/* ==========================================================================
   Spizzico Home – Pagina prodotto, parte above the fold (v2)
   3 colonne: Immagini | Scelta variante | Carrello, in rapporto 4 : 5 : 3

   PRINCIPI
   1. Un solo punto focale: il TOTALE + il pulsante "Aggiungi al carrello".
      Tutto il resto è secondario e usa colori/pesi più quieti.
   2. Scala tipografica ridotta e pesi limitati: 400 (testo), 600 (etichette,
      titoli di sezione), 700 (solo titolo prodotto e totale).
   3. Colori: blu navy per testo, prezzi delle varianti e azione; rosso #ff5555
      SOLO per il totale (e il badge sconto); verde solo per le etichette "Spedizione
      gratuita" / "Risparmi il X%" e per l'avviso trasporto gratuito;
      nero solo per il banner Black Friday (l'unico richiamo promozionale).
   4. Prefisso .atf- : nessuna collisione con style.css / bootstrap.

   SCALA (px):  13 meta · 14 secondario · 16 testo/righe · 18 sezioni · 30 titolo · 40 totale
   ========================================================================== */

.atf-root { /* i token stanno sulla radice: li ereditano sia .atf (3 colonne) sia .atf-set */
  --atf-ink: var(--blue, #00205c);
  --atf-muted: #5b6b82; /* 5.4:1 su bianco */
  --atf-line: #dbe3ee;
  --atf-line-strong: #b7c4d6;
  --atf-tint: var(--light-blue, #edf6fa);
  --atf-good: #14803f; /* 5:1 su bianco */
  --atf-good-ink: #0f6b34; /* testo delle etichette verdi (~6:1 su --atf-good-bg) */
  --atf-good-bg: #e8f6ee;
  --atf-save: #12843f; /* verde pieno dell'etichetta "Risparmi il X%" (bianco su verde ~4,8:1): si distingue dal verde tenue della spedizione */
  --atf-good-line: #a9d8bd; /* bordo etichetta verde: la tiene leggibile anche sullo sfondo azzurro della riga selezionata */
  --atf-focus: #2b6fd6;
  --atf-price: #ff5555; /* prezzi: solo testo grande (>=19px bold) per restare leggibile (3,1:1) */
  --atf-off: #c93636; /* testo del badge sconto (4,7:1 su --atf-off-bg) */
  --atf-off-bg: #fff0f0;
  --atf-off-line: #f0b9b9;
  --atf-r: 12px;
  --atf-r-sm: 8px;
  --atf-ease: 160ms ease-out;
  color: var(--atf-ink);
  font-family: 'Catamaran', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

.atf {
  display: grid;
  /* rapporto 4 : 5 : 3 (immagine : varianti : carrello). Minimi: immagine 200px, carrello 248px (sotto, il rapporto cede) */
  grid-template-columns: minmax(200px, 4fr) minmax(0, 5fr) minmax(248px, 3fr);
  column-gap: clamp(20px, 2.5vw, 40px);
  align-items: start;
  width: 100%;
}

.atf-root *, .atf-root *::before, .atf-root *::after {
  box-sizing: border-box;
}

.atf-root p, .atf-root h1, .atf-root h2, .atf-root h3, .atf-root dl, .atf-root dd {
  margin: 0;
}

.atf-info a, .atf-buy a, .atf-set a {
  color: inherit;
  text-decoration: none;
}

.atf-root button {
  font-family: inherit;
}

.atf-root {
  width: 100%;
  min-width: 0;
  flex: 1 1 100%;
}

/* unico figlio del contenitore flex del sito */

.atf-icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Colonna 1: immagini (markup originale del sito, solo ritoccato) ---------- */
.atf-media {
  min-width: 0;
}

.atf-media .img-container { /* autonomo: non dipende da .dett-prodotto-desktop (serve anche nel blocco mobile) */
  position: relative;
  border: 1px solid var(--atf-line);
  border-radius: var(--atf-r);
  overflow: hidden;
  background: #fff;
}

.atf-media .img-container img.ignifugo-icon,
.atf-media .img-container img.plastic-free-icon {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 64px;
  height: auto;
  z-index: 2;
}

.atf-media .img-container .flag-black-friday { /* tag piccolo e sobrio invece del blocco nero da 100px */
  position: absolute;
  top: 0;
  right: 0;
  width: auto !important;
  padding: 4px 10px;
  margin: 0;
  background: var(--atf-ink);
  color: #fff;
  border-bottom-left-radius: var(--atf-r-sm);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-align: center;
  z-index: 2;
}

.atf-media .img-container > img:not(.ignifugo-icon):not(.plastic-free-icon) {
  width: 100%;
  height: auto;
  display: block;
}

.atf-media .slider-container {
  margin-top: 12px;
}

.atf-media .zoom-button { /* "Galleria immagini": chiaro e discreto invece del blocco navy */
  width: auto;
  bottom: 12px;
  right: 12px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, .94);
  color: var(--atf-ink);
  border-radius: var(--atf-r-sm);
  font-size: .875rem;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: 0 1px 4px rgba(0, 32, 92, .2);
}

.atf-media .zoom-button i {
  color: var(--atf-ink);
  padding-right: 6px;
}

.atf-media .zoom-button:hover {
  color: var(--atf-ink);
  background: #fff;
}

/* ---------- Colonna 2: titolo + varianti ---------- */
.atf-info {
  min-width: 0;
  container: atf-info / inline-size;
}

.atf-head {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--atf-line);
}

.atf-title {
  font-size: clamp(1.5rem, 1.15rem + .9vw, 1.875rem); /* 24 → 30 */
  font-weight: 700;
  line-height: 1.15;
  text-transform: uppercase;
}

.atf-trust {
  margin-top: 10px;
}

.atf-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.atf-h2 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
}

