/* Podcast Feed Sync – stili di base (4.7.2).
   Font e colori del testo si ereditano dagli elementi Bricks. */

.spe-cover,
.spe-play,
.spe-progress {
  --spe-accent: #ffffff; /* cerchi e barra */
  --spe-ink: #1b1f6e;    /* icona dentro il cerchio pieno */
}

/* ---------- Copertina ---------- */
.spe-cover {
  position: relative;
  border-radius: var(--spe-radius, 12px);
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
}
.spe-cover img {
  display: block;
  width: 100%;
  height: auto;
}
.spe-cover--ratio { aspect-ratio: var(--spe-ratio); }
.spe-cover--ratio img {
  height: 100%;
  object-fit: cover;
}
.spe-cover__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--spe-accent);
  color: var(--spe-ink);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  transition: transform 0.15s, opacity 0.15s;
}
.spe-cover__play svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}
.spe-cover__play:hover { transform: scale(1.06); }
.spe-cover__play:focus-visible {
  outline: 3px solid var(--spe-accent);
  outline-offset: 3px;
}

/* ---------- Video YouTube ---------- */
.spe-embed {
  position: relative;
  aspect-ratio: var(--spe-ratio, 16/9);
  border-radius: var(--spe-radius, 12px);
  isolation: isolate; /* Safari: rispetta gli angoli arrotondati */
  overflow: hidden;
  background: #000;
}
.spe-embed__facade,
.spe-embed__player,
.spe-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.spe-embed__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.spe-embed.is-active .spe-embed__facade { display: none; }
.spe-embed:not(.is-active) .spe-embed__player { display: none; }

/* ---------- Pulsante Riproduci ---------- */
.spe-play {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: left;
  cursor: pointer;
}
.spe-play__icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: var(--spe-play-size, 40px);
  height: var(--spe-play-size, 40px);
  border-radius: 50%;
  border: 0;
  background: var(--spe-play-bg, #3A3F85);
  color: var(--spe-play-fg, #fff);
  transition: background-color 0.15s, opacity 0.15s;
}
.spe-play:hover .spe-play__icon { background: var(--spe-play-bg-hover, #454B96); }
/* Dimensioni del design: play ~13×17, pausa 12×14.
   Selettori più specifici + !important: stili generici del tema o di Bricks sugli svg non possono ingrandirle.
   Per cambiarle usa le variabili (--spe-play-icon-w/h, --spe-pause-icon-w/h). */
.spe-play .spe-play__icon > svg.spe-i-play {
  width: var(--spe-play-icon-w, 13px) !important;
  height: var(--spe-play-icon-h, 17px) !important;
  max-width: none !important;
  transform: translateX(1.5px); /* centratura ottica, come nel design */
  fill: currentColor;
}
.spe-play .spe-play__icon > svg.spe-i-pause {
  width: var(--spe-pause-icon-w, 12px) !important;
  height: var(--spe-pause-icon-h, 14px) !important;
  max-width: none !important;
  fill: currentColor;
}
.spe-play .spe-play__icon {
  width: var(--spe-play-size, 40px) !important;
  height: var(--spe-play-size, 40px) !important;
}
.spe-play .spe-play__icon > svg.spe-play__ring {
  width: 100% !important;
  height: 100% !important;
}
.spe-play:focus-visible {
  outline: 2px solid var(--spe-accent);
  outline-offset: 4px;
  border-radius: 999px;
}

/* Icona play/pausa condivisa */
.spe-i-pause,
.is-playing .spe-i-play { display: none !important; }
.is-playing .spe-i-pause { display: block !important; }

/* Anello di avanzamento attorno al cerchio: visibile in riproduzione e in pausa */
.spe-play__icon { position: relative; }
.spe-play__icon svg.spe-play__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg); /* parte dall'alto */
  pointer-events: none;
  overflow: visible;
  opacity: 0;
  transition: opacity 0.15s;
}
.spe-play__ring circle {
  fill: none;
  stroke-width: var(--spe-ring-width, 2); /* unità del viewBox 40×40: con il cerchio a 40px equivale a px */
}
.spe-play__ring-track { stroke: var(--spe-ring-track, rgba(255, 255, 255, 0.1)); }
.spe-play__ring-bar {
  stroke: var(--spe-ring-color, #fff);
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset 0.5s linear;
}
.spe-play--ring.is-playing .spe-play__ring,
.spe-play--ring.is-resume .spe-play__ring { opacity: 1; }

.spe-play.is-loading .spe-play__icon,
.spe-cover__play.is-loading { opacity: 0.6; }

/* ---------- Barra di avanzamento (facoltativa) ---------- */
.spe-progress {
  display: flex;
  align-items: center;
  gap: 0.75em;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}
.spe-progress input[type="range"] {
  flex: 1;
  min-width: 0;
  height: 4px;
  margin: 0;
  border-radius: 2px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(
    to right,
    var(--spe-accent) var(--spe-pct, 0%),
    color-mix(in srgb, var(--spe-accent) 25%, transparent) var(--spe-pct, 0%)
  );
  cursor: pointer;
}
.spe-progress input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--spe-accent);
}
.spe-progress input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--spe-accent);
}
.spe-progress input[type="range"]:focus-visible {
  outline: 2px solid var(--spe-accent);
  outline-offset: 6px;
}

