/*
 * Shared design for PanoRead pages: a mix of benchmarks.bio and logangraves.com/the-human-project.
 * From benchmarks.bio: one narrow column, mono labels and numbers, hairline rules, a bar chart
 * coloured by model provider. From The Human Project: a near-black page, soft light-gray text,
 * a large condensed serif title, and one striking central image (here, an annotated radiograph).
 * Colour is used only for data. Class names are the contract between pages.
 *
 * Fonts load from Google Fonts; every stack ends in a system font.
 */
:root {
  color-scheme: dark;
  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --serif: "Spectral", "Iowan Old Style", "Source Serif 4", Georgia, Cambria, serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Surfaces and text, dark to light. The page and text values follow The Human Project. */
  --bg: #000; --surface: #171717; --surface-2: #1d1d1e;
  --line-soft: #1f2021; --line: #2a2b2c; --line-strong: #3b3d3e;
  --faint: #5f5f63; --muted-2: #7c7c80; --muted: #949494;
  --ink-soft: #b4b4b4; --ink: #c8c8c8; --ink-strong: #ececec;

  /* One colour per provider, tuned for a dark page. */
  --openai: #ececec; --anthropic: #e08a6b; --google: #6cc08f; --spacexai: #d9b872;
  --deepseek: #7fa1ee; --zai: #9ba4b6; --thinking-machines: #b497dc; --other-provider: #7c7c80;

  /* Colours for a film's score in the hero label: 1, between 0 and 1, and 0. */
  --pass-ink: #6ee0a8; --pass-wash: rgba(52, 211, 153, 0.10); --pass-edge: rgba(52, 211, 153, 0.35);
  --mid-ink: #e7b45a; --mid-wash: rgba(245, 158, 11, 0.10); --mid-edge: rgba(245, 158, 11, 0.35);
  --fail-ink: #f08a8a; --fail-wash: rgba(239, 68, 68, 0.10); --fail-edge: rgba(239, 68, 68, 0.35);

  /* Frosted glass: panels that carry text sit on this dark, blurred layer, so text keeps its contrast over the tie-dye. */
  --glass: rgba(16, 16, 20, 0.7); --glass-line: rgba(255, 255, 255, 0.09);

  /* Boxes drawn on radiographs: dentists and model. */
  --box-dentist: #8fc7ff; --box-model: #ffae6b; --film: #000;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
::selection { background: var(--line-strong); color: var(--ink-strong); }
html { background: var(--bg); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; scroll-padding-top: 6rem; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; color: var(--ink); font: 300 16px/25px var(--serif); font-feature-settings: "kern" 1, "liga" 1; }

/* Tie-dye: one very faint picture (built by build_tiedye.py; a portrait one for tall screens) in a fixed layer
   behind the page, drifting slowly. html carries the black page colour so the layer shows. */
body::before { content: ""; position: fixed; inset: -6%; z-index: -1; pointer-events: none; background: url("assets/tiedye.webp") center / cover; animation: tiedye-drift 240s ease-in-out infinite alternate; }
@keyframes tiedye-drift { from { transform: translate3d(-1.5%, -1%, 0) scale(1.02); } to { transform: translate3d(1.5%, 1%, 0) scale(1.07); } }
@media (orientation: portrait) { body::before { background-image: url("assets/tiedye-portrait.webp"); } }
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }

a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line-strong); }
a:hover { border-bottom-color: var(--ink); }
a:focus-visible, summary:focus-visible, button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
code, kbd, pre { font-family: var(--mono); }
button, input, select { font: inherit; }

.container { width: min(1036px, calc(100% - 48px)); margin-inline: auto; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 30; padding: 0.5rem 0.9rem; background: var(--bg); border: 1px solid var(--line); font: 400 12px/18px var(--mono); }
.skip-link:focus { top: 0.75rem; }

/* Header: wordmark, mono links, hairline once the page scrolls. */
.site-header { position: sticky; top: 0; z-index: 20; background: rgba(0, 0, 0, 0.5); backdrop-filter: blur(14px); border-bottom: 1px solid transparent; }
.site-header[data-scrolled] { border-bottom-color: var(--line); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 54px; }
.brand { font: 400 23px/1 var(--display); letter-spacing: 0; white-space: nowrap; border: 0; color: var(--ink-strong); }
.brand b { font-weight: 400; }
.brand span { font: 400 11px/1 var(--mono); letter-spacing: 0.04em; color: var(--muted-2); margin-left: 6px; }
.site-nav { display: flex; align-items: center; gap: 1.4rem; font: 300 12px/18px var(--mono); color: var(--muted); }
.site-nav a { padding: 0.25rem 0; border: 0; }
.site-nav a:hover, .site-nav a[aria-current] { color: var(--ink-strong); }
.site-nav a[aria-current] { border-bottom: 1px solid var(--muted-2); }

