/* ==========================================================================
   BTM ITALIA — SEZIONI "IN ARRIVO": RELATORI E PROGRAMMA
   --------------------------------------------------------------------------
   Componenti: countdown, carosello continuo (marquee), schede relatore
   segnaposto, programma a schede-giorno con righe "fuori fuoco".
   Tutti i valori vengono dalle variabili di btm-theme.css.
   Caricato dopo btm-components.css.
   ========================================================================== */


/* --------------------------------------------------------------------------
   0. CORREZIONI GLOBALI
   (da spostare in btm-volia-skin.css al prossimo aggiornamento)
   -------------------------------------------------------------------------- */

/* Volia: button { outline: none !important } cancella il focus da tastiera
   su tutti i bottoni. Lo ripristiniamo solo per la navigazione da tastiera. */
button:focus-visible {
  outline: 3px solid var(--btm-color-primary) !important;
  outline-offset: 3px;
}

/* I link interni (#...) non finiscono sotto l'header fisso */
[id] {
  scroll-margin-top: calc(var(--btm-header-h) + 16px);
}


/* --------------------------------------------------------------------------
   1. SEZIONE
   -------------------------------------------------------------------------- */
.btm-teaser {
  padding-block: var(--btm-section-space);
}

.btm-teaser--program {
  border-top: 1px solid var(--btm-color-border);
  border-bottom: 1px solid var(--btm-color-border);
  background: var(--btm-color-bg);
}

.btm-teaser__head {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) auto;
  gap: 48px;
  align-items: end;
  margin-bottom: 56px;
}

.btm-teaser__head--single {
  grid-template-columns: minmax(0, 1fr);
}

.btm-teaser__title {
  margin-bottom: 20px;
}

.btm-teaser__intro .btm-lead {
  max-width: 620px;
}

.btm-teaser__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  margin-top: 40px;
}

/* Link testuale con freccia */
.btm-link-arrow,
.btm-link-arrow:link,
.btm-link-arrow:visited {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--btm-color-primary);
  font-family: var(--btm-font-body);
  font-size: 0.85rem;
  font-weight: var(--btm-weight-strong);
  letter-spacing: 1px;
  text-transform: uppercase;
}

.btm-link-arrow::after {
  content: '\2192';
  transition: transform var(--btm-transition);
}

.btm-link-arrow:hover {
  color: var(--btm-color-primary-dark);
}

.btm-link-arrow:hover::after {
  transform: translateX(4px);
}


/* --------------------------------------------------------------------------
   2. COUNTDOWN
   -------------------------------------------------------------------------- */
.btm-countdown__label {
  margin: 0 0 14px;
  color: var(--btm-color-muted);
  font-family: var(--btm-font-body);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.btm-countdown__units {
  display: flex;
}

.btm-countdown__unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 4.5ch;
  padding: 0 18px;
  border-left: 1px solid var(--btm-color-border);
}

.btm-countdown__unit:first-child {
  padding-left: 0;
  border-left: 0;
}

