:root {
  --bg:        #080c14;
  --bg-2:      #0a0f1a;
  --panel:     #0d1320;
  --panel-2:   #121a2a;
  --line:      #263247;
  --line-soft: #1e2a3e;
  --ink:       #e6edf6;
  --ink-dim:   #9fb0c6;
  --ink-faint: #7f93ac;
  --era-ai:    #7ee0ff;
  --era-llm:   #b39dff;
  --era-agent: #7dffb0;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
  --sans: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;

  /* motion system */
  --ease-out:    cubic-bezier(.22,.7,.24,1);
  --ease-spring: cubic-bezier(.34,1.46,.5,1);
  --ease-soft:   cubic-bezier(.4,0,.2,1);
  --dur-fast: .18s;
  --dur:      .32s;
  --dur-slow: .6s;

  /* depth */
  --radius: 14px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 6px 18px -6px rgba(0,0,0,.5), 0 2px 6px -2px rgba(0,0,0,.4);
  --shadow-card: 0 24px 60px -20px rgba(0,0,0,.7), 0 8px 24px -12px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.04);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}

/* Ambient depth: slow-drifting era-colored glows behind everything. */
body::before {
  content: ""; position: fixed; inset: -20vmax; z-index: -1; pointer-events: none;
  background:
    radial-gradient(38vmax 30vmax at 72% -8%,  rgba(126,224,255,.10), transparent 60%),
    radial-gradient(34vmax 30vmax at 12% 18%,  rgba(179,157,255,.085), transparent 62%),
    radial-gradient(40vmax 34vmax at 88% 92%,  rgba(125,255,176,.075), transparent 60%),
    radial-gradient(30vmax 26vmax at 30% 108%, rgba(179,157,255,.06), transparent 60%);
  animation: ambientDrift 44s var(--ease-soft) infinite alternate;
}
@keyframes ambientDrift {
  0%   { transform: translate3d(0,0,0) scale(1); }
  50%  { transform: translate3d(-2.2%, 1.6%, 0) scale(1.06); }
  100% { transform: translate3d(2%, -1.4%, 0) scale(1.03); }
}
@media (prefers-reduced-motion: reduce) {
  body::before { animation: none; }
}

