/* ─── Fonts ──────────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Anton&family=Space+Mono:ital,wght@0,400;0,700;1,400&family=Bebas+Neue&display=swap');

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

:root {
  --bg:       #111009;   /* warm black — like aged paper in a dark room */
  --surface:  #191610;
  --ink:      #ddd5c4;   /* warm off-white, like old book pages */
  --ink-dim:  #7a7060;
  --accent:   #b5002e;   /* maroon */
  --accent2:  #8c0024;
  --border:   #2c2820;
  --shelf:    #322e28;

  --font-disp: 'Anton', 'Impact', sans-serif;
  --font-bebas:'Bebas Neue', 'Anton', sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-mono);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ─── Paper grain ────────────────────────────────────────────────────────── */
/* Two overlaid noise layers at different scales create a deep paper texture */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
}

.grain-coarse {
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 300px 300px;
  mix-blend-mode: overlay;
}

.grain-fine {
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='150' height='150'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='turbulence' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='150' height='150' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 150px 150px;
  mix-blend-mode: screen;
}

/* ─── Page ───────────────────────────────────────────────────────────────── */
.page {
  position: relative;
  z-index: 1;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ─── Shelf rules ─────────────────────────────────────────────────────────── */
/* The horizontal lines evoke book shelf edges and printed page rules */
.shelf-rule {
  height: 1px;
  background: var(--shelf);
  margin: 0;
  position: relative;
}

.shelf-rule + .shelf-rule {
  margin-top: 2px;
  opacity: 0.4;
}

.shelf-rule--thin {
  height: 1px;
  opacity: 0.5;
  margin-top: 2px;
}

.shelf-rule--labeled {
  height: auto;
  background: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 28px 0 16px;
}

.shelf-label {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.3em;
  color: var(--ink-dim);
  white-space: nowrap;
  text-transform: uppercase;
}

.shelf-fill {
  flex: 1;
  height: 1px;
  background: var(--shelf);
}

.shelf-rule--footer {
  margin-top: 48px;
}

/* ─── Masthead ───────────────────────────────────────────────────────────── */
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 40px 0 20px;
}

.station-name {
  font-family: var(--font-disp);
  font-size: clamp(4.5rem, 18vw, 9rem);
  line-height: 0.88;
  letter-spacing: -3px;
  color: var(--ink);
}

.station-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.station-radio {
  font-family: var(--font-bebas);
  font-size: 1.1rem;
  letter-spacing: 4px;
  color: var(--accent);
}

.station-divider { opacity: 0.3; }

.masthead-right {
  padding-bottom: 8px;
}

.freq-tag {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  border: 1px solid var(--border);
  padding: 3px 8px;
}

/* ─── On Air Banner ───────────────────────────────────────────────────────── */
/* This is the primary status indicator — very different states for on/off */
.air-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 0;
  transition: all 0.4s ease;
}

/* Off air dot */
.air-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--shelf);
  border: 1px solid var(--ink-dim);
  flex-shrink: 0;
  transition: background 0.3s, border-color 0.3s, box-shadow 0.3s;
}

/* Off air text */
.air-text {
  font-family: var(--font-disp);
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  transition: color 0.3s, font-size 0.3s;
}

.air-sub {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  opacity: 0.5;
  transition: opacity 0.3s, color 0.3s;
  text-transform: uppercase;
}

/* ── ON AIR live state ── */
body.is-live .air-banner {
  padding: 28px 0;
}

body.is-live .air-dot {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(181, 0, 46, 0.15),
              0 0 16px rgba(181, 0, 46, 0.25);
  animation: live-pulse 1.8s ease-in-out infinite;
}

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(181,0,46,0.15), 0 0 16px rgba(181,0,46,0.25); }
  50%       { box-shadow: 0 0 0 8px rgba(181,0,46,0.05), 0 0 28px rgba(181,0,46,0.4); }
}

body.is-live .air-text {
  font-size: clamp(1.4rem, 5vw, 2.2rem);
  color: var(--accent);
  letter-spacing: 0.05em;
}

body.is-live .air-sub {
  opacity: 0.9;
  color: var(--ink);
}

/* ─── Tape decorations ────────────────────────────────────────────────────── */
.tape {
  position: absolute;
  height: 16px;
  background: rgba(220, 200, 170, 0.28);
  pointer-events: none;
  z-index: 2;
  /* slight paper texture on the tape itself */
  backdrop-filter: blur(0px);
}

