/* FunCAD project page. Local files only; no external fonts or libraries. */

:root {
  --bg: #f5f4f0;
  --bg-tint: #ecebe5;
  --surface: #ffffff;
  --surface-2: #f1f0eb;
  --stage: #f4f3ef;
  --ink: #12181e;
  --ink-2: #48525c;
  --ink-3: #7b848d;
  --line: rgba(18, 24, 30, 0.1);
  --line-2: rgba(18, 24, 30, 0.18);
  --blue: #2c6894;
  --gold: #cf962c;
  --coral: #d2553d;
  --teal: #2f8f80;
  --astra: #2c6894;
  --kimi: #2f8f80;
  --fable: #cf962c;
  --grok: #d2553d;
  --shadow: 0 1px 2px rgba(16, 24, 32, 0.04), 0 18px 40px -22px rgba(16, 24, 32, 0.28);
  --radius: 20px;
  --radius-sm: 14px;
  --wrap: 1180px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Inter, "Helvetica Neue", Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0d1115;
  --bg-tint: #12181d;
  --surface: #161d23;
  --surface-2: #1b232a;
  --stage: #f4f3ef;
  --ink: #eef2f5;
  --ink-2: #aeb8c1;
  --ink-3: #7f8a94;
  --line: rgba(255, 255, 255, 0.09);
  --line-2: rgba(255, 255, 255, 0.16);
  --blue: #6ea8d8;
  --gold: #e6b65a;
  --coral: #ec7a62;
  --teal: #4fb7a6;
  --astra: #6ea8d8;
  --kimi: #4fb7a6;
  --fable: #e6b65a;
  --grok: #ec7a62;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -22px rgba(0, 0, 0, 0.7);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1115;
    --bg-tint: #12181d;
    --surface: #161d23;
    --surface-2: #1b232a;
    --ink: #eef2f5;
    --ink-2: #aeb8c1;
    --ink-3: #7f8a94;
    --line: rgba(255, 255, 255, 0.09);
    --line-2: rgba(255, 255, 255, 0.16);
    --blue: #6ea8d8;
    --gold: #e6b65a;
    --coral: #ec7a62;
    --teal: #4fb7a6;
    --astra: #6ea8d8;
    --kimi: #4fb7a6;
    --fable: #e6b65a;
    --grok: #ec7a62;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 18px 40px -22px rgba(0, 0, 0, 0.7);
    color-scheme: dark;
  }
}

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

html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.25s ease, color 0.25s ease;
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--font); margin: 0; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 6px; }

.wrap { width: min(var(--wrap), calc(100% - 40px)); margin: 0 auto; }

/* ---------- Navigation ---------- */

.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 max(20px, calc((100% - var(--wrap)) / 2));
  color: #fff;
  transition: background-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease;
}
.nav.is-solid {
  color: var(--ink);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(16px);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  box-shadow: 0 1px 0 var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; }
.brand-mark { display: inline-flex; align-items: flex-end; gap: 3px; height: 18px; }
.brand-mark i { width: 4px; border-radius: 2px; background: currentColor; transform: skewX(-14deg); }
.brand-mark i:nth-child(1) { height: 9px; opacity: 0.5; }
.brand-mark i:nth-child(2) { height: 14px; opacity: 0.75; }
.brand-mark i:nth-child(3) { height: 18px; background: var(--gold); }
.nav-links { display: flex; gap: 22px; margin-left: auto; font-size: 14px; font-weight: 600; }
.nav-links a { opacity: 0.78; transition: opacity 0.2s ease; position: relative; }
.nav-links a:hover, .nav-links a.is-active { opacity: 1; }
.nav-links a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px; border-radius: 2px; background: var(--gold);
}
.theme-toggle {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%;
  border: 1px solid currentColor; border-color: color-mix(in srgb, currentColor 30%, transparent);
  background: transparent; cursor: pointer; transition: transform 0.2s ease;
}
.theme-toggle:hover { transform: rotate(18deg); }
.theme-toggle svg { width: 17px; height: 17px; }

/* ---------- Hero ---------- */

