/* =====================================================================
   MAGAZZINI OTTICI — Funnel recensioni + Buono compleanno
   Token e segni-firma ereditati dal sito "Kinetico": Archivo display,
   Hanken Grotesk corpo, rosso di marca, italic + speed lines dal logo.
   Mobile-first: tutto è pensato a 390px, il desktop è l'allargamento.
   ===================================================================== */

:root {
  --paper:   oklch(0.973 0.006 72);
  --paper-2: oklch(0.950 0.009 70);
  --paper-3: oklch(0.918 0.013 66);
  --ink:     oklch(0.180 0.013 52);
  --ink-2:   oklch(0.305 0.013 50);
  --dark:    oklch(0.165 0.012 48);
  --dark-2:  oklch(0.205 0.012 48);

  --red:        oklch(0.567 0.214 27);
  --red-bright: oklch(0.640 0.222 30);
  --red-deep:   oklch(0.470 0.180 28);
  --on-red:     oklch(0.985 0.008 60);

  --green:      oklch(0.630 0.185 147);
  --green-deep: oklch(0.505 0.150 148);
  /* Verde acceso riservato alle stelle: sfondo grande, mai testo. Gli altri
     verdi restano piu' scuri perche' servono anche come colore di testo. */
  --green-star: oklch(0.700 0.200 148);
  --amber:      oklch(0.745 0.105 68);

  --muted:   oklch(0.455 0.013 52);
  --muted-2: oklch(0.575 0.012 56);
  --on-dark:       oklch(0.955 0.007 72);
  --on-dark-muted: oklch(0.730 0.012 66);

  --line:      color-mix(in oklch, var(--ink) 15%, transparent);
  --line-2:    color-mix(in oklch, var(--ink) 8%, transparent);
  --line-dark: color-mix(in oklch, var(--on-dark) 18%, transparent);

  --font-display: "Archivo", system-ui, -apple-system, sans-serif;
  --font-body: "Hanken Grotesk", system-ui, -apple-system, sans-serif;

  --gutter: clamp(1.25rem, .7rem + 2.6vw, 3.25rem);
  --narrow: 720px;

  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;

  --sh-2: 0 14px 32px -16px oklch(0.18 0.013 52 / .34);
  --sh-3: 0 34px 64px -30px oklch(0.18 0.013 52 / .5);
  --sh-red: 0 16px 34px -14px oklch(0.567 0.214 27 / .5);

  --e: cubic-bezier(0.2, 0.8, 0.2, 1);
  --e-out: cubic-bezier(0.16, 1, 0.3, 1);
  --t1: .24s; --t2: .5s;
}

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--font-body); font-size: 1.075rem; line-height: 1.6;
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
ul { list-style: none; padding: 0; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--red); color: var(--on-red); }

h1, h2, h3 { font-family: var(--font-display); font-weight: 800; line-height: .98; letter-spacing: -.025em; text-wrap: balance; }
p { text-wrap: pretty; }

.wrap { width: 100%; max-width: var(--narrow); margin-inline: auto; padding-inline: var(--gutter); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Segno-firma dal logo: parola in corsivo rosso con la sottolineatura obliqua. */
.kx { font-style: italic; color: var(--red); position: relative; white-space: nowrap; }
.kx::after {
  content: ""; position: absolute; left: -.02em; right: -.04em; bottom: .015em;
  height: .1em; background: var(--red); transform: skewX(-18deg);
}
.kx.on-dark, .kx.on-dark::after { color: var(--amber); }
.kx.on-dark::after { background: var(--amber); }

.eyebrow {
  display: inline-flex; align-items: center; gap: .7rem;
  font-size: .78rem; font-weight: 800; letter-spacing: .14em;
  text-transform: uppercase; color: var(--red);
}
.eyebrow::before { content: ""; width: 26px; height: 3px; background: var(--red); border-radius: 3px; }
.eyebrow.is-light { color: var(--amber); }
.eyebrow.is-light::before { background: var(--amber); }

/* ------------------------------------------------------------------ HERO */
.stage { position: relative; min-height: 42vh; display: grid; place-items: center; padding: clamp(3rem, 12vw, 6rem) var(--gutter); overflow: hidden; background: var(--dark); }
.stage-bg { position: absolute; inset: -6%; z-index: 0; }
.stage-bg img { width: 100%; height: 100%; object-fit: cover; filter: blur(9px) saturate(.75) brightness(.62); transform: scale(1.06); }
.stage::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, oklch(0.165 0.012 48 / .28) 0%, oklch(0.165 0.012 48 / .72) 100%);
}
.stage-card {
  position: relative; z-index: 2; background: var(--paper);
  padding: clamp(1.5rem, 6vw, 2.4rem) clamp(1.8rem, 7vw, 3rem);
  border-radius: var(--r-md); box-shadow: var(--sh-3);
  border-bottom: 5px solid var(--red);
}
.stage-card img { width: clamp(180px, 52vw, 260px); }

