/* F3TV — CSS del player (AGENTE PLAYER). Prefisso .f3tv- ovunque.
   Tutte le misure di testo/logo in cqw: lo schermo gira sia a 1460px
   (home) sia a 400px (anteprima admin). container-type sul contenitore. */

.f3tv-schermo {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  container-type: inline-size;
  container-name: f3tv;
  font-family: Arial, Helvetica, sans-serif;
  color: #f6f1e6;
}

.f3tv-scena {
  position: absolute;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.99);
  transition: opacity 0.45s ease, transform 0.45s ease;
}
.f3tv-scena.f3tv-mostra { opacity: 1; transform: scale(1); }
.f3tv-scena.f3tv-esce { opacity: 0; transition: opacity 0.45s ease; }
.f3tv-scena.f3tv-ridotto,
.f3tv-scena.f3tv-ridotto * { transition: none !important; animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  .f3tv-scena { transition: none !important; }
  .f3tv-scena * { animation: none !important; transition: none !important; }
}

/* ---------------------------------- sigle ---------------------------------- */
.f3tv-sigla {
  position: absolute; inset: 0; background: #0b0b0b;
  display: flex; align-items: center; justify-content: center;
  animation: f3tv-sigla-esci 0.6s var(--esci-delay, 0s) ease-in both;
}
@keyframes f3tv-sigla-esci { to { opacity: 0; } }

.f3tv-scan {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen;
  background: linear-gradient(180deg, transparent 0%, rgba(198,39,49,.12) 50%, transparent 100%);
  background-size: 100% 300%;
  animation: f3tv-scan-mov 2.13s linear infinite;
}
@keyframes f3tv-scan-mov { from { background-position: 0 -100%; } to { background-position: 0 200%; } }

.f3tv-flash {
  position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none;
  mix-blend-mode: screen;
  animation: f3tv-flash-anim 0.25s var(--flash-delay, 0s) ease-out both;
}
@keyframes f3tv-flash-anim { 0% { opacity: 0; } 40% { opacity: .85; } 100% { opacity: 0; } }

.f3tv-neve-breve {
  position: absolute; inset: 0; pointer-events: none;
  animation: f3tv-neve-breve-op var(--neve-dur, 1.1s) linear both;
}
.f3tv-neve-breve svg, .f3tv-svgneve { width: 100%; height: 100%; display: block; }
@keyframes f3tv-neve-breve-op { 0% { opacity: 0; } 15% { opacity: .85; } 80% { opacity: .75; } 100% { opacity: 0; } }

.f3tv-riga {
  display: flex; flex-direction: row; align-items: center; justify-content: center;
  gap: 3.75cqw; padding: 0 7cqw; width: 100%;
}
.f3tv-logo {
  width: 27cqw; flex: 0 0 27cqw; height: auto; opacity: 0; transform: scale(.85);
  filter: drop-shadow(0 .9cqw 2.4cqw rgba(0,0,0,.55));
  animation: f3tv-logo-in .8s var(--intro-delay, 0s) cubic-bezier(.34,1.56,.64,1) both,
             f3tv-logo-respiro 1.53s var(--intro-delay, 0s) ease-in-out infinite;
}
@keyframes f3tv-logo-in { to { opacity: 1; transform: scale(1); } }
@keyframes f3tv-logo-respiro { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.012); } }

