:root {
  --bg: #0a0a0b;
  --bg-2: #111113;
  --bg-3: #18181b;
  --surface: #1f1f23;
  --text: #f3f0e8;
  --text-dim: #8c8b87;
  --text-muted: #5c5b57;
  --accent-hot: #ff4a3d;
  --accent-hot-dim: #9f2e26;
  --accent-cool: #38d6d6;
  --accent-cool-dim: #1b6b6b;
  --accent-amber: #f5b800;
  --line: #2c2c30;
  --line-bright: #3a3a40;
  --font-serif: 'Georgia', 'Times New Roman', serif;
  --font-mono: 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Courier New', monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --max-width: 75rem;
  --narrow: 48rem;
  --radius: 0.5rem;
  --shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 4rem 4rem;
  opacity: 0.35;
}

body > * {
  position: relative;
  z-index: 2;
}

.serif {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.mono {
  font-family: var(--font-mono);
}

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

.skip-link {
  position: absolute;
  top: -2.5rem;
  left: 1rem;
  z-index: 100;
  background: var(--bg-3);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  text-decoration: underline;
  transition: top 0.15s;
}

.skip-link:focus {
  top: 1rem;
}

/* Sticky ticker */
.sticky-ticker {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 15, 16, 0.92);
  border: 1px solid var(--line);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-0.5rem);
  transition: opacity 0.3s, transform 0.3s;
}

.sticky-ticker.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.sticky-ticker-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.sticky-ticker-value {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-hot);
}

@media (prefers-reduced-motion: reduce) {
  .sticky-ticker {
    transition: none;
  }
}

@media (max-width: 48rem) {
  .sticky-ticker {
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.35rem 0.6rem;
  }
  .sticky-ticker-value {
    font-size: 0.8rem;
  }
}

/* Header */
.site-header {
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 74, 61, 0.12), transparent 45%),
    radial-gradient(circle at 80% 80%, rgba(56, 214, 214, 0.08), transparent 35%),
    var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: var(--narrow);
}

.kicker {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--accent-amber);
  border: 1px solid var(--accent-amber);
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.title {
  font-size: clamp(2.75rem, 8vw, 5.5rem);
  line-height: 1.05;
  margin: 0 0 1.25rem;
}

.lede {
  font-size: clamp(1.1rem, 2.5vw, 1.4rem);
  color: var(--text-dim);
  max-width: 45ch;
  margin: 0 auto 2rem;
}

.ticker {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 1rem 1.75rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.ticker-label {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.ticker-value {
  font-family: var(--font-mono);
  font-size: clamp(2rem, 6vw, 3.5rem);
  font-weight: 700;
  color: var(--accent-hot);
  line-height: 1;
  min-width: 8ch;
  tabular-nums: 1;
}

.scroll-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Sections */
.section {
  padding: 5rem 1.5rem;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
}

.section-inner.narrow {
  max-width: var(--narrow);
}

.section-title {
  font-size: clamp(2rem, 5vw, 3.25rem);
  margin: 0 0 0.5rem;
}

.section-subtitle {
  color: var(--text-dim);
  margin: 0 0 2.5rem;
  font-size: 1.1rem;
}

.intro {
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}

.intro-text {
  font-size: 1.15rem;
  color: var(--text-dim);
  margin: 0 0 1.25rem;
}

.intro-text:last-child {
  margin-bottom: 0;
}

.caption {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

/* Volume chart */
.volume-chart {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.75rem;
  align-items: end;
  height: 18rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.volume-bar {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 0;
}

.volume-bar-fill {
  width: 100%;
  background: linear-gradient(180deg, var(--accent-hot) 0%, var(--accent-hot-dim) 100%);
  border-radius: 0.25rem 0.25rem 0 0;
  min-height: 4px;
  transition: height 0.6s ease-out;
}

.volume-bar-label {
  margin-top: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
}

.volume-bar-count {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

/* Timeline */
.timeline-container {
  position: relative;
  padding: 2rem 0;
}

.timeline-spine {
  position: absolute;
  left: 2rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.timeline-spine::before {
  content: '';
  position: absolute;
  top: 0;
  left: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-hot);
}

.timeline-spine::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: -2px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cool);
}

.timeline-entry {
  position: relative;
  margin: 0 0 4rem 4rem;
  max-width: 42rem;
}

.timeline-entry:last-child {
  margin-bottom: 0;
}

.timeline-node {
  position: absolute;
  left: -2.25rem;
  top: 0.25rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--bg-3);
  border: 2px solid var(--line-bright);
  transform: translateX(-50%);
  z-index: 3;
  transition: border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
}

.timeline-entry.active .timeline-node,
.timeline-entry.revealed .timeline-node {
  background: var(--accent-hot);
  border-color: var(--accent-hot);
  box-shadow: 0 0 0 6px rgba(255, 74, 61, 0.15);
}

.timeline-entry.defender .timeline-node {
  background: var(--accent-cool);
  border-color: var(--accent-cool);
  box-shadow: 0 0 0 6px rgba(56, 214, 214, 0.12);
}

.timeline-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.timeline-card h3 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  margin: 0 0 0.5rem;
  line-height: 1.2;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.time-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-amber);
  border: 1px solid var(--accent-amber);
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
}

