/* ==========================================================================
   Fonts (self-hosted, SIL Open Font License; see /fonts/LICENSES.txt)
   ========================================================================== */
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-roman.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("/fonts/fraunces-italic.woff2") format("woff2");
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("/fonts/martian-mono.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Tokens. Every colour on the site is one of these.
   ========================================================================== */
:root {
  /* the panel: warm near-black */
  --ink: #14110e;
  --ink-raised: #1d1915;
  --ink-line: #352e26;

  /* the silkscreen: bone white */
  --bone: #ece5d5;
  --bone-dim: #b3aa98;
  --bone-faint: #70685b;
  --bone-wash: rgba(236, 229, 213, 0.08);

  /* the one hot colour. Used for: the key, the main action, errors. */
  --signal: #ff4d1a;
  --signal-deep: #b8300b;
  --signal-ink: #1b0a03;

  /* the MIDI instrument: cooler panel, phosphor display */
  --cool: #0d1413;
  --cool-raised: #131c1a;
  --cool-line: #24332f;
  --phosphor: #74e0c8;
  --phosphor-dim: #4f9c8b;
  --phosphor-deep: #2c6558;
  --phosphor-ink: #03110d;
  --phosphor-wash: rgba(116, 224, 200, 0.09);

  --shade: rgba(9, 7, 5, 0.84);

  --font-display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Martian Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --top-h: 3.25rem;
  --gutter: clamp(1.25rem, 5vw, 4.5rem);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-settle: cubic-bezier(0.2, 1.25, 0.3, 1);

  color-scheme: dark;
}

/* Numbers written by scroll.js. Registered as non-inheriting so that changing
   one restyles a single element instead of its whole subtree. */
@property --enter { syntax: "<number>"; inherits: false; initial-value: 1; }
@property --leave { syntax: "<number>"; inherits: false; initial-value: 0; }
@property --rail { syntax: "<number>"; inherits: false; initial-value: 0; }

/* ==========================================================================
   Base
   ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--ink);
  scrollbar-color: var(--bone-faint) var(--ink);
  scroll-behavior: smooth;
  scroll-padding-top: var(--top-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  /* no background here: the page colour is on <html>, so the cool wash
     (.tint, z-index -1) can sit between it and the content */
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3, p, dl, dd, figure { margin: 0; }
a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
canvas { display: block; }
em { font-style: italic; }
[hidden] { display: none !important; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--bone);
  outline-offset: 3px;
}

::selection { background: var(--signal); color: var(--signal-ink); }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: fixed;
  left: 0.75rem; top: 0.75rem;
  z-index: 50;
  padding: 0.6rem 0.9rem;
  background: var(--bone);
  color: var(--ink);
  font: 500 0.75rem/1 var(--font-mono);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* The cool wash that fades in behind the MIDI station. Opacity only, so the
   compositor handles it without repainting the page. */
.tint {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--cool);
  opacity: var(--cool-mix, 0);
  pointer-events: none;
}

/* ==========================================================================
   Small shared parts
   ========================================================================== */

/* Silkscreen label: "01 KEY FINDER" */
.label {
  display: flex;
  align-items: center;
  gap: 0.75em;
  font: 500 0.6875rem/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.label__n {
  display: inline-grid;
  place-items: center;
  min-width: 2.1em;
  padding: 0.42em 0.4em 0.36em;
  border: 1px solid currentColor;
  color: var(--signal);
  letter-spacing: 0.06em;
}
.label--cool .label__n { color: var(--phosphor); }

.lede {
  max-width: 34rem;
  color: var(--bone-dim);
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.1875rem);
  line-height: 1.5;
}

.fine {
  max-width: 34rem;
  color: var(--bone-dim);
  font-size: 0.8125rem;
  line-height: 1.5;
}

/* Buttons: a keycap. Flat face, hard bottom edge, travels when pressed. */
.btn {
  --face: var(--bone);
  --edge: var(--bone-faint);
  --text: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6em;
  min-height: 2.875rem;
  padding: 0.85em 1.5em 0.8em;
  border: 0;
  border-radius: 2px;
  background: var(--face);
  color: var(--text);
  box-shadow: 0 4px 0 var(--edge);
  font: 600 0.75rem/1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.08s ease-out, box-shadow 0.08s ease-out, filter 0.15s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--edge); }
