/* CtrlFinder — un foglio di stile, organizzato per quello che si vede.
 *
 * Direzione: il design system di shapefinder.cc, ricavato con skillui e verificato sul CSS del sito.
 * Inter sola, palette calda e neutra (fondo #f5f5f4, fogli bianchi, testo #292524), niente accento
 * colorato: i pulsanti pieni sono neri, le piastrelle grigie, l'arancio resta al solo badge.
 * Raggio 8 px per i controlli, 15 px per i fogli, ombre a cinque strati, niente blur.
 *
 * Le comparse che partono da opacity 0 vivono sotto `.js` (index.html aggiunge la classe): senza
 * JavaScript il contenuto è leggibile e i crawler lo vedono.
 */

/* ==== Token, font, base ======================================================================== */
:root {
  color-scheme: light;
  --bg: #f5f5f4;
  --surface: #fff;
  --ink: #292524;           /* testo e superfici piene */
  --ink-deep: #1c1917;      /* pulsante pieno in hover */
  --ink-hover: #44403c;
  --on-ink: #fafaf9;
  --muted: #6b645f;
  --muted-strong: #57534e;
  --dim: #a8a29e;           /* solo testo non essenziale (risposte non disponibili) */
  --dim-soft: #c4c1be;
  --line: #e7e5e4;
  --tile: #f5f5f4;
  --tile-hover: #e7e5e4;
  --tile-active: #d6d3d1;
  --raised: #fafaf9;
  --badge: #ea580c;         /* "Recommended", l'unico arancio del sistema */
  --range: #3a83f2;         /* blu della barra del budget, riusato per il confronto */
  --cmp-1: #292524;
  --cmp-2: #ea580c;
  --cmp-3: #3a83f2;
  --cmp-muted: #57534e;
  --radius: 15px;
  --radius-sm: 8px;
  --ease-out: cubic-bezier(.23, 1, .32, 1);
  --ease-in-out: cubic-bezier(.45, 0, .25, 1);
  /* L'ombra di shapefinder: cinque strati più un anello da 1px che fa da bordo. */
  --shadow:
    0 17.54px 23.39px 0 rgb(0 0 0 / 4%),
    0 9.4px 12.5px 0 rgb(0 0 0 / 3%),
    0 5.25px 7px 0 rgb(0 0 0 / 2%),
    0 2.79px 3.72px -2px rgb(0 0 0 / 1%),
    0 1.16px 1.5px 0 rgb(0 0 0 / 1%),
    0 0 0 1px rgb(0 0 0 / 5%);
}

/* Inter per tutto il testo (sottoinsieme latino, 48 KB: copre accenti italiani, €, ×, ·, —).
   Il sistema di shapefinder non ha una seconda famiglia. */
