/* The shared chrome (tokens, reset, .wrap, header, nav, search, chips, dropdowns, footer) comes from
   /css/stack.css (uistack/site/css/stack.css), linked before this file. Only what differs here stays here. */
/* Motion: page rules. The stage, the filmstrip, the curve graph, the tuner, tiles, tables. The cards inside a stage
   are cardui's, rendered by its own renderer; the move's css is injected by js/app.js. */

/* Filters */
.tools { padding: 22px 0 8px; display: flex; flex-direction: column; gap: 12px; }
.bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bar select { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--fg); font: 500 13px var(--ui); max-width: 100%; }
.bar .search { flex: 1 1 260px; }
.clear { background: none; border: 0; color: var(--accent); font: 500 13px var(--ui); cursor: pointer; padding: 4px 6px; }
.themes__chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.themes__name { font: 600 11px/1 var(--ui); letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg3); margin-right: 4px; }
.more-wrap { display: flex; justify-content: center; padding: 0 0 48px; }
.more-btn { padding: 11px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--fg); font: 600 14px var(--ui); cursor: pointer; }
.more-btn small { color: var(--fg3); font-weight: 500; margin-left: 8px; }
.empty { padding: 60px 0; color: var(--fg3); text-align: center; }
.result-count { font-size: 13px; color: var(--fg3); }

