/* Deck (top nav) and Booth settings panel. Owned by Agent 1. */

/* ---------- Deck ---------- */
.deck {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  border-radius: 0;
  border-width: 0 0 1px 0;
  background: var(--glass-fill-strong);
}
.deck.glass::before { inset: auto 0 -1px 0; height: 1px; padding: 0; -webkit-mask: none; mask: none; border-radius: 0; }
/* Short or heavily zoomed viewports: let the deck scroll away so it never hides content. */
@media (max-height: 30rem) { .deck { position: absolute; } }

.deck__bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  max-width: calc(var(--content-max) + 4rem);
  margin-inline: auto;
  padding: var(--space-2) var(--space-4);
  min-height: 3.75rem;
}
.deck__brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.75rem;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  flex: none;
}
.deck__logo {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background:
    radial-gradient(circle, var(--vinyl) 0 7%, var(--accent) 8% 30%, transparent 31%),
    repeating-radial-gradient(circle, var(--vinyl) 0 2px, var(--vinyl-groove) 2px 3px);
  box-shadow: 0 0 0 1px var(--line);
}
:root[data-motion="full"]:not([data-calm="on"]) .deck__brand:hover .deck__logo { animation: deck-spin 1.8s linear infinite; }
@keyframes deck-spin { to { rotate: 1turn; } }

