/* Presentazioni Hoken Tech: stile comune. Colori e caratteri del marchio (CLAUDE-comune.md, "Stile grafiche Hoken Tech"). */
:root {
  --cob: #0e3aa8;
  --cob-scuro: #0a2a7c;
  --giallo: #f2cb07;
  --carta: #fff8dc;
  --fondo: #f6f3e8;
  --ink: #14213d;
  --soft: #4c5878;
  --cielo: #dce6ff;
  --menta: #e3f6e9;
  --corallo: #ffe7df;
  --titolo: "Archivo Black", "Arial Black", system-ui, sans-serif;
  --testo: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --gutter: max(20px, env(safe-area-inset-left, 0px));
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}
body {
  font: 500 clamp(15px, 0.9vw + 0.35vh, 21px) / 1.5 var(--testo);
  color: var(--ink);
  background: radial-gradient(
    120% 90% at 75% 40%,
    #fffdf4 0%,
    var(--fondo) 55%,
    #ebe6d2 100%
  );
  transition:
    background-color 0.8s,
    color 0.6s;
}
body[data-tono="scuro"] {
  color: #eef2ff;
  background: radial-gradient(
    120% 90% at 75% 40%,
    #1747c4 0%,
    var(--cob) 50%,
    #081f63 100%
  );
}
/* il cambio di tono avviene con una dissolvenza: due sfondi sovrapposti */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(
    120% 90% at 75% 40%,
    #1747c4 0%,
    var(--cob) 50%,
    #081f63 100%
  );
  opacity: 0;
  transition: opacity 0.8s ease;
  z-index: -2;
}
body[data-tono="scuro"]::before {
  opacity: 1;
}
body[data-tono="scuro"] {
  background: radial-gradient(
    120% 90% at 75% 40%,
    #fffdf4 0%,
    var(--fondo) 55%,
    #ebe6d2 100%
  );
}

/* puntini a griglia di 26px, sfumati */
.puntini {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(
    rgba(14, 58, 168, 0.14) 1.4px,
    transparent 1.8px
  );
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(
    ellipse 60% 70% at 15% 30%,
    #000,
    transparent 75%
  );
  mask-image: radial-gradient(
    ellipse 60% 70% at 15% 30%,
    #000,
    transparent 75%
  );
  transition: opacity 0.6s;
}
body[data-tono="scuro"] .puntini {
  background-image: radial-gradient(
    rgba(242, 203, 7, 0.2) 1.4px,
    transparent 1.8px
  );
}

canvas.scena {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}
.senza-3d canvas.scena {
  display: none;
}

/* barra in alto */
.testata {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(16px, env(safe-area-inset-top, 0px))
    max(var(--gutter), env(safe-area-inset-right, 0px)) 0 var(--gutter);
}
.marchio {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.marchio .scheda {
  background: var(--carta);
  border: 3px solid var(--cob);
  border-radius: 14px;
  padding: 4px 10px;
  box-shadow: 4px 4px 0 var(--cob);
  transform: rotate(-3deg);
}
body[data-tono="scuro"] .marchio .scheda {
  box-shadow: 4px 4px 0 var(--giallo);
}
.marchio img {
  display: block;
  height: clamp(30px, 3.4vw, 44px);
  width: auto;
}
.azioni {
  display: flex;
  gap: 10px;
  align-items: center;
}
.bottone {
  font: 700 clamp(13px, 0.8vw + 0.3vh, 16px) var(--testo);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  padding: 9px 16px;
  border: 2px solid var(--cob);
  background: var(--carta);
  color: var(--cob);
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  box-shadow: 3px 3px 0 var(--cob);
}
.bottone:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--cob);
}
.bottone.pieno {
  background: var(--giallo);
}
body[data-tono="scuro"] .bottone {
  border-color: var(--giallo);
  box-shadow: 3px 3px 0 var(--giallo);
}
.bottone:focus-visible,
.nav button:focus-visible {
  outline: 3px solid var(--giallo);
  outline-offset: 3px;
}
.bottone svg {
  width: 18px;
  height: 18px;
}

/* slide */
.slide {
  position: fixed;
  inset: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 46%) 1fr;
  align-items: center;
  padding: clamp(84px, 11vh, 120px) var(--gutter) clamp(84px, 12vh, 120px)
    clamp(20px, 6vw, 110px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    visibility 0s linear 0.5s;
}
.slide.attiva {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.5s ease 0.15s,
    visibility 0s;
}
.pannello {
  display: flex;
  flex-direction: column;
  gap: clamp(12px, 2vh, 24px);
  min-width: 0;
  max-width: 46rem;
}