@font-face {
  font-family: Inter;
  src: url('fonts/inter-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
body:not([data-view="results"]):not([data-view="compare"]):not([data-view="about"]) {
  overflow: hidden;
}
::selection { background: var(--ink); color: var(--bg); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }
/* Il fuoco da tastiera usa l'inchiostro: sul fondo caldo si vede, e non introduce un colore. */
button:focus-visible, a:focus-visible, input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Ogni cosa cliccabile sta almeno 44 px in alto: sotto quella misura il dito sbaglia bersaglio. */
.ghost, .buy, #next, #compare-go, .help {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px;
}

main { padding: 0; }
body[data-view="results"] main,
body[data-view="compare"] main,
body[data-view="about"] main { padding-bottom: 40px; }

/* ==== Il palco ================================================================================ */
/* I controller occupano la pagina; le domande sono un foglio appoggiato in basso, come su
   shapefinder. La scena è assoluta su tutto il palco, così i pad possono arrivare fino in fondo
   anche accanto al foglio. */
.stage {
  position: relative;
  display: flex; flex-direction: column;
  height: 100vh;
  height: 100svh;
  min-height: 100svh;
  padding-bottom: 18px;
  overflow: hidden;
}
.stage-top {
  position: relative; z-index: 2; order: 0;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 24px 0;
  pointer-events: none;
}
.stage-top > * {
  pointer-events: auto;
}
.wordmark { margin: 0; display: flex; }
.wordmark a { display: flex; color: inherit; text-decoration: none; }
/* Il lockup è un PNG perché l'SVG usa <text> e, dentro <img>, non caricherebbe Inter. */
.wordmark img { display: block; height: 48px; width: auto; }
/* Accessibilità e SEO: visibile a crawler e lettori di schermo, invisibile a video */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
/* In alto a destra: link About. */
.top-nav {
  margin-left: auto; display: flex; align-items: center; gap: 8px;
}
.nav-about {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 14px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: color .15s ease, background .15s ease;
}
.nav-about:hover { color: var(--ink); }
.nav-about[aria-current="page"],
body[data-view="about"] .nav-about {
  color: var(--ink); font-weight: 600;
  background: var(--surface); box-shadow: 0 0 0 1px rgb(0 0 0 / 6%);
}
/* L'avanzamento è una riga in cima alla pagina, non una barra dentro il foglio. */
.bar { position: absolute; top: 0; left: 0; right: 0; z-index: 3; height: 2px; background: var(--line); pointer-events: none; }
.bar i {
  display: block; height: 100%; width: 0;
  background: var(--ink); transition: width .35s var(--ease-out);
}

/* Se il motore non disegna (scheda in secondo piano, cattura di pagina, crawler) le comparse
   resterebbero a opacity 0 per sempre: app.js mette .settled sulla radice e tutto torna allo stato
   finale. Vanno spenti animazione E transizione: con l'orologio fermo una transizione resta
   inchiodata al valore di partenza, cioè a zero. Nessun elemento ha opacity 0 nel CSS: la toglie
   solo l'animazione, quindi basta spegnere quella. */
html.settled * { animation: none !important; transition: none !important; }
html.settled .card { opacity: 1 !important; transform: none !important; }

/* ==== Movimento =============================================================================== */
/* Le comparse usano fill-mode "backwards": con "both" il transform dell'animazione resterebbe
   appiccicato all'elemento e l'hover non lo muoverebbe più. */
@keyframes tile-in { from { opacity: 0; transform: translateY(6px) } }
@keyframes fade-in { from { opacity: 0 } }
@keyframes bar-up { from { opacity: 0; transform: translateY(100%) } }
@keyframes draw { from { stroke-dashoffset: 1 } }
/* La domanda nuova entra dal lato verso cui si sta andando. */
@keyframes q-next { from { opacity: 0; transform: translateX(16px) } }
@keyframes q-prev { from { opacity: 0; transform: translateX(-16px) } }

/* ==== La scena: i controller che passano le risposte ========================================== */
/* Qui si usano i ritagli scontornati (`img/cut/`): il fondo è trasparente, quindi il pad sta
   direttamente sul foglio caldo senza multiply e i colori restano quelli veri. L'opacità sta sui
   singoli controller, non sul contenitore: così quello sotto il mouse può tornare pieno invece di
   restare tagliato dal gruppo. */
#scene {
  position: absolute; inset: 0; order: 1;
  overflow: hidden; pointer-events: none;
}
/* Posizionamento gestito interamente via GPU transform scale() e translate3d() da app.js.
   I nodi hanno dimensione proporzionata al form factor orizzontale dei controller (200px x 160px). */