/* ------------------------------------------------------- BLOCCO VALUTAZIONE */
.rate { background: var(--dark); color: var(--on-dark); padding: clamp(2.6rem, 9vw, 4.5rem) 0 clamp(3rem, 10vw, 5rem); text-align: center; }
.rate .intro { color: var(--on-dark-muted); font-size: 1.02rem; max-width: 46ch; margin-inline: auto; }
.rate h1 { color: var(--on-dark); font-size: clamp(2rem, 1.2rem + 4vw, 3.2rem); font-weight: 900; margin: 1.4rem 0 .4rem; }
.rate .sub { color: var(--on-dark-muted); font-size: .95rem; margin-bottom: clamp(1.8rem, 6vw, 2.6rem); }

/* Mobile: colonna di pillole CORTE e centrate — non barre a tutta larghezza.
   Il DOM è già ordinato 5→1, quindi niente reverse: ordine visivo, ordine di
   lettura per lo screen reader e ordine di tabulazione coincidono. */
.stars { display: grid; justify-content: center; gap: .9rem; margin-bottom: 2.2rem; }

/* Desktop: torna in riga a tutta larghezza, con le positive a DESTRA.
   row-reverse perché il DOM parte dal 5: a schermo si legge 1 2 3 4 5 da
   sinistra, il 5 in fondo a destra. Qui la larghezza fissa va annullata. */
@media (min-width: 720px) {
  .stars { display: flex; flex-direction: row-reverse; gap: .5rem; justify-content: normal; }
  .star { flex: 1; width: auto; }
}

.star {
  display: flex; align-items: center; justify-content: center; gap: .4rem;
  width: 108px; min-height: 58px; padding: .9rem .5rem; border-radius: 100px;
  font-family: var(--font-display); font-weight: 800; font-size: 1.35rem;
  color: var(--on-red); background: var(--red);
  border: 2px solid transparent;
  transition: transform var(--t1) var(--e), box-shadow var(--t1) var(--e), background var(--t1) var(--e);
}
.star svg { width: 1em; height: 1em; flex: none; }
.star[data-v="5"], .star[data-v="4"] { background: var(--green-star); }
.star:hover, .star:focus-visible { transform: translateY(-4px) scale(1.03); box-shadow: 0 14px 28px -12px oklch(0 0 0 / .6); }
.star[data-v="5"]:hover, .star[data-v="4"]:hover { background: var(--green-deep); }
.star[data-v="3"]:hover, .star[data-v="2"]:hover, .star[data-v="1"]:hover { background: var(--red-deep); }
.star:active { transform: translateY(-1px) scale(.99); }
.star.is-busy { opacity: .55; pointer-events: none; }

.rate .fix { color: var(--on-dark-muted); font-size: .93rem; margin-bottom: 1rem; }
.rate .contact {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .85rem 1.6rem; border-radius: var(--r-sm);
  border: 2px solid var(--amber); color: var(--amber);
  font-weight: 800; font-size: .95rem;
  transition: background var(--t1) var(--e), color var(--t1) var(--e);
}
.rate .contact:hover { background: var(--amber); color: var(--dark); }

/* ------------------------------------------------------------ BUONO / FORM */
.gift { padding: clamp(3.2rem, 11vw, 6rem) 0; background: var(--paper-2); }
.gift-head { text-align: center; margin-bottom: clamp(2rem, 7vw, 3rem); }
.gift-head h2 { font-size: clamp(1.9rem, 1.2rem + 3.6vw, 3rem); font-weight: 900; margin: 1.1rem 0 1rem; }
.gift-head p { color: var(--muted); max-width: 52ch; margin-inline: auto; }

/* Il numero è il messaggio: 20€ deve leggersi prima del testo che lo spiega.
   flex e non inline-flex: da inline finiva in riga con l'eyebrow che lo precede. */
