/*
 * A viewing booth. The page is the neutral grey a print is judged against, the well under the
 * picture is exactly mid grey (128), which is also what "no change" is in the difference view:
 * a picture the mark had not touched would vanish into it. Ink for everything said, one
 * signal colour (process magenta) for what the hand moves.
 */
@font-face { font-family: Archivo; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; src: url(fonts/archivo-latin-ext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Archivo; font-style: normal; font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; src: url(fonts/archivo-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --booth: #c8c8c8;
  --well: #808080;
  --ink: #151515;
  --ink-soft: #4a4a4a;
  --paper: #e9e9e9;
  --rule: rgba(21, 21, 21, 0.24);
  --signal: #d4006a;
  --desk: 21.5rem;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--booth);
  color: var(--ink);
  font: 400 0.9375rem/1.45 Archivo, "Helvetica Neue", Arial, sans-serif;
  font-stretch: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
a:hover { color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* Scrollbars of the booth: a thin line of ink, no buttons, nothing behind it. */
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: rgba(21, 21, 21, 0.42) transparent; }
}
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
::-webkit-scrollbar-thumb { background: rgba(21, 21, 21, 0.42); background-clip: content-box; border: 4px solid transparent; border-radius: 0; }
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background-color: var(--ink); }

/* ── The bar ─────────────────────────────────────────────── */
.bar { display: flex; align-items: baseline; gap: 0.5rem 1.75rem; flex-wrap: wrap; padding: 0.8rem 1.25rem 0.7rem; border-bottom: 1px solid var(--rule); }
.wordmark { font-weight: 800; font-stretch: 125%; font-size: 1.5rem; letter-spacing: -0.035em; line-height: 1; text-decoration: none; }
.wordmark:hover { color: var(--ink); }
.says { margin: 0; max-width: 46rem; color: var(--ink-soft); flex: 1 1 22rem; }
.bar nav { margin-left: auto; display: flex; gap: 1.25rem; font-stretch: 112%; font-weight: 600; font-size: 0.875rem; }

