/* SCVGN Sounds Collection
   Dark theme on the SCVGN palette. No external resources of any kind -
   no fonts, no images beyond the self-hosted logo, no third-party origins. */

:root {
  --bg:          #12121f;
  --bg-raised:   #1a1a2e;
  --bg-sunken:   #0d0d17;
  --line:        #2a2a42;
  --line-soft:   #21213a;

  --text:        #e8e8f0;
  --text-dim:    #9a9ab4;
  --text-faint:  #6a6a86;

  --brand:       #ff004d;
  --brand-mid:   #9d0b28;
  --brand-deep:  #5a082d;

  --radius:      6px;
  --touch:       48px;          /* minimum touch target, both axes */
  --maxw:        1180px;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  padding: 0 0 5.5rem;          /* room for the now-playing bar */
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand);
  color: #fff;
  padding: 0.75rem 1.25rem;
  z-index: 100;
}
.skip:focus { left: 0; }

/* ---------------------------------------------------------- header ---- */

.site-header {
  text-align: center;
  padding: 3rem 1.25rem 2rem;
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--line-soft);
}

.logo {
  display: block;
  margin: 0 auto;
  width: auto;
  height: 64px;
  max-width: 100%;
}

.tagline {
  margin: 1.25rem 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-dim);
}

/* ------------------------------------------------------------ hero ---- */

.hero {
  position: relative;
  background: linear-gradient(180deg, var(--bg-sunken) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}

/* Waveform band. 48 identical spans in the markup; every height, colour and
   animation delay comes from nth-child here, so the HTML carries no inline
   styles and the CSP needs no 'unsafe-inline'. */
.wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  height: 132px;
  padding: 0 1rem;
  opacity: 0.5;
}

.wave span {
  flex: 0 1 14px;
  min-width: 3px;
  height: 12%;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-deep) 100%);
  transform-origin: center;
  animation: pulse 2.6s var(--ease) infinite;
}

/* A 12-bar repeating envelope, four cycles across the band. */
.wave span:nth-child(12n + 1)  { height: 18%; animation-delay: 0.00s; }
.wave span:nth-child(12n + 2)  { height: 42%; animation-delay: 0.09s; }
.wave span:nth-child(12n + 3)  { height: 71%; animation-delay: 0.18s; }
.wave span:nth-child(12n + 4)  { height: 96%; animation-delay: 0.27s; }
.wave span:nth-child(12n + 5)  { height: 64%; animation-delay: 0.36s; }
.wave span:nth-child(12n + 6)  { height: 38%; animation-delay: 0.45s; }
.wave span:nth-child(12n + 7)  { height: 55%; animation-delay: 0.54s; }
.wave span:nth-child(12n + 8)  { height: 83%; animation-delay: 0.63s; }
.wave span:nth-child(12n + 9)  { height: 48%; animation-delay: 0.72s; }
.wave span:nth-child(12n + 10) { height: 26%; animation-delay: 0.81s; }
.wave span:nth-child(12n + 11) { height: 60%; animation-delay: 0.90s; }
.wave span:nth-child(12n + 12) { height: 33%; animation-delay: 0.99s; }

@keyframes pulse {
  0%, 100% { transform: scaleY(0.55); opacity: 0.55; }
  50%      { transform: scaleY(1);    opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .wave span { animation: none; }
}

.hero-copy {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  text-align: center;
}

.hero-copy h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.5rem, 4.5vw, 2.25rem);
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero-copy p {
  margin: 0;
  color: var(--text-dim);
  font-size: 1rem;
}

/* ------------------------------------------------------------ tree ---- */

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem 1rem;
}

.node {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--bg-raised);
  margin-bottom: 0.625rem;
}

.node > summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--touch);
  padding: 0.625rem 1rem;
  cursor: pointer;
  list-style: none;
  user-select: none;
  border-radius: var(--radius);
  transition: background 0.15s var(--ease);
}

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

/* Disclosure triangle, drawn in CSS. */
.node > summary::before {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  border-left: 6px solid var(--brand);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  transition: transform 0.18s var(--ease);
}

.node[open] > summary::before { transform: rotate(90deg); }