.btn[disabled],
.btn[aria-disabled="true"] {
  --face: var(--ink-line);
  --edge: var(--ink-raised);
  --text: var(--bone-faint);
  cursor: not-allowed;
  filter: none;
}
.btn[disabled]:active { transform: none; box-shadow: 0 4px 0 var(--edge); }
.btn--signal { --face: var(--signal); --edge: var(--signal-deep); --text: var(--signal-ink); }
.btn--cool { --face: var(--phosphor); --edge: var(--phosphor-deep); --text: var(--phosphor-ink); }
.station--midi .btn--cool[disabled] { --face: var(--cool-line); --edge: var(--cool-raised); --text: var(--phosphor-dim); }
.btn--ghost {
  --face: transparent;
  --text: var(--bone);
  box-shadow: inset 0 0 0 1px var(--bone-faint);
}
.btn--ghost:active { transform: none; box-shadow: inset 0 0 0 1px var(--bone); }
.btn--big { min-height: 3.5rem; padding-inline: 2.2em; font-size: 0.8125rem; }
.btn--wide { width: 100%; }

.textbtn {
  padding: 0.5em 0;
  border: 0;
  background: none;
  color: var(--bone-dim);
  font: 500 0.6875rem/1.2 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-color: var(--bone-faint);
  text-underline-offset: 0.35em;
  cursor: pointer;
}
.textbtn:hover { color: var(--bone); text-decoration-color: currentColor; }

/* Sharp and flat signs, drawn rather than borrowed from a system font. */
.acc {
  display: inline-block;
  width: 0.5em;
  height: 0.72em;
  margin-left: 0.06em;
  vertical-align: 0.16em;
  overflow: visible;
}
.acc path { fill: none; stroke: currentColor; }
.acc .acc__thin { stroke-width: 0.9; }
.acc .acc__thick { stroke-width: 1.8; }
.acc .acc__bowl { stroke-width: 1.15; stroke-linejoin: round; }

/* ==========================================================================
   Top strip
   ========================================================================== */
.top {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  height: var(--top-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 var(--gutter);
  background: var(--ink);
  border-bottom: 1px solid var(--ink-line);
}
.top::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--cool);
  opacity: var(--cool-mix, 0);
  pointer-events: none;
}
.top > * { position: relative; }

.mark {
  font: 700 0.75rem/1 var(--font-mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.top__right { display: flex; align-items: center; gap: clamp(0.9rem, 3vw, 1.75rem); flex-shrink: 0; }

/* Free tries: five pilot lamps */
.tries {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--bone-dim);
  font: 500 0.625rem/1 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tries__lamps { display: flex; gap: 4px; }
.tries__lamps i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-line);
  box-shadow: inset 0 0 0 1px var(--bone-faint);
}
.tries__lamps i.is-lit { background: var(--signal); box-shadow: none; }
.tries.is-paid .tries__lamps { display: none; }
.tries__text { display: none; }
@media (min-width: 620px) { .tries__text { display: inline; } }

/* ==========================================================================
   Rail: a fader that follows the scroll (wide screens only)
   ========================================================================== */
.rail { display: none; }
@media (min-width: 1180px) and (min-height: 620px) {
  :root { --gutter: 6.5rem; }
  .rail {
    --row: 2rem;
    position: fixed;
    left: 1.1rem;
    top: 50%;
    z-index: 15;
    display: grid;
    grid-auto-rows: var(--row);
    transform: translateY(-50%);
    padding-left: 0.95rem;
  }
  .rail__track {
    position: absolute;
    left: 3px; top: calc(var(--row) / 2); bottom: calc(var(--row) / 2);
    width: 1px;
    background: var(--bone-faint);
  }
  .rail__cap {
    position: absolute;
    left: -3px; top: -5px;
    width: 7px; height: 11px;
    background: var(--signal);
    transform: translate3d(0, calc(var(--rail, 0) * var(--row)), 0);
    will-change: transform;
  }
  .rail.is-cool .rail__cap { background: var(--phosphor); }
  .rail a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--bone-faint);
    font: 500 0.5625rem/1 var(--font-mono);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
  }
  .rail a:hover,
  .rail a:focus-visible,
  .rail a.is-here { color: var(--bone); }
  .rail__name { opacity: 0; transition: opacity 0.2s; }
  .rail a:hover .rail__name,
  .rail a:focus-visible .rail__name,
  .rail a.is-here .rail__name { opacity: 1; }
}

/* ==========================================================================
   Stations
   ========================================================================== */
