/* ==========================================================
   POLI.RADIO - stile homepage
   ========================================================== */

/* --- Variabili: colori e misure usati in tutto il sito --- */
:root {
  --brand: #57b7de;        /* colore di riferimento POLI.RADIO: menu, player */
  --brand-scuro: #3596be;
  --blu: #1a7fff;          /* colore di riserva dei programmi */
  --blu-scuro: #0f5fd1;
  --rosso: #ff3b3b;
  --testo: #111;
  --sfondo-pagina: #f4f6fa;
  --bordo: #111;
  --raggio: 18px;
  --larghezza-max: 1280px;
}

/* --- Reset di base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  /* Futura è già installato su Mac e iPhone; altrove si usa Jost (gratuito, quasi identico) */
  font-family: Futura, "Futura PT", Jost, "Century Gothic", sans-serif;
  color: var(--testo);
  background: var(--sfondo-pagina);
}

a {
  color: inherit;
}

/* ==========================================================
   HEADER
   ========================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.9rem 2rem;
  background: var(--brand);
  color: #fff;
}

.logo {
  display: flex;
  align-items: flex-start;
  gap: 0.2rem;
  text-decoration: none;
  flex-shrink: 0;
}

.logo__testo {
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1;
  letter-spacing: 0.02em;
}

.logo__onde {
  width: 22px;
  height: 22px;
  fill: #fff;
  stroke: #fff;
  stroke-width: 2.2;
  stroke-linecap: round;
}
.logo__onde path {
  fill: none;
}

/* Menu: spinto a destra, si può scorrere in orizzontale su schermi piccoli */
.nav {
  display: flex;
  gap: 2rem;
  margin-left: auto;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar {
  display: none;
}

.nav__link {
  position: relative;
  padding: 0.3rem 0;
  font-weight: 600;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
}

/* sottolineatura animata */
.nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 2px;
  background: #fff;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}
.nav__link:hover::after,
.nav__link--attivo::after {
  transform: scaleX(1);
}

.nav__link--altro {
  letter-spacing: 0.1em;
}

.account {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-scuro);
  flex-shrink: 0;
}
.account svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ==========================================================
   CONTENUTO
   ========================================================== */
.contenuto {
  max-width: var(--larghezza-max);
  margin: 0 auto;
  padding: 1.5rem;
  display: grid;
  /* minmax(0, 1fr) impedisce al carosello di allargare la pagina */
  grid-template-columns: minmax(0, 1fr);
  gap: 0.75rem;
}

/* Card con lo sfondo del programma.
   L'immagine arriva dalla variabile --sfondo (impostata nell'HTML);
   sopra c'è un velo scuro per far leggere bene il testo bianco.
   Se l'immagine manca resta il gradiente blu. */