/* Scroll-reveal base state — only applied when JS marks the document. */
.js-reveal [data-reveal] {
  opacity: 0; transform: translateY(16px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
  will-change: opacity, transform;
}
.js-reveal [data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js-reveal [data-reveal] { opacity: 1 !important; transform: none !important; transition: none; }
}
.era-ai { color: var(--era-ai); } .era-llm { color: var(--era-llm); } .era-agent { color: var(--era-agent); }

.site-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 24px;
  padding: 28px clamp(16px, 5vw, 64px) 20px;
  position: sticky; top: 0; z-index: 5;
  background: linear-gradient(180deg, rgba(8,12,20,.92) 60%, rgba(8,12,20,.62));
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom: 1px solid transparent;
  border-image: linear-gradient(90deg, transparent, var(--line) 18%, var(--line) 82%, transparent) 1;
}
.title-block h1 {
  margin: 0 0 7px; font-size: clamp(21px, 3.1vw, 31px); line-height: 1.08;
  letter-spacing: -.032em; font-weight: 800; text-wrap: balance;
  background: linear-gradient(180deg, #ffffff, #c6d4e8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.tagline { margin: 0; color: var(--ink-dim); font-size: 13px; letter-spacing: .005em; }

.view-toggle { display: inline-flex; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px; flex-shrink: 0; position: relative; box-shadow: var(--shadow-1); }
.toggle-btn {
  appearance: none; border: 0; background: transparent; color: var(--ink-dim);
  font-family: var(--sans); font-size: 13px; font-weight: 600; padding: 7px 16px;
  border-radius: 999px; cursor: pointer; position: relative; z-index: 1;
  transition: color var(--dur) var(--ease-out);
}
.toggle-btn.is-active { color: var(--bg); background: var(--ink); box-shadow: 0 2px 10px -2px rgba(230,237,246,.4); }
.toggle-btn { transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-spring); }
.toggle-btn:not(.is-active):hover { color: var(--ink); }

.header-actions { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.nav-link {
  font: 600 13px/1 var(--sans); color: var(--ink-dim); text-decoration: none;
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; white-space: nowrap;
  transition: color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out),
              background var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring);
}
.nav-link:hover { color: var(--ink); border-color: #3a4a63; background: rgba(255,255,255,.025); transform: translateY(-1px); }

/* Mobile hamburger + slide-in drawer (built by nav.js); hidden on desktop. */
.nav-burger, .nav-scrim, .nav-drawer { display: none; }
@media (max-width: 760px) {
  .header-actions .nav-link { display: none; }   /* collapsed into the drawer */
  /* Drop the actions row entirely on pages that have no in-header control left
     (everything but the index, which keeps the Recap/Detailed toggle). */
  .header-actions:not(:has(.view-toggle)) { display: none; }
  /* Reserve the top-right corner so the title never runs under the pinned ☰. */
  .title-block { padding-right: 56px; }
  .nav-burger {
    position: absolute; top: 20px; right: clamp(16px, 5vw, 64px); z-index: 6;
    display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 44px; height: 44px; padding: 0 11px; box-sizing: border-box; flex-shrink: 0;
    background: var(--panel); border: 1px solid var(--line); border-radius: 12px; cursor: pointer;
  }
  .nav-burger span { display: block; width: 100%; height: 2px; border-radius: 2px; background: var(--ink-dim); }
  .nav-scrim {
    display: block; position: fixed; inset: 0; z-index: 65;
    background: rgba(4,7,12,.55); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease-out);
  }
  .nav-drawer {
    display: flex; flex-direction: column; gap: 2px;
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
    width: min(78vw, 320px);
    padding: 18px 16px calc(20px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, var(--bg-2), var(--bg));
    border-left: 1px solid var(--line); box-shadow: -22px 0 60px -16px rgba(0,0,0,.75);
    transform: translateX(100%); transition: transform var(--dur) var(--ease-out);
    overflow-y: auto; overscroll-behavior: contain;
  }
  body.nav-open .nav-scrim { opacity: 1; pointer-events: auto; }
  body.nav-open .nav-drawer { transform: none; }
  body.nav-open { overflow: hidden; }
  .nav-drawer-close {
    align-self: flex-end; width: 40px; height: 40px; margin-bottom: 6px; padding: 0;
    display: grid; place-items: center; border-radius: 50%;
    border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim);
    font: 400 22px/1 var(--sans); cursor: pointer;
  }
  .nav-drawer-link {
    display: flex; align-items: center; width: 100%; min-height: 50px;
    padding: 0 6px; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0;
    white-space: normal; font: 600 16px/1.2 var(--sans); color: var(--ink); background: none;
  }
  .nav-drawer-link:last-child { border-bottom: 0; }
  .nav-drawer-link:hover { background: none; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .nav-scrim, .nav-drawer { transition: none; }
}

.timeline {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(16px, 4vw, 48px);
  padding: 32px clamp(16px, 5vw, 64px) 64px;
  align-items: start;
}

/* spine */
.spine { position: relative; padding-left: 30px; }
.spine::before {
  content: ""; position: absolute; left: 11px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--era-ai), var(--era-llm) 55%, var(--era-agent));
}
/* Era sub-headings: large, colored section headers that clearly outrank event titles. */
.era-band { font: 800 17px/1.2 var(--sans); letter-spacing: .02em; text-transform: uppercase;
  margin: 40px 0 16px; display: flex; align-items: center; gap: 10px; }
.era-band::before { content: ""; width: 12px; height: 12px; border-radius: 3px;
  background: currentColor; box-shadow: 0 0 12px currentColor; flex-shrink: 0;
  animation: bandPulse 3.4s var(--ease-soft) infinite; }
.era-band:first-child { margin-top: 4px; }
@keyframes bandPulse {
  0%, 100% { box-shadow: 0 0 10px currentColor; }
  50%      { box-shadow: 0 0 18px currentColor, 0 0 4px currentColor; }
}
@media (prefers-reduced-motion: reduce) { .era-band::before { animation: none; } }

.event { position: relative; margin: 0 0 12px; cursor: pointer;
  transition: transform var(--dur) var(--ease-spring); }
.event:hover, .event:focus-visible { transform: translateX(4px); }
.event-dot {
  position: absolute; left: -24px; top: 5px; width: 12px; height: 12px; border-radius: 50%;
  background: #2b3a52; box-shadow: 0 0 0 4px var(--bg);
  transition: background var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring); }
.event-year { font: 600 11px/1 var(--mono); color: var(--ink-faint); letter-spacing: .04em;
  transition: color var(--dur) var(--ease-out); }
