/* ============================================================
   Brennan Riddell - Nocturne Earth
   Dark-first editorial surfaces with moss, clay, and field-note accents.
   ============================================================ */

:root {
  color-scheme: dark;
  --bg: #171319;
  --surface: #272128;
  --surface-raised: #312a31;
  --ink: #f5eee8;
  --text: #e9e0da;
  --muted: #c2b4ae;
  --faint: #9f918c;
  --border: #433a40;
  --border-strong: #5b4f56;
  --accent: #a8c686;
  --accent-2: #bfd9a4;
  --accent-contrast: #171319;
  --accent-soft: rgba(168, 198, 134, 0.14);
  --warm: #d47a5b;
  --sage: #a8c686;
  --clay: #d47a5b;
  --violet: #b9a3d1;
  --gold: #d2b36a;
  --mpala: #a8c686;
  --loita: #d47a5b;
  --map-frame: #1e1a20;
  --code-bg: #211c22;
  --radius: 6px;
  --radius-sm: 4px;
  --max: 1280px;
  --read: 900px;
  --font: Arial, Helvetica, sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f7f2ec;
  --surface: #fffcf8;
  --surface-raised: #eee7df;
  --ink: #30282b;
  --text: #3d3437;
  --muted: #74666a;
  --faint: #93858a;
  --border: #ddd1c9;
  --border-strong: #c4b4ab;
  --accent: #587346;
  --accent-2: #6f8d5b;
  --accent-contrast: #ffffff;
  --accent-soft: rgba(88, 115, 70, 0.12);
  --warm: #b8583c;
  --sage: #587346;
  --clay: #b8583c;
  --violet: #745f8b;
  --gold: #8b6b21;
  --mpala: #587346;
  --loita: #b8583c;
  --map-frame: #eee7df;
  --code-bg: #eee7df;
}

/* Per-room accents stay within the Nocturne Earth family. */
.page-home, .room-home         { --accent: var(--sage); --accent-2: #bfd9a4; --accent-soft: rgba(168,198,134,.14); }
.page-science, .room-science   { --accent: var(--sage); --accent-2: #bfd9a4; --accent-soft: rgba(168,198,134,.14); }
.page-videos, .room-videos     { --accent: var(--clay); --accent-2: #e89475; --accent-soft: rgba(212,122,91,.14); }
.page-gear, .room-gear         { --accent: #d69a62; --accent-2: #e7b481; --accent-soft: rgba(214,154,98,.14); }
.page-projects, .room-projects { --accent: var(--violet); --accent-2: #cbb8de; --accent-soft: rgba(185,163,209,.14); }
.page-journal, .room-journal   { --accent: var(--gold); --accent-2: #e0c681; --accent-soft: rgba(210,179,106,.14); }
.page-gallery, .room-gallery   { --accent: var(--clay); --accent-2: #e89475; --accent-soft: rgba(212,122,91,.14); }
.page-contact, .room-contact  { --accent: var(--sage); --accent-2: #bfd9a4; --accent-soft: rgba(168,198,134,.14); }
.page-support, .room-support  { --accent: var(--gold); --accent-2: #e0c681; --accent-soft: rgba(210,179,106,.14); }

[data-theme="light"] .page-home, [data-theme="light"] .room-home,
[data-theme="light"] .page-science, [data-theme="light"] .room-science { --accent: #587346; --accent-2: #6f8d5b; --accent-soft: rgba(88,115,70,.12); }
[data-theme="light"] .page-videos, [data-theme="light"] .room-videos,
[data-theme="light"] .page-gallery, [data-theme="light"] .room-gallery { --accent: #b8583c; --accent-2: #9f482f; --accent-soft: rgba(184,88,60,.12); }
[data-theme="light"] .page-gear, [data-theme="light"] .room-gear { --accent: #9a5f2d; --accent-2: #7e4a20; --accent-soft: rgba(154,95,45,.12); }
[data-theme="light"] .page-projects, [data-theme="light"] .room-projects { --accent: #745f8b; --accent-2: #604c76; --accent-soft: rgba(116,95,139,.12); }
[data-theme="light"] .page-journal, [data-theme="light"] .room-journal { --accent: #80601d; --accent-2: #684c13; --accent-soft: rgba(128,96,29,.12); }
[data-theme="light"] .page-contact { --accent: #587346; --accent-2: #6f8d5b; --accent-soft: rgba(88,115,70,.12); }
[data-theme="light"] .page-support { --accent: #80601d; --accent-2: #684c13; --accent-soft: rgba(128,96,29,.12); }

/* ---------- Base ---------- */
* { box-sizing: border-box; }

html {
  overflow-y: scroll;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 160ms ease, color 160ms ease;
}

h1, h2, h3, h4 {
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

a { color: inherit; }

img { max-width: 100%; }

/* ---------- Layout ---------- */
.site-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 40px), var(--max));
  margin: 0 auto;
  padding: 0 0 64px;
}

/* ---------- Header ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: clamp(25px, 2.3vw, 34px) 0;
  margin-bottom: clamp(32px, 3vw, 46px);
  border-bottom: 1px solid var(--border);
}

.topnav {
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  justify-content: center;
}

.topnav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 1rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease;
}

.topnav a:hover { color: var(--ink); background: var(--accent-soft); }
.topnav a.is-active { color: var(--accent); background: var(--accent-soft); }
.topnav a.nav-support { border: 1px solid var(--border-strong); color: var(--ink); }
.topnav a.nav-support:hover, .topnav a.nav-support.is-active { border-color: var(--gold); color: var(--gold); background: color-mix(in srgb, var(--gold) 10%, transparent); }

.theme-toggle {
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.84rem;
  cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.footer-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 0;
}
.post-shell > .footer-controls { padding: 28px 0 0; border-top: 1px solid var(--border); }

/* ---------- Buttons ---------- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.button-primary { background: var(--accent); color: var(--accent-contrast); }
.button-primary:hover { background: var(--accent-2); }

.button-ghost { border-color: var(--border-strong); background: var(--surface); color: var(--ink); }
.button-ghost:hover { border-color: var(--ink); }

.button-support { border-color: var(--border-strong); background: var(--surface); color: var(--warm); }
.button-support:hover { border-color: var(--warm); }
.button.is-disabled, .support-method-link[aria-disabled="true"] { opacity: .58; pointer-events: none; cursor: not-allowed; }

.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

/* ---------- Eyebrow / lede ---------- */
.eyebrow,
.section-kicker,
.post-context,
.portal-tag,
.entry-type,
.orbit-label,
.metric-label {
  margin: 0 0 8px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--accent);
}

.lede {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.6;
  color: var(--muted);
}

/* ---------- Home ---------- */
.landing-main { display: block; }

.page-home-minimal .landing-links,
.page-home-responsive .landing-links { display: none; }
.portrait-square-option .landing-portrait { border-radius: var(--radius); }

.landing-hero {
  display: grid;
  align-items: center;
  max-width: none;
  min-height: min(68vh, 720px);
  padding: clamp(56px, 7vw, 110px) 0 clamp(44px, 6vw, 84px);
}

.landing-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, .52fr);
  grid-template-areas:
    "title portrait"
    "description portrait";
  gap: 18px clamp(48px, 8vw, 140px);
  align-items: center;
}

.landing-title { grid-area: title; min-width: 0; }
.landing-description { grid-area: description; min-width: 0; max-width: 54rem; }

.landing-portrait {
  grid-area: portrait;
  justify-self: end;
  width: clamp(230px, 23vw, 360px);
  aspect-ratio: 1;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 18px 48px color-mix(in srgb, var(--ink) 12%, transparent);
}

.landing-portrait img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 42% 39%;
  transform: scale(1.28);
  transform-origin: 42% 39%;
}

.landing-hero h1 {
  margin: 0;
  font-size: clamp(3.2rem, 7vw, 6.6rem);
  font-weight: 700;
  line-height: .94;
  letter-spacing: -.055em;
}

.landing-title .eyebrow { margin-bottom: 18px; font-weight: 700; }
.landing-description .lede { font-size: clamp(1.05rem, 1.55vw, 1.35rem); line-height: 1.55; }
.landing-description .lede + .lede { margin-top: 12px; }

.landing-social {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 26px;
}

.landing-links {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 8px;
}

.portal-card {
  display: block;
  min-height: 188px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: 0 16px 42px color-mix(in srgb, var(--bg) 35%, transparent);
  backdrop-filter: blur(8px);
  text-decoration: none;
  color: inherit;
  transition: border-color 160ms ease, transform 160ms ease;
}

.portal-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }

.portal-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--muted);
}

.portal-tag::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-2);
}

.portal-card h3 { margin: 0; font-size: 1.14rem; font-weight: 700; }
.portal-card p { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }

/* ---------- Subpage scaffold ---------- */
.subpage { display: grid; gap: clamp(28px, 3.2vw, 40px); }
.blank-page { min-height: clamp(260px, 48vh, 620px); }

.subpage-hero { width: 100%; max-width: none; padding: 0; }
.subpage-hero h1 {
  max-width: none;
  margin: 0 0 12px;
  font-size: clamp(2.15rem, 3.7vw, 3.55rem);
  text-wrap: normal;
}
.subpage-hero .lede {
  max-width: none;
  font-size: clamp(1.08rem, calc(.45vw + 1rem), 1.28rem);
  text-wrap: pretty;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(240px, 0.9fr);
  gap: 22px;
  align-items: start;
}

.feature-panel,
.stack-panel {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.feature-panel h2 { margin: 0 0 12px; font-size: 1.5rem; }
.feature-panel p,
.stack-panel li { color: var(--muted); }

.plain-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; }

.section-heading { margin-bottom: 20px; max-width: none; }
.section-heading h2 { margin: 0; font-size: clamp(1.4rem, 3vw, 2rem); }

.cards-section { display: block; }

/* ---------- Entry cards ---------- */
.entry-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.entry-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: border-color 160ms ease;
}

.entry-card:hover { border-color: var(--border-strong); }
.entry-card h3 { margin: 0 0 8px; font-size: 1.1rem; }
.entry-card p { margin: 0; color: var(--muted); font-size: 0.94rem; }

.entry-type {
  display: inline-block;
  margin-bottom: 12px;
  padding: 0;
  background: none;
}

.category-lab-note { color: var(--sage); }
.category-reading-note { color: var(--violet); }
.category-method { color: var(--gold); }

.entry-card h3 a,
.prose a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
  text-underline-offset: 0.18em;
  transition: text-decoration-color 150ms ease;
}
.entry-card h3 a:hover,
.prose a:hover { text-decoration-color: var(--accent); }

/* ---------- Publications ---------- */
.reference-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
  max-width: var(--read);
}
.reference-list li { padding: 16px 0; border-bottom: 1px solid var(--border); }
.reference-list .ref-title { display: block; margin-bottom: 4px; font-weight: 500; }
.reference-list .ref-meta { font-size: 0.92rem; color: var(--muted); }

/* ---------- Videos ---------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.video-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.video-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #1c2a30;
}
.video-embed iframe,
.video-embed img,
.video-embed .video-placeholder {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  object-fit: cover;
}
.video-placeholder {
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 500;
}
.video-poster {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  color: #fff;
  text-decoration: none;
}
.video-poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 48%, rgba(10, 15, 17, 0.58));
  transition: background 160ms ease;
}
.video-poster:hover::after { background: linear-gradient(180deg, rgba(10, 15, 17, 0.05), rgba(10, 15, 17, 0.68)); }
.video-poster img { width: 100%; height: 100%; object-fit: cover; }
.video-play {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: 64px;
  height: 46px;
  padding-left: 3px;
  border-radius: 12px;
  background: rgba(209, 53, 47, 0.94);
  box-shadow: 0 5px 18px rgba(0,0,0,.28);
  transform: translate(-50%, -50%);
  transition: transform 160ms ease, background 160ms ease;
}
.video-poster:hover .video-play { background: #f94144; transform: translate(-50%, -50%) scale(1.06); }
.video-watch-label {
  position: absolute;
  z-index: 1;
  left: 16px;
  bottom: 13px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.video-meta { padding: 16px 18px; }
.video-meta h3 { margin: 0 0 5px; font-size: 1.05rem; }
.video-meta p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.video-meta .status-badge { margin-bottom: 10px; }
.video-meta h3 a { text-decoration: none; }
.video-meta h3 a:hover { color: var(--accent); }
.video-card-wide { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(250px, .8fr); }
.video-card-wide .video-meta { display: flex; flex-direction: column; justify-content: center; padding: 24px; }

/* ---------- Gear / Projects ---------- */
.gear-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.gear-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.gear-thumb {
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 600;
}
.gear-card h3 { margin: 0; font-size: 1.05rem; }
.gear-card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.gear-tag {
  align-self: flex-start;
  margin-top: auto;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ---------- Concrete content system ---------- */
.section-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}

.section-jump a {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
}

.section-jump a:hover { color: var(--accent); border-color: var(--accent); }

.section-heading-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  max-width: none;
}

.section-note,
.gallery-count {
  margin: 0 0 3px;
  color: var(--faint);
  font-size: 0.86rem;
  text-align: right;
}

.gear-grid-featured { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.gear-card-link { overflow: hidden; }
.gear-card-link > *:not(.card-hit) { position: relative; z-index: 1; pointer-events: none; }
.card-hit { position: absolute; inset: 0; z-index: 2; }
.gear-card-link:hover { border-color: var(--accent); transform: translateY(-2px); }

.gear-thumb {
  overflow: hidden;
  position: relative;
  min-height: 170px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface-raised)), var(--accent-soft));
}

