/* Moon Landing Timeline — static UI styles. Dark theme, no framework. */

:root {
  --bg: #080d1c;
  --surface: #131c33;
  --surface-2: #1a2440;
  --surface-3: #22304f;
  --text: #eff4ff;
  --text-soft: #ccd7f0;
  --muted: #a8b5d6;
  --line: #2c3b62;
  --line-soft: #223055;
  --accent: #9dbcff;
  --accent-soft: #2a3d6d;
  --focus: #ffd76a;

  --completed: #6fd7a8;
  --in_progress: #b39bff;
  --scheduled: #64cfef;
  --planned: #8bbcff;
  --slipped: #eabc63;
  --conceptual: #c9b7ff;
  --cancelled: #f08a8a;
  --confirmed: #6fd7a8;
  --rumored: #f3cc7a;

  --toolbar-h: 8rem;
  --radius: 14px;

  --bg-rgb: 8, 13, 28;
  --hero-overlay: linear-gradient(180deg, rgba(8, 13, 28, 0.35) 0%, rgba(8, 13, 28, 0.72) 55%, var(--bg) 100%);
  --shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  --card-tint: rgba(255, 255, 255, 0.02);
}

/* Light mode: same hues, inverted surfaces. Toggled via data-theme on <html>. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fb;
  --surface: #ffffff;
  --surface-2: #eef2fb;
  --surface-3: #e2e8f6;
  --text: #0f1730;
  --text-soft: #2b3555;
  --muted: #5b6785;
  --line: #c9d3ea;
  --line-soft: #dbe2f2;
  --accent: #2f5ed9;
  --accent-soft: #d9e3ff;
  --focus: #b8860b;

  --completed: #1f9d6a;
  --in_progress: #6d4fd1;
  --scheduled: #0f8fb4;
  --planned: #2f5ed9;
  --slipped: #b26e00;
  --conceptual: #7a5fd6;
  --cancelled: #c43d3d;
  --confirmed: #1f9d6a;
  --rumored: #b26e00;

  --bg-rgb: 243, 245, 251;
  --hero-overlay: linear-gradient(180deg, rgba(8, 13, 28, 0.25) 0%, rgba(8, 13, 28, 0.6) 55%, var(--bg) 100%);
  --shadow: 0 14px 40px rgba(30, 40, 80, 0.14);
  --card-tint: rgba(47, 94, 217, 0.03);
}

:root[data-theme="light"] body {
  background:
    radial-gradient(1100px 620px at 12% -12%, #e3eaff 0%, transparent 65%),
    radial-gradient(900px 500px at 92% 0%, #e9eefc 0%, transparent 60%),
    var(--bg);
}

:root[data-theme="light"] .hero-photo,
:root[data-theme="light"] .hero-photo a,
:root[data-theme="light"] .hero-photo .headline-stat dd,
:root[data-theme="light"] .hero-photo .tagline,
:root[data-theme="light"] .hero-photo .glossary {
  color: #eff4ff;
}

:root[data-theme="light"] .hero-photo .headline-stat dt,
:root[data-theme="light"] .hero-photo .headline-stat {
  color: #c8d3f0;
}

:root[data-theme="light"] .hero-photo .hero-credit { color: var(--muted); }

:root[data-theme="light"] .hero-photo .headline-stat {
  background: rgba(10, 16, 36, 0.55);
  border-color: rgba(255, 255, 255, 0.18);
}

:root[data-theme="light"] .hero-photo .glossary { background: rgba(10, 16, 36, 0.55); border-color: rgba(255, 255, 255, 0.18); }
:root[data-theme="light"] .hero-photo .gloss b { color: #fff; }
:root[data-theme="light"] .hero-photo .topbar .btn-ghost,
:root[data-theme="light"] .hero-photo .topbar .btn-icon { color: #eff4ff; border-color: rgba(255, 255, 255, 0.35); background: rgba(10, 16, 36, 0.4); }
:root[data-theme="light"] .hero-photo .eyebrow { color: #bcd0ff; }
:root[data-theme="light"] .hero-photo .brand { color: #fff; }

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 12% -12%, #1d2d59 0%, transparent 65%),
    radial-gradient(900px 500px at 92% 0%, #1b2545 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 1060px;
  margin-inline: auto;
  padding-inline: clamp(0.9rem, 3vw, 1.6rem);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

a { color: var(--accent); }
a:hover { color: #cfdcff; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 6px;
}

.skip-link {
  position: absolute;
  left: 0.6rem;
  top: -3rem;
  z-index: 60;
  background: var(--surface-3);
  color: var(--text);
  padding: 0.55rem 0.9rem;
  border-radius: 0 0 10px 10px;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus { top: 0; }

/* ------------------------------------------------------------------ hero */

.hero {
  padding: clamp(1.4rem, 4vw, 2.6rem) 0 1.2rem;
}

/* Photo hero: full-bleed image with a gradient that fades into the page. */
.hero-photo {
  position: relative;
  isolation: isolate;
  padding: 0 0 1.6rem;
  min-height: clamp(30rem, 78vh, 46rem);
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: url("./assets/img/hero.jpg") center 40% / cover no-repeat #0a1024;
  transform: scale(1.02);
  animation: hero-drift 28s ease-in-out infinite alternate;
}

.hero-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--hero-overlay);
}

@keyframes hero-drift {
  from { transform: scale(1.02) translate3d(0, 0, 0); }
  to { transform: scale(1.08) translate3d(-1.2%, -1.5%, 0); }
}

