/* ============ sound — the music deck (js/core/music.js renders it into [data-music-slot]) ============
   Closed: one hairline pill, 36px — a five-bar live meter and the word "Sound". It reads its
   colour from the nav (currentColor), so it flips with the paper nav like every other tool.
   Open: a small instrument panel (always dark, like the accent sampler) — movement, chapter,
   a triggered oscilloscope over a faint spectrum, the 16-step bar clock, transport, volume,
   and the interface-sounds switch. The accent only marks what is live: the meter while the
   score plays, and the current sixteenth on the clock. */

.deck {
  position: relative;
  display: inline-flex;
  align-items: stretch;
  height: 36px;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  color: inherit;
  transition: border-color var(--d-ui) var(--ease-ui);
}
.deck:hover, .deck.is-open { border-color: currentColor; }
html.nav-light .nav .deck { border-color: rgba(11, 11, 12, 0.24); }
html.nav-light .nav .deck:hover, html.nav-light .nav .deck.is-open { border-color: #0b0b0c; }

.deck__toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 14px 0 13px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 450;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
  white-space: nowrap;
}

/* the meter: five 2px bars scaled from their centre; flat dots when silent */
.deck__bars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 14px;
}
.deck__bars i {
  display: block;
  width: 2px;
  height: 14px;
  border-radius: 1px;
  background: currentColor;
  transform: scaleY(0.14);
  transition: background-color 400ms var(--ease-ui);
}
.deck.is-playing .deck__bars i { background: var(--signal); }
html.is-reduced .deck__bars i { transition: background-color 400ms var(--ease-ui), transform 300ms var(--ease-ui); }

.deck__label { opacity: 0.86; transition: opacity var(--d-ui) var(--ease-ui); }
.deck.is-on .deck__label, .deck__toggle:hover .deck__label { opacity: 1; }

/* the chevron is the tap target for the panel where there is no hover */
.deck__more {
  display: none;
  place-items: center;
  width: 30px;
  margin-left: -4px;
  border-left: 1px solid var(--hairline);
  border-radius: 0 999px 999px 0;
}
html.nav-light .nav .deck__more { border-left-color: rgba(11, 11, 12, 0.12); }
.deck__more svg { width: 12px; height: 12px; transition: transform var(--d-ui) var(--ease-out); }
.deck.is-open .deck__more svg { transform: rotate(180deg); }
@media (hover: none) {
  .deck__more { display: grid; }
  .deck__toggle { padding-right: 12px; }
}

/* ---------- the panel ---------- */
.deck__pop {
  position: absolute;
  top: calc(100% + 10px);
  right: -1px;
  z-index: 120;
  display: grid;
  gap: 10px;
  width: 296px;
  padding: 14px 14px 12px;
  border: 1px solid rgba(236, 232, 225, 0.16);
  border-radius: 10px;
  background: rgba(17, 17, 19, 0.96);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: #ece8e1;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  translate: var(--shift, 0px) -4px;
  transition:
    opacity 180ms var(--ease-ui),
    translate 260ms var(--ease-out),
    visibility 0s linear 260ms;
}
/* a bridge across the gap, so the pointer can travel from the pill to the panel */
.deck__pop::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 12px; }
.deck.is-open .deck__pop {
  opacity: 1;
  visibility: visible;
  translate: var(--shift, 0px) 0;
  transition: opacity 200ms var(--ease-ui), translate 300ms var(--ease-out), visibility 0s;
}

.deck__meta,
.deck__cue,
.deck__note,
.deck__vol-val {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 450;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.deck__meta { display: flex; justify-content: space-between; gap: 1rem; color: rgba(236, 232, 225, 0.5); }
.deck__meta [data-deck-chapter] { color: rgba(236, 232, 225, 0.78); }
.deck.is-playing .deck__meta [data-deck-status]::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin: 0 0.55em 0.12em 0;
  border-radius: 50%;
  background: var(--signal);
  vertical-align: middle;
}

.deck__title {
  display: flex;
  align-items: baseline;
  gap: 0.32em;
  margin-top: -2px;
  font-size: 1.12rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.deck__num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.2em;
  color: rgba(236, 232, 225, 0.6);
}

