@font-face {
  font-family: Archivo;
  src: url(../fonts/archivo.woff2) format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- temi: gesso (muro chiaro) e notte (showroom scuro) ---------- */
:root {
  --sfondo: #f1f1ef;
  --inchiostro: #111112;
  --parola: #e2e2de;
  --carta: #ffffff;
  --carta-ink: #111112;
  --carta-tenue: #f1f1ef;
  --esce: cubic-bezier(.16, 1, .3, 1);
  --pad: 28px;
}
:root[data-tema="notte"] {
  --sfondo: #111214;
  --inchiostro: #f1f1ef;
  --parola: #1c1d20;
  --carta: #18191c;
  --carta-ink: #f1f1ef;
  --carta-tenue: #232428;
}
:root { --tenue: color-mix(in srgb, var(--inchiostro) 58%, transparent); --filo: color-mix(in srgb, var(--inchiostro) 22%, transparent); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background: var(--sfondo);
  color: var(--inchiostro);
  font-family: Archivo, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .8s var(--esce), color .5s ease;
}
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: 3px; border-radius: 6px; }
kbd { font: inherit; font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--filo); color: var(--tenue); }
p { margin: 0; }

/* luce sull'asta nel tema notte */
:root[data-tema="notte"] .scena::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 55% at 50% 30%, rgba(255, 255, 255, .075), transparent 70%);
  transition: opacity .6s;
}
:root[data-tema="notte"] body.aperta .scena::before { opacity: 0; }

/* ---------- testata ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20; height: 68px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 0 var(--pad);
}
.logo {
  color: inherit; text-decoration: none; text-transform: uppercase;
  font-stretch: 72%; font-weight: 860; font-size: 24px; letter-spacing: -.01em;
}
.nav { display: flex; gap: 28px; font-size: 13px; font-weight: 500; color: var(--tenue); }
.borsa-btn {
  display: flex; align-items: center; gap: 10px;
  height: 42px; padding: 0 8px 0 18px; border: 0; border-radius: 999px;
  background: var(--inchiostro); color: var(--sfondo);
  font-size: 14px; font-weight: 650;
  transition: background-color .5s, color .5s, transform .3s var(--esce);
}
.borsa-btn .n {
  min-width: 26px; height: 26px; padding: 0 7px; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--sfondo); color: var(--inchiostro);
  font-size: 12px; font-variant-numeric: tabular-nums;
  transition: background-color .5s, color .5s;
}
.borsa-btn.salto { animation: salto .5s var(--esce); }
@keyframes salto { 30% { transform: scale(1.12); } }

/* ---------- scena con l'asta ---------- */
.scena { position: fixed; inset: 0; }
.asta { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; opacity: 0; transition: opacity .8s; }
body.pronto .asta { opacity: 1; }

.parola { position: absolute; left: 0; right: 0; top: 79%; height: 0; pointer-events: none; }
.parola span {
  position: absolute; left: 50%; top: 0; translate: -50% -50%;
  font-stretch: 62%; font-weight: 900; line-height: .8; letter-spacing: -.02em;
  text-transform: uppercase; white-space: nowrap;
  color: var(--parola-c, var(--parola));
  transition: color .6s ease;
  clip-path: inset(-.03em -.08em);
}
.parola i { display: block; font-style: normal; text-box: trim-both cap alphabetic; }

.barra {
  position: absolute; left: var(--pad); right: var(--pad); bottom: 46px; z-index: 5;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 20px;
  pointer-events: none; transition: opacity .4s;
}
.info { font-size: 16px; opacity: 0; translate: 0 8px; transition: opacity .35s, translate .5s var(--esce); }
.info.on { opacity: 1; translate: 0 0; }
.i-marca { font-weight: 750; }
.i-prezzo { margin-left: 10px; font-variant-numeric: tabular-nums; color: var(--tenue); }
.aiuto { font-size: 13px; color: var(--tenue); }
.aiuto-m { display: none; }
body.aperta .barra { opacity: 0; }

