/* Palette monocromatica; l'arancione del biglietto solo per accenti, logo e filigrana */
:root {
  --ink: #0d0d0d;
  --accent: #ec6530;
  --accent-button: #c94f1c; /* arancio del biglietto scurito quanto basta: testo bianco leggibile (4,5:1) */
  --accent-button-hover: #b4451a;
  --muted: #555;
  --line: #e2e2e2;
  --surface: #f4f4f4;
  --gutter: 1.25rem;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  /* molla calcolata: duration 0.6s, bounce 0.3 (assestamento ~980ms) */
  --spring: linear(0, 0.029, 0.104, 0.205, 0.32, 0.438, 0.551, 0.655, 0.747, 0.825, 0.889, 0.939, 0.978, 1.006, 1.026, 1.038, 1.044, 1.046, 1.045, 1.041, 1.037, 1.032, 1.026, 1.021, 1.016, 1.012, 1.008, 1.005, 1.003, 1.001, 1, 0.999, 0.998, 0.998, 0.998, 0.998, 0.998, 0.998, 0.999, 0.999, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  margin: 0;
  background: #fff;
  color: var(--ink);
  font: 200 1.0625rem/1.6 "Raleway", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

strong { font-weight: 400; }
h1, h2, h3, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
img, svg { display: block; }

.sprite { position: absolute; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

/* Layout: mobile first, una colonna */
.page {
  max-width: 30rem;
  margin-inline: auto;
  padding:
    max(2.5rem, env(safe-area-inset-top))
    max(var(--gutter), env(safe-area-inset-right))
    calc(12rem + env(safe-area-inset-bottom)) /* spazio per il banner in basso */
    max(var(--gutter), env(safe-area-inset-left));
}

/* Filigrana: colonna vertebrale del biglietto, tenue sullo sfondo */
.watermark {
  position: fixed;
  top: 50%;
  right: -1.5rem;
  width: auto;
  height: min(94svh, 48rem);
  translate: 0 -50%;
  opacity: 0.14;
  pointer-events: none;
  z-index: -1;
}

/* Hero: foto profilo + logo completo */
.hero { text-align: center; }

.avatar {
  display: block;
  width: 6.5rem;
  margin-inline: auto;
}
.avatar img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 12%;
  outline: 1px solid oklch(0 0 0 / 0.1);
  outline-offset: -1px;
}

.logo {
  max-width: 24rem;
  margin: 1.75rem auto 0;
}
.logo svg {
  width: 100%;
  height: auto;
  overflow: visible;
  fill: var(--ink);
}
.logo__shadow { fill: var(--accent); fill-opacity: 0.2; }

.intro {
  max-width: 26rem;
  margin: 1.75rem auto 0;
  color: var(--muted);
  text-wrap: pretty;
}
.intro strong { color: var(--ink); }

/* Sezioni: barra arancione + titolo, come nome/qualifica sul fronte del biglietto */
.section { margin-top: 3rem; }

.section__head {
  position: relative;
  padding-left: 1.125rem;
}
.section__head::before {
  content: "";
  position: absolute;
  inset: 0.15em auto 0.15em 0;
  width: 0.3125rem;
  border-radius: 1rem;
  background: var(--accent);
}
.section__head h2 {
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.2;
  text-transform: uppercase;
  text-wrap: balance;
}
.section__head p {
  margin-top: 0.25rem;
  font-size: 0.9375rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* Pulsanti */
.buttons {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.625rem;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 3.5rem;
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 400 1rem/1.3 "Raleway", system-ui, sans-serif;
  text-align: center;
  text-decoration: none;
  overflow-wrap: anywhere;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  transition:
    transform 160ms var(--ease-out),
    border-color 150ms ease,
    background-color 150ms ease;
}
.btn:active { transform: scale(0.97); }
.btn > svg {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
}

.btn--primary {
  border-color: var(--accent-button);
  background: var(--accent-button);
  color: #fff;
}

.btn--small {
  gap: 0.5rem;
  padding-inline: 0.75rem;
  white-space: nowrap;
  min-height: 3rem;
  font-size: 0.9375rem;
}
.btn--small > svg { width: 1.25rem; height: 1.25rem; }

/* Trattamenti: card a scorrimento orizzontale su mobile */
.cards {
  display: flex;
  gap: 0.75rem;
  margin: 1.5rem calc(-1 * var(--gutter)) 0;
  padding: 0.25rem var(--gutter) 0.5rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--gutter);
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.cards::-webkit-scrollbar { display: none; }

.card {
  flex: 0 0 min(78%, 18rem);
  scroll-snap-align: start;
  padding: 1.5rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: transparent;
}
.card__icon {
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: 1rem;
  color: var(--accent);
}
.card h3 {
  font-weight: 400;
  font-size: 1.125rem;
}
.card p {
  margin-top: 0.5rem;
  text-wrap: pretty;
}

/* Dove ricevo */
.places {
  margin-top: 1.5rem;
  display: grid;
  gap: 0.75rem;
}

.place {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: transparent;
  color: inherit;
  text-decoration: none;
  touch-action: manipulation;
  transition:
    transform 160ms var(--ease-out),
    border-color 150ms ease;
}
.place:active { transform: scale(0.98); }

.place__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--surface);
}
.place__icon svg { width: 1.375rem; height: 1.375rem; }

.place__title {
  display: block;
  font-size: 1.0625rem;
}
.place__sub {
  display: block;
  font-size: 0.9375rem;
  color: var(--muted);
}
.place__action {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  font-weight: 400;
  border-bottom: 1px solid var(--accent);
}

/* Footer */
.footer { margin-top: 3rem; }

.actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.625rem;
}