.etichetta {
  align-self: flex-start;
  font-weight: 700;
  font-size: 0.82em;
  padding: 4px 14px;
  border-radius: 999px;
  background: var(--cielo);
  color: var(--cob);
}
.etichetta.menta {
  background: var(--menta);
}
.etichetta.corallo {
  background: var(--corallo);
}
.etichetta.giallo {
  background: var(--giallo);
}
h1,
h2 {
  font-family: var(--titolo);
  font-weight: 400;
  margin: 0;
  text-wrap: balance;
  line-height: 1.06;
  letter-spacing: -0.01em;
}
h1 {
  font-size: clamp(34px, 4.4vw + 1vh, 88px);
  color: var(--cob);
}
h2 {
  font-size: clamp(28px, 3vw + 1vh, 62px);
  color: var(--cob);
}
body[data-tono="scuro"] h1,
body[data-tono="scuro"] h2 {
  color: var(--giallo);
}
h3 {
  font: 700 1.12em/1.25 var(--testo);
  margin: 0;
  color: var(--cob);
}
p {
  margin: 0;
}
.lead {
  font-size: 1.2em;
  color: var(--soft);
  max-width: 38em;
}
body[data-tono="scuro"] .lead {
  color: #d6def8;
}
.nota {
  font-size: 0.82em;
  color: var(--soft);
}
body[data-tono="scuro"] .nota {
  color: #b9c6ef;
}

.schede {
  display: grid;
  gap: clamp(10px, 1.6vh, 18px);
}
.schede.due {
  grid-template-columns: 1fr 1fr;
}
.scheda-t {
  background: color-mix(in srgb, var(--carta) 92%, transparent);
  border: 3px solid var(--cob);
  border-radius: 18px;
  padding: clamp(12px, 1.6vh, 18px) clamp(14px, 1.2vw, 20px);
  box-shadow: 5px 5px 0 var(--cob);
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ink);
  min-width: 0;
}
body[data-tono="scuro"] .scheda-t {
  box-shadow: 5px 5px 0 var(--giallo);
}
.scheda-t p {
  font-size: 0.95em;
}
.scheda-t .grande {
  font: 400 1.9em/1 var(--titolo);
  color: var(--cob);
}
.scheda-t .quando {
  font-size: 0.8em;
  font-weight: 700;
  color: var(--soft);
}
ul.punti {
  margin: 0;
  padding-left: 1.2em;
  display: grid;
  gap: 6px;
}

/* entrata del testo: una volta sola, a ogni cambio di slide */
.slide.attiva .r {
  animation: sale 0.75s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(0.18s + var(--i, 0) * 0.09s);
}
body[data-verso="indietro"] .slide.attiva .r {
  animation-name: scende;
}
@keyframes sale {
  from {
    opacity: 0;
    transform: translateY(26px);
  }
}
@keyframes scende {
  from {
    opacity: 0;
    transform: translateY(-26px);
  }
}

