/* Page-specific styles. Palette and type come from kit/kit.css; nothing here defines a second palette. */

/* the three fibre colours as page tokens: bright on the slide, deepened toward the ink on paper so that they read on chalk */
:root { --fx: var(--dti-x); --fy: var(--dti-y); --fz: var(--dti-z); }
.band:not(.dark):not(.stage) {
  --fx: color-mix(in oklab, var(--dti-x) 78%, var(--ink));
  --fy: color-mix(in oklab, var(--dti-y) 58%, var(--ink));
  --fz: color-mix(in oklab, var(--dti-z) 76%, var(--ink));
}
.band.alt { background: var(--paper-2); }
.top a b { letter-spacing: -.01em; }
.top > a:not(:first-child) { white-space: nowrap; }

/* ---------- the viewer (stage and second cortex) ---------- */
.viewer { position: relative; overflow: hidden; }
.viewer canvas.gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; outline-offset: -4px; }
.viewer canvas.gl:active { cursor: grabbing; }
.viewer .still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 50%; opacity: 1; transition: opacity .7s var(--ease); pointer-events: none; }
.viewer.ready .still { opacity: 0; }
.viewer.nogl .still { opacity: 1; }
.viewer.small .still { display: none; }
.viewer .loading { z-index: 2; }
.viewer.nogl .loading { position: absolute; inset: 78px 24px auto 24px; height: auto; width: auto; z-index: 4; background: color-mix(in srgb, var(--slide) 82%, transparent); padding: 8px 10px; border-radius: 6px; font-size: .86rem; }
.viewer.nogl .curtain { display: none; }
.viewer.small { height: clamp(380px, 50vw, 560px); min-height: 0; }
.viewer.small .tip { z-index: 5; }

.cap { position: absolute; top: 20px; z-index: 2; max-width: 44%; pointer-events: none; font-family: var(--display); }
.cap b { display: block; font-size: 1.05rem; font-weight: 660; letter-spacing: -.01em; }
.cap span { display: block; font-size: .8rem; line-height: 1.3; color: var(--slide-mute); }
.cap-l { left: 24px; opacity: clamp(0, calc(var(--sl, .5) * 5 - .15), 1); }
.cap-r { right: 24px; text-align: right; opacity: clamp(0, calc((1 - var(--sl, .5)) * 5 - .15), 1); }

.curtain { position: absolute; top: 0; bottom: 0; left: 50%; width: 36px; margin-left: -18px; z-index: 3; cursor: ew-resize; touch-action: none; outline: none; }
.curtain .grip { position: absolute; left: 50%; bottom: 74px; width: 44px; height: 44px; margin-left: -22px; border-radius: 50%; background: var(--slide-3); border: 1.5px solid var(--slide-ink); box-shadow: 0 0 0 5px color-mix(in srgb, var(--slide) 55%, transparent); }
.curtain .grip::before, .curtain .grip::after { content: ""; position: absolute; top: 50%; margin-top: -5px; border: 5px solid transparent; }
.curtain .grip::before { left: 7px; border-right: 7px solid var(--slide-ink); border-left-width: 0; }
.curtain .grip::after { right: 7px; border-left: 7px solid var(--slide-ink); border-right-width: 0; }
.curtain:focus-visible .grip { outline: 3px solid var(--h-brain); outline-offset: 4px; }
.curtain:hover .grip { background: var(--slide-line); }

.key { position: absolute; left: 18px; bottom: 14px; z-index: 2; pointer-events: none; max-width: 260px; }
.keybox { position: relative; width: 130px; height: 118px; }
.keybox canvas, .keybox svg { position: absolute; inset: 0; width: 130px; height: 118px; }
.keybox canvas { opacity: .95; }
.kt { font: 650 10px var(--display); }
.key p { margin: 4px 0 0; font: 500 .72rem/1.35 var(--display); color: var(--slide-mute); max-width: 230px; }

/* ---------- stage panel ---------- */
.stage { height: clamp(680px, calc(100svh - 56px), 960px); min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(320px, 420px); }
html.embed .stage { height: 100svh; }
.stage .panel { padding: clamp(22px, 2.4vw, 34px); }
.stage .panel h1 { font-size: clamp(1.9rem, 2.8vw, 2.4rem); margin-bottom: .3em; }
.stage .panel .sub { margin: 0 0 14px; font: 500 1.02rem/1.3 var(--display); color: var(--slide-mute); }
.statusline { display: flex; align-items: center; gap: 16px; margin: 0 0 14px; }
.stage .chip { --c: var(--h-brain); }
.stage .panel .lead { margin-bottom: 0; max-width: none; }
.ctl2 { display: grid; gap: 10px; margin: 18px 0 10px; }
.stage .seg button:disabled { opacity: .4; cursor: default; }
.camrow { position: absolute; right: 16px; bottom: 14px; z-index: 2; }
.camrow .seg button { padding: 6px 11px; font-size: .78rem; background: color-mix(in srgb, var(--slide) 70%, transparent); }