/* Barra: spessore regolabile; thumb="0" nasconde il pallino finché non ci passi sopra */
.spe-progress input[type="range"] { height: var(--spe-track-height, 4px); }
.spe-progress--nothumb input[type="range"]::-webkit-slider-thumb { opacity: 0; transition: opacity 0.15s; }
.spe-progress--nothumb input[type="range"]::-moz-range-thumb { opacity: 0; transition: opacity 0.15s; }
.spe-progress--nothumb:hover input[type="range"]::-webkit-slider-thumb,
.spe-progress--nothumb input[type="range"]:focus-visible::-webkit-slider-thumb { opacity: 1; }
.spe-progress--nothumb:hover input[type="range"]::-moz-range-thumb,
.spe-progress--nothumb input[type="range"]:focus-visible::-moz-range-thumb { opacity: 1; }

/* [spe_play label="0"]: solo il cerchio (il testo resta per gli screen reader) */
.spe-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.spe-play--icon { gap: 0; }

/* ---------- Avanti / indietro ---------- */
.spe-nav {
  display: inline-grid;
  place-items: center;
  width: var(--spe-nav-size, 32px);
  height: var(--spe-nav-size, 32px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--spe-nav-color, #fff);
  cursor: pointer;
  transition: opacity 0.15s, background-color 0.15s;
}
.spe-nav svg {
  width: var(--spe-nav-icon, 15px);
  height: var(--spe-nav-icon, 15px);
  fill: currentColor;
}
.spe-nav:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.spe-nav:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.spe-nav:disabled { opacity: 0.35; cursor: default; }
.spe-is-swapping [data-spe-part] { opacity: 0.6; transition: opacity 0.15s; }
.spe-title { margin: 0; }

/* ---------- Descrizione con "Mostra di più" ---------- */
.spe-desc__text {
  white-space: pre-line;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--spe-lines, 3);
  line-clamp: var(--spe-lines, 3);
  overflow: hidden;
}
.spe-desc.is-open .spe-desc__text {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}
.spe-desc__toggle {
  margin-top: 0.25em;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.spe-desc__toggle[hidden] { display: none; }

/* ---------- Finestra "Mostra di più" ---------- */
/* Personalizzabile da Bricks con le variabili:
   --spe-modal-bg, --spe-modal-fg, --spe-modal-radius, --spe-modal-width */
.spe-modal {
  width: min(var(--spe-modal-width, 680px), calc(100% - 32px));
  max-height: min(85vh, 900px);
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: var(--spe-modal-radius, 20px);
  background: var(--spe-modal-bg, #24276f);
  color: var(--spe-modal-fg, #ffffff);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.spe-modal:not([open]) { display: none; }
.spe-modal::backdrop {
  background: rgba(8, 10, 40, 0.65);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.spe-modal[open] { animation: spe-modal-in 0.18s ease-out; }
@keyframes spe-modal-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.spe-modal__inner {
  position: relative;
  max-height: min(85vh, 900px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 40px 40px 32px;
}
.spe-modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: color-mix(in srgb, currentColor 10%, transparent);
  color: inherit;
  cursor: pointer;
}
.spe-modal__close svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}
.spe-modal__close:hover { background: color-mix(in srgb, currentColor 18%, transparent); }
.spe-modal__close:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.spe-modal__title {
  margin: 0 48px 8px 0;
  font-size: 1.5em;
  line-height: 1.2;
  color: inherit;
}
.spe-modal__meta {
  margin: 0 0 24px;
  font-size: 0.875em;
  opacity: 0.7;
}
.spe-modal__body {
  font-size: 1em;
  line-height: 1.65;
  max-width: 65ch;
}
.spe-modal__body > * { margin: 0 0 1em; }
.spe-modal__body > *:last-child { margin-bottom: 0; }
.spe-modal__body a { color: inherit; text-decoration: underline; }
.spe-modal__body ul,
.spe-modal__body ol { padding-left: 1.25em; }
html.spe-modal-open { overflow: hidden; } /* niente scroll della pagina sotto la finestra */

@media (max-width: 600px) {
  .spe-modal__inner { padding: 56px 20px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .spe-modal[open] { animation: none; }
  .spe-play__ring,
  .spe-play__ring-bar { transition: none; }
  .spe-cover__play,
  .spe-play__icon { transition: none; }
  .spe-cover__play:hover { transform: none; }
}
