/* Look: an instrument at night. Deep indigo, quiet type, hairlines. Colour is reserved for one meaning:
   probability, running from cool blue (unlikely) through orchid to amber (likely). Nothing else is coloured. */
:root {
  color-scheme: dark;
  --night: #0f0e2e; --panel: #171645; --raise: #201f5a; --hair: rgba(233, 235, 255, .14);
  --mist: #e9ebff; --dim: #a6a9d8;
  --cold: #5b6cff; --mid: #c26bff; --warm: #ffb86b; --hot: #fff1c9;
  --bad: #ff6b8b; --good: #5fe3b0;
  --font: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--night); color: var(--mist); font: 400 18px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
header, main, footer { width: min(100% - 40px, 720px); margin-inline: auto; }
i { font-style: normal; color: var(--warm); }
code { font: .92em var(--mono); color: var(--hot); }

header { padding: 15vh 0 4vh; }
h1 { margin: 0 0 1.4rem; font-size: clamp(2.5rem, 10.5vw, 5rem); font-weight: 560; line-height: .98; letter-spacing: -.035em; text-wrap: balance; }
.lead { max-width: 31em; margin: 0; font-size: clamp(1.12rem, 4vw, 1.32rem); line-height: 1.42; color: var(--mist); text-wrap: pretty; }
.quiet, footer { color: var(--dim); font-size: .93rem; line-height: 1.5; }
.quiet { max-width: 38em; margin: 1rem 0 0; }

/* The model at work */
.live { margin: 7vh 0 0; padding: 22px 0 18px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.live .line { min-height: 4.2em; margin: 0; font-size: clamp(1.35rem, 5.4vw, 2.1rem); font-weight: 480; line-height: 1.3; letter-spacing: -.015em; }
.live .line span { animation: arrive .5s cubic-bezier(.2, .8, .2, 1) backwards; }
@keyframes arrive { from { opacity: 0; filter: blur(6px); } }
.cursor { display: inline-block; width: .08em; height: 1em; margin-left: .12em; vertical-align: -.14em; background: var(--hot); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.cands { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 16px; }
.cand { min-width: 0; font-size: .9rem; color: var(--dim); transition: color .25s, opacity .25s; }
.cand b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.cand i { display: block; height: 3px; margin-top: 6px; border-radius: 2px; background: var(--c); transform-origin: 0 50%; transition: transform .45s cubic-bezier(.2, .8, .2, 1); }
.cand.won { color: var(--hot); }
.cands.decided .cand:not(.won) { opacity: .28; }

section { padding: 11vh 0 0; }
.step { margin: 0 0 .9rem; color: var(--dim); font-size: .95rem; font-variant-numeric: tabular-nums; }
.step span { color: var(--warm); font-weight: 600; }
h2 { margin: 0 0 .7rem; font-size: clamp(1.75rem, 6.6vw, 2.7rem); font-weight: 540; line-height: 1.06; letter-spacing: -.028em; text-wrap: balance; }
.try { margin: 0 0 1.3rem; color: var(--dim); font-size: 1.05rem; }
.try b { color: var(--mist); font-weight: 600; }
.insight { max-width: 36em; margin: 1.7rem 0 1.1rem; text-wrap: pretty; }
.insight b { color: var(--hot); font-weight: 600; }
.honest { max-width: 36em; margin: 0; padding: 12px 0 0; border-top: 1px solid var(--hair); color: var(--dim); font-size: .93rem; line-height: 1.5; }
.honest p { margin: 0; }
.honest .tag { margin-bottom: 3px; color: var(--mist); font-weight: 600; }
.honest b { color: var(--mist); font-weight: 600; }
footer { padding: 9vh 0 130px; }

/* Experiments */
.toy { padding: 20px; border-radius: 16px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--hair); }
.toy > * + * { margin-top: 16px; }
.toy input[type="text"] { width: 100%; padding: 13px 14px; border: 1px solid var(--hair); border-radius: 10px;
  background: var(--night); color: var(--mist); font: 500 1.08rem/1.35 var(--font); }
:is(.toy input, .toy button, .toy label):focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; }
.note { margin-bottom: 0; color: var(--dim); font-size: .92rem; }

