:root {
  --ink: #0a0c10;
  --surface: #12151c;
  --surface-raised: #1a1e28;
  --text: #e8e6e3;
  --text-muted: #8a8f9a;
  --amber: #ffb347;
  --teal: #5eead4;
  --red: #ff6b6b;
  --violet: #c4b5fd;
  --paper: #f5f0e8;
  --paper-ink: #1a1a1a;
  --font-display: 'Fraunces', serif;
  --font-mono: 'JetBrains Mono', monospace;
  --gutter: 16px;
  --radius: 8px;
}

@media (prefers-color-scheme: light) {
  :root {
    --ink: #f4f2ef;
    --surface: #ffffff;
    --surface-raised: #eee9e2;
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --paper: #fffef9;
    --paper-ink: #222;
  }
}

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

html {
  font-size: 16px;
  overflow-x: hidden;
}

body {
  font-family: var(--font-mono);
  background: var(--ink);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(255,179,71,0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(94,234,212,0.02) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--gutter);
  overflow-x: hidden;
}

.hero {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(2rem, 4vw, 3rem);
  text-align: center;
  overflow-wrap: break-word;
}

.kicker {
  font-family: var(--font-mono);
  font-size: clamp(0.7rem, 1.5vw, 0.85rem);
  letter-spacing: 0.2em;
  color: var(--amber);
  margin-bottom: 0.5rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 7vw, 5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  overflow-wrap: break-word;
  word-break: break-word;
}

.subtitle {
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 2.5vw, 1.3rem);
  font-weight: 300;
  font-style: italic;
  color: var(--text-muted);
  max-width: 50ch;
  margin: 0 auto 1.5rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--surface-raised);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-pill.live .status-dot {
  background: var(--amber);
  animation: pulse 1.5s ease-in-out infinite;
}

.status-pill.live .status-text { color: var(--amber); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.ticker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gutter);
  padding: 2rem 0;
  border-top: 1px solid var(--surface-raised);
  border-bottom: 1px solid var(--surface-raised);
}

.stat { text-align: center; }

.stat-value {
  display: block;
  font-family: var(--font-mono);
  font-size: clamp(1.2rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-top: 4px;
}

.fleet { padding: 2rem 0; }

.fleet-panel {
  background: var(--surface);
  border: 1px solid var(--surface-raised);
  border-radius: var(--radius);
  padding: var(--gutter);
  position: relative;
  overflow: hidden;
}

#constellation {
  width: 100%;
  max-width: 100%;
  height: 280px;
  display: block;
}

.fleet-caption {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 8px;
}

/* --- Models section --- */

#models {
  padding: 2rem 0;
}

.models-heading {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  font-weight: 700;
  margin-bottom: 0.25rem;
}

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

ul.models {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

ul.models li {
  background: var(--surface);
  border: 1px solid var(--surface-raised);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 6px 12px;
  align-items: center;
}

.model-name {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text);
  grid-column: 1;
  grid-row: 1;
  overflow-wrap: break-word;
  word-break: break-word;
}

.model-stats {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  grid-column: 2;
  grid-row: 1;
  white-space: nowrap;
}

.model-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  height: 3px;
  border-radius: 2px;
  background: var(--surface-raised);
  position: relative;
  overflow: hidden;
}

.model-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: var(--share, 0%);
  background: var(--amber);
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* --- Timeline reel (matches timeline.mjs output) --- */

.reel { list-style: none; }

.reel .step {
  position: relative;
  padding: 12px 16px 12px 20px;
  margin-bottom: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 3px solid var(--text-muted);
  font-size: 0.8rem;
}

.reel .step.done {
  border-left-color: var(--teal);
}

.reel .step.running {
  border-left-color: var(--amber);
  animation: step-pulse 2s ease-in-out infinite;
}

.reel .step.failed {
  border-left-color: var(--red);
}

@keyframes step-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.reel .step .title {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 1rem + 0.5vw, 1.35rem);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 4px;
  color: var(--text);
  display: block;
}

.reel .step .meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
  white-space: normal;
}

.reel .step .meta code {
  background: var(--surface-raised);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.65rem;
}

.reel .step blockquote.frontier {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--violet);
  margin-top: 8px;
  padding-left: 12px;
  border-left: 2px solid var(--violet);
  font-size: 0.85rem;
  line-height: 1.5;
}

.reel .step blockquote.frontier small {
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.7;
  display: block;
  margin-bottom: 2px;
}

.reel .empty {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 2rem 0;
  text-align: center;
}

.two-col {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: calc(var(--gutter) * 2);
  padding: 2rem 0;
  align-items: start;
}

.receipt-wrap {
  position: sticky;
  top: 1rem;
  align-self: start;
}

.receipt {
  background: var(--paper);
  color: var(--paper-ink);
  font-family: var(--font-mono);
  font-size: 0.65rem;
  line-height: 1.4;
  padding: 16px 12px;
  border-radius: 2px;
  transform: rotate(-0.5deg);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  position: relative;
  white-space: pre;
  overflow: hidden;
}

.receipt::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 8px;
  background:
    linear-gradient(135deg, var(--paper) 33.33%, transparent 33.33%) 0 0,
    linear-gradient(225deg, var(--paper) 33.33%, transparent 33.33%) 0 0;
  background-size: 10px 8px;
  background-repeat: repeat-x;
}

.footer {
  padding: 3rem 0 2rem;
  border-top: 1px solid var(--surface-raised);
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 60ch;
  margin: 0 auto;
  text-align: center;
}

.footer p + p { margin-top: 0.5rem; }

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

@media (max-width: 800px) {
  .ticker {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .receipt-wrap {
    position: static;
  }

  #constellation {
    height: 200px;
  }
}

@media (max-width: 420px) {
  .ticker {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .stat-value {
    font-size: clamp(1rem, 5vw, 1.5rem);
  }

  #constellation {
    height: 180px;
  }

  .two-col {
    grid-template-columns: 1fr;
  }

  .receipt-wrap {
    position: static;
  }

  .reel .step .meta {
    font-size: 0.65rem;
  }

  ul.models li {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }

  .model-stats {
    grid-column: 1;
    grid-row: 2;
    white-space: normal;
  }

  .model-bar {
    grid-column: 1;
    grid-row: 3;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reel .step.running {
    animation: none;
  }
}
