/* ===================================================================
   NORTH POINT: PANGEA — "STRATA" design system
   -------------------------------------------------------------------
   The site is a core sample. You do not scroll a page, you descend a
   borehole: a fixed depth rail on the left tracks position in metres,
   the background is a parallax stack of rock bands, and the content
   rides above it on liquid-glass panels.

   Why this and not another dark landing page: every realism server
   site looks like a Discord embed with a hero image. A stratigraphic
   column is (a) unmistakably ours, (b) literally what "deep time"
   looks like as an information structure, and (c) gives navigation a
   physical metaphor — sections have depth, not just order.

   Glass technique follows the 2026 "liquid glass" refinement rather
   than 2020 glassmorphism: glass is applied *surgically* to focused
   surfaces only, over a dark ground, and every pane carries four
   layers — backdrop blur + saturation, a gradient hairline border, an
   inner top-edge specular, and a grain overlay that kills the plastic
   look banding otherwise produces.

   Themes: the five in-world seasons (Monsoon, Solara, Australis,
   Migration, Lunar). A theme moves accent, atmosphere and the strata
   palette. It never moves layout — the structure is the identity.

   Contract with the markup:
     html[data-season]  -> theme
     html[data-booted]  -> boot sequence finished
     .pane              -> a liquid-glass surface
     .stratum           -> one depth section
   =================================================================== */

/* ── reset ─────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem);
  line-height: 1.7;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; display: block; }
a { color: inherit; }

/* ── tokens ────────────────────────────────────────────────────── */

:root {
  --font-display: "Georgia", "Iowan Old Style", "Times New Roman", serif;
  --font-body: ui-sans-serif, "Inter", "Segoe UI", system-ui, sans-serif;
  --font-mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", "Consolas", monospace;

  /* Rock column. Five bands, deepest last. Overridden per season. */
  --rock-1: #23262c;
  --rock-2: #1c1f24;
  --rock-3: #16181d;
  --rock-4: #101216;
  --rock-5: #090a0d;

  --ground: var(--rock-5);
  --ink: #dfe3ea;
  --ink-dim: #97a0ae;
  --ink-faint: #626b79;

  --accent: #d8a24a;
  --accent-soft: color-mix(in oklab, var(--accent) 40%, transparent);
  --accent-ink: #10120f;

  /* Glass. Kept low-alpha: over a dark ground, more looks like fog. */
  --glass-fill: rgba(255, 255, 255, 0.045);
  --glass-fill-raised: rgba(255, 255, 255, 0.07);
  --glass-blur: 22px;
  --glass-sat: 150%;
  --glass-line: rgba(255, 255, 255, 0.14);
  --glass-line-dim: rgba(255, 255, 255, 0.06);
  --glass-specular: rgba(255, 255, 255, 0.5);
  --glass-shadow: 0 20px 60px -24px rgba(0, 0, 0, 0.85);

  --rail-w: 76px;
  --measure: 68ch;
  --radius: 16px;
  --radius-lg: 24px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --dur: 620ms;
}

/* ── seasons ───────────────────────────────────────────────────── */
/* Each season is a palette, not a layout. Only tokens move. */

html[data-season="monsoon"] {
  --accent: #3fa9d8;
  --accent-ink: #04141c;
  --rock-1: #1d2830; --rock-2: #17212a; --rock-3: #121a22;
  --rock-4: #0d141a; --rock-5: #070b0f;
  --ink: #dbe7ee;
}
html[data-season="solara"] {
  --accent: #e0913a;
  --accent-ink: #1a0f04;
  --rock-1: #2e2419; --rock-2: #251d14; --rock-3: #1c1610;
  --rock-4: #14100b; --rock-5: #0b0806;
  --ink: #ede2d2;
}
html[data-season="australis"] {
  --accent: #c86ab0;
  --accent-ink: #190a15;
  --rock-1: #2a1f2b; --rock-2: #221925; --rock-3: #1a131d;
  --rock-4: #130e15; --rock-5: #0a070c;
  --ink: #ecdfea;
}
html[data-season="migration"] {
  --accent: #6fbf7a;
  --accent-ink: #06150a;
  --rock-1: #1f2a22; --rock-2: #19221c; --rock-3: #131a16;
  --rock-4: #0e1310; --rock-5: #070a08;
  --ink: #dcebdf;
}
html[data-season="lunar"] {
  --accent: #8f8fe0;
  --accent-ink: #0a0a18;
  --rock-1: #21232f; --rock-2: #1a1c27; --rock-3: #14151e;
  --rock-4: #0e0f16; --rock-5: #06070c;
  --ink: #dedeef;
}