.nota {
  position: fixed; left: var(--pad); right: var(--pad); bottom: 16px; z-index: 5;
  font-size: 11px; color: var(--tenue); pointer-events: none; transition: opacity .4s;
}
body.aperta .nota { opacity: 0; }

.elenco-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; list-style: none; }

/* ---------- scheda del capo staccato ---------- */
.scheda {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 15;
  width: min(46vw, 620px); padding: 84px 56px 32px 16px;
  display: flex; flex-direction: column; justify-content: safe center; gap: 20px;
  overflow-y: auto; scrollbar-width: none;
  opacity: 0; pointer-events: none;
}
body.aperta .scheda { opacity: 1; pointer-events: auto; }
.scheda > * { flex-shrink: 0; opacity: 0; translate: 28px 0; transition: opacity .35s ease, translate .7s var(--esce); }
/* la scheda entra quando il colore ha già riempito la pagina: prima i testi chiari sul fondo chiaro non si leggono */
body.aperta .scheda > * { opacity: 1; translate: 0 0; transition-delay: .32s; }
body.aperta .scheda > :nth-child(3) { transition-delay: .4s; }
body.aperta .scheda > :nth-child(4) { transition-delay: .45s; }
body.aperta .scheda > :nth-child(5) { transition-delay: .49s; }
body.aperta .scheda > :nth-child(6) { transition-delay: .53s, .53s, 0s, 0s, 0s; }
body.aperta .scheda > :nth-child(7) { transition-delay: .57s; }
body.aperta .scheda > :nth-child(8) { transition-delay: .61s; }
.maniglia { display: none; }
.chiudi {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 0; border: 0; background: none; font-size: 14px; font-weight: 600;
}
.s-testa { display: grid; gap: 10px; }
.s-marca { font-size: 15px; font-weight: 700; }
.s-nome {
  margin: 0; font-stretch: 66%; font-weight: 860; text-transform: uppercase;
  font-size: clamp(40px, 4.4vw, 70px); line-height: .9; letter-spacing: -.012em; text-wrap: balance;
}
.s-prezzo { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }
.lbl { margin-bottom: 10px; font-size: 13px; color: var(--tenue); }
.lbl .s-colore { color: var(--inchiostro); font-weight: 600; }
.sw { display: flex; gap: 10px; }
.sw:empty { display: none; }
.sw button {
  width: 58px; height: 70px; padding: 0; border-radius: 12px;
  border: 2px solid transparent;
  background: color-mix(in srgb, var(--inchiostro) 9%, transparent) center / 82% auto no-repeat;
  transition: border-color .25s, transform .3s var(--esce);
}
.sw button:hover { transform: translateY(-2px); }
.sw button[aria-pressed="true"] { border-color: var(--inchiostro); }
.tg { display: flex; flex-wrap: wrap; gap: 8px; }
.tg button {
  min-width: 60px; height: 48px; padding: 0 16px; border-radius: 999px;
  border: 1.5px solid var(--filo); background: transparent; font-weight: 650;
  transition: background-color .2s, color .2s, border-color .2s;
}
.tg button:hover:not(:disabled) { border-color: var(--inchiostro); }
.tg button[aria-pressed="true"] { background: var(--inchiostro); color: var(--sfondo); border-color: var(--inchiostro); }
.tg button:disabled { opacity: .38; text-decoration: line-through; cursor: not-allowed; }
.s-stock { margin-top: 10px; font-size: 13px; color: var(--tenue); min-height: 18px; }
.aggiungi {
  display: flex; justify-content: space-between; align-items: center;
  height: 60px; padding: 0 26px; border: 0; border-radius: 999px;
  background: var(--inchiostro); color: var(--sfondo);
  font-size: 16px; font-weight: 700;
  /* stessa entrata degli altri pezzi della scheda: senza opacity e translate qui il pulsante compariva di colpo, prima del colore */
  transition: opacity .35s ease, translate .7s var(--esce), background-color .5s, color .5s, transform .3s var(--esce);
}
.aggiungi:hover { transform: translateY(-2px); }
.aggiungi:active { transform: scale(.98); }
.a-prezzo { font-variant-numeric: tabular-nums; opacity: .8; }
.s-macro { display: grid; grid-template-columns: 150px 1fr; gap: 22px; align-items: start; }
.lente {
  position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden;
  background: color-mix(in srgb, var(--inchiostro) 8%, transparent) 50% 42% / 420% auto no-repeat;
  cursor: crosshair;
}
.lente span {
  position: absolute; left: 10px; bottom: 9px; padding: 3px 8px; border-radius: 6px;
  font-size: 11px; font-weight: 600; background: var(--sfondo); color: var(--inchiostro);
}
.s-macro dl { margin: 0; display: grid; gap: 12px; font-size: 14px; }
.s-macro dt { font-size: 12px; color: var(--tenue); }
.s-macro dd { margin: 2px 0 0; }
.s-nav { display: flex; justify-content: space-between; }
.s-nav button { padding: 6px 0; border: 0; background: none; font-size: 13px; font-weight: 600; color: var(--tenue); }
.s-nav button:hover { color: var(--inchiostro); }