#scene .scene-item {
  position: absolute; top: 0; left: 0;
  width: 200px; height: 160px;
  margin: 0; padding: 0;
  background: none; border: 0;
  pointer-events: auto; cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  transform-origin: center center;
  will-change: transform;
  opacity: 0;
  transition: transform 620ms var(--ease-out), opacity 195ms var(--ease-out);
}
#scene:not(.ready) .scene-item {
  transition: none !important;
}
#scene .scene-item:focus,
#scene .scene-item:focus-visible {
  outline: none;
}
/* I controller in evidenza al centro, a piena opacità, con nome e prezzo sotto. */
#scene .scene-item.is-featured { z-index: 2; opacity: 1; }
#scene .scene-item img {
  display: block;
  width: 100%; height: 100%;
  object-fit: contain;
  user-select: none;
  pointer-events: none;              /* il bersaglio è il bottone, non la foto dentro */
  transition: transform 440ms var(--ease-out), filter 440ms var(--ease-out);
}
.scene-label {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  width: calc(200px / var(--s, 1)); margin-top: 4px; text-align: center; pointer-events: none;
  font-size: calc(12.5px / var(--s, 1)); line-height: 1.25; color: var(--muted);
  opacity: 0; visibility: hidden;
  transition: opacity 220ms var(--ease-out);
}
.scene-label strong {
  display: block; color: var(--ink); font-size: calc(13px / var(--s, 1)); font-weight: 600; letter-spacing: -.01em;
}
.scene-label span {
  display: block; font-size: calc(11.5px / var(--s, 1)); margin-top: 1px;
}
#scene .scene-item:not(.is-featured) .scene-label { opacity: 0; visibility: hidden; }
#scene .scene-item.is-featured .scene-label { opacity: 1; visibility: visible; }
/* Come su shapefinder: all'hover la foto sale di 6 px e si illumina a piena opacità. */
@media (hover: hover) and (pointer: fine) {
  #scene .scene-item:hover { opacity: 1 !important; z-index: 10; }
  #scene .scene-item:hover img { transform: translateY(-6px); }
}
/* I risultati stanno sotto i tre in evidenza; il confronto non ha un palco da riempire. */
body[data-view="results"] .stage { height: auto; min-height: 64svh; overflow: visible; }
body[data-view="compare"] .stage { height: auto; min-height: auto; overflow: visible; }
body[data-view="compare"] #scene { display: none; }
body[data-view="about"] .stage { height: auto; min-height: auto; overflow: visible; padding-bottom: 0; }
body[data-view="about"] #scene,
body[data-view="about"] #quiz,
body[data-view="about"] .bar { display: none; }

/* ==== Fogli =================================================================================== */
.panel, .card, .deadend {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.panel, .deadend { padding: 28px 26px; }
.panel { margin-bottom: 18px; }
/* Il questionario è il foglio che fluttua al centro-basso, largo 760 px come quello di shapefinder. */
#quiz {
  position: relative; z-index: 2; flex: none; order: 2;
  width: min(760px, calc(100% - 32px));
  margin: auto auto 28px;
  padding: 24px 28px 24px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

/* ==== Questionario ============================================================================ */
.quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  position: relative;
}
.quiz-nav-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 68px;
}
.quiz-nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  flex: 0 0 68px;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background .18s var(--ease-out), color .18s var(--ease-out), transform .18s var(--ease-out);
}
.icon-btn:hover {
  background: var(--tile);
  color: var(--ink);
}
.icon-btn:active {
  background: var(--tile-hover);
  transform: scale(0.94);
}
.icon-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.icon-btn svg {
  display: block;
}

#q-title {
  flex: 1;
  margin: 0;
  text-align: center;
  font-size: clamp(1.22rem, 3.2vw, 1.52rem);   /* 20-24 px, come shapefinder */
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.28;
  color: var(--ink);
}
#q-title:focus { outline: none; }
#q-title.from-right { animation: q-next .3s var(--ease-out) backwards; }
#q-title.from-left { animation: q-prev .3s var(--ease-out) backwards; }

.q-help {
  margin: -6px 0 18px;
  padding: 12px 16px;
  background: var(--tile);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted-strong);
  animation: fade-in .18s var(--ease-out) backwards;
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 8px;
}
.option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 90px;
  padding: 14px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--tile);
  color: var(--ink);
  text-align: center;
  user-select: none;
  cursor: pointer;
  transition: background .18s var(--ease-out), border-color .18s var(--ease-out), transform .18s var(--ease-out), box-shadow .18s var(--ease-out);
  /* Le piastrelle entrano a cascata quando arriva una domanda: --i lo scrive app.js. */
  animation: tile-in .26s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 20ms);
}
.option:hover {
  background: var(--tile-hover);
  transform: translateY(-1px);
}
.option:active {
  background: var(--tile-active);
  transform: translateY(0);
}
/* La scelta attiva: fondo superficie bianco, contorno inchiostro nitido e badge di spunta */
.option.on {
  background: var(--surface);
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink), 0 2px 8px rgba(0,0,0,0.04);
}
.option:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.option.dead {
  background: var(--raised);
  color: var(--dim);
  border-color: transparent;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}