.btm-countdown__value {
  color: var(--btm-color-text);
  font-family: var(--btm-font-serif);
  font-size: clamp(2.4rem, 4vw, 3.6rem);
  font-weight: 300;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.btm-countdown__unit:first-child .btm-countdown__value {
  color: var(--btm-color-primary);
}

.btm-countdown__name {
  margin-top: 10px;
  color: var(--btm-color-muted);
  font-family: var(--btm-font-body);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.btm-countdown__done {
  margin: 0;
  color: var(--btm-color-text);
  font-family: var(--btm-font-serif);
  font-size: 1.4rem;
  font-weight: 300;
  line-height: 1.4;
}


/* --------------------------------------------------------------------------
   3. CAROSELLO CONTINUO (marquee)
   Senza JS o con "riduci animazioni": fila scorrevole a mano.
   Con JS: .is-animated, scorrimento continuo con copie delle schede.
   Le schede usano margin-right (non gap) perché il giro sia esatto al 50%.
   -------------------------------------------------------------------------- */
.btm-marquee {
  position: relative;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 8px;
}

.btm-marquee::-webkit-scrollbar {
  display: none;
}

.btm-marquee__track {
  display: flex;
  width: max-content;
  margin: 0;
  padding: 0 0 0 max(var(--btm-gutter), calc((100vw - var(--btm-container)) / 2));
  list-style: none;
}

.btm-marquee.is-animated {
  overflow: hidden;
  scroll-snap-type: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 6%, #000 94%, transparent 100%);
}

.btm-marquee.is-animated .btm-marquee__track {
  padding: 0;
  animation: btm-marquee var(--btm-marquee-duration, 60s) linear infinite;
  will-change: transform;
}

.btm-marquee.is-animated:hover .btm-marquee__track,
.btm-marquee.is-animated:focus-within .btm-marquee__track,
.btm-marquee.is-paused .btm-marquee__track {
  animation-play-state: paused;
}

@keyframes btm-marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Bottone pausa del carosello */
.btm-pause {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--btm-color-border);
  border-radius: 50%;
  background: var(--btm-color-bg);
  color: var(--btm-color-text);
  cursor: pointer;
  transition: border-color var(--btm-transition), color var(--btm-transition);
}

.btm-pause[hidden] {
  display: none;
}

.btm-pause:hover {
  border-color: var(--btm-color-primary);
  color: var(--btm-color-primary);
}

.btm-pause svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.btm-pause .btm-icon-play { display: none; }
.btm-pause[aria-pressed="true"] .btm-icon-play { display: block; }
.btm-pause[aria-pressed="true"] .btm-icon-pause { display: none; }


/* --------------------------------------------------------------------------
   4. SCHEDA RELATORE (segnaposto)
   La "foto" è una sagoma sfumata disegnata con gradienti: nessuna immagine,
   nessuna persona reale. Cinque varianti che si ripetono.
   -------------------------------------------------------------------------- */
.btm-speaker {
  flex: 0 0 clamp(200px, 20vw, 260px);
  margin: 0 24px 0 0;
  scroll-snap-align: start;
}

.btm-speaker__photo {
  --x: 50%;
  --head: color-mix(in srgb, var(--btm-color-text) 42%, var(--btm-color-surface-alt));
  --body: color-mix(in srgb, var(--btm-color-text) 55%, var(--btm-color-surface-alt));
  --glow: color-mix(in srgb, var(--btm-color-primary) 22%, transparent);
  --glow-pos: 20% 18%;
  --bg-a: var(--btm-color-surface-alt);
  --bg-b: var(--btm-color-border);
  position: relative;
  aspect-ratio: 3 / 4;
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: var(--btm-radius-lg);
  background:
    radial-gradient(ellipse 20% 16% at var(--x) 38%, var(--head) 0%, var(--head) 35%, transparent 100%),
    radial-gradient(ellipse 46% 30% at var(--x) 100%, var(--body) 0%, var(--body) 40%, transparent 100%),
    radial-gradient(circle at var(--glow-pos), var(--glow) 0%, transparent 50%),
    linear-gradient(160deg, var(--bg-a) 0%, var(--bg-b) 100%);
}

.btm-speaker:nth-child(5n+2) .btm-speaker__photo {
  --x: 44%;
  --glow: color-mix(in srgb, var(--btm-color-accent) 45%, transparent);
  --glow-pos: 82% 20%;
}

.btm-speaker:nth-child(5n+3) .btm-speaker__photo {
  --x: 56%;
  --head: color-mix(in srgb, var(--btm-color-text) 50%, var(--btm-color-accent));
  --body: color-mix(in srgb, var(--btm-color-primary-dark) 45%, var(--btm-color-surface-alt));
  --glow-pos: 70% 75%;
}

.btm-speaker:nth-child(5n+4) .btm-speaker__photo {
  --x: 47%;
  --bg-a: color-mix(in srgb, var(--btm-color-accent) 25%, var(--btm-color-surface-alt));
  --glow: color-mix(in srgb, var(--btm-color-primary) 16%, transparent);
  --glow-pos: 15% 80%;
}

.btm-speaker:nth-child(5n+5) .btm-speaker__photo {
  --x: 53%;
  --head: color-mix(in srgb, var(--btm-color-text) 32%, var(--btm-color-surface-alt));
  --body: color-mix(in srgb, var(--btm-color-text) 68%, var(--btm-color-surface-alt));
  --bg-b: color-mix(in srgb, var(--btm-color-primary) 12%, var(--btm-color-surface-alt));
  --glow-pos: 85% 85%;
}

.btm-speaker__badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--btm-color-bg) 80%, transparent);
  color: var(--btm-color-text);
  font-family: var(--btm-font-body);
  font-size: 0.62rem;
  font-weight: var(--btm-weight-strong);
  line-height: 1.2;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.btm-speaker__index {
  margin: 0 0 4px;
  color: var(--btm-color-primary);
  font-family: var(--btm-font-serif);
  font-size: 1.1rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1.2;
}

