/* ============================================================
   THE APPLE ARCHIVE — design system & components
   ------------------------------------------------------------
   - Design tokens (type scale, spacing, neutrals)
   - Per-era accent vars (animated by JS on scroll)
   - Dark / light themes
   - Components: nav, hero, timeline rail, era dividers, cards,
     detail panel, comparison engine, time-machine chart,
     compare tray, command palette, OS museum, footer
   ============================================================ */

/* ---------- Fonts: system stack only (no network needed) ---------- */
/* UI: SF Pro / system grotesque. Display: New York / Georgia fallback. */

:root {
  /* Type scale (px): 12 14 16 20 28 40 64 96 */
  --fs-12: 0.75rem;
  --fs-14: 0.875rem;
  --fs-16: 1rem;
  --fs-20: 1.25rem;
  --fs-28: 1.75rem;
  --fs-40: 2.5rem;
  --fs-64: clamp(2.75rem, 6vw, 4rem);
  --fs-96: clamp(3.5rem, 11vw, 6.5rem);

  --font-ui: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter",
    "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Cormorant Condensed", "New York", "Big Caslon", "Hoefler Text", Georgia, "Times New Roman", serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;

  /* Spacing */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;
  --sp-9: 96px; --sp-10: 128px;

  --radius: 18px;
  --radius-sm: 10px;
  --radius-lg: 28px;

  --maxw: 1280px;

  /* Per-era accent — JS animates these. Defaults = garage era. */
  --accent: #E8A33D;
  --accent-2: #C7472A;
  --era-bg: #0A0A0A;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: dark;
}

/* ---------- Theme: DARK (default) ---------- */
:root,
[data-theme="dark"] {
  --bg: #0A0A0A;
  --bg-elev: #141414;
  --surface: rgba(255, 255, 255, 0.04);
  --surface-2: rgba(255, 255, 255, 0.07);
  --text: #FAFAFA;
  --text-dim: #A8A8AD;
  --text-faint: #6E6E73;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.18);
  --glass: rgba(18, 18, 20, 0.62);
  --shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  --grain-opacity: 0.04;
}

/* ---------- Theme: LIGHT ---------- */
[data-theme="light"] {
  --bg: #FAFAFA;
  --bg-elev: #FFFFFF;
  --surface: rgba(0, 0, 0, 0.03);
  --surface-2: rgba(0, 0, 0, 0.05);
  --text: #0A0A0A;
  --text-dim: #5C5C61;
  --text-faint: #8E8E93;
  --line: rgba(0, 0, 0, 0.10);
  --line-strong: rgba(0, 0, 0, 0.16);
  --glass: rgba(250, 250, 250, 0.7);
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.25);
  --grain-opacity: 0.025;
  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--font-ui);
  font-size: var(--fs-16);
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.8s var(--ease), color 0.4s var(--ease);
}

img { max-width: 100%; display: block; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; }

/* Selection + focus */
::selection { background: var(--accent); color: #0A0A0A; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ---------- Custom scrollbar ---------- */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
  border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ---------- Ambient grain on dark sections ---------- */
.grain::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* Era-tinted ambient glow that animates with scroll */
.ambient {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(60vw 60vw at 80% -10%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    radial-gradient(50vw 50vw at -10% 110%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 70%);
  transition: background 1.2s var(--ease);
}

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 64px);
}

.eyebrow {
  font-size: var(--fs-12);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   NAV — frosted glass top bar
   ============================================================ */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  transition: background 0.6s var(--ease), border-color 0.6s var(--ease);
}
.nav-inner {
  display: flex; align-items: center; gap: var(--sp-4);
  height: 60px;
  max-width: var(--maxw); margin-inline: auto;
  padding-inline: clamp(16px, 5vw, 64px);
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 600; letter-spacing: -0.01em; font-size: var(--fs-16);
  white-space: nowrap;
}
.brand .logo { width: 18px; height: 22px; color: var(--text); }
.brand b { font-weight: 700; }

.filters {
  display: flex; gap: 2px; margin-inline: auto;
  overflow-x: auto; scrollbar-width: none;
  -ms-overflow-style: none;
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  padding: 7px 14px; border-radius: 99px;
  font-size: var(--fs-14); color: var(--text-dim);
  white-space: nowrap;
  transition: color 0.25s, background 0.25s;
}
.filter:hover { color: var(--text); background: var(--surface); }
.filter[aria-pressed="true"] {
  color: #0A0A0A; background: var(--accent);
  font-weight: 600;
}

.nav-actions { display: flex; align-items: center; gap: var(--sp-2); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 99px;
  display: grid; place-items: center;
  color: var(--text-dim);
  transition: color 0.2s, background 0.2s, transform 0.2s;
}
.icon-btn:hover { color: var(--text); background: var(--surface); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }
.search-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 99px;
  border: 1px solid var(--line);
  color: var(--text-dim); font-size: var(--fs-14);
  transition: border-color 0.2s, color 0.2s;
}
.search-btn:hover { border-color: var(--line-strong); color: var(--text); }
.search-btn kbd {
  font-family: var(--font-ui); font-size: 11px;
  padding: 2px 6px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
}
.menu-toggle { display: none; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid; place-items: center;
  text-align: center;
  padding: 120px 0 80px;
  overflow: hidden;
}
.hero-logo {
  width: clamp(72px, 12vw, 120px);
  margin: 0 auto var(--sp-5);
  animation: floaty 6s var(--ease) infinite;
}
@keyframes floaty { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-10px)} }

.hero h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--fs-96);
  line-height: 0.98;
  letter-spacing: -0.02em;
  max-width: 16ch; margin-inline: auto;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero p.lede {
  margin: var(--sp-5) auto 0;
  max-width: 56ch;
  font-size: var(--fs-20);
  color: var(--text-dim);
}
.hero-cta {
  margin-top: var(--sp-6);
  display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 24px; border-radius: 99px;
  font-size: var(--fs-16); font-weight: 500;
  transition: transform 0.2s var(--ease), box-shadow 0.2s, background 0.2s, border-color 0.2s;
}
.btn-primary {
  background: var(--accent); color: #0A0A0A; font-weight: 600;
  box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--accent) 70%, transparent);
}
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { border: 1px solid var(--line-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface); transform: translateY(-2px); }