.option.dead:hover { background: var(--raised); }
.option.dead strong { font-weight: 500; }
.option.dead .hint { color: var(--dim-soft); }
.option.dead .n { color: var(--dim); }

.option strong {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.3;
}
.option .hint {
  max-width: 142px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--muted);
}
.option.on .hint {
  color: var(--muted-strong);
}
.option .n {
  position: absolute;
  top: 7px;
  right: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.option.on .n {
  color: var(--ink);
  font-weight: 700;
}
.option-check {
  position: absolute;
  top: 7px;
  left: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--surface);
  animation: check-pop .18s var(--ease-out);
}
@keyframes check-pop {
  0% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.multi-actions {
  margin-top: 12px;
  animation: fade-in .18s var(--ease-out) backwards;
}
#next {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 9px;
  background: var(--ink);
  color: var(--on-ink);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: -.01em;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .18s var(--ease-out), transform .18s var(--ease-out);
}
#next:hover {
  background: var(--ink-hover);
  transform: translateY(-1px);
}
#next:active {
  background: var(--ink-deep);
  transform: translateY(0);
}
#next:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.count { color: var(--muted); font-size: 12.5px; margin: 18px 0 0; text-align: center; }
.ghost {
  padding: 0 14px; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: 13px;
}
.ghost:hover { background: var(--tile); color: var(--ink); }

/* ==== Risultati =============================================================================== */
/* Risultati e confronto stanno nella colonna di lettura, sotto il palco. */
.results, .compare { width: min(1100px, 100%); margin: 0 auto; padding-inline: 20px; }
.results { padding-top: 4px; }
.results-head { display: flex; align-items: center; gap: 12px; }
.results-head h2 {
  margin: 0;
  font-size: clamp(1.4rem, 3.4vw, 1.7rem); font-weight: 600; letter-spacing: -.6px; line-height: 1.2;
}
.results-head .ghost { margin-left: auto; }
.results .count { text-align: left; margin: 12px 0 0; max-width: 62ch; }

.cards {
  display: grid; gap: 14px; margin-top: 20px;
  grid-template-columns: repeat(auto-fill, minmax(430px, 1fr));
}
.card { display: flex; align-items: stretch; gap: 16px; padding: 20px; }
/* La comparsa delle schede è guidata da app.js quando entrano nella finestra. Il ritardo a cascata
   sta solo su opacità e posizione: se lo prendesse anche l'ombra, l'hover arriverebbe in ritardo. */
.js .card {
  opacity: 0; transform: translateY(14px);
  transition:
    opacity .4s var(--ease-out) calc(var(--i, 0) * 40ms),
    transform .4s var(--ease-out) calc(var(--i, 0) * 40ms),
    box-shadow 220ms var(--ease-out);
}
.js .card.in { opacity: 1; transform: none; }
/* La foto sta su una piastrella alta quanto la scheda, come le righe di shapefinder. Il fondo bianco
   dello scatto sparisce nel multiply: resta il controller, non il riquadro. */
