/* SOLSTORM — production stylesheet (v2: the scroll-driven Blackout timeline) */

:root {
  --bg: #0a0906;
  --bg-deep: #060502;
  --ink: #c9c2b4;
  --ink-bright: #f4ede0;
  --amber: #f4a63d;
  --amber-soft: #ffcf87;
  --amber-dim: #e0b877;
  --danger: #ff6b52;
  --danger-dim: #e0563f;
  --green: #3fe08f;
  --violet: #9a6cff;
  --muted: #7a7062;
  --muted-dim: #4a4238;
  --hud-h: 124px;
  --pop-heat: 0;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  overflow-x: hidden;
}

a { color: var(--amber); text-decoration: none; }
@media (hover: hover) { a:hover { color: var(--amber-soft); } }
::selection { background: var(--amber); color: var(--bg); }

@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
@keyframes flicker { 0%, 97%, 100% { opacity: 1; } 98% { opacity: 0.82; } 99% { opacity: 0.9; } }
@keyframes scanDrift { 0% { background-position: 0 0; } 100% { background-position: 0 40px; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUpCentered { from { opacity: 0; transform: translateX(-50%) translateY(14px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes bob { 0%, 100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(6px); } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

.tone-danger { color: var(--danger); }
.tone-amber { color: var(--amber); }
.cursor { animation: blink 1s step-end infinite; }

/* ===== Fixed layers ===== */
#aurora { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; background: var(--bg-deep); }

.fx-scanlines {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  opacity: 0.5;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.035) 0px, transparent 1px, transparent 3px);
  animation: scanDrift 6s linear infinite;
}
.fx-noise {
  position: absolute; inset: 0; pointer-events: none; z-index: 1;
  opacity: 0.05;
  background-image: radial-gradient(rgba(255,255,255,0.4) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}
.fx-fixed { position: fixed; z-index: 5; }
.fx-fixed.fx-scanlines { opacity: 0.35; }

/* ===== HUD — the doomsday readout ===== */
.hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10; pointer-events: none;
  display: grid; align-items: center;
  padding: calc(12px + env(safe-area-inset-top)) 32px 16px;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, rgba(6,5,3,0.94) 0%, rgba(6,5,3,0.82) 55%, rgba(6,5,3,0) 100%);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.hud::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(244,166,61,0.3) 18%, rgba(244,166,61,0.3) 82%, transparent);
}
.hud.is-hidden { opacity: 0; transform: translateY(-14px); }

.hud-side { display: flex; align-items: baseline; gap: 20px; }
.hud-side--l { justify-self: start; }
.hud-side--r { justify-self: end; }
.hud-time { color: var(--amber); letter-spacing: 0.14em; font-size: 12px; white-space: nowrap; min-width: 11ch; transition: color 0.25s ease; }
.hud-time.is-swapping { color: var(--amber-soft); }
.hud-stat { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.hud-k { color: var(--muted); letter-spacing: 0.16em; font-size: 9px; }
.hud-k-short { display: none; }
.hud-v { color: var(--ink-bright); font-weight: 700; font-size: 13px; text-shadow: 0 2px 10px rgba(0,0,0,0.9); }
.hud-v[data-hud="rad"] { color: var(--danger); }

.hud-pop { text-align: center; }
.hud-pop-k {
  font-size: 10px; letter-spacing: 0.34em; text-indent: 0.34em;
  color: var(--amber-dim); margin-bottom: 6px; text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}
.hud-pop-v {
  font-size: clamp(30px, 5vw, 72px); font-weight: 800; line-height: 1; letter-spacing: 0.01em;
  min-width: 13ch;
  color: var(--ink-bright);
  color: color-mix(in oklab, var(--ink-bright), var(--danger) calc(var(--pop-heat, 0) * 78%));
  text-shadow: 0 0 36px rgba(255,107,82,calc(var(--pop-heat, 0) * 0.45)), 0 2px 16px rgba(0,0,0,0.95);
  transition: color 0.6s ease;
}

@media (min-width: 1024px) {
  .hud { grid-template-columns: 1fr auto 1fr; column-gap: 28px; }
}
@media (max-width: 1023px) {
  .hud {
    grid-template-columns: auto auto;
    grid-template-areas: "l r" "pop pop";
    row-gap: 8px; column-gap: 12px; padding-left: 16px; padding-right: 16px;
  }
  .hud.is-hidden { transform: translateY(-100%); }
  .hud-side--l { grid-area: l; }
  .hud-side--r { grid-area: r; }
  .hud-pop { grid-area: pop; }
  .hud-side { gap: 14px; }
  .hud-time { font-size: 11px; }
  .hud-v { font-size: 12px; }
  .hud-k-long { display: none; }
  .hud-k-short { display: inline; }
  .hud-pop-k { font-size: 9px; letter-spacing: 0.26em; text-indent: 0.26em; margin-bottom: 4px; }
  .hud-pop-v { font-size: clamp(24px, 7.4vw, 34px); }
}
@media (max-width: 400px) {
  .hud { padding-left: 12px; padding-right: 12px; }
  .hud-side--r .hud-stat:last-child { display: none; }
}

/* ===== Rail ===== */
.rail { position: fixed; z-index: 10; left: 28px; top: 50%; transform: translateY(-50%); height: 56vh; width: 14px; }
.rail-track { position: absolute; left: 6px; top: 0; bottom: 0; width: 1px; background: var(--muted-dim); }
.rail-fill { position: absolute; inset: 0; background: var(--amber); transform-origin: top; transform: scaleY(0); box-shadow: 0 0 8px rgba(244,166,61,0.6); }
.rail-nodes { list-style: none; margin: 0; padding: 0; position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; }
.rail-node {
  position: relative; display: block; width: 13px; height: 13px; border-radius: 50%;
  border: 1px solid var(--muted); background: var(--bg); transition: border-color 0.3s, background 0.3s, transform 0.3s;
}
.rail-node.is-active { border-color: var(--amber); background: var(--amber); transform: scale(1.15); box-shadow: 0 0 10px rgba(244,166,61,0.7); }
.rail-node.is-past { border-color: var(--amber-dim); }
.rail-node::after {
  content: attr(data-label); position: absolute; left: 24px; top: 50%; transform: translateY(-50%);
  font-size: 10px; letter-spacing: 0.14em; color: var(--ink); white-space: nowrap; opacity: 0; pointer-events: none;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9); transition: opacity 0.2s;
}
.rail-node.is-active::after { opacity: 0; }
@media (hover: hover) { .rail-node:hover::after { opacity: 1; } }
.rail-node:focus-visible { outline: 2px solid var(--amber-soft); outline-offset: 3px; }
@media (max-width: 767px) { .rail { display: none; } }
@media (min-width: 768px) and (max-width: 1023px) { .rail { left: 14px; } .rail-node::after { display: none; } }

/* ===== Page and beats ===== */
/* fixed imagery layer: one item per beat, opacity driven by timeline.js */
.scene { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 80%, transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 18%, #000 80%, transparent 100%);
}
.scene-item { position: absolute; inset: 0; opacity: 0; will-change: opacity; }
.scene-item img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%); }
.scene-item--tone { background: radial-gradient(ellipse at 50% 80%, var(--tone, rgba(244,166,61,0.18)) 0%, transparent 65%); }
.scene-shade { position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(6,5,3,0.5) 0%, transparent 25%, transparent 70%, rgba(6,5,3,0.7) 100%),
    linear-gradient(90deg, rgba(6,5,3,0.7) 0%, rgba(6,5,3,0.4) 40%, rgba(6,5,3,0.1) 70%, rgba(6,5,3,0.3) 100%);
}