.gear-thumb::after {
  content: "";
  position: absolute;
  width: 78%;
  height: 45%;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, transparent);
  border-radius: 50%;
  transform: rotate(-10deg);
}

.gear-thumb span,
.gear-thumb small { position: relative; z-index: 1; }
.gear-thumb span { font-size: 1.7rem; letter-spacing: -0.04em; }
.gear-thumb small { margin-left: 6px; font-size: 0.65rem; }
.gear-thumb-winter { background: linear-gradient(145deg, color-mix(in srgb, var(--sage) 24%, var(--surface-raised)), var(--surface)); }
.gear-thumb-booties { background: linear-gradient(145deg, color-mix(in srgb, var(--clay) 26%, var(--surface-raised)), var(--surface)); }
.gear-thumb-camera { background: linear-gradient(145deg, color-mix(in srgb, var(--violet) 22%, var(--surface-raised)), var(--surface)); }
.gear-thumb-overboot { background: linear-gradient(145deg, color-mix(in srgb, var(--sage) 18%, var(--surface-raised)), var(--surface)); }
.gear-thumb-wind { background: linear-gradient(145deg, color-mix(in srgb, var(--gold) 22%, var(--surface-raised)), var(--surface)); }
.gear-thumb-rain { background: linear-gradient(145deg, color-mix(in srgb, var(--violet) 18%, var(--surface-raised)), var(--surface)); }

.status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--faint);
  font-size: 0.78rem;
}

.status-badge {
  align-self: flex-start;
  display: inline-flex;
  width: fit-content;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
}

.status-badge.is-complete { background: color-mix(in srgb, var(--sage) 14%, transparent); color: var(--sage); }
.status-badge.is-progress { background: color-mix(in srgb, var(--violet) 14%, transparent); color: var(--violet); }
.status-badge.is-planned { background: rgba(97, 105, 110, 0.10); color: var(--muted); }

.text-link {
  margin-top: auto;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
}
.text-link.is-muted { color: var(--faint); }

.organizing-note {
  max-width: var(--read);
  padding: 28px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
}
.organizing-note h2 { margin: 0 0 10px; font-size: 1.45rem; }
.organizing-note p:last-child { margin: 0; color: var(--muted); }

/* ---------- Research ---------- */
.science-hero { max-width: none; }
.science-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 9px;
  margin: 0 0 12px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: 0.035em;
}
.science-meta a { color: var(--accent); text-decoration: none; }
.science-meta a:hover { text-decoration: underline; text-underline-offset: .18em; }
.science-meta-separator { color: var(--faint); }

.research-aim {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 28px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.aim-number {
  display: grid;
  place-items: center;
  min-height: 108px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.research-aim h2 { margin: 0 0 10px; font-size: clamp(1.4rem, 3vw, 2rem); }
.research-aim p:last-child { margin: 0; color: var(--muted); }

.aim-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.aim-card { padding: 18px 22px; }
.aim-card + .aim-card { border-left: 1px solid var(--border); }
.aim-card h3 {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 .34em;
  margin: 0 0 7px;
  font-size: 1.08rem;
}
.aim-card-number { color: var(--accent); font: inherit; letter-spacing: .04em; }
.aim-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

.field-research-section {
  display: grid;
  gap: 20px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
.field-research-heading {
  max-width: none;
  padding-left: 18px;
  border-left: 3px solid var(--accent);
}
.field-research-heading h2 { margin-bottom: 0; }
.map-section { display: grid; gap: 14px; }
.field-research-sightings {
  display: grid;
  gap: 14px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.research-map-frame {
  height: min(70vh, 670px);
  min-height: 480px;
  overflow: hidden;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--map-frame);
}
.research-map-frame iframe { display: block; width: 100%; height: 100%; border: 0; }

.site-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px;
  margin-top: 14px;
}
.field-sites-panel[hidden] { display: none; }
.field-site-card {
  --site-color: var(--accent);
  overflow: hidden;
  border: 1px solid var(--border);
  border-top: 3px solid var(--site-color);
  border-radius: var(--radius);
  background: var(--surface);
}
.field-site-card[data-site="mpala"] { --site-color: var(--mpala); }
.field-site-card[data-site="loita"] { --site-color: var(--loita); }
.field-site-card summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 92px;
  padding: 20px;
  cursor: pointer;
  list-style: none;
}
.field-site-card summary::-webkit-details-marker { display: none; }
.field-site-card summary:hover { background: color-mix(in srgb, var(--site-color) 10%, transparent); }
.field-site-card summary:focus-visible { outline: 3px solid color-mix(in srgb, var(--site-color) 40%, transparent); outline-offset: -3px; }
.site-country {
  display: block;
  margin: 0 0 8px;
  color: var(--site-color);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.field-site-title { display: block; color: var(--ink); font-size: 1.04rem; font-weight: 700; }
.field-site-toggle {
  display: grid;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--site-color);
  font-size: 1.3rem;
  line-height: 1;
  transition: transform 160ms ease;
}
.field-site-card[open] .field-site-toggle { transform: rotate(45deg); }
.field-site-body { padding: 0 20px 20px; border-top: 1px solid var(--border); }
.field-site-body > p { margin: 18px 0 0; color: var(--muted); font-size: 0.9rem; }
.field-site-gallery {
  display: block;
  margin-top: 18px;
}
.field-site-gallery[hidden] { display: none; }
.field-media-carousel:focus-visible { outline: 2px solid var(--site-color); outline-offset: 4px; }
.field-media-viewport { overflow: hidden; }
.field-media-slide { margin: 0; }
.field-media-slide[hidden] { display: none; }
.field-site-gallery img,
.field-site-gallery video {
  display: block;
  width: 100%;
  max-height: min(68vh, 760px);
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: calc(var(--radius) - 3px);
  background: var(--bg);
}
.field-site-gallery figcaption { margin-top: 7px; color: var(--muted); font-size: 0.78rem; line-height: 1.45; }
.field-media-controls {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
.field-media-controls button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--ink);
  font: 600 1rem/1 var(--font);
  cursor: pointer;
}
.field-media-controls button:hover { border-color: var(--site-color); color: var(--site-color); }
.field-media-controls button:focus-visible { outline: 2px solid var(--site-color); outline-offset: 2px; }
.field-media-controls span { color: var(--faint); font-size: .74rem; text-align: center; }

