:root {
  --bg: #f6f0e7;
  --surface: rgba(255, 252, 247, 0.9);
  --surface-alt: #f7e9d7;
  --surface-border: rgba(88, 62, 38, 0.12);
  --text: #20160f;
  --muted: #6f5d4c;
  --accent: #c04a22;
  --accent-2: #0e8b7d;
  --accent-3: #d8a03c;
  --shadow: 0 24px 70px rgba(53, 29, 13, 0.12);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 10px;
  --player-height: 188px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0e1014;
  --surface: rgba(26, 30, 38, 0.92);
  --surface-alt: #232834;
  --surface-border: rgba(255, 255, 255, 0.12);
  --text: #f2efe9;
  --muted: #a7a39b;
  --accent: #ef7146;
  --accent-2: #25bdac;
  --accent-3: #e3b252;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body::before,
body::after,
.page-backdrop {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  background:
    radial-gradient(circle at top left, rgba(192, 74, 34, 0.18), transparent 28%),
    radial-gradient(circle at 82% 18%, rgba(14, 139, 125, 0.16), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(216, 160, 60, 0.14), transparent 24%);
}

body::after {
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.14) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.36), transparent 72%);
  opacity: 0.35;
}

.page-backdrop {
  background:
    radial-gradient(circle at 20% 20%, rgba(192, 74, 34, 0.18), transparent 16%),
    radial-gradient(circle at 80% 80%, rgba(14, 139, 125, 0.18), transparent 18%);
  filter: blur(24px);
  opacity: 0.6;
  animation: drift 18s ease-in-out infinite alternate;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 calc(var(--player-height) + 60px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 6px 4px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-logo-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 46px;
  flex: 0 0 auto;
}

.brand-logo {
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-copy strong {
  font-size: 1.02rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-copy span,
.topbar-note,
.results-note,
.player-label,
.station-description {
  color: var(--muted);
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-links a {
  display: inline-block;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s ease, background-color 0.18s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--accent);
  background: var(--surface-alt);
}

.nav-links a[aria-current="page"] {
  color: var(--accent);
  background: var(--surface-alt);
}

.site-intro {
  margin: 4px 4px 22px;
  max-width: 62ch;
}

.site-intro h1 {
  margin: 10px 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2.3rem, 5.2vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.02;
}

.site-intro-lead {
  margin: 16px 0 0;
  max-width: 62ch;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
}

.controls-section,
.player {
  border: 1px solid var(--surface-border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.controls-section {
  border-radius: var(--radius-lg);
  padding: 32px;
}

.eyebrow {
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
}

.section-heading h2,
.player h2 {
  margin: 0;
  font-weight: 600;
  line-height: 1;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}

.button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  min-height: 46px;
  padding: 12px 18px;
  font-weight: 700;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background-color 160ms ease,
    color 160ms ease,
    opacity 160ms ease,
    box-shadow 160ms ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 12px 22px rgba(0, 0, 0, 0.08);
}

.button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.button-primary {
  color: white;
  background: linear-gradient(135deg, var(--accent), #e36b34);
}

.button-secondary {
  color: var(--text);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(247, 233, 215, 0.92));
  border: 1px solid var(--surface-border);
}

.button-record {
  color: white;
  background: linear-gradient(135deg, var(--accent), #e2572d);
  border: 1px solid transparent;
}

.button-reset {
  color: white;
  background: linear-gradient(135deg, var(--accent-2), #17a49a);
  border: 1px solid transparent;
}

.volume-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 10px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(247, 233, 215, 0.92));
  border: 1px solid var(--surface-border);
}

.volume-icon {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.volume-control input {
  width: 120px;
  accent-color: var(--accent-2);
}

.recorder-panel {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.76), rgba(247, 233, 215, 0.78));
  border: 1px solid rgba(192, 74, 34, 0.12);
}

.recorder-panel.is-recording {
  border-color: rgba(192, 74, 34, 0.28);
  box-shadow: inset 0 0 0 1px rgba(192, 74, 34, 0.08);
}

.recorder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recorder-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
}

.recorder-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--text);
  cursor: pointer;
}