.shot {
  flex: 0 0 168px; align-self: stretch; padding: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tile); border-radius: var(--radius-sm);
  transition: background .2s;
}
.thumb {
  width: 100%; height: 100%; min-height: 128px; object-fit: contain;
  mix-blend-mode: multiply;
  transition: transform .3s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover { box-shadow: var(--shadow), 0 18px 30px -18px rgb(28 25 23 / 22%); }
  .card:hover .shot { background: var(--tile-hover); }
  .card:hover .thumb { transform: translateY(-2px) scale(1.03); }
}
.card-body { flex: 1; min-width: 0; }
.card-head { display: flex; align-items: baseline; gap: 10px; }
.card-head h3 {
  margin: 0;
  font-size: 15px; font-weight: 600; letter-spacing: -.015em; line-height: 1.3;
}
.card-meta { margin: 9px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.notes {
  list-style: none; margin: 12px 0 0; padding: 10px 0 0;
  border-top: 1px solid var(--line); font-size: 12.5px; line-height: 1.5;
}
.notes li { color: var(--muted-strong); }
.notes .lbl { display: inline-block; min-width: 92px; color: var(--muted); }
.card-foot { display: flex; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.price {
  font-size: 17px; font-weight: 600; letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.price.na { font-size: 11.5px; font-weight: 500; color: var(--muted); }
/* Compare button (pill toggle) */
.pick {
  position: relative;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border-radius: var(--radius-sm);
  background: var(--tile);
  border: 1px solid var(--line);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -.01em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition:
    background .18s var(--ease-out),
    border-color .18s var(--ease-out),
    color .18s var(--ease-out),
    transform .18s var(--ease-out),
    box-shadow .18s var(--ease-out);
}
.pick * {
  pointer-events: none;
}
.pick:hover {
  background: var(--tile-hover);
  border-color: var(--dim-soft);
  color: var(--ink);
  transform: translateY(-1px);
}
.pick:active {
  transform: translateY(0);
}

/* Stato attivo quando selezionato per il confronto */
.pick:has(input:checked),
.pick.is-picked {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--on-ink);
  box-shadow: 0 2px 6px rgba(41, 37, 36, 0.14);
}
.pick:has(input:checked):hover,
.pick.is-picked:hover {
  background: var(--ink-hover);
  border-color: var(--ink-hover);
  color: var(--on-ink);
}

/* Icone */
.pick .pick-icon {
  display: block;
  flex-shrink: 0;
}
.pick .pick-icon-idle {
  display: block;
  color: var(--muted);
}
.pick:hover .pick-icon-idle {
  color: var(--ink);
}

.pick .pick-icon-active {
  display: none;
  color: var(--on-ink);
}
.pick:has(input:checked) .pick-icon-idle,
.pick.is-picked .pick-icon-idle {
  display: none;
}
.pick:has(input:checked) .pick-icon-active,
.pick.is-picked .pick-icon-active {
  display: block;
  animation: check-pop .18s var(--ease-out);
}

.pick:has(input:focus-visible) {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.buy {
  margin-left: auto; padding: 0 16px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--on-ink);
  font-size: 13px; font-weight: 600; text-decoration: none;
  white-space: nowrap;
  transition: background .18s;
}
.buy:hover { background: var(--ink-hover); }
.deadend p { margin: 0 0 14px; font-size: 13.5px; color: var(--muted-strong); }
.deadend .ghost { margin: 0 6px 8px 0; background: var(--tile); color: var(--ink); }
/* Vicolo cieco e coda dei "quasi" occupano tutta la riga, non una colonna di schede. */
.cards > .deadend, .results .cards > .count { grid-column: 1 / -1; }

/* ==== Scheda del controller ================================================================== */
/* La scheda intera apre la modale; checkbox e link restano bersagli propri (vedi app.js). */
.card { cursor: pointer; }
.card-open {
  padding: 0; font: inherit; color: inherit; text-align: left;
}
.card-open:hover { text-decoration: underline; text-underline-offset: 2px; }
.near-open {
  padding: 0; font: inherit; color: inherit;
  text-decoration: underline; text-underline-offset: 2px;
}

.modal {
  width: min(840px, calc(100% - 32px));
  max-height: min(92vh, 880px);
  padding: 0; border: 0; border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  box-shadow:
    0 24px 48px -12px rgba(28, 25, 23, 0.12),
    0 12px 24px -8px rgba(28, 25, 23, 0.08),
    0 0 0 1px rgba(28, 25, 23, 0.06);
  overflow: visible;
  transform-origin: center center;
}
.modal::backdrop {
  background: rgb(28 25 23 / 48%);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

/* Animazione di apertura e chiusura coerente con il design system */
.modal.is-opening {
  animation: modal-enter .28s var(--ease-out) forwards;
}
.modal.is-opening::backdrop {
  animation: modal-backdrop-enter .28s var(--ease-out) forwards;
}

.modal.is-closing {
  animation: modal-exit .20s var(--ease-out) forwards;
  pointer-events: none;
}
.modal.is-closing::backdrop {
  animation: modal-backdrop-exit .20s var(--ease-out) forwards;
}

@keyframes modal-enter {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modal-exit {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.97);
  }
}

@keyframes modal-backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-backdrop-exit {
  from { opacity: 1; }
  to { opacity: 0; }
}

.modal-inner { position: relative; padding: 28px 32px; }
.modal-close {
  position: absolute; top: 14px; right: 14px; z-index: 3;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: var(--tile); color: var(--ink);
  cursor: pointer;
  transition: background .18s var(--ease-out), transform .18s var(--ease-out);
}
.modal-close svg { display: block; width: 18px; height: 18px; }
.modal-close:hover {
  background: var(--tile-hover);
  transform: scale(1.06);
}
.modal-close:active {
  transform: scale(0.94);
}

.modal-grid {
  display: grid;
  grid-template-columns: minmax(280px, 340px) 1fr;
  gap: 32px;
  align-items: stretch;
}
.modal-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.modal-shot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 290px;
  padding: 24px 20px;
  background: var(--tile);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  position: relative;
}
.modal-shot img {
  width: 100%;
  height: auto;
  max-width: 300px;
  max-height: 240px;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: transform .3s var(--ease-out);
}
.modal-shot:hover img {
  transform: scale(1.04);
}

.modal-main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}
.modal-header {
  margin-bottom: 14px;
  padding-right: 36px;
}
.modal-main h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.4vw, 1.65rem);
  font-weight: 600;
  letter-spacing: -.02em;
  line-height: 1.25;
  color: var(--ink);
}
.modal-price-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
}
.modal-price {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.modal-price.na {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.modal-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
  margin: 0 0 18px;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}
.modal-specs div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}
.modal-specs dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.modal-specs dd {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}