/* ---------- Animal sightings ---------- */
.section-intro { margin: 10px 0 0; color: var(--muted); }
.sightings-panel {
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.sightings-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  padding: 11px 16px;
  cursor: pointer;
  list-style: none;
  border-left: 3px solid color-mix(in srgb, var(--accent) 60%, transparent);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  transition: background-color .16s ease;
}
.sightings-panel > summary::-webkit-details-marker { display: none; }
.sightings-panel > summary:hover { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.sightings-panel[open] > summary .field-site-toggle { transform: rotate(45deg); }
.sightings-panel > summary > span:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 13px;
}
.sightings-summary-title { display: block; color: var(--ink); font-size: .96rem; font-weight: 700; }
.sightings-summary-count { display: block; margin: 0; color: var(--muted); font-size: .78rem; }
.sightings-summary-action {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--border-strong));
  border-radius: 999px;
  background: var(--accent-soft);
  color: color-mix(in srgb, var(--accent) 80%, var(--ink));
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.sightings-summary-action .when-open { display: none; }
.sightings-panel[open] .sightings-summary-action .when-closed { display: none; }
.sightings-panel[open] .sightings-summary-action .when-open { display: inline; }
.sightings-body { padding: 16px; border-top: 1px solid var(--border); }
.sightings-overview {
  display: grid;
  grid-template-columns: minmax(0,1.5fr) minmax(390px,.8fr);
  gap: 18px 28px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.sightings-metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
.sighting-metric { min-height: 58px; padding: 8px 10px; border-left: 2px solid var(--accent); background: var(--accent-soft); }
.sighting-metric strong { display: block; color: var(--ink); font-size: 1rem; line-height: 1.1; }
.sighting-metric span { display: block; margin-top: 4px; color: var(--muted); font-size: .62rem; line-height: 1.25; text-transform: uppercase; letter-spacing: .065em; }
.phylogeny-introduction {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}
.phylogeny-introduction .section-kicker { margin-bottom: 5px; }
.phylogeny-introduction p:last-child { max-width: none; margin: 0; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.sightings-toolbar { display: grid; grid-template-columns: minmax(170px,1.3fr) repeat(3,minmax(125px,.68fr)) auto; gap: 10px; align-items: end; margin: 14px 0 0; }
.sightings-toolbar label { display: grid; gap: 6px; color: var(--muted); font-size: .76rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.sightings-toolbar input,
.sightings-toolbar select,
.sightings-view button {
  min-height: 40px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.sightings-toolbar input,
.sightings-toolbar select { width: 100%; padding: 8px 10px; }
.sightings-view { display: flex; gap: 5px; }
.sightings-view button { padding: 8px 11px; cursor: pointer; }
.sightings-view button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-contrast); }
.sightings-result-count { margin: 12px 0 6px; color: var(--faint); font-size: .75rem; }
.sightings-list { width: 100%; border-top: 1px solid var(--border); }
.sightings-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .78rem; }
.sightings-table caption.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.sightings-table th {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-strong);
  color: var(--faint);
  font-size: .64rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-align: left;
  text-transform: uppercase;
}
.sightings-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.sightings-table tbody tr { box-shadow: inset 2px 0 0 var(--border-strong); transition: background-color .15s ease; }
.sightings-table tbody tr[data-site-accent="mpala"] { box-shadow: inset 2px 0 0 var(--mpala); }
.sightings-table tbody tr[data-site-accent="loita"] { box-shadow: inset 2px 0 0 var(--loita); }
.sightings-table tbody tr:hover { background: var(--accent-soft); }
.sightings-table th:nth-child(1) { width: 29%; }
.sightings-table th:nth-child(2) { width: 17%; }
.sightings-table th:nth-child(3) { width: 24%; }
.sightings-table th:nth-child(4) { width: 13%; }
.sightings-table th:nth-child(5) { width: 17%; }
.sightings-animal { display: flex; align-items: center; gap: 9px; min-width: 0; }
.sightings-table-photo { flex: 0 0 32px; width: 32px; height: 32px; object-fit: cover; border-radius: 2px; }
.sightings-animal-names { display: grid; min-width: 0; gap: 1px; }
.sightings-animal-names strong { overflow: hidden; color: var(--ink); font-size: .82rem; line-height: 1.25; text-overflow: ellipsis; white-space: nowrap; }
.sightings-animal-names em { overflow: hidden; color: var(--muted); font-size: .72rem; line-height: 1.2; text-overflow: ellipsis; white-space: nowrap; }
.sightings-cell-taxonomy { color: var(--muted); }
.sightings-cell-taxonomy span,
.sightings-cell-taxonomy em { display: block; }
.sightings-cell-taxonomy em { margin-top: 2px; color: var(--text); }
.sightings-cell-location { color: var(--muted); line-height: 1.35; }
.sighting-status { flex: 0 0 auto; padding: 3px 7px; border-radius: 999px; color: var(--muted); background: var(--surface-raised); font-size: .67rem; letter-spacing: .05em; text-transform: uppercase; }
.status-include { color: var(--sage); background: color-mix(in srgb, var(--sage) 12%, transparent); }
.status-provisional { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.status-needs-review { color: var(--clay); background: color-mix(in srgb, var(--clay) 12%, transparent); }
.sighting-inat { color: var(--accent); font-size: .72rem; text-underline-offset: .18em; }
.sighting-notes { margin-top: 3px; color: var(--muted); font-size: .7rem; }
.sighting-notes summary { cursor: pointer; color: var(--muted); }
.sighting-notes p { margin: 5px 0 0; line-height: 1.4; }
.sightings-mobile-meta,
.sightings-mobile-link { display: none; }
.sightings-table-empty { padding: 18px !important; color: var(--muted); text-align: center; }
.sightings-tree { display: grid; gap: 18px; margin-top: 10px; }
.sightings-tree[hidden], .sightings-list[hidden] { display: none; }
.phylogeny-meta { display: flex; flex-wrap: wrap; gap: 7px 16px; color: var(--faint); font-size: .76rem; }
.phylogeny-meta > * + *::before { content: "·"; margin-right: 16px; color: var(--border-strong); }
.phylogeny-source-link { color: var(--accent); text-underline-offset: .18em; }
.phylogeny-scroll {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-top: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
}
.phylogeny-svg { display: block; width: 100%; height: auto; max-width: 100%; font-family: var(--font); }
.phylogeny-links path { fill: none; stroke: var(--border-strong); stroke-width: 1.1; }
.phylogeny-nodes circle { fill: var(--surface); stroke: var(--faint); stroke-width: 1.2; }
.phylogeny-nodes g:not([data-status="internal"]) circle { fill: var(--accent); stroke: var(--bg); stroke-width: 1.6; }
.phylogeny-nodes g[data-status="Provisional"] circle { fill: var(--gold); }
.phylogeny-nodes g[data-status="Needs review"] circle { fill: var(--clay); }
.phylogeny-nodes text { fill: var(--text); font-size: 11px; }
.phylogeny-svg.is-dense .phylogeny-nodes text { font-size: 8.5px; }
.phylogeny-common { font-weight: 600; }
.phylogeny-scientific { fill: var(--muted); font-style: italic; font-weight: 400; }
.phylogeny-empty { margin: 0; padding: 18px; border-top: 1px solid var(--border); color: var(--muted); }
.taxon-class { border-top: 2px solid var(--accent); }
.taxon-class > h3 { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 13px 4px; font-size: 1.05rem; }
.taxon-class > h3 span { color: var(--faint); font-size: .82rem; font-weight: 400; }
.taxon-branch { border-top: 1px solid var(--border); }
.taxon-branch > summary { display: flex; justify-content: space-between; gap: 12px; padding: 10px 4px; cursor: pointer; color: var(--ink); }
.taxon-branch > summary span:last-child { color: var(--faint); }
.taxon-branch ul { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px 20px; margin: 0 0 14px; padding-left: 24px; color: var(--muted); font-size: .86rem; }
.taxon-branch em { color: var(--text); }

.publication-card {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 24px;
  max-width: none;
  padding: 26px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.publication-year { color: var(--accent); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; }
.publication-card h3 { margin: 0 0 10px; font-size: 1.2rem; }
.publication-authors, .publication-meta { margin: 0 0 8px; color: var(--muted); font-size: 0.9rem; }
.publication-links { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 15px; }
.publication-links a { color: var(--accent); font-size: 0.86rem; font-weight: 600; text-underline-offset: 0.18em; }
.recommended-reading {
  display: grid;
  grid-template-columns: minmax(210px, .8fr) minmax(0, 1.5fr) auto;
  gap: 24px;
  align-items: start;
  padding: 22px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.recommended-reading h2 { margin: 0 0 6px; font-size: 1rem; }
.recommended-reading p { margin: 0; color: var(--muted); font-size: .86rem; line-height: 1.55; }
.recommended-reading-links { display: grid; gap: 8px; }
.recommended-reading-links a {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 5px 12px;
  color: var(--ink);
  font-size: .86rem;
  font-weight: 600;
  text-decoration-color: var(--border-strong);
  text-underline-offset: .18em;
}
.recommended-reading-links a:hover { color: var(--accent); }
.recommended-reading-links span { color: var(--faint); font-weight: 400; }
.recommended-reading .button { align-self: center; justify-self: center; }
.button-science-action {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border-strong));
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  color: color-mix(in srgb, var(--accent) 80%, var(--ink));
}
.button-science-action:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, var(--surface));
  color: var(--ink);
}
.field-research-note {
  margin: 16px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.65;
}
.field-research-note strong { color: var(--ink); }

