/* /versions/ — the time machine (UX program run-09; versions/machine.js). One ink slab, like a
   screening room, in both colour schemes: the pictures of the site are the only colour on it,
   lemon marks what you hold (the line, the selected version, the play key). Text on the slab:
   #f2f0ea (16.9:1 on #141414) and #bdb9af (9.3:1); lemon #ffd23f (12.8:1). Every control is at
   least 44 px. The stage keeps its size from the first paint (aspect ratio by screen size), so
   nothing moves when the registry and the pictures arrive. */
.tm {
  --tm-bg: #141414;
  --tm-ink: #f2f0ea;
  --tm-ink-2: #bdb9af;
  --tm-line: rgba(255,255,255,.14);
  --tm-well: #232321;
  --tm-lemon: #ffd23f;
  --cut: 50%;
  position: relative;
  margin: 0 0 40px;
  padding: 20px 16px 18px;
  border-radius: var(--t-r-l);
  background: var(--tm-bg);
  color: var(--tm-ink);
  box-shadow: inset 0 -8px 0 rgba(0,0,0,.35), 0 24px 48px -28px rgba(0,0,0,.6);
}
@media (prefers-color-scheme: dark) {
  .tm { --tm-bg: #0c0c0b; --tm-well: #1d1d1b; box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), inset 0 -8px 0 rgba(0,0,0,.4); }
}
@media (min-width: 600px) { .tm { padding: 26px 26px 22px; } }
@media (scripting: none) { .tm { display: none; } }
.tm[data-state="failed"] .tm-body, .tm[data-state="failed"] .tm-reel { display: none; }
body.v2 .tm :focus-visible { outline: 3px solid var(--tm-lemon); outline-offset: 3px; }

.tm-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin-bottom: 16px; }
.tm-kicker { margin: 0; font: 600 .8125rem/1.3 var(--t-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--tm-lemon); }
.tm-news { margin: 0; flex: 1 1 280px; min-height: 2.8em; font-size: .9375rem; line-height: 1.4; color: var(--tm-ink-2); }
@media (min-width: 760px) { .tm-news { min-height: 1.4em; } }

.tm-body { display: grid; gap: 20px; }
@media (min-width: 1000px) {
  .tm-body { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 28px; align-items: start; }
}

/* The stage: a desktop picture is 16:10, a phone picture 780:1688 and at most 70 % of the window tall. */
.tm-view { min-width: 0; }
.tm-stage {
  position: relative; overflow: hidden; margin: 0 auto;
  width: 100%; aspect-ratio: 16 / 10;
  border-radius: 14px; background: var(--tm-well);
  box-shadow: 0 0 0 1px var(--tm-line);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
}
.tm[data-device="p"] .tm-stage { width: auto; height: min(64svh, 600px); aspect-ratio: 780 / 1688; border-radius: 22px; }
@media (max-width: 759px) { .tm:not([data-device]) .tm-stage { width: auto; height: min(64svh, 600px); aspect-ratio: 780 / 1688; border-radius: 22px; } }
.tm[data-compare="on"] .tm-stage { cursor: ew-resize; }

.tm-shot { position: absolute; inset: 0; }
.tm-shot img { pointer-events: none; -webkit-user-drag: none; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; opacity: 0; transition: opacity var(--t-base) var(--t-out); }
.tm-shot.is-ready img { opacity: 1; }
.tm-before { clip-path: inset(0 calc(100% - var(--cut)) 0 0); }
.tm[data-compare="off"] .tm-before,
.tm[data-compare="off"] .tm-handle,
.tm[data-compare="off"] .tm-tag-before { display: none; }