/* Detail pages */
.detail { padding: 22px 0 64px; }
.crumbs { font-size: 13px; color: var(--fg3); margin-bottom: 14px; }
.crumbs a { color: var(--fg2); }
.detail h1 { font-size: clamp(28px, 3.4vw, 40px); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 10px; }
.lede { color: var(--fg2); font-size: 16px; max-width: 62ch; margin: 0 0 14px; line-height: 1.55; }
.section { margin-top: 40px; }
.section__title { font: 600 11.5px/1 var(--ui); letter-spacing: 0.08em; text-transform: uppercase; color: var(--fg3); margin: 0 0 14px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.section__title span { font-weight: 400; letter-spacing: 0; text-transform: none; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; min-width: 0; }
.panel h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.prose { font-size: 16.5px; line-height: 1.6; max-width: 66ch; }
.prose p { margin: 0 0 12px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font: 500 12px/1 var(--ui); padding: 6px 10px; border-radius: 999px; background: var(--panel2); color: var(--fg2); }
a.badge:hover { color: var(--fg); }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
pre.snippet { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 16px; font: 12px/1.6 var(--mono); overflow: auto; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 420px; }
.btn-sm { padding: 7px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--fg); font: 600 13px var(--ui); cursor: pointer; }
.btn-sm:hover { border-color: var(--fg3); }
.btn-sm[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.exports { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; align-items: center; }
.kv { width: 100%; border-collapse: collapse; font-size: 14px; }
.kv th, .kv td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kv th { color: var(--fg3); font-weight: 500; width: 130px; }
.kv td code { font: 12.5px var(--mono); }
.kv td small { color: var(--fg3); display: block; margin-top: 3px; line-height: 1.45; }
.own { display: inline-block; font: 600 10.5px/1 var(--ui); letter-spacing: .04em; text-transform: uppercase; padding: 3px 6px; border-radius: 5px; margin-left: 6px; vertical-align: 1px; background: var(--panel2); color: var(--fg2); border: 1px solid var(--line); }
.own--measured { color: #0f766e; border-color: color-mix(in srgb, #0f766e 35%, transparent); }
.own--platform, .own--platform-and-ours { color: #1d4ed8; border-color: color-mix(in srgb, #1d4ed8 30%, transparent); }
.own--book { color: #9a3412; border-color: color-mix(in srgb, #9a3412 30%, transparent); }
.own--ours { color: #6d28d9; border-color: color-mix(in srgb, #6d28d9 30%, transparent); }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.seg label { display: inline-flex; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font: 500 12.5px/1.2 var(--ui); color: var(--fg2); cursor: pointer; background: var(--panel); white-space: nowrap; }
.seg span small { color: inherit; opacity: 0.6; margin-left: 4px; font-variant-numeric: tabular-nums; }
.seg input:checked + span { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* The stage: the card at 420px, scaled down to fit when the column is narrower */
.stagewrap { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: stretch; }
@media (max-width: 820px) { .stagewrap { grid-template-columns: 1fr; } }
.stagebox { border: 1px solid var(--line); border-radius: var(--radius); padding: 32px 16px; background: var(--panel2); display: flex; justify-content: center; align-items: center; overflow: hidden; min-height: 260px; }
.mo-fit { position: relative; }
.mo-note { color: var(--fg3); font-size: 13px; }
.graphbox { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.graphbox h3 { margin: 0; font: 600 11px/1 var(--ui); letter-spacing: .07em; text-transform: uppercase; color: var(--fg3); }
.graphbox .legend { font-size: 12px; color: var(--fg3); line-height: 1.5; }
.graphbox .legend b { color: var(--fg2); font-weight: 600; }
.mc-graph { display: block; max-width: 100%; height: auto; overflow: visible; }
.mc-box { fill: none; }
.mc-grid { stroke: var(--line); stroke-width: 1; }
.mc-line { fill: none; stroke: var(--fg); stroke-width: 2; stroke-linejoin: round; }
.mc-line--dash { stroke: var(--fg3); stroke-dasharray: 4 3; stroke-width: 1.5; }
.mc-peak { fill: var(--accent); }
.mc-tick { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 2; }
.mc-over { stroke: #c2410c; stroke-width: 1; stroke-dasharray: 3 2; }
.mc-txt { font: 500 9.5px var(--ui); fill: var(--fg3); }
.mc-txt--over { fill: #c2410c; }

.player { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin: 12px 0 0; font-size: 13px; color: var(--fg2); }
.player .lab { font: 600 11px/1 var(--ui); letter-spacing: 0.07em; text-transform: uppercase; color: var(--fg3); margin-right: 6px; }
.player .grp { display: inline-flex; align-items: center; }
.player .tog { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.player .tog input { accent-color: var(--fg); margin: 0; }
.scrub { display: inline-flex; align-items: center; gap: 8px; flex: 1 1 260px; min-width: 200px; }
.scrub input { flex: 1; accent-color: var(--fg); }
.scrub output { font: 500 12px var(--mono); color: var(--fg2); min-width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
.stage-note { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 10px 2px 0; font-size: 12.5px; color: var(--fg3); }
.stage-note b { color: var(--fg2); font-weight: 600; }

/* Filmstrip: eight clones of the stage, each paused at its time */
.film { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); align-items: end; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel2); overflow: hidden; }
.mo-frame { margin: 0; display: flex; flex-direction: column; gap: 6px; align-items: center; min-width: 0; }
.mo-frame__box { position: relative; overflow: hidden; border-radius: 6px; background: var(--panel); outline: 1px solid var(--line); }
.mo-frame__box .mo-stage { position: absolute; left: 0; top: 0; }
.mo-frame figcaption { font: 500 11px var(--mono); color: var(--fg3); font-variant-numeric: tabular-nums; }

/* Tuner */
.tuner { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.tuner .panel { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.tuner .panel h3 { font: 600 11px/1 var(--ui); letter-spacing: .07em; text-transform: uppercase; color: var(--fg3); margin: 0; }
.tuner label.row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg2); flex-wrap: wrap; }
.tuner input[type="number"], .tuner input[type="text"], .tuner select { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--fg); font: 500 13px var(--ui); min-width: 0; }
.tuner input[type="text"] { font-family: var(--mono); font-size: 12px; width: 100%; }
.tuner input[type="range"] { accent-color: var(--fg); flex: 1; }
.tuner output { font: 500 12px var(--mono); color: var(--fg2); min-width: 40px; }
.bez { display: block; width: 100%; max-width: 170px; height: auto; touch-action: none; cursor: crosshair; }
.bez .h { fill: var(--panel); stroke: var(--accent); stroke-width: 2; cursor: grab; }
.bez .arm { stroke: var(--accent); stroke-width: 1; }
.bez .c { fill: none; stroke: var(--fg); stroke-width: 2; }
.bez .g { stroke: var(--line); fill: none; }
.hint { font-size: 12px; color: var(--fg3); line-height: 1.45; margin: 0; }

/* Scorecard */
.mo-sc { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.mo-sc td, .mo-sc th { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.mo-sc th { font-weight: 600; white-space: nowrap; }
.mo-sc th small { display: block; color: var(--fg3); font: 500 11px var(--mono); }
.mo-sc td:last-child { color: var(--fg2); }
.mo-word { display: inline-block; font: 700 10.5px/1 var(--ui); letter-spacing: .05em; text-transform: uppercase; padding: 4px 7px; border-radius: 5px; white-space: nowrap; }
.mo-word--pass { color: #15803d; background: color-mix(in srgb, #15803d 12%, transparent); }
.mo-word--watch { color: #b45309; background: color-mix(in srgb, #b45309 14%, transparent); }
.mo-word--fail { color: #b91c1c; background: color-mix(in srgb, #b91c1c 12%, transparent); }
:root[data-theme="dark"] .mo-word--pass { color: #4ade80; } :root[data-theme="dark"] .mo-word--watch { color: #fbbf24; } :root[data-theme="dark"] .mo-word--fail { color: #f87171; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .mo-word--pass { color: #4ade80; } :root:not([data-theme="light"]) .mo-word--watch { color: #fbbf24; } :root:not([data-theme="light"]) .mo-word--fail { color: #f87171; } }

/* Tiles: the live card on a reduced stage, playing its move on hover and focus */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; padding: 12px 0 48px; align-items: start; }
@media (max-width: 420px) { .grid { grid-template-columns: 1fr; } }
.mt { min-width: 0; cursor: pointer; border-radius: var(--radius); }
.mt:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.mt__stage { position: relative; height: 230px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel2); display: flex; align-items: center; justify-content: center; }
.mo-tilebox { display: flex; justify-content: center; width: 100%; padding: 0 12px; }
.mt__cap { display: flex; align-items: center; gap: 8px; padding: 9px 4px 0; }
.mt__name { font-weight: 600; font-size: 14.5px; }
.mt__name:hover { color: var(--accent); }
.mt__cap .mo-word { margin-left: auto; }
.mt__chip { padding: 4px 4px 0; font: 500 12px var(--mono); color: var(--fg3); }

/* Home */
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 28px; align-items: center; padding: 34px 0 28px; }
.hero h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 14px; font-weight: 700; }
.hero p.lede { font-size: 16px; max-width: 34em; margin: 0 0 20px; }
.hero > * { min-width: 0; }
.hero__stage { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 12px; align-items: stretch; }
.hero__stage .stagebox { min-height: 220px; padding: 24px 12px; }
.hero__cap { font-size: 13px; color: var(--fg3); margin-top: 8px; }
.hero__cap a { color: var(--accent); }
@media (max-width: 900px) { .hero, .hero__stage { grid-template-columns: 1fr; } }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.quick a { font-size: 12.5px; color: var(--fg2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; background: var(--panel); }
.shelf, .group { padding: 22px 0 6px; border-top: 1px solid var(--line); }
.shelf__head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.shelf__head h2 { font-size: 20px; margin: 0; letter-spacing: -0.015em; }
.shelf__head p { margin: 0; color: var(--fg3); font-size: 13.5px; flex: 1; min-width: 200px; }
.shelf__head a { font-size: 13px; color: var(--accent); white-space: nowrap; }
.shelfrow { display: grid; grid-auto-flow: column; grid-auto-columns: 300px; gap: 16px; overflow-x: auto; padding: 2px 2px 14px; scrollbar-width: thin; align-items: start; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; padding: 6px 0 18px; }
.scard { display: flex; flex-direction: column; gap: 8px; padding: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.scard:hover { border-color: var(--fg3); }
.scard__cap { display: flex; align-items: baseline; gap: 8px; }
.scard__cap b { font-size: 15px; font-weight: 600; }
.scard__cap small { margin-left: auto; color: var(--fg3); font-size: 12px; white-space: nowrap; }
.scard p { margin: 0; color: var(--fg3); font-size: 13px; line-height: 1.5; }
.scard--off { opacity: .55; }

/* Curves page */
.curvegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; padding: 8px 0 24px; }
.curve { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.curve h3 { margin: 0; font-size: 16px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.curve h3 code { font: 500 12px var(--mono); color: var(--fg3); }
.curve p { margin: 0; font-size: 13.5px; color: var(--fg2); line-height: 1.5; }
.curve .eq { font: 12px/1.5 var(--mono); color: var(--fg2); background: var(--panel2); padding: 6px 8px; border-radius: 6px; overflow-wrap: anywhere; }
.curve .ownline { font-size: 12px; color: var(--fg3); line-height: 1.45; }
.curve .run { position: relative; height: 18px; border-radius: 9px; background: var(--panel2); overflow: hidden; }
.curve .run i { position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--fg); }
.springbox { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: center; }
@media (max-width: 700px) { .springbox { grid-template-columns: 1fr; } }

/* Reference */
.plates { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; padding: 8px 0 24px; }
.plate { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.plate video { width: 100%; border-radius: 8px; background: #f4f2ee; display: block; aspect-ratio: 16 / 9; object-fit: contain; }
.plate h3 { margin: 0; font-size: 15px; }
.ptable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ptable th, .ptable td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ptable th { color: var(--fg3); font-weight: 500; }
.ptable td code { font: 12.5px var(--mono); }

/* Guide */
.guide { padding: 30px 0 80px; max-width: 760px; }
.guide h1 { font-size: 40px; line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 8px; }
.guide .lede { font-size: 19px; color: var(--fg2); margin: 0 0 30px; line-height: 1.5; }
.guide h2 { font-size: 24px; margin: 46px 0 10px; letter-spacing: -0.01em; scroll-margin-top: 70px; }
.guide p, .guide li { font-size: 16.5px; line-height: 1.65; }
.guide .toc { list-style: none; padding: 0; margin: 0 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.guide .toc a { color: var(--fg2); font-size: 15px; }
.guide .ex { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; }
.guide .ex a { font-size: 13.5px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--accent); }
.guide table { border-collapse: collapse; width: 100%; font-size: 14.5px; margin: 10px 0; }
.guide th, .guide td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.guide th { color: var(--fg3); font-weight: 500; }
.guide code { font: 13.5px var(--mono); background: var(--panel2); padding: 1px 5px; border-radius: 5px; }
@media (max-width: 560px) { .guide .toc { grid-template-columns: 1fr; } .film { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
