/* ===== RESET ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* ===== CUSTOM PROPERTIES ===== */
:root {
  --bg:      #0a0a0f;
  --panel:   #111118;
  --border:  #24242a;
  --red:     #d4262a;
  --navy:    #1b2a4a;
  --text:    #f5f3ee;
  --muted:   #8a8a93;
  --gold:    #c9a227;
  --font-d:  'Anton', Impact, sans-serif;
  --font-m:  'IBM Plex Mono', monospace;
  --font-b:  'Inter', system-ui, sans-serif;
}

/* ===== BASE ===== */
html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-b);
  line-height: 1.6;
  overflow-x: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ===== PROGRESS BAR ===== */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 3px;
  background: var(--red);
  z-index: 2000;
  transition: width 0.08s linear;
  pointer-events: none;
}

/* ===== TICKER ===== */
.ticker-wrap {
  background: var(--red);
  overflow: hidden;
  padding: 6px 0;
  position: sticky;
  top: 0;
  z-index: 300;
}

.ticker {
  display: flex;
  white-space: nowrap;
  animation: ticker-scroll 50s linear infinite;
}

.ticker-text {
  font-family: var(--font-m);
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #fff;
  padding-right: 0;
  flex-shrink: 0;
}

@keyframes ticker-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ===== HEADER ===== */
#site-header {
  position: sticky;
  top: 28px;
  z-index: 200;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-brand {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.site-name {
  font-family: var(--font-m);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--text);
  font-weight: 700;
}

.year-nav {
  display: flex;
  list-style: none;
  flex-wrap: wrap;
}

.year-node {
  display: inline-block;
  padding: 0.3rem 0.55rem;
  font-family: var(--font-m);
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-decoration: none;
  border: 1px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.year-node:hover {
  color: var(--text);
  border-color: var(--border);
}

.year-node:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  color: var(--text);
}

.year-node.active {
  color: var(--red);
  border-color: rgba(212, 38, 42, 0.4);
}

/* ===== MONO LABEL / EYEBROW ===== */
.mono-label {
  font-family: var(--font-m);
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ===== HERO ===== */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 7rem 4rem 5rem;
}

#starfield {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-bg-motif {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.stripes-svg {
  width: 100%;
  height: 100%;
}

.cap-silhouette {
  position: absolute;
  right: -2%;
  top: 50%;
  transform: translateY(-50%);
  width: min(55vw, 480px);
  pointer-events: none;
  z-index: 1;
  opacity: 0.5;
}

.hero-ghost {
  position: absolute;
  right: 3rem;
  bottom: 2rem;
  font-family: var(--font-d);
  font-size: clamp(80px, 18vw, 260px);
  color: rgba(212, 38, 42, 0.04);
  line-height: 1;
  z-index: 1;
  letter-spacing: -0.02em;
  user-select: none;
  opacity: 0;
  animation: fade-in 1.4s ease forwards 1.8s;
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 720px;
}

.hero-eyebrow {
  display: block;
  font-family: var(--font-m);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  color: var(--red);
  text-transform: uppercase;
  margin-bottom: 1.8rem;
  opacity: 0;
  animation: fade-up 0.7s ease forwards 0.3s;
}

.hero-title {
  font-family: var(--font-d);
  font-size: clamp(72px, 14vw, 200px);
  line-height: 0.88;
  letter-spacing: 0.01em;
  margin-bottom: 0;
}

.hero-title .word {
  display: block;
  overflow: hidden;
}

.hero-title .word span {
  display: block;
  transform: translateY(105%);
  color: var(--text);
}

.hero-title .red-word span {
  color: var(--red);
}

.hero-title .word:nth-child(1) span { animation: slide-up 0.85s cubic-bezier(0.16,1,0.3,1) forwards 0.45s; }
.hero-title .word:nth-child(2) span { animation: slide-up 0.85s cubic-bezier(0.16,1,0.3,1) forwards 0.6s; }
.hero-title .word:nth-child(3) span { animation: slide-up 0.85s cubic-bezier(0.16,1,0.3,1) forwards 0.75s; }

.hero-rule {
  width: 0;
  height: 2px;
  background: var(--red);
  margin: 2rem 0 1.75rem;
  animation: grow-rule 0.9s cubic-bezier(0.16,1,0.3,1) forwards 1.2s;
}

.hero-sub {
  font-size: clamp(0.875rem, 1.8vw, 1rem);
  color: var(--muted);
  line-height: 1.8;
  max-width: 500px;
  opacity: 0;
  animation: fade-up 0.7s ease forwards 1.4s;
}

.signal-cluster {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  margin-top: 2rem;
  opacity: 0;
  animation: fade-up 0.7s ease forwards 1.7s;
}

.signal-cluster .bar {
  width: 3px;
  background: var(--red);
  animation: bar-pulse 1.7s ease-in-out infinite;
}