.status {
  min-height: 1.6em;
  margin-top: 0.5rem;
  font-size: 0.9375rem;
  text-align: center;
}

.legal {
  margin-top: 1.5rem;
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
}

/* Banner promo: nasce dal pulsante tondo in basso a destra e, chiuso, ci torna dentro */
.promo {
  position: fixed;
  left: max(0.75rem, env(safe-area-inset-left));
  right: max(0.75rem, env(safe-area-inset-right));
  bottom: calc(0.75rem + env(safe-area-inset-bottom));
  z-index: 10;
  max-width: 28rem;
  margin-inline: auto;
  padding: 1.25rem;
  border-radius: 1.75rem;
  background: #fff;
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 0.06),
    0 18px 40px -12px rgb(0 0 0 / 0.3);
  /* il punto verso cui si chiude coincide con il centro del pulsante tondo */
  --fab-origin: calc(100% - 2rem) calc(100% - 2rem);
  transform: translateY(calc(100% + 1.5rem)) scale(0.96);
  transform-origin: var(--fab-origin);
  opacity: 0;
  visibility: hidden;
  transition:
    transform 250ms var(--ease-out),
    opacity 200ms ease-out,
    visibility 0s 250ms;
}
.promo[data-state="open"] {
  transform: none;
  opacity: 1;
  visibility: visible;
  transition:
    transform 980ms var(--spring),
    opacity 300ms ease-out,
    visibility 0s;
}

.promo[data-state="collapsed"] {
  transform: scale(0.08);
  opacity: 0;
  visibility: hidden;
  transition:
    transform 420ms var(--ease-in-out),
    opacity 200ms ease-out 220ms,
    visibility 0s 420ms;
}

/* Pulsante tondo con il regalo: compare quando il banner ci arriva dentro */
.promo-fab {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: calc(1rem + env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border: 0;
  border-radius: 50%;
  background: var(--accent-button);
  color: #fff;
  box-shadow:
    0 10px 24px -6px rgb(201 79 28 / 0.55),
    0 2px 6px rgb(0 0 0 / 0.12);
  cursor: pointer;
  touch-action: manipulation;
  transform: scale(0.5);
  opacity: 0;
  visibility: hidden;
  transition:
    transform 150ms var(--ease-out),
    opacity 150ms ease-out,
    visibility 0s 150ms;
}
.promo-fab.is-visible {
  transform: none;
  opacity: 1;
  visibility: visible;
  transition:
    transform 980ms var(--spring) 300ms,
    opacity 200ms ease-out 300ms,
    visibility 0s; /* subito focusabile: il fuoco ci arriva appena chiudi il banner */
}
.promo-fab.is-visible:active {
  transform: scale(0.94);
  transition: transform 160ms var(--ease-out);
}
.promo-fab svg { width: 1.625rem; height: 1.625rem; }

.promo__title {
  padding-right: 2.5rem;
  font-weight: 400;
  font-size: 1.125rem;
  line-height: 1.3;
}
.promo__text {
  margin-top: 0.25rem;
  font-size: 0.9375rem;
  color: var(--muted);
}
.promo .btn {
  position: relative;
  overflow: hidden;
  margin-top: 1rem;
}
/* riflesso di luce che attraversa il pulsante */
.promo .btn::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 45%;
  background: linear-gradient(100deg, rgb(255 255 255 / 0), rgb(255 255 255 / 0.4), rgb(255 255 255 / 0));
  transform: translateX(-120%) skewX(-20deg);
  pointer-events: none;
}

.promo__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 150ms ease, transform 160ms var(--ease-out);
}
.promo__close:active { transform: scale(0.94); background: var(--surface); }
.promo__close svg { width: 1.25rem; height: 1.25rem; }

@media (hover: hover) and (pointer: fine) {
  .btn:hover, .place:hover { border-color: var(--ink); }
  .btn--primary:hover { border-color: var(--accent-button-hover); background: var(--accent-button-hover); }
  .promo__close:hover { background: var(--surface); color: var(--ink); }
  .promo-fab:hover { background: var(--accent-button-hover); }
}