.modal-buy {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
  position: relative;
}
.modal-stores-primary {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.modal-stores-primary .buy {
  position: relative;
  width: 100%;
  height: 44px;
  margin-left: 0;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -.01em;
  transition: background .18s var(--ease-out), transform .18s var(--ease-out), border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
.modal-stores-primary .buy:hover {
  transform: translateY(-1px);
}
.modal-stores-primary .buy:active {
  transform: translateY(0);
}

/* Amazon: scuro pieno stile screenshot */
.modal-stores-primary .buy-amazon {
  background: #242220;
  color: #ffffff;
  border: 1px solid #242220;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}
.modal-stores-primary .buy-amazon:hover {
  background: #151413;
  border-color: #151413;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
}
.amazon-badge-img {
  height: 26px;
  width: auto;
  display: block;
  object-fit: contain;
  pointer-events: none;
}

/* Store secondari (AliExpress, Sito Ufficiale): sfondo soft rifinito come screenshot */
.modal-stores-primary .shop-link {
  background: #f0efed;
  color: var(--ink);
  border: 1px solid var(--line);
}
.modal-stores-primary .shop-link:hover {
  background: #e6e4e1;
  border-color: var(--dim-soft);
  color: var(--ink-deep);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Icona posizionata a sinistra proprio come nello screenshot */
.modal-stores-primary .shop-brand-icon {
  position: absolute;
  left: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  pointer-events: none;
}
.modal-stores-primary .maker-icon svg {
  width: 22px;
  height: 22px;
  display: block;
}
.modal-stores-primary .aliexpress-icon img,
.modal-stores-primary .maker-icon img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}
.modal-stores-primary .maker-icon {
  color: #57534e;
}

/* Link compatto "Altri negozi" centrato sotto ai pulsanti */
.modal-more-stores {
  display: flex;
  justify-content: center;
  position: relative;
  width: 100%;
  margin-top: 10px;
}
.more-stores-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 28px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all .16s var(--ease-out);
}
.more-stores-btn:hover {
  color: var(--ink);
  background: var(--tile);
  border-color: var(--line);
}
.more-stores-btn[aria-expanded="true"] {
  color: var(--ink);
  background: var(--tile-hover);
  border-color: var(--dim-soft);
}
.more-stores-btn .more-stores-chevron {
  transition: transform .2s var(--ease-out);
  color: var(--muted);
}
.more-stores-btn:hover .more-stores-chevron {
  color: var(--ink);
}
.more-stores-btn[aria-expanded="true"] .more-stores-chevron {
  transform: rotate(180deg);
  color: var(--ink);
}

/* Tendina a scomparsa centrata, in sovraimpressione sul resto del sito */
.more-stores-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 250px;
  max-width: 340px;
  width: max-content;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow:
    0 24px 48px -8px rgba(0, 0, 0, 0.22),
    0 12px 24px -6px rgba(0, 0, 0, 0.12),
    0 0 0 1px rgba(0, 0, 0, 0.06);
  padding: 6px;
  z-index: 100;
  animation: moreStoresFadeIn .18s var(--ease-out);
}
.more-stores-menu.dropup {
  top: auto;
  bottom: calc(100% + 6px);
  animation: moreStoresFadeInUp .18s var(--ease-out);
}
@keyframes moreStoresFadeIn {
  from { opacity: 0; transform: translate(-50%, -6px) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
@keyframes moreStoresFadeInUp {
  from { opacity: 0; transform: translate(-50%, 6px) scale(0.97); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}
.more-stores-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.more-store-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  border-radius: 6px;
  transition: background .12s, color .12s;
}
.more-store-item:hover {
  background: var(--tile);
  color: var(--ink-deep);
}
.more-store-item .ext-icon {
  color: var(--dim);
  flex-shrink: 0;
}
.more-store-item:hover .ext-icon {
  color: var(--muted);
}
.more-stores-empty {
  margin: 0;
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  text-align: center;
  white-space: normal;
}

/* ==== Barra del confronto ===================================================================== */
/* Niente blur: il sistema di shapefinder non lo usa. Fondo pieno e una riga di separazione. */
.compare-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; justify-content: center; gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-top: 1px solid var(--line);
  animation: bar-up .3s var(--ease-out) backwards;
}
#compare-go {
  padding: 0 22px; border-radius: var(--radius-sm);
  background: var(--ink); color: var(--on-ink);
  font-size: 14px; font-weight: 600;
  transition: background .18s;
}
#compare-go:hover { background: var(--ink-hover); }

/* ==== Confronto =============================================================================== */
.cmp-imgs { display: flex; gap: 12px; margin: 14px 0 20px; }
.cmp-imgs figure {
  flex: 1; min-width: 0; margin: 0;
  animation: fade-in .4s var(--ease-out) backwards;
  animation-delay: calc(var(--i, 0) * 70ms);
}
.cmp-imgs img {
  width: 100%; height: 148px; object-fit: contain;
  mix-blend-mode: multiply;
}
.cmp-imgs figcaption { margin-top: 8px; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

.table-wrap { overflow-x: auto; }
.specs { width: 100%; border-collapse: collapse; font-size: 13px; }
.specs tr { animation: fade-in .34s var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 28ms); }
.specs th, .specs td {
  text-align: left; padding: 10px 8px;
  border-bottom: 1px solid var(--line); vertical-align: top;
}
.specs th { color: var(--muted); font-weight: 500; white-space: nowrap; }
.overlay-title {
  margin: 30px 0 10px;
  font-size: 15px; font-weight: 600; letter-spacing: -.015em;
}
.overlay { display: block; margin-inline: auto; max-width: 100%; height: auto; animation: fade-in .4s var(--ease-out) backwards; }
/* Interruttori delle sagome: il colore è quello del controller nel confronto. */
.cmp-toggles { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.cmp-toggle {
  display: inline-flex; align-items: center; min-height: 44px;
  padding: 0 14px; font: inherit; font-size: 12.5px; color: var(--ink);
  background: var(--tile); border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
}
.cmp-toggle[aria-pressed="false"] { opacity: .45; text-decoration: line-through; }
.overlay .sil.off { display: none; }
/* Il disegno entra tracciando i contorni: pathLength="1" normalizza le tratte, così vale per
   qualsiasi misura di controller senza contare i pixel. */
.overlay [pathLength] { stroke-dasharray: 1; animation: draw .7s var(--ease-out) backwards; }
.compare .count { text-align: left; margin: 14px 0 0; }
.compare #back-results { margin-top: 22px; background: var(--tile); color: var(--ink); }

/* ==== Sezione About =========================================================================== */
@keyframes view-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes view-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(10px); }
}