/* 18/600 */
.atf-count {
  font-size: 1.125rem;
  color: var(--atf-muted);
  white-space: nowrap;
}

/* 14 */

.atf-options {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.atf-options--scroll { /* >6 varianti */
  max-height: 440px;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--atf-line-strong) transparent;
}

@media (min-width: 992px) {

  .atf-root .atf-info .atf-options--scroll {
    scrollbar-width: auto; /* Firefox */
    scrollbar-color: #aebccc #f1f4f7;
  }

  /* Larghezza della scrollbar */
  .atf-root .atf-info .atf-options--scroll::-webkit-scrollbar {
    width: 12px;
  }

  /* Sfondo */
  .atf-root .atf-info .atf-options--scroll::-webkit-scrollbar-track {
    background: #f1f4f7;
    border-radius: 10px;
  }

  /* Barra trascinabile */
  .atf-root .atf-info .atf-options--scroll::-webkit-scrollbar-thumb {
    background: #aebccc;
    border-radius: 10px;
    border: 2px solid #f1f4f7;
  }

  /* Hover */
  .atf-root .atf-info .atf-options--scroll::-webkit-scrollbar-thumb:hover {
    background: #8295aa;
  }
}

.atf-option {
  position: relative;
}

.atf-option > input[type="radio"] { /* reale, ma nascosto: resta focalizzabile */
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  margin: 0;
}

.atf-option > label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  grid-template-areas: "dot name name name" "dot price chips qty" "dot pack chips qty"; /* nome a tutta larghezza; sotto: prezzo e totale a sinistra, etichette e icona a destra */
  column-gap: 0;
  row-gap: 2px;
  min-height: 60px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--atf-line);
  border-radius: var(--atf-r-sm);
  cursor: pointer;
  transition: border-color var(--atf-ease), background-color var(--atf-ease), box-shadow var(--atf-ease);
}

.atf-option > label:hover {
  border-color: var(--atf-line-strong);
}

.atf-option > input:checked ~ label {
  background: var(--atf-tint);
  border-color: var(--atf-ink);
  box-shadow: inset 0 0 0 1px var(--atf-ink); /* bordo 2px visivo, nessun salto di layout */
}

.atf-option > input:focus-visible ~ label {
  outline: 3px solid var(--atf-focus);
  outline-offset: 2px;
}

.atf-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--atf-line-strong);
  background: #fff;
  display: grid;
  place-items: center;
  transition: border-color var(--atf-ease);
}

.atf-dot::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--atf-ink);
  transform: scale(0);
  transition: transform var(--atf-ease);
}