.recorder-toggle-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.recorder-toggle-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.recorder-status strong {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.recorder-panel.is-recording .recorder-status strong {
  color: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}

.recorder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.recording-preview {
  width: 100%;
  min-height: 40px;
}

.recorder-panel.is-collapsed .recorder-body {
  display: none;
}

.station-card-actions,
.player-controls,
.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}


.section-heading h2 {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.85rem, 3vw, 2.75rem);
  letter-spacing: -0.03em;
  max-width: 14ch;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  align-items: start;
  gap: 20px;
  margin: 32px 0 18px;
}

.filter-group {
  flex: 1;
  align-items: center;
}

.filter-chip {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  cursor: pointer;
  font-weight: 600;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background-color 160ms ease,
    color 160ms ease;
}

.filter-chip.is-active {
  color: white;
  background: linear-gradient(135deg, var(--accent-2), #0ca8a0);
  border-color: transparent;
}

.filter-chip:hover,
.filter-chip:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.06);
}

.search-field {
  width: 100%;
}

.search-field input {
  width: 100%;
  min-height: 48px;
  padding: 13px 18px;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
}

.results-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.results-meta p {
  margin: 0;
}

.station-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.station-card {
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  background: rgba(255, 252, 247, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow:
    0 2px 4px rgba(53, 29, 13, 0.04),
    0 8px 24px rgba(53, 29, 13, 0.07),
    0 24px 48px rgba(53, 29, 13, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  position: relative;
  transition:
    transform 240ms cubic-bezier(0.2, 0, 0, 1),
    box-shadow 240ms cubic-bezier(0.2, 0, 0, 1),
    border-color 240ms ease;
}

.station-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0%, transparent 60%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
  z-index: 0;
}

.station-card:hover {
  transform: translateY(-6px);
  box-shadow:
    0 4px 8px rgba(53, 29, 13, 0.05),
    0 20px 48px rgba(53, 29, 13, 0.13),
    0 48px 80px rgba(53, 29, 13, 0.08);
  border-color: rgba(255, 255, 255, 0.8);
}

.station-card:hover::before {
  opacity: 1;
}

.station-card.is-selected {
  border-color: rgba(14, 139, 125, 0.55);
  box-shadow:
    0 0 0 2px rgba(14, 139, 125, 0.15),
    0 8px 28px rgba(14, 139, 125, 0.14),
    0 28px 56px rgba(14, 139, 125, 0.08);
}

.station-card-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 164px;
  background:
    linear-gradient(
      145deg,
      rgba(246, 234, 218, 0.85) 0%,
      rgba(255, 250, 245, 0.95) 50%,
      rgba(230, 242, 240, 0.85) 100%
    );
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
}

.station-logo-wrap {
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  border-radius: 26px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.07);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.station-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}


.station-status {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.station-status[data-status="ready"] {
  color: var(--accent-2);
  background: rgba(14, 139, 125, 0.1);
  border-color: rgba(14, 139, 125, 0.22);
}

.station-card-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 14px 18px 16px;
  position: relative;
  z-index: 1;
}