.hero {
  position: relative;
  min-height: max(100svh, 640px);
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #fff;
  background: #0b0f13;
  isolation: isolate;
}
.hero-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.hero-shade {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(ellipse 70% 60% at 50% 48%, rgba(9, 12, 16, 0.42), rgba(9, 12, 16, 0.78)),
    linear-gradient(180deg, rgba(9, 12, 16, 0.6) 0%, rgba(9, 12, 16, 0.1) 30%, rgba(9, 12, 16, 0.2) 65%, rgba(9, 12, 16, 0.92) 100%);
}
.hero-inner { text-align: center; padding: 110px 20px 120px; max-width: 1040px; }
.hero-kicker {
  display: inline-flex; align-items: center; gap: 10px; margin: 0 0 22px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.85;
}
.hero-kicker::before, .hero-kicker::after { content: ""; width: 26px; height: 1px; background: currentColor; opacity: 0.6; }
.hero h1 {
  font-size: clamp(48px, 8.6vw, 118px);
  line-height: 0.94;
  letter-spacing: -0.048em;
  font-weight: 820;
  text-wrap: balance;
}
.hero h1 em { font-style: normal; color: #f2b84b; }
.hero-sub { margin: 22px 0 0; font-size: clamp(18px, 2.3vw, 27px); font-weight: 500; letter-spacing: -0.012em; opacity: 0.94; }
.hero-authors { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px; margin: 18px 0 0; font-size: 15px; opacity: 0.9; }
.hero-authors span { white-space: nowrap; }
.hero-authors sup, .hero-affiliations sup, .hero-contribution sup { margin-left: 2px; font-size: 0.7em; color: #f2b84b; }
.hero-affiliations, .hero-contribution { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin: 10px 0 0; font-size: 12px; line-height: 1.5; opacity: 0.78; }
.hero-affiliations sup, .hero-contribution sup { margin: 0 3px 0 0; }
.hero-contribution { margin-top: 2px; opacity: 0.7; }
.hero-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 34px; }
.hero-note {
  position: absolute; right: max(20px, calc((100% - var(--wrap)) / 2)); bottom: 26px; margin: 0;
  font-size: 12px; letter-spacing: 0.04em; opacity: 0.62;
}
.scroll-cue {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%);
  width: 34px; height: 52px; border-radius: 20px; border: 1.5px solid rgba(255, 255, 255, 0.45);
}
.scroll-cue::after {
  content: ""; position: absolute; left: 50%; top: 10px; width: 4px; height: 9px; margin-left: -2px; border-radius: 2px;
  background: #fff; animation: cue 1.8s ease-in-out infinite;
}
@keyframes cue { 0% { transform: translateY(0); opacity: 0; } 30% { opacity: 1; } 80% { transform: translateY(16px); opacity: 0; } 100% { opacity: 0; } }

/* ---------- Pills / buttons ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 20px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1); color: #fff;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  font-size: 15px; font-weight: 650; letter-spacing: -0.005em; cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}
.pill:hover { transform: translateY(-2px); background: rgba(255, 255, 255, 0.18); }
.pill svg { width: 17px; height: 17px; flex: none; }
.pill[hidden] { display: none; }
.pill-solid { background: #fff; color: #10161c; border-color: #fff; }
.pill-solid:hover { background: #fff; }
.pill-muted { opacity: 0.6; cursor: default; }
.pill-muted:hover { transform: none; background: rgba(255, 255, 255, 0.1); }
.pill small { font-size: 10px; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.85; }
.pill.on-page { color: var(--ink); border-color: var(--line-2); background: var(--surface); backdrop-filter: none; }
.pill.on-page:hover { border-color: var(--ink-3); }
.pill.on-page.pill-solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }

/* ---------- Sections ---------- */