.signal-cluster .bar:nth-child(1) { height: 8px;  animation-delay: 0s; }
.signal-cluster .bar:nth-child(2) { height: 15px; animation-delay: 0.15s; }
.signal-cluster .bar:nth-child(3) { height: 24px; animation-delay: 0.3s; }
.signal-cluster .bar:nth-child(4) { height: 11px; animation-delay: 0.45s; }
.signal-cluster .bar:nth-child(5) { height: 19px; animation-delay: 0.22s; }
.signal-cluster .bar:nth-child(6) { height: 7px;  animation-delay: 0.6s; }

.signal-label {
  font-family: var(--font-m);
  font-size: 0.55rem;
  letter-spacing: 0.25em;
  color: var(--muted);
  margin-left: 0.6rem;
  line-height: 1;
  align-self: center;
}

.begin-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2rem;
  padding: 0.7rem 1.4rem;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  font-family: var(--font-b);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 2px solid var(--red);
  transition: background 0.2s, color 0.2s;
  opacity: 0;
  animation: fade-up 0.7s ease forwards 1.9s;
}

.begin-cta:hover {
  background: transparent;
  color: var(--red);
}

.begin-cta:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

/* ===== HERO KEYFRAMES ===== */
@keyframes slide-up {
  to { transform: translateY(0); }
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  to { opacity: 1; }
}

@keyframes grow-rule {
  to { width: 120px; }
}

@keyframes bar-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.18; }
}

/* hero reveal helpers (for non-animated items like .hero-eyebrow already above) */
.reveal-hero { opacity: 0; animation: fade-up 0.7s ease forwards 0.3s; }
.reveal-hero.delay-2 { animation-delay: 1.4s; }
.reveal-hero.delay-3 { animation-delay: 1.7s; }
.reveal-hero.delay-4 { animation-delay: 1.9s; }

/* ===== NUMBERS SECTION ===== */
#numbers {
  border-top: 1px solid var(--border);
  padding: 5rem 1.5rem;
}

.section-inner {
  max-width: 1100px;
  margin: 0 auto;
}

.section-eyebrow {
  display: block;
  margin-bottom: 2.5rem;
}

.num-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--border);
  gap: 1px;
  border: 1px solid var(--border);
}

.num-card {
  background: var(--bg);
  padding: 2.5rem 2rem;
  transition: background 0.2s;
  cursor: default;
}

.num-card:hover {
  background: var(--panel);
}

.num-val {
  font-family: var(--font-d);
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 1;
  color: var(--text);
  transition: color 0.2s;
}

.num-card:hover .num-val {
  color: var(--red);
}

.num-label {
  font-family: var(--font-m);
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  margin-top: 0.6rem;
  line-height: 1.7;
}

/* ===== SCROLL REVEAL (general) ===== */
.reveal-section {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal-section.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ===== TIMELINE WRAP ===== */
.timeline-wrap {
  position: relative;
  max-width: 1050px;
  margin: 0 auto;
  padding: 4rem 1.5rem 3rem;
}

/* Spine */
.timeline-spine {
  position: absolute;
  /* left: padding + year-col + dot-center = 1.5rem + 100px + 24px */
  left: calc(1.5rem + 100px + 24px);
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
  pointer-events: none;
}

.spine-fill {
  width: 100%;
  height: 0%;
  background: var(--red);
  transition: height 0.08s linear;
}

/* Era row */
.era {
  display: grid;
  grid-template-columns: 100px 48px 1fr;
  padding: 3rem 0;
  position: relative;
  scroll-margin-top: 6rem;
}

.era:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

/* Year column */
.era-left {
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding-right: 1.5rem;
  padding-top: 0.15rem;
}

.era-year-num {
  font-family: var(--font-d);
  font-size: 1.6rem;
  line-height: 1;
  color: var(--muted);
  text-align: right;
  letter-spacing: 0.01em;
}

.era-year-num.era-range {
  font-size: 1.1rem;
  line-height: 1.3;
}

.range-bottom {
  display: block;
  font-size: 0.9rem;
  opacity: 0.6;
}

.gold-year {
  color: var(--gold);
}

.tl-word {
  font-family: var(--font-m);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-align: right;
  line-height: 1.6;
  text-transform: uppercase;
}

/* Dot column */
.era-node-col {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 0.3rem;
}

.era-dot {
  width: 14px;
  height: 14px;
  border: 2px solid var(--muted);
  background: var(--bg);
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  transition: border-color 0.25s, background 0.25s;
}

.era:hover .era-dot,
.era:focus-within .era-dot {
  border-color: var(--red);
}

.accent-dot {
  border-color: var(--gold);
  background: rgba(201, 162, 39, 0.08);
}

.gold-dot {
  border-color: var(--gold);
  background: rgba(201, 162, 39, 0.12);
}

.era-dot-sm {
  width: 10px;
  height: 10px;
}

/* Body column */
.era-body {
  padding-left: 1.5rem;
}

.era-tag {
  display: inline-block;
  margin-bottom: 0.4rem;
}

.gold-tag {
  color: var(--gold);
}

.era-body h2 {
  font-family: var(--font-d);
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 0.95;
  color: var(--text);
  margin-bottom: 1rem;
  letter-spacing: 0.01em;
}

.era-body > p {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.8;
  max-width: 660px;
  margin-bottom: 1.2rem;
}

/* Race bars */
.race-bars {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
  max-width: 520px;
}

.bar-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.bar-label-text {
  font-family: var(--font-m);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
}

.bar-track {
  height: 6px;
  background: var(--border);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0;
  transition: width 1.5s cubic-bezier(0.16,1,0.3,1);
}

.red-bar  { background: var(--red); }
.blue-bar { background: #3b5ba5; }

.bar-detail {
  font-family: var(--font-m);
  font-size: 0.55rem;
  color: var(--muted);
  letter-spacing: 0.08em;
}

/* Expand button */
.expand-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 0.4rem 0.75rem;
  font-family: var(--font-m);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  text-transform: uppercase;
  transition: color 0.15s, border-color 0.15s;
  margin-top: 0.2rem;
}

.expand-btn:hover {
  color: var(--text);
  border-color: var(--muted);
}

.expand-btn:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.expand-btn[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.chevron {
  transition: transform 0.2s ease;
}

/* Detail panel */
.detail {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  border-left: 2px solid var(--border);
  background: var(--panel);
}

.detail ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.detail li {
  padding-left: 1.2rem;
  position: relative;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.75;
}

.detail li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 1px;
  background: var(--red);
}

/* Era reveal animation */
.reveal-era {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.reveal-era.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* ===== THROUGHLINES ===== */
.throughlines {
  display: grid;
  grid-template-columns: 100px 48px 1fr;
  padding: 3rem 0 4rem;
  scroll-margin-top: 6rem;
}

.throughlines .era-body h2 {
  margin-bottom: 1.5rem;
}

.tl-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--border);
}