.event:hover .event-year, .event:focus-visible .event-year { color: var(--c); }
.event-title { font-size: 14px; color: #cddcef; transition: color var(--dur) var(--ease-out); }
.event:hover .event-title, .event:focus-visible .event-title { color: #fff; }
.event-count { font: 500 10px/1 var(--mono); color: var(--ink-faint); margin-left: 6px; }
.event:focus-visible { outline: none; }

/* Scroll-reveal for spine events — opacity base + one-shot rise animation, so
   the persistent hidden state never clobbers the hover translateX. */
.js-reveal .event { opacity: 0; }
.js-reveal .event.is-in {
  opacity: 1; transition: opacity .55s var(--ease-out);
  animation: eventRise .55s var(--ease-out);
}
@keyframes eventRise { from { transform: translateY(14px); } to { transform: translateY(0); } }
.js-reveal .era-band { opacity: 0; }
.js-reveal .era-band.is-in {
  opacity: 1; transition: opacity .5s var(--ease-out);
  animation: eventRise .5s var(--ease-out);
}
@media (prefers-reduced-motion: reduce) {
  .js-reveal .event, .js-reveal .era-band { opacity: 1; }
  .js-reveal .event.is-in, .js-reveal .era-band.is-in { animation: none; transition: none; }
}

/* Safety net (set by motion.js): guarantee the final visible state even if the
   paint clock is throttled and a transition/animation never completes. Killing
   the transition is essential — otherwise forcing opacity starts a fresh
   transition that itself freezes at the hidden start value. */
.js-reveal .reveal-done { opacity: 1 !important; transition: none !important; }
.js-reveal .event.reveal-done, .js-reveal .era-band.reveal-done { animation: none; transform: none; }
.js-reveal [data-reveal].reveal-done { transform: none !important; }
.js-reveal .years-chart.reveal-done .yr-chip { animation: none !important; opacity: 1 !important; transform: none !important; }

/* ── Block A: hover inline-expand + dot flair ── */
.event:hover .event-dot, .event:focus-visible .event-dot {
  background: var(--c); box-shadow: 0 0 0 4px var(--bg), 0 0 16px var(--c), 0 0 4px var(--c);
  transform: scale(1.25);
}
.event-inline { overflow: hidden; max-height: 0; opacity: 0;
  transition: max-height var(--dur) var(--ease-out), opacity var(--dur) var(--ease-out), margin var(--dur) var(--ease-out); margin-top: 0; }
.event-inline[hidden] { display: block; } /* animate instead of snap */
.event.is-open .event-inline { max-height: 180px; opacity: 1; margin-top: 8px; }
.inline-card {
  background: linear-gradient(180deg, var(--panel-2), color-mix(in srgb, var(--panel-2) 88%, #000));
  border: 1px solid var(--line);
  border-left: 3px solid var(--c); border-radius: 9px; padding: 9px 12px;
  font-size: 12px; line-height: 1.5; color: var(--ink-dim);
  box-shadow: var(--shadow-2);
}
.inline-card .it { font: 600 9px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--c); display: block; margin-bottom: 3px; }
.inline-card .hint { color: var(--ink-faint); }
@media (prefers-reduced-motion: reduce) {
  .event-inline { transition: none; }
}

/* ── Block B: pinned detail panel + opening reveal + diagrams ── */
.detail { position: sticky; top: 120px; }
.detail-empty { border: 1px dashed var(--line); border-radius: 14px; padding: 40px 24px;
  text-align: center; color: var(--ink-faint); }
.detail-empty-icon { font-size: 28px; margin: 0 0 10px; opacity: .6; }

.detail-card {
  position: relative; overflow: hidden;
  background:
    radial-gradient(120% 80% at 0% 0%, color-mix(in srgb, var(--c) 9%, transparent), transparent 55%),
    var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--c); border-radius: var(--radius); padding: 22px 22px 24px;
  transform-origin: top center;
  box-shadow: var(--shadow-card);
}
/* faint top sheen */
.detail-card::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--c) 60%, transparent), transparent);
}
.detail-card.revealing { animation: cardOpen .34s var(--ease-spring); }
@keyframes cardOpen {
  from { opacity: 0; transform: scale(.975) translateY(-8px); }
  to   { opacity: 1; transform: none; }
}
/* Light cross-fade used when swapping between already-pinned events. */
.detail-card.swapping { animation: cardSwap .26s var(--ease-out); }
@keyframes cardSwap { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Dismiss button on a pinned card. */
.detail-close {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 30px; height: 30px; display: grid; place-items: center; padding: 0;
  border-radius: 50%; border: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 78%, transparent);
  color: var(--ink-dim); font: 400 19px/1 var(--sans); cursor: pointer;
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring);
}
.detail-close:hover { color: var(--ink); background: var(--panel-2); border-color: #3a4a63; transform: scale(1.09); }
.detail-close:active { transform: scale(.95); }
.detail-card:has(.detail-close) .d-era,
.detail-card:has(.detail-close) > h2 { padding-right: 36px; }
.detail-card .d-era { font: 600 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--c); }
.detail-card h2 { margin: 6px 0 2px; font-size: 21px; color: #fff; }
.detail-card .d-meta { font: 11px/1.4 var(--mono); color: var(--ink-faint); margin-bottom: 14px; }
.detail-card .d-long { font-size: 13.5px; line-height: 1.65; color: #c4d2e4; margin: 0 0 14px; }
.detail-card .d-diagram { background: #0a0f17; border: 1px dashed var(--line); border-radius: 10px;
  padding: 14px; margin: 0 0 14px; text-align: center; font: 10px/1.4 var(--mono); color: var(--ink-faint);
  position: relative; overflow: hidden; }
.detail-card .d-diagram svg { display: block; margin: 0 auto 6px; }
/* one-time light sweep across the diagram when a card reveals */
.detail-card.revealing .d-diagram::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, color-mix(in srgb, var(--c) 22%, transparent) 50%, transparent 70%);
  transform: translateX(-120%); animation: diagramSweep .9s var(--ease-out) .12s both;
}
.detail-card.revealing .d-diagram svg { animation: diagramRise .5s var(--ease-out) .1s both; }
@keyframes diagramSweep { to { transform: translateX(120%); } }
@keyframes diagramRise { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .detail-card.revealing .d-diagram::after, .detail-card.revealing .d-diagram svg { animation: none; }
}
.detail-card .d-impact { background: rgba(125,255,176,.06); border-left: 2px solid var(--era-agent);
  border-radius: 7px; padding: 9px 12px; font-size: 12px; color: #a9e8c4; margin: 0 0 14px; }
.detail-card .d-members { list-style: none; padding: 0; margin: 0 0 14px; }
.detail-card .d-members li { font-size: 12px; padding: 4px 0; border-top: 1px solid var(--line-soft); }
.detail-card .d-members .my { font-family: var(--mono); color: var(--ink-faint); margin-right: 8px; }
.detail-card .d-members a { color: var(--ink-dim); text-decoration: none; }
.detail-card .d-members a:hover { color: var(--ink); text-decoration: underline; }
.detail-card .d-link { display: inline-block; font: 600 12px/1 var(--sans); color: var(--bg);
  background: var(--c); border-radius: 7px; padding: 9px 14px; text-decoration: none;
  box-shadow: 0 4px 14px -4px var(--c);
  transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease-out), filter var(--dur) var(--ease-out); }