/* Text */
main { padding-bottom: 3rem; }
.title { margin: 28px 0 0; font: 400 44px/1.02 var(--display); letter-spacing: -0.01em; color: var(--ink-strong); }
.lede { max-width: 38rem; margin: 12px 0 0; font-size: 15px; line-height: 24px; color: var(--muted); }
.section-title { margin: 0; font: 400 30px/1.1 var(--display); letter-spacing: -0.005em; color: var(--ink-strong); }
.section-sub { max-width: 38rem; margin: 6px 0 0; font: italic 300 15px/22px var(--serif); color: var(--muted); }
.eyebrow { margin: 0; font: 400 11px/16.5px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.note { margin: 10px 0 0; max-width: 40rem; font-size: 14px; line-height: 21px; color: var(--muted); }
.mono-note { font: 400 10px/16px var(--mono); color: var(--muted-2); letter-spacing: 0.02em; }
section.block { margin-top: 28px; padding: 36px clamp(20px, 4vw, 40px) 40px; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 16px; backdrop-filter: blur(18px) saturate(1.25); }

/* Tabs: small uppercase mono, active one underlined. */
.tabs { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1rem; width: fit-content; max-width: 100%; margin: 40px auto 0; padding: 10px 22px; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 999px; backdrop-filter: blur(14px) saturate(1.25); }
.tabs ul { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; margin: 0; padding: 0; list-style: none; }
.tabs li + li::before { content: "·"; margin: 0 14px; color: var(--faint); font: 300 11px/16px var(--mono); }
.tab { font: 400 11px/16px var(--mono); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted-2); padding-bottom: 3px; border: 0; border-bottom: 1px solid transparent; }
.tab:hover { color: var(--ink-soft); }
.tab[aria-current] { color: var(--ink-strong); border-bottom-color: var(--ink-strong); }

/* Controls */
.pill { display: inline-flex; align-items: center; gap: 0.4rem; padding: 2px 12px; border: 1px solid var(--line-strong); border-radius: 999px; font: 400 12px/18px var(--mono); color: var(--ink-soft); background: transparent; }
select.field { max-width: 100%; padding: 3px 28px 3px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); font: 400 12px/18px var(--mono); color: var(--ink); }
.chip { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 4px; font: 400 10px/16px var(--mono); color: var(--muted); white-space: nowrap; }
.status-pill { display: inline-block; padding: 1px 10px; border: 1px solid; border-radius: 999px; font: 400 10px/16px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }
.status-pill.pass { color: var(--pass-ink); background: var(--pass-wash); border-color: var(--pass-edge); }
.status-pill.mid { color: var(--mid-ink); background: var(--mid-wash); border-color: var(--mid-edge); }
.status-pill.fail { color: var(--fail-ink); background: var(--fail-wash); border-color: var(--fail-edge); }
.status-pill.idle { color: var(--muted); background: var(--surface); border-color: var(--line-strong); }

/* Cards, key-value lists, tables */
.card { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; background: var(--surface); }
.card + .card { margin-top: 10px; }
.kv { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 8px 20px; margin: 0; }
.kv dt { font: 400 11px/22px var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted-2); }
.kv dd { margin: 0; font-size: 15px; line-height: 22px; color: var(--ink); }
.scroll { max-width: 100%; overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font: 400 12px/18px var(--mono); }
table.data th { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line); text-align: left; font-weight: 400; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); }
table.data td { padding: 8px 10px 8px 0; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--ink); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Legend dots */
.legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font: 400 11px/16px var(--mono); color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--muted-2)); }
.legend i.box { width: 16px; height: 10px; border-radius: 1px; background: transparent; border: 2px solid var(--dot); }
.legend i.box.dashed { border-style: dashed; }

