/* LIVE A LIFE — the road is the interface. A horizontal strip of terrain:
   what's behind you is drawn (height = what you were worth, crashes scar it),
   what's ahead is a bare line, and a walker stands where you are. Same voice
   as the rest of the platform: void ground, serif for ideas, mono for figures. */
* { box-sizing: border-box; }
html { background: #07090e; }
body {
  margin: 0; background: transparent; color: #eef2f7;
  font-family: 'Jost', system-ui, sans-serif; -webkit-font-smoothing: antialiased;
}

/* ── the ambient layer (Visual Doctrine, phase 5) ──────────────────────────
   The road's sky: an ember dawn low on the horizon, scrimmed back toward
   the void so text contrast holds. position:fixed (iOS ignores
   background-attachment:fixed) — the page scrolls over a still sky.
   z-index:-1 paints under content (and far under the #weather overlay at
   z-index:4) but over the html ground; body must stay transparent. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(7,9,14,0.5), rgba(7,9,14,0.78) 82%),
    url('/img/ambient/life.webp') center / cover no-repeat,
    #07090e;
}
@media (prefers-reduced-data: reduce) {
  body::before { background: #07090e; }
}
main, #intro { max-width: 640px; margin: 0 auto; padding: 0 18px calc(40px + env(safe-area-inset-bottom)); }
.hidden { display: none !important; }
.quiet { color: #8b96a6; font-size: 13.5px; line-height: 1.6; }
.fine { font-size: 12px; }
.up { color: #62d6a4; } .dn { color: #e0716d; }

#bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(rgba(7,9,14,0.94), rgba(7,9,14,0.72)); backdrop-filter: blur(6px);
}
#homeLink {
  color: #aeb8c7; text-decoration: none; font-size: 20px; line-height: 1;
  min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(140,160,190,0.25); border-radius: 10px;
}
.bar-title, #ageChip {
  font-family: 'Spline Sans Mono', ui-monospace, monospace; font-size: 10.5px; letter-spacing: 0.22em;
}
.bar-title { color: #e0916d; }
.bar-spacer { flex: 1; }
#ageChip { color: #aeb8c7; border: 1px solid rgba(140,160,190,0.28); border-radius: 99px; padding: 5px 10px; white-space: nowrap; }

/* the opening */
#intro { padding-top: 30px; }
#intro h1 {
  font-family: 'Fraunces', Georgia, serif; font-weight: 600;
  font-size: clamp(28px, 7.6vw, 40px); line-height: 1.12; margin: 0 0 16px; text-wrap: balance;
}
#intro p { font-size: 16px; line-height: 1.62; color: #ccd5e0; margin: 0 0 14px; }
#intro em { color: #eef2f7; }
#startBtn { width: 100%; margin: 8px 0 12px; }

/* THE ROAD — forty years of terrain, left to right */
#roadWrap { padding-top: 14px; }
#road {
  overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