.atf-option > input:checked ~ label .atf-dot {
  border-color: var(--atf-ink);
}

.atf-option > input:checked ~ label .atf-dot::after {
  transform: scale(1);
}

.atf-dot {
  grid-area: dot;
  margin-right: 14px;
}

.atf-name {
  grid-area: name;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
}

/* 24/600 (TEST) */
.atf-price {
  grid-area: price;
  text-align: left;
  font-size: 1.125rem;
  color: var(--atf-muted);
  font-variant-numeric: tabular-nums;
}

/* "+ IVA cadauno" 14 */
.atf-price b {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--atf-ink);
  margin-right: 2px;
  line-height: 1.3;
}

/* prezzo singolo 24/700 (TEST) */
.atf-pack {
  grid-area: pack;
  font-size: 1.05rem;
  line-height: 1.4;
  color: var(--atf-muted);
  font-variant-numeric: tabular-nums;
}

/* totale confezione 12,8 */
.atf-pack b {
  font-weight: 600;
  color: var(--atf-ink);
}

.atf-old {
  margin-right: 6px;
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--atf-muted);
  text-decoration: line-through;
}

.atf-old {
  display: inline-block;
  margin: 2px 0 0 15px;
}

/* il prezzo barrato sta SOTTO il prezzo (elenco e riepilogo) */

.atf-off { /* badge sconto: piccolo, tinta chiara, nessun blocco pieno */
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  vertical-align: middle;
  background: var(--atf-off-bg);
  color: var(--atf-off);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px var(--atf-off-line);
}

/* Etichette nella variante (spedizione gratuita, risparmio %): a destra, impilate, accanto a prezzo e totale.
   Con colonna stretta (container query in fondo) scendono sotto il testo in riga. */
.atf-chips {
  grid-area: chips;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-left: 0;
  justify-content: space-between;
  margin-top: 10px
}

.atf-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--atf-good-bg);
  color: var(--atf-good-ink); /* verde scuro su verde tenue: ~6:1 */
  box-shadow: inset 0 0 0 1px var(--atf-good-line);
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

/* riga selezionata: le etichette passano a sfondo bianco, così staccano dall'azzurro */
.atf-option > input:checked ~ label .atf-chip:not(.atf-chip--save),
.atf-option > input:checked ~ label .atf-off {
}

.atf-chip--save {
  background: var(--atf-save);
  color: #fff;
  box-shadow: none;
  padding: 4px 10px;
}

/* "Risparmi il X%": verde pieno, testo bianco */
.atf-chip .atf-icon {
  width: 14px;
  height: 14px;
}

.atf-sum-label .atf-chips, .atf-sum-label .atf-pack, .atf-sum-label .atf-qty-icon {
  display: none;
}


/* Icona quantita' (una scatola / piu' scatole): decorativa, a destra. Compare solo con colonna larga (>= 500px): sotto, il posto serve a prezzo e totale. */
.atf-qty-icon {
  grid-area: qty;
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-left: 14px;
  color: var(--atf-muted);
}

.atf-qty-icon .atf-icon {
  width: 40px;
  height: 40px;
  stroke-width: 1.2;
}



.atf-option > input:checked ~ label .atf-qty-icon {
  color: var(--atf-ink);
}

.atf-container-info-price {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  grid-template-areas:
'dot name  qty'
'dot price qty'
'dot pack  qty'
'dot chips qty';
  gap: 3px 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  max-width: none;
}

@container atf-info (min-width: 500px) {
  .atf-qty-icon {
    display: grid;
  }
}

/* nel riepilogo non si ripetono: il carrello ha già il suo avviso */

.atf-root .atf-note {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  font-size: 1.0625rem;
  color: var(--atf-muted);
}

.atf-note .atf-icon {
  width: 16px;
  height: 16px;
}

/* ---------- Colonna 3: carrello (fissa) ---------- */
.atf-buy {
  min-width: 0;
  container: atf-buy / inline-size;
}

.atf-bf { /* banner Black Friday: nero, testo bianco, codice in evidenza (contenuto da CMS) */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px 16px;
  background: #000;
  color: #fff;
  border-radius: var(--atf-r-sm);
  text-align: center;
  font-size: .875rem;
  line-height: 1.45;
}