/* ---------- Contact and support ---------- */
.support-page, .contact-page { max-width: none; }
.support-page > .subpage-hero,
.contact-page > .subpage-hero { text-align: center; }
.support-page > .subpage-hero .lede,
.contact-page > .subpage-hero .lede {
  max-width: 78ch;
  margin-inline: auto;
}
.contact-page > .subpage-hero .hero-actions { justify-content: center; }
.support-method-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 14px;
}
.support-method {
  display: flex;
  min-height: 280px;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: center;
}
.support-method.is-primary { border-top: 3px solid var(--gold); }
.support-method h2 { margin: 0 0 10px; font-size: 1.3rem; }
.support-method > p:not(.section-kicker) { max-width: 34ch; margin: 0 auto 22px; color: var(--muted); }
.support-method .button { align-self: center; margin-top: auto; }
.support-note, .contact-card {
  width: min(100%, 780px);
  max-width: 780px;
  margin-inline: auto;
  padding: clamp(20px, 3vw, 28px);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent-soft);
}
.support-note h2 { margin: 0 0 10px; font-size: 1.4rem; }
.support-note p, .contact-card p { color: var(--muted); }
.support-note p:last-child { margin-bottom: 0; }
.support-note { text-align: center; }
.support-note p { max-width: 76ch; margin-inline: auto; }
.contact-hero { padding-bottom: clamp(18px, 3vw, 30px); text-align: center; }
.contact-hero h1 { margin-bottom: 0; }

.contact-form {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 0;
}
.contact-field { display: grid; gap: 7px; }
.contact-field-wide { grid-column: 1 / -1; }
.contact-field label {
  color: var(--ink);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .02em;
}
.contact-field input,
.contact-field select,
.contact-field textarea {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.contact-field input,
.contact-field select { min-height: 46px; padding: 8px 11px; }
.contact-field textarea { min-height: 150px; padding: 11px; line-height: 1.55; resize: vertical; }
.contact-field input:hover,
.contact-field select:hover,
.contact-field textarea:hover { border-color: var(--accent); }
.contact-field input:focus,
.contact-field select:focus,
.contact-field textarea:focus { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.contact-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px; }
.contact-actions span { color: var(--faint); font-size: .78rem; }
.contact-status {
  display: grid;
  gap: 3px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.contact-status strong { color: var(--ink); }
.contact-status span, .contact-status li { color: var(--muted); font-size: .9rem; }
.contact-status ul { margin: 4px 0 0; padding-left: 18px; }
.contact-status[hidden] { display: none; }
.contact-status.is-success { border-color: var(--sage); }
.contact-status.is-error { border-color: var(--warm); }
.contact-privacy { max-width: 80ch; margin: 18px auto 0; padding-top: 14px; border-top: 1px solid var(--border); font-size: .76rem; text-align: center; }
.contact-trap { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

.custom-gear-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
  padding: clamp(26px, 4vw, 48px);
  border: 1px solid color-mix(in srgb, var(--accent) 44%, var(--border));
  border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 78%, var(--surface)), var(--surface));
}
.custom-gear-panel h2 { margin: 0 0 14px; font-size: clamp(1.55rem, 3vw, 2.35rem); }
.custom-gear-panel p { margin: 0; max-width: 760px; color: var(--muted); }
.custom-gear-terms { display: grid; gap: 16px; }
.custom-gear-terms ul { display: grid; gap: 9px; margin: 0; padding-left: 19px; color: var(--muted); font-size: .92rem; }
.custom-gear-terms .button { justify-self: start; }
.custom-gear-terms small { color: var(--faint); font-size: .75rem; }
.contact-field small { color: var(--faint); font-size: .75rem; line-height: 1.45; }
.contact-field label span { color: var(--faint); font-weight: 400; }
.gear-acknowledgement {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.5;
}
.gear-acknowledgement input { width: 17px; height: 17px; margin: 3px 0 0; accent-color: var(--accent); }

/* ---------- Projects ---------- */
.project-feature {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.project-visual {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 390px;
  overflow: hidden;
  background: radial-gradient(circle at center, #e7f2f4 0 2%, #c8d9df 3% 9%, #233c48 10% 11%, #132a34 12% 100%);
}
.project-visual > span { position: absolute; left: 20px; bottom: 18px; color: rgba(255,255,255,.68); font-size: .65rem; font-weight: 600; letter-spacing: .12em; }
.vacuum-ring { position: absolute; border: 1px solid rgba(166, 221, 233, 0.48); border-radius: 50%; }
.ring-one { width: 220px; height: 220px; }
.ring-two { width: 300px; height: 300px; border-style: dashed; }
.vacuum-core { width: 46px; height: 46px; border-radius: 50%; border: 2px solid #a9dce6; box-shadow: 0 0 38px rgba(139, 222, 239, 0.65); }
.project-copy { display: flex; flex-direction: column; justify-content: center; padding: clamp(28px, 5vw, 54px); }
.project-copy h2 { margin: 20px 0 13px; font-size: clamp(1.45rem, 3vw, 2rem); }
.project-copy > p { color: var(--muted); }
.project-note { padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.86rem; }

/* Gallery hierarchy */
.gallery-heading-row { display: flex; justify-content: space-between; align-items: end; gap: 20px; max-width: none; }
.gallery-subfilter { margin-top: -12px; padding-top: 12px; border-top: 1px solid var(--border); }
.gallery-subfilter button { padding: 6px 12px; font-size: 0.82rem; }
.gallery-subfilter button.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.gallery-item .gi-ph { aspect-ratio: 4 / 3; min-height: 190px; flex-direction: column; gap: 4px; }
.gallery-item .gi-ph small { color: var(--faint); font-size: 0.62rem; letter-spacing: 0.08em; }
.gallery-item .gi-wildlife { background: linear-gradient(145deg, color-mix(in srgb, var(--sage) 24%, var(--surface-raised)), var(--surface)); }
.gallery-item .gi-fieldwork { background: linear-gradient(145deg, color-mix(in srgb, var(--clay) 22%, var(--surface-raised)), var(--surface)); }
.gallery-item .gi-landscape { background: linear-gradient(145deg, color-mix(in srgb, var(--violet) 18%, var(--surface-raised)), var(--surface)); }
.gallery-item .gi-creative { background: linear-gradient(145deg, color-mix(in srgb, var(--violet) 24%, var(--surface-raised)), var(--surface)); }
.gallery-item .gi-paintings { background: linear-gradient(145deg, color-mix(in srgb, var(--clay) 26%, var(--surface-raised)), var(--surface)); }

/* ---------- Gallery ---------- */
.gallery-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.gallery-filter button {
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}
.gallery-filter button:hover { color: var(--ink); border-color: var(--border-strong); }
.gallery-filter button.is-active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }

.gallery-wall { columns: 2 360px; column-gap: 16px; }
.gallery-item {
  display: block;
  width: 100%;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  border-radius: 3px;
  overflow: hidden;
  background: var(--surface-raised);
  cursor: zoom-in;
  break-inside: avoid;
  transition: opacity 160ms ease;
}
.gallery-item:hover { opacity: 0.88; }
.gallery-item:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.gallery-item img { display: block; width: 100%; height: auto; }
.gallery-item .gi-ph {
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}
.gallery-empty {
  padding: 72px 24px;
  border: 1px dashed var(--border-strong);
  color: var(--muted);
  text-align: center;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  overflow: hidden;
  background: #090b0c;
}
.lightbox.is-open { display: block; }
.lb-stage {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
}
.lb-stage.is-zoomed { cursor: grab; }
.lb-stage.is-zoomed:active { cursor: grabbing; }
.lb-image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transform-origin: center;
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
}
.lightbox button {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.32);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
}
.lightbox button:hover { background: rgba(0, 0, 0, 0.68); }
.lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.lightbox .lb-close { top: 20px; right: 20px; transform: none; width: 42px; height: 42px; font-size: 1.1rem; }
.lightbox .lb-prev { left: 18px; }
.lightbox .lb-next { right: 18px; }
.lb-toolbar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  z-index: 2;
  display: flex;
  gap: 7px;
  padding: 6px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(8px);
  transform: translateX(-50%);
}
.lightbox .lb-toolbar button {
  position: static;
  width: auto;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  transform: none;
  border: 0;
  font-size: 0.78rem;
}
.lb-info {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 3;
  width: min(420px, calc(100vw - 36px));
  max-height: calc(100vh - 92px);
  overflow: auto;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(8, 10, 11, 0.82);
  color: #f4f4f2;
  backdrop-filter: blur(12px);
}
.lb-info h2 { margin: 0 0 8px; color: #fff; font-size: 1.2rem; }
.lb-info p { margin: 0 0 14px; color: #d7d9da; font-size: 0.92rem; }
.lb-info dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-size: 0.8rem; }
.lb-info dt { color: #8e9598; text-transform: uppercase; letter-spacing: 0.07em; }
.lb-info dd { margin: 0; color: #f0f1f1; }
.lightbox:fullscreen,
.lightbox:-webkit-full-screen { width: 100vw; height: 100vh; }

/* ---------- Commissioned photography ---------- */
.photography-hire-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: center;
  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding: clamp(26px, 4vw, 48px);
  border: 1px solid color-mix(in srgb, var(--accent) 44%, var(--border));
  border-radius: var(--radius);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-soft) 78%, var(--surface)), var(--surface));
}
.photography-hire-panel h2 { margin: 0 0 14px; font-size: clamp(1.55rem, 3vw, 2.35rem); }
.photography-hire-panel p { margin: 0; color: var(--muted); }
.photography-hire-action { display: grid; gap: 18px; }
.photography-hire-action .button { justify-self: start; }
.photography-inquiry-card { max-width: 1040px; }

