/*
 * ConSellWeb Master Theme - Stili dei template
 * Percorso: assets/css/frontend/templates.css
 * Ruolo: regole dei template FSE ordinate per navigatore e DOM.
 *
 * Chiave di lettura Matrix:
 * template -> blocco -> elemento
 * Esempio: index/home -> immagine principale -> titolo = .csw-home-hero__headline
 */

/* =================================================================
 *  01. PAGINA INIZIALE / HOME
 * ================================================================= */

/* -----------------------------------------------------------------
 *  01.01 HOME / HERO
 *  Messaggio a sinistra, lettore Mp3Down a destra (hero.js).
 *  Colori del sito dai preset di theme.json; colori del lettore
 *  (metallo, display, spettro) riprodotti dalla skin.
 *  Coordinate in pixel del frontale 1045x603 (layout.json del renderer).
 * ----------------------------------------------------------------- */

.hero-impianto {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  align-items: center;
  column-gap: clamp(32px, 4vw, 72px);
  margin-block-start: 0; /* annulla lo spazio tra blocchi di WordPress: la Hero parte dal bordo, sotto l'header fisso */
  padding: 114px max(20px, calc((100% - 1600px) / 2)) 64px; /* in alto: 66px dell'header fisso trasparente + 48px */
  background: radial-gradient(120% 90% at 62% 38%, #d6d9da 0%, #c7cacb 45%, #a9adaf 100%);
}

.hero-messaggio {
  color: var(--wp--preset--color--contrast);
}

.hero-messaggio h1 {
  transition: color .3s ease, translate .3s ease;
  margin: 0 0 0.3em;
  font-size: clamp(44px, 5.2vw, 88px);
  line-height: 1;
  letter-spacing: -0.02em;
  color: inherit;
}

/* Il puntatore della guida passa sul titolo: effetto hover */
.hero-messaggio h1.is-sorvolato {
  color: var(--wp--preset--color--identity);
  translate: 0 -4px;
}

.hero-riga {
  margin: 0 0 32px;
  font-size: clamp(20px, 1.7vw, 28px);
  font-weight: 700;
  line-height: 1.25;
}

.hero-nota {
  margin: 16px 0 0;
  font-size: 14px;
  line-height: 1.5;
}

.hero-palco {
  position: relative;
  width: min(1045px, 100%);
  aspect-ratio: 1045 / 603;
  justify-self: end;
}

.hero-frontale {
  position: absolute;
  left: 0;
  top: 0;
  width: 1045px;
  height: 603px;
  transform-origin: 0 0;
  border-radius: 9px;
  background: url("../../img/hero/ricomposizione-off@1x.png") no-repeat 0 0 / 1045px 603px;
  box-shadow: 0 2px 3px rgba(0, 0, 0, .25), 0 28px 60px -18px rgba(0, 0, 0, .55);
}

.hero-frontale > * { position: absolute; }

.hero-strato {
  opacity: 0;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: 100% 100%;
  transition: opacity .3s ease;
}

.hero-strato.is-visibile { opacity: 1; }

.hero-led-init { left: 56px; top: 116px; width: 24px; height: 23px; background-image: url("../../img/hero/led-inizializzazione@1x.png"); }
.hero-led-on { left: 56px; top: 116px; width: 24px; height: 23px; background-image: url("../../img/hero/led-acceso@1x.png"); }
.hero-copertina { left: 62px; top: 219px; width: 143px; height: 104px; background-image: url("../../img/hero/copertina-accesa@1x.png"); }
.hero-radio { left: 34px; top: 369px; width: 114px; height: 34px; background-image: url("../../img/hero/pulsante-radio-normale@1x.png"); }
.hero-locale { left: 278px; top: 369px; width: 114px; height: 34px; background-image: url("../../img/hero/pulsante-locale-normale@1x.png"); }
.hero-play { left: 552px; top: 353px; width: 64px; height: 51px; background-image: url("../../img/hero/pulsante-play-premuto@1x.png"); transition: none; }
.hero-stop { left: 696px; top: 353px; width: 64px; height: 51px; background-image: url("../../img/hero/pulsante-stop-premuto@1x.png"); transition: none; }
.hero-pause { left: 768px; top: 353px; width: 64px; height: 51px; background-image: url("../../img/hero/pulsante-pause-premuto@1x.png"); transition: none; }
.hero-ripeti { left: 894px; top: 304px; width: 18px; height: 16px; background-image: url("../../img/hero/icona-ripeti-accesa@3x.png"); }
.hero-casuale { left: 923px; top: 306px; width: 17px; height: 12px; background-image: url("../../img/hero/icona-casuale-accesa@3x.png"); }
.hero-cuore { left: 952px; top: 305px; width: 18px; height: 14px; background-image: url("../../img/hero/icona-cuore-pieno-accesa@3x.png"); }
.hero-piu { left: 981px; top: 304px; width: 18px; height: 16px; background-image: url("../../img/hero/icona-piu-accesa@3x.png"); }

/* VU: finestre ritagliate, quadranti e lancette alla loro tela nativa */
.hero-vu { top: 54px; height: 76px; overflow: hidden; }
.hero-vu-sx { left: 296px; width: 209px; }
.hero-vu-dx { left: 540px; width: 208px; }
.hero-vu > div { position: absolute; left: 0; top: 0; transform-origin: 0 0; background-size: 100% 100%; }
.hero-quadranti { width: 2144px; height: 733px; background-image: url("../../img/hero/quadranti-vu-accesi@nativa.png"); }
.hero-lancetta { width: 2145px; height: 733px; }
.hero-vu-sx .hero-lancetta { background-image: url("../../img/hero/lancetta-left@nativa.png"); }
.hero-vu-dx .hero-lancetta { background-image: url("../../img/hero/lancetta-right@nativa.png"); }

/* Display del lettore: ambra della skin */
.hero-testo {
  color: #FFC35D;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  white-space: nowrap;
  overflow: hidden;
  line-height: 1;
}
.hero-sorgente { left: 235px; top: 225px; width: 610px; height: 18px; font-size: 10.5px; line-height: 18px; }
.hero-titolo { left: 233px; top: 244px; width: 620px; height: 34px; font-size: 28px; line-height: 34px; }
.hero-titolo span { display: inline-block; will-change: transform; }
.hero-sottotitolo { left: 235px; top: 276px; width: 610px; height: 19px; font-size: 10.5px; line-height: 19px; }
.hero-tempo-sx { left: 234px; top: 303px; width: 42px; height: 18px; font-size: 12px; line-height: 18px; }
.hero-tempo-dx { left: 813px; top: 303px; width: 49px; height: 18px; font-size: 12px; line-height: 18px; }
.hero-avanzamento { left: 277px; top: 312px; width: 521px; height: 2px; background: #4B4637; }

/* Spettro: 7 bande, 9 segmenti */
.hero-segmento { width: 8px; height: 3px; opacity: 0; }

/* Manopola del volume: ghiera fissa, disco rotante (centro locale 59,59) */
.hero-ghiera { left: 829px; top: 57px; width: 171px; height: 138px; background: url("../../img/hero/manopola-ghiera@1x.png") no-repeat 0 0 / 100% 100%; pointer-events: none; }
.hero-disco { left: 855px; top: 66px; width: 118px; height: 118px; background: url("../../img/hero/manopola-disco@1x.png") no-repeat 0 0 / 100% 100%; transform-origin: 59px 59px; pointer-events: none; }
.hero-manopola { left: 855px; top: 66px; width: 118px; height: 118px; border-radius: 50%; cursor: ns-resize; touch-action: none; }

/* Lista del lettore */
.hero-lista { left: 36px; top: 458px; width: 470px; font-size: 12px; }
.hero-lista > div { display: grid; grid-template-columns: 44px 1fr 60px; height: 29px; align-items: center; color: #d8a24f; }
.hero-lista > div.is-corrente { color: #FFC35D; font-weight: 600; }

/* Tasto ON/OFF e tasti PLAY, STOP, PAUSE: aree cliccabili sopra i tasti disegnati */
.hero-power { left: 47px; top: 137px; width: 42px; height: 42px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; }
.hero-tasto { top: 353px; width: 64px; height: 51px; padding: 0; border: 0; border-radius: 6px; background: none; cursor: pointer; }
.hero-tasto-play { left: 552px; }
.hero-tasto-stop { left: 696px; }
.hero-tasto-pause { left: 768px; }

/* Zone informative: invisibili, si rivelano con un contorno al passaggio */
.hero-zona { padding: 0; border: 0; border-radius: 8px; background: none; cursor: help; }

.hero-zona:hover,
.hero-zona:focus-visible,
.hero-power:focus-visible,
.hero-tasto:focus-visible,
.hero-manopola:focus-visible {
  outline: 2px solid var(--wp--preset--color--identity);
  outline-offset: 2px;
}

/* Riquadro informativo, fuori dal frontale scalato */
.hero-tip {
  position: absolute;
  z-index: 5;
  width: min(300px, 90%);
  padding: 14px 16px 12px;
  border-radius: 8px;
  background: var(--wp--preset--color--contrast);
  color: var(--wp--preset--color--background);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .6);
  font-size: 14px;
  line-height: 1.45;
}
.hero-tip[hidden] { display: none; }
.hero-tip p { margin: 0; }
.hero-tip .hero-tip-titolo { margin-bottom: 4px; font-weight: 700; }
.hero-tip-link { display: inline-block; margin-top: 8px; color: inherit; font-weight: 700; }
.hero-tip-link:focus-visible { outline: 2px solid var(--wp--preset--color--background); outline-offset: 2px; }

/* Puntatore della guida: vive nella Hero, parte sopra il titolo; la punta della freccia
   cade sul centro del comando */
.hero-puntatore {
  position: absolute;
  left: -5px;
  top: -3px;
  z-index: 6;
  width: 24px;
  height: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .4s ease, transform var(--durata, .9s) cubic-bezier(.45, 0, .2, 1);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45));
}
.hero-puntatore.is-visibile { opacity: 1; }
.hero-puntatore.is-fermo { transition: none; }
.hero-puntatore svg { display: block; transform-origin: 5px 3px; transition: transform .12s ease; }
.hero-puntatore.is-clic svg { transform: scale(.82); }
.hero-puntatore path {
  fill: var(--wp--preset--color--background);
  stroke: var(--wp--preset--color--contrast);
  stroke-width: 1.5;
  stroke-linejoin: round;
}

/* Durante la guida il puntatore vero e nascosto finche il mouse non si muove (hero.js) */
html.is-guida-cursore,
html.is-guida-cursore * {
  cursor: none;
}

/* Il browser ha bloccato l'audio senza un gesto del visitatore: PLAY invita a premere */
.hero-tasto-play.is-invito {
  outline: 2px solid var(--wp--preset--color--identity);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-tasto-play.is-invito { animation: hero-invito 1.6s ease-in-out infinite; }
}

@keyframes hero-invito {
  50% { outline-color: transparent; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-strato { transition: none; }
}

@media (max-width: 782px) {
  .hero-impianto {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 32px;
    min-height: 0;
    align-content: start;
  }

  .hero-palco { justify-self: center; }
}

/* -----------------------------------------------------------------
 *  01.02 HOME / IN BREVE
 *  Informazioni di completamento sotto la Hero: quattro voci brevi.
 * ----------------------------------------------------------------- */

.in-breve {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 40px clamp(24px, 3vw, 56px);
  margin-block-start: 0;
  padding: 64px max(20px, calc((100% - 1600px) / 2));
  background: var(--wp--preset--color--background);
  color: var(--wp--preset--color--contrast);
}

.in-breve-voce {
  padding-top: 18px;
  border-top: 2px solid var(--wp--preset--color--identity);
}

.in-breve-voce h2 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  color: inherit;
}

.in-breve-voce p {
  margin: 0;
  max-width: 40ch;
  line-height: 1.55;
}

@media (max-width: 1100px) {
  .in-breve { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
  .in-breve { grid-template-columns: minmax(0, 1fr); }
}

/* -----------------------------------------------------------------
 *  01.03 HOME / COMPONENTI
 *  Una sottosezione per ogni parte del lettore: vista ritagliata dal
 *  frontale (variabili --x --y --w --h --s nel markup) e testo.
 * ----------------------------------------------------------------- */

.componenti {
  display: grid;
  gap: 56px;
  max-width: 1045px;
  margin: 0 auto;
  padding: 80px 20px 110px;
}

.componente {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 40px;
  align-items: center;
  scroll-margin-top: 110px;
}

.componente-vista {
  justify-self: center;
  width: calc(var(--w) * var(--s) * 1px);
  height: calc(var(--h) * var(--s) * 1px);
  border-radius: 6px;
  background: url("../../img/hero/ricomposizione-off@1x.png") no-repeat;
  background-size: calc(1045px * var(--s)) calc(603px * var(--s));
  background-position: calc(var(--x) * var(--s) * -1px) calc(var(--y) * var(--s) * -1px);
  box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .55);
}

.componente-testo h2 {
  margin: 0 0 10px;
  font-size: 26px;
  line-height: 1.2;
}

.componente-testo p {
  margin: 0 0 18px;
  max-width: 62ch;
  line-height: 1.6;
}

.componente:target .componente-testo h2 {
  color: var(--wp--preset--color--identity);
}

@media (max-width: 720px) {
  .componente {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

/* -----------------------------------------------------------------
 *  01.04 HOME / INFORMAZIONI
 * ----------------------------------------------------------------- */

.csw-home-info-composition {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
}

.csw-home-info-image--accent {
  position: absolute;
  bottom: -40%;
  left: 16%;
  width: 60%;
  aspect-ratio: 353 / 259;
  overflow: hidden;
  z-index: 2;
}

.csw-home-info-image--base {
  position: absolute;
  top: 0;
  right: 0;
  width: 58%;
  aspect-ratio: 400 / 541;
  overflow: hidden;
  z-index: 1;
}

.csw-home-info-image--accent img,
.csw-home-info-image--base img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 782px) {
  .csw-home-info-composition {
    aspect-ratio: 355 / 480;
  }

  .csw-home-info-image--base {
    top: 0;
    right: 0;
    width: 100%;
    height: auto;
  }

  .csw-home-info-image--accent {
    bottom: -6%;
    left: 50%;
    width: 95%;
    transform: translateX(-51%);
  }
}

@supports (animation-timeline: view()) {
  @media (min-width: 1024px) and (prefers-reduced-motion: no-preference) {
    .csw-home-info-image--accent {
      animation: csw-home-info-accent-scroll linear both;
      animation-timeline: view();
      animation-range: entry 0% exit 100%;
    }

    @keyframes csw-home-info-accent-scroll {
      from {
        translate: 0 70px;
      }

      to {
        translate: 0 -70px;
      }
    }
  }
}

/* -----------------------------------------------------------------
 *  01.05 HOME / GALLERIA
 *  Scorrimento della galleria condiviso anche da Chi siamo, prima occorrenza nel DOM Home.
 * ----------------------------------------------------------------- */

.csw-gallery-slider {
  position: relative;
  width: 100%;
}

.csw-gallery-slider__viewport {
  overflow: hidden;
  width: 100%;
  cursor: grab;
}

.csw-gallery-slider__track {
  display: flex;
  align-items: stretch;
  gap: 28px;
  will-change: transform;
  touch-action: pan-y;
  user-select: none;
}

.csw-gallery-slider__slide {
  flex: 0 0 calc(100% / 3);
  box-sizing: border-box;
  padding-inline: 0;
  height: clamp(240px, 40vw, 420px);
}

.csw-gallery-slider__slide a {
  display: block;
  height: 100%;
}

.csw-gallery-slider__slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.csw-gallery-slider.is-dragging .csw-gallery-slider__viewport {
  cursor: grabbing;
}

.csw-gallery-slider__control {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  color: var(--wp--preset--color--ui-icons);
  transform: translateY(-50%);
  cursor: pointer;
}

.csw-gallery-slider__control--prev {
  left: 16px;
}

.csw-gallery-slider__control--next {
  right: 16px;
}

.csw-gallery-slider__control[disabled] {
  opacity: 0.45;
  cursor: default;
}

@media (max-width: 767px) {
  .csw-gallery-slider__slide {
    flex-basis: 100%;
  }

  .csw-gallery-slider__control--prev {
    left: 8px;
  }

  .csw-gallery-slider__control--next {
    right: 8px;
  }
}

.csw-services-popup .csw-home-desc-popup__title {
  font-size: 22px;
}

html.csw-home-desc-popup-open {
  overflow: hidden;
}

.csw-house-services,
.csw-services-popup__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.csw-house-services {
  display: grid;
  gap: 0;
}

.csw-service-entry {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin: 0;
  padding: 18px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--foreground) 18%, transparent);
}