.view-in {
  animation: view-in .26s var(--ease-out) backwards;
}
.view-out {
  animation: view-out .18s var(--ease-out) forwards;
  pointer-events: none;
}

.about {
  position: relative; z-index: 2;
  padding: 32px 24px 64px;
}
.about.is-entering {
  animation: view-in .3s var(--ease-out) backwards;
}
.about.is-leaving {
  animation: view-out .2s var(--ease-out) forwards;
  pointer-events: none;
}
.about-inner {
  max-width: 680px;
  margin: 0 auto;
}
.about-head {
  margin-bottom: 24px;
}
.about-title {
  margin: 0 0 20px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  line-height: 1.25;
}
.about p {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
}
.about-lead {
  font-size: 16px;
  line-height: 1.6;
}
.about h3 {
  margin: 36px 0 12px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--ink);
}
.about a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.about a:hover {
  color: var(--ink-deep);
  text-decoration-thickness: 2px;
}

/* ==== Footer =================================================================================== */
/* Footer minimale e discreto: compare in fondo alla pagina quando si scorrono i risultati,
   il confronto o la sezione about. Nascosto nella vista questionario a tutto schermo. */
.site-footer {
  display: none;
  padding: 32px 20px 48px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}
body[data-view="results"] .site-footer,
body[data-view="compare"] .site-footer,
body[data-view="about"] .site-footer {
  display: block;
}
.footer-inner {
  max-width: 680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.footer-disc {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}
.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.footer-link {
  color: var(--muted);
  font-size: 12px;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 2px;
  transition: color .15s ease, text-decoration-color .15s ease;
  padding: 0;
  cursor: pointer;
  background: none;
  border: 0;
}
.footer-link:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}
.footer-sep {
  color: var(--dim-soft);
  user-select: none;
}