/* ---------- Social row / footer ---------- */
.social-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: center; }

.social-link {
  font-size: 0.98rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: color 150ms ease;
}
.social-link:hover { text-decoration: underline; text-underline-offset: 0.2em; }
.social-link.is-support { color: var(--warm); }

.site-footer {
  margin-top: 56px;
  padding: 34px 0 0;
  border-top: 1px solid var(--border);
  display: grid;
  gap: 17px;
  justify-items: center;
  text-align: center;
}
.footer-note { margin: 0; color: var(--faint); font-size: 0.85rem; }

/* ---------- Ambient playground v2 ---------- */
#ambient-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 360ms ease;
}
body[data-effect]:not([data-effect="off"]) #ambient-field { opacity: 1; }

.effects-control { position: relative; }

.effects-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid color-mix(in srgb, var(--sage) 48%, var(--border-strong));
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: .84rem;
  cursor: pointer;
}
.effects-trigger:hover { color: var(--ink); border-color: var(--sage); }
.effects-trigger:focus-visible,
.effects-close:focus-visible,
.effect-options > button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.effects-glyph {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--sage) 16%, transparent);
  color: var(--sage);
  font-size: .76rem;
}
body[data-effect]:not([data-effect="off"]) .effects-glyph { animation: effects-glyph-turn 12s linear infinite; }

.effects-menu {
  position: fixed;
  z-index: 40;
  left: 50%;
  bottom: max(72px, calc(env(safe-area-inset-bottom) + 16px));
  width: min(344px, calc(100vw - 24px));
  max-height: calc(100svh - 96px);
  overflow-y: auto;
  padding: 15px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-raised) 94%, transparent);
  box-shadow: 0 24px 70px color-mix(in srgb, #000 40%, transparent);
  backdrop-filter: blur(18px);
  transform: translateX(-50%);
}
.effects-menu[hidden] { display: none; }
.effects-heading { display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 2px 2px 12px; }
.effects-heading strong, .effects-heading small { display: block; }
.effects-heading strong { color: var(--ink); font-size: .92rem; }
.effects-heading small { margin-top: 2px; color: var(--faint); font-size: .7rem; }
.effects-close {
  width: 29px;
  height: 29px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font: 400 1.3rem/1 Arial, sans-serif;
  cursor: pointer;
}
.effects-close:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.effect-options { display: grid; gap: 6px; }
.effect-options > button {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.effect-options > button:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.effect-options > button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--sage) 46%, var(--border));
  background: color-mix(in srgb, var(--sage) 9%, transparent);
}
.effect-options b, .effect-options small { display: block; }
.effect-options b { color: var(--ink); font-size: .82rem; }
.effect-options small { margin-top: 2px; color: var(--faint); font-size: .68rem; }
.effect-swatch {
  position: relative;
  display: block;
  width: 42px;
  height: 32px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--bg);
}
.swatch-off::after { content: "\2014"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); }
.swatch-geometry { background: repeating-conic-gradient(from 20deg, color-mix(in srgb, var(--sage) 78%, transparent) 0 8deg, transparent 8deg 30deg), var(--bg); }
.swatch-leaves { background: radial-gradient(ellipse at 28% 35%, var(--clay) 0 8%, transparent 9%), radial-gradient(ellipse at 70% 68%, var(--gold) 0 8%, transparent 9%), var(--bg); }
.swatch-rain { background: repeating-linear-gradient(105deg, transparent 0 7px, color-mix(in srgb, var(--text) 72%, transparent) 8px 9px, transparent 10px 17px), var(--bg); }
.swatch-tide { background: repeating-radial-gradient(ellipse at 18% 110%, transparent 0 5px, color-mix(in srgb, var(--sage) 75%, transparent) 6px 7px, transparent 8px 12px), var(--bg); }
.swatch-fireflies {
  background:
    radial-gradient(circle at 25% 35%, color-mix(in srgb, var(--gold) 92%, white) 0 3%, color-mix(in srgb, var(--gold) 28%, transparent) 4% 12%, transparent 13%),
    radial-gradient(circle at 70% 66%, color-mix(in srgb, var(--sage) 88%, white) 0 3%, color-mix(in srgb, var(--sage) 25%, transparent) 4% 13%, transparent 14%),
    var(--bg);
}
.swatch-suminagashi {
  background:
    repeating-radial-gradient(ellipse at 22% 70%, transparent 0 4px, color-mix(in srgb, var(--violet) 72%, transparent) 5px 6px, transparent 7px 10px),
    repeating-radial-gradient(ellipse at 88% 15%, transparent 0 6px, color-mix(in srgb, var(--sage) 58%, transparent) 7px 8px, transparent 9px 13px),
    var(--bg);
}
.effects-note { margin: 11px 3px 0; color: var(--faint); font-size: .66rem; }

@keyframes effects-glyph-turn { to { transform: rotate(360deg); } }

/* ---------- Posts ---------- */
.post-shell {
  position: relative;
  z-index: 1;
  width: min(calc(100% - 40px), var(--read));
  margin: 0 auto;
  padding: 0 0 64px;
}

.post-header { margin: 4px 0 22px; }
.post-header h1 { margin: 0 0 9px; font-size: clamp(1.9rem, 4vw, 2.7rem); }
.post-meta { display: flex; flex-wrap: wrap; gap: 14px; color: var(--faint); font-size: 0.9rem; }

.prose { font-size: 1.05rem; line-height: 1.75; color: var(--text); }
.prose > *:first-child { margin-top: 0; }
.prose h2 { margin: 2.2rem 0 0.7rem; font-size: 1.6rem; }
.prose h3 { margin: 1.8rem 0 0.6rem; font-size: 1.28rem; }
.prose p { margin: 0 0 1.1rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: 0.3rem 0; }
.prose blockquote {
  margin: 1.6rem 0;
  padding: 0.2rem 0 0.2rem 1.1rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
}
.prose hr { margin: 2.2rem 0; border: 0; border-top: 1px solid var(--border); }
.prose code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 0.9em; }
.prose :not(pre) > code { padding: 0.12rem 0.38rem; border-radius: 5px; background: var(--accent-soft); }
.prose pre {
  overflow-x: auto;
  padding: 16px;
  border-radius: var(--radius-sm);
  background: var(--code-bg);
  border: 1px solid var(--border);
}
.prose pre code { font-size: 0.85rem; }