/* Respect a light-mode preference by lifting the column rather than
   inverting it — a stratigraphic core is dark, and a white version of
   this design would be a different site. Contrast is what we fix. */
@media (prefers-color-scheme: light) {
  html:not([data-season]) {
    --rock-1: #2c3038; --rock-2: #24272e; --rock-3: #1d2026;
    --ink: #eef1f6;
    --glass-fill: rgba(255, 255, 255, 0.07);
    --glass-line: rgba(255, 255, 255, 0.2);
  }
}

/* ── the column: parallax rock bands ───────────────────────────── */

.column {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    linear-gradient(
      180deg,
      var(--rock-1) 0%,
      var(--rock-2) 26%,
      var(--rock-3) 52%,
      var(--rock-4) 76%,
      var(--rock-5) 100%
    );
}

/* Bedding planes — the thin lines between deposits. Offset by scroll
   via --depth (set from JS) so the rock moves slower than the text. */
.column::before {
  content: "";
  position: absolute;
  inset: -20% 0;
  background-image: repeating-linear-gradient(
    180deg,
    transparent 0 118px,
    rgba(255, 255, 255, 0.035) 118px 119px,
    transparent 119px 190px,
    rgba(0, 0, 0, 0.28) 190px 192px
  );
  transform: translate3d(0, calc(var(--depth, 0) * -0.22px), 0);
  will-change: transform;
}

/* Atmosphere — a soft seasonal wash that keeps the ground from being
   a flat gradient. Two blobs, opposed, moving at different rates. */
.column::after {
  content: "";
  position: absolute;
  inset: -30% -10%;
  background:
    radial-gradient(60% 45% at 18% 12%,
      color-mix(in oklab, var(--accent) 22%, transparent) 0%, transparent 70%),
    radial-gradient(50% 40% at 86% 68%,
      color-mix(in oklab, var(--accent) 12%, transparent) 0%, transparent 72%);
  filter: blur(30px);
  opacity: 0.75;
  transform: translate3d(0, calc(var(--depth, 0) * -0.08px), 0);
  will-change: transform;
}

/* Grain. One tiny inline SVG turbulence, tiled. Without this the glass
   reads as plastic and the gradients band on cheap panels. */
.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,\
<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'>\
<filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/>\
<feColorMatrix type='saturate' values='0'/></filter>\
<rect width='140' height='140' filter='url(%23n)' opacity='0.42'/></svg>");
}

/* ── depth rail ────────────────────────────────────────────────── */

.rail {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--rail-w);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.1rem 0;
  border-right: 1px solid var(--glass-line-dim);
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.42), rgba(0, 0, 0, 0.16));
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
}

.rail__mark {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.rail__track {
  flex: 1;
  width: 2px;
  margin: 1rem 0;
  background: linear-gradient(180deg,
    var(--glass-line), var(--glass-line-dim));
  position: relative;
  border-radius: 2px;
}

/* The bit — the drill head. Sits at scroll fraction --progress. */
.rail__bit {
  position: absolute;
  left: 50%;
  top: calc(var(--progress, 0) * 100%);
  width: 11px; height: 11px;
  margin-left: -5.5px; margin-top: -5.5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow:
    0 0 0 3px color-mix(in oklab, var(--accent) 25%, transparent),
    0 0 18px 2px color-mix(in oklab, var(--accent) 55%, transparent);
  transition: top 120ms linear;
}

.rail__depth {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.rail__unit {
  font-family: var(--font-mono);
  font-size: 0.54rem;
  color: var(--ink-faint);
  letter-spacing: 0.2em;
}

/* ── shell ─────────────────────────────────────────────────────── */

.shell {
  position: relative;
  z-index: 10;
  margin-left: var(--rail-w);
  padding: 0 clamp(1rem, 4vw, 3.5rem);
}

.stratum {
  position: relative;
  padding: clamp(3.5rem, 9vh, 7rem) 0;
  max-width: 1180px;
  margin: 0 auto;
}

/* Each section announces its depth in the margin, like a core log. */
.stratum__depth {
  position: absolute;
  top: clamp(3.5rem, 9vh, 7rem);
  left: -3.2rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  color: var(--ink-faint);
  writing-mode: vertical-rl;
  white-space: nowrap;
}

@media (max-width: 900px) { .stratum__depth { display: none; } }

/* ── glass ─────────────────────────────────────────────────────── */

.pane {
  position: relative;
  border-radius: var(--radius);
  background: var(--glass-fill);
  backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
  border: 1px solid var(--glass-line-dim);
  box-shadow: var(--glass-shadow);
  padding: clamp(1.15rem, 2.4vw, 1.9rem);
  overflow: hidden;
  isolation: isolate;
}

/* Layer 2: gradient hairline. A flat border reads as a box; a border
   that brightens toward the light source reads as an edge. */
.pane::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    150deg,
    var(--glass-line) 0%,
    transparent 38%,
    transparent 62%,
    color-mix(in oklab, var(--accent) 30%, transparent) 100%
  );
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  pointer-events: none;
}

