:root {
  --bg: #0e1210;
  --surface: #171d19;
  --surface-2: #1f2723;
  --ink: #f2f4f1;
  --muted: #9aa39c;
  --line: #2b332e;
  --brand: #5f950e;
  --brand-hi: #7ab813;
  --accent: #5f950e;
  --accent-ink: #ffffff;
  --radius: 14px;
  --radius-sm: 9px;
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }

a { color: var(--brand-hi); }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }

.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;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Header ---------- */

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 20px;
  flex-wrap: wrap;
}

.brand img { height: 34px; width: auto; }

.site-nav { display: flex; gap: 20px; flex-wrap: wrap; }
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--brand-hi); color: var(--ink); }

/* ---------- Hero ---------- */

.hero {
  background-size: cover;
  background-position: center;
  padding: 90px 0 70px;
}

.hero-inner { text-align: center; }
.hero-logo { max-width: 320px; margin: 0 auto 18px; }
.hero-tagline {
  color: var(--muted);
  font-size: 17px;
  margin: 0;
}

/* ---------- Stations grid (home) ---------- */

.stations-section { padding: 56px 0 20px; }

.stations-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
}

.station-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color .15s, transform .15s;
}
.station-card:hover { border-color: var(--accent); }

.station-card-media {
  aspect-ratio: 16 / 9;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.station-card-media img { width: 100%; height: 100%; object-fit: cover; }

.station-card-media.logo-only {
  aspect-ratio: 21 / 9;
  background-image: linear-gradient(135deg, rgba(255,255,255,.14), rgba(0,0,0,.14));
}
.station-card-media.logo-only img { width: auto; height: auto; max-width: 55%; max-height: 65%; object-fit: contain; }

.station-card-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.station-card-body h2 { margin: 0; font-size: 20px; }
.station-card-body h2 a { color: var(--ink); text-decoration: none; }
.station-card-body h2 a:hover { color: var(--accent); }
.station-card-tagline { margin: 0; color: var(--muted); font-size: 14px; }

.card-link {
  margin-top: auto;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
}
.card-link:hover { text-decoration: underline; }

/* ---------- Player ---------- */

.player {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  flex-wrap: wrap;
}

.play-btn {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .1s;
}
.play-btn:hover { transform: scale(1.05); }
.play-btn:active { transform: scale(.97); }
.play-btn svg { width: 26px; height: 26px; fill: currentColor; }

/* Solo un'icona alla volta: pilotato da data-state sul .player, non dall'attributo
   "hidden" (inaffidabile su <svg> tra browser diversi). Play è il default. */
.play-btn [data-icon-play] { display: block; }
.play-btn [data-icon-pause],
.play-btn [data-icon-loading] { display: none; }

.player[data-state="connecting"] .play-btn [data-icon-play] { display: none; }
.player[data-state="connecting"] .play-btn [data-icon-loading] { display: block; }

.player[data-state="playing"] .play-btn [data-icon-play] { display: none; }
.player[data-state="playing"] .play-btn [data-icon-pause] { display: block; }

.player--mini .play-btn { width: 48px; height: 48px; }
.player--mini .play-btn svg { width: 20px; height: 20px; }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.now-playing { flex: 1 1 160px; min-width: 0; }
.np-status { margin: 0; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.np-track {
  margin: 2px 0 0;
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-height: 1.2em;
}
.np-listeners { margin: 0; font-size: 12px; color: var(--muted); flex: 0 0 auto; }

.volume-control { flex: 0 0 auto; }
.volume-control input[type="range"] {
  width: 100px;
  accent-color: var(--accent);
}

/* ---------- About / Chi siamo ---------- */

.about-section { padding: 46px 0 70px; }
.about-section h2 { font-size: 22px; margin-bottom: 16px; }
.about-section p { color: var(--muted); max-width: 760px; }
.about-section a { color: var(--brand-hi); font-weight: 600; }

/* ---------- Station page ---------- */

.station-hero {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 40px;
  padding: 56px 0 40px;
  align-items: start;
}

.station-art {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--accent);
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.station-art img { width: 100%; height: 100%; object-fit: contain; }

.station-art--wide {
  aspect-ratio: 21 / 9;
  padding: 20px 34px;
  background-image: linear-gradient(135deg, rgba(255,255,255,.14), rgba(0,0,0,.14));
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent);
}

.station-info h1 { margin: 0 0 6px; font-size: 32px; }
.station-tagline { color: var(--muted); margin: 0 0 22px; font-size: 16px; }

.station-link { margin-top: 18px; color: var(--muted); font-size: 14px; }
.station-link a { color: var(--accent); font-weight: 600; }

.history-section { padding: 10px 0 40px; }
.history-section h2 { font-size: 20px; margin-bottom: 16px; }

.history-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.history-empty { color: var(--muted); font-size: 14px; }

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.history-cover { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--surface-2); }
.history-meta { min-width: 0; }
.history-title { margin: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-time { margin: 2px 0 0; font-size: 12px; color: var(--muted); }

.station-extra {
  padding: 10px 0 60px;
  color: var(--muted);
  max-width: 760px;
}
.station-extra h2, .station-extra h3 { color: var(--ink); }
.station-extra .check-list { list-style: none; padding: 0; }
.station-extra .check-list li::before { content: "\2714  "; color: var(--accent); }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); padding: 30px 0; margin-top: 20px; }
.site-footer-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-logo { height: 26px; width: auto; opacity: .8; }
.site-footer p { margin: 0; color: var(--muted); font-size: 13px; }
.site-footer a { color: var(--muted); }

/* ---------- 404 ---------- */

.error-section { padding: 100px 0; text-align: center; }
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
  .station-hero { grid-template-columns: 240px 1fr; gap: 28px; }
}

@media (max-width: 720px) {
  .stations-grid { grid-template-columns: 1fr; }
  .station-hero { grid-template-columns: 1fr; }
  .station-art { max-width: 220px; margin: 0 auto; }
  .hero { padding: 60px 0 44px; }
  .hero-logo { max-width: 240px; }
  .site-header-inner { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .spin { animation: none; }
  .play-btn { transition: none; }
  .station-card { transition: none; }
}