.hero-inner {
  width: 100%;
  padding-top: 1rem;
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: clamp(3rem, 10vh, 7rem);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand img { border-radius: 7px; }

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.btn-follow { font-weight: 600; background: rgba(8, 13, 28, 0.35); }

.btn-icon {
  display: inline-grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  padding: 0;
  background: rgba(8, 13, 28, 0.35);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 1.05rem;
  cursor: pointer;
}

.btn-icon:hover { border-color: var(--accent); color: var(--text); }
.btn-icon .icon-sun { display: none; }
:root[data-theme="light"] .btn-icon .icon-sun { display: inline; }
:root[data-theme="light"] .btn-icon .icon-moon { display: none; }

.hero-photo h1 {
  font-size: clamp(2.2rem, 7vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.45);
}

.hero-photo .tagline {
  max-width: 62ch;
  font-size: clamp(1rem, 2.4vw, 1.15rem);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}

.hero-photo .headline-stat {
  background: rgba(10, 16, 36, 0.55);
  border-color: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.glossary {
  margin: 0.9rem 0 0;
  padding: 0.55rem 0.8rem;
  background: rgba(10, 16, 36, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  backdrop-filter: blur(8px);
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.6;
  max-width: 78ch;
}

.glossary strong { color: var(--text); font-weight: 650; }

.gloss { white-space: nowrap; }
.gloss b { font-weight: 700; }
.gloss.status-completed b { color: var(--completed); }
.gloss.status-in_progress b { color: var(--in_progress); }
.gloss.status-planned b { color: var(--planned); }
.gloss.status-slipped b { color: var(--slipped); }
.gloss.status-conceptual b { color: var(--conceptual); }

.hero-credit {
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}

.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.7rem, 5.5vw, 2.6rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.tagline {
  margin: 0;
  max-width: 56ch;
  color: var(--text-soft);
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
}

.headline-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1.15rem 0 0;
}

.headline-stat {
  flex: 1 1 7rem;
  min-width: 6.5rem;
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
}

.headline-stat dt {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.headline-stat dd {
  margin: 0.15rem 0 0;
  font-size: 1.3rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- toolbar */

.toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 13, 28, 0.9);
  backdrop-filter: blur(14px);
  border-block: 1px solid var(--line-soft);
  padding: 0.7rem 0 0.55rem;
}

.filters { display: block; }

.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.field { margin: 0; }

.search-field {
  position: relative;
  flex: 1 1 18rem;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 0.7rem;
  color: var(--muted);
  font-size: 1.1rem;
  pointer-events: none;
}

.search-hint {
  position: absolute;
  right: 0.6rem;
  color: var(--muted);
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.05rem 0.4rem;
  font: inherit;
  font-size: 0.75rem;
  pointer-events: none;
}

input[type="search"],
select,
button {
  font: inherit;
  color: var(--text);
}

input[type="search"] {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 2.4rem 0.6rem 2.2rem;
  min-height: 2.7rem;
}

input[type="search"]::placeholder { color: #8f9dbe; }

input[type="search"]:hover,
select:hover { border-color: var(--accent-soft); }

select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.35rem 0.45rem 0.55rem;
  min-height: 2.4rem;
  font-size: 0.88rem;
  text-overflow: ellipsis;
}

/* The drawer spans the full width so its select grid gets the whole row;
   the view toggle is layered on the right of the summary line. */
.filter-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  margin-top: 0.4rem;
}

.filter-row .filter-drawer { grid-area: 1 / 1 / 2 / -1; }

.view-toggle {
  grid-area: 1 / 2 / 2 / 3;
  justify-self: end;
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.15rem;
  gap: 0.15rem;
}

.view-btn {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  padding: 0.3rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.view-btn:hover { color: var(--text); }

.view-btn[aria-pressed="true"] {
  background: var(--surface-3);
  color: var(--text);
  font-weight: 600;
}

.filter-summary {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.15rem;
  width: fit-content;
  list-style: none;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 0.86rem;
  padding: 0.2rem 0.1rem;
}

.filter-summary::-webkit-details-marker { display: none; }

.filter-chevron {
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.filter-drawer[open] .filter-chevron { transform: rotate(-135deg); }

.filter-badge {
  background: var(--accent-soft);
  color: var(--text);
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  min-width: 1.3rem;
  text-align: center;
  padding: 0.05rem 0.4rem;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.4rem, 1fr));
  gap: 0.4rem 0.5rem;
  padding: 0.4rem 0 0.15rem;
}

.field-reset { display: flex; align-items: stretch; }

.btn-reset {
  width: 100%;
  min-height: 2.4rem;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.8rem;
  cursor: pointer;
}

.btn-reset:hover { background: #2a3a60; }

.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.active-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.78rem;
  padding: 0.22rem 0.6rem;
  cursor: pointer;
}

.active-chip:hover { border-color: var(--accent); color: var(--text); }
.active-chip-key { color: var(--muted); }
.active-chip-x { font-size: 0.95rem; line-height: 1; color: var(--muted); }
.clear-all { color: var(--accent); }

.year-rail {
  margin-top: 0.5rem;
  overflow-x: auto;
  scrollbar-width: thin;
}

.year-rail-list {
  display: flex;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0 0 0.15rem;
}

.year-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.year-pill:hover { border-color: var(--accent); color: var(--text); }
.year-pill-count { color: var(--muted); font-size: 0.7rem; }

.year-pill.is-current {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

/* ----------------------------------------------------------------- stats */

main { padding-bottom: 1rem; }

.section-heading {
  margin: 1.4rem 0 0.6rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 0.75rem;
}

.stat-block {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem 0.85rem;
}

.stat-title {
  margin: 0 0 0.55rem;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.8rem;
  padding: 0.28rem 0.65rem;
  cursor: pointer;
}

.stat-chip:hover { border-color: var(--accent); }
.stat-chip.is-empty { opacity: 0.45; }

.stat-chip-count {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.stat-chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.stat-chip[aria-pressed="true"] .stat-chip-count { color: var(--text-soft); }

.stat-chip::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--muted);
}

.stat-chip.status-completed::before { background: var(--completed); }
.stat-chip.status-in_progress::before { background: var(--in_progress); }
.stat-chip.status-scheduled::before { background: var(--scheduled); }
.stat-chip.status-planned::before { background: var(--planned); }
.stat-chip.status-slipped::before { background: var(--slipped); }
.stat-chip.status-conceptual::before { background: var(--conceptual); }
.stat-chip.status-cancelled::before { background: var(--cancelled); }

.bars {
  display: grid;
  gap: 0.3rem;
}

.bar-row {
  display: grid;
  grid-template-columns: 3.4rem 1fr 2rem;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0.2rem 0.35rem;
  color: var(--text-soft);
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
}

.bar-row:hover { border-color: var(--line); }

.bar-row[aria-pressed="true"] {
  border-color: var(--accent);
  background: rgba(157, 188, 255, 0.08);
  color: var(--text);
}

.bar-track {
  height: 0.5rem;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), #6f8fe0);
}