.tape-1 {
  width: 90px;
  top: -7px;
  left: 32px;
  transform: rotate(-1.2deg);
}

.tape-2 {
  width: 60px;
  top: -5px;
  right: 48px;
  transform: rotate(1.8deg);
}

/* ─── Player ──────────────────────────────────────────────────────────────── */
.player {
  position: relative;
  padding: 28px 0 24px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.player-inner {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Play button */
.play-btn {
  width: 64px;
  height: 64px;
  border: 1px solid var(--ink-dim);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  position: relative;
}

.play-btn::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid var(--border);
  pointer-events: none;
}

.play-btn:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--ink);
}

.play-btn.playing {
  background: var(--accent);
  border-color: var(--accent);
}

.play-icon { width: 22px; height: 22px; }
.hidden { display: none !important; }

/* Player info */
.player-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.player-label {
  font-family: var(--font-disp);
  font-size: 1.4rem;
  letter-spacing: 0.5px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-meta {
  font-size: 0.58rem;
  letter-spacing: 0.15em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

/* Waveform */
.waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 20px;
}

.waveform span {
  display: block;
  width: 2px;
  height: 3px;
  background: var(--border);
  flex-shrink: 0;
  transition: background 0.3s;
}

.waveform.active span {
  background: var(--accent);
  animation: wave 1.3s ease-in-out infinite;
}

.waveform.active span:nth-child(1)  { animation-delay: 0.00s; }
.waveform.active span:nth-child(2)  { animation-delay: 0.10s; }
.waveform.active span:nth-child(3)  { animation-delay: 0.20s; }
.waveform.active span:nth-child(4)  { animation-delay: 0.30s; }
.waveform.active span:nth-child(5)  { animation-delay: 0.15s; }
.waveform.active span:nth-child(6)  { animation-delay: 0.05s; }
.waveform.active span:nth-child(7)  { animation-delay: 0.25s; }
.waveform.active span:nth-child(8)  { animation-delay: 0.35s; }
.waveform.active span:nth-child(9)  { animation-delay: 0.10s; }
.waveform.active span:nth-child(10) { animation-delay: 0.20s; }
.waveform.active span:nth-child(11) { animation-delay: 0.30s; }
.waveform.active span:nth-child(12) { animation-delay: 0.00s; }

@keyframes wave {
  0%, 100% { height: 3px; }
  50%       { height: 18px; }
}

/* Volume */
.vol-control {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.vol-label {
  font-size: 0.5rem;
  letter-spacing: 0.25em;
  color: var(--ink-dim);
}

.vol-slider {
  -webkit-appearance: none;
  appearance: none;
  writing-mode: vertical-lr;
  direction: rtl;
  width: 4px;
  height: 72px;
  background: var(--border);
  outline: none;
  cursor: pointer;
}

.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  background: var(--ink);
  cursor: pointer;
}

.vol-slider::-webkit-slider-thumb:hover {
  background: var(--accent);
}

/* ─── Sets ────────────────────────────────────────────────────────────────── */
.sets-loading {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  padding: 8px 0 24px;
}

/* Each set looks like a book spine on a shelf */
.set-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s;
}

.set-row:first-child {
  border-top: 1px solid var(--border);
}

.set-row:hover       { border-bottom-color: var(--accent); }
.set-row.playing     { border-bottom-color: var(--accent); }

.set-idx {
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  color: var(--ink-dim);
  width: 20px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.set-row.playing .set-idx { color: var(--accent); }

.set-play-btn {
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.set-play-btn:hover,
.set-row.playing .set-play-btn {
  background: var(--accent);
  border-color: var(--accent);
}

.set-play-btn svg { width: 8px; height: 8px; }

.set-title {
  font-family: var(--font-disp);
  font-size: 0.95rem;
  letter-spacing: 0.3px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.set-date {
  font-size: 0.55rem;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  flex-shrink: 0;
}

.set-dur {
  font-size: 0.6rem;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.empty-state {
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  padding: 16px 0 32px;
  text-transform: uppercase;
}

/* ─── Footer ──────────────────────────────────────────────────────────────── */
.footer {
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 16px;
  text-transform: uppercase;
}

.footer-sep {
  color: var(--accent);
  opacity: 0.6;
}

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 500px) {
  .player-inner { gap: 16px; }
  .vol-control { display: none; }
  .masthead { flex-direction: column; align-items: flex-start; gap: 8px; padding-top: 28px; }
}