/* Layer 3: top-edge specular. This is the single detail that separates
   "liquid glass" from "translucent div". */
.pane::after {
  content: "";
  position: absolute;
  top: 0; left: 8%; right: 8%;
  height: 1px;
  background: linear-gradient(90deg,
    transparent, var(--glass-specular), transparent);
  opacity: 0.55;
  pointer-events: none;
}

.pane--raised { background: var(--glass-fill-raised); }

/* Pointer-tracked highlight. --mx/--my are set by strata.js in
   percentages; when JS is off the gradient sits centred and static,
   which still looks intentional. */
.pane--live {
  background-image: radial-gradient(
    380px circle at var(--mx, 50%) var(--my, 0%),
    color-mix(in oklab, var(--accent) 13%, transparent) 0%,
    transparent 62%
  );
}

/* ── type ──────────────────────────────────────────────────────── */

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.9rem;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.015em;
  margin: 0 0 0.6em;
  text-wrap: balance;
}

h1 { font-size: clamp(2.4rem, 1.6rem + 3.6vw, 4.6rem); }
h2 { font-size: clamp(1.7rem, 1.3rem + 1.5vw, 2.6rem); }
h3 { font-size: clamp(1.1rem, 1rem + 0.5vw, 1.35rem); }

p { margin: 0 0 1.05em; max-width: var(--measure); }
p:last-child { margin-bottom: 0; }

.lede {
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.25rem);
  color: var(--ink-dim);
  max-width: 58ch;
}

.dim { color: var(--ink-dim); }
.faint { color: var(--ink-faint); }
.mono { font-family: var(--font-mono); }

/* ── controls ──────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem 1.35rem;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: var(--glass-fill-raised);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: transform 220ms var(--ease), border-color 220ms var(--ease),
              background 220ms var(--ease);
}
.btn:hover {
  transform: translateY(-2px);
  border-color: color-mix(in oklab, var(--accent) 55%, transparent);
  background: color-mix(in oklab, var(--accent) 10%, var(--glass-fill-raised));
}
.btn--solid {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 650;
}
.btn--solid:hover { background: var(--accent); filter: brightness(1.08); }

:where(a, button, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── nav ───────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 0.75rem clamp(1rem, 4vw, 3.5rem);
  margin: 0 calc(-1 * clamp(1rem, 4vw, 3.5rem));
  border-bottom: 1px solid var(--glass-line-dim);
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.18));
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
}

.topbar__brand {
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.topbar__brand b { color: var(--accent); font-weight: 600; }

.topbar__nav {
  display: flex;
  gap: 0.25rem;
  margin-left: auto;
  flex-wrap: wrap;
}
.topbar__nav a {
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--ink-dim);
  text-decoration: none;
  transition: color 180ms var(--ease), background 180ms var(--ease);
}
.topbar__nav a:hover,
.topbar__nav a[aria-current="page"] {
  color: var(--ink);
  background: var(--glass-fill);
}

/* ── season switcher ───────────────────────────────────────────── */

.seasons {
  display: flex;
  gap: 0.3rem;
  padding: 0.28rem;
  border-radius: 999px;
  border: 1px solid var(--glass-line-dim);
  background: var(--glass-fill);
}
.seasons button {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: var(--swatch);
  cursor: pointer;
  padding: 0;
  transition: transform 200ms var(--ease), box-shadow 200ms var(--ease);
}
.seasons button:hover { transform: scale(1.18); }
.seasons button[aria-pressed="true"] {
  box-shadow: 0 0 0 2px var(--ground), 0 0 0 3.5px var(--swatch);
}

/* ── layout helpers ────────────────────────────────────────────── */