/* A missing picture: a plain panel with the version's number and why there is no picture. */
.tm-gap { position: absolute; inset: 0; display: none; flex-direction: column; justify-content: center; gap: 10px; padding: 24px; background: var(--tm-well); }
.tm-before .tm-gap { background: #2c2c29; }
.tm-shot.is-gap .tm-gap { display: flex; }
.tm-gap-n { margin: 0; font: 800 clamp(2.25rem, 6vw, 4.5rem)/.9 var(--t-display); letter-spacing: -.02em; color: var(--tm-ink); }
.tm-gap-t { margin: 0; max-width: 30ch; font-size: .9375rem; line-height: 1.4; color: var(--tm-ink-2); }
.tm[data-compare="on"] .tm-before .tm-gap { padding-right: calc(100% - var(--cut) + 16px); }
.tm[data-compare="on"] .tm-after .tm-gap { padding-left: calc(var(--cut) + 16px); align-items: flex-end; text-align: right; }
.tm[data-device="p"] .tm-gap-n { font-size: 2rem; }
.tm[data-device="p"] .tm-gap-t { font-size: .875rem; }
.tm-gap-t { overflow-wrap: anywhere; }

/* A small stage (a desktop picture on a phone, any phone picture): the stage is a size container,
   so below 480 px of stage width the tags lose « · before» / « · after» and the panel starts under
   the tags in smaller type; on a stage under 260 px tall (a desktop picture on a phone) the panel
   drops its big number, which the tag above already says. */
.tm-stage { container: tm-stage / size; }
@container tm-stage (max-width: 479px) {
  .tm .tm-stage .tm-tag-w { display: none; }
  .tm .tm-stage .tm-tag { top: 8px; padding: 6px 8px; }
  .tm .tm-stage .tm-gap { gap: 6px; padding: 46px 12px 12px; justify-content: flex-start; justify-content: safe center; }
  .tm .tm-stage .tm-gap-n { font-size: 1.5rem; font-size: clamp(1.125rem, 8cqw, 1.75rem); }
  .tm .tm-stage .tm-gap-t { font-size: .8125rem; line-height: 1.35; }
  /* Clear of the 48 px knob on the line. */
  .tm[data-compare="on"] .tm-stage .tm-before .tm-gap { padding-right: calc(100% - var(--cut) + 30px); }
  .tm[data-compare="on"] .tm-stage .tm-after .tm-gap { padding-left: calc(var(--cut) + 30px); }
}
@container tm-stage (max-height: 259px) {
  .tm .tm-stage .tm-gap-n { display: none; }
  .tm .tm-stage .tm-gap { padding-top: 42px; }
}

.tm-tag {
  position: absolute; top: 10px; z-index: 2; margin: 0; padding: 7px 10px; border-radius: 8px;
  background: rgba(20,20,20,.86); color: #fff; font: 600 .75rem/1 var(--t-mono); letter-spacing: .04em; white-space: nowrap;
  pointer-events: none;
}
.tm-tag-before { left: 10px; }
.tm[data-device="p"] .tm-tag-w { display: none; }
@media (max-width: 759px) { .tm:not([data-device]) .tm-tag-w { display: none; } }
.tm-tag-after { right: 10px; }
.tm[data-compare="off"] .tm-tag-after { left: 10px; right: auto; }

/* Two equal first screens (their `look` hashes match): a note at the foot of the stage says this
   first screen did not change, so a line that shows nothing new does not look broken. */
.tm-same {
  position: absolute; left: 50%; bottom: 12px; z-index: 4; transform: translateX(-50%);
  width: max-content; max-width: calc(100% - 24px); margin: 0; padding: 8px 12px; border-radius: 8px;
  background: rgba(20,20,20,.9); color: #fff; font: 600 .75rem/1.3 var(--t-mono); letter-spacing: .04em;
  text-align: center; pointer-events: none; box-shadow: 0 0 0 1px rgba(255,255,255,.18);
}
.tm-same[hidden], .tm[data-compare="off"] .tm-same, .tm[data-state="loading"] .tm-same { display: none; }

/* The line: a white rule with a lemon knob; the range input under it carries keyboard and screen readers. */
.tm-range {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.tm-handle { position: absolute; top: 0; bottom: 0; left: var(--cut); z-index: 3; width: 0; pointer-events: none; }
.tm-handle::before { content: ""; position: absolute; top: 0; bottom: 0; left: -1.5px; width: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25), 0 0 18px rgba(0,0,0,.35); }
.tm-handle i {
  position: absolute; top: 50%; left: 0; width: 48px; height: 48px; margin: -24px 0 0 -24px; border-radius: 50%;
  background: var(--tm-lemon); box-shadow: inset 0 -4px 0 rgba(0,0,0,.16), 0 6px 16px rgba(0,0,0,.4);
  transition: transform var(--t-slow) var(--t-spring);
}
.tm-handle i::before, .tm-handle i::after {
  content: ""; position: absolute; top: 50%; width: 9px; height: 9px; margin-top: -5px;
  border: solid #141414; border-width: 0 0 2.5px 2.5px;
}
.tm-handle i::before { left: 11px; transform: rotate(45deg); }
.tm-handle i::after { right: 11px; transform: rotate(-135deg); }
.tm-stage.is-dragging .tm-handle i { transform: scale(1.12); }
.tm-range:focus-visible + .tm-handle i { outline: 3px solid #fff; outline-offset: 3px; }

/* Under the stage: screen size and the run's pages. */
.tm-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-top: 14px; }
.tm-seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--tm-well); box-shadow: inset 0 0 0 1px var(--tm-line); }
.tm-seg-key, .tm-page {
  min-height: 44px; min-width: 44px; padding: 0 14px; border: 0; border-radius: var(--t-r-btn, 10px); background: transparent; color: var(--tm-ink-2);
  font: 600 .875rem/1 var(--t-display); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
body.v2 .tm-seg-key, body.v2 .tm-page { font: 600 .875rem/1 var(--t-display); }
body.v2 .tm-page { font-family: var(--t-mono); font-weight: 500; letter-spacing: .02em; }
.tm-seg-key[aria-pressed="true"] { background: var(--tm-ink); color: #141414; }
.tm-pages { display: flex; flex-wrap: wrap; gap: 6px; }
.tm-page { box-shadow: inset 0 0 0 1px var(--tm-line); }
.tm-page[aria-pressed="true"] { background: var(--tm-ink); color: #141414; box-shadow: none; }
@media (hover: hover) { .tm-seg-key:not([aria-pressed="true"]):hover, .tm-page:not([aria-pressed="true"]):hover { color: var(--tm-ink); } }

/* The version's words, keys and vote. */
.tm-info { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tm-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 0; font: 500 .8125rem/1.3 var(--t-mono); font-variant-numeric: tabular-nums; letter-spacing: .04em; color: var(--tm-ink-2); }
.tm-num { color: var(--tm-ink); font-weight: 600; }
.tm-live {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px 6px 9px; border-radius: 999px;
  background: var(--tm-ink); color: #141414; font: 600 .75rem/1 var(--t-mono); letter-spacing: .08em; text-transform: uppercase;
}
.tm-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--t-mint); }
.tm-title { margin: 0; font-size: 1.75rem; line-height: 1.02; font-weight: 800; letter-spacing: -.015em; text-wrap: balance; overflow-wrap: anywhere; }
@media (min-width: 600px) { .tm-title { font-size: 2.25rem; } }
.tm-summary { margin: 0; line-height: 1.45; color: var(--tm-ink-2); overflow-wrap: anywhere; }

.tm-keys { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 2px; }
.tm-key {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 16px 3px;
  border-radius: var(--t-r-btn, 10px); text-align: center; text-decoration: none;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.5), inset 0 -4px 0 rgba(0,0,0,.3);
  transition: transform var(--t-slow) var(--t-spring);
}
body.v2 a.tm-key { color: var(--tm-ink); font: 700 .9375rem/1.1 var(--t-display); }
body.v2 a.tm-key-primary { background: var(--tm-ink); color: #141414; box-shadow: inset 0 -4px 0 rgba(0,0,0,.18); }
@media (hover: hover) { .tm-key:hover { transform: translateY(-3px); } }
.tm-key:active { transform: translateY(2px) scale(.97); transition-duration: var(--t-fast); }

.tm-vote { margin-top: 6px; padding: 16px; border-radius: 16px; background: var(--tm-well); box-shadow: inset 0 0 0 1px var(--tm-line); }
.tm-vote[hidden] { display: none; }
.tm-vote-q { margin: 0 0 12px; font-weight: 700; font-size: 1.0625rem; line-height: 1.3; }
.tm-vote-keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tm-vote-keys[hidden] { display: none; }
.tm-vote-key {
  min-height: 48px; padding: 0 8px 3px; border: 0; border-radius: var(--t-r-btn, 10px); cursor: pointer;
  background: #2f2f2c; color: var(--tm-ink); box-shadow: inset 0 -4px 0 rgba(0,0,0,.35);
  transition: transform var(--t-slow) var(--t-spring); -webkit-tap-highlight-color: transparent;
}
body.v2 .tm-vote-key { font: 700 .9375rem/1.1 var(--t-display); }
body.v2 .tm-vote-key[data-vote="1"] { background: var(--t-mint); color: #141414; }
@media (hover: hover) { .tm-vote-key:hover { transform: translateY(-3px); } }
.tm-vote-key:active { transform: translateY(2px) scale(.97); transition-duration: var(--t-fast); }
.tm-crowd[hidden] { display: none; }
.tm-crowd-line { margin: 0; line-height: 1.45; color: var(--tm-ink); }
.tm-crowd-line:focus { outline: none; }
.tm-bar { display: flex; gap: 3px; height: 10px; margin-top: 12px; border-radius: 999px; overflow: hidden; }
.tm-bar[hidden] { display: none; }
.tm-bar i { flex: 0 0 0; min-width: 0; transition: flex-grow .7s var(--t-out); }
.tm-bar i[data-bar="1"] { background: var(--t-mint); }
.tm-bar i[data-bar="2"] { background: #8a877f; }
.tm-bar i[data-bar="3"] { background: var(--tm-ink); }

/* The reel: the play key and the strip of every version, oldest first. */
.tm-reel { display: flex; align-items: stretch; gap: 12px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--tm-line); }
.tm-play {
  flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  width: 92px; min-height: 44px; padding: 10px 8px 13px; border: 0; border-radius: 16px; cursor: pointer;
  background: var(--tm-lemon); color: #141414; box-shadow: inset 0 -5px 0 rgba(0,0,0,.18);
  transition: transform var(--t-slow) var(--t-spring); -webkit-tap-highlight-color: transparent;
}
body.v2 .tm-play { font: 700 .8125rem/1.15 var(--t-display); text-align: center; }
@media (hover: hover) { .tm-play:hover { transform: translateY(-3px); } }
.tm-play:active { transform: translateY(2px) scale(.97); transition-duration: var(--t-fast); }
@media (max-width: 599px) {
  .tm-reel { flex-direction: column; }
  .tm-play { width: 100%; flex-direction: row; min-height: 52px; padding: 0 16px 4px; gap: 10px; border-radius: 14px; }
}
.tm-play-icon { position: relative; width: 18px; height: 20px; }
.tm-play-icon::before { content: ""; position: absolute; inset: 0 0 0 3px; background: #141414; clip-path: polygon(0 0, 100% 50%, 0 100%); }
.tm.is-playing .tm-play-icon::before { inset: 0 2px; clip-path: polygon(0 0, 35% 0, 35% 100%, 0 100%, 0 0, 65% 0, 100% 0, 100% 100%, 65% 100%, 65% 0); }

.tm-strip {
  flex: 1 1 auto; min-width: 0; display: flex; gap: 10px; padding: 4px 4px 8px; margin: -4px 0;
  overflow-x: auto; scroll-snap-type: x proximity; overscroll-behavior-x: contain; scrollbar-width: thin;
  scrollbar-color: #4a4a46 transparent;
}
.tm-tile {
  position: relative; flex: none; display: flex; flex-direction: column; gap: 7px; width: 132px; padding: 6px 6px 8px;
  border-radius: 14px; cursor: pointer; scroll-snap-align: center; color: var(--tm-ink-2);
  transition: transform var(--t-slow) var(--t-spring), background var(--t-base) var(--t-out);
}
@media (min-width: 600px) { .tm-tile { width: 150px; } }
.tm-tile[aria-selected="true"] { background: var(--tm-well); color: var(--tm-ink); box-shadow: inset 0 0 0 2px var(--tm-lemon); }
@media (hover: hover) { .tm-tile[role="option"]:hover { transform: translateY(-3px); color: var(--tm-ink); } }
.tm-thumb { position: relative; display: block; aspect-ratio: 16 / 10; border-radius: 9px; overflow: hidden; background: var(--tm-well); box-shadow: 0 0 0 1px var(--tm-line); }
.tm-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.tm-thumb-n { position: absolute; inset: 0; display: none; align-items: center; justify-content: center; font: 800 1.75rem/1 var(--t-display); letter-spacing: -.02em; color: var(--tm-ink-2); }
.tm-thumb.is-empty img { display: none; }
.tm-thumb.is-empty .tm-thumb-n, .tm-next .tm-thumb-n { display: flex; }
.tm-cap { display: flex; justify-content: space-between; gap: 6px; padding: 0 2px; font: 500 .75rem/1.2 var(--t-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tm-cap-n { font-weight: 600; color: var(--tm-ink); }
.tm-dot { position: absolute; top: 1px; right: 1px; display: none; width: 14px; height: 14px; border-radius: 50%; background: var(--tm-lemon); box-shadow: 0 0 0 3px var(--tm-bg); }
.tm-tile.is-new .tm-dot { display: block; }
.tm-next { cursor: default; }
.tm-next .tm-thumb { background: transparent; box-shadow: none; outline: 2px dashed #4a4a46; outline-offset: -2px; }

/* While the registry loads: the slab, a blank stage and a strip of three blank tiles hold the room. */
.tm[data-state="loading"] .tm-info, .tm[data-state="loading"] .tm-controls, .tm[data-state="loading"] .tm-handle,
.tm[data-state="loading"] .tm-tag, .tm[data-state="loading"] .tm-play { visibility: hidden; }
.tm-strip { min-height: 124px; }
@media (max-width: 999px) { .tm-info { min-height: 340px; } }

@media (prefers-reduced-motion: reduce) {
  .tm-key, .tm-key:hover, .tm-key:active, .tm-vote-key, .tm-vote-key:hover, .tm-vote-key:active, .tm-play, .tm-play:hover,
  .tm-play:active, .tm-tile, .tm-tile:hover, .tm-handle i { transform: none !important; transition: none !important; }
  .tm-shot img, .tm-bar i { transition: none; }
}
