/* The Waiting Room — a listening study.
   A warm desk, a stack of shelter records, one card at a time.

   Two visual languages, deliberately: the form is bureaucratic (mono, small,
   spaced) and the dog's voice is human (serif, large, warm). The contrast is
   the argument. */

:root {
  --desk: #b9ab92;
  --paper: #f2ebdd;
  --paper-2: #e7dcc8;
  --ink: #24201b;
  --rule: #b3a48d;
  --warm: #d7a83e;
  --on-air: #c94732;

  /* Mixed from the seven, never a new hue. */
  --muted: color-mix(in srgb, var(--ink) 55%, var(--paper));
  --faint: color-mix(in srgb, var(--ink) 34%, var(--paper));
  --hair: color-mix(in srgb, var(--rule) 62%, var(--paper));

  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: 'Source Serif 4', Charter, 'Iowan Old Style', Georgia, serif;
  --display: 'Archivo Narrow', 'Archivo Condensed', Oswald, system-ui, sans-serif;

  --gutter: clamp(1.1rem, 3vw, 3rem);
  --page: 84rem;
  --card-w: min(71rem, 100%);
  --skirt: 3.35rem; /* room under the card for the rest of the deck */

  --s-1: clamp(0.5rem, 1vw, 0.75rem);
  --s-2: clamp(0.9rem, 1.8vw, 1.4rem);
  --s-3: clamp(1.5rem, 3vw, 2.5rem);
  --s-4: clamp(2.5rem, 5vw, 4.5rem);
  --s-5: clamp(4rem, 8vw, 7rem);
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background-color: var(--desk);
  /* A quiet tooth on the desk. Nothing photographic. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.05'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--mono);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--rule);
}

a:hover {
  text-decoration-color: var(--ink);
}

kbd {
  padding: 0.05em 0.35em;
  border: 1px solid color-mix(in srgb, var(--ink) 30%, transparent);
  border-radius: 2px;
  font: inherit;
  font-size: 0.85em;
}

.skip-link {
  position: absolute;
  left: -9999px;
  padding: 0.6rem 0.9rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.skip-link:focus {
  left: var(--gutter);
  top: 1rem;
  z-index: 40;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ══ INTRODUCTION ═════════════════════════════════════════════════════════ */

.intro {
  display: grid;
  gap: var(--s-2) var(--s-3);
  max-width: var(--page);
  margin: 0 auto;
  padding: 1.2rem var(--gutter) 0.8rem;
}

.intro__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2rem, 3.4vw, 3rem);
  line-height: 0.84;
  letter-spacing: -0.025em;
  text-transform: uppercase;
}

.intro__title span {
  display: block;
}

.intro__lede {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.intro__rule {
  width: 100%;
  max-width: 13rem;
  margin: 0.7rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.intro__sub {
  margin: 0;
  max-width: 28ch;
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.6;
}

/* The finding: the dog's words, so it is set in the human face. */
.finding__quote {
  margin: 0;
  max-width: 40ch;
  font-family: var(--serif);
  font-size: clamp(1.125rem, 1.65vw, 1.5rem);
  line-height: 1.4;
  font-weight: 400;
  quotes: '“' '”';
}

.finding__quote::before {
  content: open-quote;
}

.finding__quote::after {
  content: close-quote;
}

#finding::after {
  content: '';
  display: block;
  width: min(100%, 22rem);
  height: 3px;
  margin: 0.6rem 0 0.5rem;
  background: var(--warm);
}

.finding__names {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
}

.finding__names button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

.finding__names button:hover {
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.finding__dot {
  color: var(--faint);
}

/* A rubber stamp struck on the desk: the shelter that published this record.
   Ink-coloured, low contrast, slightly off-square. Never a badge. */
.intro__stamp {
  display: none;
  place-self: start end;
  width: 6.75rem;
  height: 6.75rem;
  margin: -0.2rem -0.15rem 0 0;
  color: color-mix(in srgb, var(--ink) 55%, var(--desk));
  transform: rotate(-7deg);
}

.intro__stamp .stamp {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 0.8;
}

.intro__stamp text {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: 0.14em;
}

@media (min-width: 64rem) {
  .intro {
    grid-template-columns: auto minmax(11rem, 14rem) minmax(22rem, 1fr) auto;
    align-items: start;
    gap: var(--s-3);
  }

  /* Hairline dividers between the masthead's registers, as on a form. */
  .intro__premise,
  #finding {
    padding-left: var(--s-3);
    margin-left: calc(var(--s-3) * -0.5);
    border-left: 1px solid color-mix(in srgb, var(--ink) 20%, transparent);
  }

  .intro__stamp {
    display: block;
  }
}

/* ══ THE DECK ═════════════════════════════════════════════════════════════ */

.stage {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter) var(--s-4);
}