.card {
  position: relative;
  border: 2px solid var(--bordo);
  border-radius: var(--raggio);
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(110deg, rgba(5, 15, 40, 0.85) 0%, rgba(5, 15, 40, 0.45) 100%),
    var(--sfondo, none) center / cover no-repeat,
    linear-gradient(135deg, #0b1f4d, var(--blu));
}

/* ---------- Blocco LIVE ---------- */
.live {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 2rem;
  align-items: center;
  padding: 2rem;
  min-height: 420px;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  font-size: 1.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pallino {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--rosso);
  animation: pulsa 1.6s ease-in-out infinite;
}

@keyframes pulsa {
  0%   { box-shadow: 0 0 0 0 rgba(255, 59, 59, 0.7); }
  70%  { box-shadow: 0 0 0 10px rgba(255, 59, 59, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 59, 0); }
}

.orario {
  margin: 0.8rem 0 0;
  font-size: 1.25rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.orario__sep {
  margin: 0 0.4rem;
  opacity: 0.6;
}

.live__titolo {
  margin: 1.5rem 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 800;
  line-height: 1.05;
  text-transform: uppercase;
}

.live__link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.8rem;
  padding-left: 1.5rem;
}
.live__link a {
  font-size: 1.15rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
}
.live__link a:hover {
  text-decoration-color: var(--rosso);
}

/* ---------- Video Twitch ---------- */
.video {
  aspect-ratio: 16 / 9;
  border: 2px solid #fff;
  border-radius: calc(var(--raggio) + 6px);
  overflow: hidden;
  background: #000;
}

.video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.video__segnaposto {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  font-size: 1.4rem;
  font-weight: 800;
  text-transform: uppercase;
  background: linear-gradient(135deg, #1b1033, #6441a5);
}
.video__segnaposto svg {
  width: 64px;
  height: 64px;
  fill: #fff;
}

/* ---------- Link alla diretta Twitch (solo telefono) ---------- */
.link-twitch {
  display: none;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 1rem;
  border: 2px solid #fff;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.1);
  text-decoration: none;
}
.link-twitch__icona {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #fff;
  flex-shrink: 0;
}
.link-twitch__icona svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #0b1f4d;
  stroke-width: 2;
  stroke-linejoin: round;
}
.link-twitch__testi {
  display: flex;
  flex-direction: column;
  margin-right: auto;
}
.link-twitch__titolo {
  font-size: 1.15rem;
  font-weight: 800;
  text-transform: uppercase;
}
.link-twitch__sotto {
  font-size: 0.9rem;
  opacity: 0.8;
}

/* ---------- Blocco A SEGUIRE ---------- */
.seguire {
  padding: 1.4rem 2rem;
}

.seguire__riga {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 2rem;
}

.seguire__etichetta {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.seguire__programma h2 {
  margin: 0;
  max-width: 22ch;
  font-size: 1.15rem;
  font-weight: 600;
  text-transform: uppercase;
}

.orario--piccolo {
  margin: 0;
  font-size: 1.4rem;
}

/* ==========================================================
   SELETTORE VERSIONE (V1 / V2)
   ========================================================== */
/* Nella versione 1 gli elementi della versione 2 sono nascosti */
body[data-versione="1"] .solo-v2,
body[data-versione="2"] .solo-v1 {
  display: none;
}

.versioni {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--brand-scuro);
  flex-shrink: 0;
}

.versioni button {
  min-width: 44px;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 0.85rem;
  cursor: pointer;
}

.versioni button[aria-pressed="true"] {
  background: #fff;
  color: var(--brand-scuro);
}

.versioni button:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--rosso);
  outline-offset: 2px;
}

/* ==========================================================
   VERSIONE 2: elementi apribili (details / summary)
   ========================================================== */
summary {
  cursor: pointer;
  list-style: none;
}
summary::-webkit-details-marker {
  display: none;
}

/* Freccia dentro un cerchio, disegnata in CSS */
.freccia {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.freccia::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 42%;
  width: 30%;
  height: 30%;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translate(-50%, -50%) rotate(45deg);
}
.freccia--su {
  transform: rotate(180deg);
}
.freccia--destra {
  transform: rotate(-90deg);
}
.freccia--sinistra {
  transform: rotate(90deg);
}
.freccia--grande {
  width: 42px;
  height: 42px;
  border-width: 3px;
}
.freccia--grande::before {
  border-width: 3px;
}

/* quando il blocco è aperto la freccia si gira */
details[open] > summary .freccia {
  transform: rotate(180deg);
}
details[open] > summary .freccia--su {
  transform: rotate(0deg);
}

/* ---------- Link "Scopri le ultime puntate" (dentro il blocco LIVE) ---------- */
.puntate {
  grid-column: 1 / -1;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: -1rem;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  text-decoration: none;
}
.puntate:hover .freccia {
  transform: rotate(-90deg) translateY(3px);
}

/* ---------- Prossimo programma / A seguire: pannello informazioni ----------
   Il pannello è "appoggiato" sopra la barra (bottom: 100%) e copre quello che
   c'è sopra, senza spostare il resto della pagina. È alto quanto il suo testo. */
.seguire {
  position: relative;
  z-index: 5;
  overflow: visible;
  padding-left: 3.2rem;
}

/* quando è aperto, gli angoli in alto della barra diventano dritti per unirsi al pannello */
.seguire:has(.seguire-info[open]) {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  border-top-color: transparent;
}

.seguire-info__pulsante {
  position: absolute;
  top: 10px;
  left: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
}

