/* ── COOKIE CONSENT BANNER (Sessione 49, fix layout mobile Sessione 51) ── */
.cookie-banner {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 999;
  background: var(--ink);
  color: var(--white);
  padding: 1.1rem 5%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  box-shadow: 0 -4px 24px rgba(0,0,0,.18);
  transform: translateY(100%);
  transition: transform .35s var(--ease);
}
.cookie-banner.visible { transform: translateY(0); }

.cookie-banner-text {
  font-size: .82rem;
  line-height: 1.55;
  color: var(--warm);
  max-width: 640px;
  flex: 1 1 320px;
}
.cookie-banner-text a { color: var(--orange); text-decoration: underline; }

/* Testo lungo (desktop/tablet) vs versione breve (mobile) — stessa <p>, due <span>
   alternati via display, mai entrambi visibili. Nessuna modifica alla logica JS: sono
   solo testo statico, il bottone Accetta/Rifiuta e i suoi ID restano identici. */
.cookie-text-short { display: none; }

.cookie-banner-actions {
  display: flex;
  align-items: center;
  gap: .7rem;
  flex-wrap: wrap;
}

.cookie-btn {
  font-family: 'Inter', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  padding: .6em 1.35em;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: background .17s, transform .12s, box-shadow .17s;
  white-space: nowrap;
}
.cookie-btn-accept {
  background: var(--orange);
  color: var(--white);
  box-shadow: 0 2px 10px rgba(232,97,42,.3);
}
.cookie-btn-accept:hover { background: var(--orange-deep); transform: translateY(-1px); }

.cookie-btn-reject {
  background: transparent;
  color: var(--warm);
  border: 1px solid rgba(250,250,247,.3);
}
.cookie-btn-reject:hover { border-color: var(--warm); }

@media (max-width: 640px) {
  .cookie-banner { flex-direction: column; align-items: stretch; text-align: center; }
  /* BUG Sessione 51: "flex: 1 1 320px" ereditato dalla regola base sopra applica il
     flex-basis di 320px all'asse VERTICALE in flex-direction:column, riservando ~320px
     di altezza al testo a prescindere dal contenuto reale (~100px) — causa dell'80%+
     di altezza in eccesso del banner su mobile. Qui l'asse principale e' verticale,
     quindi il testo deve dimensionarsi sul contenuto (flex-basis: auto). */
  .cookie-banner-text { flex: 0 1 auto; }
  .cookie-banner-actions { justify-content: center; }
}

/* Layout compatto mobile (verificato a 375px e 390px, iPhone SE/12/13) — riduce padding,
   mostra un testo piu' corto con link diretto alla Cookie Policy invece del paragrafo
   esteso, e garantisce bottoni con target touch >=44px. max-height + overflow-y sono una
   rete di sicurezza in piu' (oltre al fix del flex-basis sopra), cosi' il banner non puo'
   comunque superare una porzione ragionevole dello schermo anche se il testo dovesse
   allungarsi in futuro. */
@media (max-width: 480px) {
  .cookie-banner {
    padding: .75rem 1rem;
    gap: .65rem;
    max-height: 30vh;
    overflow-y: auto;
  }
  .cookie-text-full { display: none; }
  .cookie-text-short { display: inline; }
  .cookie-banner-text {
    font-size: .78rem;
    line-height: 1.4;
  }
  .cookie-banner-actions { gap: .6rem; }
  .cookie-btn {
    flex: 1 1 auto;
    min-height: 44px;
    padding: .5em 1em;
    font-size: .8rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cookie-banner { transition: none; }
}
