:root {
  /* palette sampled from the banner photo: dark rock shadow, warm stone, sky-blue, rust rock stain */
  --bg: #1a1714;
  --surface: #241f1a;
  --surface-2: #2d2721;
  --border: #3f382f;
  --text: #ece6da;
  --muted: #a39a8c;
  --teal: #86a9c4;
  --rust: #c17d44;
  --radius: 3px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

h1, h2, h3, h4 {
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.5em;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono {
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.02em;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

/* ---------- Header / nav ---------- */

header.site-header {
  position: relative;
  border-bottom: 1px solid var(--border);
  background:
    linear-gradient(180deg, rgba(26,23,20,0.9), rgba(26,23,20,0.98)),
    var(--bg);
  overflow: visible;
}

header.site-header.has-banner {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

header.site-header.has-banner::before { display: none; }

header.site-header.has-banner .header-inner {
  padding-top: 42px;
  padding-bottom: 36px;
}

header.site-header::before {
  /* topographic / bathymetric contour lines: fjord depth meets mountain elevation */
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image:
    repeating-radial-gradient(ellipse at 15% 30%, transparent 0, transparent 18px, var(--teal) 19px, transparent 20px, transparent 46px),
    repeating-radial-gradient(ellipse at 85% 70%, transparent 0, transparent 22px, var(--rust) 23px, transparent 24px, transparent 52px);
  pointer-events: none;
}

.header-inner {
  position: relative;
  padding: 22px 0 16px;
}

header.site-header .header-inner {
  padding-left: 28px;
  padding-right: 28px;
}

.brand-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.brand a {
  color: var(--text);
  font-family: "Space Grotesk", system-ui, sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
}
.brand a:hover { text-decoration: none; color: var(--teal); }

.tagline {
  color: var(--muted);
  font-size: 0.8rem;
}

nav.menu {
  margin-top: 14px;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  text-transform: lowercase;
}

nav.menu a { color: var(--muted); }
nav.menu a:hover, nav.menu a.active { color: var(--teal); text-decoration: none; }
nav.menu .admin-link { margin-left: auto; }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  padding: 6px 11px;
  border-radius: var(--radius);
  cursor: pointer;
}
.nav-toggle:hover { border-color: var(--teal); color: var(--teal); }

/* ---------- Post grid (landing page) ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin: 28px 0 60px;
}

.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--surface);
  display: block;
}

.tile img, .tile video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.tile:hover img, .tile:hover video { transform: scale(1.04); }

.tile .no-cover {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.tile .overlay {
  position: absolute;
  inset: auto 0 0 0;
  padding: 10px 12px;
  background: linear-gradient(0deg, rgba(26,23,20,0.92), rgba(26,23,20,0));
  color: var(--text);
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.tile:hover .overlay { opacity: 1; transform: translateY(0); }

.tile .overlay .date {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  display: block;
  margin-top: 2px;
}

.empty-state {
  color: var(--muted);
  padding: 60px 0;
  text-align: center;
}

/* ---------- Post / page content ---------- */

article.post, .page-content {
  max-width: 720px;
  margin: 40px auto;
}

article.post .meta, .page-content .meta {
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  margin-bottom: 18px;
}

article.post .cover-media img,
article.post .cover-media video {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 24px;
}

.content-body img, .content-body video {
  max-width: 100%;
  border-radius: var(--radius);
  margin: 18px 0;
}

.content-body pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  overflow-x: auto;
}

.content-body code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.88em;
}

/* ---------- Forms / admin ---------- */

.admin-wrap { max-width: 780px; margin: 40px auto; }

.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

input[type=text], input[type=password], input[type=date], input[type=number], textarea, select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.95rem;
}

textarea { min-height: 320px; font-family: "IBM Plex Mono", monospace; font-size: 0.88rem; resize: vertical; }

input:focus, textarea:focus, select:focus, button:focus, a:focus {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.btn {
  display: inline-block;
  background: var(--teal);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn:hover { text-decoration: none; opacity: 0.9; }
.btn.secondary { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn.danger { background: var(--rust); color: #fff; }

.upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.upload-row input[type=file] { flex: 1; min-width: 200px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }

table.admin-list { width: 100%; border-collapse: collapse; margin-top: 12px; }
table.admin-list th, table.admin-list td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
table.admin-list th { color: var(--muted); font-family: "IBM Plex Mono", monospace; font-weight: 400; font-size: 0.75rem; text-transform: uppercase; }
table.admin-list .row-actions { display: flex; gap: 12px; }
table.admin-list .draft-tag { color: var(--rust); font-family: "IBM Plex Mono", monospace; font-size: 0.7rem; }

.error-msg { color: var(--rust); margin-bottom: 14px; font-size: 0.9rem; }

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 44px;
}

footer.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0 40px;
  color: var(--muted);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.75rem;
}

@media (max-width: 700px) {
  header.site-header.has-banner .header-inner {
    padding-top: 24px;
    padding-bottom: 18px;
  }

  .nav-toggle { display: block; }

  nav.menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    min-width: 200px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    box-shadow: 0 12px 28px rgba(0,0,0,0.45);
    z-index: 50;
  }
  nav.menu.open { display: flex; }
  nav.menu a { padding: 8px 4px; width: 100%; }
  nav.menu .admin-link { margin-left: 0; }
}

@media (max-width: 480px) {
  .wrap { padding: 0 14px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
