/* TerraMesh window. Colours, type and motion follow the TerraMesh design kit
   (tokens.json v2): forest, paper, lime, night and fog, Figtree 400-700, one
   leaf per surface, mission leaves only where that mission is the subject. */

@font-face { font-family: 'Figtree'; font-weight: 400; font-display: swap; src: url(kit/fonts/figtree-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 500; font-display: swap; src: url(kit/fonts/figtree-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 600; font-display: swap; src: url(kit/fonts/figtree-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Figtree'; font-weight: 700; font-display: swap; src: url(kit/fonts/figtree-latin-700-normal.woff2) format('woff2'); }

:root {
  --forest: #163F32; --paper: #F3F5EE; --ink: #142E24; --muted: #59695F; --moss: #6E846D;
  --lime: #D5EE9B; --night: #0D2A2E; --land: #2C5A4B; --fog: #C9D5D6; --line: #DCE3DA;
  --gain: #F0C067; --go: #6FC39A;
  --spring: cubic-bezier(.34, 1.36, .64, 1);
  --out: cubic-bezier(.16, 1, .3, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--night); color: var(--paper);
  font: 400 16px/1.45 Figtree, system-ui, -apple-system, 'Segoe UI', sans-serif;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
h1, h2, h3 { font-weight: 600; letter-spacing: -0.02em; line-height: 1.05; margin: 0; }
p { margin: 0; }

/* Inside the desktop window the portfolio already has its own way out. */
.back {
  position: fixed; top: 14px; left: 14px; z-index: 20; padding: 7px 12px; border-radius: 999px;
  background: rgba(13, 42, 46, .72); color: var(--paper); text-decoration: none; font-size: 13px; font-weight: 500;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(243, 245, 238, .14);
}
.in-window .back { display: none; }

.s { position: relative; padding: clamp(72px, 12vh, 120px) clamp(20px, 6vw, 72px); }
.s-head { max-width: 640px; margin: 0 auto clamp(36px, 6vh, 56px); text-align: center; }
.eyebrow { font-size: 13px; font-weight: 500; letter-spacing: .12em; text-transform: uppercase; color: var(--moss); margin-bottom: 12px; }
.s h2 { font-size: clamp(30px, 5vw, 48px); }
.s-sub { margin-top: 14px; font-size: clamp(16px, 1.9vw, 19px); color: inherit; opacity: .78; }

/* Reveal: everything marked .rise or inside a .reveal block comes up once
   when it scrolls in, on the kit's spring. */
.rise, .reveal > * { opacity: 0; transform: translateY(18px); transition: opacity .9s var(--out), transform .9s var(--spring); }
.rise.in, .reveal.in > * { opacity: 1; transform: none; }
.reveal.in > *:nth-child(2) { transition-delay: .08s; }
.reveal.in > *:nth-child(3) { transition-delay: .16s; }
.reveal.in > *:nth-child(4) { transition-delay: .24s; }
.reveal.in > *:nth-child(5) { transition-delay: .32s; }

/* 1. Hero ---------------------------------------------------------------- */
.hero {
  min-height: 100vh; display: grid; place-items: center; text-align: center; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 30%, #1d4d3e 0%, var(--forest) 45%, var(--night) 100%);
}
.hex-drift { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .5; }
.hero-inner { position: relative; max-width: 620px; }
.hero-leaf { width: 200px; height: 200px; display: block; margin: 0 auto -6px; }
.wordmark { font-size: clamp(48px, 9vw, 88px); letter-spacing: -0.015em; color: var(--paper); }
.wordmark .ch { display: inline-block; opacity: 0; transform: translateY(.5em) rotate(4deg); }
.wordmark.in .ch { opacity: 1; transform: none; transition: opacity .6s var(--out), transform .8s var(--spring); transition-delay: calc(1.1s + var(--i) * 45ms); }
.tagline { margin-top: 14px; font-size: clamp(19px, 2.6vw, 24px); color: var(--lime); font-weight: 500; transition-delay: 1.7s !important; }
.lede { margin-top: 18px; font-size: 17px; opacity: 0; color: rgba(243, 245, 238, .82); transition-delay: 1.9s !important; }
.lede.in { opacity: 1; }
.byline { margin-top: 22px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--moss); transition-delay: 2.1s !important; }
.scroll-cue { position: absolute; bottom: 28px; left: 50%; width: 26px; height: 42px; margin-left: -13px; border: 1.5px solid rgba(243, 245, 238, .4); border-radius: 14px; }
.scroll-cue span { position: absolute; left: 50%; top: 8px; width: 4px; height: 8px; margin-left: -2px; border-radius: 2px; background: var(--lime); animation: cue 2s var(--out) infinite; }
@keyframes cue { 0% { opacity: 0; transform: translateY(0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* 2. Fog ----------------------------------------------------------------- */
.fog { padding: 0; background: var(--night); }
.fog-stage { position: relative; height: 100vh; min-height: 520px; overflow: hidden; cursor: crosshair; }
.fog-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.fog-caption { position: absolute; left: clamp(20px, 6vw, 72px); top: clamp(56px, 12vh, 110px); max-width: 420px; pointer-events: none; }
.fog-line {
  position: absolute; top: 0; left: 0; width: max-content; max-width: 80vw; padding: 10px 16px; border-radius: 12px;
  background: rgba(13, 42, 46, .78); color: var(--paper); font-size: clamp(20px, 3vw, 28px); font-weight: 600; letter-spacing: -.02em; line-height: 1.15;
  opacity: 0; transform: translateY(10px); transition: opacity .7s var(--out), transform .8s var(--spring);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.fog-line.is-on { opacity: 1; transform: none; }
.fog-hud {
  position: absolute; right: clamp(16px, 4vw, 40px); bottom: clamp(16px, 4vw, 40px); margin: 0; display: flex; gap: 8px;
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.fog-hud div { background: rgba(13, 42, 46, .8); border: 1px solid rgba(213, 238, 155, .2); border-radius: 12px; padding: 8px 12px; min-width: 92px; }
.fog-hud dt { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--fog); opacity: .8; }
.fog-hud dd { margin: 2px 0 0; font-size: 20px; font-weight: 600; color: var(--lime); }
.fog-hint { position: absolute; left: clamp(16px, 4vw, 40px); bottom: clamp(20px, 4vw, 44px); font-size: 13px; color: var(--fog); opacity: .7; pointer-events: none; }
.credit { position: absolute; left: 0; right: 0; bottom: 4px; text-align: center; font-size: 10px; color: rgba(201, 213, 214, .45); pointer-events: none; }

/* 3. Missions ------------------------------------------------------------ */
.missions { background: var(--paper); color: var(--ink); }
.missions .s-sub { color: var(--muted); opacity: 1; }
.mission-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(12px, 1.6vw, 20px); max-width: 1180px; margin: 0 auto; perspective: 1200px; }
.mission {
  position: relative; border-radius: 22px; overflow: hidden; background: var(--tint); color: var(--ink);
  opacity: 0; transform: translateY(40px) rotateX(8deg); transform-origin: 50% 100%;
  transition: opacity .9s var(--out), transform 1s var(--spring), box-shadow .4s;
  transition-delay: calc(var(--i, 0) * 110ms);
  box-shadow: 0 1px 0 rgba(20, 46, 36, .06);
}
.mission.in { opacity: 1; transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
.mission.tilting { transition: transform .12s linear, box-shadow .4s; }
.mission:hover { box-shadow: 0 24px 50px -24px rgba(20, 46, 36, .45); }
.m-media { aspect-ratio: 456 / 470; overflow: hidden; background: var(--accent); }
.m-media video { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; transform: scale(1.04); transition: transform 1.2s var(--out); }
.mission:hover .m-media video { transform: scale(1.1); }
.m-body { position: relative; padding: 138px 20px 22px; }
/* Big enough that the mission leaf keeps its own detail (gullies, waves,
   clouds, dots): below about 130 px the kit falls back to the plain leaf. */
.m-leaf { position: absolute; top: -62px; left: -4px; width: 200px; height: 200px; pointer-events: none; }
.m-body h3 { font-size: 24px; color: var(--accent); }
.m-body p { margin-top: 8px; font-size: 15px; color: var(--ink); }
.capture { list-style: none; padding: 0; margin: clamp(36px, 6vh, 56px) auto 0; max-width: 1180px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.capture li { border-top: 2px solid var(--line); padding-top: 12px; font-size: 15px; color: var(--muted); }
.capture b { display: block; color: var(--ink); font-weight: 600; font-size: 16px; }

/* 4. Gaia ---------------------------------------------------------------- */
.gaia { background: linear-gradient(180deg, var(--night), #0a2226); }
.gaia-grid { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: clamp(28px, 6vw, 80px); align-items: center; max-width: 1040px; margin: 0 auto; }
.phone {
  margin: 0; aspect-ratio: 9 / 16; border-radius: 34px; overflow: hidden; background: #0a2226;
  border: 8px solid #071a1d; box-shadow: 0 0 0 1px rgba(213, 238, 155, .14), 0 40px 80px -30px rgba(0, 0, 0, .7), 0 0 90px -20px rgba(111, 195, 154, .25);
  transform: translateY(30px) scale(.96); opacity: 0; transition: transform 1.1s var(--spring), opacity .9s var(--out);
}
.phone.in { transform: none; opacity: 1; }
.phone video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gaia-copy .eyebrow { color: var(--go); }
.questions { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 10px; }
.questions li {
  display: flex; align-items: center; gap: 14px; font-size: clamp(17px, 2vw, 21px); font-weight: 500;
  opacity: 0; transform: translateX(-16px); transition: opacity .7s var(--out), transform .8s var(--spring);
}
.questions.in li { opacity: 1; transform: none; }
.questions.in li:nth-child(2) { transition-delay: .25s; }
.questions.in li:nth-child(3) { transition-delay: .5s; }
.questions span { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 15px; font-weight: 600; color: var(--night); background: var(--lime); }
.gaia-loop { margin-top: 24px; font-size: 15px; color: var(--fog); opacity: .8; border-left: 2px solid var(--go); padding-left: 14px; }

.gaia-charts { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(16px, 3vw, 32px); max-width: 1040px; margin: clamp(48px, 9vh, 80px) auto 0; }
.chart { margin: 0; padding: 24px; border-radius: 20px; background: rgba(243, 245, 238, .04); border: 1px solid rgba(243, 245, 238, .08); }
.chart h3 { font-size: 21px; }
.chart figcaption p { margin-top: 6px; font-size: 14px; color: var(--fog); opacity: .8; }
.absence svg { width: 100%; height: auto; margin-top: 14px; overflow: visible; }
.axis line { stroke: rgba(201, 213, 214, .3); stroke-width: 1; }
.axis text { fill: rgba(201, 213, 214, .65); font: 500 11px Figtree, sans-serif; }
.curve { fill: none; stroke: var(--lime); stroke-width: 3; stroke-linecap: round; }
.mark20 line { stroke: var(--gain); stroke-dasharray: 4 4; opacity: 0; transition: opacity .6s; }
.mark20 circle { fill: var(--gain); transform-box: fill-box; transform-origin: center; transform: scale(0); transition: transform .6s var(--spring); }
.absence.done .mark20 line { opacity: 1; }
.absence.done .mark20 circle { transform: scale(1); }
.quote { margin-top: 12px; font-size: 15px; color: var(--gain); opacity: 0; transform: translateY(8px); transition: opacity .7s var(--out) .2s, transform .7s var(--spring) .2s; }
.absence.done .quote { opacity: 1; transform: none; }
.bars { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 12px; }
.bars li { display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto 10px; column-gap: 10px; row-gap: 5px; font-size: 14px; }
.bars span { color: var(--fog); }
.bars b { font-weight: 600; font-variant-numeric: tabular-nums; }
.bars i { grid-column: 1 / -1; height: 10px; border-radius: 5px; background: rgba(201, 213, 214, .3); transform-origin: left; transform: scaleX(0); transition: transform 1.2s var(--out); }
/* Bars start at 0.25 so the gaps that matter are visible, and say so. */
.bench.in .bars i { transform: scaleX(calc((var(--v) - 0.25) / 0.05)); }
.bars li:nth-child(2) i { transition-delay: .12s; }
.bars li:nth-child(3) i { transition-delay: .24s; }
.bars li:nth-child(4) i { transition-delay: .36s; }
.bars .is-gaia i { background: var(--lime); }
.bars .is-gaia span, .bars .is-gaia b { color: var(--lime); }
.bars .is-oracle i { background: repeating-linear-gradient(90deg, rgba(201, 213, 214, .45) 0 6px, transparent 6px 10px); }
.note { margin-top: 16px; font-size: 13px; color: var(--fog); opacity: .65; }

/* 5. Consensus ----------------------------------------------------------- */
.consensus { background: var(--paper); color: var(--ink); }
.consensus .s-sub { color: var(--muted); opacity: 1; }
.consensus .eyebrow { color: var(--moss); }
.vote { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: 220px 1fr; gap: 28px 40px; align-items: center; }
.specimen { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 18px; text-align: center; }
.v-leaf { width: 140px; height: 140px; }
.suggest { font-size: 14px; color: var(--muted); }
.suggest i { color: var(--ink); }
.suggest em { display: block; margin-top: 8px; font-style: normal; font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #9a3b2b; opacity: 0; transition: opacity .5s; }
.vote.s1 .suggest em { opacity: 1; }
.vote.s1 .suggest i { text-decoration: line-through; text-decoration-color: rgba(154, 59, 43, .7); }
.voters { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.voters li { display: flex; align-items: center; gap: 12px; opacity: 0; transform: translateX(20px); transition: opacity .5s var(--out), transform .7s var(--spring); }
.voters li.on { opacity: 1; transform: none; }
.voters .dot { width: 34px; height: 34px; border-radius: 50%; background: var(--line); position: relative; flex: none; }
.voters .dot::after { content: ''; position: absolute; inset: 9px 11px 5px; border-radius: 50% 50% 40% 40%; background: var(--moss); opacity: .5; }
.voters .say { padding: 7px 12px; border-radius: 10px; background: #fff; border: 1px solid var(--line); font-size: 15px; }
.voters [data-say="yes"].on .say { border-color: var(--go); background: #ecf7f0; }
.voters [data-say="no"] .say { color: var(--muted); }
.tally { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 14px; opacity: 0; transform: scale(.9); transition: opacity .5s, transform .7s var(--spring); }
.vote.s3 .tally { opacity: 1; transform: none; }
.tally-n { font-size: 17px; font-weight: 600; }
.badge { padding: 8px 14px; border-radius: 999px; background: var(--forest); color: var(--lime); font-weight: 600; font-size: 14px; }

/* 6. Privacy ------------------------------------------------------------- */
.privacy { background: var(--forest); }
.priv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 6vw, 72px); align-items: center; max-width: 1040px; margin: 0 auto; }
.priv-viz { aspect-ratio: 1; border-radius: 24px; overflow: hidden; background: var(--night); }
.tile-canvas { width: 100%; height: 100%; display: block; }
.privacy .eyebrow { color: var(--lime); opacity: .8; }
.ticks { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; }
.ticks li { position: relative; padding-left: 30px; font-size: 16px; color: rgba(243, 245, 238, .88); }
.ticks li::before { content: ''; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--lime); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Ccircle cx='9' cy='9' r='9'/%3E%3C/svg%3E"); }
.ticks li::after { content: ''; position: absolute; left: 5px; top: 8px; width: 7px; height: 4px; border-left: 2px solid var(--forest); border-bottom: 2px solid var(--forest); transform: rotate(-45deg); }

/* 7. Build --------------------------------------------------------------- */
.build { background: var(--paper); color: var(--ink); }
.flow { list-style: none; padding: 0; margin: 0 auto; max-width: 1040px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: f; position: relative; }
.flow::before { content: ''; position: absolute; top: 22px; left: 23px; right: calc((100% - 40px) / 3 - 23px); height: 2px; background: linear-gradient(90deg, var(--forest), var(--go), var(--forest)); transform-origin: left; transform: scaleX(0); transition: transform 1.6s var(--out); }
.flow.in::before { transform: scaleX(1); }
.flow li { position: relative; padding-top: 58px; counter-increment: f; }
.flow li::before { content: counter(f); position: absolute; top: 0; left: 0; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--forest); color: var(--lime); font-weight: 600; font-size: 18px; box-shadow: 0 0 0 6px var(--paper); }
.flow h3 { font-size: 22px; color: var(--forest); }
.flow p { margin-top: 8px; color: var(--muted); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; max-width: 840px; margin: 40px auto 0; }
.chips span { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; font-size: 13px; font-weight: 500; color: var(--ink); }
.status { max-width: 640px; margin: 36px auto 0; text-align: center; color: var(--muted); font-size: 15px; }

.foot { background: var(--night); padding: 40px 24px 48px; text-align: center; }
.foot-leaf { width: 48px; height: 48px; border-radius: 12px; }
.foot p { max-width: 560px; margin: 10px auto 0; font-size: 12px; color: rgba(201, 213, 214, .6); }

/* Narrow ---------------------------------------------------------------- */
@media (max-width: 900px) {
  .mission-grid, .capture { grid-template-columns: repeat(2, 1fr); }
  .gaia-grid, .gaia-charts, .priv-grid { grid-template-columns: 1fr; }
  .phone { max-width: 260px; margin: 0 auto; }
  .vote { grid-template-columns: 1fr; }
  .specimen { max-width: 260px; margin: 0 auto; }
  .flow { grid-template-columns: 1fr; }
  .flow::before { display: none; }
}
@media (max-width: 520px) {
  .mission-grid { grid-template-columns: 1fr; }
  .capture { grid-template-columns: 1fr; }
  .fog-hud { left: 12px; right: 12px; justify-content: space-between; }
  .fog-hud div { min-width: 0; flex: 1; }
  .fog-hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0s !important; transition-delay: 0s !important; animation: none !important; }
}