.station-language {
  margin: 0 0 3px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.station-name {
  margin: 0 0 6px;
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.22rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.station-description {
  margin: 0 0 10px;
  font-size: 0.875rem;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.station-category-tag {
  margin: 0 0 10px;
}

.station-category-tag span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent-2);
  background: rgba(14, 139, 125, 0.09);
  border: 1px solid rgba(14, 139, 125, 0.18);
}

.station-category-tag span::before {
  content: "";
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.station-card-actions {
  margin-top: auto;
}

.station-play-button {
  width: 100%;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 36px 24px;
  border-radius: var(--radius-md);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--surface-border);
}

.station-card--ad {
  align-items: stretch;
  padding: 16px;
  min-height: 280px;
}

.station-card--ad:hover {
  transform: none;
  box-shadow:
    0 2px 4px rgba(53, 29, 13, 0.04),
    0 8px 24px rgba(53, 29, 13, 0.07),
    0 24px 48px rgba(53, 29, 13, 0.04);
}

.ad-card-label {
  margin: 0 0 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}

.station-card--ad .adsbygoogle {
  width: 100%;
}

.player-shell {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  background: linear-gradient(to top, rgba(20, 10, 5, 0.38) 0%, transparent 100%);
}

.player {
  width: min(1440px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 22px;
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(145deg, rgba(26, 15, 8, 0.97) 0%, rgba(12, 34, 32, 0.97) 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 4px 24px rgba(0, 0, 0, 0.28),
    0 24px 64px rgba(0, 0, 0, 0.38),
    0 -16px 48px rgba(192, 74, 34, 0.09);
  backdrop-filter: blur(48px);
  -webkit-backdrop-filter: blur(48px);
  color: rgba(255, 250, 245, 0.92);
}

.player::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, rgba(192, 74, 34, 0.7), rgba(216, 160, 60, 0.8), rgba(14, 139, 125, 0.7));
  pointer-events: none;
  z-index: 1;
}

.player-station {
  min-width: 0;
  flex: 1;
}

.player-label {
  margin: 0 0 6px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 800;
}

#playerTitle {
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.35rem, 1.8vw, 2rem);
  letter-spacing: -0.03em;
}

#playerMeta {
  margin: 8px 0 0;
  max-width: 84ch;
}

.player .player-label {
  color: rgba(255, 250, 245, 0.45);
}

.player .recorder-panel {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
}

.player .recorder-panel.is-recording {
  border-color: rgba(192, 74, 34, 0.45);
  box-shadow: inset 0 0 0 1px rgba(192, 74, 34, 0.12);
}

.player .recorder-status {
  color: rgba(255, 250, 245, 0.6);
}

.player .recorder-toggle {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
  color: rgba(255, 250, 245, 0.88);
}

.player .button-secondary {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 250, 245, 0.9);
}

.player .volume-control {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.16);
  color: rgba(255, 250, 245, 0.9);
}

.player .volume-icon {
  color: rgba(255, 250, 245, 0.45);
}

@media (max-width: 1280px) {
  .page-shell,
  .player {
    width: min(1180px, 100%);
  }

  .station-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .page-shell {
    width: min(100% - 28px, 1120px);
  }

  .controls-section {
    padding: 24px;
  }

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

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

@media (max-width: 780px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
    padding-bottom: 124px;
  }

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

  .topbar,
  .results-meta,
  .player {
    flex-direction: column;
    align-items: stretch;
  }

  .controls-section {
    padding: 18px 16px;
  }

  .section-heading {
    align-items: start;
    flex-direction: column;
    gap: 8px;
  }

  .section-heading h2 {
    max-width: none;
    font-size: clamp(1.5rem, 7vw, 2rem);
  }

  .toolbar {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 24px;
  }

  .search-field {
    width: 100%;
  }

  .filter-group {
    gap: 8px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .filter-group::-webkit-scrollbar {
    display: none;
  }

  .filter-chip {
    flex: 0 0 auto;
    min-height: 42px;
    padding-inline: 13px;
  }

  .results-meta {
    gap: 8px;
  }

  .station-card-hero {
    height: 136px;
  }

  .station-logo-wrap {
    width: 92px;
    height: 92px;
    border-radius: 20px;
  }

  .station-card-body {
    padding: 12px 14px 14px;
  }

  .player {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "station controls"
      "recorder recorder";
    gap: 8px 10px;
    align-items: center;
    border-radius: 16px;
    padding: 8px 10px;
  }

  .player-controls {
    grid-area: controls;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .player-station {
    grid-area: station;
  }

  .player-label {
    margin-bottom: 4px;
    font-size: 0.72rem;
  }

  #playerTitle {
    font-size: clamp(1.05rem, 4.8vw, 1.45rem);
    line-height: 1.05;
  }

  #playerMeta {
    display: none;
  }

  .volume-control {
    min-height: 36px;
    padding: 6px 10px;
    flex: 0 1 128px;
    min-width: 108px;
  }

  .volume-control input {
    width: 76px;
  }

  .player-shell {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  }

  .recorder-panel {
    grid-area: recorder;
    gap: 6px;
    padding: 8px 10px;
  }

  .recorder-header {
    gap: 6px;
  }

  .recorder-toggle {
    min-height: 32px;
    padding: 5px 9px;
  }

  .recorder-toggle-label {
    font-size: 0.72rem;
  }

  .recorder-actions {
    gap: 6px;
  }
}

