/* ============================================================
   RiskEra — space risk-web. Void black, marble bone, gold accent,
   green = rising, red = falling.
   ============================================================ */
:root {
  --void:   #06070B;
  --void-2: #0C0E14;
  --panel:  #11131A;
  --bone:   #ECE7DD;
  --muted:  #9AA0AA;
  --line:   #20232B;

  --gold:   #F4B740;
  --gold-hi:#FFD274;
  --up:     #35D29A;   /* rising / money in */
  --down:   #E8694A;   /* falling / money out */

  --maxw: 1080px;
  --gut: clamp(20px, 5vw, 64px);

  --f-display: "Archivo", system-ui, sans-serif;
  --f-body: "Hanken Grotesk", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  background: var(--void);
  color: var(--bone);
  font-family: var(--f-body);
  font-size: clamp(16px, 1.05vw + 13px, 19px);
  line-height: 1.6;
  letter-spacing: 0.01em;
  overflow-x: hidden;
}

/* ---- background stack (bottom → top): footage · stars · gold glow · grain · content ---- */
.fx-layer { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
  /* fade the footage into the void at the edges so it never looks like a panel */
  -webkit-mask: radial-gradient(125% 115% at 50% 38%, #000 32%, transparent 78%);
          mask: radial-gradient(125% 115% at 50% 38%, #000 32%, transparent 78%);
}
.fx-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 1.2s ease;
  /* monochrome hextech treatment — bone/void, not stock-video color */
  filter: grayscale(1) contrast(1.16) brightness(0.55);
  will-change: opacity, transform, filter;
}
.fx-video.on { opacity: 0.20; }

.stars { position: fixed; inset: 0; z-index: 1; display: block; pointer-events: none; }
body::after {
  content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120vw 90vh at 50% -20%, rgba(244,183,64,0.07), transparent 55%);
}

/* scanline + film-grain wash */
.fx-grain { position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: 0.5;
  background:
    repeating-linear-gradient(to bottom, rgba(0,0,0,0.16) 0 1px, transparent 1px 3px),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/></svg>");
  background-size: auto, 160px 160px;
  mix-blend-mode: overlay;
  animation: grainShift 0.9s steps(3) infinite;
}
@keyframes grainShift {
  0% { background-position: 0 0, 0 0; }
  100% { background-position: 0 0, 24px 14px; }
}

.nav, main, .foot { position: relative; z-index: 3; }

/* ---- event-change glitch burst (footage + headline pop together) ---- */
.fx-burst .fx-video.on { animation: fxKick 0.7s steps(2) 1; }
@keyframes fxKick {
  0%   { transform: translate3d(0,0,0); filter: grayscale(1) contrast(1.16) brightness(0.55); }
  18%  { transform: translate3d(-1.5%,0,0); filter: grayscale(1) contrast(1.5) brightness(0.8)
         drop-shadow(3px 0 rgba(244,183,64,0.6)) drop-shadow(-3px 0 rgba(80,180,255,0.5)); }
  36%  { transform: translate3d(1.5%,0,0); }
  60%  { transform: translate3d(-0.6%,0,0); filter: grayscale(1) contrast(1.2) brightness(0.6); }
  100% { transform: translate3d(0,0,0); filter: grayscale(1) contrast(1.16) brightness(0.55); }
}

/* ---------- shared type ---------- */
.eyebrow {
  font-family: var(--f-mono);
  font-size: 12px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 1.4rem;
  display: inline-flex; align-items: center; gap: 9px;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--up); box-shadow: 0 0 10px var(--up); animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.lead {
  font-family: var(--f-display); font-weight: 800;
  font-size: clamp(28px, 4.4vw, 52px); line-height: 1.05; letter-spacing: -0.02em;
  max-width: 18ch; margin-bottom: 1.4rem;
}
.body { color: #C7C3BA; max-width: 56ch; font-size: clamp(16px, 1.1vw + 12px, 20px); }

/* ---------- nav ---------- */
.nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px var(--gut); position: sticky; top: 0;
  backdrop-filter: blur(10px);
  background: linear-gradient(var(--void), rgba(6,7,11,0.3));
  border-bottom: 1px solid transparent; transition: border-color .3s ease;
}
.nav.scrolled { border-bottom-color: var(--line); }
.mark { font-family: var(--f-display); font-weight: 900; letter-spacing: 0.18em; font-size: 18px; color: var(--bone); text-decoration: none; }
.mark.small { font-size: 15px; }
.nav-cta {
  font-family: var(--f-mono); font-size: 12.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--bone); text-decoration: none; padding: 9px 16px;
  border: 1px solid var(--line); border-radius: 2px; transition: border-color .25s ease, color .25s ease;
}
.nav-cta:hover { border-color: var(--gold); color: var(--gold); }

