/* A conference paper on a desk, printed in black plus two spot inks: one per attention head.
   Layout: one sheet, one text column, figures the full width of the sheet. Single light theme by choice. */
:root {
  --desk: #2e3136;
  --paper: #fcfcfb;
  --ink: #14161a;
  --ink-2: #555b65;
  --rule: #d5d8dc;
  --wash: #f2f3f5;
  --head-a: #2444e2;        /* ink for attention head A */
  --head-b: #ee6c12;        /* ink for attention head B */
  --wrong: #c40f3a;         /* proofreader's mark for a mistranslated word */
  --serif: "STIX Two Text", "Times New Roman", Times, serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --row: 27px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--desk); color: var(--ink); font: 400 1.09rem/1.58 var(--serif); }
.sheet { background: var(--paper); max-width: 900px; margin: 28px auto; padding: 30px clamp(16px, 7vw, 84px) 40px; box-shadow: 0 2px 30px rgb(0 0 0 / .45); }
@media (max-width: 720px) { .sheet { margin: 0; box-shadow: none; } }
a { color: inherit; text-decoration-color: var(--head-a); text-underline-offset: 2px; }
a:hover { color: var(--head-a); }
:focus-visible { outline: 2px solid var(--head-a); outline-offset: 2px; }
.skip { position: absolute; left: -999px; } .skip:focus { left: 8px; top: 8px; background: var(--paper); padding: 6px 10px; z-index: 5; }

.running { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font: 400 .72rem/1.4 var(--mono); color: var(--ink-2); letter-spacing: .02em; margin-bottom: 34px; }
.running a { text-decoration: none; }

/* the two-rule title block of the conference template */
.titleblock { border-top: 4px solid var(--ink); border-bottom: 1px solid var(--ink); padding: 22px 0 24px; text-align: center; }
h1 { margin: 0; font: 700 clamp(2rem, 6.4vw, 3.3rem)/1.08 var(--serif); letter-spacing: -.012em; text-wrap: balance; }
.authors { list-style: none; margin: 26px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px 12px; text-align: center; font-size: .93rem; line-height: 1.3; }
.authors b { display: block; font-weight: 600; }
.authors span { display: block; color: var(--ink-2); font-size: .82rem; }
@media (max-width: 620px) { .authors { grid-template-columns: repeat(2, 1fr); } }
.byline { text-align: center; color: var(--ink-2); font-size: .86rem; line-height: 1.5; margin: 22px auto 0; max-width: 60ch; }

.abstract { max-width: 62ch; margin: 34px auto 30px; }
.abstract h2 { text-align: center; font: 700 1.05rem/1.2 var(--serif); margin: 0 0 8px; }
.abstract p { margin: 0; font-size: 1rem; line-height: 1.55; }

section > h2 { font: 700 1.28rem/1.25 var(--serif); margin: 46px 0 10px; text-wrap: balance; }
section > h2 .num { display: inline-block; min-width: 1.5em; }
section > p, section > ol { max-width: 66ch; margin: 0 0 14px; }
.places { padding-left: 1.3em; } .places li { margin-bottom: 10px; }
em { font-style: italic; }
.eq { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; max-width: 66ch; margin: 16px 0; padding-left: clamp(0px, 4vw, 40px); font-size: 1.08rem; overflow-x: auto; }
.eq span:first-child { white-space: nowrap; }
.eqn { color: var(--ink-2); }

/* figures */
.fig { margin: 26px 0 30px; }
.fig-body { background: var(--wash); border: 1px solid var(--rule); border-radius: 3px; padding: clamp(12px, 3vw, 22px); display: flex; flex-direction: column; gap: 14px; }
figcaption, caption { font-size: .9rem; line-height: 1.45; color: var(--ink); margin-top: 9px; max-width: 74ch; text-align: left; }
caption { caption-side: top; margin: 0 0 8px; }
.fig-split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 720px) { .fig-split { grid-template-columns: 1fr; } }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.prompt { margin: 0; font-size: .97rem; }
.count { font: 500 .78rem/1.3 var(--mono); color: var(--ink-2); }