@media (max-width: 520px) {
  .topbar {
    gap: 6px;
    margin-bottom: 14px;
  }

  .brand-logo-wrap {
    height: 38px;
  }

  .brand-copy {
    display: none;
  }

  .nav-links {
    gap: 2px;
  }

  .nav-links a {
    padding: 6px 9px;
    font-size: 0.88rem;
  }

  .results-meta,
  .topbar {
    align-items: start;
  }

  .page-shell {
    padding-bottom: 108px;
  }

  .player {
    grid-template-columns: 1fr;
    grid-template-areas:
      "station"
      "controls"
      "recorder";
    gap: 8px;
    padding: 8px;
  }

  .station-card-actions,
  .player-controls {
    width: 100%;
  }

  .player-controls {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .player-controls .button {
    min-height: 36px;
    padding-inline: 12px;
    flex: 1 1 92px;
  }

  .volume-control {
    width: 100%;
    justify-content: space-between;
    flex: 1 1 100%;
    min-width: 0;
  }

  .volume-control input {
    width: min(100%, 148px);
  }

  .player-label {
    font-size: 0.68rem;
    margin-bottom: 3px;
  }

  #playerTitle {
    font-size: clamp(1rem, 5.6vw, 1.25rem);
  }

  .recorder-status {
    align-items: flex-start;
    flex-direction: column;
  }

  .recorder-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .recorder-header {
    align-items: flex-start;
  }

  .player-shell {
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom, 0px));
  }
}

/* Legal pages (privacy policy, DMCA) */
.page-shell--legal {
  padding-bottom: 40px;
}

/* When soft navigation keeps the player alive on a legal page, reserve room
   so the fixed player bar doesn't cover the footer. */
body.has-player .page-shell--legal {
  padding-bottom: calc(var(--player-height) + 60px);
}