.hero-stats {
  margin-top: var(--sp-8);
  display: flex; gap: clamp(20px, 5vw, 64px); justify-content: center; flex-wrap: wrap;
}
.hero-stat .n {
  font-family: var(--font-display);
  font-size: var(--fs-40); font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
}
.hero-stat .l { font-size: var(--fs-14); color: var(--text-dim); }

.scroll-hint {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  font-size: var(--fs-12); color: var(--text-faint);
  letter-spacing: 0.1em; text-transform: uppercase;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.scroll-hint .dot {
  width: 22px; height: 34px; border: 1.5px solid var(--line-strong); border-radius: 99px;
  position: relative;
}
.scroll-hint .dot::after {
  content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 6px; border-radius: 99px; background: var(--accent);
  animation: scrolldot 1.8s var(--ease) infinite;
}
@keyframes scrolldot { 0%{opacity:0;top:6px} 40%{opacity:1} 100%{opacity:0;top:18px} }

/* ============================================================
   TIMELINE RAIL (sticky scrubber)
   ============================================================ */
.rail {
  position: fixed; top: 50%; right: 22px; transform: translateY(-50%);
  z-index: 60;
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 6px; border-radius: 99px;
  background: var(--glass);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
}
.rail button {
  position: relative;
  width: 30px; height: 26px;
  display: grid; place-items: center;
  color: var(--text-faint); font-size: 10px; font-weight: 600;
  border-radius: 99px;
  transition: color 0.2s;
}
.rail button .tick {
  width: 14px; height: 2px; border-radius: 2px; background: currentColor;
  transition: width 0.3s var(--ease), background 0.3s;
}
.rail button:hover { color: var(--text); }
.rail button[aria-current="true"] { color: var(--accent); }
.rail button[aria-current="true"] .tick { width: 22px; background: var(--accent); }
.rail button .yr {
  position: absolute; right: 110%; white-space: nowrap;
  background: var(--bg-elev); color: var(--text);
  padding: 3px 9px; border-radius: 8px; font-size: 11px;
  border: 1px solid var(--line);
  opacity: 0; pointer-events: none; transform: translateX(6px);
  transition: opacity 0.2s, transform 0.2s;
}
.rail button:hover .yr { opacity: 1; transform: translateX(0); }

/* ============================================================
   ERA SECTIONS & DIVIDERS
   ============================================================ */
.era { position: relative; padding: var(--sp-9) 0 var(--sp-8); scroll-margin-top: 80px; }
.era-divider {
  text-align: center; padding: var(--sp-8) 0 var(--sp-6);
  scroll-margin-top: 70px;
}
.era-divider .era-range {
  font-size: var(--fs-14); letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); font-weight: 600;
}
.era-divider h2 {
  font-family: var(--font-display);
  font-size: var(--fs-64); font-weight: 600; letter-spacing: -0.02em;
  margin-top: var(--sp-2);
  line-height: 1.02;
}
.era-divider p {
  max-width: 58ch; margin: var(--sp-4) auto 0;
  color: var(--text-dim); font-size: var(--fs-20);
}
.era-divider .rule {
  width: 64px; height: 4px; border-radius: 4px; margin: var(--sp-5) auto 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ============================================================
   DEVICE GRID + CARDS
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
  margin-top: var(--sp-6);
}

.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-5);
  overflow: hidden;
  transition: transform 0.45s var(--ease), border-color 0.4s, box-shadow 0.45s, background 0.4s;
  /* reveal-on-enter */
  opacity: 0; transform: translateY(28px);
}
.card.in { opacity: 1; transform: none; }
.card:hover {
  transform: translateY(-6px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  background: var(--surface-2);
}
.card::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 50% -20%,
    color-mix(in srgb, var(--card-accent, var(--accent)) 16%, transparent), transparent 60%);
  opacity: 0; transition: opacity 0.5s;
}
.card:hover::before { opacity: 1; }

.card-media {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-4);
  padding: 14px;
  /* a clean, consistent light "studio" panel so every product photo —
     whatever its original background — reads as a floating product */
  background:
    radial-gradient(120% 95% at 50% -15%, color-mix(in srgb, var(--card-accent, var(--accent)) 22%, transparent), transparent 60%),
    linear-gradient(180deg, #ffffff 0%, #edeff2 100%);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05), inset 0 -22px 44px -28px rgba(0, 0, 0, 0.22);
  overflow: hidden;
}
.card-media .device-art {
  width: 70%; height: 70%;
  filter: drop-shadow(0 16px 18px rgba(0,0,0,0.30));
  transition: transform 0.5s var(--ease);
}
.card:hover .device-art { transform: translateY(-4px) scale(1.04) rotate(-1deg); }

