/* DoctorSuite — accessibilità di Prenota e dell'App (WCAG 2.1 AA, EN 301 549): pannello e preferenze del paziente.
 * Classi su <html>: a11y-testo-1..3, a11y-contrasto, a11y-font, a11y-spaziatura, a11y-link, a11y-no-animazioni, a11y-cursore. */

/* Dimensione del testo: scala il rem della pagina (anche le utility Tailwind in rem) */
html.a11y-testo-1 { --ds-font-scale: 1.15; }
html.a11y-testo-2 { --ds-font-scale: 1.3; }
html.a11y-testo-3 { --ds-font-scale: 1.5; }

/* Alto contrasto: inchiostri più scuri, bordi netti, niente grigi chiari sul testo */
html.a11y-contrasto:not(.dark) {
  --ds-bg: #FFFFFF; --ds-surface-2: #F1F5F9; --ds-line: #1E293B; --ds-line-soft: #334155;
  --ds-ink: #000000; --ds-ink-2: #000000; --ds-muted: #1E293B; --ds-muted-2: #1E293B; --ds-placeholder: #334155; --ds-field-border: #000000;
  --ds-cyan-text: #0B4A75; --ds-mid: #0B3D91; --ds-focus: #B00020;
  --ds-grad-action: linear-gradient(135deg, #0B3D91, #10145C); --ds-grad-brand: linear-gradient(135deg, #0B4A75, #10145C);
  --info-t: #0B4A75; --ok-t: #0F4D25; --warn-t: #6B3400; --err-t: #8A1A12;
}
html.a11y-contrasto body[data-portale] { --ds-bg: #FFFFFF; }
html.a11y-contrasto .ds-card, html.a11y-contrasto .pr-card, html.a11y-contrasto .pr-scelta__box, html.a11y-contrasto .pr-tessera { border: 2px solid var(--ds-line) !important; box-shadow: none !important; }
html.a11y-contrasto a:not(.ds-btn):not(.pr-tessera):not(.pr-card) { text-decoration: underline; }
html.a11y-contrasto :focus-visible { outline: 4px solid var(--ds-focus) !important; outline-offset: 2px; }
html.a11y-contrasto .ds-banner--ambiente { background: #000; color: #FFD54F; }

/* Font ad alta leggibilità: solo font di sistema (nessun download) */
html.a11y-font body, html.a11y-font button, html.a11y-font input, html.a11y-font select, html.a11y-font textarea {
  font-family: Verdana, Tahoma, "Segoe UI", "Trebuchet MS", Arial, sans-serif !important; letter-spacing: 0 !important;
}

/* Spaziatura del testo (WCAG 1.4.12) */
html.a11y-spaziatura body * { line-height: 1.6 !important; letter-spacing: .12em !important; word-spacing: .16em !important; }
html.a11y-spaziatura body p { margin-bottom: 1em; }

/* Link sottolineati */
html.a11y-link a:not(.ds-btn) { text-decoration: underline !important; text-underline-offset: 3px; text-decoration-thickness: 2px; }

/* Animazioni ridotte (anche se il sistema non lo chiede) */
html.a11y-no-animazioni *, html.a11y-no-animazioni *::before, html.a11y-no-animazioni *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html.a11y-no-animazioni { view-transition-name: none; }

/* Cursore grande */
html.a11y-cursore, html.a11y-cursore * { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l15 11-6.5 1 4 7.5-3 1.5-4-7.5L4 20z' fill='%23000' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E") 4 2, auto !important; }
html.a11y-cursore a, html.a11y-cursore button, html.a11y-cursore label, html.a11y-cursore summary, html.a11y-cursore [role="button"] { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 24 24'%3E%3Cpath d='M9 2.5a1.5 1.5 0 013 0V10l1-.2a1.5 1.5 0 013 .2l1 .2a1.5 1.5 0 012.5 1.3V16a6 6 0 01-6 6h-1.5a6 6 0 01-5-2.7L4 15a1.5 1.5 0 012.3-2l2.7 2.5z' fill='%23000' stroke='%23fff' stroke-width='1.3'/%3E%3C/svg%3E") 12 2, pointer !important; }

/* Bersagli touch di almeno 44px nell'App */
body[data-portale="app"] .ds-tondo { width: 44px; height: 44px; }

/* Pulsante nell'header di Prenota */
.ds-a11y-btn { width: 44px; height: 44px; flex-shrink: 0; border-radius: 9999px; border: 1px solid var(--ds-line); background: var(--ds-surface); color: var(--ds-dark);
  display: inline-flex; align-items: center; justify-content: center; font-size: 20px; cursor: pointer; }
.ds-a11y-btn:hover { border-color: var(--ds-cyan); color: var(--ds-cyan-text); }
html.dark .ds-a11y-btn { color: var(--ds-cyan-text); }

/* Pannello */
.ds-a11y { position: fixed; inset: 0; z-index: var(--ds-z-modal); background: var(--ds-overlay); display: flex; justify-content: flex-end; }
.ds-a11y__box { width: min(400px, 100%); height: 100%; overflow-y: auto; background: var(--ds-surface); color: var(--ds-ink); padding: 20px 20px 28px; box-shadow: var(--ds-shadow-modal);
  animation: ds-a11y-in var(--ds-dur) var(--ds-ease); }
@keyframes ds-a11y-in { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.ds-a11y__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ds-a11y__head h2 { margin: 0; font-size: 1.25rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.ds-a11y__head h2 i { color: var(--ds-cyan-text); }
.ds-a11y__chiudi { width: 44px; height: 44px; border-radius: 9999px; border: 1px solid var(--ds-line); background: var(--ds-surface); color: var(--ds-ink); cursor: pointer; font-size: 18px; }
.ds-a11y__intro { color: var(--ds-muted); font-size: .9rem; margin: 6px 0 16px; }
.ds-a11y__gruppo { border: 0; margin: 0 0 14px; padding: 0; }
.ds-a11y__gruppo legend { font-weight: 800; margin-bottom: 8px; }
.ds-a11y__scala { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.ds-a11y__liv { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; border-radius: var(--ds-r-md);
  border: 2px solid var(--ds-line); background: var(--ds-surface); cursor: pointer; font-weight: 800; color: var(--ds-ink); text-align: center; }
.ds-a11y__liv input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ds-a11y__liv--0 > span:first-of-type { font-size: 15px; } .ds-a11y__liv--1 > span:first-of-type { font-size: 19px; }
.ds-a11y__liv--2 > span:first-of-type { font-size: 23px; } .ds-a11y__liv--3 > span:first-of-type { font-size: 27px; }
.ds-a11y__liv-l { font-size: 11px; font-weight: 700; color: var(--ds-muted); line-height: 1.1; }
.ds-a11y__liv:has(input:checked) { border-color: var(--ds-dark); background: var(--brd-b); box-shadow: inset 0 0 0 1px var(--ds-dark); }
.ds-a11y__liv:has(input:checked)::after { content: '\2713'; position: absolute; top: 3px; right: 6px; font-size: 12px; color: var(--ds-dark); }
.ds-a11y__liv:has(input:focus-visible) { outline: 3px solid var(--ds-focus); outline-offset: 2px; }
.ds-a11y__lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ds-a11y__opz { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 12px; border-radius: var(--ds-r-md); border: 1px solid var(--ds-line); cursor: pointer; }
.ds-a11y__opz > i { width: 36px; height: 36px; border-radius: 10px; background: var(--info-b); color: var(--info-t); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ds-a11y__opz > span { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ds-a11y__opz small { color: var(--ds-muted); font-size: .78rem; }
.ds-a11y__opz .ds-switch { width: 48px; height: 28px; flex-shrink: 0; }
.ds-a11y__opz .ds-switch::after { width: 22px; height: 22px; }
.ds-a11y__opz .ds-switch:checked::after { transform: translateX(20px); }
.ds-a11y__opz:has(input:checked) { border-color: var(--ds-cyan-text); background: var(--info-b); }
.ds-a11y__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.ds-a11y__foot .ds-btn { height: 44px; }
.ds-a11y__link { font-weight: 700; text-decoration: underline; }
@media (prefers-reduced-motion: reduce) { .ds-a11y__box { animation: none; } }
.ds-skip { min-height: 44px; display: inline-flex; align-items: center; }