/* ---------- hero ---------- */
.hero {
  min-height: 88vh; display: flex; flex-direction: column; justify-content: center;
  padding: 0 var(--gut); max-width: var(--maxw); margin: 0 auto;
}
.hero-title {
  font-family: var(--f-display); font-weight: 900;
  font-size: clamp(44px, 9vw, 116px); line-height: 0.95; letter-spacing: -0.03em; margin-bottom: 1.6rem;
}
.hero-title span { display: block; }
.hero-title .accent { color: var(--gold); text-shadow: 0 0 36px rgba(244,183,64,0.3); }

/* ---- Arcane / hextech glitch headline ---- */
.glitch span { position: relative; }
.glitch span::before, .glitch span::after {
  content: attr(data-text); position: absolute; inset: 0; pointer-events: none;
  clip-path: inset(0 0 100% 0); opacity: 0;
}
.glitch span::before { color: #50b4ff; transform: translate3d(-2px,0,0); }  /* blue split */
.glitch span::after  { color: var(--gold); transform: translate3d(2px,0,0); } /* gold split */
/* gentle ambient shimmer so it feels alive without strobing */
.glitch span::before { animation: glAmbientA 7s steps(1) infinite; }
.glitch span::after  { animation: glAmbientB 8s steps(1) infinite; }
@keyframes glAmbientA {
  0%, 96%, 100% { opacity: 0; clip-path: inset(0 0 100% 0); }
  97% { opacity: 0.5; clip-path: inset(10% 0 80% 0); transform: translate3d(-3px,0,0); }
  98.5% { opacity: 0.4; clip-path: inset(60% 0 20% 0); transform: translate3d(2px,0,0); }
}
@keyframes glAmbientB {
  0%, 95%, 100% { opacity: 0; clip-path: inset(0 0 100% 0); }
  96% { opacity: 0.45; clip-path: inset(40% 0 35% 0); transform: translate3d(3px,0,0); }
  97.5% { opacity: 0.35; clip-path: inset(78% 0 8% 0); transform: translate3d(-2px,0,0); }
}
/* strong burst on a real event change (root .fx-burst toggled by the engine) */
.fx-burst .glitch span::before { animation: glKickA 0.7s steps(2) 1; }
.fx-burst .glitch span::after  { animation: glKickB 0.7s steps(2) 1; }
@keyframes glKickA {
  0% { opacity: 0.8; clip-path: inset(8% 0 70% 0); transform: translate3d(-6px,0,0); }
  30% { clip-path: inset(55% 0 22% 0); transform: translate3d(5px,0,0); }
  60% { clip-path: inset(20% 0 60% 0); transform: translate3d(-3px,0,0); }
  100% { opacity: 0; transform: translate3d(0,0,0); }
}
@keyframes glKickB {
  0% { opacity: 0.7; clip-path: inset(72% 0 6% 0); transform: translate3d(6px,0,0); }
  30% { clip-path: inset(12% 0 64% 0); transform: translate3d(-5px,0,0); }
  60% { clip-path: inset(48% 0 30% 0); transform: translate3d(3px,0,0); }
  100% { opacity: 0; transform: translate3d(0,0,0); }
}
.hero-sub { color: #C7C3BA; max-width: 52ch; font-size: clamp(17px, 1.2vw + 13px, 22px); margin-bottom: 2.4rem; }
.scroll-hint { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); margin-top: 3rem; }
.scroll-hint::before { content: "↓  "; }

/* ---------- buttons ---------- */
.btn {
  display: inline-block; align-self: flex-start;
  font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--void); background: var(--gold); text-decoration: none;
  padding: 14px 26px; border: 0; border-radius: 2px; cursor: pointer;
  transition: transform .2s ease, box-shadow .25s ease, background .25s ease;
}
.btn:hover { background: var(--gold-hi); box-shadow: 0 0 28px rgba(244,183,64,0.4); transform: translateY(-1px); }
.btn:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 3px; }