.csw-service-entry__icon {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.csw-service-entry__icon svg {
  display: block;
  width: 24px;
  height: 24px;
}

.csw-service-entry__title {
  margin: 0;
  color: var(--wp--preset--color--foreground);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.35;
}

.csw-service-entry__description {
  margin: 4px 0 0;
  color: color-mix(in srgb, var(--wp--preset--color--foreground) 68%, transparent);
  font-size: 16px;
  line-height: 1.45;
}

.csw-services-popup__section + .csw-services-popup__section {
  margin-top: 34px;
}

.csw-services-popup__category {
  margin: 0 0 10px;
  color: var(--wp--preset--color--foreground);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.35;
}

.csw-service-entry.is-excluded .csw-service-entry__icon::before,
.csw-service-entry.is-excluded .csw-service-entry__icon::after {
  position: absolute;
  top: 50%;
  left: -3px;
  width: 30px;
  height: 2px;
  background: #e11;
  content: "";
  pointer-events: none;
}

.csw-service-entry.is-excluded .csw-service-entry__icon::before {
  transform: rotate(45deg);
}

.csw-service-entry.is-excluded .csw-service-entry__icon::after {
  transform: rotate(-45deg);
}

/* -----------------------------------------------------------------
 *  01.06 HOME / FINESTRA DELLA DESCRIZIONE
 * ----------------------------------------------------------------- */

.csw-home-desc-popup__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--wp--preset--color--primary);
  border-radius: 4px;
  background: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--on-primary);
  font: inherit;
  cursor: pointer;
}