.post-figure { margin: 1.8rem 0; }
.post-figure img { display: block; width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.post-figure figcaption { margin-top: 0.6rem; font-size: 0.9rem; color: var(--muted); }

/* Live embeds (maps, viz, iframes) inside posts */
.post-embed {
  margin: 1.9rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.post-embed > iframe,
.post-embed > * { display: block; width: 100%; border: 0; }
.post-embed.aspect-16-9 { aspect-ratio: 16 / 9; }
.post-embed.aspect-4-3 { aspect-ratio: 4 / 3; }
.post-embed.wide { width: min(96vw, 1000px); margin-left: 50%; transform: translateX(-50%); }
.post-embed figcaption,
.embed-caption { padding: 10px 14px; font-size: 0.88rem; color: var(--muted); border-top: 1px solid var(--border); }

.math-block { overflow-x: auto; }
.katex-display { overflow-x: auto; overflow-y: hidden; padding: 0.3rem 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .topnav { gap: 4px; }
  .topnav a { min-height: 38px; padding: 6px 10px; font-size: .95rem; }
  .sightings-overview { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .topbar { justify-content: flex-start; overflow: hidden; }
  .topnav { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { flex: 0 0 auto; }
  .content-grid,
  .entry-grid,
  .video-grid,
  .gear-grid { grid-template-columns: 1fr; }
  .entry-grid, .gear-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .aim-grid { grid-template-columns: 1fr; }
  .aim-card + .aim-card { border-left: 0; border-top: 1px solid var(--border); }
  .project-feature { grid-template-columns: 1fr; }
  .project-visual { min-height: 320px; }
  .video-card-wide { grid-template-columns: 1fr; }
  .sightings-toolbar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sightings-view { align-self: stretch; }
  .sightings-view button { flex: 1; }
  .sightings-table th:nth-child(1) { width: 38%; }
  .sightings-table th:nth-child(2) { width: 24%; }
  .sightings-table th:nth-child(4) { width: 17%; }
  .sightings-table th:nth-child(5) { width: 21%; }
  .sightings-table th:nth-child(3),
  .sightings-cell-location { display: none; }
}

@media (max-width: 760px) {
  .photography-hire-panel { grid-template-columns: 1fr; padding: 22px; }
}

/* ---------- Centered development pages ---------- */
.page-gear .subpage-hero,
.page-projects .subpage-hero,
.page-journal .subpage-hero,
.page-gallery .subpage-hero { text-align: center; }

.page-gear .subpage-hero .lede,
.page-projects .subpage-hero .lede,
.page-journal .subpage-hero .lede,
.page-gallery .subpage-hero .lede {
  max-width: 82ch;
  margin-inline: auto;
}

.page-gear .subpage-hero .hero-actions,
.page-gallery .subpage-hero .hero-actions,
.page-gear .section-jump { justify-content: center; }

.page-gear .section-heading-row,
.page-gallery .gallery-heading-row {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-align: center;
}

.page-gear .section-note,
.page-gallery .gallery-count { text-align: center; }

.page-gear .gear-card {
  align-items: center;
  text-align: center;
}
.page-gear .gear-thumb { width: 100%; }
.page-gear .status-line { width: 100%; justify-content: center; }
.page-gear .gear-tag { align-self: center; }
.page-gear .custom-gear-panel { align-items: center; text-align: center; }
.page-gear .custom-gear-terms ul {
  width: fit-content;
  max-width: 100%;
  margin-inline: auto;
  text-align: left;
}
.page-gear .custom-gear-terms .button { justify-self: center; }

.organizing-note {
  width: min(100%, var(--read));
  margin-inline: auto;
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius);
  text-align: center;
}

.page-projects .project-copy { text-align: center; }
.page-projects .project-copy .status-line { justify-content: center; }

.page-gallery .gallery-filter { justify-content: center; }
.page-gallery .photography-hire-panel { text-align: center; }
.page-gallery .photography-hire-action .button { justify-self: center; }

.journal-development {
  width: min(100%, 760px);
  margin-inline: auto;
  padding: 24px 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  text-align: center;
}
.journal-development .status-badge { margin-inline: auto; }
.journal-development h2 { margin: 12px 0 9px; }
.journal-development p { max-width: 62ch; margin: 0 auto; color: var(--muted); }

.page-gear .post-header { text-align: center; }
.page-gear .post-meta { justify-content: center; }
.post-status-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 24px;
  padding: 10px 14px;
  border-block: 1px solid var(--border);
  color: var(--muted);
  font-size: .84rem;
  text-align: center;
}
.post-status-line .status-badge { flex: 0 0 auto; }

@media (max-width: 640px) {
  .site-shell, .post-shell { width: min(calc(100% - 24px), var(--max)); }
  .page-home .topbar { display: none; }
  body:not(.page-home) .topbar { justify-content: flex-start; margin-bottom: 22px; overflow: hidden; }
  body:not(.page-home) .topnav {
    flex-wrap: nowrap;
    justify-content: flex-start;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
  }
  body:not(.page-home) .topnav::-webkit-scrollbar { display: none; }
  body:not(.page-home) .topnav a { flex: 0 0 auto; }
  .landing-hero { min-height: 0; padding: 32px 0 28px; }
  .landing-hero-grid {
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-areas:
      "portrait title"
      "description description";
    column-gap: 18px;
    row-gap: 22px;
  }
  .landing-portrait {
    width: 96px;
    justify-self: start;
  }
  .landing-hero h1 { font-size: clamp(2.15rem, 10vw, 3.35rem); }
  .landing-title .eyebrow { margin-bottom: 8px; font-size: .62rem; line-height: 1.45; }
  .landing-description .lede { font-size: 1rem; line-height: 1.55; }
  .page-home-minimal .landing-links,
  .page-home-responsive .landing-links,
  .page-home-tiles .landing-links,
  .landing-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 0;
  }
  .portal-card { min-height: 118px; padding: 14px; }
  .portal-card h3 { font-size: .92rem; line-height: 1.25; }
  .portal-card p { display: none; }
  .portal-tag { font-size: .64rem; }
  .entry-grid, .gear-grid { grid-template-columns: 1fr; }
  .support-method-grid { grid-template-columns: 1fr; }
  .support-method { min-height: 0; }
  .contact-form { grid-template-columns: 1fr; }
  .contact-field-wide { grid-column: auto; }
  .custom-gear-panel { grid-template-columns: 1fr; padding: 22px; }
  .gallery-wall { columns: 1; }
  .post-embed.wide { width: 100%; margin-left: 0; transform: none; }
  .section-heading-row, .gallery-heading-row { align-items: flex-start; flex-direction: column; gap: 6px; }
  .section-note, .gallery-count { text-align: left; }
  .gear-grid-featured, .site-summary-grid { grid-template-columns: 1fr; }
  .research-aim { grid-template-columns: 1fr; padding: 22px; }
  .aim-number { min-height: 54px; }
  .publication-card { grid-template-columns: 1fr; gap: 8px; }
  .research-map-frame { height: min(72vh, 560px); min-height: 460px; }
  .field-site-card summary { padding: 17px; }
  .field-site-body { padding: 0 17px 17px; }
  .sightings-panel > summary { min-height: 54px; padding: 9px 12px; }
  .sightings-body { padding: 10px; }
  .sightings-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .sightings-toolbar { grid-template-columns: 1fr; }
  .sightings-view { width: 100%; }
  .sightings-table th:nth-child(1) { width: 56%; }
  .sightings-table th:nth-child(4) { width: 19%; }
  .sightings-table th:nth-child(5) { width: 25%; }
  .sightings-table th:nth-child(2),
  .sightings-cell-taxonomy { display: none; }
  .sightings-mobile-meta { display: block; overflow: hidden; color: var(--faint); font-size: .64rem; text-overflow: ellipsis; white-space: nowrap; }
  .taxon-branch ul { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .sightings-summary-title { font-size: .88rem; }
  .sightings-summary-count { width: 100%; }
  .sightings-overview { gap: 12px; }
  .sighting-metric { min-height: 50px; padding: 7px; }
  .sighting-metric span { font-size: .56rem; }
  .sightings-table th:nth-child(1) { width: 72%; }
  .sightings-table th:nth-child(4) { width: 28%; }
  .sightings-table th:nth-child(5),
  .sightings-cell-record { display: none; }
  .sightings-mobile-link { display: inline; margin-top: 2px; }
}

@media (max-width: 380px) {
  .landing-hero-grid {
    grid-template-columns: 82px minmax(0, 1fr);
    column-gap: 14px;
  }
  .landing-portrait { width: 82px; }
  .portal-card { min-height: 108px; padding: 12px; }
  .portal-card h3 { font-size: .84rem; }
}

@media (max-width: 520px) {
  .effects-trigger { min-height: 38px; padding: 7px 11px; font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}

/* ---------- Phylogeny family view ---------- */
.phylogeny-family-key {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
}
.phylogeny-family-key > summary {
  padding: 10px 13px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 650;
  letter-spacing: .035em;
  cursor: pointer;
}
.phylogeny-family-legend { display: grid; gap: 18px; padding: 2px 13px 16px; }
.phylogeny-legend-class { display: grid; gap: 11px; }
.phylogeny-legend-class + .phylogeny-legend-class { padding-top: 15px; border-top: 1px solid var(--border); }
.phylogeny-legend-class h4 {
  margin: 0;
  color: var(--ink);
  font-size: .78rem;
  letter-spacing: .09em;
  text-transform: uppercase;
}
.phylogeny-legend-order {
  display: grid;
  grid-template-columns: minmax(110px,.24fr) minmax(0,1fr);
  gap: 12px 18px;
  align-items: start;
}
.phylogeny-legend-order h5 { margin: 1px 0 0; color: var(--muted); font-size: .76rem; font-style: italic; font-weight: 650; }
.phylogeny-legend-families { display: flex; flex-wrap: wrap; gap: 7px 14px; }
.phylogeny-family-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: .72rem;
  white-space: nowrap;
}
.phylogeny-family-item small { color: var(--faint); font-size: .62rem; font-variant-numeric: tabular-nums; }
.phylogeny-family-item i {
  width: 16px;
  height: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--family-color) 86%, var(--text));
}
.phylogeny-scroll {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, var(--bg));
}
.phylogeny-links path { fill: none; stroke: color-mix(in srgb, var(--family-color) 84%, var(--text)); stroke-width: 1.4; }
.phylogeny-links path[data-family="mixed"] { stroke: var(--border-strong); stroke-width: 1.05; }
.phylogeny-nodes g:not([data-status="internal"]) circle {
  fill: var(--surface);
  stroke: color-mix(in srgb, var(--family-color) 88%, var(--text));
  stroke-width: 2;
}
.phylogeny-nodes g[data-status="Provisional"] circle { stroke-dasharray: 2 1.5; }
.phylogeny-nodes g[data-status="Needs review"] circle { stroke-dasharray: 1 2; }
.phylogeny-family-tick { fill: color-mix(in srgb, var(--family-color) 86%, var(--text)); }
.phylogeny-nodes text { fill: var(--text); font-size: 10.5px; }