.deck__nav { margin-left: auto; display: flex; align-items: center; }
.deck__list {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}
.deck__list li { max-width: none; }
.deck__link {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 0.45em;
  min-height: 2.75rem;
  padding: 0.7rem 0.65rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
}
.deck__num {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8em;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.deck__link:hover { color: var(--text); background: rgb(255 255 255 / .05); }
.deck__link[aria-current="true"] { color: var(--text); }
/* Now playing marker: an underline bar, not colour alone. */
.deck__link[aria-current="true"]::after {
  content: "";
  position: absolute;
  left: 0.65rem;
  right: 0.65rem;
  bottom: 0.35rem;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
:root[data-contrast="high"] .deck__link[aria-current="true"]::after { height: 3px; background: var(--text); }

.deck__toggle,
.deck__booth {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  flex: none;
}
.deck__toggle:hover, .deck__booth:hover { border-color: var(--accent-2); }
.deck__toggle svg, .deck__booth svg { width: 1.2rem; height: 1.2rem; flex: none; }
.deck__booth[aria-expanded="true"] { border-color: var(--accent-2); }
.deck__toggle { display: none; }
:root[data-contrast="high"] .deck__toggle,
:root[data-contrast="high"] .deck__booth { border: 2px solid var(--text); background: #000; }

/* Compact layout (set by js/motion.js when the tracklist does not fit). */
.js .deck[data-layout="compact"] .deck__toggle { display: inline-flex; }
.js .deck[data-layout="compact"] .deck__nav { position: static; }
.js .deck[data-layout="compact"] .deck__list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  display: none;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  max-height: calc(100vh - var(--deck-h, 4rem));
  max-height: calc(100dvh - var(--deck-h, 4rem));
  overflow-y: auto;
  padding: var(--space-3) var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  white-space: normal;
}
.js .deck[data-layout="compact"] .deck__toggle[aria-expanded="true"] + .deck__list { display: flex; }
.js .deck[data-layout="compact"] .deck__link { display: flex; width: 100%; padding: 0.85rem 0.75rem; font-size: 1.0625rem; }
.js .deck[data-layout="compact"] .deck__link[aria-current="true"]::after { left: 0; right: auto; top: 0.6rem; bottom: 0.6rem; width: 3px; height: auto; }
.js .deck[data-layout="compact"] .deck__toggle[aria-expanded="true"] { border-color: var(--accent-2); }
.deck__toggle-icon { transition: rotate var(--dur) var(--spring); }
.deck__toggle[aria-expanded="true"] .deck__toggle-icon { rotate: 0.5turn; }

/* No scripts: show the whole list, wrapping if needed. */
:root:not(.js) .deck__list { flex-wrap: wrap; white-space: normal; }

@media (max-width: 30em) {
  .deck__bar { gap: var(--space-2); padding-inline: var(--space-3); }
  .deck__booth-more { display: none; }
  .deck__name { font-size: 1rem; }
}
@media (max-width: 26em) {
  /* Small phones: the brand drops to its logo so "Accessibility" can keep its words.
     Hidden text stays available to assistive tech. */
  .deck__name {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .deck__booth, .deck__toggle { padding-inline: 0.7rem; }
}
/* "Tracklist" drops to its icon only when space runs out: on very small screens, or small ones while music plays. */
@media (max-width: 22.5em) {
  .js .deck[data-layout="compact"] .deck__toggle > span {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
}
@media (max-width: 24em) {
  .is-music-playing .deck[data-layout="compact"] .deck__toggle > span {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
}
/* Big text on a small screen: let the bar wrap rather than overflow. */
.deck[data-layout="compact"] .deck__bar { flex-wrap: wrap; }

/* Playback progress: thin groove with a needle that tracks page scroll. */
.deck__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  overflow: hidden;
  background: linear-gradient(90deg, transparent, var(--vinyl-groove) 8% 92%, transparent);
  pointer-events: none;
}
.deck__progress-fill {
  position: absolute;
  inset: 0;
  translate: calc((var(--page-progress, 0) - 1) * 100%) 0;
  background: linear-gradient(90deg, var(--accent-3), var(--accent));
  background: linear-gradient(in oklch 90deg, var(--accent-3), var(--tint-strong, var(--accent)), var(--accent));
}
.deck__progress-fill::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: var(--text);
}
:root[data-contrast="high"] .deck__progress-fill { background: var(--text); }

@supports (animation-timeline: scroll()) {
  :root[data-motion="full"]:not([data-calm="on"]) .deck__progress-fill {
    animation: deck-progress linear both;
    animation-timeline: scroll(root block);
  }
}
@keyframes deck-progress { from { translate: -100% 0; } to { translate: 0 0; } }

/* ---------- Booth settings dialog ---------- */
.booth {
  width: min(28rem, 100%);
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: visible;
}
.booth::backdrop { background: rgb(0 0 0 / .55); }
:root[data-contrast="high"] .booth::backdrop { background: rgb(0 0 0 / .8); }
:root[data-motion="full"]:not([data-calm="on"]) .booth[open] .booth__panel { animation: booth-in var(--dur-slow) var(--spring-soft); }
:root[data-motion="full"]:not([data-calm="on"]) .booth[open]::backdrop { animation: booth-fade var(--dur) ease; }
@keyframes booth-in { from { translate: 100% 0; opacity: 0.4; } }
@keyframes booth-fade { from { opacity: 0; } }

.booth__panel {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-5) var(--space-5) var(--space-7);
  border-radius: var(--radius) 0 0 var(--radius);
  background: var(--surface);
  background: color-mix(in oklch, var(--surface) 92%, transparent);
}
@media (max-width: 30em) {
  .booth__panel { border-radius: 0; padding-inline: var(--space-4); }
}
.booth__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}
.booth__kicker {
  color: var(--accent-2);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.booth__title { font-size: 1.75rem; font-weight: 700; }
.booth__close { padding-inline: 0.9rem; }
.booth__desc { margin-top: var(--space-3); color: var(--text-muted); }

.booth__form { display: grid; gap: var(--space-4); margin-top: var(--space-5); }

/* A channel strip per setting. */
.channel {
  min-width: 0;
  margin: 0;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.channel__legend {
  float: left;
  width: 100%;
  padding: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
}
.channel__hint {
  clear: both;
  margin: var(--space-1) 0 var(--space-3);
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.45;
}
:root[data-contrast="high"] .channel { border: 2px solid var(--text); }

/* Segmented mixer switch. Native radios underneath, label is the target. */
.switch {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr));
  gap: var(--space-2);
  padding: 4px;
  border-radius: 10px;
  background: var(--bg-deep);
  box-shadow: inset 0 1px 3px rgb(0 0 0 / .6);
}
.switch--four { grid-template-columns: repeat(auto-fit, minmax(4.75rem, 1fr)); }
.switch__opt { position: relative; display: block; }
.switch__opt input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch__face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 2.75rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--text-muted);
  font-weight: 500;
  text-align: center;
  line-height: 1.2;
  pointer-events: none;
  transition: background-color var(--dur-fast) ease, color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