.legal-main {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.legal-card {
  border: 1px solid var(--surface-border);
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: var(--radius-lg);
  padding: 40px clamp(24px, 5vw, 56px);
}

.legal-header {
  max-width: 70ch;
}

.legal-header h1 {
  margin: 12px 0 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.legal-updated {
  margin: 16px 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.legal-intro {
  margin: 18px 0 0;
  max-width: 70ch;
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--muted);
}

.legal-body {
  max-width: 74ch;
}

.legal-body h2 {
  margin: 40px 0 12px;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(1.3rem, 2.4vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  scroll-margin-top: 24px;
}

.legal-body h2:first-child {
  margin-top: 0;
}

.legal-body h3 {
  margin: 24px 0 8px;
  font-size: 1.05rem;
  font-weight: 700;
}

.legal-body p,
.legal-body li {
  font-size: 1rem;
  line-height: 1.75;
  color: var(--muted);
}

.legal-body p {
  margin: 0 0 14px;
}

.legal-body ul,
.legal-body ol {
  margin: 0 0 16px;
  padding-left: 22px;
}

.legal-body li {
  margin-bottom: 8px;
}

.legal-body li::marker {
  color: var(--accent);
}

.legal-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legal-body a:hover,
.legal-body a:focus-visible {
  color: var(--accent-2);
}

.legal-body strong {
  color: var(--text);
}

.legal-body code {
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  background: var(--surface-alt);
  border: 1px solid var(--surface-border);
}

.legal-divider {
  height: 1px;
  margin: 40px 0;
  border: 0;
  background: var(--surface-border);
}

.legal-contact {
  margin: 24px 0 0;
  padding: 20px 22px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(192, 74, 34, 0.07), rgba(216, 160, 60, 0.08));
  border: 1px solid rgba(192, 74, 34, 0.18);
}

.legal-contact h3 {
  margin: 0 0 6px;
}

.legal-contact p {
  margin: 0;
}

.legal-contact a {
  font-weight: 700;
}

/* Contact page */
.contact-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 28px;
  align-items: start;
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.contact-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.contact-field label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.contact-field input,
.contact-field textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.contact-field textarea {
  min-height: 140px;
  resize: vertical;
}

.contact-field input:focus,
.contact-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(192, 74, 34, 0.14);
}

.contact-form .button {
  align-self: flex-start;
}

.contact-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(192, 74, 34, 0.07), rgba(216, 160, 60, 0.08));
  border: 1px solid rgba(192, 74, 34, 0.18);
}

.contact-detail {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.contact-detail-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.contact-detail p {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.contact-detail a {
  color: var(--muted);
  text-decoration: none;
}

.contact-detail a:hover,
.contact-detail a:focus-visible {
  color: var(--accent);
}

@media (max-width: 720px) {
  .contact-layout {
    grid-template-columns: 1fr;
  }
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--accent);
}

/* Site footer */
.site-footer {
  margin-top: 40px;
  padding: 28px 4px;
  border-top: 1px solid var(--surface-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--accent);
}

.footer-copy {
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 520px) {
  .legal-card {
    padding: 28px 20px;
  }

  .site-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(1.5%, -1.5%, 0) scale(1.03);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.72;
  }
  50% {
    opacity: 1;
  }
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
}

.reveal.is-visible {
  animation: riseIn 560ms cubic-bezier(0.2, 0.75, 0.15, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .page-backdrop {
    animation: none;
  }
}

/* Soft-navigation (spa.js): show progress while the next page is fetched */
body.is-navigating {
  cursor: progress;
}

/* Theme toggle button */
.nav-toggle-item {
  display: inline-flex;
  align-items: center;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--surface-border);
  background: var(--surface);
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition:
    color 0.18s ease,
    background-color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--accent);
  background: var(--surface-alt);
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
}

/* Dark theme component overrides */
[data-theme="dark"] body::after {
  opacity: 0.16;
}

/* The brand wordmark is dark artwork; sit it on a light badge in dark mode */
[data-theme="dark"] .brand-logo-wrap {
  padding: 4px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.92);
}

[data-theme="dark"] .station-card {
  background: rgba(26, 30, 38, 0.82);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.3),
    0 8px 24px rgba(0, 0, 0, 0.4),
    0 24px 48px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .station-card::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.06) 0%, transparent 60%);
}

[data-theme="dark"] .station-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
  box-shadow:
    0 4px 8px rgba(0, 0, 0, 0.35),
    0 20px 48px rgba(0, 0, 0, 0.5),
    0 48px 80px rgba(0, 0, 0, 0.35);
}

[data-theme="dark"] .station-card-hero {
  background: linear-gradient(
    145deg,
    rgba(38, 43, 56, 0.9) 0%,
    rgba(26, 30, 38, 0.95) 50%,
    rgba(20, 36, 34, 0.9) 100%
  );
  border-bottom-color: rgba(255, 255, 255, 0.06);
}

/* Keep a light tile behind logos so they stay legible in dark mode */
[data-theme="dark"] .station-logo-wrap {
  background: #f1eee8;
  border-color: rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .station-status {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.14);
}