.atf-bf, .atf-bf p, .atf-bf strong {
  color: #fff;
}

.atf-bf img {
  display: block;
  width: 24px !important;
  height: auto;
  flex: none;
}

.atf-bf > div {
  flex: 1;
}

.atf-bf strong {
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.atf-bf u { /* il codice sconto è un "chip" bianco: l'elemento più contrastato del banner */
  text-decoration: none;
  font-weight: 700;
  color: #000;
  background: #fff;
  padding: 1px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.atf-card {
  background: #fff;
  border: 1px solid var(--atf-line);
  border-radius: var(--atf-r);
  padding: 20px;
  box-shadow: 0 1px 2px rgba(0, 32, 92, .05), 0 8px 24px rgba(0, 32, 92, .06);
}

.atf-card-title {
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--atf-muted);
}

.atf-cap {
  font-size: 1.0625rem;
  color: var(--atf-muted);
}

.atf-sep {
  border: 0;
  border-top: 1px solid var(--atf-line);
  margin: 16px 0;
}

/* Riepilogo: lo script esistente (script.js) copia l'innerHTML della <label> scelta in
   .label-description-selected. Qui lo si "ri-veste" solo con CSS: nessun JS nuovo. */
.atf-sum-label {
  display: block;
  margin-top: 14px;
}

.atf-sum-label .atf-dot {
  display: none;
}

.atf-sum-label .atf-ship-ok {
  display: none;
}

.atf-sum-label .atf-name {
  display: block;
  font-size: 1rem;
}

.atf-sum-label .atf-price {
  display: block;
  margin-top: 6px;
  text-align: left;
  font-size: 1.125rem;
  white-space: normal;
}

.atf-sum-label .atf-price b {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--atf-ink);
}

.atf-sum-label .atf-off {
  margin-left: 6px;
  display: none!important;
}

.atf .atf-total {
  color: var(--atf-price);
  margin-top: 2px;
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.1; /* 40/700: il numero più grande della pagina */
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}

.atf-total p {
  display: none;
}

/* il vecchio script aggiunge "iva inclusa": già nell'etichetta */

.atf-ship {
  display: none;
}

.atf:has(.atf-option > input:checked ~ label .atf-ship-ok) .atf-ship { /* visibile se la variante scelta ha il flag (nessun JS) */
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  margin-top: 10px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--atf-good-ink);
  background-color: var(--atf-good-bg);
  font-size: 15px;
  border-radius: 24px;
}

.atf-ship .atf-icon {
  width: 23px;
  height: 23px;
}

.atf-qty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.atf-qty > label {
  font-size: 1.125rem;
  color: var(--atf-muted);
}

.atf-stepper {
  display: inline-flex;
  border: 1px solid var(--atf-line-strong);
  border-radius: var(--atf-r-sm);
  overflow: hidden;
  background: #fff;
}

.atf-stepper button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  background: #fff;
  color: var(--atf-ink);
  border: 0;
  cursor: pointer;
  transition: background-color var(--atf-ease);
}

.atf-stepper button:hover {
  background: var(--atf-tint);
}

.atf-stepper button:focus-visible {
  outline: 3px solid var(--atf-focus);
  outline-offset: -3px;
}

.atf-stepper .atf-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.atf-stepper input[type="number"] {
  width: 56px;
  height: 44px;
  padding: 0;
  border: 0;
  border-inline: 1px solid var(--atf-line);
  background: #fff;
  color: var(--atf-ink);
  font: 600 1rem/1 inherit;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.atf-stepper input[type="number"]::-webkit-inner-spin-button,
.atf-stepper input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.atf-stepper input[type="number"]:focus-visible {
  outline: 3px solid var(--atf-focus);
  outline-offset: -3px;
}

.atf-cta-wrap {
  margin-top: 16px;
}

.atf-cta {
  width: 100%;
  min-height: 52px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--atf-ink);
  color: #fff;
  border: 0;
  border-radius: var(--atf-r-sm);
  font-size: .9375rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color var(--atf-ease), transform 120ms;
}

.atf-cta .atf-icon {
  width: 22px;
  height: 22px;
}

.atf-cta:hover {
  background: #00307f;
}

.atf-cta:active {
  transform: scale(.985);
}