.node > summary:hover { background: #21213a; }

.node > summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.node > summary .title { flex: 1 1 auto; font-weight: 600; }

.node > summary .count {
  flex: none;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  color: var(--text-faint);
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.125rem 0.625rem;
}

.node > .body { padding: 0.25rem 0.75rem 0.75rem; }

/* Top-level race / category sections read louder than their children. */
.node.level-0 {
  background: var(--bg-sunken);
  border-color: var(--line);
  margin-bottom: 1rem;
}

.node.level-0 > summary {
  min-height: 60px;
  padding: 0.875rem 1.125rem;
}

.node.level-0 > summary .title {
  font-size: 1.0625rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.node.level-0 > summary::before { border-left-width: 8px; border-top-width: 6px; border-bottom-width: 6px; }

.node.level-2 { background: var(--bg-sunken); }

.note {
  margin: 0.5rem 0.25rem 1rem;
  color: var(--text-dim);
  font-size: 0.9375rem;
  font-style: italic;
}

/* --------------------------------------------------------- sounds ---- */

.sounds {
  list-style: none;
  margin: 0.5rem 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.5rem;
}

.sound {
  display: flex;
  gap: 4px;
}

.sound .play,
.sound .stop {
  min-height: var(--touch);
  border: 1px solid var(--line);
  background: var(--bg-raised);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: background 0.13s var(--ease), border-color 0.13s var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.sound .play {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-radius: var(--radius) 0 0 var(--radius);
}

.sound .stop {
  flex: 0 0 var(--touch);
  width: var(--touch);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 var(--radius) var(--radius) 0;
  border-left: none;
}

.sound .play:hover,
.sound .stop:not([disabled]):hover {
  background: #262640;
  border-color: var(--brand-mid);
}

.sound .play:focus-visible,
.sound .stop:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
  position: relative;
  z-index: 1;
}

.sound .stop[disabled] {
  opacity: 0.32;
  cursor: default;
}

.sound .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Play glyph - a CSS triangle. */
.sound .play .icon {
  flex: none;
  width: 0;
  height: 0;
  border-left: 9px solid var(--brand);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

/* Stop glyph - a CSS square. */
.sound .stop .icon {
  width: 11px;
  height: 11px;
  border-radius: 1px;
  background: var(--text-dim);
}

.sound .stop:not([disabled]) .icon { background: var(--brand); }

/* Playing state, set by player.js via aria-pressed. */
.sound .play[aria-pressed="true"] {
  background: var(--brand-deep);
  border-color: var(--brand);
}

.sound .play[aria-pressed="true"] .icon {
  border: none;
  width: 11px;
  height: 11px;
  border-radius: 1px;
  background: var(--brand);
  animation: blink 1s steps(2, start) infinite;
}

@keyframes blink { 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  .sound .play[aria-pressed="true"] .icon { animation: none; }
}

/* Marks a label that was inferred rather than documented. */
.flag {
  color: var(--brand-mid);
  font-size: 0.8em;
  margin-left: 0.3em;
  vertical-align: super;
  cursor: help;
}

/* --------------------------------------------------- now playing ---- */

.nowplaying {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: var(--maxw);
  margin: 0 auto 0.75rem;
  padding: 0.625rem 0.75rem 0.625rem 1rem;
  background: var(--bg-raised);
  border: 1px solid var(--brand-mid);
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.55);
}

.nowplaying[hidden] { display: none; }

@media (min-width: 1212px) {
  .nowplaying { left: 1rem; right: 1rem; }
}

.np-dot {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  animation: blink 1s steps(2, start) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .np-dot { animation: none; }
}

.np-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.9375rem;
  color: var(--text-dim);
}

.np-stop {
  flex: none;
  min-height: var(--touch);
  padding: 0 1.5rem;
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  background: var(--brand-deep);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.np-stop:hover { background: var(--brand-mid); }

.np-stop:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------------------------------------------------------- footer ---- */

.site-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 1rem;
  border-top: 1px solid var(--line-soft);
  text-align: center;
  color: var(--text-faint);
  font-size: 0.8125rem;
}

.site-footer p { margin: 0.4rem 0; }

/* ---------------------------------------------------------- small ---- */

@media (max-width: 560px) {
  .site-header { padding: 2rem 1rem 1.5rem; }
  .logo { height: 48px; }
  .wave { height: 96px; gap: 2px; }
  main { padding: 1.5rem 0.625rem; }
  .node > .body { padding: 0.25rem 0.5rem 0.625rem; }
  .sounds { grid-template-columns: 1fr; }
}