.page { position: relative; z-index: 3; }

.beat {
  position: relative; min-height: 100vh; min-height: 100svh; overflow: hidden;
  display: flex; flex-direction: column; justify-content: center;
  padding: 96px 24px; scroll-margin-top: var(--hud-h);
}

/* the text block: scrolls over the fixed imagery */
.beat-body {
  position: relative; z-index: 2; max-width: 620px; width: 100%;
  padding: 30px 34px 26px; border-left: 2px solid rgba(244,166,61,0.7);
  background: linear-gradient(90deg, rgba(6,5,3,0.78) 0%, rgba(6,5,3,0.62) 70%, rgba(6,5,3,0.35) 100%);
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
}

.beat-time { font-size: 12px; letter-spacing: 0.22em; color: var(--amber); margin-bottom: 18px; text-shadow: 0 2px 10px rgba(0,0,0,0.9); }
.beat-time::before { content: '> '; color: var(--amber-dim); }
.beat-h {
  font-size: clamp(30px, 4.6vw, 54px); font-weight: 800; letter-spacing: 0.02em; line-height: 1.05;
  color: var(--ink-bright); margin: 0 0 22px; text-transform: uppercase; text-wrap: balance;
  text-shadow: 0 2px 18px rgba(0,0,0,0.85);
}
.beat-body p { margin: 0 0 16px; font-size: clamp(15px, 1.4vw, 18px); line-height: 1.65; color: var(--ink-bright); text-shadow: 0 2px 12px rgba(0,0,0,0.9); text-wrap: pretty; }
.beat-body p strong { color: var(--amber); font-weight: 700; }
.beat-body p em { font-style: normal; color: var(--ink); }