.atf-cta:focus-visible {
  outline: 3px solid var(--atf-focus);
  outline-offset: 3px;
}

/* Link rapidi e abbonamenti stanno DENTRO la card del carrello, sotto il pulsante, separati da un filetto */
.atf-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  margin-top: 18px;
  padding: 14px 0 0;
  border-top: 1px solid var(--atf-line);
  font-size: 1.125rem;
}

.atf-quick a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--atf-muted);
}

.atf-quick a:hover {
  color: var(--atf-ink);
  text-decoration: underline;
}

.atf-quick .atf-icon {
  width: 16px;
  height: 16px;
}

.atf-quick a:focus-visible {
  outline: 3px solid var(--atf-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.atf-buy .abo {
  margin-top: 14px;
  padding: 14px 0 0;
  border-top: 1px solid var(--atf-line);
}

.atf-buy .abo h6 {
  margin: 0 0 8px !important;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: .04em;
  color: var(--atf-muted);
}

.atf-buy .abo img {
  height: 62px;
  width: auto;
}

/* ---------- Completa il set: riga a tutta larghezza, una card con bordo per prodotto ---------- */
.atf-set {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--atf-line);
  container: atf-set / inline-size;
  scroll-margin-top: 24px;
}

.atf-set-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  row-gap: 4px;
}

/* titolo | descrizione | pulsante a destra */
.atf-set .atf-h2 {
  font-size: 1.375rem;
}

/* 22/600 */
.atf-set-head p {
  font-size: 1rem;
  color: var(--atf-muted);
}

.atf-set .d-none {
  display: none !important;
}

/* toggle usato da "Mostra altri" */

/* max 4 card per riga: la larghezza minima di una colonna è il maggiore tra 280px e un quarto della riga (auto-fill: con meno prodotti le card non si allargano) */
.atf-set-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(max(280px, calc((100% - 48px) / 4)), 1fr));
  gap: 16px;
  margin-top: 16px;
}

.atf-set-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 6px 16px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--atf-line-strong);
  border-radius: var(--atf-r);
  transition: border-color var(--atf-ease), box-shadow var(--atf-ease);
}

.atf-set-item:hover {
  border-color: var(--atf-ink);
  box-shadow: 0 4px 16px rgba(0, 32, 92, .08);
}

.atf-set-thumb {
  grid-row: span 2;
  display: block;
  width: 96px;
  height: 96px;
}

.atf-set-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  border-radius: var(--atf-r-sm);
}

.atf-set-name {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  text-transform: uppercase;
  align-self: end;
}

.atf-set-name:hover {
  text-decoration: underline;
}

.atf-set-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-self: start;
}

.atf-set-price {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--atf-ink);
  white-space: nowrap;
  width: 100%;
}

.atf-btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 6px 18px;
  background: #fff;
  color: var(--atf-ink);
  border: 1px solid var(--atf-line-strong);
  border-radius: var(--atf-r-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color var(--atf-ease), background-color var(--atf-ease);
}

.atf-btn-outline:hover {
  border-color: var(--atf-ink);
  background: var(--atf-tint);
}

.atf-btn-outline:focus-visible {
  outline: 3px solid var(--atf-focus);
  outline-offset: 2px;
}

.atf-btn-outline .atf-icon {
  width: 18px;
  height: 18px;
}

/* "Mostra altri / meno": a destra, sulla stessa riga del titolo "Completa il Set" (così si vede sempre anche con le card aperte) */
.atf-more {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
}

.atf-more > button {
  min-height: 40px;
  padding: 4px 16px;
}