.detail-card .d-link:hover { transform: translateY(-2px); box-shadow: 0 8px 22px -6px var(--c); filter: brightness(1.06); }
.detail-card.revealing > * { animation: blockIn .3s both; }
.detail-card.revealing > *:nth-child(1){animation-delay:.02s}
.detail-card.revealing > *:nth-child(2){animation-delay:.05s}
.detail-card.revealing > *:nth-child(3){animation-delay:.09s}
.detail-card.revealing > *:nth-child(4){animation-delay:.13s}
.detail-card.revealing > *:nth-child(5){animation-delay:.17s}
.detail-card.revealing > *:nth-child(6){animation-delay:.21s}
@keyframes blockIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.event.is-pinned .event-dot { background: var(--c); box-shadow: 0 0 0 4px var(--bg), 0 0 14px var(--c); }
@media (prefers-reduced-motion: reduce) {
  .detail-card.revealing, .detail-card.revealing > *, .detail-card.swapping { animation: none; }
}

.load-error { color: var(--ink-dim); font-size: 14px; line-height: 1.6; max-width: 46ch; }
.load-error code { font-family: var(--mono); color: var(--era-ai); }

/* Footer disclaimers: quiet small-print that recedes from the content. */
.site-footer {
  padding: 20px clamp(16px, 5vw, 64px) 40px;
  border-top: 1px solid var(--line-soft);
  color: var(--ink-faint);
}
.site-footer p { margin: 0; font-size: 12px; line-height: 1.6; max-width: 72ch; }
.site-footer code { font-family: var(--mono); font-size: 11.5px; color: var(--ink-dim); }