#road::-webkit-scrollbar { display: none; }
#road svg { display: block; }
.base { stroke: rgba(140,160,190,0.3); stroke-width: 1; stroke-dasharray: 2 4; }
.tslice.up { fill: rgba(98,214,164,0.34); }
.tslice.dn { fill: rgba(224,113,109,0.36); }
.tslice.crash { fill: rgba(224,86,110,0.5); }
.ridge { stroke-width: 1.6; fill: none; }
.ridge.up { stroke: #62d6a4; }
.ridge.dn { stroke: #e0716d; }
.ridge.crash { stroke: #e0566e; filter: drop-shadow(0 0 4px rgba(224,86,110,0.8)); }
.tslice.fresh, .ridge.fresh { animation: tRise 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes tRise { from { transform: scaleY(0.05); } }
.bolt { font-size: 11px; }
.flag { fill: #e6bd5c; font-size: 9px; }
.walker { fill: #e0916d; }
.whalo { fill: rgba(224,145,109,0.25); animation: wPulse 2.2s ease-in-out infinite; }
@keyframes wPulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 0.9; } }
.tk { fill: #5b687e; font-family: 'Spline Sans Mono', ui-monospace, monospace; font-size: 8.5px; }
.hit { fill: transparent; cursor: pointer; }
#roadCap { margin: 6px 0 0; font-size: 12.5px; color: #8b96a6; line-height: 1.5; }

/* where you stand */
#stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 16px; }
.stat {
  padding: 11px 12px; border-radius: 12px;
  background: rgba(16,20,28,0.66); border: 1px solid rgba(140,160,190,0.16);
}
.stat .k {
  display: block; font-family: 'Spline Sans Mono', ui-monospace, monospace;
  font-size: 8.5px; letter-spacing: 0.16em; color: #8b96a6; margin-bottom: 4px;
}
.stat b {
  font-family: 'Spline Sans Mono', ui-monospace, monospace; font-size: 15px;
  font-variant-numeric: tabular-nums;
}

/* the sky: what the papers say about the year ahead */
#sky {
  display: flex; align-items: center; gap: 13px; margin-top: 14px;
  padding: 12px 14px; border-radius: 12px;
  background: rgba(16,20,28,0.55); border: 1px solid rgba(140,160,190,0.18);
}
#skyGlyph { font-size: 24px; line-height: 1; flex: 0 0 auto; }
#sky .sk-txt { min-width: 0; }
.sk-eyebrow {
  display: block; font-family: 'Spline Sans Mono', ui-monospace, monospace;
  font-size: 8.5px; letter-spacing: 0.2em; color: #8b96a6; margin-bottom: 3px;
}
.sk-eyebrow b { font-weight: 600; }
#skyLine {
  margin: 0; font-family: 'Fraunces', Georgia, serif; font-style: italic;
  font-size: 14.5px; line-height: 1.45; color: #dde4ee;
}
#sky.sk-clear { border-color: rgba(143,182,255,0.25); } #sky.sk-clear .sk-eyebrow b { color: #8fb6ff; }
#sky.sk-hot { border-color: rgba(230,189,92,0.3); } #sky.sk-hot .sk-eyebrow b { color: #e6bd5c; }
#sky.sk-storm { border-color: rgba(224,86,110,0.4); background: rgba(28,14,18,0.55); }
#sky.sk-storm .sk-eyebrow b { color: #e0566e; }

.sec {
  font-family: 'Spline Sans Mono', ui-monospace, monospace; font-size: 10px;
  font-weight: 600; letter-spacing: 0.24em; color: #e0916d; margin: 24px 0 8px;
}
.sec span { letter-spacing: 0.04em; color: #8b96a6; font-weight: 400; }

/* the mix */
#mixBar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; gap: 1px; margin-bottom: 10px; }
#mixBar i { display: block; min-width: 3px; }
#allocs { display: flex; flex-direction: column; gap: 5px; }
.alloc {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 11px;
  background: rgba(16,20,28,0.6); border: 1px solid rgba(140,160,190,0.14);
}
.dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 9px; }
.an { flex: 1; min-width: 0; font-size: 14px; font-weight: 500; }
.an i {
  display: block; font-style: normal; margin-top: 1px;
  font-family: 'Spline Sans Mono', ui-monospace, monospace; font-size: 10px; color: #8b96a6;
}
.ctl { display: flex; align-items: center; gap: 4px; }
.ctl b {
  font-family: 'Spline Sans Mono', ui-monospace, monospace; font-size: 13px;
  min-width: 40px; text-align: center; font-variant-numeric: tabular-nums;
}
.stp {
  appearance: none; cursor: pointer; width: 44px; height: 44px; border-radius: 9px;
  background: rgba(13,20,32,0.7); border: 1px solid rgba(140,160,190,0.24);
  color: #eef2f7; font-size: 18px; line-height: 1;
}
.stp:active { background: rgba(24,32,46,0.9); }

/* the running commentary */
#log { margin-top: 16px; display: flex; flex-direction: column; gap: 6px; min-height: 44px; }
.line {
  margin: 0; font-size: 13.5px; line-height: 1.55; color: #ccd5e0;
  padding: 9px 12px; border-radius: 10px; background: rgba(16,20,28,0.5);
  border-left: 2px solid rgba(140,160,190,0.3);
}
.line.dn { border-left-color: #e0716d; }
.line.recall { border-left-color: #e6bd5c; background: rgba(24,20,12,0.5); }
.line b.up { color: #62d6a4; } .line b.dn { color: #e0716d; }

/* buttons */
button.primary {
  appearance: none; cursor: pointer; width: 100%; border: 0; border-radius: 12px;
  background: #e0916d; color: #1c0f08; font-weight: 600;
  font-family: 'Spline Sans Mono', ui-monospace, monospace;
  font-size: 12.5px; letter-spacing: 0.16em; padding: 15px 18px;
  box-shadow: 0 4px 0 #a9603f;
}
button.primary:active { transform: translateY(3px); box-shadow: 0 1px 0 #a9603f; }
button.primary:disabled { opacity: .45; box-shadow: none; cursor: default; }
#nextBtn { margin-top: 20px; }
#footNote { margin-top: 10px; text-align: center; }
.ghost-btn {
  appearance: none; cursor: pointer; background: none; border: 0;
  color: #aeb8c7; font-family: 'Jost', system-ui, sans-serif; font-size: 14px;
  padding: 12px; min-height: 44px;
}
.ghost-btn:active { color: #fff; }
.ghost-link { display: block; text-align: center; color: #62d6a4; text-decoration: none; font-size: 14px; padding: 12px; }

/* sheets */
dialog {
  border: 1px solid rgba(224,145,109,0.3); border-radius: 16px; background: #0b0e15; color: #eef2f7;
  padding: 22px 20px 18px; width: min(460px, calc(100vw - 32px)); font-family: 'Jost', system-ui, sans-serif;
  max-height: 88vh; max-height: 88dvh; overflow-y: auto; /* the recap can outgrow a phone */
}

/* the card's mark: authored line-art in a medallion tinted by the kind of year */
.ev-head { display: flex; align-items: center; gap: 12px; }
.ev-medal {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 50%; flex: 0 0 46px;
  background: rgba(16,20,28,0.8); border: 1px solid currentColor;
}
.card-art { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.m-fork { color: #e0916d; }
.m-gift { color: #e6bd5c; }
.m-toll { color: #e0716d; }
dialog::backdrop { background: rgba(4,5,8,0.76); backdrop-filter: blur(3px); }
.ev-tag {
  font-family: 'Spline Sans Mono', ui-monospace, monospace; font-size: 9.5px;
  letter-spacing: 0.24em; color: #e0916d;
}
dialog h3 {
  font-family: 'Fraunces', Georgia, serif; font-weight: 600; font-size: 23px;
  line-height: 1.2; margin: 8px 0 10px;
}
dialog p { font-size: 14.5px; line-height: 1.58; color: #ccd5e0; margin: 0 0 12px; }
.ev-cost {
  font-family: 'Spline Sans Mono', ui-monospace, monospace !important;
  font-size: 13px !important; color: #e6bd5c !important;
}

/* the fork: two ways through the year */
#chOpts { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.opt {
  appearance: none; cursor: pointer; text-align: left; width: 100%;
  padding: 13px 14px; min-height: 56px; border-radius: 12px;
  background: rgba(16,22,32,0.75); border: 1px solid rgba(140,160,190,0.26);
  color: #eef2f7; font-family: 'Jost', system-ui, sans-serif;
}
.opt b { display: block; font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.opt span {
  display: block; font-family: 'Spline Sans Mono', ui-monospace, monospace;
  font-size: 11px; line-height: 1.5; color: #8b96a6;
}
.opt:active { background: rgba(28,36,50,0.9); border-color: rgba(224,145,109,0.5); }
.opt:disabled { opacity: 0.4; cursor: default; }

/* the end of the road */
#endGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 4px 0 8px; }
.cell2 { padding: 10px 11px; border-radius: 10px; background: rgba(16,20,28,0.7); border: 1px solid rgba(140,160,190,0.14); }
.cell2.wide { grid-column: 1 / -1; } /* sentences, not figures */
.cell2 span {
  display: block; font-family: 'Spline Sans Mono', ui-monospace, monospace;
  font-size: 8.5px; letter-spacing: 0.14em; color: #8b96a6; margin-bottom: 3px;
}
.cell2 b { font-family: 'Spline Sans Mono', ui-monospace, monospace; font-size: 13px; }
.calls-sec { margin: 14px 0 6px; }
#endCalls { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.call {
  margin: 0 !important; font-size: 13px !important; line-height: 1.5 !important;
  padding: 7px 10px; border-radius: 9px; background: rgba(16,20,28,0.55);
  border-left: 2px solid rgba(230,189,92,0.4);
  display: flex; align-items: flex-start; gap: 9px;
}
.call-art {
  width: 20px; height: 20px; flex: 0 0 20px; margin-top: 1px;
  fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round;
}
.call b { font-family: 'Spline Sans Mono', ui-monospace, monospace; font-size: 9.5px; letter-spacing: 0.14em; color: #e6bd5c; }
.call i { color: #8b96a6; }
#endHonesty { font-size: 12.5px !important; }
#endLesson {
  font-family: 'Fraunces', Georgia, serif; font-style: italic; font-size: 15px;
  line-height: 1.55; color: #dde4ee;
}
#endFeed {
  display: inline-block; margin-bottom: 14px; color: #62d6a4; text-decoration: none;
  font-size: 14px; border-bottom: 1px solid rgba(98,214,164,0.4); padding-bottom: 1px;
}
.row { display: flex; flex-direction: column; gap: 4px; }

/* ── phase-3 cinematics ─────────────────────────────────────────────────────
   The weather overlay: the whole page feels a crash year for a breath, and
   the rebound dawns. Opacity-only on a fixed layer under the chrome —
   atmosphere, never information (the log and the road carry the facts). */
#weather {
  position: fixed; inset: 0; pointer-events: none; z-index: 4;
  opacity: 0; transition: opacity 0.7s ease;
}
#weather.crash {
  opacity: 1;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(224,86,110,0.15), transparent 55%),
    radial-gradient(150% 120% at 50% 115%, rgba(110,16,30,0.28), transparent 62%);
}
#weather.dawn {
  opacity: 1;
  background:
    radial-gradient(150% 120% at 50% 115%, rgba(98,214,164,0.14), transparent 58%),
    radial-gradient(120% 90% at 50% 0%, rgba(230,189,92,0.09), transparent 50%);
}

/* the walker steps when a year lands */
.walker.stepped { animation: wStep 0.55s cubic-bezier(0.2, 0.8, 0.2, 1); }
.whalo.stepped { animation: wHaloStep 0.8s ease-out; }
@keyframes wStep { 0% { transform: translateY(-7px); } 60% { transform: translateY(1px); } 100% { transform: none; } }
@keyframes wHaloStep { 0% { opacity: 1; transform: scale(1.7); transform-box: fill-box; transform-origin: center; } 100% { opacity: 0.35; transform: scale(1); } }

/* the end card opens on the whole road, drawn as one line */
#endRoad { margin: 10px 0 4px; }
#endRoad:empty { display: none; }
.er-svg { display: block; width: 100%; height: 84px; }
.er-line { fill: none; stroke: #e0916d; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 6px rgba(224,145,109,0.4)); }
.er-crash { stroke: rgba(224,86,110,0.45); stroke-width: 2; stroke-dasharray: 2 3; }
.er-dot { fill: #e6bd5c; filter: drop-shadow(0 0 6px rgba(230,189,92,0.8)); }

@media (prefers-reduced-motion: reduce) {
  .tslice.fresh, .ridge.fresh, .whalo { animation: none; }
  #weather { transition: none; opacity: 0 !important; }
  .walker.stepped, .whalo.stepped { animation: none; }
}