.csw-home-desc-popup__trigger:hover,
.csw-home-desc-popup__trigger:focus-visible {
  border-color: var(--wp--preset--color--primary-hover);
  background: var(--wp--preset--color--primary-hover);
  color: var(--wp--preset--color--on-primary);
}

.csw-home-desc-popup__dialog[hidden] {
  display: none;
}

.csw-home-desc-popup__dialog {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.csw-home-desc-popup__backdrop {
  position: absolute;
  inset: 0;
  background: color-mix(in srgb, var(--wp--preset--color--foreground) 48%, transparent);
}

.csw-home-desc-popup__panel {
  position: relative;
  z-index: 1;
  width: min(800px, 100%);
  max-height: min(86vh, 780px);
  overflow: auto;
  padding: clamp(28px, 5vw, 52px);
  background: var(--wp--preset--color--background);
  color: var(--wp--preset--color--foreground);
  box-shadow: 0 24px 80px color-mix(in srgb, var(--wp--preset--color--foreground) 22%, transparent);
}

.csw-home-desc-popup__close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--wp--preset--color--foreground);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.csw-home-desc-popup__title {
  margin: 0 0 48px;
  color: var(--wp--preset--color--foreground);
  font-size: var(--wp--preset--font-size--x-large);
  font-weight: 400;
  line-height: 1.1;
}

.csw-home-desc-popup__content {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.csw-home-desc-popup__heading {
  margin: 16px 0 6px;
  color: var(--wp--preset--color--foreground);
  font-size: var(--wp--preset--font-size--medium);
  font-weight: 500;
  line-height: 1.25;
}

.csw-home-desc-popup__paragraph {
  margin: 0;
  color: color-mix(in srgb, var(--wp--preset--color--foreground) 72%, transparent);
  font-size: var(--wp--preset--font-size--small);
  line-height: 1.7;
}

@media (max-width: 767px) {
  .csw-home-desc-popup__dialog {
    padding: 16px;
    place-items: end center;
  }

  .csw-home-desc-popup__panel {
    max-height: 88vh;
    padding: 32px 22px;
  }

  .csw-home-desc-popup__title {
    margin-block-end: 32px;
  }
}