.btm-speaker__name {
  margin: 0;
  color: var(--btm-color-text);
  font-family: var(--btm-font-body);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.35;
}

.btm-speaker__meta {
  margin: 4px 0 0;
  color: var(--btm-color-muted);
  font-family: var(--btm-font-body);
  font-size: 0.85rem;
  line-height: 1.5;
}


/* --------------------------------------------------------------------------
   5. PROGRAMMA
   -------------------------------------------------------------------------- */
.btm-program__days {
  display: flex;
  gap: 8px 40px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--btm-color-border);
}

.btm-program__day {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin: 0 0 -1px;
  padding: 0 0 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--btm-color-muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: color var(--btm-transition), border-color var(--btm-transition);
}

.btm-program__day:hover,
.btm-program__day[aria-selected="true"] {
  color: var(--btm-color-text);
}

.btm-program__day[aria-selected="true"] {
  border-bottom-color: var(--btm-color-primary);
}

.btm-program__weekday {
  font-family: var(--btm-font-body);
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.btm-program__date {
  font-family: var(--btm-font-serif);
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  font-weight: 300;
  line-height: 1.2;
}

/* Senza JS nessuna scheda è "attiva": si vedono tutte le giornate */
.btm-program:not(.is-ready) .btm-program__day {
  cursor: default;
}

.btm-program__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.btm-program__row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  gap: 32px;
  align-items: center;
  padding: 28px 0;
  border-bottom: 1px solid var(--btm-color-border);
}

.btm-program__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Barre "fuori fuoco" al posto del testo */
.btm-ghost {
  display: block;
  height: 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--btm-color-text) 14%, transparent);
  filter: blur(3px);
}

.btm-ghost--time {
  width: 64px;
  height: 18px;
  background: color-mix(in srgb, var(--btm-color-text) 22%, transparent);
}

.btm-ghost--title {
  height: 18px;
  background: color-mix(in srgb, var(--btm-color-text) 20%, transparent);
}

.btm-ghost--text {
  height: 11px;
}

.btm-ghost--tag {
  width: 96px;
  height: 26px;
  background: color-mix(in srgb, var(--btm-color-primary) 18%, transparent);
}

.btm-program__row:nth-child(5n+1) .btm-ghost--title { width: 72%; }
.btm-program__row:nth-child(5n+1) .btm-ghost--text  { width: 38%; }
.btm-program__row:nth-child(5n+2) .btm-ghost--title { width: 54%; }
.btm-program__row:nth-child(5n+2) .btm-ghost--text  { width: 46%; }
.btm-program__row:nth-child(5n+3) .btm-ghost--title { width: 81%; }
.btm-program__row:nth-child(5n+3) .btm-ghost--text  { width: 30%; }
.btm-program__row:nth-child(5n+4) .btm-ghost--title { width: 63%; }
.btm-program__row:nth-child(5n+4) .btm-ghost--text  { width: 52%; }
.btm-program__row:nth-child(5n+5) .btm-ghost--title { width: 47%; }
.btm-program__row:nth-child(5n+5) .btm-ghost--text  { width: 35%; }


/* --------------------------------------------------------------------------
   6. RESPONSIVE E MOVIMENTO RIDOTTO
   -------------------------------------------------------------------------- */
@media (max-width: 991.98px) {
  .btm-teaser__head {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
}

@media (max-width: 767.98px) {
  .btm-teaser {
    padding-block: calc(var(--btm-section-space) * 0.6);
  }

  .btm-teaser__head {
    margin-bottom: 36px;
  }

  .btm-countdown__unit {
    padding: 0 12px;
  }

  .btm-countdown__value {
    font-size: 2.1rem;
  }

  .btm-marquee__track {
    padding-left: var(--btm-gutter-mobile);
  }

  .btm-speaker {
    flex-basis: clamp(190px, 62vw, 240px);
    margin-right: 16px;
  }

  .btm-program__days {
    gap: 8px 24px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .btm-program__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
    padding: 20px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btm-marquee.is-animated .btm-marquee__track {
    animation: none;
  }

  .btm-link-arrow::after {
    transition: none;
  }
}