.deck {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s-2);
  padding: 0;
}

.deck__cards {
  position: relative;
  justify-self: center;
  width: var(--card-w);
  padding-bottom: var(--skirt);
}

/* ── the card ── */

.card {
  --drag: 0px;
  --tilt: 0deg;
  --stay: 0;
  min-height: 33rem;
  padding: clamp(1.25rem, 1.9vw, 1.8rem) clamp(1.4rem, 2.8vw, 2.75rem)
    clamp(1.1rem, 1.6vw, 1.4rem);
  background-color: var(--paper);
  /* The same tooth as the desk, a shade softer, so the paper reads as stock. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  border-radius: 7px;
  box-shadow:
    0 1px 0 color-mix(in srgb, var(--paper) 70%, transparent) inset,
    0 2px 3px -1px color-mix(in srgb, var(--ink) 16%, transparent),
    0 26px 46px -24px color-mix(in srgb, var(--ink) 62%, transparent);
  transition:
    transform 420ms cubic-bezier(0.22, 0.75, 0.2, 1),
    opacity 320ms ease,
    background-color 520ms ease;
}

/* Cards behind are pinned to the active card's box; only the offset and tilt
   below reveal them. Without this they take their own content height and hide. */
.card:not(.is-active) {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: var(--skirt);
  overflow: hidden;
  pointer-events: none;
}

.card.is-active {
  position: relative;
  z-index: 6;
}

.card[data-offset='0'] {
  transform: translateX(var(--drag)) rotate(var(--tilt));
}

/* Four sheets of slightly different stock, fanned. Elegant, not scrapbook.
   Each carries a hairline edge so the deck reads as separate sheets rather
   than as layers of shadow. */
.card[data-offset='1'] {
  transform: translate(0.95rem, 1.05rem) rotate(-0.75deg);
  background-color: var(--paper-2);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--rule) 70%, transparent),
    0 6px 10px -8px color-mix(in srgb, var(--ink) 60%, transparent);
  z-index: 5;
}

.card[data-offset='2'] {
  transform: translate(-1.15rem, 1.95rem) rotate(1.1deg);
  background-color: color-mix(in srgb, var(--warm) 16%, var(--paper-2));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--rule) 78%, transparent),
    0 6px 10px -8px color-mix(in srgb, var(--ink) 60%, transparent);
  z-index: 4;
}

.card[data-offset='3'] {
  transform: translate(0.7rem, 2.75rem) rotate(-0.45deg);
  background-color: color-mix(in srgb, var(--rule) 40%, var(--paper-2));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--rule) 88%, transparent),
    0 6px 10px -9px color-mix(in srgb, var(--ink) 60%, transparent);
  z-index: 3;
}

.card[data-offset='4'] {
  transform: translate(-0.45rem, 3.35rem) rotate(0.35deg);
  background-color: color-mix(in srgb, var(--rule) 66%, var(--paper-2));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 22%, transparent);
  z-index: 2;
}

.card[data-offset='5'],
.card[data-offset='6'],
.card[data-offset='7'] {
  transform: translateY(4rem);
  opacity: 0;
  z-index: 1;
}

.card[data-offset^='-'] {
  transform: translateX(-58%) rotate(-3deg);
  opacity: 0;
  z-index: 0;
}

.deck__cards.is-dragging .card {
  transition: none;
}

/* Designed mode warms the stock. A shift in the paper, never a wash. */
.card[data-mode='designed'] {
  background-color: color-mix(in srgb, var(--warm) calc(15% * (1 - var(--stay))), var(--paper));
}

/* ── head: administrative, quiet, spaced ── */

.card__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.card__head p {
  margin: 0;
}

.card__count b {
  font-weight: 600;
  color: var(--on-air);
}

.card__source {
  text-align: right;
  color: var(--ink);
}

.card__name {
  margin: clamp(0.75rem, 1.4vw, 1.1rem) 0 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.5rem, 6.5vw, 4.75rem);
  line-height: 0.86;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  overflow-wrap: break-word;
}

.card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.85rem;
  margin: 0.7rem 0 0;
  font-size: 0.6875rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.card__meta span + span::before {
  content: '·';
  margin-right: 0.85rem;
  color: var(--faint);
}