.station {
  position: relative;
  padding: clamp(4.5rem, 11vh, 8rem) var(--gutter);
}
.station__inner {
  max-width: 76rem;
  margin: 0 auto;
  /* --enter runs 0 -> 1 as the station scrolls into view (set from scroll.js) */
  transform: translate3d(0, calc((1 - var(--enter, 1)) * 3.5rem), 0);
  opacity: calc(0.12 + var(--enter, 1) * 0.88);
}
.title {
  font: 400 clamp(2.4rem, 1.6rem + 4.4vw, 5.25rem)/0.98 var(--font-display);
  letter-spacing: -0.02em;
}
.title em { font-weight: 300; }

/* ---------- 01 Key finder ---------- */
.station--key {
  min-height: 100svh;
  padding-top: calc(var(--top-h) + 1.25rem);
  padding-bottom: 3.5rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  gap: 1rem;
  overflow: hidden;
}

.wheel {
  --size: min(86vw, 40svh);
  position: relative;
  justify-self: center;
  width: var(--size);
  aspect-ratio: 1;
  margin-top: 0.75rem;
  /* --leave runs 0 -> 1 as the first screen scrolls away */
  transform: translate3d(0, calc(var(--leave, 0) * 22vh), 0) scale(calc(1 - var(--leave, 0) * 0.14));
  opacity: calc(1 - var(--leave, 0) * 0.85);
  will-change: transform, opacity;
}
.wheel__disc {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.wheel__disc svg { display: block; width: 100%; height: 100%; overflow: visible; }

/* The fixed pointer the wheel turns under. */
.wheel__index {
  position: absolute;
  left: 50%; top: -0.9rem;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 3px;
  transform: translateX(-50%);
  color: var(--signal);
  font: 600 0.5rem/1 var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.wheel__index::after {
  content: "";
  width: 0; height: 0;
  border: 6px solid transparent;
  border-top: 9px solid var(--signal);
  border-bottom: 0;
}

.w-ring { fill: none; stroke: var(--ink-line); stroke-width: 1; }
.w-tick { stroke: var(--bone-faint); stroke-width: 1.5; }
.w-tick--long { stroke: var(--bone-dim); stroke-width: 2; }
.w-seg {
  fill: transparent;
  stroke: var(--bone-faint);
  stroke-width: 1.5;
  transition: fill 0.5s var(--ease-out), stroke 0.5s var(--ease-out);
}
.w-slot { color: var(--bone-dim); transition: color 0.5s var(--ease-out); }
.w-name { font-family: var(--font-display); font-weight: 400; fill: currentColor; }
.w-code { font-family: var(--font-mono); font-weight: 500; fill: var(--bone-faint); letter-spacing: 0.06em; transition: fill 0.5s var(--ease-out); }
.w-acc path { fill: none; stroke: currentColor; }
.w-slot.is-near .w-seg { fill: var(--bone-wash); stroke: var(--bone); }
.w-slot.is-near { color: var(--bone); }
.w-slot.is-near .w-code { fill: var(--bone-dim); }
.w-slot.is-on .w-seg { fill: var(--signal); stroke: var(--signal); }
.w-slot.is-on { color: var(--signal-ink); }
.w-slot.is-on .w-code { fill: var(--signal-ink); }
.w-hub { fill: none; stroke: var(--bone-faint); stroke-width: 1.5; }
.w-hub--fill { fill: var(--ink); }
.w-petal {
  fill: var(--bone-faint);
  transform: scale(var(--v, 0));
  transition: transform 0.9s var(--ease-settle), fill 0.5s;
}
.w-petals { transition: transform 0.9s var(--ease-settle); }
.w-petals.is-minor { transform: rotate(-90deg); }
.w-petal.is-tonic { fill: var(--signal); }
.w-petal.is-scale { fill: var(--bone-dim); }

.drop {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1.25rem;
  min-width: 0;
  padding: 1.1rem 1rem 1rem;
}
.drop__corner {
  position: absolute;
  width: 18px; height: 18px;
  border: 0 solid var(--bone-faint);
  transition: transform 0.25s var(--ease-out), border-color 0.25s;
  pointer-events: none;
}
.drop__corner--tl { left: 0; top: 0; border-width: 1.5px 0 0 1.5px; }
.drop__corner--tr { right: 0; top: 0; border-width: 1.5px 1.5px 0 0; }
.drop__corner--bl { left: 0; bottom: 0; border-width: 0 0 1.5px 1.5px; }
.drop__corner--br { right: 0; bottom: 0; border-width: 0 1.5px 1.5px 0; }
.drop.is-over .drop__corner { border-color: var(--signal); }
.drop.is-over .drop__corner--tl { transform: translate(8px, 8px); }
.drop.is-over .drop__corner--tr { transform: translate(-8px, 8px); }
.drop.is-over .drop__corner--bl { transform: translate(8px, -8px); }
.drop.is-over .drop__corner--br { transform: translate(-8px, -8px); }

.drop__body { min-width: 0; align-self: center; }
.pane { display: none; }
.drop[data-state="idle"] .pane--idle,
.drop[data-state="busy"] .pane--busy,
.drop[data-state="result"] .pane--result,
.drop[data-state="error"] .pane--error { display: block; }

.hero {
  padding-bottom: 0.1em; /* room for the italic descenders of "Let go." */
  font: 400 clamp(3.6rem, 2rem + 12vw, 10.5rem)/0.86 var(--font-display);
  letter-spacing: -0.035em;
}
.hero__over { display: none; font-style: italic; font-weight: 300; color: var(--signal); }
.drop.is-over .hero__rest { display: none; }
.drop.is-over .hero__over { display: inline; }
.pane--idle .lede { margin-top: 1.25rem; }
.pick { margin-top: 1.6rem; display: grid; justify-items: start; gap: 1.1rem; }
.pick__input {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
}
.pick__input:focus-visible + .btn { outline: 2px solid var(--bone); outline-offset: 3px; }

.busy__status {
  font: 300 italic clamp(2.4rem, 1.5rem + 6vw, 5.5rem)/1 var(--font-display);
  letter-spacing: -0.02em;
}
.busy__file {
  margin: 1rem 0 1.25rem;
  color: var(--bone-dim);
  font: 400 0.75rem/1.4 var(--font-mono);
  overflow-wrap: anywhere;
}

/* The readout */
.readout {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-family: var(--font-display);
  line-height: 0.84;
}
.readout__tonic {
  font-size: clamp(6rem, min(27vw, 24svh), 15rem);
  font-weight: 400;
  letter-spacing: -0.04em;
  margin-left: -0.04em;
}
/* At this size the sign sits like a superscript, top level with the capital. */
.readout__tonic .acc { width: 0.27em; height: 0.39em; vertical-align: 0.33em; margin-left: 0.03em; }
.readout__tonic .acc .acc__thin { stroke-width: 0.5; }
.readout__tonic .acc .acc__thick { stroke-width: 1.45; }
.readout__tonic .acc .acc__bowl { stroke-width: 0.85; }
.readout__tonic .acc--flat { width: 0.3em; height: 0.46em; vertical-align: 0.27em; margin-left: 0; }
.readout__mode {
  font-size: clamp(2.4rem, min(9.5vw, 8.5svh), 5.25rem);
  font-style: italic;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--signal);
  padding-bottom: 0.12em;
}

.specs {
  display: grid;
  grid-template-columns: auto auto;
  justify-content: start;
  gap: 1rem 2.25rem;
  margin-top: 1.2rem;
}
.specs__item--wide { grid-column: 1 / -1; }
.specs dt {
  margin-bottom: 0.55rem;
  color: var(--bone-dim);
  font: 500 0.5938rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.specs dd {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  font: 500 1.0625rem/1 var(--font-mono);
  letter-spacing: 0.02em;
}
.specs__word { color: var(--bone-dim); font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase; }
.meter { display: inline-flex; gap: 2px; }
.meter i { width: 5px; height: 14px; background: var(--ink-line); }
.meter i.is-lit { background: var(--signal); }
.scale { gap: 0.2rem 0.85rem !important; }
.scale span { white-space: nowrap; }

.alts { margin-top: 1.25rem; }
.alts__label {
  margin-bottom: 0.7rem;
  color: var(--bone-dim);
  font: 500 0.5938rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.alts__list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.alt {
  display: inline-flex;
  align-items: baseline;
  gap: 0.65em;
  min-height: 2.5rem;
  padding: 0.55em 0.65em;
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  background: transparent;
  color: var(--bone);
  font: 500 0.6875rem/1 var(--font-mono);
  letter-spacing: 0.02em;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.alt:hover { border-color: var(--bone); }
.alt small { color: var(--bone-dim); font-size: 0.5938rem; letter-spacing: 0.06em; }
.alt[aria-pressed="true"] { background: var(--bone); border-color: var(--bone); color: var(--ink); }
.alt[aria-pressed="true"] small { color: var(--ink-line); }

.after {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 2rem;
  margin-top: 1.3rem;
}
.cue {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  color: var(--bone);
  font: 500 0.9375rem/1.3 var(--font-body);
  text-decoration: none;
}
.cue__arrow {
  display: grid;
  place-items: center;
  width: 2.25rem; height: 2.25rem;
  border: 1px solid var(--phosphor-dim);
  border-radius: 50%;
  color: var(--phosphor);
  animation: nudge 1.8s ease-in-out infinite;
}
.cue__count { color: var(--bone-dim); }
.cue:hover .cue__arrow { background: var(--phosphor); color: var(--phosphor-ink); border-color: var(--phosphor); }
@keyframes nudge {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(3px); }
}

/* The reveal: the wheel settles, then the key comes up out of the panel. */
@keyframes rise {
  from { clip-path: inset(0 -20% 100% -20%); transform: translate3d(0, 0.32em, 0); }
  to { clip-path: inset(-20% -20% -20% -20%); transform: none; }
}
@keyframes arrive {
  from { opacity: 0; transform: translate3d(0, 0.8rem, 0); }
  to { opacity: 1; transform: none; }
}
@keyframes swap {
  from { opacity: 0; transform: translate3d(0, 0.12em, 0); }
  to { opacity: 1; transform: none; }
}
.drop.is-revealing .readout__tonic { animation: rise 0.95s var(--ease-out) 0.55s both; }
.drop.is-revealing .readout__mode { animation: rise 0.8s var(--ease-out) 0.85s both; }
.drop.is-revealing .specs__item { animation: arrive 0.55s var(--ease-out) both; }
.drop.is-revealing .specs__item:nth-child(1) { animation-delay: 1.25s; }
.drop.is-revealing .specs__item:nth-child(2) { animation-delay: 1.37s; }
.drop.is-revealing .specs__item:nth-child(3) { animation-delay: 1.49s; }
.drop.is-revealing .alts { animation: arrive 0.55s var(--ease-out) 1.75s both; }
.drop.is-revealing .after { animation: arrive 0.55s var(--ease-out) 2.05s both; }
.drop.is-swapping .readout__tonic,
.drop.is-swapping .readout__mode { animation: swap 0.28s var(--ease-out) both; }

.error__title { font: 300 italic clamp(2.2rem, 1.4rem + 5vw, 4.5rem)/1 var(--font-display); letter-spacing: -0.02em; }
.error__text { max-width: 30rem; margin-top: 1rem; color: var(--bone-dim); font-size: 1.0625rem; }
.error__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; margin-top: 1.6rem; }

/* The tape: where the waveform draws itself */
.tape { min-width: 0; }
.tape__wave { width: 100%; height: 3.5rem; }
.tape__meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  min-height: 1.1em;
  margin-top: 0.5rem;
  color: var(--bone-dim);
  font: 400 0.625rem/1.1 var(--font-mono);
  letter-spacing: 0.08em;
}
.tape__meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tape__meta span:last-child { flex-shrink: 0; }

.deal {
  position: absolute;
  left: var(--gutter); right: var(--gutter); bottom: 1.15rem;
  display: flex;
  gap: 0.9em;
  color: var(--bone-dim);
  font: 500 0.5938rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
}
.deal span { color: var(--bone-faint); }

@media (min-width: 900px) {
  .station--key {
    grid-template-columns: minmax(0, 1fr) var(--wheel);
    --wheel: min(44vw, calc(100svh - var(--top-h) - 7rem));
    align-content: stretch;
    align-items: center;
    column-gap: clamp(1rem, 3vw, 3rem);
    padding-right: clamp(1rem, 3vw, 3rem);
  }
  .wheel {
    --size: var(--wheel);
    grid-column: 2;
    grid-row: 1;
    margin-top: 0;
    transform: translate3d(0, calc(var(--leave, 0) * 26vh), 0) scale(calc(1 - var(--leave, 0) * 0.1));
  }
  .drop {
    grid-column: 1;
    grid-row: 1;
    align-self: stretch;
    padding: 1.6rem 1.75rem 1.4rem;
    min-height: min(42rem, calc(100svh - var(--top-h) - 6rem));
  }
  /* The big type is allowed to run over the edge of the wheel. */
  .hero, .readout { position: relative; z-index: 2; }
  .tape__wave { height: 4.25rem; }
  .wheel__index { top: -1.25rem; font-size: 0.5625rem; }
}

/* ---------- 02 MIDI finder ---------- */
.station--midi { padding-top: clamp(5rem, 14vh, 9rem); }
.midi__head {
  display: grid;
  gap: 1.25rem 3rem;
  margin: 1.5rem 0 2.25rem;
}
.midi__head .title em { color: var(--phosphor); }
@media (min-width: 900px) {
  .midi__head { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: end; }
}

.roll { border: 1px solid var(--cool-line); background: var(--cool-raised); }
.roll__strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--cool-line);
  font: 400 0.6875rem/1.3 var(--font-mono);
  letter-spacing: 0.06em;
}
.roll__source { display: flex; gap: 0.9rem; min-width: 0; }
.roll__source span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.roll__tag { color: var(--phosphor); letter-spacing: 0.16em; text-transform: uppercase; flex-shrink: 0; }
.roll__facts { color: var(--bone-dim); white-space: nowrap; }