/* navigazione in basso */
.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 max(var(--gutter), env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px)) var(--gutter);
}
.nav .tasti {
  display: flex;
  gap: 10px;
}
.nav button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--cob);
  background: var(--carta);
  color: var(--cob);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--cob);
}
body[data-tono="scuro"] .nav button {
  border-color: var(--giallo);
  box-shadow: 3px 3px 0 var(--giallo);
}
.nav button:disabled {
  opacity: 0.35;
  cursor: default;
}
.nav button svg {
  width: 20px;
  height: 20px;
}
.contatore {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-size: 0.9em;
}
.suggerimento {
  font-size: 0.8em;
  color: var(--soft);
}
body[data-tono="scuro"] .suggerimento {
  color: #b9c6ef;
}
.avanzamento {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  z-index: 6;
  background: rgba(14, 58, 168, 0.12);
}
.avanzamento span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--giallo);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* telefono e schermi stretti: la forma 3D in alto, il testo in basso */
@media (max-width: 820px), (max-aspect-ratio: 1/1) {
  .slide {
    grid-template-columns: 1fr;
    align-items: end;
    padding: 80px var(--gutter) 96px;
  }
  .pannello {
    background: color-mix(in srgb, var(--fondo) 88%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-radius: 20px;
    padding: 16px;
    max-height: 62vh;
    overflow: auto;
  }
  body[data-tono="scuro"] .pannello {
    background: color-mix(in srgb, #0a2a7c 85%, transparent);
  }
  .schede.due {
    grid-template-columns: 1fr;
  }
  .suggerimento,
  .bottone .lungo {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .slide,
  .slide.attiva {
    transition: none;
  }
  .slide.attiva .r {
    animation: none;
  }
  .avanzamento span {
    transition: none;
  }
}

/* etichette agganciate al 3D */
.etichette3d { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.senza-3d .etichette3d { display: none; }
.etichetta3d {
  position: absolute;
  left: 0;
  top: 0;
  translate: -50% calc(-100% - 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1px;
  max-width: 15em;
  padding: 6px 12px 7px;
  border-radius: 12px;
  background: var(--carta);
  border: 2px solid var(--cob);
  box-shadow: 3px 3px 0 var(--cob);
  color: var(--ink);
  font-size: clamp(11px, 0.62vw + 0.3vh, 15px);
  line-height: 1.25;
  white-space: nowrap;
  opacity: 0;
  scale: 0.85;
  transition: opacity 0.35s ease, scale 0.35s ease;
  transition-delay: calc(var(--k, 0) * 0.08s);
}
.etichetta3d.visibile { opacity: 1; scale: 1; }
.etichetta3d b { font-weight: 700; color: var(--cob); }
.etichetta3d span { color: var(--soft); font-size: 0.88em; }
.etichetta3d::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: 16px;
  margin-left: -1px;
  background: var(--cob);
}
.etichetta3d.giallo { background: var(--giallo); }
.etichetta3d.grande b { font-family: var(--titolo); font-weight: 400; font-size: 1.35em; }
body[data-tono="scuro"] .etichetta3d { box-shadow: 3px 3px 0 var(--giallo); }
body[data-tono="scuro"] .etichetta3d::after { background: var(--giallo); }
@media (max-width: 820px), (max-aspect-ratio: 1/1) {
  .etichetta3d { font-size: 10px; padding: 3px 7px 4px; }
  .etichetta3d span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .etichetta3d { transition: none; }
}

/* mockup del telefono (slide con una pagina vera da mostrare) */
.illustrazione { display: grid; place-items: center; min-width: 0; }
.telefono {
  width: clamp(220px, 19vw, 330px);
  aspect-ratio: 9 / 18.5;
  background: var(--ink);
  border-radius: 38px;
  padding: 12px;
  box-shadow: 10px 10px 0 var(--giallo), 0 30px 60px rgba(10, 26, 74, 0.35);
  rotate: 4deg;
}
.telefono .schermo {
  height: 100%;
  border-radius: 28px;
  background: #fffdf5;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: clamp(10px, 0.72vw, 13px);
  color: var(--ink);
}
.schermo .barra-sito { background: var(--cob); color: #fff; padding: 22px 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.schermo .barra-sito b { font: 400 1.35em/1.1 var(--titolo); color: var(--giallo); }
.schermo .barra-sito small { opacity: 0.85; }
.schermo .prodotto { margin: 12px 12px 4px; height: 24%; border-radius: 16px; background: radial-gradient(circle at 35% 35%, #ffe07a, var(--giallo) 45%, #e39b06 100%); display: grid; place-items: center; }
.schermo .prodotto svg { width: 46%; height: auto; }
.schermo dl { margin: 6px 12px; display: grid; gap: 6px; }
.schermo dl div { display: grid; grid-template-columns: 38% 1fr; gap: 6px; padding-bottom: 6px; border-bottom: 1px solid #e7e1c9; }
.schermo dt { color: var(--soft); }
.schermo dd { margin: 0; font-weight: 700; }
.schermo .grafico { margin: 4px 12px; display: flex; align-items: flex-end; gap: 4px; height: 12%; }
.schermo .grafico i { flex: 1; background: var(--menta); border-radius: 4px 4px 0 0; border: 1px solid #8fcfa8; }
.schermo .verifica { margin: auto 12px 14px; padding: 8px 10px; border-radius: 12px; background: var(--menta); color: #14532d; font-weight: 700; display: flex; gap: 6px; align-items: center; }
@media (max-width: 820px), (max-aspect-ratio: 1/1) {
  .illustrazione { display: none; }
}