.bar-count {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.result-meta {
  margin: 1.1rem 0 0.7rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.result-meta.error {
  color: #ffb4b4;
  background: rgba(240, 138, 138, 0.12);
  border: 1px solid rgba(240, 138, 138, 0.4);
  border-radius: 10px;
  padding: 0.6rem 0.75rem;
}

/* -------------------------------------------------------------- timeline */

.year-group {
  scroll-margin-top: calc(var(--toolbar-h) + 0.75rem);
  margin-bottom: 1.6rem;
}

.timeline:focus,
.year-group:focus { outline: none; }

.year-header {
  position: sticky;
  top: calc(var(--toolbar-h) + 0.25rem);
  z-index: 6;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
  padding: 0.35rem 0.85rem;
  background: rgba(15, 22, 42, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.year-heading {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
}

.year-count {
  color: var(--muted);
  font-size: 0.76rem;
}

.year-events {
  display: grid;
  gap: 0.7rem;
  margin-left: 0.5rem;
  padding-left: 1.35rem;
  border-left: 2px solid var(--line-soft);
}

.event {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.35rem 0.9rem 0.9rem;
  scroll-margin-top: calc(var(--toolbar-h) + 1rem);
}

.event:hover { border-color: var(--line); }

.event::before {
  content: "";
  position: absolute;
  left: -1.79rem;
  top: 1.15rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 4px rgba(8, 13, 28, 0.9);
}

.event.status-completed::before { background: var(--completed); }
.event.status-in_progress::before { background: var(--in_progress); }
.event.status-scheduled::before { background: var(--scheduled); }
.event.status-planned::before { background: var(--planned); }
.event.status-slipped::before { background: var(--slipped); }
.event.status-conceptual::before { background: var(--conceptual); }
.event.status-cancelled::before { background: var(--cancelled); }

.event-heading { margin: 0; font-size: 1rem; }

.event-toggle {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "date chevron"
    "title chevron";
  align-items: center;
  gap: 0.1rem 0.6rem;
  width: 100%;
  background: transparent;
  border: 0;
  border-radius: 10px;
  padding: 0.55rem 0.15rem 0.35rem;
  text-align: left;
  cursor: pointer;
}

.event-toggle:hover .event-title { color: #ffffff; }

.event-date {
  grid-area: date;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.precision {
  color: #8f9dbe;
  font-size: 0.72rem;
  font-style: italic;
}

.event-title {
  grid-area: title;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.35;
  color: var(--text);
}

.event-chevron {
  grid-area: chevron;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}

.event-toggle[aria-expanded="true"] .event-chevron { transform: rotate(-135deg); }

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  list-style: none;
  margin: 0.15rem 0 0;
  padding: 0 0 0 0.15rem;
}

.badge {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.16rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.badge.status-completed { color: var(--completed); border-color: color-mix(in srgb, var(--completed) 45%, var(--line)); background: color-mix(in srgb, var(--completed) 14%, transparent); }
.badge.status-in_progress { color: var(--in_progress); border-color: color-mix(in srgb, var(--in_progress) 45%, var(--line)); background: color-mix(in srgb, var(--in_progress) 14%, transparent); }
.badge.status-scheduled { color: var(--scheduled); border-color: color-mix(in srgb, var(--scheduled) 45%, var(--line)); background: color-mix(in srgb, var(--scheduled) 12%, transparent); }
.badge.status-planned { color: var(--planned); border-color: color-mix(in srgb, var(--planned) 45%, var(--line)); background: color-mix(in srgb, var(--planned) 12%, transparent); }
.badge.status-slipped { color: var(--slipped); border-color: color-mix(in srgb, var(--slipped) 45%, var(--line)); background: color-mix(in srgb, var(--slipped) 14%, transparent); }
.badge.status-conceptual { color: var(--conceptual); border-color: color-mix(in srgb, var(--conceptual) 45%, var(--line)); background: color-mix(in srgb, var(--conceptual) 12%, transparent); }
.badge.status-cancelled { color: var(--cancelled); border-color: color-mix(in srgb, var(--cancelled) 45%, var(--line)); background: color-mix(in srgb, var(--cancelled) 14%, transparent); }

.badge-category { color: var(--text-soft); background: var(--surface-2); }
.badge-program { color: var(--accent); border-color: var(--accent-soft); background: rgba(157, 188, 255, 0.08); text-transform: none; letter-spacing: 0.02em; }

.badge.confidence-confirmed { color: var(--confirmed); border-color: color-mix(in srgb, var(--confirmed) 35%, var(--line)); }
.badge.confidence-planned { color: var(--planned); border-color: color-mix(in srgb, var(--planned) 30%, var(--line)); }
.badge.confidence-rumored { color: var(--rumored); border-color: color-mix(in srgb, var(--rumored) 40%, var(--line)); }

.event-body { padding: 0.15rem 0.15rem 0; }

.summary {
  margin: 0.55rem 0 0.5rem;
  color: var(--text-soft);
  font-size: 0.94rem;
  max-width: 72ch;
}

mark {
  background: rgba(255, 215, 106, 0.28);
  color: #fff3cf;
  border-radius: 3px;
  padding: 0 0.1rem;
}

.event-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 0.7rem;
  margin: 0 0 0.5rem;
  font-size: 0.84rem;
}

.event-facts dt {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding-top: 0.18rem;
}

.event-facts dd { margin: 0; }

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.chip {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  padding: 0.1rem 0.42rem;
  font-size: 0.78rem;
  color: var(--text-soft);
}

.chip-link a {
  text-decoration: none;
  color: var(--accent);
}

.chip-link:hover { border-color: var(--accent); }
.chip-link a:hover { text-decoration: underline; }

.notes {
  margin: 0 0 0.55rem;
  padding: 0.4rem 0.6rem;
  border-left: 3px solid var(--slipped);
  background: rgba(234, 188, 99, 0.07);
  border-radius: 0 8px 8px 0;
  color: var(--text-soft);
  font-size: 0.83rem;
}

.notes-label {
  color: var(--slipped);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
}

.sources {
  border-top: 1px dashed var(--line);
  padding-top: 0.55rem;
}

.sources-title {
  margin: 0 0 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.source-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.83rem;
}

.source-list li { margin-bottom: 0.2rem; }
.source-link { color: var(--accent); }
.source-meta { color: var(--muted); }

.empty {
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 2rem 1.2rem;
  text-align: center;
}

.empty-title { margin: 0 0 0.3rem; font-size: 1.05rem; font-weight: 650; }
.empty-hint { margin: 0 0 1rem; color: var(--muted); font-size: 0.9rem; }
.empty .btn-reset { width: auto; }

/* ------------------------------------------------------------ highlights */

.mode-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.15rem;
  gap: 0.15rem;
}

.mode-btn {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.mode-btn:hover { color: var(--text); }

.mode-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 650;
  box-shadow: inset 0 0 0 1px var(--accent);
}

.highlights { margin-top: 0.6rem; }

.highlights-lede {
  margin: 0 0 0.9rem;
  max-width: 74ch;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.beat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.beat-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.82rem;
  padding: 0.3rem 0.7rem;
  cursor: pointer;
}

.beat-chip:hover { border-color: var(--accent); }
.beat-chip.is-empty { opacity: 0.45; }

.beat-chip-count {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.beat-chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
  font-weight: 600;
}

.beat-chip[aria-pressed="true"] .beat-chip-count { color: var(--text-soft); }

.draft-options {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.9rem;
  margin-top: 0.7rem;
}

.draft-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-soft);
  font-size: 0.85rem;
  cursor: pointer;
}

.draft-option input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--accent);
}

