/* radio.sextos.app: tokens and components from the shared design system (DESIGN.md in manavees/sextos.app). */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --text: #1c1b19;
  --muted: #6b6a64;
  --border: #e3e1da;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --accent-text: #ffffff;
  --danger: #b42318;
  --radius: 14px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #141413;
  --surface: #1e1e1c;
  --text: #efeee9;
  --muted: #9c9b94;
  --border: #34332f;
  --accent: #a78bfa;
  --accent-hover: #c4b5fd;
  --accent-text: #141413;
  --danger: #f97066;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #141413;
    --surface: #1e1e1c;
    --text: #efeee9;
    --muted: #9c9b94;
    --border: #34332f;
    --accent: #a78bfa;
    --accent-hover: #c4b5fd;
    --accent-text: #141413;
    --danger: #f97066;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
:is(a, button, input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Top bar */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 960px; margin: 0 auto; padding: 16px; }
.site-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.home-btn { display: inline-flex; align-items: center; height: 32px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: 999px; background: var(--surface); color: var(--text); font-size: .85rem; font-weight: 600; text-decoration: none; }
.home-btn:hover { border-color: var(--accent); }

.theme { position: relative; flex: none; width: 44px; height: 26px; padding: 0; cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.theme::after { content: "☀️"; position: absolute; top: 1px; left: 2px; width: 22px; height: 22px; font-size: 14px; line-height: 22px;
  text-align: center; border-radius: 50%; background: var(--border); transition: transform .2s; }
:root[data-theme="dark"] .theme::after { content: "🌙"; transform: translateX(18px); }

/* Page */
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px 140px; }
.intro h1 { margin: clamp(24px, 8vh, 72px) 0 12px; font-size: clamp(2.4rem, 10vw, 4rem); line-height: 1.05; letter-spacing: -0.03em; }
.intro h1 span { color: var(--muted); font-weight: 500; }
.lead { max-width: 34em; margin: 0 0 32px; color: var(--muted); font-size: 1.1rem; }

.stations { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.station {
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  width: 100%;
  height: 100%;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.station:hover, .station:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.station[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }

.mono { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 48px; height: 48px; border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--accent); font-weight: 700; letter-spacing: -0.02em; }
.station .mono { grid-row: 1 / 3; }
.station .name { align-self: end; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.station .tag { align-self: start; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }

/* Equalizer bars while a station is playing */
.eq { display: none; align-items: flex-end; gap: 2px; height: 14px; margin-left: 8px; vertical-align: middle; }
.station.is-playing .eq { display: inline-flex; }
.eq i { display: block; width: 3px; height: 100%; border-radius: 1px; background: var(--accent); transform-origin: bottom; animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: -.3s; }
.eq i:nth-child(3) { animation-delay: -.6s; }
@keyframes eq { 0%, 100% { transform: scaleY(.25); } 50% { transform: scaleY(1); } }

.empty { padding: 24px; border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface); color: var(--muted); text-align: center; }
.note { margin: 24px 0 0; color: var(--muted); font-size: 14px; }

/* Player bar, fixed to the bottom of the screen */
.player { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.player-inner { display: flex; align-items: center; gap: 16px; max-width: 960px; margin: 0 auto; padding: 12px 16px; }
.now { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.now-text { display: flex; flex-direction: column; min-width: 0; }
.now-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-text span { color: var(--muted); font-size: .85rem; }
.now-text span.is-error { color: var(--danger); }

.controls { display: flex; align-items: center; gap: 4px; }
.ctl { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%; background: var(--surface); color: var(--text); cursor: pointer; }
.ctl:hover { border-color: var(--muted); }
.ctl:disabled { opacity: .5; cursor: not-allowed; }
.ctl-main { width: 48px; height: 48px; background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.ctl-main:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.ctl-main .i-pause { display: none; }
.ctl-main.is-on .i-play { display: none; }
.ctl-main.is-on .i-pause { display: block; }

.volume { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.volume input { width: 110px; min-height: 32px; padding: 0; accent-color: var(--accent); }

@media (max-width: 640px) {
  .player-inner { flex-wrap: wrap; gap: 8px 12px; }
  .now { flex-basis: 100%; }
  .controls { flex: 1; justify-content: center; }
}
/* Phones control the volume with the hardware keys (and iOS ignores it in the page anyway) */
@media (pointer: coarse) { .volume { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .station, .theme::after { transition: none; }
  .station:hover, .station:focus-visible { transform: none; }
  .eq i { animation: none; transform: scaleY(.7); }
}