.tl-card {
  background: var(--panel);
  padding: 1.5rem;
  transition: background 0.2s;
}

.tl-card:hover {
  background: #16161e;
}

.tl-icon {
  margin-bottom: 0.75rem;
  opacity: 0.85;
}

.tl-card h3 {
  font-family: var(--font-d);
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
}

.tl-card p {
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.75;
}

/* ===== FOOTER ===== */
footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer-inner {
  max-width: 1050px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-note {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.75;
  max-width: 700px;
}

.footer-meta {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.5rem 1rem;
    gap: 0.5rem;
  }

  .year-nav {
    overflow-x: auto;
    width: 100%;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
  }

  .year-node {
    white-space: nowrap;
    font-size: 0.6rem;
    padding: 0.25rem 0.4rem;
  }

  .hero {
    padding: 5rem 1.25rem 3rem;
    min-height: 90svh;
  }

  .cap-silhouette {
    opacity: 0.15;
    width: min(70vw, 300px);
  }

  .hero-ghost {
    display: none;
  }

  #numbers {
    padding: 3rem 1rem;
  }

  .num-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .timeline-wrap {
    padding: 2.5rem 1rem 2rem;
  }

  .timeline-spine {
    left: calc(1rem + 64px + 20px);
  }

  .era {
    grid-template-columns: 64px 40px 1fr;
    padding: 2rem 0;
  }

  .era-year-num {
    font-size: 1rem;
  }

  .era-year-num.era-range {
    font-size: 0.85rem;
  }

  .throughlines {
    grid-template-columns: 64px 40px 1fr;
    padding-bottom: 2.5rem;
  }

  .tl-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1100px) {
  .timeline-spine {
    left: calc(1.5rem + 120px + 24px);
  }

  .era {
    grid-template-columns: 120px 48px 1fr;
  }

  .era-year-num {
    font-size: 2rem;
  }

  .throughlines {
    grid-template-columns: 120px 48px 1fr;
  }
}

@media (max-width: 480px) {
  .num-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 4rem 1rem 2.5rem;
  }

  .era {
    grid-template-columns: 52px 36px 1fr;
    padding: 1.5rem 0;
  }

  .throughlines {
    grid-template-columns: 52px 36px 1fr;
  }

  .timeline-spine {
    left: calc(1rem + 52px + 18px);
  }

  .era-year-num {
    font-size: 0.8rem;
  }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  /* Show all hero content immediately */
  .hero-title .word span {
    transform: none;
    animation: none;
  }

  .hero-eyebrow,
  .hero-sub,
  .hero-ghost,
  .signal-cluster,
  .begin-cta,
  .reveal-hero {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .hero-rule {
    animation: none;
    width: 120px;
  }

  /* Ticker: pause */
  .ticker {
    animation-play-state: paused;
  }

  /* Signal bars: no pulse */
  .signal-cluster .bar {
    animation: none;
    opacity: 0.6;
  }

  /* Scroll reveals: show immediately */
  .reveal-section,
  .reveal-era {
    opacity: 1;
    transform: none;
    transition: none;
  }

  /* Progress and spine: no transitions */
  #progress-bar,
  .spine-fill {
    transition: none;
  }

  /* Bar fills: skip animation */
  .bar-fill {
    transition: none;
  }

  /* Chevron: no transition */
  .chevron {
    transition: none;
  }

  /* Hover transitions: keep but instantaneous */
  .num-card,
  .num-card .num-val,
  .year-node,
  .expand-btn,
  .tl-card,
  .era-dot,
  .begin-cta {
    transition: none;
  }
}