/* Desktop: due colonne, come fronte e retro affiancati */
@media (min-width: 60rem) {
  .page {
    max-width: 68rem;
    display: grid;
    grid-template-columns: minmax(0, 26rem) minmax(0, 30rem);
    justify-content: center;
    align-items: start;
    gap: 6rem;
    padding-block: 5rem;
  }
  .hero {
    position: sticky;
    top: 5rem;
  }
  .avatar { width: 8rem; }
  /* filigrana più grande e più centrale: passa dietro la parte destra della colonna dei testi */
  .watermark {
    right: auto;
    /* a metà tra "dietro la colonna" (50% + 21rem) e "sul bordo" (100% + 3rem - larghezza);
       larghezza = 125vh × 128.7/631.3 ≈ 25.48vh */
    left: calc(75% + 12rem - 12.74vh);
    height: 125vh;
  }
  .content > .section:first-child { margin-top: 0; }

  .cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin-inline: 0;
    padding: 0;
    overflow: visible;
  }
  /* numero dispari di card: l'ultima occupa tutta la riga */
  .card:last-child:nth-child(odd) { grid-column: 1 / -1; }

  .promo {
    left: auto;
    right: 2rem;
    bottom: 2rem;
    width: 22rem;
    --fab-origin: calc(100% - 1.75rem) calc(100% - 1.75rem);
  }
  .promo-fab {
    right: 2rem;
    bottom: 2rem;
  }
}

/* ---------- Movimento ----------
   Ingresso della hero (una volta per visita): foto, firma che si scrive,
   qualifica, testo, contatti a onda. Il banner promo arriva dopo, da script.js. */
@media (prefers-reduced-motion: no-preference) {
  .avatar { animation: pop 700ms var(--ease-out) both; }
  .watermark { animation: draw-down 1.4s var(--ease-in-out) 100ms both; }
  .logo__sig { animation: write 1.1s var(--ease-in-out) 200ms both; }
  .logo__tag { animation: fade-up 700ms var(--ease-out) 750ms both; --y: 14px; }
  .intro { animation: fade-up 700ms var(--ease-out) 850ms both; }

  .section--contacts .section__head { animation: fade-up 600ms var(--ease-out) 950ms both; }
  .section--contacts li { animation: fade-up 600ms var(--ease-out) both; }
  .section--contacts li:nth-child(1) { animation-delay: 1000ms; }
  .section--contacts li:nth-child(2) { animation-delay: 1060ms; }
  .section--contacts li:nth-child(3) { animation-delay: 1105ms; }
  .section--contacts li:nth-child(4) { animation-delay: 1140ms; }

  /* Sezioni più in basso: compaiono mentre scorri (solo mobile, dove sono sotto la piega) */
  @supports (animation-timeline: view()) {
    @media (max-width: 59.99rem) {
      .reveal {
        animation: fade-up linear both;
        animation-timeline: view();
        animation-range: entry 5% entry 45%;
        --y: 24px;
      }
    }
  }
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.94); }
}
@keyframes fade-up {
  from { opacity: 0; transform: translateY(var(--y, 10px)); }
}
@keyframes write {
  from { clip-path: inset(-20% 100% -20% 0); }
  to { clip-path: inset(-20% 0 -20% 0); }
}
@keyframes draw-down {
  from { clip-path: inset(0 0 100% 0); }
  to { clip-path: inset(0 0 0 0); }
}

/* Richiamo sul pulsante del banner: un riflesso di luce e l'icona che "squilla",
   insieme, appena il banner si assesta e poi ogni 6s. Si ferma se ci passi sopra. */
@media (prefers-reduced-motion: no-preference) {
  .promo[data-state="open"] .btn::after { animation: shine 6s var(--ease-in-out) 600ms infinite; }
  .promo[data-state="open"] .btn > svg { animation: ring 6s var(--ease-out) 650ms infinite; }
  .promo-fab.is-visible svg { animation: ring 6s var(--ease-out) 1.2s infinite; }
  .promo .btn:hover::after, .promo .btn:hover > svg,
  .promo .btn:focus-visible::after, .promo .btn:focus-visible > svg { animation-play-state: paused; }
}

@keyframes shine {
  0% { transform: translateX(-120%) skewX(-20deg); }
  14%, 100% { transform: translateX(340%) skewX(-20deg); }
}
@keyframes ring {
  0%, 13%, 100% { transform: rotate(0); }
  2% { transform: rotate(-14deg) scale(1.1); }
  5% { transform: rotate(12deg) scale(1.1); }
  8% { transform: rotate(-8deg) scale(1.05); }
  11% { transform: rotate(4deg); }
}

/* Movimento ridotto: il banner compare in dissolvenza, senza salire */
@media (prefers-reduced-motion: reduce) {
  .promo, .promo[data-state], .promo-fab, .promo-fab.is-visible { transform: none; }
}