.seguire-info__testo {
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: 100%;
  padding: 1.4rem 2rem 1rem 3.2rem;
  border: 2px solid var(--bordo);
  border-bottom: 0;
  border-radius: var(--raggio) var(--raggio) 0 0;
  /* stesso sfondo della barra (velo scuro + foto del programma + colore di riserva) */
  background:
    linear-gradient(110deg, rgba(5, 15, 40, 0.9) 0%, rgba(5, 15, 40, 0.6) 100%),
    var(--sfondo, none) center / cover no-repeat,
    linear-gradient(135deg, #0b1f4d, var(--blu));
  box-shadow: 0 -12px 30px rgba(0, 0, 0, 0.25);
  animation: sali 0.2s ease-out;
}

/* linea che separa il pannello dalla barra */
.seguire-info__testo::after {
  content: "";
  position: absolute;
  left: 3.2rem;
  right: 2rem;
  bottom: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

.seguire-info__testo p {
  max-width: 70ch;
  margin: 0 0 0.6rem;
  line-height: 1.55;
}
.seguire-info__testo a {
  font-weight: 600;
}

@keyframes sali {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- Fasce bianche: canzone (V1) e ultimo articolo (V2) ---------- */
.fascia {
  border: 2px solid var(--bordo);
  border-radius: var(--raggio);
  background: #fff;
}

.fascia__riga {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
  padding: 1.2rem 2rem;
}

.articolo__etichetta {
  padding-right: 1.5rem;
  border-right: 3px solid var(--bordo);
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
}

.fascia__titolo {
  margin: 0;
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.fascia__leggi {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}
.fascia__riga:hover .fascia__leggi {
  color: var(--blu);
}

.fascia__anteprima {
  padding: 0 2rem 1.4rem;
  max-width: 70ch;
}
.fascia__anteprima p {
  margin-top: 0;
  line-height: 1.55;
}
.fascia__anteprima a {
  font-weight: 600;
  color: var(--blu);
}

/* ==========================================================
   V1: CAROSELLO ULTIMI ARTICOLI
   ========================================================== */
.carosello__testa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.8rem;
}

.carosello__titolo {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.carosello__comandi {
  display: flex;
  gap: 0.5rem;
}

.carosello__btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--testo);
  cursor: pointer;
}
.carosello__btn .freccia {
  width: 36px;
  height: 36px;
}
.carosello__btn:disabled {
  opacity: 0.25;
  cursor: default;
}
.carosello__btn:focus-visible {
  outline: 3px solid var(--blu);
  border-radius: 50%;
}

/* La traccia scorre in orizzontale e si "aggancia" a ogni card */
.carosello__traccia {
  --spazio: 1rem;
  --visibili: 4;
  list-style: none;
  margin: 0;
  padding: 6px 0 0.4rem;
  display: flex;
  gap: var(--spazio);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.carosello__traccia::-webkit-scrollbar {
  display: none;
}
.carosello__traccia:focus-visible {
  outline: 3px solid var(--blu);
  outline-offset: 4px;
}

/* larghezza card = (spazio totale - spazi tra le card) / numero di card visibili */
.articolo-card {
  flex: 0 0 calc((100% - (var(--visibili) - 1) * var(--spazio)) / var(--visibili));
  scroll-snap-align: start;
  aspect-ratio: 3 / 4;
  border: 2px solid var(--bordo);
  border-radius: var(--raggio);
  overflow: hidden;
  /* foto dell'articolo con un velo scuro in basso per leggere il titolo;
     se la foto manca resta il colore di riserva */
  background:
    linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 55%),
    var(--foto, none) center / cover no-repeat,
    var(--riserva, #2a3b66);
}

/* colori di riserva diversi finché non ci sono le foto */
.articolo-card:nth-child(4n + 1) { --riserva: linear-gradient(160deg, #1a7fff, #0b1f4d); }
.articolo-card:nth-child(4n + 2) { --riserva: linear-gradient(160deg, #ff7a59, #7a1f3d); }
.articolo-card:nth-child(4n + 3) { --riserva: linear-gradient(160deg, #2fbf8f, #0d3b40); }
.articolo-card:nth-child(4n + 4) { --riserva: linear-gradient(160deg, #f2b632, #7a3d0b); }

.articolo-card a {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 0.4rem;
  padding: 1.2rem;
  color: #fff;
  text-decoration: none;
}

.articolo-card__data {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.85;
}

.articolo-card__titolo {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 800;
  line-height: 1.1;
  text-transform: uppercase;
}

.articolo-card {
  transition: transform 0.2s ease;
}
.articolo-card:hover {
  transform: translateY(-4px);
}

/* ---------- Canzone in riproduzione ---------- */
.canzone__cover {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border: 2px solid var(--bordo);
  border-radius: 8px;
  background: linear-gradient(135deg, #eef8fc, #c8e7f4);
}
.canzone__cover svg {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--brand-scuro);
  stroke-width: 1.8;
}

.canzone__testi {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.canzone__etichetta {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--brand);
}
.canzone__artista {
  font-weight: 600;
  opacity: 0.7;
}

/* ---------- Pulsante Play / Pausa ---------- */
.play {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.play:hover {
  background: var(--brand-scuro);
  transform: scale(1.05);
}
.play:focus-visible {
  outline: 3px solid var(--rosso);
  outline-offset: 3px;
}
.play svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}
/* mostra l'icona giusta in base allo stato */
.play__icona-pausa,
.play[aria-pressed="true"] .play__icona-play {
  display: none;
}
.play[aria-pressed="true"] .play__icona-pausa {
  display: block;
}

/* ==========================================================
   RESPONSIVE (tablet e telefono)
   ========================================================== */
@media (max-width: 900px) {
  .header {
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    padding: 0.8rem 1rem;
  }
  /* il menu va su una riga tutta sua sotto logo e account */
  .nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    gap: 1.4rem;
  }
  .versioni {
    margin-left: auto;
  }

  .puntate {
    justify-self: start;
    margin-top: 0;
  }

  .fascia__riga {
    grid-template-columns: 1fr auto;
    gap: 0.8rem 1rem;
    padding: 1.2rem 1.4rem;
  }
  .articolo__etichetta {
    grid-column: 1 / -1;
    padding-right: 0;
    border-right: 0;
  }
  .articolo__etichetta br {
    display: none;
  }

  .articolo-card {
    aspect-ratio: 4 / 5;
  }

  .canzone__cover {
    width: 56px;
    height: 56px;
  }
  .fascia__riga:has(.canzone__cover) {
    grid-template-columns: auto 1fr auto;
  }
  .play {
    width: 52px;
    height: 52px;
  }
  .seguire-info__testo {
    padding: 1.2rem 1.4rem 0.8rem 3.2rem;
  }
  .seguire-info__testo::after {
    right: 1.4rem;
  }
  .fascia__anteprima {
    padding: 0 1.4rem 1.2rem;
  }

  .contenuto {
    padding: 1rem;
  }

  .live {
    grid-template-columns: 1fr;
    padding: 1.4rem;
    min-height: 0;
  }

  .seguire {
    padding: 1.2rem 1.4rem 1.2rem 3.2rem;
  }
  .seguire__riga {
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1rem;
  }
  .seguire__etichetta {
    grid-column: 1 / -1;
    font-size: 1.3rem;
  }
  .orario--piccolo {
    font-size: 1.1rem;
  }
}

@media (min-width: 601px) and (max-width: 900px) {
  .carosello__traccia {
    --visibili: 2;
  }
}
/* ---------- Solo telefono ---------- */
@media (max-width: 600px) {
  .carosello__traccia {
    --visibili: 1;
  }
  /* il player "Ora in riproduzione" va in cima alla pagina */
  .fascia.solo-v1 {
    order: -1;
  }

  /* carosello un po' più basso */
  .articolo-card {
    aspect-ratio: 1 / 1;
  }

  /* niente video: c'è il link alla diretta */
  .video {
    display: none;
  }
  .link-twitch {
    display: flex;
  }
}

@media (prefers-reduced-motion: reduce) {
  .carosello__traccia { scroll-behavior: auto; }
  .seguire-info__testo { animation: none; }
  .pallino { animation: none; }
}