.card__rule {
  margin: clamp(0.85rem, 1.7vw, 1.2rem) 0 clamp(0.95rem, 1.9vw, 1.35rem);
  border: 0;
  border-top: 1px solid var(--rule);
}

/* ── the body: document left, instrument right ── */

.card__cols {
  display: grid;
  gap: var(--s-2);
}

@media (min-width: 60rem) {
  .card__cols {
    grid-template-columns: minmax(0, 1.75fr) minmax(18rem, 1fr);
    gap: clamp(1.75rem, 3.5vw, 3.25rem);
  }

  .card__apparatus {
    padding-left: clamp(1.5rem, 3vw, 2.5rem);
    border-left: 1px solid var(--hair);
  }
}

/* ── the listing: a person's words, so it is set like prose ── */

.listing {
  margin: 0;
  max-width: 62ch;
  font-family: var(--serif);
  font-size: clamp(1.0625rem, 1.35vw, 1.25rem);
  font-weight: 400;
  line-height: 1.62;
  letter-spacing: 0.002em;
}

/* Sentences the shelter reused. Marked, never reworded. */
.thread {
  box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--warm) 70%, var(--rule));
}

/* ── the echo: an annotation printed onto the record ── */

.echo {
  margin: clamp(1.1rem, 2.4vw, 1.75rem) 0 0;
  padding: 0.9rem 0 0.2rem 1.1rem;
  border-left: 2px solid var(--warm);
  background: linear-gradient(
    to right,
    color-mix(in srgb, var(--paper-2) 82%, transparent),
    transparent 82%
  );
}

.echo__label,
.echo__names {
  margin: 0;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.echo__quote {
  margin: 0.45rem 0 0.55rem;
  font-family: var(--serif);
  font-size: 1rem;
  font-style: italic;
  line-height: 1.5;
  color: var(--ink);
}

.echo__names {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
}

.echo__names b {
  color: var(--ink);
  font-weight: 600;
}

.echo__names button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.echo__names button:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.echo__names span {
  color: var(--faint);
}

.card__perf {
  display: none;
}

/* ══ VOICE ════════════════════════════════════════════════════════════════ */

.voice__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
}

.voice__title {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* The only red on the page, and only while sound is coming out. */
.onair {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--on-air);
  opacity: 0;
  transition: opacity 240ms ease;
}

.card.is-playing .onair {
  opacity: 1;
}

.onair__dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--on-air);
}

.card.is-playing .onair__dot {
  animation: air 1.8s ease-in-out infinite;
}

@keyframes air {
  50% {
    opacity: 0.28;
  }
}

.voice__note {
  margin: 0.35rem 0 clamp(0.8rem, 1.6vw, 1.1rem);
  max-width: 40ch;
  font-family: var(--serif);
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted);
}

/* ── the switch: one strong horizontal object on the document ── */

/* Two halves, always coloured — the object states the argument even at rest:
   the shelter's reading is ink, the designed reading is warm. The unselected
   half is veiled toward the paper rather than emptied. */
.switch {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--ink),
    0 1px 0 color-mix(in srgb, var(--paper) 70%, transparent),
    0 6px 12px -8px color-mix(in srgb, var(--ink) 70%, transparent);
}

.switch__half {
  position: relative;
  min-width: 0;
  padding: 0.72rem 0.85rem;
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 380ms ease;
}

/* The extra inner padding keeps both labels clear of the knob, and is kept
   small enough that DESIGNED still sets on one line in the narrowest column. */
.switch__half--flat {
  padding-right: 1.2rem;
  background: color-mix(in srgb, var(--ink) 94%, var(--warm));
  color: var(--paper);
}

.switch__half--designed {
  padding-left: 1.2rem;
  background: var(--warm);
  color: var(--ink);
}

/* The off side reads as pressed out, not as a different control. */
.switch__half:not(.is-on)::after {
  content: '';
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--paper) 34%, transparent);
  box-shadow: inset 0 2px 5px -3px color-mix(in srgb, var(--ink) 85%, transparent);
}

.switch__half:not(.is-on):hover::after {
  background: color-mix(in srgb, var(--paper) 26%, transparent);
}

.switch__half--designed {
  text-align: right;
}

.switch__name {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
}