/* Real product photography (with SVG fallback handled in JS) */
.device-photo {
  width: 100%; height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 14px 18px rgba(0, 0, 0, 0.22));
  transition: transform 0.55s var(--ease);
}
.card:hover .device-photo { transform: scale(1.06) translateY(-3px); }
.modal-hero .device-photo {
  width: 230px; height: 190px; margin-bottom: var(--sp-4);
  background: linear-gradient(180deg, #ffffff, #edeff2);
  border-radius: 18px; padding: 18px;
  box-shadow: 0 22px 44px -18px rgba(0, 0, 0, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}
.pi-icon {
  background: linear-gradient(180deg, #ffffff, #edeff2);
  border-radius: 7px; padding: 3px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}
.pi-icon .device-photo { width: 100%; height: 100%; filter: none; }
.pi-icon .device-art { width: 100%; height: 100%; }
.card-media .line-badge {
  position: absolute; top: 10px; left: 10px;
  font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 99px;
  background: var(--glass); border: 1px solid var(--line);
  color: var(--text-dim); backdrop-filter: blur(8px);
}
.card-media .year-badge {
  position: absolute; top: 10px; right: 12px;
  font-family: var(--font-display);
  font-size: var(--fs-20); font-weight: 600;
  color: rgba(20, 20, 22, 0.82);                 /* dark on the light studio panel */
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.55);
}
.card-media .line-badge {
  background: rgba(255, 255, 255, 0.72);
  color: #44454a; border-color: rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(6px);
}

.card h3 { font-size: var(--fs-20); letter-spacing: -0.01em; line-height: 1.2; }
.card .dates { font-size: var(--fs-12); color: var(--text-faint); margin-top: 2px; }
.card .blurb {
  margin-top: var(--sp-3); font-size: var(--fs-14); color: var(--text-dim);
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.card-quickstats {
  display: flex; gap: var(--sp-4); margin-top: var(--sp-4);
  padding-top: var(--sp-4); border-top: 1px solid var(--line);
}
.qstat { flex: 1; min-width: 0; }
.qstat .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); }
.qstat .v {
  font-family: var(--font-display); font-weight: 600;
  font-size: var(--fs-16); color: var(--text);
  font-variant-numeric: tabular-nums;
}

.card-actions { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); }
.card-actions .btn-sm {
  flex: 1; padding: 9px 12px; border-radius: 10px;
  font-size: var(--fs-14); text-align: center;
  border: 1px solid var(--line);
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.card-actions .btn-sm:hover { background: var(--surface-2); border-color: var(--line-strong); }
.card-actions .btn-sm.primary { background: var(--accent); color: #0A0A0A; border-color: transparent; font-weight: 600; }
.card-actions .btn-sm.added { background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent); border-color: transparent; }

/* ============================================================
   DEVICE DETAIL MODAL
   ============================================================ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: clamp(12px, 4vw, 40px);
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(960px, 100%); max-height: 90svh; overflow-y: auto;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transform: translateY(20px) scale(0.98); transition: transform 0.35s var(--ease);
}
.modal-backdrop.open .modal { transform: none; }
.modal-hero {
  position: relative; padding: var(--sp-7) var(--sp-7) var(--sp-6);
  background:
    radial-gradient(90% 120% at 70% -10%, color-mix(in srgb, var(--card-accent, var(--accent)) 30%, transparent), transparent 70%),
    var(--surface);
  border-bottom: 1px solid var(--line);
}
.modal-close {
  position: absolute; top: 18px; right: 18px;
  width: 36px; height: 36px; border-radius: 99px;
  background: var(--glass); border: 1px solid var(--line);
  display: grid; place-items: center; color: var(--text);
}
.modal-close:hover { background: var(--surface-2); }
.modal-hero .device-art { width: 160px; height: 130px; margin-bottom: var(--sp-4); filter: drop-shadow(0 20px 30px rgba(0,0,0,0.5)); }
.modal-hero h2 { font-family: var(--font-display); font-size: var(--fs-40); letter-spacing: -0.02em; }
.modal-hero .sub { color: var(--text-dim); margin-top: 6px; }
.modal-body { padding: var(--sp-6) var(--sp-7) var(--sp-7); }
.modal-body .blurb { font-size: var(--fs-20); color: var(--text); line-height: 1.5; }
.firsts {
  margin-top: var(--sp-4); padding: var(--sp-4);
  border-left: 3px solid var(--accent); border-radius: 0 10px 10px 0;
  background: var(--surface); font-size: var(--fs-16); color: var(--text-dim);
}
.trivia {
  margin-top: var(--sp-4); padding: var(--sp-4);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 12px; font-size: var(--fs-14);
}
.trivia b { color: var(--accent); }

.spec-grid {
  margin-top: var(--sp-6);
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
}
.spec {
  background: var(--bg-elev); padding: var(--sp-4);
}
.spec .k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-faint); }
.spec .v { margin-top: 4px; font-size: var(--fs-16); }

/* Comparison engine block inside modal */
.compare-engine { margin-top: var(--sp-6); }
.compare-engine h4 {
  font-size: var(--fs-14); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-faint); margin-bottom: var(--sp-4);
  display: flex; align-items: center; gap: 10px;
}
.scale-toggle { margin-left: auto; display: flex; gap: 2px; background: var(--surface); border-radius: 99px; padding: 3px; }
.scale-toggle button { font-size: 11px; padding: 4px 12px; border-radius: 99px; color: var(--text-dim); }
.scale-toggle button[aria-pressed="true"] { background: var(--accent); color: #0A0A0A; font-weight: 600; }

.cmp-row { margin-bottom: var(--sp-5); }
.cmp-row .cmp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.cmp-row .cmp-title { font-size: var(--fs-16); font-weight: 600; }
.cmp-row .cmp-factor {
  font-family: var(--font-display); font-size: var(--fs-28); font-weight: 600;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.cmp-bars { display: grid; gap: 6px; }
.cmp-bar-label { display: flex; justify-content: space-between; font-size: var(--fs-12); color: var(--text-dim); }
.cmp-track { height: 12px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.cmp-fill {
  height: 100%; border-radius: 99px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1s var(--ease-out);
}
.cmp-fill.muted { background: var(--line-strong); }
.cmp-note { font-size: var(--fs-14); color: var(--text-dim); margin-top: 8px; }
.cmp-approx { font-size: 11px; color: var(--text-faint); font-style: italic; }

/* ============================================================
   TIME MACHINE — interactive log/linear growth chart
   ============================================================ */
.timemachine { padding: var(--sp-9) 0; }
.tm-head { text-align: center; max-width: 66ch; margin: 0 auto var(--sp-6); }
.tm-head h2 { font-family: var(--font-display); font-size: var(--fs-64); letter-spacing: -0.02em; }
.tm-sub { color: var(--text-dim); font-size: var(--fs-16); margin-top: var(--sp-3); line-height: 1.6; }
.tm-sub b { color: var(--text); font-weight: 600; }

.tm-controls { display: flex; gap: var(--sp-3); justify-content: center; flex-wrap: wrap; margin-bottom: var(--sp-5); }
.tm-metrics, .tm-scale { display: inline-flex; gap: 4px; padding: 4px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.tm-metric, .tm-scalebtn {
  font-size: var(--fs-14); padding: 7px 16px; border-radius: 99px; color: var(--text-dim);
  white-space: nowrap; transition: background 0.2s, color 0.2s;
}
.tm-metric[aria-pressed="true"], .tm-scalebtn[aria-pressed="true"] { background: var(--accent); color: #0A0A0A; font-weight: 600; }
.tm-metric:hover, .tm-scalebtn:hover { color: var(--text); }

.tm-chart-wrap { position: relative; width: 100%; }
#tm-svg { width: 100%; height: auto; display: block; overflow: visible; }
.tm-grid { stroke: var(--line); stroke-width: 1; }
.tm-axis { fill: var(--text-faint); font-size: 14px; font-family: var(--font-mono); }
.tm-axis-y { fill: var(--text-dim); }
.tm-area { fill: color-mix(in srgb, var(--accent) 13%, transparent); stroke: none; }
.tm-line { fill: none; stroke: color-mix(in srgb, var(--accent) 55%, transparent); stroke-width: 2; stroke-linejoin: round; }
.tm-dot { stroke: var(--bg); stroke-width: 1.5; cursor: pointer; transition: r 0.15s ease; }
.tm-dot:hover, .tm-dot.on { r: 7.5; stroke-width: 2; }
.tm-mile {
  fill: var(--text); font-size: 13px; font-weight: 600; font-family: var(--font-ui);
  pointer-events: none; paint-order: stroke; stroke: var(--bg); stroke-width: 3px; stroke-linejoin: round;
}

.tm-tip {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none; z-index: 5;
  background: var(--bg-elev); border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 7px 11px; box-shadow: var(--shadow); white-space: nowrap; font-size: 0.82rem;
}
.tm-tip b { display: block; color: var(--text); }
.tm-tip span { color: var(--text-dim); font-variant-numeric: tabular-nums; }

.tm-legend { display: flex; gap: var(--sp-3) var(--sp-4); justify-content: center; flex-wrap: wrap; margin-top: var(--sp-4); }
.tm-leg { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-12); color: var(--text-dim); }
.tm-leg i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }

.tm-takeaway {
  display: flex; align-items: center; gap: var(--sp-5); flex-wrap: wrap; justify-content: center;
  max-width: 74ch; margin: var(--sp-6) auto 0; padding: var(--sp-5); text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.tm-bignum { font-family: var(--font-display); font-weight: 600; font-size: clamp(38px, 6vw, 68px); line-height: 1; color: var(--accent); white-space: nowrap; }
.tm-bignum span { font-size: 0.5em; opacity: 0.65; margin-left: 1px; }
.tm-takeaway p { flex: 1; min-width: 230px; color: var(--text-dim); font-size: var(--fs-16); line-height: 1.6; }
.tm-takeaway p b { color: var(--text); font-weight: 600; }
.tm-caveat { display: block; margin-top: 6px; font-size: var(--fs-12); color: var(--text-faint); }

@media (prefers-reduced-motion: no-preference) {
  .tm-dot { animation: tmpop 0.4s var(--ease) both; animation-delay: calc(var(--i) * 6ms); transform-box: fill-box; transform-origin: center; }
  @keyframes tmpop { from { opacity: 0; transform: scale(0); } to { opacity: 1; transform: scale(1); } }
}

/* ============================================================
   COMPARE TRAY
   ============================================================ */
.tray {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 120;
  background: var(--glass);
  backdrop-filter: saturate(180%) blur(24px); -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: 1px solid var(--line-strong);
  transform: translateY(110%); transition: transform 0.45s var(--ease);
  box-shadow: 0 -20px 50px -20px rgba(0,0,0,0.6);
}
.tray.open { transform: none; }
.tray-bar {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-3) clamp(16px, 5vw, 64px);
  max-width: var(--maxw); margin-inline: auto;
}
.tray-bar .count { font-weight: 600; }
.tray-chips { display: flex; gap: 8px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tray-chips::-webkit-scrollbar { display: none; }
.tray-chip {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  padding: 6px 8px 6px 12px; border-radius: 99px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: var(--fs-14);
}
.tray-chip button { color: var(--text-faint); width: 18px; height: 18px; border-radius: 99px; }
.tray-chip button:hover { color: var(--text); background: var(--surface); }

.cmp-panel {
  max-height: 0; overflow: hidden; transition: max-height 0.5s var(--ease);
}
.cmp-panel.open { max-height: 70svh; overflow-y: auto; }
.cmp-table-wrap { padding: 0 clamp(16px, 5vw, 64px) var(--sp-6); max-width: var(--maxw); margin-inline: auto; }
.cmp-table { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.cmp-table th, .cmp-table td { text-align: left; padding: var(--sp-3); border-bottom: 1px solid var(--line); vertical-align: top; }
.cmp-table th:first-child, .cmp-table td:first-child { color: var(--text-faint); font-weight: 500; white-space: nowrap; }
.cmp-table thead th { font-family: var(--font-display); font-size: var(--fs-16); }
.cmp-table .winner { color: var(--accent); font-weight: 600; }

/* ============================================================
   COMMAND PALETTE
   ============================================================ */
.palette-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(6px);
  display: grid; place-items: start center; padding-top: 14vh;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.palette-backdrop.open { opacity: 1; pointer-events: auto; }
.palette {
  width: min(640px, 92vw);
  background: var(--bg-elev); border: 1px solid var(--line-strong);
  border-radius: 16px; box-shadow: var(--shadow); overflow: hidden;
  transform: translateY(-12px); transition: transform 0.25s var(--ease);
}
.palette-backdrop.open .palette { transform: none; }
.palette-input {
  display: flex; align-items: center; gap: 12px; padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.palette-input svg { width: 20px; height: 20px; color: var(--text-faint); }
.palette-input input {
  flex: 1; background: none; border: none; outline: none;
  color: var(--text); font-size: var(--fs-20);
}
.palette-results { max-height: 50vh; overflow-y: auto; padding: var(--sp-2); }
.palette-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 10px 12px; border-radius: 10px; text-align: left;
}
.palette-item[aria-selected="true"], .palette-item:hover { background: var(--surface-2); }
.palette-item .pi-icon { width: 34px; height: 28px; flex: none; }
.palette-item .pi-name { font-size: var(--fs-16); }
.palette-item .pi-meta { font-size: var(--fs-12); color: var(--text-faint); margin-left: auto; white-space: nowrap; }
.palette-empty { padding: var(--sp-6); text-align: center; color: var(--text-faint); }

/* ============================================================
   OS MUSEUM
   ============================================================ */
.museum { padding: var(--sp-9) 0; background: var(--bg-elev); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.museum-head { text-align: center; max-width: 64ch; margin: 0 auto var(--sp-7); }
.museum-head h2 { font-family: var(--font-display); font-size: var(--fs-64); letter-spacing: -0.02em; }
.museum-head p { color: var(--text-dim); font-size: var(--fs-20); margin-top: var(--sp-3); }

.os-picker { display: flex; gap: var(--sp-2); justify-content: center; flex-wrap: wrap; margin-bottom: var(--sp-6); }
.os-chip {
  padding: 9px 18px; border-radius: 99px; font-size: var(--fs-14);
  border: 1px solid var(--line); color: var(--text-dim);
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.os-chip:hover { color: var(--text); border-color: var(--line-strong); }
.os-chip[aria-pressed="true"] { background: var(--accent); color: #0A0A0A; border-color: transparent; font-weight: 600; }

/* CRT bezel */
.crt {
  max-width: 900px; margin: 0 auto;
  background: linear-gradient(180deg, #E9E5DC, #C8C2B4);
  border-radius: 26px; padding: 26px 26px 54px;
  box-shadow: var(--shadow), inset 0 2px 4px rgba(255,255,255,0.6);
  position: relative;
}
[data-theme="light"] .crt { background: linear-gradient(180deg, #DAD5C8, #B6B0A0); }
.crt::after {
  content: "The Apple Archive"; position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%);
  font-size: 11px; letter-spacing: 0.18em; color: #6b6355; text-transform: uppercase;
}
.crt-screen {
  aspect-ratio: 4 / 3;
  background: #000; border-radius: 8px; overflow: hidden;
  position: relative; box-shadow: inset 0 0 40px rgba(0,0,0,0.8);
}
.crt-screen .scanlines {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.10) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply; opacity: 0.5;
}

/* Launch overlay (lazy opt-in) */
.os-launch {
  position: absolute; inset: 0; z-index: 10;
  display: grid; place-items: center; text-align: center;
  background: radial-gradient(circle at 50% 40%, #1c1c1c, #000);
  color: #fff; padding: var(--sp-5);
}
.os-launch .chip { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: #8a8a8a; }
.os-launch h3 { font-family: var(--font-display); font-size: var(--fs-28); margin: 10px 0; }
.os-launch p { color: #aaa; font-size: var(--fs-14); max-width: 44ch; margin: 0 auto var(--sp-4); }
.os-launch .launch-btn {
  background: #fff; color: #000; font-weight: 600; padding: 12px 22px; border-radius: 99px;
  transition: transform 0.2s;
}
.os-launch .launch-btn:hover { transform: scale(1.04); }
.os-launch .size { display: block; margin-top: 10px; font-size: 11px; color: #777; }

/* ---- Classic Mac System recreation ---- */
.classic {
  position: absolute; inset: 0; z-index: 8;
  background: #b3b3b3;
  /* desktop dither pattern */
  background-image:
    repeating-conic-gradient(#a8a8a8 0% 25%, #c0c0c0 0% 50%);
  background-size: 4px 4px;
  font-family: var(--font-mono);
  color: #000; font-size: 12px;
  -webkit-font-smoothing: none;
}
.classic .menubar {
  height: 22px; background: #fff; border-bottom: 1px solid #000;
  display: flex; align-items: center; gap: 18px; padding: 0 10px; z-index: 20; position: relative;
}
.classic .menubar .apple { font-size: 14px; }
.classic .menubar .mi { font-size: 12px; }
.classic .menubar .clock { margin-left: auto; }
.classic .desktop { position: absolute; inset: 22px 0 0 0; }

.classic .icon {
  position: absolute; width: 64px; text-align: center; cursor: default;
  user-select: none;
}
.classic .icon .glyph {
  width: 38px; height: 34px; margin: 0 auto 2px;
  background: #fff; border: 1px solid #000;
  display: grid; place-items: center; font-size: 18px;
  box-shadow: 1px 1px 0 #000;
}
.classic .icon .label { background: #fff; padding: 0 2px; display: inline-block; }
.classic .icon.sel .label { background: #000; color: #fff; }

.win {
  position: absolute; background: #fff; border: 1px solid #000;
  box-shadow: 2px 2px 0 rgba(0,0,0,0.4); min-width: 180px;
}
.win .titlebar {
  height: 18px; border-bottom: 1px solid #000; display: flex; align-items: center;
  /* classic horizontal title-bar lines */
  background: repeating-linear-gradient(0deg, #000 0 1px, #fff 1px 2px);
  padding: 0 4px;
}
.win .titlebar .closebox { width: 11px; height: 11px; background: #fff; border: 1px solid #000; margin-right: 6px; }
.win .titlebar .t { background: #fff; padding: 0 6px; font-size: 12px; }
.win .content { padding: 10px 12px; background: #fff; }
.win .content p { margin-bottom: 8px; line-height: 1.4; }
.win.about .content { text-align: center; }
.win.about .happy { font-size: 26px; }

/* Boot screen */
.boot {
  position: absolute; inset: 0; z-index: 9; background: #b3b3b3;
  display: grid; place-items: center;
  background-image: repeating-conic-gradient(#a8a8a8 0% 25%, #c0c0c0 0% 50%);
  background-size: 4px 4px;
}
.boot .happymac {
  width: 84px; height: 84px; background: #fff; border: 2px solid #000;
  border-radius: 8px; display: grid; place-items: center; font-size: 40px;
  box-shadow: 3px 3px 0 rgba(0,0,0,0.35);
}
.boot .welcome { position: absolute; bottom: 40px; font-family: var(--font-mono); font-size: 12px; }
.boot .bootbar {
  position: absolute; bottom: 22px; width: 180px; height: 10px;
  border: 1px solid #000; background: #fff;
}
.boot .bootbar i { display: block; height: 100%; width: 0; background: #000; transition: width 0.2s linear; }

/* ---- Apple II green-phosphor BASIC screen ---- */
.apple2 {
  position: absolute; inset: 0; z-index: 8;
  background: #0a140a; color: #41ff5a;
  font-family: var(--font-mono); font-size: 14px; line-height: 1.32;
  padding: 10px 14px; overflow: hidden; cursor: text;
  text-shadow: 0 0 5px rgba(65, 255, 90, 0.45);
}
.apple2 .a2-screen { white-space: pre-wrap; word-break: break-word; height: 100%; overflow: hidden; }
.apple2 .a2-cursor { background: #41ff5a; color: #0a140a; animation: a2blink 1s steps(1) infinite; }
@keyframes a2blink { 50% { background: transparent; color: transparent; } }
.apple2 .a2-hint { position: absolute; right: 14px; bottom: 10px; font-size: 10px; letter-spacing: 0.06em; color: #1f7a2c; }
.apple2 input.a2-capture { position: absolute; left: -9999px; top: 0; opacity: 0; width: 1px; height: 1px; }

/* ---- Live emulator OS picker ---- */
.os-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 14px auto 6px; max-width: 380px; }
.os-launch-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 9px 12px; border-radius: 10px; text-align: left; color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(255, 255, 255, 0.04);
  transition: background 0.15s, transform 0.15s;
}
.os-launch-btn:hover { background: rgba(255, 255, 255, 0.12); transform: translateY(-1px); }
.os-launch-btn b { font-size: 13px; }
.os-launch-btn span { font-size: 10px; color: #9a9a9a; }

iframe.os-frame { width: 100%; height: 100%; border: 0; background: #000; }

.os-meta { max-width: 900px; margin: var(--sp-4) auto 0; display: flex; gap: var(--sp-4); align-items: center; flex-wrap: wrap; }
.os-meta .tour-toggle, .os-meta .mute-toggle {
  display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-14);
  padding: 8px 14px; border-radius: 99px; border: 1px solid var(--line); color: var(--text-dim);
}
.os-meta .tour-toggle[aria-pressed="true"] { background: var(--accent); color: #0A0A0A; border-color: transparent; }
.os-credit { font-size: var(--fs-12); color: var(--text-faint); margin-left: auto; max-width: 46ch; }

/* guided-tour tooltip */
.tour-tip {
  position: absolute; z-index: 30; max-width: 200px;
  background: var(--accent); color: #0A0A0A; font-family: var(--font-ui);
  font-size: 12px; padding: 8px 11px; border-radius: 10px;
  box-shadow: var(--shadow);
}
.tour-tip::after {
  content: ""; position: absolute; bottom: -6px; left: 18px;
  border: 6px solid transparent; border-top-color: var(--accent); border-bottom: 0;
}

/* ============================================================
   AD HISTORY
   ============================================================ */
.ads { padding: var(--sp-9) 0; }
.ads-head { text-align: center; max-width: 62ch; margin: 0 auto var(--sp-7); }
.ads-head h2 { font-family: var(--font-display); font-size: var(--fs-64); letter-spacing: -0.02em; }
.ads-head p { color: var(--text-dim); font-size: var(--fs-20); margin-top: var(--sp-3); }

.section-tabs {
  display: inline-flex; gap: 6px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 99px; padding: 4px;
  margin-bottom: var(--sp-6);
}
.section-tab {
  padding: 5px 14px; border-radius: 99px;
  font-size: var(--fs-13); font-weight: 500;
  color: var(--text-faint); text-decoration: none;
  transition: color 0.18s, background 0.18s;
  white-space: nowrap;
}
.section-tab:hover { color: var(--text); }
.section-tab[aria-current="page"] {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

.ads-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
}

.ad-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  color: var(--text);
  transition: transform 0.45s var(--ease), border-color 0.4s, box-shadow 0.45s, background 0.4s;
  opacity: 0; transform: translateY(28px);
}
.ad-card.in { opacity: 1; transform: none; }
.ad-card:hover {
  transform: translateY(-6px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  background: var(--surface-2);
}

.ad-poster {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid; place-items: center; text-align: center;
  padding: var(--sp-5);
  width: 100%; border: 0; cursor: pointer; font: inherit;
  color: #fff;
  background-color: var(--ad-accent);
  background-image:
    linear-gradient(to bottom, rgba(0,0,0,0.52) 0%, rgba(0,0,0,0.08) 38%, rgba(0,0,0,0.08) 62%, rgba(0,0,0,0.68) 100%),
    var(--ad-thumb, linear-gradient(150deg, var(--ad-accent), #0a0a0a 95%));
  background-size: cover;
  background-position: center;
  overflow: hidden;
}
.ad-poster::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse 110% 110% at 50% 50%, transparent 40%, rgba(0,0,0,0.38) 100%);
}
/* faint film-grain texture on posters */
.ad-poster::before {
  content: ""; position: absolute; inset: 0; opacity: 0.07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.ad-poster .ad-title {
  position: relative; z-index: 2;
  font-family: var(--font-display); font-size: var(--fs-28); line-height: 1.05; font-weight: 600;
  text-shadow: 0 2px 22px rgba(0, 0, 0, 0.55);
}
.ad-poster .ad-year {
  position: absolute; top: 12px; left: 14px; z-index: 2;
  font-size: var(--fs-12); letter-spacing: 0.18em; font-weight: 700; opacity: 0.9;
}
.ad-play {
  position: absolute; z-index: 3; bottom: 12px; right: 12px;
  width: 44px; height: 44px; border-radius: 99px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(6px);
  transition: transform 0.2s var(--ease), background 0.2s;
}
.ad-card:hover .ad-play { transform: scale(1.12); background: rgba(255, 255, 255, 0.32); }
.ad-play svg { width: 18px; height: 18px; fill: #fff; margin-left: 2px; }

/* embedded in-place YouTube player (replaces the poster on click) */
.ad-frame { position: relative; aspect-ratio: 16 / 9; background: #000; }
.ad-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }

.ad-body { padding: var(--sp-5); display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ad-meta { font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 600; }
.ad-makers { font-size: var(--fs-12); color: var(--text-faint); }
.ad-blurb { font-size: var(--fs-14); color: var(--text-dim); flex: 1; line-height: 1.55; }
.ad-watch { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: var(--fs-14); font-weight: 500; color: var(--accent); }
.ad-card:hover .ad-watch { text-decoration: underline; }

/* ============================================================
   FOUNDERS & CEOs
   ============================================================ */
.people { padding: var(--sp-9) 0; }
.people-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
}
.person-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-5);
  position: relative; overflow: hidden;
  transition: transform 0.45s var(--ease), border-color 0.4s, box-shadow 0.45s, background 0.4s;
  opacity: 0; transform: translateY(28px);
}
.person-card.in { opacity: 1; transform: none; }
.person-card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--p-accent), transparent 80%);
}
.person-card:hover { transform: translateY(-6px); border-color: var(--line-strong); box-shadow: var(--shadow); background: var(--surface-2); }
.person-head { display: flex; align-items: center; gap: var(--sp-4); margin-bottom: var(--sp-4); }
.person-avatar {
  flex: none; width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 600; font-size: var(--fs-20); color: #fff;
  background: radial-gradient(120% 120% at 30% 20%, color-mix(in srgb, var(--p-accent) 85%, #fff), var(--p-accent) 55%, #0a0a0a 130%);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 8px 18px -8px color-mix(in srgb, var(--p-accent) 70%, transparent);
  letter-spacing: 0.02em;
}
.person-photo {
  flex: none; width: 58px; height: 58px; border-radius: 50%; object-fit: cover;
  background: var(--surface-2);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-accent) 60%, transparent), 0 8px 18px -8px color-mix(in srgb, var(--p-accent) 70%, transparent);
}
.person-role { font-size: var(--fs-12); text-transform: uppercase; letter-spacing: 0.08em; color: var(--p-accent); font-weight: 600; }
.person-name { font-size: var(--fs-20); letter-spacing: -0.01em; line-height: 1.15; margin-top: 2px; }
.person-years { font-size: var(--fs-12); color: var(--text-faint); margin-top: 2px; font-variant-numeric: tabular-nums; }
.person-blurb { font-size: var(--fs-14); color: var(--text-dim); line-height: 1.6; }
.person-known { margin-top: var(--sp-3); padding-top: var(--sp-3); border-top: 1px solid var(--line); font-size: var(--fs-13, 0.82rem); color: var(--text-dim); }
.person-known b { color: var(--p-accent); }

/* ============================================================
   THE FLOPS
   ============================================================ */
.flops { padding: var(--sp-9) 0; }
.flops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
}
.flop-card {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.45s var(--ease), border-color 0.4s, box-shadow 0.45s, background 0.4s;
  opacity: 0; transform: translateY(28px);
}
.flop-card.in { opacity: 1; transform: none; }
.flop-card:hover { transform: translateY(-6px); border-color: var(--line-strong); box-shadow: var(--shadow); background: var(--surface-2); }
.flop-poster {
  position: relative;
  aspect-ratio: 16 / 8;
  display: grid; place-items: center; text-align: center;
  padding: var(--sp-5);
  color: #fff;
  background-color: #0c0c0c;
  background-image:
    linear-gradient(to bottom, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.1) 38%, rgba(0,0,0,0.1) 62%, rgba(0,0,0,0.65) 100%),
    var(--f-thumb, linear-gradient(160deg, color-mix(in srgb, var(--f-accent) 38%, #141414), #0c0c0c));
  background-size: cover;
  background-position: center;
  border-bottom: 1px solid var(--line);
  overflow: hidden;
}
.flop-poster .flop-meta {
  position: absolute; top: 12px; left: 14px;
  font-size: var(--fs-12); letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; opacity: 0.78;
}
.flop-poster .flop-name {
  font-family: var(--font-display); font-size: var(--fs-28); font-weight: 600; line-height: 1.05;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.5);
}
.flop-poster .flop-fate {
  position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
  white-space: nowrap;
  font-size: var(--fs-12); font-weight: 600; letter-spacing: 0.02em;
  padding: 5px 12px; border-radius: 99px;
  background: rgba(0, 0, 0, 0.42); border: 1px solid rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(6px);
}
.flop-blurb { padding: var(--sp-5); font-size: var(--fs-14); color: var(--text-dim); line-height: 1.6; flex: 1; }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { padding: var(--sp-9) 0 var(--sp-7); }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: var(--sp-6); }
.footer h4 { font-size: var(--fs-14); text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-faint); margin-bottom: var(--sp-3); }
.footer p { color: var(--text-dim); font-size: var(--fs-14); max-width: 46ch; }
.footer a.fl { display: block; color: var(--text-dim); font-size: var(--fs-14); padding: 4px 0; transition: color 0.2s; }
.footer a.fl:hover { color: var(--accent); }
.footer .colophon { margin-top: var(--sp-7); padding-top: var(--sp-5); border-top: 1px solid var(--line); font-size: var(--fs-12); color: var(--text-faint); display: flex; justify-content: space-between; gap: var(--sp-4); flex-wrap: wrap; }

/* ============================================================
   UTIL / REVEAL
   ============================================================ */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 400;
  background: var(--accent); color: #0A0A0A; padding: 10px 16px; border-radius: 10px;
  transition: top 0.2s;
}
.skip-link:focus { top: 12px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
/* Mobile era rail is hidden by default; the phone breakpoint below
   (which comes later in source order, so it wins when it matches)
   switches it to flex. Declaring the default here — before the media
   queries — keeps the cascade correct. */
.rail-mobile { display: none; }

@media (max-width: 920px) {
  .footer-grid { grid-template-columns: 1fr; }
  .rail { display: none; }
}

@media (max-width: 760px) {
  .filters { display: none; }
  .menu-toggle { display: grid; }
  .search-btn kbd { display: none; }
  .hero h1 { font-size: clamp(2.6rem, 12vw, 3.4rem); }

  /* Mobile filter drawer */
  .filters.mobile-open {
    display: flex; position: fixed; inset: 60px 0 auto 0;
    flex-direction: column; gap: 0;
    background: var(--glass); backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--line); padding: var(--sp-3);
    z-index: 99;
  }
  .filters.mobile-open .filter { width: 100%; text-align: left; }

  /* Bottom horizontal rail */
  .rail-mobile {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
    overflow-x: auto; gap: 0; padding: 8px;
    background: var(--glass); backdrop-filter: blur(16px);
    border-top: 1px solid var(--line); scrollbar-width: none;
  }
  .rail-mobile::-webkit-scrollbar { display: none; }
  .rail-mobile button { flex: none; padding: 6px 12px; font-size: 11px; color: var(--text-dim); border-radius: 99px; white-space: nowrap; }
  .rail-mobile button[aria-current="true"] { background: var(--accent); color: #0A0A0A; font-weight: 600; }

  .tm-controls { gap: var(--sp-2); }
  .tray-bar { flex-wrap: wrap; }
}

/* Hide custom cursor logic on touch; pointer-fine only enhancements */
@media (hover: hover) and (pointer: fine) {
  .cursor-dot {
    position: fixed; top: 0; left: 0; z-index: 500; pointer-events: none;
    width: 8px; height: 8px; border-radius: 99px; background: var(--accent);
    mix-blend-mode: difference; transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s, background 0.2s;
  }
  .cursor-dot.big { width: 38px; height: 38px; background: color-mix(in srgb, var(--accent) 40%, transparent); }
}

/* ============================================================
   DEVICE DETAIL PAGES  /device/<id>/  &  /devices/  HUB
   Pre-rendered by tools/build-pages.js — these classes are
   NOT used by the interactive SPA on index.html.
   ============================================================ */

/* Secondary nav on device/hub pages */
.dev-nav { display: flex; gap: var(--sp-4); align-items: center; margin-left: auto; }
.dev-nav a { font-size: var(--fs-14); color: var(--text-dim); text-decoration: none; transition: color 0.2s; }
.dev-nav a:hover { color: var(--text); }

/* Breadcrumb */
.crumbs {
  font-size: var(--fs-14); color: var(--text-faint);
  margin-bottom: var(--sp-6); padding-top: calc(var(--sp-7) + 64px);
}
.crumbs a { color: var(--text-dim); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

/* Article layout wrapper */
.dev-article { max-width: 860px; padding-bottom: var(--sp-9); }

/* Article header */
.dev-head { margin-bottom: var(--sp-7); }
.dev-head h1 {
  font-family: var(--font-display); font-size: var(--fs-64);
  letter-spacing: -0.02em; line-height: 1.05;
  margin: var(--sp-2) 0 var(--sp-3);
}

/* Lead paragraph on device pages */
.dev-lede { font-size: var(--fs-20); color: var(--text-dim); line-height: 1.6; max-width: 660px; }

/* Hero product photo */
.dev-hero {
  width: 100%; max-width: 640px; height: auto; display: block;
  border-radius: var(--radius); margin: var(--sp-7) auto;
  object-fit: contain; background: var(--surface);
}

/* Section headings inside articles */
.dev-article h2 {
  font-family: var(--font-display); font-size: var(--fs-28);
  margin: var(--sp-7) 0 var(--sp-4); letter-spacing: -0.01em;
}
.dev-article h3 { font-size: var(--fs-20); font-weight: 600; margin: var(--sp-5) 0 var(--sp-2); }
.dev-article p { color: var(--text-dim); font-size: var(--fs-16); line-height: 1.7; margin-bottom: var(--sp-3); }

/* Key facts section (Q&A for AEO / AI search) */
.dev-keyfacts {
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: var(--sp-5) 0; margin: var(--sp-6) 0;
}

/* Specs table */
.dev-specs { width: 100%; border-collapse: collapse; font-size: var(--fs-14); }
.dev-specs tr { border-bottom: 1px solid var(--line); }
.dev-specs th {
  text-align: left; font-weight: 500; color: var(--text-faint);
  padding: var(--sp-3) var(--sp-4) var(--sp-3) 0; width: 40%; vertical-align: top;
}
.dev-specs td { color: var(--text); padding: var(--sp-3) 0; vertical-align: top; }

/* Related & hub device link pills */
.dev-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.dev-links a {
  display: inline-block; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 99px;
  font-size: var(--fs-14); color: var(--text-dim);
  text-decoration: none; transition: border-color 0.2s, color 0.2s;
}
.dev-links a:hover { border-color: var(--accent); color: var(--accent); }
.dev-links a em { font-style: normal; color: var(--text-faint); margin-left: 4px; font-size: var(--fs-12); }

/* Caveat / approximation note */
.dev-note { font-size: var(--fs-12) !important; color: var(--text-faint) !important; font-style: italic; }

/* Prev / next navigation */
.dev-prevnext {
  display: flex; justify-content: space-between; gap: var(--sp-4);
  margin: var(--sp-7) 0; padding-top: var(--sp-5); border-top: 1px solid var(--line);
}
.dev-prevnext .pn { font-size: var(--fs-14); color: var(--text-dim); text-decoration: none; transition: color 0.2s; }
.dev-prevnext .pn:hover { color: var(--accent); }

/* CTA link back to interactive archive */
.dev-cta { margin-top: var(--sp-6) !important; }
.dev-cta a { color: var(--accent); text-decoration: none; font-weight: 500; }
.dev-cta a:hover { text-decoration: underline; }

/* Last-updated datestamp */
.updated { font-size: var(--fs-12) !important; color: var(--text-faint) !important; margin-top: var(--sp-7) !important; }

/* Device page footer */
.dev-footer { border-top: 1px solid var(--line); padding: var(--sp-7) 0; }
.dev-footer p { font-size: var(--fs-14); color: var(--text-dim); margin-bottom: var(--sp-2); }
.dev-footer a { color: var(--accent); text-decoration: none; }
.dev-footer a:hover { text-decoration: underline; }
.byline { margin-top: var(--sp-5) !important; }

/* /devices/ hub — era group headings */
.hub-era { margin-bottom: var(--sp-7); }
.hub-era h2 { font-family: var(--font-display); font-size: var(--fs-28); margin-bottom: var(--sp-4); }
.hub-era h2 span { font-size: var(--fs-20); color: var(--text-faint); font-weight: 400; margin-left: var(--sp-2); }

/* Responsive adjustments for device pages */
@media (max-width: 760px) {
  .dev-head h1 { font-size: clamp(2.2rem, 9vw, 3rem); }
  .dev-specs th { width: 45%; }
  .dev-prevnext { flex-direction: column; gap: var(--sp-3); }
}