.draft-sort { min-width: 11rem; }

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr));
  gap: 0.75rem;
}

.highlight {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  border-top: 3px solid var(--muted);
  padding: 0.8rem 0.9rem 0.85rem;
}

.highlight:hover { border-color: var(--line); }

.highlight.status-completed { border-top-color: var(--completed); }
.highlight.status-in_progress { border-top-color: var(--in_progress); }
.highlight.status-scheduled { border-top-color: var(--scheduled); }
.highlight.status-planned { border-top-color: var(--planned); }
.highlight.status-slipped { border-top-color: var(--slipped); }
.highlight.status-conceptual { border-top-color: var(--conceptual); }
.highlight.status-cancelled { border-top-color: var(--cancelled); }

.highlight-top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
}

.beat-tag {
  color: var(--accent);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.highlight-when {
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.highlight-title {
  margin: 0.35rem 0 0;
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.35;
}

.why-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0.45rem 0 0;
  padding: 0;
}

.why-tag {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  padding: 0.1rem 0.4rem;
}

.draft-text {
  white-space: pre-wrap;
  margin: 0.65rem 0 0.7rem;
  padding: 0.65rem 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.5;
}

.highlight-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
}

.btn-copy {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 9px;
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.85rem;
  cursor: pointer;
}

.btn-copy:hover { background: #35497d; }

.btn-copy.is-copied {
  background: color-mix(in srgb, var(--completed) 22%, transparent);
  border-color: var(--completed);
  color: var(--completed);
}

.char-count {
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.char-count.is-tight { color: var(--slipped); }
.char-count.is-over { color: var(--cancelled); font-weight: 700; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-soft);
  font-size: 0.8rem;
  padding: 0.35rem 0.65rem;
  text-decoration: none;
  cursor: pointer;
}

.btn-ghost:hover { border-color: var(--accent); color: var(--text); }

.event-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--line);
}

.event.is-target {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgba(255, 215, 106, 0.35);
}

/* ----------------------------------------------------------- share card */

.share-main { padding-block: 1.2rem 2rem; }

.share-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.share-controls .field { flex: 1 1 18rem; }
.share-controls .btn-ghost { min-height: 2.4rem; }