.switch__gloss {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.5rem;
  font-weight: 400;
  letter-spacing: 0.03em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.switch__half--flat .switch__gloss {
  color: color-mix(in srgb, var(--paper) 62%, var(--ink));
}

.switch__half--designed .switch__gloss {
  color: color-mix(in srgb, var(--ink) 62%, var(--warm));
}

/* The switch clips, so focus is drawn inside it. */
.switch__half--flat:focus-visible {
  outline: 2px solid var(--paper);
  outline-offset: -5px;
}

.switch__half--designed:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -5px;
}

/* The knob rides the seam and leans toward the side that is live. */
.switch__knob {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 1.45rem;
  height: 1.45rem;
  margin: -0.725rem 0 0 -0.725rem;
  border-radius: 50%;
  background: var(--paper);
  box-shadow:
    0 0 0 1px var(--ink),
    inset 0 0 0 4px var(--paper),
    inset 0 0 0 7px var(--ink),
    0 2px 4px -1px color-mix(in srgb, var(--ink) 70%, transparent);
  pointer-events: none;
  transform: translateX(-0.3rem);
  transition: transform 380ms cubic-bezier(0.22, 0.75, 0.2, 1);
  z-index: 2;
}

.card[data-mode='designed'] .switch__knob {
  transform: translateX(0.3rem);
}

/* ── player ── */

.player {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: clamp(0.8rem, 1.5vw, 1.05rem);
}

.player__play {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  padding: 0;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease;
}

.player__play:hover {
  background: var(--ink);
  color: var(--paper);
}

.player__glyph {
  width: 0;
  height: 0;
  margin-left: 0.15rem;
  border-left: 0.58rem solid currentColor;
  border-top: 0.36rem solid transparent;
  border-bottom: 0.36rem solid transparent;
}

.player__play.is-playing .player__glyph {
  width: 0.52rem;
  height: 0.68rem;
  margin-left: 0;
  border: 0;
  background: currentColor;
  box-shadow: inset 0 0 0 0.14rem var(--paper);
}

.player__play.is-playing:hover .player__glyph {
  box-shadow: inset 0 0 0 0.14rem var(--ink);
}

/* A progress indicator drawn in the document's language. */
.wave {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 1px;
  height: 2rem;
  min-width: 0;
  cursor: pointer;
}

.wave span {
  flex: 1;
  min-width: 0;
  background: color-mix(in srgb, var(--ink) 80%, var(--paper));
}

.wave__mask {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  background: color-mix(in srgb, var(--paper) 58%, transparent);
  pointer-events: none;
  transition: width 180ms linear;
}

.card[data-mode='designed'] .wave span {
  background: color-mix(in srgb, var(--ink) 60%, var(--warm));
}