.expander { margin-top: 10px; }
.expander-btn {
  font: inherit; font-size: 12px; letter-spacing: 0.16em; color: var(--amber); background: none; border: 0; padding: 12px 0; cursor: pointer;
  min-height: 44px; display: inline-flex; align-items: center; gap: 10px; text-align: left; text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}
.expander-btn::before { content: '[+]'; color: var(--amber-dim); }
.expander-btn[aria-expanded="true"]::before { content: '[-]'; }
.expander-btn:focus-visible { outline: 2px solid var(--amber-soft); outline-offset: 4px; }
@media (hover: hover) { .expander-btn:hover { color: var(--amber-soft); } }
.expander-panel { border-left: 1px solid rgba(244,166,61,0.4); padding: 6px 0 4px 18px; margin: 6px 0 0 4px; max-width: 540px; }
.expander-panel p { font-size: 14px; line-height: 1.7; color: var(--ink); margin: 0 0 12px; }
.expander-panel p:last-child { margin-bottom: 0; }
.expander-panel .src { font-size: 11px; letter-spacing: 0.08em; color: var(--muted); }

/* ===== Hero ===== */
.beat--hero { align-items: center; text-align: center; padding: 40px 24px; }
.hero-vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at center, rgba(5,4,2,0.3) 10%, rgba(5,4,2,0.8) 100%); }
.hero-glow { position: absolute; z-index: 1; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(1000px, 90vw); height: 520px; pointer-events: none; background: radial-gradient(ellipse at center, rgba(4,3,1,0.7) 0%, rgba(4,3,1,0.35) 55%, transparent 80%); }
.hero-topbar { position: absolute; z-index: 3; top: 28px; left: 28px; right: 28px; display: flex; justify-content: space-between; gap: 16px; }
.sys-tag { font-size: 12px; letter-spacing: 0.08em; color: var(--ink); animation: flicker 6s infinite; text-shadow: 0 2px 8px rgba(0,0,0,0.8); }
.grid-tag { font-size: 12px; letter-spacing: 0.08em; color: var(--ink-bright); text-shadow: 0 2px 8px rgba(0,0,0,0.8); }
.hero-content { position: relative; z-index: 2; animation: fadeUp 1s ease-out; }
.eyebrow { font-size: clamp(11px, 1.3vw, 14px); letter-spacing: 0.35em; color: #d4c4a8; margin-bottom: 18px; text-shadow: 0 2px 10px rgba(0,0,0,0.8); }
.title { font-size: clamp(60px, 13vw, 160px); font-weight: 800; letter-spacing: 0.02em; margin: 0; color: var(--amber); text-shadow: 0 0 40px rgba(244,166,61,0.35), 0 0 90px rgba(244,166,61,0.15); line-height: 0.95; }
.subtitle { font-size: clamp(15px, 2vw, 22px); color: var(--ink-bright); margin-top: 22px; letter-spacing: 0.05em; text-shadow: 0 2px 10px rgba(0,0,0,0.8); }
.status-line { margin-top: 34px; font-size: 14px; color: var(--ink); letter-spacing: 0.05em; text-shadow: 0 2px 8px rgba(0,0,0,0.8); }
.hero-frame { margin: 56px auto 0; max-width: 520px; font-size: 13px; line-height: 1.7; color: var(--ink); letter-spacing: 0.02em; text-shadow: 0 2px 10px rgba(0,0,0,0.9); opacity: 0; animation: fadeUp 1s ease-out 1.2s forwards; }
.scroll-prompt {
  position: absolute; z-index: 3; bottom: 30px; left: 50%; transform: translateX(-50%);
  font-size: 11px; letter-spacing: 0.2em; color: var(--amber); white-space: nowrap; opacity: 0;
  animation: fadeUpCentered 0.8s ease-out 2.2s forwards, bob 2.4s ease-in-out 3s infinite;
}
.scroll-prompt svg { display: block; margin: 8px auto 0; }

/* ===== Micro-visuals ===== */
.clock-wrap { position: relative; z-index: 2; margin: 8px 0 26px; }
.clock { font-size: clamp(46px, 8vw, 118px); font-weight: 800; letter-spacing: 0.04em; line-height: 1; color: var(--ink-bright); font-variant-numeric: tabular-nums; text-shadow: 0 0 30px rgba(244,166,61,0.25), 0 2px 18px rgba(0,0,0,0.9); transition: color 0.3s; }
.clock.is-critical { color: var(--danger); animation: flicker 0.9s infinite; text-shadow: 0 0 30px rgba(255,107,82,0.45), 0 2px 18px rgba(0,0,0,0.9); }
.clock-sub { font-size: 11px; letter-spacing: 0.2em; color: var(--muted); margin-top: 10px; }
.clock-sub b { color: var(--amber); font-weight: 700; }

/* ===== CTA ===== */
.beat--cta { align-items: center; text-align: center; }
.cta-vignette { position: absolute; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at center, rgba(5,4,2,0.3) 20%, rgba(5,4,2,0.7) 100%); }
.cta-content { position: relative; z-index: 2; text-align: center; }
.cta-label { font-size: 13px; letter-spacing: 0.2em; color: #a89d89; margin-bottom: 22px; text-shadow: 0 2px 10px rgba(0,0,0,0.9); }
.cta-lead { max-width: 520px; margin: 0 auto 34px; font-size: clamp(15px, 1.5vw, 18px); line-height: 1.65; color: var(--ink-bright); text-shadow: 0 2px 12px rgba(0,0,0,0.9); }
.cta-button {
  display: inline-flex; align-items: center; gap: 14px; padding: 22px 44px;
  border: 1px solid var(--amber); color: var(--amber);
  font-size: clamp(16px, 2vw, 20px); font-weight: 700; letter-spacing: 0.08em;
  background: rgba(244,166,61,0.06); box-shadow: 0 0 40px rgba(244,166,61,0.12);
  transition: background 0.2s, box-shadow 0.2s;
}
@media (hover: hover) { .cta-button:hover { color: var(--amber); background: rgba(244,166,61,0.16); box-shadow: 0 0 60px rgba(244,166,61,0.25); } }
.cta-button:focus-visible { outline: 2px solid var(--amber-soft); outline-offset: 4px; }
.cta-footnote { margin-top: 26px; font-size: 12px; color: var(--ink); letter-spacing: 0.1em; text-shadow: 0 2px 10px rgba(0,0,0,0.9); }

/* ===== Footer ===== */
.site-footer {
  position: relative; z-index: 1; padding: 28px 24px 32px; text-align: center;
  font-size: 11px; letter-spacing: 0.1em; color: var(--muted-dim);
  background: var(--bg-deep); border-top: 1px solid rgba(244,166,61,0.08);
}
.site-footer p { margin: 0 0 10px; }
.site-footer p:last-child { margin: 0; letter-spacing: 0.04em; color: var(--muted); line-height: 1.7; max-width: 720px; margin-inline: auto; }

/* ===== Responsive ===== */
@media (min-width: 1024px) {
  .beat { padding: calc(var(--hud-h) + 24px) 96px 96px 150px; }
  .beat--hero, .beat--cta { padding-left: 24px; padding-right: 24px; }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .beat { padding: calc(var(--hud-h) + 48px) 40px 72px 64px; }
}
@media (max-width: 767px) {
  .beat { justify-content: flex-end; padding: calc(var(--hud-h) + 40px) 20px calc(56px + env(safe-area-inset-bottom)); }
  .beat--hero { justify-content: center; padding: 40px 20px; }
  .beat--hero .hero-topbar { top: 18px; left: 18px; right: 18px; }
  .scene-shade { background: linear-gradient(180deg, rgba(6,5,3,0.5) 0%, rgba(6,5,3,0.2) 30%, rgba(6,5,3,0.45) 60%, rgba(6,5,3,0.85) 100%); }
  .beat-body { padding: 22px 20px 18px; background: linear-gradient(180deg, rgba(6,5,3,0.55), rgba(6,5,3,0.8)); }
  .beat-body p { font-size: 15px; }
  .hero-frame { margin-top: 40px; font-size: 12px; }
}
@media (min-width: 1280px) {
  .beat { padding-left: 200px; }
}

/* HUD band is shorter in the stacked (two-row) layout */
@media (max-width: 1023px) { :root { --hud-h: 92px; } }