.roll__view {
  position: relative;
  height: clamp(15rem, 46vh, 24rem);
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--cool);
  overscroll-behavior-x: contain;
  scrollbar-color: var(--phosphor-deep) var(--cool-raised);
  scrollbar-width: thin;
}
.roll__view:focus-visible { outline-offset: -2px; outline-color: var(--phosphor); }
/* The track is as wide as the whole tune; the canvas is one screen wide and
   stays pinned while the track scrolls underneath it. */
.roll__track { position: relative; min-width: 100%; height: 100%; }
.roll__canvas { position: sticky; left: 0; width: 100%; height: 100%; }
.roll__empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.25rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--bone-dim);
}
.roll__empty p { max-width: 24rem; }
.roll:not([data-state="empty"]) .roll__empty { display: none; }

.transport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  padding: 1rem;
  border-top: 1px solid var(--cool-line);
}
.tbtn {
  display: inline-flex;
  align-items: center;
  gap: 0.75em;
  min-width: 6.4rem;
  min-height: 2.875rem;
  padding: 0 1.1em;
  border: 1px solid var(--phosphor-dim);
  border-radius: 2px;
  background: transparent;
  color: var(--phosphor);
  font: 600 0.75rem/1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.tbtn:hover:not([disabled]) { background: var(--phosphor-wash); }
.tbtn[disabled] { border-color: var(--cool-line); color: var(--phosphor-deep); cursor: not-allowed; }
.tbtn__glyph {
  width: 0; height: 0;
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent currentColor;
}
.tbtn[aria-pressed="true"] { background: var(--phosphor); color: var(--phosphor-ink); border-color: var(--phosphor); }
.tbtn[aria-pressed="true"] .tbtn__glyph { width: 10px; height: 10px; border: 0; background: currentColor; }
.clock {
  font: 500 0.8125rem/1 var(--font-mono);
  letter-spacing: 0.04em;
  color: var(--bone);
  min-width: 10.5em;
  font-variant-numeric: tabular-nums;
}

/* A slide switch */
.switch { display: inline-flex; align-items: center; gap: 0.8rem; cursor: pointer; margin-right: auto; }
.switch__input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.switch__track {
  position: relative;
  width: 2.75rem; height: 1.5rem;
  border: 1px solid var(--phosphor-dim);
  border-radius: 2px;
  background: var(--cool);
  flex-shrink: 0;
}
.switch__thumb {
  position: absolute;
  left: 2px; top: 2px; bottom: 2px;
  width: 1.1rem;
  background: var(--phosphor-dim);
  transition: transform 0.16s var(--ease-out), background-color 0.16s;
}
.switch__input:checked + .switch__track .switch__thumb { transform: translateX(1.3rem); background: var(--phosphor); }
.switch__input:focus-visible + .switch__track { outline: 2px solid var(--phosphor); outline-offset: 3px; }
.switch__input:disabled + .switch__track { border-color: var(--cool-line); }
.switch__input:disabled + .switch__track .switch__thumb { background: var(--cool-line); }
.switch__input:disabled ~ .switch__text { color: var(--bone-faint); }
.switch__text { font: 500 0.75rem/1.2 var(--font-mono); letter-spacing: 0.05em; }
.switch__text .acc { vertical-align: 0.28em; }
.roll__note { min-height: 1.4em; padding: 0 1rem 0.9rem; color: var(--bone-dim); font-size: 0.8125rem; }
.roll__note:empty { display: none; }

/* ---------- 03 Price ---------- */
.station--price { padding-block: clamp(6rem, 20vh, 12rem); }
.price {
  max-width: 14ch;
  margin: 1.75rem 0 2.5rem;
  font: 400 clamp(2.9rem, 1.6rem + 7vw, 7.5rem)/0.94 var(--font-display);
  letter-spacing: -0.03em;
}
.price em { font-weight: 300; color: var(--signal); }
.buy { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.75rem; margin-bottom: 1.5rem; }
.buy__state { font: 500 0.75rem/1.4 var(--font-mono); letter-spacing: 0.05em; color: var(--bone-dim); }
.buy__state:empty { display: none; }
/* A place to type a key, for anyone who already has one */
.keyrow { display: grid; gap: 0.6rem; max-width: 34rem; margin-top: 2.25rem; padding-top: 1.5rem; border-top: 1px solid var(--ink-line); }
.keyrow__label {
  font: 500 0.625rem/1 var(--font-mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.keyrow__line { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: stretch; }
.keyrow__line .field__input { flex: 1 1 15rem; min-width: 0; width: auto; }
.keyrow__line .btn { flex: 0 0 auto; }
.station--price.is-paid .buy__state { color: var(--bone); }

/* ---------- 04 FAQ + foot ---------- */
.station--faq { padding-bottom: 2rem; }
.faq { max-width: 46rem; margin-top: 1.75rem; border-top: 1px solid var(--ink-line); }
.faq details { border-bottom: 1px solid var(--ink-line); }
.faq summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding: 1.15rem 0;
  font: 400 clamp(1.2rem, 1.05rem + 0.7vw, 1.6rem)/1.2 var(--font-display);
  letter-spacing: -0.01em;
  cursor: pointer;
  list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex-shrink: 0;
  width: 14px; height: 14px;
  background:
    linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat;
  color: var(--signal);
  transition: transform 0.2s var(--ease-out);
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { max-width: 40rem; padding: 0 2.5rem 1.4rem 0; color: var(--bone-dim); }

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem 2rem;
  max-width: 76rem;
  margin: clamp(4rem, 12vh, 7rem) auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--ink-line);
  color: var(--bone-dim);
  font: 500 0.625rem/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.foot__links { display: flex; gap: 1.75rem; }
.foot__links a { padding: 0.6em 0; text-underline-offset: 0.35em; text-decoration-color: var(--bone-faint); }
.foot__links a:hover { color: var(--bone); }

/* ==========================================================================
   Account panel (sign up, log in, 2FA, reset, settings)
   ========================================================================== */
.panel {
  width: min(27rem, calc(100vw - 1.5rem));
  max-height: calc(100svh - 1.5rem);
  margin: auto;
  padding: 0;
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  background: var(--ink-raised);
  color: var(--bone);
  overflow: hidden;
}
.panel[open] { display: flex; flex-direction: column; animation: panel-in 0.28s var(--ease-out); }
.panel::backdrop { background: var(--shade); }
@keyframes panel-in {
  from { opacity: 0; transform: translate3d(0, 1rem, 0); }
  to { opacity: 1; transform: none; }
}
.panel__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.8rem 0.8rem 0.8rem 1.25rem;
  border-bottom: 1px solid var(--ink-line);
  flex-shrink: 0;
}
.panel__close {
  position: relative;
  width: 2.5rem; height: 2.5rem;
  border: 0;
  background: none;
  color: var(--bone-dim);
}
.panel__close:hover { color: var(--bone); }
.panel__close span::before,
.panel__close span::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 15px; height: 1.5px;
  background: currentColor;
}
.panel__close span::before { transform: translate(-50%, -50%) rotate(45deg); }
.panel__close span::after { transform: translate(-50%, -50%) rotate(-45deg); }
.panel__body {
  padding: 1.5rem 1.25rem 1.5rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--bone-faint) var(--ink-raised);
  scrollbar-width: thin;
}