/* ---------- Comparative model system ---------- */
.research-models {
  display: grid;
  gap: clamp(20px, 2.5vw, 32px);
  margin-block: 0;
}
.research-models > .section-heading { margin-bottom: 0; }
.research-model {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
}
.research-model:nth-of-type(even) .research-model-media { order: 2; }
.research-model:nth-of-type(even) .research-model-copy { order: 1; }
.research-model-media { margin: 0; }
.research-model-media img {
  display: block;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.research-model-media.is-published-figure img { aspect-ratio: auto; object-fit: contain; background: #fff; }
.research-model-media figcaption { margin-top: 10px; color: var(--faint); font-size: .73rem; line-height: 1.5; }
.research-model-copy h3 { margin: 0 0 12px; font-size: clamp(1.45rem, 2.6vw, 2.2rem); }
.research-model-copy p { max-width: 68ch; margin: 0; color: var(--muted); }
.research-model-copy p + p { margin-top: 14px; }
.research-model-copy .hero-actions { justify-content: center; }

/* ---------- Gear directory and loadouts ---------- */
.gear-directory {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  width: min(100%, 390px);
  margin: 24px auto 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  text-align: center;
}

.gear-directory-item {
  appearance: none;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: color 150ms ease, background 150ms ease;
}

.gear-directory-item:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 58%, transparent);
}

.gear-directory-item.is-active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.gear-directory-item:focus-visible { outline: none; box-shadow: inset 0 0 0 2px currentColor; }

.gear-directory-item strong { font-size: .92rem; font-weight: 600; }

.gear-collection-intro {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding-top: 4px;
  text-align: center;
}

.gear-collection-intro h2 { margin: 0; font-size: clamp(1.85rem, 3vw, 2.55rem); }
.gear-collection-intro p:last-child { max-width: 76ch; margin: 4px auto 0; color: var(--muted); }

.loadouts-section {
  display: grid;
  gap: 16px;
  scroll-margin-top: 24px;
}