/* Hero: title, one line, then a large central radiograph with story-style progress. */
.hero { padding-top: 64px; text-align: center; }
.hero h1 { margin: 0 auto; font: 400 88px/0.96 var(--display); letter-spacing: -0.02em; color: var(--ink-strong); }
.stage { position: relative; margin: 44px auto 0; aspect-ratio: 2 / 1; overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--film); }
.stage::after { content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none; background: radial-gradient(ellipse at 50% 46%, transparent 55%, rgba(0, 0, 0, 0.55) 100%); }
.slide { position: absolute; inset: 0; z-index: 1; opacity: 0; transition: opacity 1.1s ease; }
.slide[data-active] { z-index: 2; opacity: 1; }
.slide svg { display: block; width: 100%; height: 100%; transform-origin: var(--fx, 50%) var(--fy, 50%); transition: transform 1.1s ease; }
.slide[data-active] svg { transform: scale(1.32); transition: transform 7s cubic-bezier(0.2, 0.6, 0.3, 1); }
.slide image { filter: brightness(0.92) contrast(1.18); }
.slide .box { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; opacity: 0; }
.slide .box.dentist { stroke: var(--box-dentist); }
.slide .box.model { stroke: var(--box-model); stroke-dasharray: 6 4; }
.slide .tag { font: 500 var(--tag-size, 14px) var(--mono); opacity: 0; paint-order: stroke; stroke: rgba(0, 0, 0, 0.7); stroke-width: 3px; }
.slide .tag.dentist { fill: var(--box-dentist); }
.slide .tag.model { fill: var(--box-model); }
.slide[data-active] .box.dentist, .slide[data-active] .tag.dentist { animation: appear 0.7s ease 0.5s forwards; }
.slide[data-active] .box.model, .slide[data-active] .tag.model { animation: appear 0.7s ease 1.4s forwards; }
@keyframes appear { to { opacity: 1; } }
.stage-caption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; margin-top: 14px; padding: 10px 14px; background: var(--glass); border: 1px solid var(--glass-line); border-radius: 10px; backdrop-filter: blur(14px) saturate(1.25); font: 400 11px/16px var(--mono); color: var(--muted); text-align: left; }
.stage-caption .facts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; }
.segments { display: flex; gap: 6px; margin-top: 8px; }
.segments button { position: relative; flex: 1; height: 16px; padding: 0; border: 0; background: none; cursor: pointer; }
.segments button::before, .segments button::after { content: ""; position: absolute; left: 0; top: 7px; height: 2px; border-radius: 2px; }
.segments button::before { right: 0; background: rgba(255, 255, 255, 0.24); }
.segments button::after { width: 0; background: var(--ink-soft); }
.segments button.done::after { width: 100%; }
.segments button[aria-current="true"]::after { animation: fill 6.5s linear forwards; }
.stage-wrap:hover .segments button[aria-current="true"]::after, .segments:focus-within button[aria-current="true"]::after { animation-play-state: paused; }
@keyframes fill { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) {
  .slide, .slide svg, .slide[data-active] svg { transition: none; transform: none; }
  .slide .box, .slide .tag { opacity: 1; animation: none !important; }
  .segments button[aria-current="true"]::after { animation: none; width: 100%; }
}

/* Footer: slightly lighter band with a wordmark and one quiet line. */
.site-footer { margin-top: 56px; padding: 36px 0 40px; background: var(--glass); border-top: 1px solid var(--glass-line); backdrop-filter: blur(18px) saturate(1.25); }
.site-footer .container { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2rem 4rem; }
.site-footer .brand { display: inline-block; }
.footer-aside p { margin: 0; font-size: 13px; line-height: 20px; color: var(--muted-2); }
.footer-aside a { color: var(--ink-soft); }

@media (max-width: 860px) {
  .hero h1 { font-size: 64px; }
}
@media (max-width: 640px) {
  .container { width: calc(100% - 32px); }
  .site-header .container { height: auto; min-height: 54px; padding: 8px 0; flex-wrap: wrap; }
  .site-nav { gap: 0.4rem 1rem; font-size: 11px; flex-wrap: wrap; }
  .site-nav .optional { display: none; }
  .title { font-size: 38px; }
  .hero { padding-top: 40px; }
  .hero h1 { font-size: 46px; }
  .stage { margin-top: 32px; aspect-ratio: 16 / 9; }
  .tabs { margin-top: 28px; padding: 8px 16px; }
  section.block { padding: 26px 16px 28px; border-radius: 12px; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .kv dt { margin-top: 10px; }
  .site-footer .container { grid-template-columns: minmax(0, 1fr); }
}

/* Print: white paper, black text, no tie-dye or glass, no header, footer, hero animation or controls. */
@media print {
  html, body { background: #fff !important; color: #111 !important; }
  body::before, .site-header, .site-footer, .skip-link, .tabs, .segments, .pv-toolbar, .pv-menu, select, button { display: none !important; }
  :root { --ink: #111; --ink-strong: #000; --ink-soft: #222; --muted: #444; --muted-2: #555; --faint: #777; --line: #bbb; --line-soft: #ddd; --line-strong: #999; --glass: transparent; --glass-line: #ccc; --surface: #fff; }
  section.block, .pv, .stage-caption { background: none !important; border-color: #ccc !important; backdrop-filter: none !important; break-inside: avoid; }
  .container { width: 100%; }
  .stage { aspect-ratio: auto; max-height: 45vh; }
  a { border-bottom: 0; }
  .pv { display: block; height: auto; }
  .pv-films, .pv-list, .pv-messages, .pv-scroll { height: auto !important; max-height: none !important; overflow: visible !important; }
}