.grid {
  display: grid;
  gap: clamp(0.8rem, 1.6vw, 1.25rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
}
.grid--wide {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
}
.row { display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: 1.1rem; }

/* ── metrics ───────────────────────────────────────────────────── */

.metric__value {
  font-family: var(--font-mono);
  font-size: clamp(1.7rem, 1.4rem + 1.2vw, 2.5rem);
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1;
}
.metric__label {
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 0.5rem;
}

/* ── species cards ─────────────────────────────────────────────── */

.card {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-decoration: none;
  transition: transform 300ms var(--ease);
}
.card:hover { transform: translateY(-4px); }
.card h3 { margin: 0; }
.card p {
  font-size: 0.85rem;
  color: var(--ink-dim);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tags { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.tag {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--glass-line-dim);
  color: var(--ink-dim);
  white-space: nowrap;
}
.tag--accent {
  border-color: color-mix(in oklab, var(--accent) 45%, transparent);
  color: var(--accent);
}

/* ── season cards ──────────────────────────────────────────────── */

.season-card { --swatch: var(--accent); }
.season-card .swatch {
  width: 100%; height: 3px; border-radius: 3px;
  background: var(--swatch);
  margin-bottom: 0.9rem;
}
.season-card ul { margin: 0.6rem 0 0; padding-left: 1.05rem; }
.season-card li { font-size: 0.85rem; color: var(--ink-dim); margin-bottom: 0.3rem; }

/* ── prose (species detail) ────────────────────────────────────── */

.prose p { font-size: 1rem; color: var(--ink); }
.prose p + p { margin-top: 1.05em; }

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1px;
  background: var(--glass-line-dim);
  border-radius: var(--radius);
  overflow: hidden;
}
.figures > div {
  background: var(--rock-3);
  padding: 0.95rem 1.1rem;
}
.figures dt {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.figures dd {
  margin: 0.35rem 0 0;
  font-size: 0.98rem;
  color: var(--ink);
  text-transform: capitalize;
}

.pager { display: flex; justify-content: space-between; gap: 1rem; }

/* ── reveal-on-scroll ──────────────────────────────────────────── */

[data-reveal] {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
[data-reveal].is-in { opacity: 1; transform: none; }

/* ── boot sequence ─────────────────────────────────────────────── */

.boot {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: var(--rock-5);
  transition: opacity 700ms var(--ease), visibility 700ms;
}
html[data-booted] .boot { opacity: 0; visibility: hidden; pointer-events: none; }

.boot__core {
  width: min(420px, 82vw);
  text-align: left;
}

.boot__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  margin: 0 0 0.15rem;
}
.boot__title b { color: var(--accent); font-weight: 600; }

.boot__sub {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1.6rem;
}

/* Seismic trace — an SVG polyline animated by stroke-dashoffset. */
.boot__trace { height: 48px; margin-bottom: 1.2rem; opacity: 0.75; }
.boot__trace path {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-dasharray: 1400;
  stroke-dashoffset: 1400;
  animation: trace 2.6s var(--ease) forwards;
}
@keyframes trace { to { stroke-dashoffset: 0; } }

.boot__bar {
  height: 2px;
  background: var(--glass-line-dim);
  border-radius: 2px;
  overflow: hidden;
}
.boot__fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  transition: width 220ms linear;
}

.boot__readout {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.63rem;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  margin-top: 0.6rem;
  font-variant-numeric: tabular-nums;
}
.boot__task { color: var(--ink-dim); }

/* ── footer ────────────────────────────────────────────────────── */

.foot {
  border-top: 1px solid var(--glass-line-dim);
  margin-top: 3rem;
  padding: 2rem 0 3.5rem;
  font-size: 0.82rem;
  color: var(--ink-faint);
}
.foot a { color: var(--ink-dim); text-decoration: none; }
.foot a:hover { color: var(--accent); }

/* ── responsive ────────────────────────────────────────────────── */

@media (max-width: 720px) {
  :root { --rail-w: 0px; }
  .rail { display: none; }
  .topbar { gap: 0.6rem; }
  .topbar__nav { order: 3; width: 100%; margin-left: 0; }
}

/* ── motion + capability fallbacks ─────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .boot { display: none; }
}

/* Firefox and older Safari fall back to a solid tinted panel rather
   than an unreadable transparent one. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .pane, .topbar, .rail, .btn {
    background: color-mix(in oklab, var(--rock-2) 88%, var(--accent) 4%);
  }
}

@media print {
  .column, .grain, .rail, .boot, .topbar { display: none; }
  .shell { margin-left: 0; }
  body { background: #fff; color: #000; }
}