/* ── Booth and desk ──────────────────────────────────────── */
main { display: grid; grid-template-columns: minmax(0, 1fr) var(--desk); min-height: 0; }
.booth { display: grid; grid-template-rows: minmax(0, 1fr) auto auto; min-width: 0; min-height: 0; }
.well { background: var(--well); overflow: auto; display: grid; place-items: safe center; padding: 2.25rem; position: relative; }
.well.is-over { outline: 3px solid var(--signal); outline-offset: -3px; }
.sheet { grid-area: 1 / 1; position: relative; flex: none; isolation: isolate; cursor: crosshair; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.sheet.is-swipe { cursor: ew-resize; touch-action: pan-y; }
.sheet canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.sheet.is-sharp canvas { image-rendering: pixelated; }
/* Crop marks: where the picture ends, which the difference view would otherwise not show. */
.crop { position: absolute; width: 14px; height: 14px; pointer-events: none; opacity: 0.8; }
.crop::before, .crop::after { content: ""; position: absolute; background: var(--ink); }
.crop::before { width: 14px; height: 1px; }
.crop::after { width: 1px; height: 14px; }
.crop.tl { left: -22px; top: -22px; } .crop.tl::before { top: 21px; } .crop.tl::after { left: 21px; }
.crop.tr { right: -22px; top: -22px; } .crop.tr::before { top: 21px; } .crop.tr::after { left: -8px; }
.crop.bl { left: -22px; bottom: -22px; } .crop.bl::before { top: -8px; } .crop.bl::after { left: 21px; }
.crop.br { right: -22px; bottom: -22px; } .crop.br::before { top: -8px; } .crop.br::after { left: -8px; }
.divider { position: absolute; top: -10px; bottom: -10px; width: 1px; background: var(--signal); pointer-events: none; display: none; }
.divider span { position: absolute; top: 16px; font-size: 0.75rem; font-weight: 600; font-stretch: 112%; color: #fff; background: var(--signal); padding: 0.05rem 0.4rem; white-space: nowrap; }
.divider .left { right: 0; }
.divider .right { left: 1px; background: var(--ink); }
.busy { position: sticky; left: 0.9rem; bottom: 0.9rem; grid-area: 1 / 1; place-self: end start; max-width: min(34rem, 100%); z-index: 1; margin: 0; background: var(--ink); color: var(--paper); padding: 0.3rem 0.7rem; font-size: 0.8125rem; }
.busy[hidden] { display: none; }
.caption { margin: 0; padding: 0.55rem 1.25rem; border-top: 1px solid var(--rule); display: flex; gap: 0.3rem 1.5rem; flex-wrap: wrap; color: var(--ink-soft); font-size: 0.875rem; }
.caption b { color: var(--ink); font-weight: 600; }

/* The copies the mark is read from, as the browser made them. */
.strip { border-top: 1px solid var(--rule); padding: 0.7rem 1.25rem 0.9rem; min-width: 0; }
.strip-says { margin: 0 0 0.65rem; color: var(--ink-soft); font-size: 0.875rem; max-width: 68rem; }
.strip-says strong { color: var(--ink); font-weight: 700; font-stretch: 112%; margin-right: 0.35rem; }
.copies { list-style: none; margin: 0; padding: 0 0 0.35rem; display: flex; gap: 0.8rem; overflow-x: auto; }
.copies li { flex: 1 1 0; min-width: 6.6rem; }
.copies .thumb { height: 3.5rem; background: var(--well); display: grid; place-items: center; overflow: hidden; }
.copies canvas { display: block; max-width: 100%; max-height: 3.5rem; }
.copies .says { margin-top: 0.4rem; font-size: 0.8125rem; line-height: 1.25; }
.copies .said { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.15rem; font-weight: 600; font-size: 0.875rem; }
.copies small { display: block; color: var(--ink-soft); font-size: 0.8125rem; font-variant-numeric: tabular-nums; }
.dot { flex: none; width: 0.6rem; height: 0.6rem; border-radius: 50%; border: 1.5px solid var(--ink); }
[data-state="found"] .dot { background: var(--ink); }
[data-state="waiting"] .dot { border-style: dotted; }
[data-state="waiting"] .word { color: var(--ink-soft); font-weight: 400; }
[data-state="wrong"] .dot { border-color: var(--signal); background: var(--signal); }
[data-state="wrong"] .word { color: var(--signal); }

.desk { border-left: 1px solid var(--rule); overflow: auto; padding: 0.4rem 1.25rem 1.5rem; }
.desk section { padding: 1rem 0 1.1rem; border-bottom: 1px solid var(--rule); }
.desk section:last-of-type { border-bottom: 0; }
.desk h2 { margin: 0 0 0.6rem; font-size: 0.875rem; font-weight: 700; font-stretch: 112%; letter-spacing: -0.005em; }
.desk p { margin: 0.6rem 0 0; color: var(--ink-soft); }

.thumbs { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.thumbs button { all: unset; cursor: pointer; height: 3rem; display: block; outline: 1px solid var(--rule); background: var(--well); }
.thumbs button img { display: block; height: 3rem; width: auto; }
.thumbs button[aria-pressed="true"] { outline: 2px solid var(--signal); outline-offset: 2px; }
.thumbs button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.thumbs .own { display: grid; place-items: center; padding: 0 0.7rem; background: transparent; outline: 1px dashed var(--ink); font-size: 0.8125rem; font-weight: 600; line-height: 1.15; text-align: center; }
.thumbs .own:hover { background: var(--paper); }

.choice { display: inline-flex; border: 1px solid var(--ink); }
.choice button { all: unset; cursor: pointer; padding: 0.3rem 0.75rem; font-weight: 600; font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.choice button + button { border-left: 1px solid var(--ink); }
.choice button:hover { background: var(--paper); }
.choice button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.choice button:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.row { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.75rem; }
.row label { flex: 1; }
.row output { font-stretch: 80%; font-weight: 700; font-size: 1.0625rem; font-variant-numeric: tabular-nums; min-width: 3.4rem; text-align: right; }

input[type="range"] { appearance: none; -webkit-appearance: none; width: 100%; height: 1.5rem; background: transparent; margin: 0.35rem 0 0; cursor: ew-resize; }
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--ink); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--ink); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 0.95rem; height: 0.95rem; margin-top: calc(-0.475rem + 1px); border-radius: 50%; background: var(--signal); border: 0; }
input[type="range"]::-moz-range-thumb { width: 0.95rem; height: 0.95rem; border-radius: 50%; background: var(--signal); border: 0; }

.figures { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 0.3rem 1rem; }
.figures dt { color: var(--ink-soft); }
.figures dd { margin: 0; text-align: right; font-stretch: 80%; font-weight: 700; font-size: 1.0625rem; font-variant-numeric: tabular-nums; }

.key { display: block; width: 100%; margin-top: 0.3rem; padding: 0.4rem 0.55rem; font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--ink); border-radius: 0; }
.checks { list-style: none; margin: 0.7rem 0 0; padding: 0; }
.checks li { display: grid; grid-template-columns: 0.9rem 1fr; gap: 0 0.5rem; align-items: baseline; padding: 0.25rem 0; }
.checks .dot { align-self: center; }
.checks .said { grid-column: 2; font-weight: 600; }
.checks .said small { font-weight: 400; color: var(--ink-soft); font-size: 0.8125rem; font-variant-numeric: tabular-nums; margin-left: 0.4rem; }
.desk .lead { margin: 0.9rem 0 0; color: var(--ink); font-weight: 600; }

.install { font-size: 0.875rem; color: var(--ink-soft); padding-top: 1rem; margin: 0; line-height: 1.9; }
.install code { font: 600 0.875rem ui-monospace, "SF Mono", Menlo, Consolas, monospace; color: var(--ink); background: var(--paper); padding: 0.15rem 0.4rem; }

@media (max-width: 60rem) {
  body { display: block; }
  /* Stacked: the picture, then what the hand does with it, then the copies. */
  main { display: flex; flex-direction: column; }
  .booth { display: contents; }
  .well { order: 1; max-height: 86vh; padding: 1.75rem; }
  .caption { order: 2; }
  .desk { order: 3; border-left: 0; overflow: visible; }
  .strip { order: 4; }
  .bar nav { margin-left: 0; }
}
