/* ============================================================================
 * Predictions vs Reality — styles
 * Theme-aware (dark default). Palette follows the validated data-viz reference:
 * blue/aqua/yellow/green/violet/red/magenta/orange categorical; good/warn/crit
 * status; ink + surface tokens swap in one place per theme.
 * ==========================================================================*/

:root,
:root[data-theme="dark"] {
  --page:        #0d0d0d;
  --surface:     #1a1a19;
  --surface-2:   #232322;
  --ink:         #ffffff;
  --ink-2:       #c3c2b7;
  --muted:       #898781;
  --hair:        #2c2c2a;
  --ring:        rgba(255,255,255,0.10);
  --accent:      #3987e5;   /* blue */
  --accent-soft: rgba(57,135,229,0.14);
  --good:        #0ca30c;
  --warn:        #fab219;
  --crit:        #e06464;
  --shadow:      0 8px 30px rgba(0,0,0,0.45);
}
:root[data-theme="light"] {
  --page:        #f4f2ec;
  --surface:     #fcfcfb;
  --surface-2:   #f3f2ee;
  --ink:         #0b0b0b;
  --ink-2:       #52514e;
  --muted:       #75736d;
  --hair:        #e1e0d9;
  --ring:        rgba(11,11,11,0.10);
  --accent:      #2a78d6;
  --accent-soft: rgba(42,120,214,0.10);
  --good:        #0a8a0a;
  --warn:        #b97e00;
  --crit:        #c53232;
  --shadow:      0 8px 30px rgba(20,20,20,0.10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
em { font-style: italic; color: var(--ink); }
code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--surface-2);
  padding: 0.1em 0.4em;
  border-radius: 5px;
}

/* ---------- NAV ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem clamp(1rem, 4vw, 2.5rem);
  background: color-mix(in srgb, var(--page) 82%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--hair);
}
.brand {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-weight: 700; letter-spacing: -0.02em; color: var(--ink);
  font-size: 1.02rem; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-vs { color: var(--muted); font-weight: 500; font-style: italic; }
.brand-orb {
  width: 15px; height: 15px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #cfe3ff, var(--accent) 60%, #16407a);
  box-shadow: 0 0 12px var(--accent-soft);
}
.nav-links {
  display: flex; gap: 1.1rem; margin-left: auto;
  font-size: 0.88rem; overflow-x: auto; scrollbar-width: none;
}
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a { color: var(--ink-2); white-space: nowrap; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }
.theme-toggle {
  flex: none; width: 38px; height: 38px; border-radius: 50%;
  border: 1px solid var(--hair); background: var(--surface);
  color: var(--ink); cursor: pointer; font-size: 1rem;
  display: grid; place-items: center; transition: background 0.2s;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-icon-light { display: none; }
:root[data-theme="light"] .theme-icon-dark { display: none; }
:root[data-theme="light"] .theme-icon-light { display: inline; }

/* ---------- HERO ---------- */
.hero {
  max-width: 1000px; margin: 0 auto;
  padding: clamp(3rem, 9vw, 6.5rem) clamp(1.2rem, 5vw, 2rem) clamp(2rem, 5vw, 3.5rem);
  text-align: center;
}
.eyebrow {
  text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.74rem;
  color: var(--muted); margin: 0 0 1.2rem;
}
.hero h1 {
  font-size: clamp(1.9rem, 5.2vw, 3.6rem); line-height: 1.1;
  letter-spacing: -0.03em; margin: 0 0 1.4rem; font-weight: 800;
}
.hero-accent { color: var(--muted); font-weight: 700; }
.hero-accent em { color: var(--accent); font-style: normal; }
.hero-sub {
  max-width: 640px; margin: 0 auto 2.4rem;
  font-size: clamp(1rem, 2.2vw, 1.18rem); color: var(--ink-2);
}
.hero-stats {
  display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center;
  margin-bottom: 2.6rem;
}
.stat {
  flex: 1 1 150px; max-width: 220px;
  background: var(--surface); border: 1px solid var(--hair);
  border-radius: 14px; padding: 1.1rem 1rem; box-shadow: var(--shadow);
}
.stat-num { font-size: 2.1rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.stat-num.good { color: var(--good); }
.stat-num.crit { color: var(--crit); }
.stat-num.accent { color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--muted); margin-top: 0.45rem; }
.scroll-cue {
  display: inline-block; color: var(--muted); font-size: 0.9rem;
  animation: bob 2.4s ease-in-out infinite;
}
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(6px); } }