/* Type filter bar (Detailed view only) */
.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 4px clamp(16px, 5vw, 64px) 0; }
.filters[hidden] { display: none; }
.filter-label { font: 600 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint); margin-right: 4px; }
.filter-btn { appearance: none; border: 1px solid var(--line); background: var(--panel);
  color: var(--ink-dim); font: 600 12px/1 var(--sans); padding: 7px 14px; border-radius: 999px;
  cursor: pointer; transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring); }
.filter-btn:hover { color: var(--ink); border-color: #3a4a63; transform: translateY(-1px); }
.filter-btn.is-active { color: var(--bg); background: var(--ink); border-color: var(--ink); box-shadow: 0 2px 10px -3px rgba(230,237,246,.4); }

/* Collapsible filter trigger — mobile only; the inline row stays on desktop.
   .filter-options is display:contents on desktop so its buttons flow in the bar
   exactly as before. */
.filter-options { display: contents; }
.filter-toggle { display: none; }
.filter-toggle-value { color: var(--ink); font-weight: 700; }
.filter-caret { color: var(--ink-faint); font-size: 11px; transition: transform var(--dur) var(--ease-out); }
@media (max-width: 760px) {
  .filters { position: relative; }
  .filter-label { display: none; }
  .filter-toggle {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
    appearance: none; cursor: pointer;
    border: 1px solid var(--line); background: var(--panel); color: var(--ink-dim);
    font: 600 13px/1 var(--sans); padding: 0 16px; border-radius: 999px;
    transition: border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
  }
  .filter-toggle .filter-toggle-label { color: var(--ink-faint); font-weight: 600; }
  .filter-toggle.is-filtered { border-color: var(--ink); }
  .filter-options {
    display: none; position: absolute; top: calc(100% + 6px);
    left: clamp(16px, 5vw, 64px); z-index: 20;
    flex-direction: column; gap: 6px; min-width: 220px;
    padding: 8px; border-radius: 14px;
    background: var(--panel-2); border: 1px solid var(--line); box-shadow: var(--shadow-card);
  }
  .filters.is-open .filter-options { display: flex; animation: menuDrop var(--dur) var(--ease-out); }
  .filters.is-open .filter-caret { transform: rotate(180deg); }
  .filter-options .filter-btn { width: 100%; justify-content: flex-start; text-align: left; }
}
@keyframes menuDrop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .filters.is-open .filter-options { animation: none; }
  .filter-caret { transition: none; }
}

/* Acronym tooltips in the click summary */
.gloss { text-decoration: none; border-bottom: 1px dotted var(--ink-faint);
  cursor: help; position: relative; font-style: normal; }
.gloss:hover, .gloss:focus-visible { border-bottom-color: var(--c, var(--era-llm)); outline: none; }
.gloss::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 9px);
  transform: translateX(-50%) translateY(4px);
  background: #18223a; color: var(--ink); border: 1px solid var(--c, var(--line));
  border-radius: 9px; padding: 7px 11px; font: 500 11.5px/1.45 var(--sans);
  white-space: normal; width: max-content; max-width: 230px; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.55); opacity: 0; pointer-events: none;
  transition: opacity .15s ease, transform .15s ease; z-index: 30; }
.gloss::before {
  content: ""; position: absolute; left: 50%; bottom: calc(100% + 3px);
  transform: translateX(-50%); border: 6px solid transparent;
  border-top-color: var(--c, var(--line)); opacity: 0; transition: opacity .15s ease; z-index: 30; }
.gloss:hover::after, .gloss:focus-visible::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.gloss:hover::before, .gloss:focus-visible::before { opacity: 1; }

/* Local images in the detail panel */
.detail-card .d-image { margin: 0 0 14px; }
.detail-card .d-image img { width: 100%; height: auto; display: block;
  border-radius: 10px; border: 1px solid var(--line); }
.detail-card .d-image figcaption { font: 10px/1.4 var(--mono); color: var(--ink-faint); margin-top: 6px; }