.view__title { font: 400 clamp(1.9rem, 1.6rem + 1.6vw, 2.5rem)/1.02 var(--font-display); letter-spacing: -0.02em; }
.view__title em { font-weight: 300; color: var(--signal); }
.view__text { margin-top: 0.75rem; color: var(--bone-dim); font-size: 0.9375rem; }
.view__text strong { color: var(--bone); font-weight: 600; }
.view__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1.5rem;
  padding-top: 1.1rem;
  border-top: 1px solid var(--ink-line);
}

.form { display: grid; gap: 1.1rem; margin-top: 1.5rem; }
.field { display: grid; gap: 0.5rem; }
.field__label {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font: 500 0.625rem/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--bone-dim);
}
.field__input {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--bone-faint);
  border-radius: 2px;
  background: var(--ink);
  color: var(--bone);
  font: 400 1rem/1.3 var(--font-body);
}
.field__input::placeholder { color: var(--bone-faint); }
.field__input:focus-visible { outline: 2px solid var(--bone); outline-offset: 2px; border-color: var(--bone); }
.field__input--key {
  font: 500 1rem/1.3 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.field__input--key::placeholder { letter-spacing: 0.06em; }
.field__hint { color: var(--bone-dim); font-size: 0.8125rem; line-height: 1.45; }
.form__error {
  padding: 0.7rem 0.85rem;
  border-left: 3px solid var(--signal);
  background: var(--ink);
  color: var(--bone);
  font-size: 0.875rem;
  line-height: 1.45;
}
.form__error:empty { display: none; }

/* The access key, shown after paying */
.keybox {
  margin-top: 1.25rem;
  padding: 1.1rem 1rem 1rem;
  border: 1px solid var(--ink-line);
  background: var(--ink);
}
.keybox__key {
  /* Sized so all 23 characters stay on one line down to a 320px screen. */
  font: 500 clamp(0.6875rem, 3.3vw, 1.125rem)/1.3 var(--font-mono);
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--bone);
  overflow-wrap: anywhere;
  user-select: all;
}
/* Ways to keep the key: equal buttons in a row, two to a row on a narrow phone. */
.keybox__row { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.25rem, 1fr)); gap: 0.6rem; margin-top: 0.9rem; }
.keybox__row .btn { padding-inline: 0.5em; font-size: 0.6875rem; letter-spacing: 0.08em; }
.keybox__note { grid-column: 1 / -1; color: var(--bone-dim); font-size: 0.8125rem; line-height: 1.45; }
@media (max-width: 30rem) {
  .keybox__row { grid-template-columns: 1fr 1fr; }
  .keybox__row > a.btn { grid-column: 1 / -1; }
}
.keybox__note:empty { display: none; }