.gear-view { display: grid; gap: 32px; animation: gear-view-in 180ms ease both; }
.gear-view[hidden] { display: none; }
@keyframes gear-view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.loadout-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.loadout-panel {
  display: grid;
  gap: 16px;
  min-width: 0;
  padding: clamp(20px, 2.7vw, 30px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  text-align: left;
}

.loadout-panel.is-featured { grid-column: 1 / -1; }
.loadout-panel.is-draft { border-style: dashed; }
.loadout-panel-header { display: flex; align-items: start; justify-content: space-between; gap: 20px; }
.loadout-panel-header h3 { margin: 0 0 3px; font-size: clamp(1.3rem, 2.4vw, 1.75rem); }
.loadout-panel-header p { margin: 0; color: var(--faint); font-size: .78rem; letter-spacing: .05em; text-transform: uppercase; }
.loadout-state { flex: 0 0 auto; color: var(--accent); font-size: .74rem; }
.loadout-body { font-size: .96rem; line-height: 1.65; }
.loadout-body > *:last-child { margin-bottom: 0; }
.loadout-body .text-link { display: inline-flex; text-decoration: none; }

.prose-table-wrap { width: 100%; margin: 1.35rem 0; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.prose-table-wrap table { width: 100%; min-width: 520px; border-collapse: collapse; background: var(--surface); }
.prose-table-wrap th,
.prose-table-wrap td { padding: 11px 13px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.prose-table-wrap th { color: var(--accent); font-size: .74rem; letter-spacing: .07em; text-transform: uppercase; }
.prose-table-wrap td { color: var(--muted); font-size: .9rem; }
.prose-table-wrap tr:last-child td { border-bottom: 0; }
.loadout-support-link { margin-top: 10px; }

.page-gear .gear-card { gap: 10px; padding: 16px; }
.page-gear .gear-thumb { min-height: 110px; aspect-ratio: 16 / 6; }
.page-gear .gear-grid:not(.gear-grid-featured) .gear-thumb { min-height: 68px; aspect-ratio: auto; }
.page-gear .custom-gear-panel { gap: clamp(22px, 4vw, 48px); padding: clamp(22px, 3vw, 34px); }

/* ---------- Compact gallery header ---------- */
.page-gallery .subpage { gap: 22px; }
.gallery-compact-head {
  display: grid;
  gap: 18px;
  padding: 4px 0 18px;
  border-bottom: 1px solid var(--border);
}

.gallery-title-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.gallery-compact-head .eyebrow { margin-bottom: 7px; }
.gallery-compact-head h1 { margin: 0; font-size: clamp(2.1rem, 4.2vw, 3.8rem); line-height: .98; }
.gallery-external-links { display: flex; flex-wrap: wrap; gap: 8px 18px; padding-bottom: 4px; }
.gallery-external-links a { color: var(--muted); font-size: .88rem; text-underline-offset: 4px; }
.gallery-external-links a:hover { color: var(--accent); }

.gallery-toolbar-controls {
  display: flex;
  align-items: end;
  gap: 12px;
}

.gallery-select-group { display: grid; gap: 5px; }
.gallery-select-group > span { color: var(--faint); font-size: .67rem; font-weight: 650; letter-spacing: .11em; text-transform: uppercase; }
.gallery-select-group select {
  min-width: 160px;
  padding: 8px 34px 8px 11px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: .84rem;
}

.gallery-select-group select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.gallery-toolbar-controls .gallery-count { margin: 0 0 8px auto; color: var(--faint); font-size: .78rem; }
.page-gallery .gallery-wall { margin-top: 0; }

@media (max-width: 720px) {
  .loadout-grid { grid-template-columns: 1fr; }
  .gear-directory-item { min-height: 0; }
  .loadout-panel-header { align-items: flex-start; flex-direction: column; gap: 7px; }
  .prose-table-wrap table { min-width: 0; table-layout: fixed; }
  .prose-table-wrap th:first-child,
  .prose-table-wrap td:first-child { width: 58%; }
  .gallery-title-row { align-items: flex-start; flex-direction: column; gap: 13px; }
  .gallery-toolbar-controls { align-items: stretch; flex-wrap: wrap; }
  .gallery-select-group { flex: 1 1 145px; }
  .gallery-select-group select { width: 100%; min-width: 0; }
  .gallery-toolbar-controls .gallery-count { width: 100%; margin: 0; text-align: left; }
}
.research-model-with-timetree {
  grid-template-columns: minmax(0, 1.32fr) minmax(280px, .68fr);
  align-items: start;
  gap: clamp(28px, 4vw, 54px);
}
.research-model-with-timetree .pnas-timetree-panel { min-width: 0; margin-top: 0; }

/* ---------- PNAS study timetree ---------- */
.pnas-timetree-panel {
  margin-top: clamp(20px, 3vw, 34px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: clip;
}
.pnas-timetree-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 68px;
  padding: 13px 17px;
  cursor: pointer;
  list-style: none;
  transition: background-color .16s ease;
}
.pnas-timetree-panel > summary::-webkit-details-marker { display: none; }
.pnas-timetree-panel > summary:hover { background: var(--accent-soft); }
.pnas-timetree-panel > summary strong,
.pnas-timetree-panel > summary small { display: block; }
.pnas-timetree-panel > summary strong { color: var(--ink); font-size: .98rem; }
.pnas-timetree-panel > summary small { margin-top: 1px; color: var(--muted); font-size: .76rem; }
.pnas-timetree-panel[open] > summary .field-site-toggle { transform: rotate(45deg); }
.pnas-timetree-body { padding: clamp(14px, 2.5vw, 24px); border-top: 1px solid var(--border); }
.pnas-timetree-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(270px, .85fr);
  align-items: end;
  gap: 18px 34px;
}
.pnas-timetree-intro .section-kicker { margin-bottom: 6px; }
.pnas-timetree-intro h3 { max-width: 29ch; margin: 0; font-size: clamp(1.2rem, 2vw, 1.65rem); }
.pnas-timetree-intro > p { max-width: 63ch; margin: 0; color: var(--muted); font-size: .87rem; line-height: 1.55; }
.pnas-timetree-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 20px;
  padding-top: 15px;
  border-top: 1px solid var(--border);
}
.pnas-timetree-filter { display: flex; flex-wrap: wrap; gap: 6px; }
.pnas-timetree-filter button {
  min-height: 36px;
  padding: 6px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .75rem;
  cursor: pointer;
}
.pnas-timetree-filter button:hover { border-color: var(--accent); color: var(--ink); }
.pnas-timetree-filter button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-contrast);
}
.pnas-uncertainty-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: .75rem;
  cursor: pointer;
}
.pnas-uncertainty-toggle input { accent-color: var(--accent); }
.pnas-timetree-status { margin: 10px 0 3px; color: var(--faint); font-size: .72rem; }
.pnas-timetree-figure {
  position: relative;
  width: 100%;
  min-height: 300px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface-raised) 28%, transparent);
  overflow: hidden;
}
.pnas-time-svg { display: block; width: 100%; height: auto; font-family: var(--font); }
.pnas-time-grid line { stroke: var(--border); stroke-width: .75; stroke-dasharray: 2 4; }
.pnas-time-intervals line { stroke: color-mix(in srgb, var(--violet) 68%, var(--muted)); stroke-width: 5; stroke-linecap: round; opacity: .58; }
.pnas-time-branch {
  fill: none;
  stroke: var(--border-strong);
  stroke-width: 1.4;
  transition: opacity .15s ease, stroke .15s ease, stroke-width .15s ease;
}
.pnas-time-branch.is-group-hominidae { stroke: var(--violet); }
.pnas-time-branch.is-group-leporidae { stroke: var(--gold); }
.pnas-time-branch.is-group-gliridae { stroke: #77a9cf; }
.pnas-time-branch.is-group-nesomyidae { stroke: #cb8caf; }
.pnas-time-branch.is-group-gerbillinae { stroke: #c49a6c; }
.pnas-time-branch.is-group-murinae { stroke: #83a9bd; }
.pnas-time-branch.is-group-deomyinae { stroke: var(--accent); stroke-width: 1.8; }
.pnas-time-branch.is-unresolved { stroke-dasharray: 5 4; }
.pnas-time-branch.is-dimmed,
.pnas-time-tip.is-dimmed,
.pnas-time-node.is-dimmed { opacity: .18; }
.pnas-time-branch.is-selected { stroke: var(--gold); stroke-width: 2.7; opacity: 1; }
.pnas-time-node,
.pnas-time-tip { cursor: pointer; outline: none; }
.pnas-time-node circle { fill: var(--surface); stroke: var(--faint); stroke-width: 1.2; }
.pnas-time-tip circle { fill: var(--clay); stroke: var(--bg); stroke-width: 1.5; }
.pnas-time-tip.is-regenerative circle { fill: var(--accent); }
.pnas-time-tip.is-unknown circle { fill: var(--surface); stroke: var(--gold); stroke-width: 2; }
.pnas-time-tip.is-unresolved circle { stroke: var(--gold); stroke-width: 2; }
.pnas-time-node:focus circle,
.pnas-time-tip:focus circle,
.pnas-time-node.is-selected circle,
.pnas-time-tip.is-selected circle { stroke: var(--gold); stroke-width: 2.5; }
.pnas-time-label { fill: var(--text); font-size: 11px; font-style: italic; font-weight: 600; }
.pnas-time-axis line { stroke: var(--faint); stroke-width: .9; }
.pnas-time-axis text { fill: var(--faint); font-size: 9px; text-anchor: middle; }
.pnas-time-axis .pnas-time-axis-label { font-size: 9.5px; letter-spacing: .02em; }
.pnas-timetree-selection {
  min-height: 40px;
  padding: 9px 11px;
  border: solid var(--border);
  border-width: 0 1px 1px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.45;
}
.pnas-timetree-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 16px;
  margin-top: 12px;
  color: var(--faint);
  font-size: .69rem;
}
.pnas-timetree-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pnas-timetree-legend i { display: inline-block; flex: 0 0 auto; }
.pnas-timetree-legend .is-regenerative,
.pnas-timetree-legend .is-scar,
.pnas-timetree-legend .is-unknown { width: 9px; height: 9px; border-radius: 50%; }
.pnas-timetree-legend .is-regenerative { background: var(--accent); }
.pnas-timetree-legend .is-scar { background: var(--clay); }
.pnas-timetree-legend .is-unknown { border: 2px solid var(--gold); background: var(--surface); }
.pnas-timetree-legend .is-interval { width: 18px; height: 5px; border-radius: 3px; background: var(--violet); opacity: .7; }
.pnas-timetree-legend .is-unresolved { width: 18px; border-top: 2px dashed var(--gold); }
.pnas-taxonomy-key {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 13px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--border);
  color: var(--faint);
  font-size: .65rem;
  line-height: 1.35;
}
.pnas-taxonomy-key span { display: inline-flex; align-items: center; gap: 5px; }
.pnas-taxonomy-key i { width: 16px; border-top: 2px solid var(--border-strong); }
.pnas-taxonomy-key .is-hominidae { border-color: var(--violet); }
.pnas-taxonomy-key .is-leporidae { border-color: var(--gold); }
.pnas-taxonomy-key .is-gliridae { border-color: #77a9cf; }
.pnas-taxonomy-key .is-nesomyidae { border-color: #cb8caf; }
.pnas-taxonomy-key .is-gerbillinae { border-color: #c49a6c; }
.pnas-taxonomy-key .is-murinae { border-color: #83a9bd; }
.pnas-taxonomy-key .is-deomyinae { border-color: var(--accent); }
.pnas-timetree-method { margin-top: 13px; border-top: 1px solid var(--border); }
.pnas-timetree-method > summary {
  padding: 11px 0 3px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 650;
  cursor: pointer;
}
.pnas-timetree-method div { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding-top: 7px; }
.pnas-timetree-method p { margin: 0; color: var(--faint); font-size: .72rem; line-height: 1.55; }
.pnas-timetree-method a { color: var(--accent); text-underline-offset: .16em; }
.pnas-timetree-panel.is-compact > summary { min-height: 58px; padding: 10px 13px; }
.pnas-timetree-panel.is-compact .pnas-timetree-body { padding: 12px; }
.pnas-timetree-panel.is-compact .pnas-timetree-toolbar {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}
.pnas-timetree-panel.is-compact .pnas-timetree-filter button {
  min-height: 31px;
  padding: 4px 8px;
  font-size: .68rem;
}
.pnas-timetree-panel.is-compact .pnas-timetree-figure { min-height: 0; }
.pnas-timetree-panel.is-compact .pnas-timetree-selection { min-height: 35px; padding: 7px 9px; font-size: .68rem; }
.pnas-timetree-panel.is-compact .pnas-time-label { font-size: 9.5px; }
.pnas-timetree-panel.is-compact .pnas-timetree-method { margin-top: 10px; }
.pnas-timetree-panel.is-compact .pnas-timetree-method > summary { padding-top: 8px; font-size: .69rem; }
.pnas-timetree-panel.is-compact .pnas-timetree-method p { font-size: .67rem; }

@media (max-width: 980px) {
  .research-model-with-timetree { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .phylogeny-family-key > summary { min-height: 44px; display: flex; align-items: center; }
  .phylogeny-legend-order { grid-template-columns: 1fr; gap: 7px; }
  .recommended-reading { grid-template-columns: 1fr; gap: 16px; }
  .recommended-reading .button { justify-self: center; }
  .research-model { grid-template-columns: 1fr; }
  .research-model:nth-of-type(even) .research-model-media,
  .research-model:nth-of-type(even) .research-model-copy { order: initial; }
  .pnas-timetree-intro { grid-template-columns: 1fr; align-items: start; gap: 10px; }
  .pnas-timetree-intro h3 { max-width: none; }
  .pnas-timetree-method div { grid-template-columns: 1fr; gap: 9px; }
  .pnas-time-label { font-size: 10px; }
  .pnas-timetree-figure { min-height: 260px; }
}