.share-frame {
  position: relative;
  display: grid;
  container-type: inline-size;
  background:
    radial-gradient(900px 500px at 8% -20%, #24386b 0%, transparent 62%),
    radial-gradient(700px 420px at 95% 4%, #1d2a4e 0%, transparent 58%),
    #0a1024;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}

.share-frame[data-ratio="16x9"] { aspect-ratio: 16 / 9; }
.share-frame[data-ratio="1x1"] { aspect-ratio: 1 / 1; }
.share-frame[data-ratio="free"] { aspect-ratio: auto; }

.share-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: clamp(1rem, 3.5cqi, 2.4rem);
  height: 100%;
  min-height: 18rem;
  color: #e8ecf7;
  isolation: isolate;
}

/* Photo backdrop: the same cover + gradient the PNG export draws. */
.share-card.has-photo::before,
.share-card.has-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}
.share-card.has-photo::before {
  background: var(--photo) center 40% / cover no-repeat;
}
.share-card.has-photo::after {
  background:
    linear-gradient(90deg, rgba(6, 10, 24, 0.55), rgba(6, 10, 24, 0) 70%),
    linear-gradient(180deg, rgba(6, 10, 24, 0.15), rgba(6, 10, 24, 0.55) 45%, rgba(6, 10, 24, 0.96));
}

.share-frame[data-ratio="free"] .share-card { min-height: 24rem; }

/* Fixed-ratio frames can't grow, so cap the blurb like the PNG export does. */
.share-frame:not([data-ratio="free"]) .share-blurb {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  max-width: 62ch;
}
.share-frame[data-ratio="1x1"] .share-blurb { -webkit-line-clamp: 4; }
.share-frame:not([data-ratio="free"]) .share-title { font-size: clamp(1.2rem, 4.2cqi, 2.7rem); }

.share-credit {
  position: absolute;
  top: clamp(0.5rem, 1.6cqi, 1rem);
  right: clamp(0.7rem, 2.4cqi, 1.6rem);
  font-size: clamp(0.55rem, 1cqi, 0.7rem);
  color: rgba(220, 228, 250, 0.75);
  text-align: right;
  max-width: 60%;
}

.share-card .share-title,
.share-card .share-blurb { color: #fff; }
.share-card .share-when { color: #dbe3ff; }
.share-card .share-foot { color: #aab5d6; border-top-color: rgba(255, 255, 255, 0.16); }
.share-card .share-foot strong { color: #e8ecf7; }
.share-card .share-eyebrow { color: #9dbcff; margin-top: auto; }
.share-card .share-foot { margin-top: 0.4rem; }
.share-card .badge { background: rgba(255, 255, 255, 0.08); }

.share-download-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.7rem;
}

.share-hint { color: var(--muted); font-size: 0.82rem; }

.share-hero .topbar { margin-bottom: 1rem; }
.topbar-actions { display: flex; align-items: center; gap: 0.5rem; }

.share-eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: clamp(0.7rem, 1.5cqi, 0.95rem);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.share-title {
  margin: 0;
  font-size: clamp(1.3rem, 4.6cqi, 3rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.share-when {
  margin: 0;
  color: var(--text-soft);
  font-size: clamp(0.85rem, 2cqi, 1.3rem);
  font-variant-numeric: tabular-nums;
}

.share-blurb {
  margin: 0.2rem 0 0;
  color: var(--text);
  font-size: clamp(0.9rem, 2.2cqi, 1.45rem);
  line-height: 1.45;
  max-width: 46ch;
}

.share-card .badges { margin-top: 0.15rem; }

.share-card .badge { font-size: clamp(0.6rem, 1.25cqi, 0.8rem); }

.share-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.6rem;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  font-size: clamp(0.68rem, 1.4cqi, 0.9rem);
}

.share-foot strong { color: var(--text-soft); font-weight: 600; }

.share-draft {
  margin-top: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.85rem 0.9rem;
}

.share-draft h2 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.share-draft textarea {
  width: 100%;
  min-height: 8.5rem;
  resize: vertical;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.5;
  padding: 0.65rem 0.8rem;
}

.share-draft-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.6rem;
}

.share-sources {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.84rem;
}

.share-sources ul { margin: 0.3rem 0 0; padding-left: 1.1rem; }

/* ---------------------------------------------------------------- footer */

footer {
  border-top: 1px solid var(--line-soft);
  margin-top: 1.5rem;
  padding-block: 1rem 2.5rem;
  color: var(--muted);
  font-size: 0.82rem;
}

footer p { margin: 0 0 0.4rem; max-width: 70ch; }

footer code {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  padding: 0.05rem 0.3rem;
  font-size: 0.78rem;
}

/* --------------------------------------------------------- section heads */

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.4rem 1rem;
  margin-top: 1.8rem;
}

.section-heading.big {
  margin: 0 0 0.5rem;
  font-size: clamp(1.15rem, 2.6vw, 1.45rem);
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
  font-weight: 750;
}

.section-lede {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 64ch;
}

.section-tools {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

/* ------------------------------------------------------------ now & next */

.now-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(15.5rem, 1fr);
  gap: 0.7rem;
  overflow-x: auto;
  padding: 0.2rem 0.1rem 0.7rem;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}

.now-card {
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-top: 3px solid var(--p, var(--line));
  border-radius: var(--radius);
  overflow: hidden;
  padding: 0;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.now-card:hover,
.now-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.now-pic {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--surface-2);
}

.now-body {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.65rem 0.8rem 0.8rem;
}

.now-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
}

.now-flags { font-size: 0.95rem; letter-spacing: 0.05em; }

.now-status,
.ov-card-status,
.slip-status {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.12rem 0.5rem;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.now-status.status-in_progress, .ov-card-status.status-in_progress, .slip-status.status-in_progress { color: var(--in_progress); border-color: color-mix(in srgb, var(--in_progress) 50%, transparent); background: color-mix(in srgb, var(--in_progress) 14%, transparent); }
.now-status.status-planned, .ov-card-status.status-planned { color: var(--planned); border-color: color-mix(in srgb, var(--planned) 50%, transparent); background: color-mix(in srgb, var(--planned) 12%, transparent); }
.now-status.status-scheduled, .ov-card-status.status-scheduled { color: var(--scheduled); border-color: color-mix(in srgb, var(--scheduled) 50%, transparent); }
.now-status.status-slipped, .ov-card-status.status-slipped, .slip-status.status-slipped { color: var(--slipped); border-color: color-mix(in srgb, var(--slipped) 50%, transparent); background: color-mix(in srgb, var(--slipped) 14%, transparent); }
.now-status.status-conceptual, .ov-card-status.status-conceptual { color: var(--conceptual); border-color: color-mix(in srgb, var(--conceptual) 50%, transparent); }
.now-status.status-completed, .ov-card-status.status-completed { color: var(--completed); border-color: color-mix(in srgb, var(--completed) 50%, transparent); background: color-mix(in srgb, var(--completed) 14%, transparent); }
.now-status.status-cancelled, .ov-card-status.status-cancelled, .slip-status.status-cancelled { color: var(--cancelled); border-color: color-mix(in srgb, var(--cancelled) 50%, transparent); background: color-mix(in srgb, var(--cancelled) 14%, transparent); }

.now-title {
  color: var(--text);
  font-weight: 650;
  font-size: 0.98rem;
  line-height: 1.3;
}

.now-when { color: var(--text-soft); font-size: 0.82rem; }
.now-when b { color: var(--text); font-weight: 700; }
.now-program { color: var(--p, var(--accent)); font-size: 0.74rem; font-weight: 600; letter-spacing: 0.04em; }

/* ------------------------------------------------------------- overview */

.ov-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.legend-item { display: inline-flex; align-items: center; gap: 0.35rem; }
.legend-item i { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--muted); }
.legend-item.status-completed i { background: var(--completed); }
.legend-item.status-in_progress i { background: var(--in_progress); }
.legend-item.status-planned i { background: var(--planned); }
.legend-item.status-slipped i { background: var(--slipped); }
.legend-item.status-conceptual i { background: var(--conceptual); }
.legend-item.status-cancelled i { background: var(--cancelled); }
.legend-featured i { border-radius: 3px; background: var(--focus); }

.ov {
  position: relative;
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.ov-controls {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
  padding: 0.5rem 0.6rem 0;
}

.ov-controls .ov-btn { border: 1px solid var(--line); background: var(--surface); }

.ov-btn {
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--text-soft);
  font-size: 0.85rem;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
}

.ov-btn:hover { background: var(--surface-3); color: var(--text); }

.ov-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  cursor: grab;
  scrollbar-width: thin;
  padding-bottom: 0.4rem;
}

.ov-scroll.is-grabbing { cursor: grabbing; user-select: none; }
.ov-scroll:focus-visible { outline-offset: -3px; }

.ov-canvas {
  position: relative;
  min-height: 25rem;
  padding-top: 0.8rem;
}

/* Milestone filmstrip -------------------------------------------------- */

.ov-cards {
  position: relative;
  height: calc(2 * 16.4rem + 0.5rem);
}

.ov-card {
  position: absolute;
  top: 0;
  width: var(--card-w);
  display: flex;
  flex-direction: column;
  text-align: left;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: visible;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.ov-card:hover,
.ov-card:focus-visible {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: var(--shadow);
  z-index: 3;
}

.ov-card-pic {
  position: relative;
  display: block;
  height: 6.4rem;
  border-radius: 12px 12px 0 0;
  overflow: hidden;
  background: var(--surface-2);
}

.ov-card-pic img { width: 100%; height: 100%; object-fit: cover; display: block; }

.ov-card-status {
  position: absolute;
  left: 0.45rem;
  bottom: 0.45rem;
  background: rgba(8, 13, 28, 0.7);
  backdrop-filter: blur(6px);
}

.ov-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.55rem 0.7rem 0.7rem;
  min-height: 9.2rem;
}

.ov-card-when { color: var(--accent); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.ov-card-title { color: var(--text); font-weight: 650; font-size: 0.9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ov-card-blurb { color: var(--muted); font-size: 0.76rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* The tail drops from the card to the axis under its true date. */
.ov-card-tail {
  position: absolute;
  left: var(--tail-x);
  top: 100%;
  width: 2px;
  height: var(--tail-h, 0.9rem);
  background: linear-gradient(180deg, var(--line), transparent 90%);
  pointer-events: none;
}

/* Axis ---------------------------------------------------------------- */

.ov-axis {
  position: relative;
  height: 2.2rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.ov-year {
  position: absolute;
  top: 0;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding-left: 0.6rem;
  border-left: 1px solid var(--line);
  color: var(--text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
  background: transparent;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  text-align: left;
  cursor: default;
}

button.ov-year { cursor: pointer; }
button.ov-year:hover { background: rgba(157, 188, 255, 0.08); }

.ov-year-count {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.72rem;
}

.ov-pin {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.7rem;
  white-space: nowrap;
}

.ov-pin-right { transform: translate(-100%, -50%); }

/* Lanes --------------------------------------------------------------- */

.ov-lanes { position: relative; padding: 0.4rem 0 0.6rem; }

.ov-lane {
  position: relative;
  height: 3rem;
  border-bottom: 1px dashed var(--line-soft);
}

.ov-lane:last-child { border-bottom: 0; }

.ov-lane::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--line-soft);
  opacity: 0.6;
}

.ov-lane-label {
  position: sticky;
  left: 0.5rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
  padding: 0.15rem 0.55rem 0.15rem 0.4rem;
  background: rgba(var(--bg-rgb), 0.86);
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 600;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.ov-lane-icon { font-size: 0.85rem; }

.ov-dot {
  position: absolute;
  top: calc(50% + (var(--stack) - 1) * 0.55rem);
  width: 0.72rem;
  height: 0.72rem;
  margin-left: -0.36rem;
  margin-top: -0.36rem;
  padding: 0;
  border-radius: 50%;
  border: 2px solid rgba(var(--bg-rgb), 0.9);
  background: var(--muted);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ov-dot.is-big { width: 0.95rem; height: 0.95rem; margin-left: -0.475rem; margin-top: -0.475rem; }
.ov-dot.is-featured { box-shadow: 0 0 0 2px var(--focus); }
.ov-dot:hover, .ov-dot:focus-visible, .ov-dot.is-hot { transform: scale(1.6); z-index: 3; box-shadow: 0 0 0 3px rgba(255, 215, 106, 0.55), 0 0 18px rgba(255, 215, 106, 0.55); }

.ov-dot.status-completed { background: var(--completed); }
.ov-dot.status-in_progress { background: var(--in_progress); }
.ov-dot.status-scheduled { background: var(--scheduled); }
.ov-dot.status-planned { background: var(--planned); }
.ov-dot.status-slipped { background: var(--slipped); }
.ov-dot.status-conceptual { background: var(--conceptual); opacity: 0.85; }
.ov-dot.status-cancelled { background: var(--cancelled); }

.ov-today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px dashed var(--focus);
  pointer-events: none;
  z-index: 2;
  opacity: 0.85;
}

.ov-today-label {
  position: absolute;
  top: 0.35rem;
  left: 0.35rem;
  color: var(--focus);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
}

.ov-tip {
  position: absolute;
  z-index: 6;
  transform: translate(-50%, -110%);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  max-width: 16rem;
  padding: 0.45rem 0.6rem;
  background: rgba(var(--bg-rgb), 0.96);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.35;
  pointer-events: none;
  box-shadow: var(--shadow);
}

.ov-tip span { color: var(--muted); }

/* ------------------------------------------------------------- race/slips */

.race-wrap { margin-top: 1.6rem; }

.race-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.race-cols {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

.race-col {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 0.85rem 0.85rem 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  border-top: 3px solid var(--planned);
}

.race-us { border-top-color: #ff9f6b; }
.race-cn { border-top-color: #ff6b7d; }
.race-rest { border-top-color: #7fe0c0; }

.race-flags { font-size: 1.25rem; letter-spacing: 0.1em; }
.race-title { margin: 0.2rem 0 0; font-size: 1rem; }
.race-sub { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.74rem; }

.race-big {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.55rem 0.7rem;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
}

.race-big.is-link { cursor: pointer; }
.race-big.is-link:hover { border-color: var(--accent); }

.race-big-label { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; }
.race-big-value { font-size: 2rem; font-weight: 800; line-height: 1.05; font-variant-numeric: tabular-nums; }
.race-big-note { color: var(--text-soft); font-size: 0.76rem; line-height: 1.35; }

.race-nums {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.6rem;
  margin: 0;
}

.race-nums dt { color: var(--muted); font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; }
.race-nums dd { margin: 0; font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }

.race-next {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  text-align: left;
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  cursor: pointer;
  margin-top: auto;
}

.race-next:hover { border-color: var(--accent); }
.race-next-label { color: var(--accent); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.race-next-title { color: var(--text); font-weight: 600; font-size: 0.86rem; line-height: 1.3; }
.race-next-when { color: var(--muted); font-size: 0.76rem; }

.slips {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--slipped);
  border-radius: var(--radius);
  padding: 0.85rem 0.85rem 0.6rem;
}

.slips .section-heading.big { font-size: 1.05rem; }

.slip-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }

.slip-btn {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "status title" "status when" "note note";
  gap: 0.1rem 0.5rem;
  align-items: start;
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0.45rem 0.5rem;
  cursor: pointer;
}

.slip-btn:hover { background: var(--surface-2); border-color: var(--line-soft); }
.slip-status { grid-area: status; margin-top: 0.15rem; }
.slip-title { grid-area: title; color: var(--text); font-weight: 600; font-size: 0.88rem; line-height: 1.3; }
.slip-when { grid-area: when; color: var(--muted); font-size: 0.74rem; }
.slip-note { grid-area: note; color: var(--text-soft); font-size: 0.76rem; line-height: 1.4; margin-top: 0.2rem; }

/* --------------------------------------------------------- quick chips */

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.45rem;
}

.quick-chip {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.78rem;
  padding: 0.22rem 0.65rem;
  cursor: pointer;
}

.quick-chip:hover { border-color: var(--accent); color: var(--text); }
.quick-chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }

.year-pill.is-now { border-color: color-mix(in srgb, var(--focus) 60%, var(--line)); }

/* --------------------------------------------------- timeline additions */

.past-fold {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  width: 100%;
  margin: 0 0 1.4rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--text-soft);
  cursor: pointer;
}

.past-fold:hover { border-color: var(--accent); color: var(--text); }
.past-fold-title { font-weight: 650; }
.past-fold-count { color: var(--muted); font-size: 0.8rem; }

.today-marker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--focus);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0.2rem 0;
}

.today-marker::before,
.today-marker::after {
  content: "";
  flex: 1;
  border-top: 2px dashed color-mix(in srgb, var(--focus) 70%, transparent);
}

.today-marker::before { flex: 0 0 1rem; }

.event {
  border-left: 3px solid var(--p, var(--line-soft));
  background: linear-gradient(90deg, color-mix(in srgb, var(--p, transparent) 7%, var(--surface)) 0%, var(--surface) 30%);
}

.event.in-view { animation: card-in 0.45s ease both; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.event.is-milestone { border-color: color-mix(in srgb, var(--focus) 35%, var(--line-soft)); border-left-color: var(--p, var(--focus)); }

.badge-milestone { color: var(--focus); border-color: color-mix(in srgb, var(--focus) 45%, var(--line)); background: color-mix(in srgb, var(--focus) 12%, transparent); }

.badge-program[style*="--p"] { color: var(--p); border-color: color-mix(in srgb, var(--p) 45%, var(--line)); background: color-mix(in srgb, var(--p) 10%, transparent); }

.event-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.5rem;
}

.event-thumb {
  margin: 0.55rem 0 0;
  width: 8.5rem;
  aspect-ratio: 16 / 10;
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  cursor: zoom-in;
  background: var(--surface-2);
}

.event-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.event-thumb:hover img { transform: scale(1.05); }

.event.is-collapsed .event-thumb { display: none; }

.relative {
  color: var(--focus);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}

.chip-flag { display: inline-flex; align-items: center; gap: 0.35rem; }

.flag {
  display: inline-block;
  width: 1.25rem;
  height: 0.94rem;
  border-radius: 2px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.18);
  vertical-align: -0.1em;
}

.flag-sm { width: 1rem; height: 0.75rem; }
.flag-row { display: inline-flex; gap: 0.25rem; align-items: center; }
.now-flags .flag { width: 1.15rem; height: 0.86rem; }
.race-flags .flag { width: 1.7rem; height: 1.28rem; border-radius: 3px; }
.quick-chip { display: inline-flex; align-items: center; gap: 0.35rem; }
.quick-chip .flag { width: 1.05rem; height: 0.79rem; }
.ov-lane-icon { display: inline-flex; gap: 0.15rem; align-items: center; }

.pic-credit {
  color: var(--muted);
  font-size: 0.7rem;
  padding: 0.25rem 0.1rem 0;
}

.pic-credit a { text-decoration: none; }

/* ---------------------------------------------------------------- dialog */

.event-dialog {
  width: min(58rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: auto;
}

.event-dialog::backdrop {
  background: rgba(4, 7, 16, 0.72);
  backdrop-filter: blur(6px);
}

.dialog-close-form { position: sticky; top: 0; z-index: 3; height: 0; display: flex; justify-content: flex-end; }

.dialog-close {
  margin: 0.6rem 0.6rem 0 0;
  width: 2.3rem;
  height: 2.3rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(8, 13, 28, 0.7);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.dialog-close:hover { background: rgba(8, 13, 28, 0.9); }

.dialog-pic { margin: 0; position: relative; }
.dialog-pic img { display: block; width: 100%; max-height: 24rem; object-fit: cover; }
.dialog-pic .pic-credit { position: absolute; right: 0.6rem; bottom: 0.4rem; padding: 0.15rem 0.5rem; background: rgba(8, 13, 28, 0.65); border-radius: 6px; color: #d7deee; }
.dialog-pic .pic-credit a { color: #fff; }

.dialog-head { padding: 1rem 1.2rem 0.4rem; }
.dialog-eyebrow { margin: 0 0 0.3rem; color: var(--p, var(--accent)); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.dialog-title { margin: 0 0 0.35rem; font-size: clamp(1.3rem, 3vw, 1.8rem); line-height: 1.15; letter-spacing: -0.01em; }
.dialog-when { margin: 0 0 0.5rem; color: var(--text-soft); font-size: 0.92rem; }
.dialog-content { padding: 0.4rem 1.2rem 1.2rem; }
.dialog-content .summary { font-size: 1rem; max-width: none; }

/* ------------------------------------------------------ highlights pics */

.highlight-pic {
  display: block;
  width: calc(100% + 1.8rem);
  margin: -0.8rem -0.9rem 0.6rem;
  padding: 0;
  height: 7.5rem;
  border: 0;
  border-radius: calc(var(--radius) - 3px) calc(var(--radius) - 3px) 0 0;
  overflow: hidden;
  cursor: zoom-in;
  background: var(--surface-2);
}

.highlight-pic img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.25s ease; }
.highlight-pic:hover img { transform: scale(1.04); }

.highlight { border-top-color: var(--p, var(--muted)); }

/* ---------------------------------------------------------------- footer */

.site-footer { padding-block: 1.4rem 2.6rem; }

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.2rem;
}

.footer-grid .section-heading { margin-top: 0; }
.footer-fine { margin-top: 1.2rem; color: var(--muted); }

/* ------------------------------------------------------------ responsive */

/* Wide screens park the sticky year label in a left gutter so it never
   overlaps card text while its section scrolls past. */
@media (min-width: 900px) {
  .year-group {
    display: grid;
    grid-template-columns: 5.6rem minmax(0, 1fr);
    column-gap: 1rem;
    align-items: start;
  }

  .year-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.05rem;
    padding: 0.4rem 0.7rem;
    border-radius: 12px;
    text-align: left;
  }

  .year-events { margin-left: 0; }
}

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

@media (max-width: 820px) {
  .stats-grid { grid-template-columns: 1fr; }
  .search-hint { display: none; }
  input[type="search"] { padding-right: 0.75rem; }
  .hero-photo { min-height: clamp(26rem, 70vh, 40rem); }
  .topbar { margin-bottom: clamp(2rem, 8vh, 4rem); }
  .footer-grid { grid-template-columns: 1fr; }
  .glossary .gloss { white-space: normal; }
}

@media (max-width: 560px) {
  .mode-toggle { width: 100%; }
  .mode-btn { flex: 1; }
  .highlight-grid { grid-template-columns: 1fr; }
  .share-frame[data-ratio="16x9"] { aspect-ratio: auto; }
  .headline-stats { gap: 0.4rem; }
  .headline-stat { flex: 1 1 5.5rem; min-width: 5rem; padding: 0.5rem 0.6rem; }
  .headline-stat dd { font-size: 1.1rem; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .year-events { margin-left: 0.25rem; padding-left: 1rem; }
  .event { padding: 0.3rem 0.7rem 0.75rem; }
  .event::before { left: -1.44rem; }
  .event-facts { grid-template-columns: 1fr; gap: 0.1rem; }
  .event-facts dt { padding-top: 0.3rem; }
  .race-cols { grid-template-columns: 1fr; }
  .now-strip { grid-auto-columns: minmax(13.5rem, 80vw); }
  .event-head { grid-template-columns: 1fr; }
  .event-thumb { width: 100%; aspect-ratio: 16 / 7; margin-top: 0.2rem; order: -1; }
  .btn-follow { display: none; }
  .ov-canvas { min-height: 22rem; }
  .hero-photo h1 { font-size: clamp(2rem, 11vw, 3rem); }
  .event-dialog { width: calc(100vw - 0.8rem); max-height: calc(100vh - 0.8rem); border-radius: 14px; }
  .dialog-pic img { max-height: 14rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
