/* =========================================================================
   TTIO — Campagna «Natale offline 2026»  ·  OVERLAY/MODAL · ISOLATO · RIMOVIBILE
   -------------------------------------------------------------------------
   Il blocco è un overlay sopra la normale /home (che resta invariata sotto).
   Deve sembrare una piccola pagina TTIO sovrapposta, collegata alla scansione
   del cartoncino: niente card-in-card, niente fasce azzurre, niente look da
   survey. La città NON è mai mostrata (solo analytics/storage, vedi JS).
   z-index 150: sopra l'header (100), sotto il cookie-banner (200) così il
   consenso resta sempre raggiungibile.
   RIMOZIONE: elimina da home.html il <div id="ttio-christmas">, questo <link>
   e lo <script> christmas-2026.js.
   ========================================================================= */

#ttio-christmas[hidden] { display: none !important; }

/* Blocca lo scroll della pagina dietro mentre l'overlay è aperto. */
.xmas-lock { overflow: hidden !important; }

/* --- Overlay: la pagina sotto resta visibile tutt'intorno --------------- */
.xmas-overlay {
  position: fixed;
  inset: 0;
  z-index: 150;
  display: flex;
  align-items: center;              /* card centrata, ma compatta (height:auto) */
  justify-content: center;
  /* gutter sempre visibili (sfondo/Home attorno al modal) + safe-area iPhone */
  padding:
    calc(env(safe-area-inset-top, 0px) + clamp(1rem, 4.5vh, 2.5rem))
    calc(env(safe-area-inset-right, 0px) + 16px)
    calc(env(safe-area-inset-bottom, 0px) + clamp(1rem, 4.5vh, 2.5rem))
    calc(env(safe-area-inset-left, 0px) + 16px);
}
/* Backdrop leggero: la Home sotto resta riconoscibile (dim + lieve sfocatura). */
.xmas-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 30, 70, .26);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  animation: xmas-fade-in .2s ease both;
}
@media (prefers-reduced-motion: reduce) { .xmas-backdrop { animation: none; } }

/* --- Modale: piccola card appoggiata sopra la Home (non full-screen) ---- */
.xmas-modal {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: min(100%, 420px);          /* ≈ calc(100% - 32px), max 420px */
  max-height: 80vh;
  max-height: 80dvh;                /* altezza reale su mobile */
  background: var(--bg);
  border-radius: 26px;
  box-shadow: 0 22px 55px -18px rgba(16, 24, 80, .42);
  display: flex;
  flex-direction: column;
  overflow: hidden;                 /* lo scroll è interno (inner); la X resta ferma */
  animation: xmas-rise .24s var(--ease, ease) both;
}
@media (prefers-reduced-motion: reduce) { .xmas-modal { animation: none; } }
@keyframes xmas-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes xmas-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Area scrollabile: contenuto allineato in alto, niente vuoto centrale. */
.xmas-modal-inner {
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  padding: 3rem clamp(1.3rem, 5vw, 1.75rem) clamp(1.6rem, 4vw, 2rem);
}

/* --- X di chiusura: ferma in alto a destra del modal (non scrolla via) -- */
.xmas-close {
  position: absolute;
  top: .55rem;
  right: .55rem;
  z-index: 2;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--navy);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.xmas-close:hover { background: #e7ecff; }
.xmas-close:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* --- Desktop: stessa card compatta, un filo più ampia ------------------- */
@media (min-width: 721px) {
  .xmas-modal {
    width: min(100%, 460px);
    max-height: min(82vh, 640px);
    box-shadow: 0 30px 80px -24px rgba(16, 24, 80, .5);
  }
  .xmas-modal-inner { padding: 3.1rem clamp(1.9rem, 4vw, 2.6rem) 2.3rem; }
  .xmas-close { top: .7rem; right: .7rem; }
}

/* --- Contenuto (editoriale, nessuna card interna) ----------------------- */
.xmas-step { animation: xmas-step-in .3s ease both; }
@media (prefers-reduced-motion: reduce) { .xmas-step { animation: none; } }
@keyframes xmas-step-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

.xmas-eyebrow {
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .74rem;
  font-weight: 700;
  color: var(--blue);
  margin: 0 0 .8rem;
}
.xmas-title {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--navy);
  font-size: clamp(1.5rem, 1rem + 2.1vw, 2.2rem);
  line-height: 1.16;
  letter-spacing: -.01em;
  margin: 0 auto .55rem;
  max-width: 20ch;
  text-wrap: balance;
}
.xmas-title:focus { outline: none; }
.xmas-text {
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.55;
  margin: 0 auto 1.3rem;
  max-width: 32rem;
}
.xmas-ask {
  font-family: var(--font-display);
  font-weight: 500;
  color: var(--navy);
  font-size: clamp(1.08rem, 2.4vw, 1.25rem);
  margin: 1.6rem auto .85rem;
}

.xmas-actions { display: flex; flex-wrap: wrap; gap: .7rem; justify-content: center; margin-top: .2rem; }
.xmas-options { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: .2rem; }

/* Modulo feedback / follow-up */
.xmas-form { text-align: left; }
.xmas-form .xmas-title { text-align: center; }
.xmas-textarea, .xmas-input {
  width: 100%;
  box-sizing: border-box;
  border: var(--border-soft);
  border-radius: var(--radius);
  padding: .85rem .95rem;
  font: inherit;
  color: var(--ink);
  background: var(--bg-card);
}
.xmas-textarea { resize: vertical; min-height: 5rem; }
.xmas-textarea:focus, .xmas-input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.xmas-count { margin: .35rem 0 0; text-align: right; font-size: .8rem; color: var(--ink-soft); opacity: .7; }

.xmas-label { display: block; font-weight: 700; color: var(--navy); margin: .8rem 0 .3rem; font-size: .95rem; }
.xmas-opt { font-weight: 400; color: var(--ink-soft); opacity: .8; }
.xmas-check { display: flex; gap: .6rem; align-items: flex-start; font-size: .88rem; color: var(--ink-soft); line-height: 1.45; cursor: pointer; margin-top: .9rem; }
.xmas-check input { margin-top: .2rem; flex: 0 0 auto; width: 18px; height: 18px; accent-color: var(--blue); }
.xmas-check a { color: var(--blue); text-decoration: underline; }
.xmas-formerror { color: #b3261e; font-size: .88rem; margin: .6rem 0 0; text-align: center; }
.xmas-form .xmas-actions { margin-top: 1.1rem; }

/* Strade secondarie (terziarie): calcolatore generale + Spazi. Link testuali
   discreti, separati da una linea sottile — NON bottoni, non devono competere
   con le scelte principali del modal. */
.xmas-tertiary {
  margin-top: 1.3rem;
  padding-top: .95rem;
  border-top: 1px solid var(--line);
}
.xmas-tertiary-item { margin: 0 0 .7rem; font-size: .85rem; line-height: 1.4; }
.xmas-tertiary-item:last-child { margin-bottom: 0; }
.xmas-tertiary-q { display: block; color: var(--ink-soft); margin-bottom: .15rem; }
.xmas-tertiary-link { color: var(--blue); font-weight: 700; text-decoration: none; white-space: nowrap; }
.xmas-tertiary-link:hover { text-decoration: underline; }

/* Honeypot: fuori schermo, mai visibile né focalizzabile. */
.xmas-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