.tokens { display: flex; flex-wrap: wrap; gap: 8px 10px; min-height: 3.2em; }
.word { display: inline-flex; }
.tok { display: inline-grid; justify-items: center; padding: 6px 8px 4px; border: 1px solid hsl(var(--h) 70% 72% / .55); margin-left: -1px;
  background: hsl(var(--h) 60% 60% / .13); font: 500 1.02rem/1.15 var(--mono); white-space: pre; animation: arrive .4s backwards; }
.word .tok:first-child { border-radius: 7px 0 0 7px; margin-left: 0; }
.word .tok:last-child { border-radius: 0 7px 7px 0; }
.word .tok:only-child { border-radius: 7px; }
.tok small { margin-top: 3px; font-size: .68rem; color: hsl(var(--h) 80% 80%); }

.sentence { min-height: 2.8em; margin: 0; font-size: 1.35rem; font-weight: 480; line-height: 1.35; letter-spacing: -.01em; }
.given { color: var(--dim); }
.new { color: var(--hot); }

.bars { display: grid; gap: 1px; }
.bar { display: grid; grid-template-columns: minmax(5.4em, 28%) 1fr 3.2em; align-items: center; gap: 12px; width: 100%; min-height: 40px;
  padding: 2px 8px; border: 0; border-radius: 8px; background: none; color: inherit; font: inherit; text-align: left; }
button.bar { cursor: pointer; }
button.bar:hover { background: var(--raise); }
.bar .w { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .track { height: 6px; border-radius: 3px; background: rgba(233, 235, 255, .07); }
.bar .fill { display: block; height: 100%; min-width: 2px; border-radius: 3px; background: var(--c, var(--cold)); box-shadow: 0 0 14px var(--c, transparent);
  transform-origin: 0 50%; transition: width .5s cubic-bezier(.2, .9, .2, 1.1), background .4s; }
.bar .pct { text-align: right; font-variant-numeric: tabular-nums; font-size: .93rem; color: var(--dim); }
.bar.cut .w { color: var(--dim); text-decoration: line-through; opacity: .6; }
.bar.cut .pct { color: var(--bad); }
/* the hotter, the more restless: chance made visible */
.bars.hot .fill { animation: restless calc(1.5s - var(--heat) * .9s) ease-in-out infinite alternate; }
.bars.hot .bar:nth-child(even) .fill { animation-delay: -.4s; }
@keyframes restless { to { transform: scaleX(calc(1 - var(--heat) * .16)); } }

.row { display: flex; flex-wrap: wrap; gap: 8px; }
.row button { min-height: 44px; padding: 0 16px; border: 1px solid var(--hair); border-radius: 999px; background: none; color: var(--mist);
  font: 500 .97rem/1.2 var(--font); cursor: pointer; transition: background .15s, border-color .15s; }
.row button:hover { border-color: var(--warm); }
.row button.main { border-color: var(--warm); background: var(--warm); color: #1a1208; font-weight: 600; }
.row button.main:hover { background: var(--hot); }
.row button[aria-pressed="true"] { border-color: var(--warm); background: rgba(255, 184, 107, .14); color: var(--hot); }
.row button.mono { font-family: var(--mono); font-size: .9rem; }

.slider { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: baseline; }
.slider label { font-weight: 500; }
.slider output { font-variant-numeric: tabular-nums; color: var(--warm); font-weight: 600; }
.slider input { grid-column: 1 / -1; width: 100%; height: 38px; margin: 0; accent-color: var(--warm); }

.lines { display: grid; gap: 0; margin-bottom: 0; padding: 0; list-style: none; font-size: 1.05rem; line-height: 1.4; }
.lines li { padding: 10px 0; border-top: 1px solid var(--hair); }

/* 4 · attention arcs */
.attn { position: relative; padding-top: 96px; }
.attn svg { position: absolute; left: 0; top: 0; width: 100%; height: 100px; overflow: visible; pointer-events: none; }
.attn path { fill: none; stroke-linecap: round; }
.attn .words { display: flex; flex-wrap: nowrap; gap: 10px; overflow: hidden; font-size: clamp(.95rem, 3.9vw, 1.25rem); font-weight: 480; white-space: nowrap; }
.attn .words span { padding: 2px 0; border-bottom: 2px solid transparent; color: var(--dim); transition: color .4s, border-color .4s; }
.attn .words .seen { color: var(--mist); border-color: var(--c); }
.attn .words .slot { min-width: 2.6em; border-bottom: 2px dashed var(--hot); color: var(--hot); }

/* 5 · answers with their confidence */
.answer { display: flex; flex-wrap: wrap; gap: 10px 8px; align-items: flex-start; margin-bottom: 0; font-size: 1.22rem; font-weight: 480; }
.answer .gen { display: inline-grid; justify-items: center; color: var(--hot); animation: arrive .45s backwards; }
.answer .gen small { margin-top: 4px; padding-top: 3px; border-top: 2px solid var(--c); font-size: .72rem; font-weight: 500; color: var(--dim); font-variant-numeric: tabular-nums; }

/* 6 · the shelf */
.switch { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; font-weight: 500; }
.switch input { appearance: none; -webkit-appearance: none; position: relative; width: 52px; height: 30px; margin: 0; border-radius: 999px; background: var(--raise);
  box-shadow: inset 0 0 0 1px var(--hair); cursor: pointer; transition: background .2s; }
.switch input::after { content: ""; position: absolute; left: 3px; top: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--mist); transition: translate .2s; }
.switch input:checked { background: var(--warm); }
.switch input:checked::after { translate: 22px 0; background: #1a1208; }
.switch input:focus-visible { outline: 2px solid var(--hot); outline-offset: 3px; }
.shelf { display: grid; gap: 0; margin-bottom: 0; padding: 0; list-style: none; transition: opacity .3s; }
.shelf.off { opacity: .35; }
.shelf li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--hair); font-size: .98rem; color: var(--dim); transition: color .3s; }
.shelf li.hit { color: var(--hot); }
.shelf .score { font-size: .85rem; font-variant-numeric: tabular-nums; }
.shelf .meter { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: var(--c, var(--cold)); transform-origin: 0 50%; transition: transform .5s cubic-bezier(.2, .8, .2, 1), background .4s; }
.status { margin-bottom: 0; color: var(--dim); font-size: .95rem; }
.status b { display: block; margin-top: 4px; color: var(--hot); font-weight: 500; }

