/**
 * Stili dei componenti di compliance del template: banner cookie, widget di
 * accessibilità, link legali del footer e pagine legali.
 * NON modificare: è caricato da compliance_head() su ogni pagina, dopo il CSS
 * del sito. Volutamente neutro, funziona con qualsiasi design.
 */

/* ================================================== utilità */

.sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ================================================== banner cookie */

.cw-banner {
  position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 99990;
  max-width: 620px; margin: 0 auto;
  background: #ffffff; color: #1c2330;
  border: 1px solid #d8dde6; border-radius: 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .22);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.cw-banner-inner { padding: 20px 22px; }

.cw-title { margin: 0 0 6px; font-size: 17px; line-height: 1.3; color: inherit; }
.cw-text { margin: 0 0 14px; font-size: 14px; color: #45506a; }
.cw-text a { color: #2563eb; text-decoration: underline; }

.cw-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cw-btn {
  font: 600 14px/1 inherit; padding: 11px 18px; border-radius: 9px;
  border: 1px solid #c6cdd9; background: #f2f4f8; color: #1c2330; cursor: pointer;
}
.cw-btn:hover { background: #e7eaf1; }
.cw-btn-primary { background: #1c2330; border-color: #1c2330; color: #fff; }
.cw-btn-primary:hover { background: #313b4e; }
.cw-btn-ghost { background: transparent; border-color: transparent; text-decoration: underline; }
.cw-btn:focus-visible, .cw-close:focus-visible {
  outline: 3px solid #2563eb; outline-offset: 2px;
}

/* pannello preferenze */
.cw-modal {
  position: fixed; inset: 0; z-index: 99991;
  display: flex; align-items: center; justify-content: center;
  background: rgba(15, 23, 42, .55); padding: 18px;
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.cw-modal[hidden], .cw-banner[hidden] { display: none; }
.cw-modal-box {
  background: #fff; color: #1c2330; border-radius: 14px; padding: 22px;
  max-width: 560px; width: 100%; max-height: 88vh; overflow: auto;
  box-shadow: 0 18px 60px rgba(15, 23, 42, .35);
}
.cw-modal-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cw-close {
  border: none; background: transparent; font-size: 17px; cursor: pointer;
  color: #45506a; padding: 6px 8px; border-radius: 8px;
}
.cw-close:hover { background: #f2f4f8; }

.cw-cat { border: 1px solid #e4e7ec; border-radius: 10px; padding: 12px 14px; margin: 10px 0; }
.cw-cat p { margin: 6px 0 0; font-size: 13px; color: #45506a; }
.cw-cat-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cw-always { font-size: 12px; font-weight: 700; color: #067647; background: #ecfdf3; padding: 4px 10px; border-radius: 99px; }

/* interruttore */
.cw-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex: none; }
.cw-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.cw-switch span[aria-hidden] {
  position: absolute; inset: 0; border-radius: 99px; background: #c6cdd9; transition: background .15s;
  pointer-events: none;
}
.cw-switch span[aria-hidden]::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
}
.cw-switch input:checked + span[aria-hidden] { background: #067647; }
.cw-switch input:checked + span[aria-hidden]::after { transform: translateX(20px); }
.cw-switch input:focus-visible + span[aria-hidden] { outline: 3px solid #2563eb; outline-offset: 2px; }

/* ================================================== widget accessibilità */

.aw-root {
  position: fixed; left: 16px; bottom: 16px; z-index: 99989;
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}
.aw-toggle {
  width: 52px; height: 52px; border-radius: 50%; border: none; cursor: pointer;
  background: #1c2330; color: #fff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 20px rgba(15, 23, 42, .35);
}
.aw-toggle:hover { background: #313b4e; }
.aw-toggle:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }

.aw-panel {
  position: absolute; left: 0; bottom: 62px;
  width: 268px; background: #fff; color: #1c2330;
  border: 1px solid #d8dde6; border-radius: 14px; padding: 14px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, .25);
}
.aw-panel[hidden] { display: none; }
.aw-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.aw-head h2 { margin: 0; font-size: 15px; }
.aw-close {
  border: none; background: transparent; cursor: pointer; color: #45506a;
  font-size: 15px; padding: 4px 7px; border-radius: 7px;
}
.aw-close:hover { background: #f2f4f8; }

.aw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.aw-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px; font: 600 12px/1.25 inherit; text-align: center;
  border: 1px solid #d8dde6; border-radius: 10px; background: #f8f9fc;
  color: #1c2330; cursor: pointer;
}
.aw-item:hover { background: #eef1f6; }
.aw-item.is-on { background: #1c2330; border-color: #1c2330; color: #fff; }
.aw-item:focus-visible { outline: 3px solid #2563eb; outline-offset: 2px; }
.aw-ico { font-size: 17px; line-height: 1; }

.aw-reset {
  width: 100%; margin-top: 10px; padding: 9px; font: 600 13px/1 inherit;
  border: 1px solid #c6cdd9; border-radius: 9px; background: #fff; cursor: pointer;
}
.aw-reset:hover { background: #f2f4f8; }
.aw-link { display: block; margin-top: 9px; font-size: 12px; color: #45506a; text-align: center; }

@media (max-width: 640px) {
  .aw-panel { width: min(268px, calc(100vw - 48px)); }
  .cw-actions .cw-btn { flex: 1 1 auto; }
}

/* --------------- effetti delle opzioni di accessibilità (classi su <html>) */

/* Testo più grande: funziona al meglio se il CSS del sito usa i rem */
html.acc-font-1 { font-size: 112.5%; }
html.acc-font-2 { font-size: 125%; }
html.acc-font-1 body { font-size: 1.05em; }
html.acc-font-2 body { font-size: 1.12em; }

/* Alto contrasto (schema classico: fondo nero, testo bianco, link gialli) */
html.acc-contrast body,
html.acc-contrast body *:not(img):not(video):not(iframe):not(svg):not(path):not(circle) {
  background-color: #000000 !important;
  background-image: none !important;
  color: #ffffff !important;
  border-color: #ffffff !important;
  box-shadow: none !important;
  text-shadow: none !important;
}
html.acc-contrast a, html.acc-contrast a * { color: #ffff00 !important; text-decoration: underline !important; }
html.acc-contrast button, html.acc-contrast .btn, html.acc-contrast input, html.acc-contrast textarea, html.acc-contrast select {
  outline: 1px solid #ffffff !important;
}
html.acc-contrast img, html.acc-contrast video { filter: contrast(1.1); }

/* Font ad alta leggibilità */
html.acc-readable body, html.acc-readable body * {
  font-family: Verdana, "Segoe UI", Arial, sans-serif !important;
  font-style: normal !important;
}

/* Evidenzia link */
html.acc-links a {
  text-decoration: underline !important;
  outline: 2px solid currentColor; outline-offset: 2px;
}

/* Interlinea e spaziatura ampie (criterio WCAG 1.4.12) */
html.acc-spacing body, html.acc-spacing body p, html.acc-spacing body li {
  line-height: 2 !important; letter-spacing: .08em !important; word-spacing: .16em !important;
}
html.acc-spacing body p { margin-bottom: 1.6em !important; }

/* Ferma animazioni e scorrimenti animati */
html.acc-noanim *, html.acc-noanim *::before, html.acc-noanim *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}

/* ================================================== link legali nel footer */

.legal-links { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.legal-links a, .legal-link-btn { color: inherit; font-size: 13px; text-decoration: underline; }
.legal-link-btn {
  background: none; border: none; padding: 0; cursor: pointer; font: inherit; font-size: 13px;
}

/* ============================== checkbox privacy dei form (GDPR) */

.privacy-field {
  display: flex !important; flex-direction: row !important;
  gap: 10px !important; align-items: flex-start !important;
  font-weight: 400 !important; font-size: 13px !important; line-height: 1.5 !important;
}
.privacy-field input[type="checkbox"] {
  width: 17px !important; height: 17px; margin: 2px 0 0; flex: none;
  accent-color: currentColor;
}
.privacy-field a { color: inherit; text-decoration: underline; }

/* ================================================== pagine legali */

.legal-page h1 { margin-bottom: 6px; }
.legal-updated { font-size: 14px; opacity: .7; margin: 0 0 22px; }
.legal-page section { margin: 26px 0; }
.legal-page section h2 { font-size: 21px; margin-bottom: 8px; }
.legal-owner-box {
  border: 1px solid rgba(127, 127, 127, .35); border-radius: 12px;
  padding: 16px 18px; margin: 20px 0; font-size: 15px;
}
.legal-owner-box strong { display: block; margin-bottom: 6px; }
.legal-owner-box span { display: block; }