.player__time {
  flex: none;
  margin: 0;
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.player__time b {
  font-weight: 500;
  color: var(--ink);
}

/* ══ THE STAY DIAL (hero only) ════════════════════════════════════════════ */

/* A full-width instrument across the foot of the card: track on the left,
   readout on the right. Stacking it in a column doubled its height. */
.dial {
  display: grid;
  gap: 0.7rem;
  margin-top: clamp(0.9rem, 1.8vw, 1.25rem);
  padding-top: clamp(0.8rem, 1.6vw, 1.1rem);
  border-top: 1px solid var(--hair);
}

@media (min-width: 60rem) {
  .dial {
    grid-template-columns: minmax(0, 1.75fr) minmax(18rem, 1fr);
    gap: clamp(1.75rem, 3.5vw, 3.25rem);
    align-items: start;
  }

  .dial__readout {
    padding-left: clamp(1.5rem, 3vw, 2.5rem);
    border-left: 1px solid var(--hair);
  }
}

.dial__label {
  margin: 0;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.dial__label code {
  font-size: inherit;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--ink);
}

.dial__track {
  --pos: 0;
  --inset: 0.55rem;
  position: relative;
  height: 1.9rem;
  margin-top: 0.35rem;
}

.dial__rule,
.dial__marks,
.dial__marker {
  pointer-events: none;
}

.dial__rule {
  position: absolute;
  top: 1.15rem;
  left: var(--inset);
  right: var(--inset);
  height: 1px;
  background: var(--ink);
}

.dial__marks {
  position: absolute;
  top: 0.6rem;
  left: var(--inset);
  right: var(--inset);
  display: flex;
  justify-content: space-between;
}

.dial__marks span {
  width: 1px;
  height: 1.1rem;
  background: color-mix(in srgb, var(--ink) 55%, var(--paper));
}

.dial__marker {
  position: absolute;
  top: 0.62rem;
  left: calc(var(--inset) + (100% - 2 * var(--inset)) * var(--pos) / (var(--stops) - 1));
  width: 1.1rem;
  height: 1.1rem;
  margin-left: calc(var(--inset) * -1);
  background: var(--ink);
  border-radius: 2px;
  transition: left 340ms cubic-bezier(0.22, 0.75, 0.2, 1);
}

.card[data-mode='designed'] .dial__marker {
  background: color-mix(in srgb, var(--warm) calc(100% * (1 - var(--stay))), var(--ink));
  box-shadow: 0 0 0 1px var(--ink);
}

.dial__input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.dial__track:has(.dial__input:focus-visible) .dial__marker {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.dial__stops {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.5625rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.dial__stop {
  flex: 1;
  text-align: center;
}

.dial__stop:first-child {
  text-align: left;
}

.dial__stop:last-child {
  text-align: right;
}

.dial__stop em {
  display: block;
  margin-top: 0.1rem;
  font-style: normal;
  color: var(--faint);
}

.dial__stop.is-on {
  color: var(--ink);
  font-weight: 600;
}

.dial__prompt {
  margin: 0;
}

.dial__prompt-label {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.5625rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.dial__prompt code {
  font-size: 0.75rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.dial__prompt code.is-fresh {
  animation: fresh 900ms ease-out;
}

@keyframes fresh {
  from {
    background: var(--warm);
  }
  to {
    background: transparent;
  }
}

.dial__caveat {
  margin: 0.3rem 0 0;
  font-family: var(--serif);
  font-size: 0.75rem;
  font-style: italic;
  line-height: 1.45;
  color: var(--muted);
}

/* ══ DERIVATION ═══════════════════════════════════════════════════════════ */

.derivation {
  margin-top: clamp(0.8rem, 1.5vw, 1.1rem);
  border-top: 1px solid var(--hair);
}

.derivation summary {
  padding: 0.6rem 0 0;
  font-size: 0.625rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
}

.derivation summary::-webkit-details-marker {
  display: none;
}

.derivation summary span::before {
  content: '+ ';
}

.derivation[open] summary span::before {
  content: '− ';
}

.derivation summary:hover {
  color: var(--ink);
}

.derivation__panel {
  padding-top: 0.9rem;
}

.rules {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  text-align: left;
}

.rules th,
.rules td {
  padding: 0.4rem 0.6rem 0.4rem 0;
  border-bottom: 1px solid var(--hair);
  vertical-align: top;
  font-weight: 400;
}

.rules tbody th {
  width: 6rem;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  white-space: nowrap;
}

.rules .is-quiet {
  color: var(--muted);
}

.rules i {
  font-style: italic;
}

.derivation__out {
  margin: var(--s-2) 0;
}

.derivation__out span {
  display: block;
  margin-bottom: 0.2rem;
  font-size: 0.625rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.derivation__out code {
  font-size: 0.8125rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.card__origin {
  margin: var(--s-2) 0 0;
  font-size: 0.6875rem;
  line-height: 1.7;
  color: var(--muted);
}

/* ══ DECK FURNITURE ═══════════════════════════════════════════════════════ */

.arrow {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--ink) 32%, transparent);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 200ms ease, color 200ms ease, opacity 200ms ease;
}

.arrow:hover:not(:disabled) {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

.deck__hint {
  margin: 0.55rem 0 0;
  text-align: center;
  font-size: 0.625rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 45%, var(--desk));
}

.deck__hint-glyph {
  margin-right: 0.4rem;
}

/* ── index: file-folder tabs along the foot of the deck ── */

.index {
  display: flex;
  gap: 2px;
  margin-top: 0.5rem;
  padding-bottom: 1px;
  overflow-x: auto;
  scrollbar-width: thin;
}

/* File tabs: each one a folder edge, the front of the file lifted and lighter.
   Equal basis so every tab is the same width regardless of the name it holds;
   the min-width clears the longest name in the set, so nothing ever clips. */
.index__item {
  flex: 1 1 0;
  min-width: 7.5rem;
  padding: 0.45rem 0.75rem 0.5rem;
  border: 0;
  border-radius: 6px 6px 0 0;
  background: color-mix(in srgb, var(--paper-2) 52%, var(--desk));
  color: color-mix(in srgb, var(--ink) 62%, var(--desk));
  font: inherit;
  text-align: center;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--paper) 45%, transparent),
    inset -1px 0 0 color-mix(in srgb, var(--ink) 14%, transparent),
    inset 0 -1px 0 color-mix(in srgb, var(--ink) 14%, transparent);
  transition: background-color 220ms ease, color 220ms ease, transform 220ms ease;
}

.index__item:hover {
  background: color-mix(in srgb, var(--paper-2) 82%, var(--desk));
  color: var(--ink);
}

.index__n {
  display: block;
  font-size: 0.5625rem;
  letter-spacing: 0.18em;
}

.index__name {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* The active tab is the front of the file: raised, lighter, marked in red. */
.index__item.is-on {
  background: var(--paper);
  color: var(--ink);
  transform: translateY(-5px);
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--paper) 90%, transparent),
    0 5px 0 var(--paper),
    0 -6px 14px -8px color-mix(in srgb, var(--ink) 55%, transparent);
}

.index__item.is-on .index__name {
  position: relative;
}

/* A struck rule under the name, the way a file tab is marked. */
.index__item.is-on .index__name::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -0.28rem;
  width: 1.6rem;
  height: 2px;
  margin-left: -0.8rem;
  background: var(--on-air);
}

.index__item.is-on .index__n {
  color: var(--on-air);
  font-weight: 600;
}

/* ══ ABOUT ════════════════════════════════════════════════════════════════ */

.about {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s-4) var(--gutter) var(--s-5);
}