/* 7 · code */
.choices { display: flex; align-items: baseline; gap: 12px; margin-bottom: 0; }
.choices b { font-size: 2.6rem; font-weight: 540; line-height: 1; letter-spacing: -.03em; color: var(--c); font-variant-numeric: tabular-nums; transition: color .4s; }
.choices span { color: var(--dim); font-size: .95rem; }
.prompt { margin-bottom: 0; padding: 12px 14px; border-radius: 10px; background: var(--night); font: 500 1rem/1.4 var(--mono); overflow-x: auto; white-space: pre; }
.rule { height: 1px; margin: 24px 0 8px; border: 0; background: var(--hair); }
.label { margin-bottom: -6px; color: var(--dim); font-size: .92rem; }
.runs { display: grid; gap: 0; margin-bottom: 0; padding: 0; list-style: none; }
.runs li { padding: 11px 0; border-top: 1px solid var(--hair); animation: arrive .45s backwards; }
.runs code { display: block; color: var(--dim); font-size: .98rem; overflow-x: auto; white-space: pre; }
.runs code b { font-weight: 600; color: var(--hot); }
.runs p { margin: 5px 0 0; font-size: .93rem; }
.runs .pass p { color: var(--good); }
.runs .fail p { color: var(--bad); }
.runs .no { color: var(--dim); }

.glossary dl { display: grid; gap: 0; margin: 1.6rem 0 0; }
.glossary dl > div { display: grid; grid-template-columns: minmax(8.5em, 30%) 1fr; gap: 6px 20px; padding: 16px 0; border-top: 1px solid var(--hair); }
.glossary dt { font-weight: 600; color: var(--hot); }
.glossary dd { margin: 0; color: var(--dim); font-size: .98rem; line-height: 1.5; }
@media (max-width: 520px) {
  .glossary dl > div { grid-template-columns: 1fr; }
  .cands { grid-template-columns: repeat(3, 1fr); }
  .cand:nth-child(n+4) { display: none; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