/* ── References page ── */
.references { padding: 32px clamp(16px, 5vw, 64px) 64px; max-width: 1080px; }
.ref-loading { color: var(--ink-faint); font-size: 14px; }
.ref-group { margin: 0 0 34px; }
.ref-domain {
  display: flex; align-items: baseline; gap: 12px;
  padding-bottom: 10px; margin-bottom: 12px; border-bottom: 1px solid var(--line-soft);
}
/* Domain is the headline: large, bright mono — clearly outranks its entries. */
.ref-domain-name { font: 800 21px/1.15 var(--mono); color: #fff; letter-spacing: -.01em; }
.ref-count {
  font: 600 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-faint);
}
.ref-list { list-style: none; margin: 0; padding: 0; }
.ref-entry {
  position: relative; display: flex; align-items: baseline; gap: 10px;
  padding: 5px 0 5px 18px; font-size: 13.5px; line-height: 1.5;
  border-radius: 7px; transition: background var(--dur) var(--ease-out); }
.ref-entry:hover { background: rgba(255,255,255,.022); }
.ref-entry::before {
  content: ""; position: absolute; left: 1px; top: 10px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--dot, var(--ink-faint));
  transition: box-shadow var(--dur) var(--ease-out); }
.ref-entry:hover::before { box-shadow: 0 0 9px var(--dot, var(--ink-faint)); }
.ref-entry[data-era="ai"]    { --dot: var(--era-ai); }
.ref-entry[data-era="llm"]   { --dot: var(--era-llm); }
.ref-entry[data-era="agent"] { --dot: var(--era-agent); }
.ref-date {
  flex-shrink: 0; min-width: 92px; white-space: nowrap;
  font: 600 12.5px/1.5 var(--mono); color: var(--ink-faint);
}
.ref-sep { flex-shrink: 0; color: var(--line); }
.ref-topic { color: var(--ink-dim); text-decoration: none; transition: color var(--dur) var(--ease-out); }
.ref-topic:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }

/* ── Editorial page ── */
.editorial { padding: 32px clamp(16px, 5vw, 64px) 56px; max-width: 720px; }
.editorial .lead { margin: 0 0 22px; font-size: 16px; line-height: 1.7; color: var(--ink); }
.editorial h2 {
  margin: 28px 0 8px; font: 700 13px/1.3 var(--sans); letter-spacing: .04em;
  text-transform: uppercase; color: var(--era-llm);
}
.editorial p { margin: 0 0 12px; font-size: 14px; line-height: 1.75; color: var(--ink-dim); }
.editorial a { color: var(--era-ai); text-decoration: none; }
.editorial a:hover { text-decoration: underline; }
.editorial strong { color: var(--ink); }
.editorial em { font-style: normal; font-weight: 600; color: var(--ink); }

/* ── By Year (horizontal) view ── */
/* Page is a flex column so the chart can be anchored to the bottom while the
   click-summary panel sits at the top-left, above the timeline. */
body.years-page { display: flex; flex-direction: column; min-height: 100vh; }
.years { flex: 1; display: flex; flex-direction: column; position: relative; padding: 18px clamp(16px, 5vw, 64px) 40px; }
.years-stage { margin-top: auto; }
.years-empty { margin: 4px 0 0; font-size: 13px; color: var(--ink-faint); }
/* The whole 1950→now axis fits the viewport — columns flex to share the width
   (no horizontal scroll); chips scale within a column but keep a fixed height,
   so column height still honestly encodes per-year activity. */
.years-scroll { overflow: visible; padding-top: 8px; }
.years-chart { display: flex; align-items: flex-end; gap: 0; width: 100%; min-height: 300px;
  position: relative; }