.about__grid {
  display: grid;
  gap: var(--s-3);
  padding-top: var(--s-3);
  border-top: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
}

@media (min-width: 56rem) {
  .about__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--s-4);
  }

  .about__col + .about__col {
    padding-left: var(--s-3);
    border-left: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  }
}

/* This block sits on the desk, not on paper, so its secondary tones are mixed
   toward the desk. Mixing toward the paper (--muted) washes them out here. */
.about {
  --muted-on-desk: color-mix(in srgb, var(--ink) 78%, var(--desk));
}

.about__col h2 {
  margin: 0 0 var(--s-2);
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-on-desk);
}

.about__col p {
  margin: 0 0 0.9rem;
  font-family: var(--serif);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.about__fine {
  color: color-mix(in srgb, var(--ink) 88%, var(--desk));
  font-size: 0.9375rem !important;
}

.steps {
  margin: 0 0 0.9rem;
  padding: 0;
  list-style: none;
  font-family: var(--serif);
  font-size: 0.9375rem;
  line-height: 1.55;
}

.steps li {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
}

.steps__n {
  font-family: var(--mono);
  font-size: 0.625rem;
  letter-spacing: 0.14em;
  color: var(--muted-on-desk);
  padding-top: 0.3rem;
}

.about__heart {
  color: var(--on-air);
  font-size: 1rem;
}

.about__foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem;
  margin: var(--s-4) 0 0;
  padding-top: var(--s-2);
  border-top: 1px solid color-mix(in srgb, var(--ink) 22%, transparent);
  font-size: 0.5625rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted-on-desk);
}

/* ══ SMALL SCREENS ════════════════════════════════════════════════════════ */

@media (max-width: 48rem) {
  /* Title and premise side by side, so the card is reachable at a glance. */
  .intro {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 0.7rem 1.1rem;
    padding: 1rem var(--gutter) 0.7rem;
  }

  .intro__title {
    grid-column: 1;
    font-size: 1.625rem;
  }

  .intro__premise {
    grid-column: 2;
  }

  #finding {
    grid-column: 1 / -1;
  }

  .intro__rule {
    margin: 0.5rem 0;
  }

  .intro__sub {
    font-size: 0.8125rem;
  }

  .finding__quote {
    font-size: 1.0625rem;
  }

  /* Stacked, so a wrapped line never begins with a stray separator. */
  .card__meta {
    display: block;
  }

  .card__meta span {
    display: block;
  }

  .card__meta span + span::before {
    content: none;
  }

  .deck {
    grid-template-columns: 1fr;
    gap: var(--s-2);
  }

  .deck__cards {
    order: -1;
    width: 100%;
  }

  .arrow {
    display: none;
  }

  .card {
    min-height: 0;
  }

  .switch {
    grid-template-columns: 1fr;
  }

  .switch__half--designed {
    text-align: left;
    box-shadow: 0 -1px 0 var(--ink);
  }

  .switch__knob {
    display: none;
  }
}

@media (max-width: 30rem) {
  .player {
    flex-wrap: wrap;
  }

  .wave {
    order: 3;
    flex-basis: 100%;
  }
}

/* ══ REDUCED MOTION ═══════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  /* The dot carries state, so it stays lit rather than animating away. */
  .card.is-playing .onair__dot {
    animation: none;
  }
}