/* ==========================================================================
   Legal pages
   ========================================================================== */
.doc { max-width: 44rem; margin: 0 auto; padding: calc(var(--top-h) + 3rem) var(--gutter) 5rem; }
.doc h1 { margin: 1.25rem 0 1rem; font: 400 clamp(2.6rem, 1.8rem + 4vw, 4.5rem)/0.98 var(--font-display); letter-spacing: -0.02em; }
.doc h2 { margin: 2.5rem 0 0.75rem; font: 400 1.6rem/1.15 var(--font-display); letter-spacing: -0.01em; }
.doc p, .doc ul { margin: 0 0 1rem; color: var(--bone-dim); }
.doc ul { padding-left: 1.2rem; }
.doc li { margin-bottom: 0.4rem; }
.doc strong { color: var(--bone); font-weight: 600; }
.doc a { text-underline-offset: 0.25em; }
.doc table { width: 100%; margin: 0 0 1.25rem; border-collapse: collapse; font-size: 0.9375rem; }
.doc th, .doc td { padding: 0.65rem 0.75rem 0.65rem 0; border-bottom: 1px solid var(--ink-line); text-align: left; vertical-align: top; color: var(--bone-dim); }
.doc th { color: var(--bone); font: 500 0.625rem/1.3 var(--font-mono); letter-spacing: 0.12em; text-transform: uppercase; }
.doc__foot { margin-top: 3rem; padding-top: 1.25rem; border-top: 1px solid var(--ink-line); }

.noscript { margin: 0; padding: 1rem var(--gutter); background: var(--signal); color: var(--signal-ink); }

/* ==========================================================================
   Reduced motion: no drift, no sweeps, no scroll-linked movement.
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .station__inner { transform: none; opacity: 1; }
  .wheel { transform: none; opacity: 1; }
  .cue__arrow { animation: none; }
}
