/* Hallmark · macrostructure: bespoke (machine panel feeding a paper strip, under a pull cord)
 * tone: technical, tactile · anchor hue: oxide red on graphite · motion: physics of the cord only
 */
@font-face { font-family: "Sometype Mono"; src: url("/fonts/sometype-mono.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --ink: oklch(22% 0.012 250);
  --ink-2: oklch(30% 0.012 250);
  --line: oklch(40% 0.012 250);
  --text: oklch(93% 0.012 90);
  --text-2: oklch(76% 0.012 90);
  --red: oklch(58% 0.19 30);
  --red-2: oklch(46% 0.17 30);
  --blank: oklch(100% 0 0);
  --blank-ink: oklch(18% 0.01 250);
  --font: "Sometype Mono", ui-monospace, Menlo, Consolas, monospace;
  --ease-out: cubic-bezier(.2, .7, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: clip; background: var(--ink); color: var(--text); font: 400 14px/1.35 var(--font); }
body { display: flex; flex-direction: column; height: 100dvh; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

#stage { position: relative; flex: 1 1 auto; min-height: 0; background: var(--blank); overflow: clip; }
#stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: var(--blank); visibility: hidden; }
#stage iframe.front { visibility: visible; }

#cord { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
#knob { position: fixed; left: 0; top: 0; width: 76px; height: 96px; margin: -14px 0 0 -38px; display: grid; justify-items: center; align-content: start; padding-top: 14px; touch-action: none; cursor: grab; z-index: 21; -webkit-user-select: none; user-select: none; will-change: transform; }
#knob.held { cursor: grabbing; }
#knob svg { display: block; overflow: visible; margin-top: -2px; filter: drop-shadow(1px 3px 2px oklch(10% 0 0 / .35)); }
.neck { fill: var(--ink); }
.bead { fill: var(--red); }
.band { fill: var(--red-2); }
#hint { position: fixed; left: 0; top: 0; z-index: 20; padding: 5px 9px; background: var(--ink); color: var(--text); font-size: 14px; white-space: nowrap; pointer-events: none; transition: opacity .2s; }
#hint.gone { opacity: 0; }

#bar { flex: 0 0 auto; background: var(--ink); padding: 0 16px calc(8px + env(safe-area-inset-bottom)); position: relative; z-index: 15; border-top: 1px solid var(--line); }
#scrub { display: block; width: 100%; margin: 10px 0 6px; height: 24px; background: none; -webkit-appearance: none; appearance: none; cursor: pointer; touch-action: pan-y; }
#scrub::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(to right, var(--red) var(--done, 100%), var(--line) var(--done, 100%)); }
#scrub::-moz-range-track { height: 4px; background: var(--line); }
#scrub::-moz-range-progress { height: 4px; background: var(--red); }
#scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 24px; margin-top: -10px; background: var(--text); border: 0; border-radius: 2px; }
#scrub::-moz-range-thumb { width: 14px; height: 24px; background: var(--text); border: 0; border-radius: 2px; }
#scrub:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
.row { display: flex; align-items: center; gap: 10px; min-height: 30px; }
#readout { margin: 0; flex: 1 1 auto; min-width: 0; white-space: nowrap; font-weight: 600; font-variant-numeric: tabular-nums; }
#when { color: var(--text); margin-right: 4px; }
#subject { margin: 2px 0 6px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.35em; }
.row button { background: none; border: 1px solid var(--line); padding: 4px 9px; min-height: 30px; cursor: pointer; white-space: nowrap; transition: background-color .15s, border-color .15s; }
.row button:hover { background: var(--ink-2); border-color: var(--text-2); }
.row button:active { background: var(--line); }
.row button:focus-visible, .foot a:focus-visible, #end a:focus-visible, #end button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }
#play { background: var(--red); border-color: var(--red); color: oklch(99% 0 0); }
#play:hover { background: var(--red-2); border-color: var(--red-2); }
.foot { margin: 0; display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.foot a { color: inherit; text-underline-offset: 2px; }
@media (max-width: 460px) { #open { display: none; } .foot { justify-content: flex-start; } }

#end { position: absolute; left: 0; right: 0; top: 0; z-index: 10; padding: clamp(96px, 20vh, 200px) 24px 24px; max-width: 760px; color: var(--blank-ink); }
#end[hidden] { display: none; }
#end .words { margin: 0 56px 0 0; font: 600 clamp(36px, 9.5vw, 72px)/1.08 var(--font); letter-spacing: -.02em; text-wrap: balance; }
#end .links { margin: 28px 0 0; font-size: 22px; }
#end a { color: var(--red-2); text-underline-offset: 4px; }
#again { margin-top: 28px; padding: 12px 16px; min-height: 48px; background: var(--blank-ink); color: var(--blank); border: 0; cursor: pointer; transition: background-color .15s; }
#again:hover { background: var(--ink-2); }
#again:active { background: var(--line); }