.switch__face--size { flex-direction: column; gap: 0.1rem; font-size: 0.875rem; }
.switch__face--readable { font-family: var(--font-readable); }
.switch__aa { font-family: var(--font-display); font-weight: 700; line-height: 1; }
.switch__led {
  width: 0.6rem;
  height: 0.6rem;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
  background: transparent;
}
.switch__opt input:hover + .switch__face { color: var(--text); background: rgb(255 255 255 / .04); }
.switch__opt input:checked + .switch__face {
  color: var(--text);
  font-weight: 700;
  background: var(--surface);
  border-color: var(--accent-2);
  box-shadow: var(--glass-highlight), 0 2px 6px rgb(0 0 0 / .5);
}
.switch__opt input:checked + .switch__face .switch__led {
  border-color: var(--accent-2);
  background: var(--accent-2);
  box-shadow: 0 0 8px var(--accent-2);
}
.switch__opt input:focus-visible + .switch__face { outline: 3px solid var(--focus-ring); outline-offset: 2px; }
:root[data-calm="on"] .switch__opt input:checked + .switch__face .switch__led { box-shadow: none; }
:root[data-contrast="high"] .switch__opt input:checked + .switch__face { border: 3px solid var(--text); background: #000; box-shadow: none; text-decoration: underline; }
:root[data-contrast="high"] .switch__opt input:checked + .switch__face .switch__led { background: var(--text); border-color: var(--text); box-shadow: none; }
@media (forced-colors: active) {
  .switch__face { border: 1px solid CanvasText; }
  .switch__opt input:checked + .switch__face { border: 3px solid Highlight; }
  .switch__opt input:checked + .switch__face .switch__led { background: Highlight; border-color: Highlight; }
}

.booth__foot { display: flex; justify-content: flex-start; padding-top: var(--space-2); }
.booth__reset { width: 100%; }

/* ---------- Footer ---------- */
.site-footer {
  padding: clamp(4rem, 9vw, 7rem) max(var(--space-4), calc((100% - var(--content-max)) / 2)) var(--space-6);
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, transparent, var(--bg-deep));
  background: linear-gradient(in oklch 180deg, transparent, var(--bg-deep));
}
.site-footer__signoff {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.site-footer__sub { margin-top: var(--space-3); color: var(--text-muted); }
.site-footer__a11y {
  margin-top: var(--space-7);
  max-width: 48rem;
  padding: var(--space-5);
}
.site-footer__a11y > * + * { margin-top: var(--space-3); }
.site-footer__heading { font-size: 1.375rem; }
.site-footer__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  margin-top: var(--space-7);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.9375rem;
}
.site-footer__top {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 600;
}
@media print {
  .site-footer { padding: 1rem 0 0; background: none; }
  .site-footer__a11y { display: none; }
}

/* Stop music: only present while the record is playing (WCAG 1.4.2, a way to stop audio is always in reach). */
.deck__music {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  white-space: nowrap;
  flex: none;
}
.deck__music[hidden] { display: none; }
.deck__music:hover { background: var(--surface); border-color: var(--accent-2); }
.deck__music-eq { display: inline-flex; align-items: flex-end; gap: 2px; width: 1rem; height: 1rem; }
.deck__music-eq i { flex: 1; height: 60%; border-radius: 1px; background: var(--accent); }
.deck__music-eq i:nth-child(2) { height: 100%; }
.deck__music-eq i:nth-child(3) { height: 40%; }
:root[data-motion="full"]:not([data-calm="on"]) .deck__music-eq i { animation: music-eq 0.97s ease-in-out infinite alternate; transform-origin: bottom; }
:root[data-motion="full"]:not([data-calm="on"]) .deck__music-eq i:nth-child(2) { animation-delay: -0.32s; }
:root[data-motion="full"]:not([data-calm="on"]) .deck__music-eq i:nth-child(3) { animation-delay: -0.64s; }
@keyframes music-eq { from { transform: scaleY(0.35); } to { transform: scaleY(1); } }
:root[data-contrast="high"] .deck__music { border: 2px solid var(--text); background: #000; }
:root[data-contrast="high"] .deck__music-eq i { background: var(--text); }
@media (max-width: 40em) { .deck__music-more { display: none; } }
@media print { .deck__music { display: none !important; } }

/* Phones: Stop shrinks to its icon while music plays; its accessible name stays (visually hidden). */
@media (max-width: 30em) {
  .deck__music { padding-inline: 0.75rem; }
  .deck__music-label {
    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;
  }
}