.mix { margin: 16px 0 8px; }
.mixhead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; margin-bottom: 6px; font: 500 .78rem/1.35 var(--display); color: var(--slide-mute); }
.mixhead b { font: 660 1.05rem var(--display); color: var(--slide-ink); letter-spacing: -.01em; }
.mixrow { display: grid; grid-template-columns: 92px minmax(0, 1fr) 76px; gap: 12px; align-items: center; padding: 8px 0; border-top: 1px solid var(--slide-line); }
.mn { font: 620 .92rem var(--display); }
.mn small { display: block; font-weight: 500; font-size: .75rem; color: var(--slide-mute); }
.mb { display: grid; gap: 5px; }
.mb i { display: block; height: 9px; border-radius: 2px; width: var(--w); transition: width .55s var(--ease); }
.mb i.e { background: var(--c); }
.mb i.a { background: transparent; box-shadow: inset 0 0 0 1.6px var(--c); }
.mv { display: grid; text-align: right; font: 640 .92rem var(--display); }
.mv em { font-style: normal; font-weight: 500; color: var(--slide-mute); }
.mixfoot { margin: 6px 0 0; padding-top: 8px; border-top: 1px solid var(--slide-line); font: 500 .76rem/1.5 var(--display); color: var(--slide-mute); max-width: none; }
.fillkey, .outkey { display: inline-block; width: 16px; height: 8px; border-radius: 2px; vertical-align: -.5px; margin-right: 4px; }
.fillkey { background: var(--slide-mute); }
.outkey { box-shadow: inset 0 0 0 1.5px var(--slide-mute); }
.stage .note { margin: 8px 0 0; font-size: .88rem; line-height: 1.5; max-width: none; }

/* ---------- sections on paper and slide ---------- */
.split2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: clamp(24px, 5vw, 80px); align-items: start; }
.split2 h2 { position: sticky; top: 88px; }
.prose p { max-width: 66ch; }
.head { max-width: 72ch; margin-bottom: 30px; }
.lede2 { margin: .7em 0 0; font-size: 1.12rem; line-height: 1.62; max-width: 68ch; }
.dark .lede2 { color: color-mix(in srgb, var(--slide-ink) 86%, var(--slide-mute)); }
.src { margin: 30px 0 0; max-width: 92ch; font: 500 .8rem/1.55 var(--display); color: var(--ink-mute); }
.dark .src { color: var(--slide-mute); }
.explorer { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, 1fr); gap: clamp(24px, 4vw, 60px); align-items: start; }
.two { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(28px, 4vw, 64px); align-items: start; }
.row2 { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 0; }
.btn:disabled { opacity: .4; cursor: default; }
.seg button:disabled { opacity: .4; cursor: default; }