.section { padding: clamp(76px, 9.5vw, 136px) 0; position: relative; }
.section.tint { background: var(--bg-tint); }
.section-head { text-align: center; max-width: 860px; margin: 0 auto clamp(34px, 4.4vw, 60px); }
.kicker {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 12px; font-weight: 750; letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue);
}
.kicker::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--gold); }
.section h2 {
  margin-top: 14px;
  font-size: clamp(34px, 5vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.04em;
  font-weight: 800;
  text-wrap: balance;
}
.sub { margin: 16px auto 0; max-width: 640px; color: var(--ink-2); font-size: clamp(16px, 1.55vw, 19px); line-height: 1.5; text-wrap: balance; }
.fine { margin: 18px auto 0; text-align: center; color: var(--ink-3); font-size: 13px; max-width: 760px; }

/* ---------- Overview ---------- */

.lead {
  max-width: 900px; margin: 0 auto clamp(34px, 4vw, 54px); text-align: center;
  font-size: clamp(24px, 3.1vw, 38px); line-height: 1.18; letter-spacing: -0.03em; font-weight: 700; text-wrap: balance;
}
.lead span { color: var(--ink-3); }
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: clamp(34px, 4vw, 56px);
  border-radius: var(--radius); overflow: hidden; background: var(--line); border: 1px solid var(--line);
}
.stat { background: var(--surface); padding: 26px 22px 24px; text-align: center; }
.stat strong { display: block; font-size: clamp(34px, 4.4vw, 54px); line-height: 1; letter-spacing: -0.045em; font-weight: 800; }
.stat strong small { font-size: 0.45em; letter-spacing: -0.02em; color: var(--ink-3); font-weight: 700; }
.stat > span { display: block; margin-top: 10px; color: var(--ink-2); font-size: 14px; font-weight: 550; }
.stat .arrow { color: var(--gold); font-weight: 700; padding: 0 0.08em; }
.intro-player {
  position: relative; margin: 0 0 clamp(34px, 4vw, 56px); aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: var(--radius); background: #0b0f13; box-shadow: var(--shadow);
}
.intro-player video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.intro-play {
  position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: clamp(18px, 4vw, 44px);
  border: 0; background: linear-gradient(180deg, rgba(9, 12, 16, 0) 55%, rgba(9, 12, 16, 0.55)); color: #fff; cursor: pointer;
}
.intro-play span {
  display: inline-flex; align-items: center; gap: 12px; padding: 7px 22px 7px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.14); border: 1px solid rgba(255, 255, 255, 0.32); backdrop-filter: blur(10px);
  font-size: 15px; font-weight: 650; letter-spacing: -0.01em; transition: transform 0.2s ease, background 0.2s ease;
}
.intro-play i { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; background: #fff; color: #10161c; }
.intro-play svg { width: 16px; height: 16px; margin-left: 2px; }
.intro-play:hover span { transform: translateY(-2px); background: rgba(255, 255, 255, 0.22); }
.intro-player.is-playing .intro-play { display: none; }

/* ---------- Figures ---------- */

.figure-card {
  margin: 0; position: relative;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: clamp(12px, 2.2vw, 28px); box-shadow: var(--shadow);
}
.figure-card img { width: 100%; height: auto; }
.figure-card + .figure-card { margin-top: 22px; }
.figure-card figcaption {
  margin-top: 14px; text-align: center; font-size: 13px; color: #6f7881; letter-spacing: 0.01em;
}
.figure-card figcaption b { color: #2b333b; font-weight: 700; }
.zoomable { cursor: zoom-in; }
.zoom-hint {
  position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(18, 24, 30, 0.72); color: #fff;
  opacity: 0; transition: opacity 0.2s ease; pointer-events: none;
}
.zoom-hint svg { width: 16px; height: 16px; }
.zoomable:hover .zoom-hint { opacity: 1; }

/* ---------- Failure viewers ---------- */

.viewer-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; }
.viewer-card {
  position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  background: var(--surface-2); box-shadow: var(--shadow);
}
.failure-viewer { position: relative; aspect-ratio: 4 / 3; cursor: grab; touch-action: pan-y; }
.failure-viewer:active { cursor: grabbing; }
.failure-viewer canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.viewer-label {
  position: absolute; left: 18px; top: 16px; z-index: 2; pointer-events: none;
  display: flex; flex-direction: column; gap: 2px;
}
.viewer-label span { font-size: 11px; font-weight: 750; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.viewer-label strong { font-size: 19px; letter-spacing: -0.02em; }
.viewer-label strong i { font-style: normal; color: var(--coral); }
.viewer-hint {
  position: absolute; right: 14px; bottom: 12px; z-index: 2; pointer-events: none;
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 84%, transparent); color: var(--ink-2); font-size: 12px; font-weight: 600;
  transition: opacity 0.4s ease;
}
.viewer-hint svg { width: 14px; height: 14px; }
.failure-viewer.interacted ~ .viewer-hint { opacity: 0; }
.viewer-status { position: absolute; inset: 0; display: grid; place-items: center; color: var(--ink-3); font-size: 13px; }
.failure-viewer.ready .viewer-status { display: none; }
.center-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* ---------- Harness band ---------- */

.band-dark { background: #0f1519; color: #eef2f5; }
.band-dark .kicker { color: #8fc0e6; }
.band-dark .sub { color: #a7b2bb; }
.loop {
  list-style: none; margin: 26px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; counter-reset: step;
}
.loop li {
  position: relative; padding: 18px 16px 16px; border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.09);
  counter-increment: step;
}
.loop li::before { content: "0" counter(step); display: block; font-family: var(--mono); font-size: 12px; color: #f2b84b; margin-bottom: 8px; }
.loop li b { display: block; font-size: 16px; letter-spacing: -0.01em; }
.loop li span { display: block; margin-top: 4px; font-size: 13px; color: #95a1ab; line-height: 1.4; }
.loop li:not(:last-child)::after {
  content: ""; position: absolute; right: -9px; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  border-top: 1.5px solid #5b6772; border-right: 1.5px solid #5b6772; transform: rotate(45deg);
}
.loop li:last-child { background: rgba(242, 184, 75, 0.08); border-color: rgba(242, 184, 75, 0.3); }

/* ---------- Media cards (simulation + prototypes) ---------- */

.sim-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.media-card {
  position: relative; margin: 0; border-radius: var(--radius-sm); overflow: hidden;
  border: 1px solid var(--line); background: var(--stage); aspect-ratio: 16 / 9;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.media-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.media-card video, .media-card > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sim-grid .media-card.featured { grid-column: span 2; grid-row: span 2; }
.media-cap {
  position: absolute; left: 12px; right: 12px; bottom: 10px; z-index: 1;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; pointer-events: none;
}
.media-cap b { font-size: 13.5px; font-weight: 700; letter-spacing: -0.01em; color: #1f2830; line-height: 1.25; }
.sim-grid .media-cap b, .pair-videos .media-cap b {
  padding: 3px 8px; border-radius: 7px; background: rgba(244, 243, 239, 0.86);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.featured .media-cap b { font-size: 17px; }
.agent {
  flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 7px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.86); color: #26303a; font-size: 11.5px; font-weight: 700;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.agent::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--dot, #888); }
.agent[data-agent="Astra"] { --dot: #2c6894; }
.agent[data-agent="Kimi"] { --dot: #2f8f80; }
.agent[data-agent="Fable"] { --dot: #cf962c; }
.agent[data-agent="Grok"] { --dot: #d2553d; }
.agent[data-agent="Grok + history"] { --dot: #d2553d; }
.agent[data-agent="Grok + history"]::before { background: transparent; box-shadow: inset 0 0 0 2px var(--dot); }

.proto-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.proto-grid .media-card { background: #111; border-color: transparent; }
.proto-grid .media-card::after {
  content: ""; position: absolute; inset: auto 0 0 0; height: 46%; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.62));
}
.proto-grid .media-cap { z-index: 2; }
.proto-grid .media-cap b { color: #fff; font-size: 15px; }
.proto-grid .media-cap span { color: rgba(255, 255, 255, 0.72); font-size: 12px; font-weight: 600; }

.photo-row { display: flex; gap: 12px; margin-top: 16px; }
.photo-row figure {
  flex: var(--r) 1 0; aspect-ratio: var(--r); margin: 0; border-radius: var(--radius-sm); overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--line);
}
.photo-row img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.photo-row figure:hover img { transform: scale(1.04); }

/* ---------- Revision tabs ---------- */

.tabs { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent; cursor: pointer; font-size: 14.5px; font-weight: 650; color: var(--ink-2);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.tab:hover { color: var(--ink); border-color: var(--ink-3); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tab .agent { box-shadow: none; padding: 2px 8px 2px 6px; font-size: 11px; }
.tab-panel[hidden] { display: none; }
.revision-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.revision-side { display: contents; }
.pair-videos { order: -1; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pair-videos .media-card { aspect-ratio: 16 / 9; }
.pair-videos .media-cap b { font-size: 15px; }
.revision-layout .figure-card.tall img { max-width: 860px; margin: 0 auto; }
.agent.state-fail { --dot: #d2553d; }
.agent.state-pass { --dot: #2f8f80; }
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.steps li {
  display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; padding: 14px 16px;
  border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); font-size: 14.5px; line-height: 1.4;
}
.steps li::before {
  content: attr(data-mark); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 800; color: #fff; background: var(--coral);
}
.steps li.fix::before { background: var(--gold); }
.steps li.pass::before { background: var(--teal); }
.steps li b { font-weight: 700; }

/* ---------- Benchmark ---------- */

.figure-pair { display: grid; grid-template-columns: 1fr; gap: 22px; }
.chip-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.chip {
  height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent;
  font-size: 13.5px; font-weight: 650; color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.chip:hover { color: var(--ink); border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, transparent); }
.chip[data-key="Grok + history"] i { background: transparent; box-shadow: inset 0 0 0 2px var(--dot); }
.chip .count { font-size: 11px; opacity: 0.6; font-weight: 700; }
.subhead { margin: clamp(48px, 6vw, 80px) 0 22px; text-align: center; }
.subhead h3 { font-size: clamp(22px, 2.4vw, 30px); letter-spacing: -0.025em; font-weight: 760; }
.subhead p { margin: 8px 0 0; color: var(--ink-3); font-size: 14px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 12px; margin-top: 22px; }
.g-item {
  position: relative; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); overflow: hidden; cursor: zoom-in; aspect-ratio: 1 / 1; text-align: left;
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}
.g-item:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.g-item img { position: absolute; inset: 26px 10px 46px 10px; width: calc(100% - 20px); height: calc(100% - 72px); object-fit: contain; transition: transform 0.35s ease; }
.g-item:hover img { transform: scale(1.06); }
.g-item .g-cap { position: absolute; left: 10px; right: 10px; bottom: 8px; }
.g-item .g-cap b {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  font-size: 12px; line-height: 1.3; font-weight: 650; color: var(--ink-2);
}
.g-item .agent { position: absolute; top: 8px; right: 8px; background: var(--surface-2); color: var(--ink-2); box-shadow: none; font-size: 10.5px; padding: 2px 7px 2px 6px; }
.g-item[hidden] { display: none; }
.families { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.family {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px 7px 8px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); font-size: 13px; font-weight: 600; color: var(--ink-2);
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.family code { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); background: var(--surface-2); padding: 2px 5px; border-radius: 5px; }
.family.dim { opacity: 0.22; }

/* ---------- Results ---------- */

.results-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 22px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(20px, 2.6vw, 32px);
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 22px; }
.card-head h3 { font-size: 18px; letter-spacing: -0.015em; font-weight: 750; }
.card-head span { color: var(--ink-3); font-size: 13px; font-weight: 600; }
.bars { display: grid; gap: 16px; }
.bar { display: grid; grid-template-columns: 128px 1fr 64px; align-items: center; gap: 14px; }
.bar-name { font-weight: 700; font-size: 14.5px; letter-spacing: -0.01em; }
.bar-name small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; margin-top: 1px; }
.bar-track { height: 14px; border-radius: 999px; background: var(--surface-2); overflow: hidden; position: relative; }
.bar-fill {
  position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 999px; background: var(--c, var(--blue));
  transition: width 1.1s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bar-fill.striped { background-image: repeating-linear-gradient(-45deg, transparent 0 6px, rgba(255, 255, 255, 0.28) 6px 12px); background-color: var(--c); }
.bar-num { text-align: right; font-weight: 800; font-size: 20px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.bar-num small { font-size: 12px; color: var(--ink-3); font-weight: 650; }
.pair { display: grid; gap: 18px; }
.pair-row { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; }
.pair-row > span { font-weight: 700; font-size: 14px; line-height: 1.25; }
.pair-row > span small { display: block; font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.pair-bars { display: grid; gap: 6px; }
.pair-bar { display: grid; grid-template-columns: 1fr 44px; gap: 10px; align-items: center; }
.pair-bar .bar-track { height: 10px; }
.pair-bar em { font-style: normal; text-align: right; font-weight: 750; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.pair-row.highlight > span { color: var(--gold); }
.legend { display: flex; gap: 16px; margin-top: 22px; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.card-note { margin: 20px 0 0; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.takeaways { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 22px; }
.takeaway { padding: 20px 20px 18px; border-radius: var(--radius-sm); background: var(--surface); border: 1px solid var(--line); }
.takeaway strong { display: block; font-size: 28px; letter-spacing: -0.04em; font-weight: 800; line-height: 1.05; }
.takeaway strong .arrow { color: var(--gold); }
.takeaway > span { display: block; margin-top: 8px; font-size: 14px; color: var(--ink-2); line-height: 1.4; }
.takeaway strong small { font-size: 0.5em; color: var(--ink-3); letter-spacing: -0.02em; }

/* ---------- Resources ---------- */

.resources { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.resource {
  display: flex; flex-direction: column; gap: 10px; padding: 22px; min-height: 150px;
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease; cursor: pointer; text-align: left;
}
.resource:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--line-2); }
.resource svg { width: 26px; height: 26px; color: var(--blue); }
.resource b { font-size: 18px; letter-spacing: -0.02em; margin-top: auto; }
.resource span { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.resource.muted { cursor: default; opacity: 0.6; }
.resource.muted:hover { transform: none; box-shadow: none; border-color: var(--line); }

.site-footer {
  padding: 34px 0 44px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: 13px;
}
.site-footer .wrap { display: flex; align-items: center; justify-content: space-between; gap: 18px; flex-wrap: wrap; }
.site-footer .brand { color: var(--ink); font-size: 16px; }

/* ---------- Overlays ---------- */

.overlay {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 28px;
  background: rgba(6, 9, 12, 0.88); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  opacity: 0; visibility: hidden; transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.overlay.is-open { opacity: 1; visibility: visible; transition: opacity 0.25s ease, visibility 0s; }
.overlay figure { margin: 0; max-width: min(1500px, 100%); max-height: 100%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.overlay img { max-width: 100%; max-height: calc(100vh - 120px); object-fit: contain; border-radius: 10px; background: #fff; }
.overlay img.on-dark { background: transparent; }
.overlay figcaption { color: #cfd6dc; font-size: 14px; text-align: center; }
.overlay video { width: min(1280px, 100%); max-height: calc(100vh - 120px); border-radius: 12px; background: #000; }
.overlay-close {
  position: absolute; top: 18px; right: 18px; width: 44px; height: 44px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, 0.12); color: #fff; cursor: pointer; display: grid; place-items: center;
}
.overlay-close:hover { background: rgba(255, 255, 255, 0.22); }
.overlay-close svg { width: 20px; height: 20px; }

/* ---------- Reveal ---------- */

.js [data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.75, 0.25, 1); }
.js [data-reveal].is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .scroll-cue::after { animation: none; }
  .media-card, .g-item, .resource, .pill { transition: none; }
}

/* ---------- Responsive ---------- */

@media (max-width: 1040px) {
  .nav-links { gap: 16px; font-size: 13.5px; }
  .resources { grid-template-columns: repeat(2, 1fr); }
  .loop { grid-template-columns: repeat(3, 1fr); }
  .loop li:nth-child(3)::after { display: none; }
}

@media (max-width: 900px) {
  .nav-links { display: none; }
  .theme-toggle { margin-left: auto; }
  .sim-grid { grid-template-columns: repeat(2, 1fr); }
  .sim-grid .media-card.featured { grid-column: span 2; grid-row: span 1; }
  .sim-grid .media-card:nth-child(n + 12) { display: none; }
  .proto-grid { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .results-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; }
  .takeaways { grid-template-columns: 1fr; }
  .viewer-pair { grid-template-columns: 1fr; }
  .hero-note { display: none; }
}

@media (max-width: 600px) {
  .wrap { width: calc(100% - 32px); }
  .nav { padding: 0 16px; height: 58px; }
  .hero-inner { padding: 96px 16px 110px; }
  .pill { height: 42px; padding: 0 16px; font-size: 14px; }
  .sim-grid, .proto-grid { gap: 10px; }
  .media-cap { left: 8px; right: 8px; bottom: 7px; }
  .media-cap b { font-size: 12px; }
  .sim-grid .media-card .agent { display: none; }
  .sim-grid .media-card.featured .agent { display: inline-flex; }
  .proto-grid { grid-template-columns: 1fr; }
  .pair-videos { gap: 10px; }
  .photo-row { overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; padding-bottom: 4px; }
  .photo-row figure { flex: none; height: 190px; scroll-snap-align: start; }
  .pair-videos .media-cap b { font-size: 12px; }
  .variants .media-cap b { display: none; }
  .wide-only { display: none; }
  .gallery { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .family { font-size: 12px; padding: 5px 9px; gap: 0; }
  .family code { display: none; }
  .families { gap: 6px; }
  .bar-name small { font-size: 10.5px; }
  .bar { grid-template-columns: 92px 1fr 52px; gap: 10px; }
  .pair-row { grid-template-columns: 1fr; gap: 8px; }
  .loop { grid-template-columns: 1fr 1fr; }
  .loop li::after { display: none; }
  .resources { grid-template-columns: 1fr 1fr; }
  .resource { min-height: 124px; padding: 18px; }
  .stat { padding: 20px 12px; }
  .figure-card { border-radius: 14px; }
  .overlay { padding: 12px; }
}
