/**
 * KSM Cookie Consent — stili del banner e del centro preferenze.
 *
 * Token sovrascrivibili per sito (brand): ridefinire le variabili --ksm-cc-*
 * nel proprio foglio di stile DOPO questo file. Tema chiaro/scuro automatico.
 *
 * Accessibilità: contrasto AA/AAA sui token di default, focus visibile,
 * dimensioni dei bersagli touch >= 44px, testo ridimensionabile (unità rem).
 */

:root {
  --ksm-cc-bg: #ffffff;
  --ksm-cc-ink: #1a1c2e;
  --ksm-cc-ink-2: #4c4f68;
  --ksm-cc-line: #d9dbe8;
  --ksm-cc-accent: #2328c4;      /* blu KSM: sostituibile col colore del sito */
  --ksm-cc-accent-ink: #ffffff;
  --ksm-cc-overlay: rgba(20, 22, 46, 0.55);
}
@media (prefers-color-scheme: dark) {
  :root {
    --ksm-cc-bg: #191b2c;
    --ksm-cc-ink: #ecedf7;
    --ksm-cc-ink-2: #a8abc6;
    --ksm-cc-line: #33364e;
    --ksm-cc-accent: #8b90ff;
    --ksm-cc-accent-ink: #12131f;
    --ksm-cc-overlay: rgba(0, 0, 0, 0.6);
  }
}

/* ---------------- Banner (non modale, in fondo alla pagina) ------------- */

.ksm-cc-banner {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 9999;
  background: var(--ksm-cc-bg);
  color: var(--ksm-cc-ink);
  border-top: 1px solid var(--ksm-cc-line);
  box-shadow: 0 -6px 24px rgba(10, 12, 40, 0.12);
  padding: 1rem clamp(1rem, 4vw, 2.5rem) 1.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
}
.ksm-cc-banner h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}
.ksm-cc-banner p {
  margin: 0 0 0.9rem;
  color: var(--ksm-cc-ink-2);
  max-width: 75ch;
}
.ksm-cc-banner a {
  color: var(--ksm-cc-accent);
  text-decoration: underline;
}

/* ---------------- Pulsanti ---------------------------------------------- */

.ksm-cc-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.ksm-cc-btn {
  font: inherit;
  min-height: 44px;
  padding: 0.55rem 1.2rem;
  border-radius: 10px;
  border: 1.5px solid var(--ksm-cc-accent);
  background: var(--ksm-cc-accent);
  color: var(--ksm-cc-accent-ink);
  cursor: pointer;
}
/* "Preferenze"/"Chiudi": variante a contorno, comunque ben visibile. */
.ksm-cc-btn.ksm-cc-ghost {
  background: transparent;
  color: var(--ksm-cc-accent);
}
.ksm-cc-btn:focus-visible,
.ksm-cc-banner a:focus-visible,
.ksm-cc-modal input:focus-visible {
  outline: 3px solid var(--ksm-cc-accent);
  outline-offset: 2px;
}

/* ---------------- Centro preferenze (modale) ---------------------------- */

.ksm-cc-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: var(--ksm-cc-overlay);
  display: grid;
  place-items: center;
  padding: 1rem;
}
.ksm-cc-modal {
  background: var(--ksm-cc-bg);
  color: var(--ksm-cc-ink);
  border-radius: 14px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 1.5rem clamp(1rem, 3vw, 2rem);
  font-size: 0.95rem;
  line-height: 1.5;
}
.ksm-cc-modal h2 {
  margin: 0 0 0.5rem;
  font-size: 1.2rem;
}
.ksm-cc-controller {
  color: var(--ksm-cc-ink-2);
  font-size: 0.82rem;
  margin: 0 0 1.2rem;
}
.ksm-cc-cat {
  border-top: 1px solid var(--ksm-cc-line);
  padding: 0.9rem 0;
}
.ksm-cc-cat p {
  margin: 0.3rem 0 0.6rem;
  color: var(--ksm-cc-ink-2);
}
.ksm-cc-cat-head label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}
.ksm-cc-cat-head input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--ksm-cc-accent);
}

/* Registro cookie: tabella scorrevole nel proprio contenitore. */
.ksm-cc-scroll { overflow-x: auto; }
.ksm-cc-modal table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.82rem;
}
.ksm-cc-modal th,
.ksm-cc-modal td {
  text-align: left;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--ksm-cc-line);
  vertical-align: top;
}
.ksm-cc-modal th {
  color: var(--ksm-cc-ink-2);
  font-weight: 600;
}

/* ---------------- Modalità "solo testo" (versione non vedenti, F-19) ----- */
/* Niente ombre, niente overlay scuro, layout lineare: il dialog resta,      */
/* ma ridotto all'essenziale per la lettura sequenziale via screen reader.   */

.ksm-cc-textonly,
.ksm-cc-textonly .ksm-cc-modal {
  box-shadow: none;
  border-radius: 0;
}
.ksm-cc-overlay.ksm-cc-textonly {
  background: var(--ksm-cc-bg);
  place-items: start center;
}
.ksm-cc-textonly .ksm-cc-btn {
  border-radius: 4px;
}

@media (prefers-reduced-motion: no-preference) {
  .ksm-cc-banner { animation: ksm-cc-in 0.25s ease-out; }
  @keyframes ksm-cc-in {
    from { transform: translateY(30%); opacity: 0; }
    to   { transform: none; opacity: 1; }
  }
}

/* ---------------- Annuncio prima del ricaricamento (v2, 27/10/2026) ------- */
/* Alla revoca la pagina si ricarica: l'avviso è per chi usa un lettore di    */
/* schermo (role="status"), quindi resta fuori dallo schermo ma non nascosto. */

.ksm-cc-annuncio {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