.btn, .tab, .chip, .hd { font: 500 .78rem/1 var(--mono); color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: 3px; padding: 8px 11px; cursor: pointer; }
.btn:hover { background: var(--ink); color: var(--paper); }
.tab:hover, .chip:hover { box-shadow: inset 0 0 0 1px var(--ink); }
.btn:active { transform: translateY(1px); }
.link { font: inherit; color: var(--head-a); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.link:hover { color: var(--ink); }

/* head legend / toggles */
.legend { display: inline-flex; gap: 6px; flex-wrap: wrap; margin-left: auto; }
.hd { display: inline-flex; align-items: center; gap: 6px; border-color: var(--rule); padding: 7px 9px; }
.hd i { width: 16px; height: 4px; border-radius: 2px; background: var(--c); }
.hd[aria-pressed="false"] { color: var(--ink-2); } .hd[aria-pressed="false"] i { background: var(--rule); }
.hd.a { --c: var(--head-a); } .hd.b { --c: var(--head-b); }

/* attention view: two columns of words, lines between */
.av-head { display: flex; justify-content: space-between; gap: 12px; font: 500 .68rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 6px; }
.av-body { display: grid; grid-template-columns: auto minmax(70px, 1fr) auto; align-items: start; }
.av-col { list-style: none; margin: 0; padding: 0; }
.av-col li { height: var(--row); display: flex; align-items: center; }
.av-left li { justify-content: flex-end; }
.tok { font: 500 .84rem/1 var(--mono); color: var(--ink); background: rgb(20 22 26 / calc(var(--w, 0) * .14)); border: 1px solid transparent; border-radius: 3px; padding: 4px 6px; cursor: pointer; white-space: nowrap; }
.tok:hover, li.on .tok { border-color: var(--ink); }
li.on .tok { font-weight: 600; }
li.hidden .tok { visibility: hidden; }
li.pending .tok { visibility: visible; border: 1px dashed var(--ink-2); color: var(--ink-2); }
li.start .tok { color: var(--ink-2); font-style: italic; }
.av.pick .av-left .tok { border-color: var(--ink); background: var(--paper); }
@media (hover: hover) { .av.pick .av-left .tok:hover { background: var(--ink); color: var(--paper); } }
.av.pick .av-left .tok:active { background: var(--ink); color: var(--paper); }
.av-lines { width: 100%; display: block; overflow: visible; }
.ln { fill: none; stroke-linecap: round; mix-blend-mode: multiply; transition: stroke-opacity .18s; }
.ln.h0 { stroke: var(--head-a); } .ln.h1 { stroke: var(--head-b); }

/* sentence builder: every word is a menu */
.builder { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 5px; }
.builder select { font: 500 .86rem/1.2 var(--mono); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-bottom: 1px dashed var(--ink); border-radius: 3px; padding: 6px 4px; cursor: pointer; max-width: 100%; }
.builder select.empty { color: var(--ink-2); border-style: dashed; border-color: var(--rule); }
.builder .fixed { font: 500 .86rem/1 var(--mono); padding: 0 2px; }
.builder .btn { padding: 7px 9px; }

/* readouts */
.readout { font-size: .92rem; line-height: 1.45; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.readout h3 { font: 500 .68rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 5px; }
.readout p { margin: 0; }
.fr { font: 500 .86rem/1.5 var(--mono); }
.odds { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; font: 500 .8rem/1.2 var(--mono); }
.bar { height: 9px; background: var(--rule); border-radius: 1px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); width: calc(var(--v) * 100%); }
.num { font-variant-numeric: tabular-nums; }
.bad { color: var(--wrong); text-decoration: underline wavy var(--wrong); text-underline-offset: 3px; }
.okmark { color: var(--ink-2); }

/* figure 2: path length */
.pathrow { display: grid; grid-template-columns: 1fr; gap: 5px; }
.rowlabel { font: 500 .68rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.chips { display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; position: relative; }
.arcwrap { padding-top: 34px; }
.chips .chip { padding: 8px 0; text-align: center; font-size: clamp(.62rem, 2.6vw, .8rem); border-color: var(--rule); position: relative; }
.chips .chip[disabled] { color: var(--ink-2); cursor: default; background: transparent; }
.chips .chip[disabled]:hover { color: var(--ink-2); background: transparent; }
.chips .chip.src { border-color: var(--ink); font-weight: 600; }
.chips .chip.dst { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chips .chip.lit { background: var(--head-b); border-color: var(--head-b); color: #fff; }
.chips .chip.passed { border-color: var(--head-b); }
.chips svg { position: absolute; left: 0; top: 0; width: 100%; height: 36px; overflow: visible; pointer-events: none; }
.chips svg path { fill: none; stroke: var(--head-a); stroke-width: 3; stroke-linecap: round; }

/* figure 3: query and keys */
.steps { display: flex; flex-wrap: wrap; gap: 5px; }
.chip[aria-pressed="true"], .tab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.qk { display: grid; grid-template-columns: auto auto auto minmax(60px, 1fr) auto; gap: 5px 12px; align-items: center; font: 500 .8rem/1.2 var(--mono); }
.qk .hdr { font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); align-self: end; }
.qk .q { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-bottom: 8px; border-bottom: 1px solid var(--rule); margin-bottom: 2px; font-family: var(--serif); font-size: .95rem; }
.qk .top { font-weight: 600; }
.qk .bar i { background: var(--c); }
.spark { display: block; }
@media (max-width: 480px) { .qk { gap: 5px 7px; font-size: .72rem; } }

/* figure 4 */
.tabs { display: flex; flex-wrap: wrap; gap: 5px; }
.note-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 3px; font: 500 .8rem/1.3 var(--mono); }
.note-list b { font-weight: 600; }
.sw { display: inline-block; width: 12px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }

/* figure 5: positions */
.posgrid { display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: center; }
.axis-y { writing-mode: vertical-rl; transform: rotate(180deg); font: 500 .64rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); text-align: center; }
.axis-x { margin: -8px 0 0; font: 500 .64rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); text-align: center; }
#pos-canvas { width: 100%; height: 160px; display: block; cursor: crosshair; border: 1px solid var(--ink); background: var(--paper); touch-action: pan-y; }
.probe { display: flex; align-items: center; gap: 10px; font: 500 .78rem/1.3 var(--mono); min-height: 30px; flex-wrap: wrap; }
.outlines { display: grid; gap: 6px; font: 500 .84rem/1.5 var(--mono); }
.outlines .lab { display: block; font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.toggle[aria-pressed="true"] { background: var(--wrong); border-color: var(--wrong); color: #fff; }

/* figure 6: game */
.scorebar { display: flex; justify-content: space-between; gap: 12px; font: 500 .8rem/1.3 var(--mono); }
#game-attn { max-width: 430px; width: 100%; margin: 0 auto; }
#live-attn, #three-attn { max-width: 460px; width: 100%; }
#game-msg { min-height: 3em; }
.pts { font: 600 .9rem/1 var(--mono); padding: 2px 6px; border-radius: 3px; background: var(--ink); color: var(--paper); margin-right: 6px; }

/* figure 7: the machine */
.machine { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.machine .wide { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack > h3 { font: 500 .68rem/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 0; }
.io { font: 500 .74rem/1.3 var(--mono); color: var(--ink-2); text-align: center; padding: 2px 0; }
.io::after { content: "↓"; display: block; line-height: 1; margin-top: 2px; }
.io.end::after { content: none; } .io.end::before { content: "↓"; display: block; line-height: 1; margin-bottom: 2px; }
.part { background: var(--paper); border: 1px solid var(--ink); border-radius: 3px; padding: 9px 10px; display: flex; flex-direction: column; gap: 8px; }
.part h4 { margin: 0; font: 600 .92rem/1.2 var(--serif); }
.part .ctl { display: flex; flex-wrap: wrap; gap: 5px; }
.part.spacer { visibility: hidden; }
.cut { font: 500 .74rem/1 var(--mono); color: var(--ink); background: var(--paper); border: 1px solid var(--rule); border-radius: 3px; padding: 7px 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.cut i { width: 12px; height: 4px; border-radius: 2px; background: var(--c, var(--ink)); }
.cut:hover { border-color: var(--ink); }
.cut[aria-pressed="true"] { background: var(--wrong); border-color: var(--wrong); color: #fff; text-decoration: line-through; }
.cut[aria-pressed="true"] i { background: #fff; }
.part.gone { border-style: dashed; background: repeating-linear-gradient(135deg, transparent 0 6px, rgb(196 15 58 / .12) 6px 7px), var(--paper); }
.part.gone h4 { text-decoration: line-through; color: var(--ink-2); }
button.part { cursor: pointer; text-align: left; font: inherit; color: inherit; }
button.part:hover { box-shadow: inset 0 0 0 1px var(--ink); }
button.part small { font: 500 .72rem/1.3 var(--mono); color: var(--ink-2); }
@media (max-width: 560px) { .machine { grid-template-columns: 1fr; } .part.spacer { display: none; } }
.result { display: grid; gap: 10px; }
.big { font: 600 1.9rem/1 var(--mono); font-variant-numeric: tabular-nums; }
.big small { font: 500 .8rem/1 var(--mono); color: var(--ink-2); margin-left: 8px; }
.meter { height: 12px; background: var(--rule); border-radius: 1px; overflow: hidden; }
.meter i { display: block; height: 100%; width: calc(var(--v) * 100%); background: var(--ink); transition: width .15s; }
.fails { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; font: 500 .8rem/1.5 var(--mono); }
.fails li > div { display: grid; grid-template-columns: 4.9rem minmax(0, 1fr); align-items: baseline; }
.fails .lab { font-size: .64rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
.verdict { margin: 0; font-size: .95rem; }

/* figure 8: chart */
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font: 500 11px var(--mono); fill: var(--ink-2); }
.chart .lbl { fill: var(--ink); }

/* table */
.tablewrap { overflow-x: auto; margin: 6px 0 4px; }
.spec { border-collapse: collapse; width: 100%; font-size: .93rem; line-height: 1.35; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.spec th, .spec td { text-align: left; vertical-align: top; padding: 6px 12px 6px 0; }
.spec thead th { border-bottom: 1px solid var(--ink); font-weight: 600; }
.spec tbody th { font-weight: 400; color: var(--ink-2); width: 34%; }
.spec td { font-variant-numeric: tabular-nums; }
.spec td:last-child { font-weight: 600; padding-right: 0; }

.colophon { border-top: 1px solid var(--ink); margin-top: 50px; }
.colophon h2 { font-size: 1.05rem; margin-top: 18px; }
.colophon p { font-size: .92rem; line-height: 1.5; color: var(--ink); max-width: 74ch; }
.pageno { text-align: center; font-size: .9rem; margin-top: 34px; color: var(--ink-2); }
.noscript { max-width: 900px; margin: 0 auto 28px; padding: 12px 16px; background: var(--paper); font-size: .95rem; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .ln, .meter i { transition: none; } }