/* ---------- BANDS / SECTION HEADS ---------- */
.band { padding: clamp(3rem, 7vw, 5.5rem) clamp(1.2rem, 5vw, 3rem); }
.band.alt { background: var(--surface); border-block: 1px solid var(--hair); }
.section-head { max-width: 760px; margin: 0 auto 2.6rem; text-align: center; }
.section-kicker {
  display: inline-block; text-transform: uppercase; letter-spacing: 0.16em;
  font-size: 0.7rem; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); padding: 0.3rem 0.7rem; border-radius: 999px;
  margin-bottom: 1rem;
}
.section-head h2 {
  font-size: clamp(1.6rem, 4vw, 2.5rem); letter-spacing: -0.025em;
  margin: 0 0 0.8rem; font-weight: 800;
}
.section-lede { color: var(--ink-2); font-size: 1.02rem; margin: 0; }
.chart-note, .spectrum-explainer, .result-count {
  color: var(--muted); font-size: 0.86rem; text-align: center;
}

/* ---------- 2 · ERA TIMELINE ---------- */
.era-layout {
  max-width: 1060px; margin: 0 auto;
  display: grid; grid-template-columns: 260px 1fr; gap: 2rem;
}
.era-rail { list-style: none; margin: 0; padding: 0; position: relative; }
.era-rail::before {
  content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px;
  width: 2px; background: var(--hair);
}
.era-node {
  position: relative; padding: 0.55rem 0 0.55rem 2.1rem;
  cursor: pointer; color: var(--ink-2); transition: color 0.2s;
}
.era-node::before {
  content: ""; position: absolute; left: 4px; top: 0.95rem;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--muted); transition: all 0.2s;
}
.era-node:hover { color: var(--ink); }
.era-node.active { color: var(--ink); }
.era-node.active::before { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.era-node .era-period { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.era-node .era-name { font-weight: 700; font-size: 1rem; }
.era-detail {
  background: var(--surface); border: 1px solid var(--hair); border-radius: 16px;
  padding: clamp(1.4rem, 3vw, 2rem); box-shadow: var(--shadow); min-height: 260px;
}
.era-detail h3 { margin: 0 0 0.2rem; font-size: 1.5rem; letter-spacing: -0.02em; }
.era-detail .era-detail-period { color: var(--accent); font-size: 0.82rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; }
.era-detail p { margin: 1rem 0 0; color: var(--ink-2); }
.era-detail .era-example {
  margin-top: 1.1rem; padding: 0.9rem 1.1rem; border-left: 3px solid var(--accent);
  background: var(--accent-soft); border-radius: 0 10px 10px 0; color: var(--ink);
}
.era-detail .era-verdict { font-style: italic; color: var(--ink); border-top: 1px solid var(--hair); padding-top: 1rem; }
.era-detail .src-link { font-size: 0.82rem; }

/* ---------- 3 · BIAS CHART ---------- */
.bias-chart { max-width: 780px; margin: 0 auto 1rem; display: grid; gap: 0.55rem; }
.bias-row { display: grid; grid-template-columns: 120px 1fr; align-items: center; gap: 0.8rem; }
.bias-row .bias-label { text-align: right; font-size: 0.9rem; color: var(--ink-2); font-weight: 600; }
.bias-track {
  position: relative; height: 30px; background: var(--surface-2);
  border-radius: 8px; overflow: hidden;
}
.bias-track::before { /* center line = neutral */
  content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1px;
  background: var(--muted); opacity: 0.5;
}
.bias-fill {
  position: absolute; top: 3px; bottom: 3px; border-radius: 5px; transition: all 0.6s cubic-bezier(.2,.7,.2,1);
  display: flex; align-items: center;
}
.bias-fill.pos { left: 50%; justify-content: flex-end; padding-right: 8px; }
.bias-fill.neg { right: 50%; justify-content: flex-start; padding-left: 8px; }
.bias-fill .bias-val { font-size: 0.72rem; font-weight: 700; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.4); white-space: nowrap; }

/* ---------- 4 · SPECTRUM ---------- */
.spectrum {
  max-width: 960px; margin: 0 auto 0.6rem; position: relative;
  height: 120px; border-radius: 16px;
  background: linear-gradient(90deg,
     rgba(12,163,12,0.22) 0%, rgba(250,178,25,0.20) 50%, rgba(208,59,59,0.24) 100%);
  border: 1px solid var(--hair);
}
.spectrum-dot {
  position: absolute; top: 50%; transform: translate(-50%,-50%);
  padding: 0.4rem 0.75rem; border-radius: 999px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--ring); box-shadow: var(--shadow);
  font-size: 0.8rem; font-weight: 600; white-space: nowrap; transition: transform 0.15s;
}
.spectrum-dot:hover, .spectrum-dot.active { transform: translate(-50%,-50%) scale(1.08); border-color: var(--accent); }
.spectrum-axis {
  max-width: 960px; margin: 0 auto; display: flex; justify-content: space-between;
  font-size: 0.78rem; color: var(--muted); padding: 0 0.4rem;
}
.spectrum-explainer {
  max-width: 720px; margin: 1.2rem auto 0; min-height: 3rem;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 12px;
  padding: 1rem 1.2rem; color: var(--ink); font-size: 0.95rem;
}