/* subtle activity floor under the columns */
.years-chart::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-soft) 12%, var(--line-soft) 88%, transparent);
}
.yr-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.yr-stack { display: flex; flex-direction: column-reverse; align-items: center; gap: 3px; padding-bottom: 6px; }
.yr-chip {
  width: 70%; max-width: 14px; height: 11px; padding: 0; border-radius: 3px; cursor: pointer;
  border: 1px solid var(--c); background: color-mix(in srgb, var(--c) 26%, transparent);
  transform-origin: bottom center;
  transition: transform .16s var(--ease-spring), box-shadow .16s var(--ease-out), background .16s var(--ease-out);
}
/* staggered grow-up entrance, gated on a class JS adds once the chart is in view */
.years-chart.is-in .yr-chip { animation: chipIn .52s var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 9ms); }
@keyframes chipIn {
  from { opacity: 0; transform: translateY(6px) scaleY(.15); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .years-chart.is-in .yr-chip { animation: none; }
  .yr-chip { transition: none; }
}
.yr-chip[data-era="ai"] { --c: var(--era-ai); }
.yr-chip[data-era="llm"] { --c: var(--era-llm); }
.yr-chip[data-era="agent"] { --c: var(--era-agent); }
.yr-chip:hover, .yr-chip:focus-visible {
  transform: scale(1.32); outline: none; background: var(--c); box-shadow: 0 0 12px var(--c), 0 0 4px var(--c);
}
.yr-chip.is-pinned { background: var(--c); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--c); }
.yr-tick {
  width: 100%; min-height: 20px; padding-top: 7px; border-top: 1px solid var(--line);
  font: 600 10px/1 var(--mono); color: var(--ink-faint); text-align: center; white-space: nowrap;
}
.yr-tick.is-labelled { color: var(--ink); font-size: 12.5px; font-weight: 700; letter-spacing: .02em; }
.years-hint { margin: 0 0 12px; font-size: 12px; color: var(--ink-faint);
  transition: opacity .3s var(--ease-out); }
/* Once a summary is pinned, the "click to pin it above" hint no longer applies
   and would otherwise peek out from behind the card — fade it out (keeping its
   space so the chart doesn't shift). */
.years-hint.is-hidden { opacity: 0; pointer-events: none; }
/* The summary overlays the page (out of flow) at the top-left, so pinning a card
   never shifts the chart — it just appears on top. */
.years-detail {
  position: absolute; z-index: 20; top: 18px;
  left: clamp(16px, 5vw, 64px); right: clamp(16px, 5vw, 64px);
  max-width: 600px; max-height: calc(100vh - 150px); overflow: auto;
}