.gift-amount {
  display: flex; justify-content: center; align-items: baseline; gap: .1rem;
  font-family: var(--font-display); font-weight: 900; font-style: italic;
  font-size: clamp(4.2rem, 2rem + 12vw, 7rem); line-height: .85;
  color: var(--red); letter-spacing: -.05em;
}
.gift-amount span { font-size: .45em; font-style: normal; }

.card {
  background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--sh-2);
  padding: clamp(1.5rem, 6vw, 2.6rem); border: 1px solid var(--line-2);
}

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-size: .82rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: .45rem; }
.field input, .field textarea, .field select {
  width: 100%; font: inherit; font-size: 1.02rem; color: var(--ink);
  background: var(--paper-2); border: 2px solid var(--line-2); border-radius: var(--r-sm);
  padding: .95rem 1rem; transition: border-color var(--t1) var(--e), background var(--t1) var(--e);
  /* 16px minimi: sotto, iOS zooma il viewport al focus e il form salta. */
  min-height: 54px;
}
.field textarea { min-height: 130px; resize: vertical; line-height: 1.55; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--red); background: var(--paper); }
.field input::placeholder, .field textarea::placeholder { color: var(--muted-2); }
.field .hint { font-size: .84rem; color: var(--muted); margin-top: .4rem; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
@media (max-width: 620px) { .row { grid-template-columns: 1fr; gap: 0; } }

/* Trappola per bot: fuori schermo, non display:none — alcuni bot saltano
   proprio i campi nascosti col display, e la trappola resterebbe vuota. */
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.check { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1rem; cursor: pointer; }
.check input { flex: none; width: 24px; height: 24px; margin-top: 2px; accent-color: var(--red); cursor: pointer; }
.check span { font-size: .94rem; line-height: 1.5; color: var(--ink-2); }
.check a { color: var(--red); text-decoration: underline; font-weight: 700; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  width: 100%; min-height: 58px; padding: 1rem 1.6rem; border-radius: var(--r-sm);
  font-family: var(--font-body); font-size: 1rem; font-weight: 800;
  color: var(--on-red); background: var(--red); border: 2px solid var(--red);
  transition: transform var(--t1) var(--e), box-shadow var(--t1) var(--e), background var(--t1) var(--e);
}
.btn:hover { transform: translateY(-3px); box-shadow: var(--sh-red); background: var(--red-deep); }
.btn:active { transform: translateY(-1px); }
.btn[disabled] { opacity: .6; pointer-events: none; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); box-shadow: var(--sh-2); }
.btn--auto { width: auto; }
.btn--green { background: var(--green); border-color: var(--green); color: #fff; }
.btn--green:hover { background: var(--green-deep); box-shadow: 0 16px 34px -14px oklch(0.605 0.155 152 / .5); }

.note { font-size: .86rem; color: var(--muted); text-align: center; margin-top: 1rem; line-height: 1.55; }

/* Messaggi di esito: il ruolo lo dà il bordo sinistro, non solo il colore —
   così restano leggibili anche a chi non distingue rosso e verde. */
.msg { padding: 1rem 1.1rem; border-radius: var(--r-sm); font-size: .96rem; font-weight: 600; margin-bottom: 1.2rem; border-left: 4px solid; }
.msg.is-err { background: color-mix(in oklch, var(--red) 9%, var(--paper)); border-color: var(--red); color: var(--red-deep); }
.msg.is-ok  { background: color-mix(in oklch, var(--green) 11%, var(--paper)); border-color: var(--green); color: var(--green-deep); }
.msg[hidden] { display: none; }

/* --------------------------------------------------------- QUESTIONARIO */
.quiz { padding: clamp(2.4rem, 9vw, 4.5rem) 0 clamp(3rem, 10vw, 5rem); }
.quiz-head { margin-bottom: clamp(1.8rem, 6vw, 2.6rem); }
.quiz-head h1 { font-size: clamp(1.9rem, 1.2rem + 3.6vw, 2.9rem); font-weight: 900; margin: 1rem 0 .9rem; }
.quiz-head p { color: var(--muted); max-width: 54ch; }

.picks { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; margin-bottom: 1.6rem; }
@media (max-width: 560px) { .picks { grid-template-columns: 1fr; } }
.pick { position: relative; }
.pick input { position: absolute; opacity: 0; width: 0; height: 0; }
.pick span {
  display: flex; align-items: center; gap: .8rem; min-height: 58px; padding: .9rem 1.1rem;
  border: 2px solid var(--line-2); border-radius: var(--r-sm); background: var(--paper);
  font-weight: 700; font-size: .97rem; line-height: 1.3;
  transition: border-color var(--t1) var(--e), background var(--t1) var(--e), transform var(--t1) var(--e);
}
/* Quadratino disegnato in CSS: senza un segno di spunta visibile, la scelta
   multipla si legge come una lista di bottoni e il cliente ne tocca uno solo. */
.pick span::before {
  content: ""; flex: none; width: 22px; height: 22px; border-radius: 5px;
  border: 2px solid var(--line); background: var(--paper);
  transition: border-color var(--t1) var(--e), background var(--t1) var(--e);
}
.pick:hover span { border-color: var(--line); transform: translateY(-2px); }
.pick input:checked + span { border-color: var(--red); background: color-mix(in oklch, var(--red) 8%, var(--paper)); }
.pick input:checked + span::before {
  border-color: var(--red); background: var(--red);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  background-size: 15px; background-position: center; background-repeat: no-repeat;
}
.pick input:focus-visible + span { outline: 3px solid var(--red); outline-offset: 3px; }

/* ------------------------------------------------------------- GRAZIE */
.thanks { min-height: 78vh; display: grid; place-items: center; padding: clamp(3rem, 10vw, 5rem) 0; text-align: center; }
.thanks h1 { font-size: clamp(2.1rem, 1.3rem + 4vw, 3.4rem); font-weight: 900; margin: 1.2rem 0 1rem; }
.thanks p { color: var(--muted); max-width: 48ch; margin-inline: auto; }
.thanks .actions { display: grid; gap: .8rem; margin-top: 2.2rem; }
.tick { width: 74px; height: 74px; margin-inline: auto; border-radius: 50%; background: var(--green); display: grid; place-items: center; }
.tick svg { width: 38px; height: 38px; stroke: #fff; stroke-width: 3.2; fill: none; stroke-linecap: round; stroke-linejoin: round; }

/* --------------------------------------------------------------- STAFF */
.staff { padding: clamp(2rem, 8vw, 3.5rem) 0; }
.staff h1 { font-size: clamp(1.7rem, 1.2rem + 2.6vw, 2.4rem); font-weight: 900; margin-bottom: .5rem; }
.staff .lead { color: var(--muted); margin-bottom: 2rem; }
.result { margin-top: 1.6rem; }
.result-card { border-radius: var(--r-md); padding: 1.4rem; border: 2px solid var(--line-2); background: var(--paper); }
.result-card.is-ok  { border-color: var(--green); background: color-mix(in oklch, var(--green) 7%, var(--paper)); }
.result-card.is-ko  { border-color: var(--red);   background: color-mix(in oklch, var(--red) 7%, var(--paper)); }
.result-card .big { font-family: var(--font-display); font-weight: 900; font-size: 1.5rem; letter-spacing: -.02em; margin-bottom: .3rem; }
.result-card dl { display: grid; grid-template-columns: auto 1fr; gap: .45rem 1.2rem; margin-top: 1rem; font-size: .95rem; }
.result-card dt { color: var(--muted); font-weight: 700; }
.result-card dd { margin: 0; font-weight: 700; }
.codebox { font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 2px; text-transform: uppercase; }

/* -------------------------------------------------------------- FOOTER */
.foot { background: var(--dark); color: var(--on-dark-muted); padding: 2.4rem 0; text-align: center; font-size: .86rem; line-height: 1.7; }
.foot a { color: var(--on-dark); text-decoration: underline; text-underline-offset: 3px; }
.foot .marca { font-family: var(--font-display); font-weight: 800; color: var(--on-dark); font-size: 1rem; margin-bottom: .5rem; letter-spacing: -.01em; }

/* ------------------------------------------------------------- MOTION */
/* Nascondere in partenza vale solo se c'è il JS che poi rivela. La classe .js
   la mette uno script inline nell'head: senza di lui il form del buono resterebbe
   invisibile per sempre a chi ha JS disattivato o bloccato da un'estensione. */
.js [data-reveal] { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--e-out), transform .7s var(--e-out); }
.js [data-reveal].is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] { opacity: 1; transform: none; transition: none; }
  .star, .btn, .pick span { transition: none; }
  .star:hover, .btn:hover, .pick:hover span { transform: none; }
}