.action-badge {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
  background: rgba(255, 74, 61, 0.12);
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
}

.category-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-dim);
  border: 1px solid var(--line-bright);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.timeline-card p {
  color: var(--text-dim);
  margin: 0 0 1rem;
}

.timeline-card p:last-child {
  margin-bottom: 0;
}

.timeline-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.source-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  text-decoration: none;
  border: 1px solid var(--line-bright);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  transition: border-color 0.2s, color 0.2s;
}

.source-chip:hover,
.source-chip:focus {
  border-color: var(--accent-cool);
  color: var(--accent-cool);
}

.phase-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 1rem;
}

.phase-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  padding: 0.15rem 0.45rem;
  border-radius: 0.25rem;
  background: var(--bg-3);
  color: var(--text-muted);
  border: 1px solid var(--line);
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
}

.phase-chip.active {
  color: var(--text);
  border-color: currentColor;
}

/* Phase chart */
.phase-chart {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.phase-row {
  display: grid;
  grid-template-columns: 7rem 1fr 4rem;
  align-items: center;
  gap: 1rem;
}

.phase-label {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.phase-track {
  position: relative;
  height: 1.25rem;
  background: var(--bg-3);
  border-radius: 999px;
  overflow: hidden;
}

.phase-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent-hot);
  transition: width 0.8s ease-out;
}

.phase-row:nth-child(2) .phase-fill { background: #ff6b5e; }
.phase-row:nth-child(3) .phase-fill { background: #ff8f85; }
.phase-row:nth-child(4) .phase-fill { background: var(--accent-amber); }
.phase-row:nth-child(5) .phase-fill { background: #e6c229; }
.phase-row:nth-child(6) .phase-fill { background: var(--accent-cool); }
.phase-row:nth-child(7) .phase-fill { background: #5ce0e0; }
.phase-row:nth-child(8) .phase-fill { background: #8a8aff; }

.phase-count {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  text-align: right;
}

/* Phase matrix */
.phase-matrix-heading {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  margin: 3rem 0 0.5rem;
}

.phase-matrix-subtitle {
  margin-bottom: 1.5rem;
}

.phase-matrix {
  display: grid;
  grid-template-columns: 7rem repeat(5, 1fr);
  gap: 0.35rem;
  border: 1px solid var(--line);
  padding: 0.75rem;
  border-radius: var(--radius);
  background: var(--surface);
}

.phase-matrix-header,
.phase-matrix-cell {
  padding: 0.55rem 0.25rem;
  text-align: center;
  border-radius: 0.25rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
}

.phase-matrix-header {
  color: var(--text-muted);
  border-bottom: 1px solid var(--line);
}

.phase-matrix-row-label {
  text-align: left;
  color: var(--text-dim);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  align-self: center;
}

.phase-matrix-cell {
  background: var(--bg-3);
  color: var(--text-muted);
  transition: background-color 0.3s, color 0.3s, box-shadow 0.3s;
}

.phase-matrix-cell.active,
.phase-matrix-cell.phase-active {
  background: var(--accent-hot);
  color: var(--bg);
  font-weight: 700;
  box-shadow: 0 0 0.5rem rgba(255, 74, 61, 0.25);
}

@media (max-width: 48rem) {
  .phase-matrix {
    grid-template-columns: 5rem repeat(5, 1fr);
    gap: 0.25rem;
    padding: 0.5rem;
  }

  .phase-matrix-header,
  .phase-matrix-cell,
  .phase-matrix-row-label {
    font-size: 0.65rem;
    padding: 0.4rem 0.15rem;
  }
}

/* Attack chain */
.chain-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.chain-btn {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-bright);
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
  min-height: 44px;
}

.chain-btn:hover,
.chain-btn:focus {
  border-color: var(--accent-cool);
  background: var(--bg-3);
}

.chain-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chain-progress {
  display: flex;
  gap: 0.4rem;
}

.progress-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--line-bright);
  cursor: pointer;
  transition: background-color 0.2s, transform 0.2s;
}

.progress-dot.active {
  background: var(--accent-cool);
  transform: scale(1.25);
}

.chain-stage {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
  min-height: 14rem;
}

.chain-stage-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.chain-stage-number {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-cool);
  border: 1px solid var(--accent-cool);
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  flex-shrink: 0;
}

.chain-stage-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin: 0;
}