/* ternary */
.ternwrap { position: relative; width: 100%; aspect-ratio: 560 / 500; }
.ternwrap canvas, .ternwrap svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ternwrap canvas { opacity: .5; }
.ternwrap svg { touch-action: none; cursor: crosshair; outline-offset: 4px; overflow: visible; }
.ternwrap .grid { stroke: rgba(233, 238, 248, .14); stroke-width: 1; }
.ternwrap .frame { fill: none; stroke: rgba(233, 238, 248, .5); stroke-width: 1.3; }
.ternwrap .corner { font: 660 15px var(--display); }
.ternwrap .plabel { font: 560 12px var(--display); fill: var(--slide-ink); paint-order: stroke; stroke: var(--slide); stroke-width: 3px; stroke-linejoin: round; }
.ternwrap .mute2 { fill: var(--slide-mute); }
.ternwrap .eqmark { stroke: rgba(233, 238, 248, .8); stroke-width: 1.3; fill: none; }
.ternwrap .pt { outline: none; }
.ternwrap .pt:focus-visible .netdot, .ternwrap .pt:hover .netdot { stroke-width: 3; }
.ternwrap .pt:focus-visible circle, .ternwrap .pt:focus-visible path { stroke: var(--h-brain); stroke-width: 3; }
.ternwrap .big.end text { text-anchor: end; }
.ternwrap .netdot { stroke: #fff; stroke-width: 1.4; }
.ternwrap .effring { fill: none; stroke: #fff; stroke-width: 2.4; }
.ternwrap .effcore { fill: #fff; }
.ternwrap .subeff { fill: none; stroke: rgba(255, 255, 255, .85); stroke-width: 1.4; }
.ternwrap .subobs { fill: #fff; stroke: var(--slide); stroke-width: 1.2; }
.ternwrap .obsring { fill: none; stroke: #fff; stroke-width: 2.4; }
.ternwrap .obscore { fill: #fff; }
.ternwrap .gdiam { fill: color-mix(in srgb, var(--slide) 60%, transparent); stroke: #fff; stroke-width: 2.2; stroke-dasharray: 4 3; }
.ternwrap .guess { outline: none; cursor: grab; }
.ternwrap .guess:focus-visible .gdiam { stroke: var(--h-brain); }
.ternwrap .gline { stroke: #fff; stroke-width: 1.4; stroke-dasharray: 4 5; opacity: .85; transition: opacity .4s; }
.ternwrap .later { opacity: 0; visibility: hidden; }
#tern.revealed .ternwrap .later { opacity: 1; visibility: visible; transition: opacity .7s var(--ease); }
#tern:not(.subj) .subpt { display: none; }
.ternwrap .off { display: none; }
.ternside { display: grid; gap: 14px; }
.ternside .seg { gap: 8px; }
.mini { width: 100%; border-collapse: collapse; font: 560 .88rem/1.3 var(--display); }
.mini th, .mini td { padding: 7px 8px; border-bottom: 1px solid var(--slide-line); text-align: right; font-variant-numeric: tabular-nums; }
.mini th:first-child { text-align: left; }
.mini thead th { font-weight: 640; font-size: .8rem; }
.mini tbody th { font-weight: 600; color: var(--slide-ink); }
.hov { margin: 0 0 8px; font: 500 .88rem/1.45 var(--display); }
@media (min-width: 901px) { .hov { min-height: 4.4em; } }
.verdict { margin: 0; font: 600 .95rem/1.45 var(--display); max-width: none; }
.ternside .note, .ternside p { max-width: none; }
.checks { display: grid; gap: 8px; }
.checks label { display: flex; gap: 9px; align-items: flex-start; font: 500 .84rem/1.4 var(--display); color: var(--slide-mute); cursor: pointer; }
.checks input { margin-top: 2px; accent-color: var(--h-brain); }

/* checks on paper */
.col h3 { margin-bottom: 10px; }
.col .seg + .note { margin-top: 12px; }
.keyrow + .note, .fig + .note { margin-top: 14px; }
.ternwrap .leader { stroke: rgba(233,238,248,.4); stroke-width: 1; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
#checks .note, #checks .src { max-width: none; }
.spread span { display: block; margin-top: 4px; }
.track { stroke: var(--paper-line); stroke-width: 1; }
.gridl { stroke: var(--paper-line); stroke-width: 1; stroke-dasharray: 2 4; }
.tick { font: 500 11px var(--display); fill: var(--ink-mute); }
.rowlab { font: 620 13px var(--display); fill: var(--ink); }
.rowlab.n { font-weight: 500; font-size: 12px; fill: var(--ink-mute); }
.axname { font: 500 11.5px var(--display); fill: var(--ink-mute); }
.uniform { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 5 4; }
.unilab { font: 620 11px var(--display); fill: var(--ink); }
.dot { fill: var(--c); stroke: var(--paper); stroke-width: 1.6; }
.eff { fill: none; stroke: var(--c); stroke-width: 2; }
.dg, .eg { transition: transform .65s var(--ease), opacity .4s var(--ease); }
.chart.still * { transition: none !important; }
.bar .bfill { fill: var(--c); }
.bar.primary .bfill { fill-opacity: .92; }
.bar.alternative .bfill { fill-opacity: .4; stroke: var(--c); stroke-width: 1.6; }
.bdot { fill: var(--paper); stroke: var(--ink); stroke-width: 1.2; }
.bval { font: 650 12px var(--display); fill: var(--ink); }
.bname { font: 500 11.5px var(--display); fill: var(--ink-mute); }
.bmod { font: 650 13px var(--display); }
.keyrow { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 8px; font: 500 .8rem var(--display); color: var(--ink-mute); }
.keyrow i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.keyrow .dk i { border-radius: 0; background: transparent; border: 2px solid var(--ink-mute); transform: rotate(45deg) scale(.9); }
.keyrow .primary i { width: 13px; height: 9px; border-radius: 2px; background: var(--ink-mute); }
.keyrow .alternative i { width: 13px; height: 9px; border-radius: 2px; background: color-mix(in srgb, var(--ink-mute) 35%, transparent); border: 1.5px solid var(--ink-mute); }

/* gradient explorer */
.gradx { grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr); align-items: center; }
.gradside { display: grid; gap: 12px; }
.gradside h3 { margin-top: 6px; }
.gradside .note { margin: 0; max-width: none; }
.glist { display: grid; }
.grow { display: grid; grid-template-columns: 124px minmax(0, 1fr) 52px; gap: 12px; align-items: center; width: 100%; padding: 9px 6px; background: none; border: 0; border-top: 1px solid var(--slide-line); color: inherit; font: 520 .9rem var(--display); text-align: left; cursor: pointer; transition: background .2s var(--ease); }
.grow:last-child { border-bottom: 1px solid var(--slide-line); }
.grow:hover, .grow[aria-pressed="true"] { background: var(--slide-3); }
.gb { display: block; height: 10px; border-radius: 2px; background: var(--slide-3); }
.grow:hover .gb, .grow[aria-pressed="true"] .gb { background: var(--slide-2); }
.gb i { display: block; height: 100%; border-radius: 2px; transition: width .55s var(--ease), background .4s; }
.gv { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.glist + .row2 { margin-top: 0; }

/* verdict */
.twin { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(28px, 5vw, 80px); margin-top: 30px; }
.twin .side { border-top: 3px solid var(--ink); padding-top: 14px; }
.twin ul { list-style: none; margin: 0; padding: 0; }
.twin li { padding: 14px 0; border-bottom: 1px solid var(--paper-line); font-size: 1rem; line-height: 1.58; max-width: 62ch; }
.twin li b { font-family: var(--display); font-weight: 650; letter-spacing: -.005em; }

/* data and cite */
.facts { margin: 26px 0; }
.facts > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 24px; padding: 15px 0; border-top: 1px solid var(--paper-line); }
.facts > div:last-child { border-bottom: 1px solid var(--paper-line); }
.facts dt { font: 650 .95rem/1.4 var(--display); }
.facts dd { margin: 0; font-size: 1rem; line-height: 1.62; max-width: 76ch; }
.facts code, .code code, .prose code { font: 500 .86em ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--paper-3); padding: .1em .35em; border-radius: 4px; }
.code pre { margin: 6px 0 0; padding: 14px 16px; background: var(--paper); border-radius: 10px; overflow-x: auto; font: 400 .84rem/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.code pre code { background: none; padding: 0; }
.band.alt .code pre { background: var(--paper); }
.links { margin: 24px 0 0; font: 500 .95rem var(--display); }
.alist { list-style: none; margin: 0; padding: 0; }
.alist li { padding: 8px 0; border-bottom: 1px solid var(--paper-line); font-size: .98rem; line-height: 1.5; }
.authors .note { margin-top: 14px; }

/* ---------- embed and thumbnail modes ---------- */
html.embed .stage { min-height: 100svh; }
html.thumb body { background: var(--slide); }
html.thumb .top, html.thumb main > section:not(.stage), html.thumb .sitefoot { display: none; }
html.thumb .stage { display: block; min-height: 0; height: 100vh; }
html.thumb .panel { display: none; }
html.thumb .stage .viewer { position: absolute; inset: 0; min-height: 0; }
html.thumb .curtain .grip { bottom: 40px; }
@media (min-width: 901px) and (max-width: 1180px) { .stage .key p { display: none; } }
html.bare .cap, html.bare .key, html.bare .curtain, html.bare .camrow { display: none; }
html.thumb .key p, html.thumb .camrow { display: none; }
html.thumb .cap b { font-size: 1.35rem; }
html.thumb .cap span { font-size: 1rem; }
html.thumb .key { left: 28px; bottom: 26px; }

/* ---------- narrow screens ---------- */
@media (max-width: 900px) {
  .explorer, .two, .gradx, .twin, .split2 { grid-template-columns: minmax(0, 1fr); }
  .split2 h2 { position: static; }
  .stage { height: auto; grid-template-columns: minmax(0, 1fr); }
  .stage .viewer { min-height: 0; height: min(118vw, 640px); }
  .camrow { display: none; }
  .key p { display: none; }
  .keybox, .keybox canvas, .keybox svg { width: 104px; height: 94px; }
  .cap { max-width: 46%; }
  .cap span { display: none; }
  .curtain .grip { bottom: 58px; }
}
@media (max-width: 600px) {
  .facts > div { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .grow { grid-template-columns: 104px minmax(0, 1fr) 46px; gap: 8px; }
  .mixrow { grid-template-columns: 80px minmax(0, 1fr) 66px; gap: 8px; }
  .cap-l { left: 14px; } .cap-r { right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .viewer .still { transition: none; }
}