/* ---------- 5 · FILTERS + CARDS ---------- */
.filters {
  max-width: 1080px; margin: 0 auto 1rem; display: flex; flex-wrap: wrap;
  gap: 1.4rem; justify-content: center;
}
.filter-group { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; }
.filter-group .fg-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-right: 0.2rem; }
.chip {
  font: inherit; font-size: 0.8rem; cursor: pointer;
  padding: 0.32rem 0.72rem; border-radius: 999px;
  border: 1px solid var(--hair); background: var(--surface); color: var(--ink-2);
  transition: all 0.15s; display: inline-flex; align-items: center; gap: 0.35rem;
}
.chip:hover { color: var(--ink); border-color: var(--muted); }
.chip.active { background: var(--ink); color: var(--page); border-color: var(--ink); }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; }
.result-count { margin: 0.4rem 0 1.4rem; }
.cards {
  max-width: 1140px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem;
}
.card {
  background: var(--surface); border: 1px solid var(--hair); border-radius: 16px;
  padding: 1.3rem; display: flex; flex-direction: column; gap: 0.7rem;
  box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--card-accent, var(--accent)); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.card-sector { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--card-accent); }
.card-outcome { font-size: 0.72rem; font-weight: 700; display: inline-flex; align-items: center; gap: 0.35rem; }
.card-claim { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.4; }
.card-who { font-size: 0.82rem; color: var(--muted); }
.card-meta { font-size: 0.74rem; color: var(--muted); display: flex; gap: 0.8rem; }
.card-reality { font-size: 0.92rem; color: var(--ink-2); }
.card-reality strong { color: var(--ink); }
.card-fail {
  font-size: 0.78rem; color: var(--ink-2); background: var(--surface-2);
  border-radius: 8px; padding: 0.55rem 0.7rem; border: 1px solid var(--hair);
}
.card-fail b { color: var(--warn); }
.card-src { font-size: 0.78rem; margin-top: auto; }
.card-anim { animation: rise 0.4s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- 6 · GAME ---------- */
.game { max-width: 720px; margin: 0 auto; }
.game-scorebar {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid var(--hair); border-radius: 12px;
  padding: 0.7rem 1.1rem; margin-bottom: 1rem; font-size: 0.9rem;
}
.game-scorebar b { color: var(--accent); font-size: 1.15rem; }
.game-card {
  background: var(--surface); border: 1px solid var(--hair); border-radius: 18px;
  padding: clamp(1.4rem, 4vw, 2rem); box-shadow: var(--shadow); text-align: center;
}
.game-sector { font-size: 0.74rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--card-accent, var(--accent)); }
.game-claim { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; margin: 0.7rem 0 0.4rem; line-height: 1.35; }
.game-who { color: var(--muted); font-size: 0.9rem; margin-bottom: 1.4rem; }
.game-prompt { font-weight: 600; margin-bottom: 0.9rem; color: var(--ink-2); }
.game-choices { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; }
.game-btn {
  font: inherit; font-weight: 700; cursor: pointer; padding: 0.7rem 1.4rem;
  border-radius: 12px; border: 2px solid var(--hair); background: var(--surface-2); color: var(--ink);
  transition: all 0.15s; min-width: 150px;
}
.game-btn:hover { border-color: var(--accent); transform: translateY(-2px); }
.game-btn.came { border-color: color-mix(in srgb, var(--good) 55%, var(--hair)); }
.game-btn.missed { border-color: color-mix(in srgb, var(--crit) 55%, var(--hair)); }
.game-reveal { margin-top: 1.4rem; text-align: left; animation: rise 0.35s ease both; }
.game-verdict { font-size: 1.1rem; font-weight: 800; text-align: center; margin-bottom: 0.8rem; }
.game-verdict.right { color: var(--good); }
.game-verdict.wrong { color: var(--crit); }
.game-reality { color: var(--ink-2); background: var(--surface-2); border-radius: 10px; padding: 0.9rem 1.1rem; }
.game-reality strong { color: var(--ink); }
.game-next {
  margin-top: 1.2rem; font: inherit; font-weight: 700; cursor: pointer;
  padding: 0.7rem 1.6rem; border-radius: 12px; border: none;
  background: var(--accent); color: #fff; display: block; margin-inline: auto;
}
.game-next:hover { filter: brightness(1.08); }
.game-done { text-align: center; padding: 2rem 1rem; }
.game-done .big { font-size: 3rem; font-weight: 800; color: var(--accent); }