.chain-stage p {
  color: var(--text-dim);
  margin: 0 0 1rem;
  line-height: 1.65;
}

.chain-stage-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

/* Why section */
.why {
  background: var(--bg-2);
  border-top: 1px solid var(--line);
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1.5rem;
}

.why-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  transition: transform 0.3s, border-color 0.3s;
}

.why-card:hover {
  border-color: var(--line-bright);
}

.why-card-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.why-card p {
  color: var(--text-dim);
  margin: 0 0 1rem;
}

.why-source {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line-bright);
  transition: color 0.2s, border-color 0.2s;
}

.why-source:hover,
.why-source:focus {
  color: var(--accent-cool);
  border-color: var(--accent-cool);
}

/* Footer */
.site-footer {
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding: 4rem 1.5rem;
}

.footer-title {
  font-size: 1.75rem;
  margin: 0 0 0.75rem;
}

.footer-note {
  color: var(--text-dim);
  margin: 0 0 1.5rem;
}

.source-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
}

.source-list li {
  margin-bottom: 0.75rem;
}

.source-link {
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid var(--line-bright);
  transition: color 0.2s, border-color 0.2s;
}

.source-link:hover,
.source-link:focus {
  color: var(--accent-cool);
  border-color: var(--accent-cool);
}

.footer-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.revealed {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .revealed {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .volume-bar-fill,
  .phase-fill,
  .timeline-card,
  .why-card,
  .chain-stage {
    transition: none;
  }
}

/* Noscript */
.noscript-banner {
  background: var(--accent-amber);
  color: var(--bg);
  padding: 1rem;
  text-align: center;
  font-size: 0.9rem;
}

/* Responsive desktop timeline */
@media (min-width: 64rem) {
  .timeline-spine {
    left: 50%;
    transform: translateX(-50%);
  }

  .timeline-entry {
    margin-left: 0;
    width: 45%;
  }

  .timeline-entry:nth-child(odd) {
    margin-left: 5%;
    text-align: left;
    padding-right: 2rem;
  }

  .timeline-entry:nth-child(even) {
    margin-left: 50%;
    padding-left: 2rem;
  }

  .timeline-node {
    left: auto;
    right: -2.1rem;
    transform: translateX(50%);
  }

  .timeline-entry:nth-child(odd) .timeline-node {
    right: -2.1rem;
    left: auto;
  }

  .timeline-entry:nth-child(even) .timeline-node {
    left: -2.1rem;
    right: auto;
    transform: translateX(-50%);
  }
}

/* Mobile adjustments */
@media (max-width: 48rem) {
  .section {
    padding: 3.5rem 1rem;
  }

  .title {
    font-size: 2.5rem;
  }

  .lede {
    font-size: 1.05rem;
  }

  .ticker-value {
    font-size: 2.25rem;
  }

  .volume-chart {
    height: 14rem;
    gap: 0.35rem;
  }

  .volume-bar-label {
    font-size: 0.65rem;
    white-space: nowrap;
    writing-mode: vertical-rl;
    margin-top: 0.5rem;
    color: var(--text-dim);
  }

  .volume-bar-count {
    font-size: 0.7rem;
  }

  .timeline-entry {
    margin-left: 3rem;
  }

  .timeline-spine {
    left: 1.25rem;
  }

  .timeline-node {
    left: -1.75rem;
    width: 0.75rem;
    height: 0.75rem;
  }

  .timeline-card {
    padding: 1.15rem;
  }

  .timeline-card h3 {
    font-size: 1.35rem;
  }

  .phase-row {
    grid-template-columns: 5.5rem 1fr 3.5rem;
    gap: 0.65rem;
  }

  .phase-label {
    font-size: 0.7rem;
  }

  .phase-count {
    font-size: 0.75rem;
  }

  .chain-controls {
    gap: 0.75rem;
  }

  .chain-btn {
    padding: 0.55rem 1rem;
    font-size: 0.8rem;
  }

  .chain-stage {
    padding: 1.25rem;
  }

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