/* ============================================================
   InfoComuni · Modalità Totem reale 50″
   ----------------------------------------------------------------
   CSS attivato quando body ha class "is-totem" (impostata da
   kiosk-totem.js quando si rileva fullscreen + flag localStorage).
   Ottimizzazioni:
   - Cursor hidden (no mouse)
   - User-select disabled
   - Tap target ≥ 88px (WCAG 2.5.5)
   - Font scale up per visibilità a 1.5-3m
   - Niente scroll esterno
   ============================================================ */

/* TOTEM mode: nasconde il cursore (no mouse, solo touch) */
body.is-totem,
body.is-totem * {
  cursor: none !important;
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* TOTEM: blocca scroll body (la pagina si adatta a 100vh esatti) */
body.is-totem {
  overflow: hidden !important;
  position: fixed !important;
  inset: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* TOTEM: tap-target enforcement — tutti i bottoni e link cliccabili
   devono avere area di tocco ≥ 88px (WCAG AAA 2.5.5 large target) */
body.is-totem .kiosk-action,
body.is-totem .hot,
body.is-totem button,
body.is-totem [role="button"] {
  min-height: 88px !important;
  min-width: 88px !important;
}

/* TOTEM: font scaling per visibilità a distanza touchscreen 50″ */
body.is-totem .kiosk-hero h1 {
  font-size: clamp(3rem, 6vmin, 6rem) !important;
}
body.is-totem .kiosk-hero__lede {
  font-size: clamp(1.2rem, 2vmin, 2rem) !important;
}
body.is-totem .kiosk-action__label strong {
  font-size: clamp(1.6rem, 2.8vmin, 2.4rem) !important;
}
body.is-totem .kiosk-action__label small {
  font-size: clamp(1rem, 1.7vmin, 1.4rem) !important;
}

/* TOTEM: hot zones più grandi */
body.is-totem .hot__halo { r: 56 !important; }
body.is-totem .hot__dot  { r: 38 !important; }
body.is-totem .hot__sigla { font-size: 32px !important; }
body.is-totem .hot__tt-label { font-size: 16px !important; }

/* TOTEM: idle attractor sempre prominente */
body.is-totem .kiosk-attractor {
  background: linear-gradient(135deg, rgba(11,35,64,0.96), rgba(10,20,36,0.98)) !important;
}
body.is-totem .kiosk-attractor h2 {
  font-size: clamp(3rem, 6vmin, 6rem) !important;
}

/* TOTEM verticale (portrait) — viewport 1080×1920 */
@media (orientation: portrait) and (min-aspect-ratio: 9/17) {
  body.is-totem .kiosk-actions {
    grid-template-columns: 1fr !important;
    max-width: 32rem !important;
    margin: 0 auto !important;
  }
}

/* TOTEM orizzontale (landscape) — viewport 1920×1080 */
@media (orientation: landscape) and (min-aspect-ratio: 17/10) {
  body.is-totem .kiosk-home-page {
    padding: clamp(2rem, 3vmin, 4rem) !important;
  }
}

/* TOTEM: indicatore visivo che siamo in modalità reale (top-right corner)
   visibile solo nei primi 3s, poi sparisce. */
body.is-totem::after {
  content: "🟢 TOTEM MODE";
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 100000;
  background: rgba(21, 128, 61, 0.95);
  color: #fff;
  padding: 6px 14px;
  border-radius: 999px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  font-weight: 600;
  pointer-events: none;
  animation: totemFadeOut 4s ease-out 1s forwards;
  opacity: 0;
}
@keyframes totemFadeOut {
  0% { opacity: 0; transform: translateY(-10px); }
  10% { opacity: 1; transform: translateY(0); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-10px); }
}

/* TOTEM: previene flash del cursor al mousemove iniziale */
body.is-totem .kiosk-attractor__inner { cursor: none !important; }

/* Fix: l'attributo HTML [hidden] dev'essere rispettato sull'attractor
   (CSS display:flex lo sovrascriveva) */
.kiosk-attractor[hidden] { display: none !important; }

/* === Sprint 7 v4 (02/05/2026): toolbar Esci raggruppata in BASSO-DX,
   fuori dall'header kiosk per evitare sovrapposizione con i controlli
   esistenti (lingua, accessibilità). Pillola con mini-logo InfoComuni. === */

/* MINI-LOGO InfoComuni · branding nella toolbar bottom-dx */
.kiosk-mini-logo {
  position: fixed;
  bottom: 16px;
  right: 124px; /* 16px (X) + 44px (X) + 10gap + 44px (FS) + 10gap = 124 */
  z-index: 100001;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  background: rgba(11, 35, 64, 0.85);
  border: 1.5px solid rgba(184, 134, 11, 0.6);
  border-radius: 999px;
  text-decoration: none;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: background-color .2s, border-color .2s, transform .12s;
}
.kiosk-mini-logo:hover,
.kiosk-mini-logo:focus-visible {
  background: rgba(11, 35, 64, 0.95);
  border-color: #b8860b;
  transform: scale(1.04);
  outline: none;
}
.kiosk-mini-logo__mark {
  width: 32px; height: 32px;
  background: #FFCC33; color: #0E2F4A;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; line-height: 1;
  font-style: italic;
  flex-shrink: 0;
}
.kiosk-mini-logo__text {
  display: flex; flex-direction: column; line-height: 1.1;
}
.kiosk-mini-logo__brand {
  font-size: 13px; font-weight: 800; color: #fff; letter-spacing: 0.01em;
}
.kiosk-mini-logo__sub {
  font-size: 9px; font-weight: 700; color: #FFCC33;
  letter-spacing: 0.12em; text-transform: uppercase;
}
@media (max-width: 720px) {
  .kiosk-mini-logo { padding: 4px; }
  .kiosk-mini-logo__text { display: none; }
}
@media (min-width: 1920px) {
  .kiosk-mini-logo {
    right: 156px; padding: 8px 18px 8px 8px; gap: 12px;
  }
  .kiosk-mini-logo__mark { width: 40px; height: 40px; font-size: 22px; }
  .kiosk-mini-logo__brand { font-size: 15px; }
  .kiosk-mini-logo__sub { font-size: 10px; }
}

.kiosk-fullscreen-btn {
  position: fixed;
  bottom: 16px;
  right: 70px;
  z-index: 100001;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(11, 35, 64, 0.85);
  border: 1.5px solid rgba(184, 134, 11, 0.7);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  padding: 0;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transition: background-color .2s ease, transform .12s ease, border-color .2s ease;
}
.kiosk-fullscreen-btn:hover,
.kiosk-fullscreen-btn:focus-visible {
  background: #b8860b;
  border-color: #b8860b;
  transform: scale(1.08);
  outline: none;
}
.kiosk-fullscreen-btn svg { width: 18px; height: 18px; }
.kiosk-fullscreen-btn .kiosk-exit__text {
  position: absolute;
  bottom: 100%;
  margin-bottom: 8px;
  right: 0;
  white-space: nowrap;
  background: rgba(11, 35, 64, 0.95);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(184, 134, 11, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.kiosk-fullscreen-btn:hover .kiosk-exit__text,
.kiosk-fullscreen-btn:focus-visible .kiosk-exit__text {
  opacity: 1;
}
@media (min-width: 1920px) {
  .kiosk-fullscreen-btn { width: 56px; height: 56px; right: 84px; }
  .kiosk-fullscreen-btn svg { width: 22px; height: 22px; }
}

/* === TOTEM EXIT: X bottom-right per tornare al desktop === */
.kiosk-exit {
  position: fixed;
  bottom: 16px; right: 16px;
  z-index: 100001;
  width: 56px; height: 56px;
  background: rgba(11, 35, 64, 0.85);
  border: 2px solid rgba(255, 204, 51, 0.55);
  border-radius: 999px;
  display: inline-flex;
  align-items: center; justify-content: center;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  transition: background .2s ease, border-color .2s ease, transform .12s ease;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  line-height: 1;
}
.kiosk-exit:hover,
.kiosk-exit:focus-visible {
  background: rgba(220, 38, 38, 0.9);
  border-color: #ffcc33;
  transform: scale(1.05);
  outline: none;
}
.kiosk-exit:active { transform: scale(0.95); }
.kiosk-exit__lbl {
  position: absolute;
  right: calc(100% + 10px);
  white-space: nowrap;
  background: rgba(11, 35, 64, 0.92);
  color: #ffcc33;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 204, 51, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.kiosk-exit:hover .kiosk-exit__lbl,
.kiosk-exit:focus-visible .kiosk-exit__lbl {
  opacity: 1;
}

/* === Sprint 7 v3 (02/05/2026) — variante COMPATTA:
   Il vecchio bottone "Esci · Versione desktop" era troppo invadente:
   copriva il pannello provincia laterale del kiosk (V1 Atlante e simili).
   Ora: solo X compatta 40×40, senza testo, ma con tooltip + label
   visibile solo su hover (per utenti vedenti) e aria-label per screen reader. */
.kiosk-exit--labeled {
  width: 44px !important;
  height: 44px !important;
  border-radius: 50%;
  padding: 0 !important;
  gap: 0;
  background: rgba(11, 35, 64, 0.85);
  color: #fff;
  border: 1.5px solid rgba(184, 134, 11, 0.7);
  min-height: 44px;
  min-width: 44px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif !important;
}
.kiosk-exit--labeled:hover,
.kiosk-exit--labeled:focus-visible {
  background: #b8860b;
  color: #fff;
  border-color: #b8860b;
  transform: scale(1.08);
  outline: none;
}
.kiosk-exit--labeled .kiosk-exit__svg {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: transform .15s ease;
}
/* Testo nascosto in versione compatta — appare come tooltip SOPRA il bottone */
.kiosk-exit--labeled .kiosk-exit__text {
  position: absolute;
  bottom: 100%;
  margin-bottom: 8px;
  right: 0;
  white-space: nowrap;
  background: rgba(11, 35, 64, 0.95);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(184, 134, 11, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}
.kiosk-exit--labeled:hover .kiosk-exit__text,
.kiosk-exit--labeled:focus-visible .kiosk-exit__text {
  opacity: 1;
}
/* Su schermi totem grandi (≥1920px) — un po' più visibile ma sempre compatto */
@media (min-width: 1920px) {
  .kiosk-exit--labeled {
    width: 56px !important;
    height: 56px !important;
    min-height: 56px;
    min-width: 56px;
  }
  .kiosk-exit--labeled .kiosk-exit__svg { width: 22px; height: 22px; }
  .kiosk-exit--labeled .kiosk-exit__text { font-size: 14px; padding: 8px 16px; }
}
/* Su schermi piccoli mantieni dimensione comoda al tap */
@media (max-width: 480px) {
  .kiosk-exit--labeled {
    width: 44px !important;
    height: 44px !important;
  }
}

/* Vecchio long-press X (totem fullscreen): manteniamo come secondario */
.is-totem .totem-exit {
  position: fixed; top: 8px; left: 8px; z-index: 100001;
  width: 56px; height: 56px;
  background: rgba(0,0,0,0.4);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 12px;
  display: none;
  cursor: pointer !important;
  align-items: center; justify-content: center;
  color: #fff; font-size: 22px;
  transition: opacity .2s ease;
  opacity: 0.3;
}
.is-totem .totem-exit:hover,
.is-totem .totem-exit:active {
  opacity: 1;
  background: rgba(220,38,38,0.7);
  border-color: rgba(255,100,100,0.4);
}
.is-totem.totem-show-exit .totem-exit {
  display: flex;
}