/* ==== Telefono e tablet ======================================================================= */
@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr; }
  #quiz { width: calc(100% - 24px); margin: auto auto 18px; }
  .results, .compare { padding-inline: 12px; }
}
@media (max-width: 700px) {
  .stage-top { padding: 12px 14px 0; gap: 10px; }
  .top-nav { gap: 6px; }
  .nav-about { min-width: 44px; padding: 0 10px; font-size: 12px; }
  .wordmark img { height: 36px; }
  .about { padding: 18px 16px 48px; }
  .about-title { font-size: 24px; }
  .about h3 { margin-top: 28px; font-size: 16px; }
  .about p { font-size: 14px; }
  .panel, .deadend { padding: 20px 16px; }
  #quiz {
    width: 100%;
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
    padding: 20px 16px 24px;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, .06), 0 0 0 1px rgb(0 0 0 / 5%);
  }
  .quiz-head { margin-bottom: 16px; }
  .quiz-nav-left, .quiz-nav-right { flex: 0 0 62px; }
  #q-title { font-size: 17px; margin: 0; }
  .options { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); gap: 7px; }
  .option { min-height: 84px; padding: 12px 10px; }
  .option .hint { max-width: 124px; }
  .card { gap: 12px; padding: 16px; }
  .shot { flex-basis: 96px; padding: 6px; align-self: flex-start; aspect-ratio: 1; }
  .thumb { min-height: 84px; }
  .card-foot { gap: 10px; }
  .cmp-imgs { gap: 8px; }
  .cmp-imgs img { height: 104px; }
  .specs { font-size: 12px; }
  .specs th, .specs td { padding: 8px 5px; }
  /* 390 px: se l'etichetta resta su una riga la tabella esce dalla scheda. */
  .specs th { white-space: normal; }
  .modal-inner { padding: 22px 18px 24px; }
  .modal-grid { grid-template-columns: 1fr; gap: 18px; }
  .modal-shot { min-height: 200px; padding: 18px 14px; }
  .modal-shot img { max-height: 190px; max-width: 250px; }
  .modal-specs { grid-template-columns: 1fr; }
  .modal-buy .buy, .modal-stores-primary .buy { flex: 1 1 100%; }
  .site-footer { padding: 24px 16px 36px; }
  .footer-disc, .footer-link { font-size: 11.5px; }
}

/* I comportamenti d'ingresso vanno spenti, non rallentati: lo stato finale deve essere quello
   visibile, o il contenuto sparisce. */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
  .js .card { opacity: 1 !important; transform: none !important; }
}