.deck__scope {
  position: relative;
  height: 52px;
  border-block: 1px solid rgba(236, 232, 225, 0.08);
}
.deck__scope canvas { width: 100%; height: 100%; }

/* the musical clock: sixteen sixteenths, beats a little taller */
.deck__steps { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; align-items: end; height: 6px; }
.deck__steps i { display: block; height: 3px; background: rgba(236, 232, 225, 0.16); }
.deck__steps i:nth-child(4n + 1) { height: 6px; background: rgba(236, 232, 225, 0.3); }
.deck__steps i.is-now { background: var(--signal); }

.deck__cue { color: rgba(236, 232, 225, 0.5); min-height: 1.4em; }

.deck__ctrl {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(236, 232, 225, 0.1);
}
.deck__play {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(236, 232, 225, 0.24);
  border-radius: 50%;
  transition: background-color var(--d-ui) var(--ease-ui), color var(--d-ui) var(--ease-ui), border-color var(--d-ui) var(--ease-ui);
}
.deck__play svg { width: 12px; height: 12px; }
.deck__play:hover { background: #ece8e1; color: #0b0b0c; border-color: #ece8e1; }
.deck__vol-val { min-width: 2ch; color: rgba(236, 232, 225, 0.6); text-align: right; }

/* volume: a hairline track that fills to the value, a small round thumb */
.deck__vol {
  --v: 84%;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.deck__vol::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 1px;
  background: linear-gradient(to right, #ece8e1 var(--v), rgba(236, 232, 225, 0.18) var(--v));
}
.deck__vol::-moz-range-track { height: 2px; border-radius: 1px; background: rgba(236, 232, 225, 0.18); }
.deck__vol::-moz-range-progress { height: 2px; border-radius: 1px; background: #ece8e1; }
.deck__vol::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  margin-top: -5px;
  border: 0;
  border-radius: 50%;
  background: #ece8e1;
  -webkit-appearance: none;
  appearance: none;
  transition: transform var(--d-micro) var(--ease-ui);
}
.deck__vol::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #ece8e1; }
.deck__vol:hover::-webkit-slider-thumb, .deck__vol:focus-visible::-webkit-slider-thumb { transform: scale(1.2); }
.deck__vol:focus-visible { outline-offset: 2px; }

.deck__foot { display: grid; gap: 2px; justify-items: start; }
.deck__note { color: rgba(236, 232, 225, 0.42); }
.deck__sfx {
  padding: 0.3rem 0;
  font-size: 0.78rem;
  color: rgba(236, 232, 225, 0.72);
  text-decoration: underline;
  text-decoration-color: rgba(236, 232, 225, 0.28);
  text-underline-offset: 3px;
  transition: color var(--d-ui) var(--ease-ui), text-decoration-color var(--d-ui) var(--ease-ui);
}
.deck__sfx b { font-weight: 500; color: #ece8e1; }
.deck__sfx:hover { color: #ece8e1; text-decoration-color: var(--signal); }

/* ---------- inside the mobile menu: 48px pill, 44px targets, the panel opens upwards ---------- */
.tools--menu .deck { height: 48px; }
/* the menu's tools speak in sentence case: match them */
.tools--menu .deck__toggle {
  gap: 12px;
  padding: 0 16px 0 18px;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 400;
  letter-spacing: -0.005em;
  text-transform: none;
}
.tools--menu .deck__more { display: grid; width: 46px; margin-left: 0; }
.tools--menu .deck__pop {
  top: auto;
  bottom: calc(100% + 10px);
  right: auto;
  left: -1px;
  width: min(320px, calc(100vw - 2 * var(--gutter)));
  translate: var(--shift, 0px) 4px;
}
.tools--menu .deck.is-open .deck__pop { translate: var(--shift, 0px) 0; }
.tools--menu .deck__pop::before { top: 100%; bottom: auto; }
.tools--menu .deck__play { width: 44px; height: 44px; }
.tools--menu .deck__vol { height: 44px; }
.tools--menu .deck__sfx { min-height: 44px; }