@container atf-set (max-width: 640px) {
  .atf-set-head p {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* spazio stretto: la descrizione va sotto, il pulsante resta accanto al titolo */

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 991px) {
  /* una colonna: immagini → varianti → carrello → set */
  .atf {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 24px;
  }

  .atf-media {
    max-width: 520px;
    margin-inline: auto;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .atf-card {
    padding: 16px;
  }

  .atf-set-item {
    grid-template-columns: 80px minmax(0, 1fr);
    padding: 12px;
  }

  .atf-set-thumb {
    width: 80px;
    height: 80px;
  }

  .atf-total {
    font-size: 2.25rem;
  }

  .atf-option > label {
    padding: 12px;
    column-gap: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .atf * {
    transition: none !important;
  }
}

/* Varianti adattive alla larghezza della colonna (non dello schermo): con colonna stretta le etichette scendono sotto prezzo e totale */
@container atf-info (max-width: 440px) {
  .atf-option > label {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "dot name" "dot price" "dot pack" ". chips";
    padding: 12px;
  }

  .atf-chips {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    margin: 8px 0 0;
  }
}

/* Carrello stretto (finestra ridotta): i contenuti si riorganizzano in base alla larghezza della colonna */
@container atf-buy (max-width: 310px) {
  .atf-card {
    padding: 16px;
  }

  .atf-total {
    font-size: 2.25rem;
  }

  .atf-qty {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .atf-stepper {
    display: flex;
  }

  .atf-stepper input[type="number"] {
    flex: 1;
    width: auto;
  }

  .atf-cta {
    font-size: .875rem;
    letter-spacing: .02em;
    padding-inline: 12px;
  }

  .atf-cta .atf-icon {
    width: 20px;
    height: 20px;
  }

  .atf-bf {
    padding: 12px;
    font-size: .8125rem;
  }

  .atf-bf img {
    width: 20px !important;
  }

  .atf-bf strong {
    font-size: 1rem;
  }
}

/* FASE 1 — adattamento ai componenti PHP legacy: non altera i data-* né gli handler del carrello. */
.atf-root .atf-info .variante {
  display: block !important;
  padding: 0 !important;
}

.atf-root .atf-info .variante > ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.atf-root .atf-info .product-option {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 16px;
  border: 1px solid var(--atf-line);
  border-radius: 8px;
  background: #fff;
  margin: 0;
}

.atf-root .atf-info .product-option:has(> input[type=radio]:checked) {
  background: var(--atf-tint);
  border-color: var(--atf-ink);
  box-shadow: inset 0 0 0 1px var(--atf-ink);
}

.atf-root .atf-info .product-option > input[type=radio] {
  flex: none;
  accent-color: var(--atf-ink);
  width: 20px;
  height: 20px;
  margin: 0;
}

.atf-root .atf-info .product-option > label {
  cursor: pointer;
  flex: 1 1 80%;
  font-size: 16px;
  line-height: 1.5;
  color: var(--atf-ink);
  margin: 0;
}

.atf-root .atf-info .product-option > .lista-colori {
  padding: 8px 0 0 32px;
}

.atf-root .atf-info .product-option .gold-icon {
  max-height: 30px;
  width: auto;
}

.atf-root .atf-buy .aside {
  width: 100%;
  max-width: none;
  padding: 0;
  margin: 0;
}

.atf-root .atf-buy .aside-border {
  border: 1px solid var(--atf-line);
  border-radius: 12px;
  padding: 20px !important;
  background: white;
  box-shadow: 0 8px 24px rgba(0, 32, 92, .06);
}

.atf-root .atf-buy .aside-border > p:first-child {
  font-size: 13px;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--atf-muted);
}

.atf-root .atf-buy .price-product-item {
  font-size: 38px !important;
  color: var(--atf-price) !important;
}

.atf-root .atf-buy .cta-cart {
  margin-top: 16px !important;
}

.atf-root .atf-buy .btn-add {
  background: var(--atf-ink);
  color: white;
  border-radius: 8px;
  min-height: 52px;
  display: flex !important;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.atf-root .atf-buy .abo {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--atf-line);
}

.atf-root .atf-media .img-container {
  display: block !important;
}

.atf-root .atf-media .img-container img {
  max-width: 100%;
}

@media (max-width: 1199px) {
  .atf-root .atf-media .img-container {
    display: block !important;
  }
}

/* FASE 2 — Card dinamiche, desktop e mobile. */
.atf-root .atf-info .variante > ul {
  display: grid;
  gap: 8px;
}

.atf-root .atf-info .product-option.atf-option,
.dett-prodotto-mobile .product-option.atf-option {
  display: block;
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  list-style: none;
  margin: 0 0 8px;
}

.atf-root .atf-info .product-option.atf-option > input[type=radio],
.dett-prodotto-mobile .product-option.atf-option > input[type=radio] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  left: 10px;
  top: 10px;
  margin: 0;
}

.atf-root .atf-info .product-option.atf-option > label,
.dett-prodotto-mobile .product-option.atf-option > label {
  display: grid;
  grid-template-columns:24px minmax(0, 1fr) auto;
  grid-template-areas:'dot name qty' 'dot price qty' 'dot pack qty' 'dot chips qty';
  gap: 3px 0;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--atf-line);
  border-radius: var(--atf-r-sm);
  cursor: pointer;
  font-size: 16px;
  max-width: none;
}

.atf-root .atf-info .product-option.atf-option > input:checked ~ label,
.dett-prodotto-mobile .product-option.atf-option > input:checked ~ label {
  background: var(--atf-tint);
  border-color: var(--atf-ink);
  box-shadow: inset 0 0 0 1px var(--atf-ink);
}

.atf-root .atf-info .product-option.atf-option > input:focus-visible ~ label,
.dett-prodotto-mobile .product-option.atf-option > input:focus-visible ~ label {
  outline: 3px solid var(--atf-focus);
  outline-offset: 2px
}

.atf-root .atf-info .product-option.atf-option .atf-dot,
.dett-prodotto-mobile .product-option.atf-option .atf-dot {
  grid-area: dot;
  margin: 3px 0 0
}

.atf-root .atf-info .product-option.atf-option .atf-name,
.dett-prodotto-mobile .product-option.atf-option .atf-name {
  grid-area: name;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3
}

.atf-root .atf-info .product-option.atf-option .atf-price,
.dett-prodotto-mobile .product-option.atf-option .atf-price {
  grid-area: price;
  font-size: 1rem;
  color: var(--atf-muted)
}

.atf-root .atf-info .product-option.atf-option .atf-price b,
.dett-prodotto-mobile .product-option.atf-option .atf-price b {
  font-size: 1.375rem;
  color: var(--atf-ink)
}

.atf-root .atf-info .product-option.atf-option .atf-pack,
.dett-prodotto-mobile .product-option.atf-option .atf-pack {
  grid-area: pack;
  font-size: .95rem
}

/* Icone confezione come nella demo. Nascoste soltanto sulle card strette. */
.atf-root .atf-info .product-option.atf-option .atf-qty-icon,
.dett-prodotto-mobile .product-option.atf-option .atf-qty-icon {
  grid-area: qty;
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  margin-left: 12px;
  color: var(--atf-muted);
}

.atf-qty-icon img.atf-icon {
  display: block;
  height: 100%;
  object-fit: contain;
}


.atf-root .atf-info .product-option.atf-option > input:checked ~ label .atf-qty-icon,
.dett-prodotto-mobile .product-option.atf-option > input:checked ~ label .atf-qty-icon {
  color: var(--atf-ink)
}

@container atf-info (max-width: 499px) {
  .atf-root .atf-info .product-option.atf-option .atf-qty-icon {
    display: none
  }
}

@media (max-width: 499px) {
  .dett-prodotto-mobile .product-option.atf-option .atf-qty-icon {
    display: none
  }
}

.atf-root .atf-info .product-option.atf-option .lista-colori,
.dett-prodotto-mobile .product-option.atf-option .lista-colori {
  padding: 12px 16px 14px;
  border: 1px solid var(--atf-line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  background: white
}

.atf-root .atf-info .product-option.atf-option .lista-colori.d-none,
.dett-prodotto-mobile .product-option.atf-option .lista-colori.d-none {
  display: none !important
}

.atf-root .atf-info .atf-options--scroll {
  max-height: 555px;
  overflow-y: auto;
}

.dett-prodotto-mobile .product-option.atf-option .atf-dot::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #00205c;
  transform: scale(0);
  transition: transform .16s
}

.dett-prodotto-mobile .product-option.atf-option > input:checked ~ label .atf-dot::after {
  transform: scale(1)
}

.dett-prodotto-mobile .product-option.atf-option .atf-dot {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 2px solid #b7c4d6;
  border-radius: 50%
}

.dett-prodotto-mobile .product-option.atf-option .atf-old {
  display: inline-block;
  margin-left: 15px;
}

/* Il vecchio template mobile non è dentro .atf-root: definisce i token autonomamente. */
.dett-prodotto-mobile {
  --atf-ink: #00205c;
  --atf-tint: #edf6fa;
  --atf-line: #dbe3ee;
  --atf-muted: #5b6b82;
  --atf-focus: #2b6fd6;
  --atf-r-sm: 8px;
}

.dett-prodotto-mobile .product-option.atf-option > label .atf-chips {
  grid-area: chips
}

/* Card a colonna ridotta: recupera spazio per nome e prezzi. */
@container atf-info (max-width: 499px) {
  .atf-root .atf-info .product-option.atf-option > label {
    grid-template-columns:24px minmax(0, 1fr);
    grid-template-areas:'dot name' 'dot price' 'dot pack' 'dot chips';
  }
}

@media (max-width: 499px) {
  .dett-prodotto-mobile .product-option.atf-option > label {
    grid-template-columns:24px minmax(0, 1fr);
    grid-template-areas:'dot name' 'dot price' 'dot pack' 'dot chips';
  }
}

/* Badge spedizione gratuita nelle varianti */
.atf-option .atf-chip.atf-ship-ok {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;

  padding: 7px 14px;
  gap: 8px;

  border-radius: 24px;
  white-space: normal;
  text-align: center;
}

/* Icona camion */
.atf-option .atf-chip.atf-ship-ok .atf-icon {
  width: 21px;
  height: 21px;
  flex-shrink: 0;
}

/* Disposizione su mobile */
@media (max-width: 480px) {
  .atf-option .atf-chip.atf-ship-ok {
    font-size: 14px;
    padding: 6px 12px;
  }
}
/* FASE 3 – Riepilogo e set. Aggiunte basate sul CSS revisionato dal reparto sviluppo. */
.atf-root .atf-buy .aside-border.atf-card { padding: 20px !important; margin: 0 !important; }
.atf-root .atf-buy .atf-sum-label { margin-top: 14px; }
.atf-root .atf-buy .atf-total { font-size: 2.5rem !important; color: var(--atf-price) !important; display: block !important; font-weight: 800 }
.atf-root .atf-buy .atf-total > del { font-size: 1rem; font-weight: 400; color: var(--atf-muted); position: absolute;left: 100px; top: -10px}
.atf-root .atf-buy .atf-qty { margin-top: 16px !important; }
.atf-root .atf-buy .atf-qty > label { margin: 0; }
.atf-root .atf-buy .atf-stepper button { font-size: 1.5rem; line-height: 1; }
.atf-root .atf-buy .cta-cart.atf-cta-wrap { margin-top: 16px !important; }
.atf-root .atf-buy .atf-cta { text-decoration: none; }
.atf-root .atf-buy .atf-ship { display: none; }
.atf-root .atf-buy .atf-quick { margin-top: 18px; }
.atf-root .atf-set .atf-set-item { min-width: 0; }
.atf-root .atf-set .atf-set-item .atf-btn-outline { min-height: 40px; }
.atf-root .atf-set .atf-set-thumb img { object-fit: contain; }
.atf-root .atf-set .atf-set-item.d-none { display: none !important; }
/* Mobile eredita i token dalla stessa .atf-root, evitando gli stili della vecchia scheda. */
.dett-prodotto-mobile .atf-root .atf { grid-template-columns: minmax(0, 1fr); row-gap: 24px; }
.dett-prodotto-mobile .atf-root .atf-buy .price-product-item-mobile { font-size: 2.25rem !important; color: var(--atf-price) !important;position: relative }
@media (max-width: 480px) {
  .atf-root .atf-buy .aside-border.atf-card { padding: 16px !important; }
  .atf-root .atf-set-list { grid-template-columns: minmax(0, 1fr); }
}


/* Tooltip spedizione gratuita */
.tooltip {
  --bs-tooltip-bg: #ffffff;
  --bs-tooltip-color: #40536b;
  --bs-tooltip-opacity: 1;
  --bs-tooltip-max-width: 260px;
}

.tooltip .tooltip-inner {
  background: #ffffff;
  color: #40536b;
  border: 1px solid #dce3eb;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 16px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

/* Freccia del tooltip */
.bs-tooltip-top .tooltip-arrow::before {
  border-top-color: #ffffff;
}