/* ---------- 7 · HORIZON ---------- */
.horizon-grid {
  max-width: 1140px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.1rem;
}
.horizon-card {
  background: var(--surface); border: 1px solid var(--hair); border-radius: 16px;
  padding: 1.4rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 0.6rem;
}
.horizon-top { display: flex; justify-content: space-between; align-items: baseline; }
.horizon-year { font-size: 0.78rem; font-weight: 800; letter-spacing: 0.05em; color: var(--card-accent, var(--accent)); background: var(--accent-soft); padding: 0.2rem 0.6rem; border-radius: 999px; }
.horizon-sector { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.horizon-headline { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.02em; }
.horizon-detail { font-size: 0.92rem; color: var(--ink-2); }
.horizon-conf { margin-top: 0.3rem; }
.conf-bar { height: 7px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-bottom: 0.35rem; }
.conf-fill { height: 100%; border-radius: 4px; }
.conf-label { font-size: 0.74rem; font-weight: 700; }
.horizon-note { font-size: 0.8rem; color: var(--muted); font-style: italic; border-top: 1px solid var(--hair); padding-top: 0.6rem; }
.horizon-src { font-size: 0.76rem; }

/* ---------- 8 · SOURCES ---------- */
.source-list { max-width: 820px; margin: 0 auto; padding: 0; list-style: none; display: grid; gap: 0.5rem; }
.source-list li {
  background: var(--surface); border: 1px solid var(--hair); border-radius: 10px;
  padding: 0.7rem 1rem; font-size: 0.9rem; display: flex; gap: 0.6rem; align-items: baseline;
}
.source-list .s-tag { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); flex: none; min-width: 88px; }

/* ---------- FOOTER ---------- */
.foot { text-align: center; padding: 3rem 1.5rem; color: var(--ink-2); border-top: 1px solid var(--hair); }
.foot-dim { color: var(--muted); font-size: 0.84rem; }
.src-link::after { content: " ↗"; font-size: 0.8em; opacity: 0.7; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 720px) {
  .nav-links { display: none; }
  .era-layout { grid-template-columns: 1fr; }
  .era-rail { display: flex; overflow-x: auto; gap: 0.5rem; }
  .era-rail::before { display: none; }
  .era-node { flex: none; padding: 0.5rem 0.8rem; border: 1px solid var(--hair); border-radius: 999px; }
  .era-node::before { display: none; }
  .bias-row { grid-template-columns: 84px 1fr; }
  .bias-row .bias-label { font-size: 0.78rem; }
  .theme-toggle { margin-left: auto; }
  /* phone: the spectrum labels can't fit side by side, so they wrap in order (knowable → black swans) */
  .spectrum { height: auto; display: flex; flex-wrap: wrap; justify-content: center; gap: 0.45rem; padding: 0.9rem 0.6rem; }
  .spectrum-dot { position: static; transform: none; margin-top: 0 !important; }
  .spectrum-dot:hover, .spectrum-dot.active { transform: scale(1.05); }
}
button { font-family: inherit; }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; scroll-behavior: auto; transition: none !important; }
}