.f3tv-testi { display: flex; flex-direction: column; gap: 1.35cqw; flex: 1; min-width: 0; }
.f3tv-titolo-macchina {
  font-weight: 900; color: var(--ink, #f6f1e6); white-space: pre-line; line-height: 1.08;
  font-size: 5cqw;
}
.f3tv-sotto-macchina {
  font-weight: 700; letter-spacing: .05cqw; color: var(--rosso, #c62731);
  white-space: pre-line; font-size: 2.8cqw;
}
.f3tv-benvenuto .f3tv-sotto-macchina { text-transform: uppercase; }
.f3tv-contatto { text-transform: none; letter-spacing: normal; line-height: 1.35; }
.f3tv-cursore { display: inline-block; margin-left: .12em; }

/* cartello: nessun logo, tutto centrato */
.f3tv-cartello { flex-direction: column; gap: 1.6cqw; text-align: center; padding: 0 10cqw; }
.f3tv-etichetta {
  opacity: 0; font-weight: 700; font-size: 1.77cqw; letter-spacing: .5cqw;
  text-transform: uppercase; color: var(--rosso, #c62731);
  animation: f3tv-fadein .5s var(--in-delay, 0s) ease both;
}
.f3tv-titolo-centro { font-size: 6.67cqw; text-align: center; }
.f3tv-riga-rossa {
  width: 0; height: .3cqw; background: var(--rosso, #c62731); border-radius: .15cqw;
  animation: f3tv-riga-cresce var(--riga-dur, 1s) var(--riga-delay, 0s) ease both;
}
@keyframes f3tv-riga-cresce { to { width: 100%; } }
@keyframes f3tv-fadein { to { opacity: 1; } }

/* chiusura: spegnimento del tubo catodico */
.f3tv-tubo { position: absolute; inset: 0; background: #0b0b0b; transform-origin: center; }
.f3tv-tubo .f3tv-riga { position: absolute; inset: 0; }
.f3tv-tubo.f3tv-spento {
  animation: f3tv-tubo-collassa var(--collassa-dur, 450ms) ease-in forwards;
}
@keyframes f3tv-tubo-collassa {
  0% { transform: scaleY(1) scaleX(1); }
  55% { transform: scaleY(.004) scaleX(1); }
  100% { transform: scaleY(.004) scaleX(0); }
}
.f3tv-neve-spegni { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .5s linear; }
.f3tv-neve-spegni.f3tv-attiva { opacity: .35; transition-duration: var(--neve-sp-dur, 800ms); }
.f3tv-lampo-spegni { position: absolute; inset: 0; background: #fff; opacity: 0; mix-blend-mode: screen; pointer-events: none; }
.f3tv-tubo.f3tv-spento .f3tv-lampo-spegni { animation: f3tv-flash-anim var(--collassa-dur, 450ms) linear both; }
/* la chiusura NON usa la dissolvenza generica delle sigle: la sua "uscita"
   è lo spegnimento del tubo (sopra), esattamente come in Chiusura.tsx */
.f3tv-chiusura { animation: none; }

/* ---------------------------------- foto ---------------------------------- */
.f3tv-punti, .f3tv-affiancata { position: absolute; inset: 0; display: flex; }
.f3tv-punti { background: #f5d49b; }
.f3tv-fotofull { position: absolute; inset: 0; }
.f3tv-fotofull img { width: 100%; height: 100%; object-fit: cover; }
.f3tv-punti .f3tv-fotofull img { animation: f3tv-zoom-lento var(--durata-ms, 8s) linear both; }
@keyframes f3tv-zoom-lento { from { transform: scale(1); } to { transform: scale(1.05); } }
.f3tv-fotob { opacity: 0; transition: opacity var(--dissolve-dur, .87s) linear; }
.f3tv-fotob.f3tv-mostra { opacity: 1; }

/* punti: colonna assoluta, allineata al bordo destro (come l'AbsoluteFill
   flex-column con alignItems:"flex-end" di ScenaStatuine.tsx); il div
   interno porta la larghezza in % e il padding, il testo dentro resta
   normale (allineato a sinistra), cosi' il blocco intero sta a destra. */
.f3tv-punti-colonna {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: flex-end; justify-content: center; pointer-events: none;
}
.f3tv-punti-interna { padding-right: 4%; display: flex; flex-direction: column; gap: 1.4cqw; }
.f3tv-punti .f3tv-titolo-macchina { color: var(--rosso, #c62731); text-align: right; }

/* affiancata: colonna normale nel flusso (flex:1), testo a sinistra */
.f3tv-affiancata-colonna {
  position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column;
  justify-content: center; padding: 0 6cqw 0 1cqw; gap: 2.3cqw;
}

.f3tv-lista-punti { display: flex; flex-direction: column; gap: 1.5cqw; margin-top: 1.4cqw; }
.f3tv-punto-riga { display: flex; align-items: center; gap: 1.2cqw; }
.f3tv-pallino {
  display: block !important; /* il tema nasconde gli span vuoti */
  width: 1.3cqw; height: 1.3cqw; flex: 0 0 1.3cqw; border-radius: .3cqw; opacity: 0; transform: scale(0);
  animation: f3tv-pallino-in .3s var(--pallino-delay, 0s) ease both;
}
@keyframes f3tv-pallino-in { to { opacity: 1; transform: scale(1); } }
.f3tv-punto-testo { font-size: 2.5cqw; font-weight: 700; line-height: 1.2; }

.f3tv-foto-sx { position: relative; height: 100%; overflow: hidden;
  -webkit-mask-image: linear-gradient(to right, #000 0%, #000 93%, transparent 100%);
  mask-image: linear-gradient(to right, #000 0%, #000 93%, transparent 100%);
  animation: f3tv-foto-scivola .9s ease both;
}
.f3tv-foto-sx img { width: 100%; height: 100%; object-fit: cover; animation: f3tv-zoom-lento var(--durata-ms, 8s) linear both; }
@keyframes f3tv-foto-scivola { from { transform: translateX(-4cqw); } to { transform: translateX(0); } }
.f3tv-affiancata .f3tv-titolo-macchina { font-size: 5.4cqw; letter-spacing: -.03cqw; }
/* PC: blocco testo appoggiato a destra, lo spazio libero resta al centro */
@media (min-width: 641px) {
  .f3tv-affiancata-colonna { display: grid; justify-content: end; align-content: center;
    padding: 0 6cqw 0 3cqw; }
}
.f3tv-punti .f3tv-titolo-macchina { font-size: 5.4cqw; letter-spacing: -.03cqw; text-align: right; }

.f3tv-zoom { position: absolute; inset: 0; background: #000; }
.f3tv-zoom-nero { position: absolute; inset: 0; background: #000; }
.f3tv-zoom-foto {
  position: absolute; inset: 0; opacity: 0;
  animation: f3tv-zoom-apre-chiude var(--durata-ms, 7s) linear both;
}
.f3tv-zoom-foto img {
  width: 100%; height: 100%; object-fit: cover;
  animation: f3tv-zoom-costante var(--durata-ms, 7s) linear both;
}
@keyframes f3tv-zoom-costante { from { transform: scale(1); } to { transform: scale(var(--zoom-fin, 1.1)); } }
@keyframes f3tv-zoom-apre-chiude { 0% { opacity: 0; } 12% { opacity: 1; } 88% { opacity: 1; } 100% { opacity: 0; } }

/* -------------------------------- divisori -------------------------------- */
.f3tv-divisore { position: absolute; inset: 0; }
.f3tv-neve-div { background: #111; }
.f3tv-neve-canvas { width: 100%; height: 100%; image-rendering: pixelated; display: block; }
.f3tv-neve-scan {
  position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.25) 0 1px, transparent 1px 3px);
}
.f3tv-nero-div { background: #000; }
.f3tv-barre-div { display: flex; }
.f3tv-fascia { flex: 1 1 0; height: 100%; }

/* ---------------------------------- media ---------------------------------- */
.f3tv-video-stampo { position: absolute; inset: 0; background: #000; display: flex; align-items: center; justify-content: center; }
.f3tv-video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.f3tv-video-titolo { color: #f6f1e6; font-size: 2.6cqw; font-weight: 700; text-align: center; padding: 0 8cqw; white-space: pre-line; }

.f3tv-stl { position: absolute; inset: 0; background: #0f0d0c; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6cqw; }
.f3tv-stl-canvas { width: 55cqw; height: 55cqw; max-height: 70cqh; display: flex; align-items: center; justify-content: center; }
.f3tv-stl-canvas canvas { width: 100%; height: 100%; display: block; }
.f3tv-stl-titolo { color: #f6f1e6; font-size: 3cqw; font-weight: 800; text-align: center; padding: 0 6cqw; }

/* ------------------------------- telefono -------------------------------
   Schermo 16:9 largo 390px = testi da 6px. Sul telefono lo schermo
   diventa verticale (2:3): foto sopra, testo sotto, caratteri grandi. */
@media (max-width: 640px) {
  div.f3-frame.f3tv, .f3tv-schermo { aspect-ratio: 2 / 3; } /* div.: batte lo <style> inline dello shortcode */
  div.f3-frame.f3tv { max-width: 100% !important; }

  /* sigle: logo sopra, testo sotto */
  .f3tv-riga { box-sizing: border-box; flex-direction: column; gap: 5cqw; padding: 0 7cqw; text-align: center; }
  .f3tv-riga .f3tv-testi { flex: 0 1 auto; width: 100%; }
  .f3tv-contatto { overflow-wrap: anywhere; }
  .f3tv-logo { width: 52cqw; flex: 0 0 auto; }
  .f3tv-testi { align-items: center; gap: 2.5cqw; }
  .f3tv-titolo-macchina { font-size: 10cqw; }
  .f3tv-sotto-macchina { font-size: 5.6cqw; }
  .f3tv-titolo-centro { font-size: 12cqw; }
  .f3tv-etichetta { font-size: 4.2cqw !important; letter-spacing: .8cqw; }
  .f3tv-riga-rossa { height: .8cqw; }

  /* punti: foto in alto, colonna di testo in basso */
  .f3tv-punti .f3tv-fotofull { bottom: 57%; overflow: hidden; }
  /* foto 16:9 alta quanto il riquadro (64.5cqw => larga 114.7cqw), spostata per
     centrare il soggetto a --fuoco-x (opzione fuocoX); il bordo sinistro sfuma */
  .f3tv-punti .f3tv-fotofull img {
    position: absolute; top: 0; left: calc(50cqw - var(--fuoco-x, 25) * 1.147cqw); width: auto; height: 100%; max-width: none;
    animation: none; transform: none;
    -webkit-mask-image: linear-gradient(to right, transparent 0, #000 9%);
    mask-image: linear-gradient(to right, transparent 0, #000 9%); }
  .f3tv-punti-colonna { top: 43%; align-items: stretch; justify-content: flex-start; }
  .f3tv-punti-interna { box-sizing: border-box; width: 100% !important;
    padding: 4cqw 6cqw; gap: 2cqw; }
  .f3tv-punti .f3tv-titolo-macchina { font-size: 8.5cqw; text-align: left; }

  /* affiancata: foto sopra, testo sotto */
  .f3tv-affiancata { flex-direction: column; }
  .f3tv-foto-sx { flex: 0 0 44% !important; height: 44%; min-height: 0;
    -webkit-mask-image: none; mask-image: none; }
  .f3tv-foto-sx img { object-fit: contain; object-position: center;
    animation: none; display: block; }
  .f3tv-affiancata-colonna { justify-content: flex-start;
    padding: 4cqw 6cqw; gap: 2cqw; }
  .f3tv-affiancata .f3tv-titolo-macchina { font-size: 8.5cqw; }

  /* elenco puntato */
  .f3tv-lista-punti { gap: 2.4cqw; margin-top: 1cqw; }
  .f3tv-punto-riga { gap: 2.6cqw; }
  .f3tv-pallino { width: 2.4cqw; height: 2.4cqw; flex: 0 0 2.4cqw; border-radius: .5cqw; }
  .f3tv-punto-testo { font-size: 4.4cqw; line-height: 1.25; min-width: 0; }

  /* In verticale conserviamo tutta la grafica Vespa, scritte comprese.
     Lo zoom avanza da 94% a 100%: mai oltre il bordo della fotografia. */
  .f3tv-zoom-foto img { object-fit: contain; object-position: center;
    animation-name: f3tv-zoom-telefono; }
  @keyframes f3tv-zoom-telefono { from { transform: scale(.94); } to { transform: scale(1); } }
  .f3tv-video { object-fit: contain; object-position: center; }
  .f3tv-video-titolo { font-size: 6cqw; }
  .f3tv-stl-titolo { font-size: 7cqw; }
  .f3tv-stl-canvas { width: 80cqw; height: 80cqw; }
}