/* floating hover tooltip for the by-year chips */
.years-tip {
  position: fixed; z-index: 50; max-width: 280px; pointer-events: none;
  background: #18223a; border: 1px solid var(--c, var(--line));
  border-left: 3px solid var(--c, var(--era-llm)); border-radius: 10px; padding: 9px 12px;
  box-shadow: 0 12px 34px rgba(0,0,0,.6);
  opacity: 0; transform: translateY(4px); transition: opacity .14s ease, transform .14s ease;
}
.years-tip.is-on { opacity: 1; transform: translateY(0); }
.years-tip[hidden] { display: none; }
.years-tip .tip-meta {
  display: block; margin-bottom: 3px; font: 600 9px/1.4 var(--mono);
  letter-spacing: .08em; text-transform: uppercase; color: var(--c, var(--era-llm));
}
.years-tip .tip-title { display: block; margin-bottom: 3px; font-size: 13px; color: #fff; }
.years-tip .tip-short { display: block; font-size: 11.5px; line-height: 1.5; color: var(--ink-dim); }
@media (prefers-reduced-motion: reduce) {
  .yr-chip, .years-tip { transition: none; }
}

/* ──────────────────────────────────────────────────────────────────────────
   MOBILE / TOUCH LAYER
   Two independent axes:
     • Layout      → keys off viewport width (≤760px stack, ≤480px phone pass)
     • Interaction → keys off capability (hover/pointer), so hover-only states
                     never stick after a tap and touch gets real affordances.
   ────────────────────────────────────────────────────────────────────────── */

/* Bottom-sheet scrim. Inert/hidden on desktop; shown on mobile only while a
   detail card is pinned (driven by :has, dismissed by a JS tap handler). */
.sheet-scrim { display: none; }

@media (max-width: 760px) {
  .timeline { grid-template-columns: 1fr; padding-bottom: 40px; }
  .ref-entry { flex-wrap: wrap; row-gap: 0; }
  .ref-entry .ref-sep { display: none; }

  .site-header { flex-direction: column; gap: 14px; }
  .header-actions { flex-wrap: wrap; }

  /* Detail becomes a dismissable bottom sheet in both views. It slides up only
     when a .detail-card is present, so the empty/hover-hint state never shows. */
  .detail, .years-detail {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: auto; max-width: none; order: 0; margin: 0;
    z-index: 60; max-height: 85vh; overflow-y: auto; overflow-x: hidden;
    overscroll-behavior: contain;
    padding: 10px 14px calc(14px + env(safe-area-inset-bottom));
    background: linear-gradient(180deg, var(--bg-2), var(--bg));
    border-top: 1px solid var(--line);
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -22px 60px -16px rgba(0,0,0,.75);
    transform: translateY(110%);
    transition: transform var(--dur) var(--ease-out);
    -webkit-overflow-scrolling: touch;
  }
  .detail:has(.detail-card), .years-detail:has(.detail-card) { transform: translateY(0); }
  .detail .detail-empty { display: none; }
  @media (prefers-reduced-motion: reduce) {
    .detail, .years-detail { transition: none; }
  }

  /* Scrim behind the sheet; tapping it dismisses (handler wired in JS). */
  body:has(.detail-card) .sheet-scrim {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(4,7,12,.55);
    -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
    animation: scrimIn var(--dur) var(--ease-out);
  }
  /* Lock the page behind the open sheet (the sheet scrolls independently). */
  body:has(.detail-card) { overflow: hidden; }

  /* Larger close target on the sheet. */
  .detail-close { width: 40px; height: 40px; font-size: 22px; }

  /* ≥44px touch targets for the header/filter controls. */
  .nav-link, .toggle-btn, .filter-btn {
    min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  }

  /* Roomier spine rows: pad the tap area and re-seat the dot to the year line. */
  .event { padding: 7px 0; margin: 0; min-height: 44px; }
  .event-dot { top: 12px; }

  /* ── By Year: scroll horizontally instead of crushing 76 years to fit ── */
  .years-scroll {
    overflow-x: auto; overflow-y: visible;
    overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    /* Edge fades are scroll-aware: --fade-l/--fade-r are set by years.js to 0
       at whichever end is fully reached, so the first/last year never sits
       dimmed or clipped under a static mask. */
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l, 0px), #000 calc(100% - var(--fade-r, 0px)), transparent 100%);
            mask-image: linear-gradient(90deg, transparent 0, #000 var(--fade-l, 0px), #000 calc(100% - var(--fade-r, 0px)), transparent 100%);
  }
  .years-chart { width: max-content; min-width: 100%; }
  .yr-col { flex: 0 0 auto; min-width: 32px; }
  .yr-chip { width: 20px; max-width: 22px; height: 18px; position: relative; }
  /* Extend the hit area beyond the small visual mark without distorting heights. */
  .yr-chip::after { content: ""; position: absolute; inset: -5px -7px; }
  .yr-tick { font-size: 11px; }
  .yr-tick.is-labelled { font-size: 12px; }
}

@keyframes scrimIn { from { opacity: 0; } to { opacity: 1; } }

/* Tighter phone pass: reclaim vertical space from the sticky header + gutters. */
@media (max-width: 480px) {
  .site-header { padding: 16px 16px 13px; gap: 10px; }
  .nav-burger { top: 12px; right: 16px; }
  .title-block h1 { font-size: clamp(19px, 6.4vw, 24px); }
  .tagline { font-size: 12px; }
  .header-actions { gap: 9px; width: 100%; }
  .timeline { padding: 20px 16px 40px; }
  .years { padding: 14px 16px 28px; }
  .references, .editorial { padding-top: 22px; }
}

/* Touch devices: neutralise the lift/scale/glow hover states so they don't
   stick after a tap, while keeping keyboard :focus-visible affordances and the
   pinned-state styling intact. */
@media (hover: none) {
  .event:hover { transform: none; }
  .event:hover .event-dot {
    transform: none; background: #2b3a52; box-shadow: 0 0 0 4px var(--bg);
  }
  .event.is-pinned:hover .event-dot {
    background: var(--c); box-shadow: 0 0 0 4px var(--bg), 0 0 14px var(--c);
  }
  .nav-link:hover, .filter-btn:hover, .toggle-btn:hover { transform: none; }
  .nav-link:hover { background: transparent; border-color: var(--line); }
  .yr-chip:hover {
    transform: none; box-shadow: none;
    background: color-mix(in srgb, var(--c) 26%, transparent);
  }
  .yr-chip.is-pinned:hover {
    background: var(--c); box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--c);
  }
}

/* Tap-to-toggle glossary tips (touch has no hover; JS adds .is-tip on tap). */
.gloss.is-tip::after { opacity: 1; transform: translateX(-50%) translateY(0); }
.gloss.is-tip::before { opacity: 1; }
@media (max-width: 760px) {
  .gloss::after { max-width: min(230px, 78vw); }
}