/* cartellino che va nella borsa */
.cartellino {
  position: fixed; z-index: 40; left: 0; top: 0; pointer-events: none;
  padding: 7px 12px 7px 22px; border-radius: 4px;
  background: #fff; color: #111; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
}
.cartellino::before {
  content: ""; position: absolute; left: 8px; top: 50%; width: 6px; height: 6px; margin-top: -3px;
  border-radius: 50%; background: var(--sfondo); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25);
}

/* ---------- borsa ---------- */
.velo { position: fixed; inset: 0; z-index: 25; background: rgba(8, 8, 10, .42); opacity: 0; transition: opacity .4s; }
.velo.on { opacity: 1; }
.borsa {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 30;
  width: min(440px, 100vw); display: flex; flex-direction: column;
  background: var(--carta); color: var(--carta-ink);
  translate: 100% 0; transition: translate .6s var(--esce);
  --inchiostro: var(--carta-ink); --tenue: color-mix(in srgb, var(--carta-ink) 58%, transparent); --filo: color-mix(in srgb, var(--carta-ink) 14%, transparent);
}
.borsa.on { translate: 0 0; }
.b-testa { display: flex; justify-content: space-between; align-items: center; padding: 22px 24px; border-bottom: 1px solid var(--filo); }
.b-testa h2 { margin: 0; font-stretch: 70%; font-weight: 860; font-size: 30px; text-transform: uppercase; }
.b-n { color: var(--tenue); font-variant-numeric: tabular-nums; }
.b-chiudi { border: 0; background: none; font-size: 14px; font-weight: 600; padding: 6px 0; }
.b-corpo { flex: 1; overflow-y: auto; padding: 8px 24px; }
.b-righe { list-style: none; margin: 0; padding: 0; }
.b-riga { display: grid; grid-template-columns: 84px 1fr auto; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--filo); }
.b-img { width: 84px; height: 104px; border-radius: 10px; background: var(--carta-tenue) center / 80% auto no-repeat; }
.b-txt { display: grid; align-content: start; gap: 3px; font-size: 14px; }
.b-txt b { font-weight: 700; }
.b-txt .tenue { font-size: 13px; }
.b-qta { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; }
.b-qta button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--filo); background: none; font-weight: 700; }
.b-qta button:disabled { opacity: .35; cursor: not-allowed; }
.b-qta output { min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; font-weight: 650; }
.b-dx { display: grid; justify-items: end; align-content: space-between; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.b-togli { border: 0; background: none; padding: 0; font-size: 12px; font-weight: 500; color: var(--tenue); text-decoration: underline; text-underline-offset: 3px; }
.b-vuota { padding: 48px 0; display: grid; gap: 6px; }
.b-vuota p:first-child { font-size: 18px; font-weight: 700; }
.borsa.piena .b-vuota { display: none; }
.tenue { color: var(--tenue); }
.b-piede { padding: 18px 24px calc(22px + env(safe-area-inset-bottom)); border-top: 1px solid var(--filo); display: grid; gap: 14px; }
.borsa:not(.piena) .b-piede { display: none; }
.b-sped-t { font-size: 13px; margin-bottom: 8px; }
.b-barra { height: 4px; border-radius: 2px; background: var(--filo); overflow: hidden; }
.b-barra i { display: block; height: 100%; width: 0; background: var(--carta-ink); transition: width .6s var(--esce); }
.b-tot { display: flex; justify-content: space-between; font-size: 16px; }
.b-tot b { font-variant-numeric: tabular-nums; }
.b-paga { height: 56px; border: 0; border-radius: 999px; background: var(--carta-ink); color: var(--carta); font-size: 16px; font-weight: 700; }
.b-fine { font-size: 13px; color: var(--tenue); }

/* ---------- senza WebGL: capi in fila, sempre cliccabili ---------- */
.ripiego { display: none; }
body.no-gl .asta { display: none; }
body.no-gl .ripiego {
  position: absolute; left: 0; right: 0; top: 18%; bottom: 14%;
  display: flex; gap: 2vw; padding: 0 6vw; overflow-x: auto; align-items: flex-start;
  border-top: 5px solid var(--inchiostro);
}
body.no-gl .ripiego button { flex: 0 0 auto; height: 88%; border: 0; background: none; padding: 18px 0 0; }
body.no-gl .ripiego img { height: 100%; width: auto; }

/* ---------- telefono ---------- */
@media (max-width: 759px) {
  :root { --pad: 18px; }
  .top { height: 60px; }
  .logo { font-size: 21px; }
  .nav { display: none; }
  .parola { top: 71%; }
  .barra { bottom: 52px; flex-direction: column; align-items: flex-start; gap: 4px; }
  .info { font-size: 15px; }
  .aiuto-d { display: none; }
  .aiuto-m { display: inline; }
  .nota { bottom: 14px; font-size: 10px; }
  .scheda {
    top: auto; left: 0; width: auto; height: 54dvh; padding: 8px 20px calc(24px + env(safe-area-inset-bottom));
    justify-content: flex-start; gap: 18px; overflow-y: auto; overscroll-behavior: contain;
    background: var(--sfondo); border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 40px rgba(0, 0, 0, .12);
    opacity: 1; translate: 0 102%; transition: translate .6s var(--esce);
    /* niente transizione sul fondo: su Chrome mobile resta ferma sul colore vecchio mentre la scheda sale */
  }
  body.aperta .scheda { translate: 0 0; }
  .scheda > * { translate: 0 14px; }
  .maniglia { display: block; flex: 0 0 auto; align-self: center; width: 44px; height: 5px; border-radius: 3px; background: var(--filo); margin-bottom: -6px; }
  .chiudi kbd { display: none; }
  .scheda { gap: 14px; }
  .chiudi { position: absolute; top: 16px; right: 16px; font-size: 13px; }
  .s-nome { font-size: 32px; }
  .s-prezzo { font-size: 20px; }
  .sw button { width: 50px; height: 58px; }
  .s-macro { grid-template-columns: 112px 1fr; gap: 16px; }
  .s-macro dl { font-size: 13px; }
  .aggiungi { position: sticky; bottom: 0; flex: 0 0 auto; box-shadow: 0 0 0 10px var(--sfondo); transition: opacity .35s ease, translate .7s var(--esce), background-color .8s, color .8s, box-shadow .8s; }
  .borsa { width: 100vw; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; transition-delay: 0s !important; }
}