/* ---------- the risk web ---------- */
.web-wrap { max-width: 1200px; margin: 0 auto; padding: clamp(40px, 8vh, 90px) var(--gut); }
.web-head { max-width: var(--maxw); }
.web-head h2 { font-family: var(--f-display); font-weight: 800; font-size: clamp(26px, 4vw, 46px); letter-spacing: -0.02em; }
.web-sub { color: #B7B3AB; max-width: 54ch; margin-top: .8rem; }

.graph-stage {
  position: relative; margin-top: 1.8rem;
  height: clamp(420px, 70vh, 720px);
  border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: radial-gradient(80% 80% at 50% 40%, rgba(20,24,34,0.5), rgba(6,7,11,0.2));
}
#graph { position: absolute; inset: 0; }
#graph canvas { display: block; }

.graph-state {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.08em; color: var(--muted);
  pointer-events: none; text-align: center; padding: 0 1rem;
}
.graph-state.hidden { display: none; }

.legend {
  position: absolute; left: 14px; bottom: 12px; list-style: none;
  display: flex; flex-wrap: wrap; gap: 6px 16px; max-width: calc(100% - 28px);
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.04em; color: var(--muted);
  background: rgba(6,7,11,0.55); padding: 8px 12px; border-radius: 4px; border: 1px solid var(--line);
}
.legend li { display: flex; align-items: center; gap: 7px; }
.legend span { width: 14px; height: 0; display: inline-block; }
.lg-size { width: 12px; height: 12px; border-radius: 50%; background: var(--gold); }
.lg-up { border-top: 2px solid var(--up); }
.lg-down { border-top: 2px solid var(--down); }
.lg-solid { border-top: 2px solid var(--bone); }
.lg-dash { border-top: 2px dashed var(--bone); }

/* accessible list */
.as-list { margin-top: 1.4rem; max-width: var(--maxw); }
.as-list summary { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); cursor: pointer; }
.as-list summary:hover { color: var(--gold); }
#eventList { list-style: none; margin-top: 1rem; display: grid; gap: 10px; }
#eventList li { border-top: 1px solid var(--line); padding-top: 10px; color: #C7C3BA; font-size: 15px; }
#eventList b { color: var(--bone); font-family: var(--f-display); font-weight: 600; }
#eventList .pct { font-family: var(--f-mono); color: var(--gold); }

/* ---------- bands ---------- */
.band { max-width: var(--maxw); margin: 0 auto; padding: clamp(72px, 12vh, 150px) var(--gut); }
.join { padding-bottom: clamp(90px, 16vh, 200px); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- signup ---------- */
.signup { margin-top: 1rem; max-width: 520px; }
.field { display: flex; gap: 10px; flex-wrap: wrap; }
#email {
  flex: 1 1 220px; background: var(--panel); border: 1px solid var(--line); border-radius: 2px;
  color: var(--bone); font-family: var(--f-body); font-size: 16px; padding: 14px 16px; transition: border-color .2s ease;
}
#email::placeholder { color: #5C606A; }
#email:focus { outline: none; border-color: var(--gold); }
.field .btn { flex: 0 0 auto; }
.form-note { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.04em; color: var(--muted); margin-top: 14px; }
.form-note.ok { color: var(--up); }
.form-note.err { color: var(--down); }

/* ---------- footer ---------- */
.foot {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 30px var(--gut); border-top: 1px solid var(--line);
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.08em; color: var(--muted);
}
.foot .mark { color: var(--bone); }
.foot-copy { margin-left: auto; }

/* ---------- reveal motion (progressive enhancement) ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s cubic-bezier(.2,.6,.2,1), transform .7s cubic-bezier(.2,.6,.2,1); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- mobile ---------- */
@media (max-width: 720px) {
  .nav-cta { display: none; }
  .field { flex-direction: column; }
  .field .btn { width: 100%; text-align: center; }
  .graph-stage { height: clamp(380px, 64vh, 520px); }
  .legend { font-size: 10px; gap: 5px 10px; }
  /* lighter footage + grain on phones (battery + legibility) */
  .fx-video.on { opacity: 0.14; }
  .fx-grain { opacity: 0.35; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .dot { animation: none; }
  .btn { transition: none; }
  /* no footage, no grain drift, no glitch when the user asked for calm */
  .fx-layer { display: none; }
  .fx-grain { animation: none; opacity: 0.3; }
  .glitch span::before, .glitch span::after { animation: none !important; opacity: 0 !important; }
}
