/* ===== Accessibility settings (see js/a11y-init.js, js/a11y.js) ===== */

/* --- Panel --- */
.a11y-trigger {
    color: var(--sm-text);
    min-height: 44px;
    border: 1px solid var(--sm-border);
    background-color: var(--sm-surface);
}

.a11y-trigger:hover,
.a11y-trigger:focus-visible,
.a11y-trigger[aria-expanded="true"] {
    color: var(--sm-text);
    background-color: var(--sm-surface-2);
    border-color: var(--sm-muted);
}

.a11y-panel {
    position: fixed;
    top: 4.5rem;
    inset-inline-end: 16px;
    width: min(24rem, calc(100vw - 32px));
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    z-index: 1050;
}

.a11y-panel[hidden] {
    display: none;
}

.a11y-target {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.a11y-plain-btn {
    color: var(--bs-body-color);
    border: 1px solid var(--bs-body-color);
    background: transparent;
}

.a11y-plain-btn:hover,
.a11y-plain-btn:focus-visible {
    color: var(--bs-body-bg);
    background-color: var(--bs-body-color);
}

.btn-check:checked + .btn-outline-primary,
.btn-check:focus-visible + .btn-outline-primary {
    color: var(--sm-on-accent);
    background-color: var(--sm-accent);
    border-color: var(--sm-accent);
}

.a11y-switch .form-check-input:checked {
    background-color: var(--sm-accent);
    border-color: var(--sm-accent);
}

.a11y-fs-sample-1 { font-size: 0.8rem; }
.a11y-fs-sample-2 { font-size: 0.9rem; }
.a11y-fs-sample-3 { font-size: 1rem; }
.a11y-fs-sample-4 { font-size: 1.2rem; }
.a11y-fs-sample-5 { font-size: 1.4rem; }

.a11y-switch {
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    margin-bottom: 0;
}

.a11y-switch .form-check-input {
    width: 2.5em;
    height: 1.4em;
    margin-top: 0.05em;
    cursor: pointer;
}

.a11y-switch .form-check-label {
    padding-inline-start: 0.5rem;
    cursor: pointer;
}

.a11y-switch .form-text {
    padding-inline-start: 0.5rem;
}

/* --- Text size: scales the rem base used by the whole site --- */
html.a11y-font-size-1 { --a11y-scale: 0.875; }
html.a11y-font-size-2 { --a11y-scale: 0.9375; }
html.a11y-font-size-4 { --a11y-scale: 1.125; }
html.a11y-font-size-5 { --a11y-scale: 1.25; }

/* --- Dark mode: tokens live in site.css ([data-bs-theme="dark"]) --- */

/* --- Softer contrast: less glare. Redefines the theme tokens from site.css --- */
html.a11y-low-contrast[data-bs-theme="light"] {
    --sm-bg: #F1EBE1;
    --sm-surface: #F7F2EA;
    --sm-surface-2: #E9E0D2;
    --sm-border: #DACDBA;
    --sm-text: #4A4039;
    --sm-muted: #66594E;
    --sm-accent: #9C5235;
    --sm-accent-rgb: 156, 82, 53;
    --sm-accent-hover: #834430;
}

html.a11y-low-contrast[data-bs-theme="dark"] {
    --sm-bg: #2A2420;
    --sm-surface: #322B26;
    --sm-surface-2: #3A322B;
    --sm-border: #4A4037;
    --sm-text: #D9CFC2;
    --sm-muted: #B9AC9C;
    --sm-accent: #D89A7C;
    --sm-accent-rgb: 216, 154, 124;
    --sm-accent-hover: #E4B097;
}

/* --- Dyslexia-friendly font (only downloaded when switched on) --- */
@font-face {
    font-family: 'OpenDyslexic';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/opendyslexic-400.woff2') format('woff2');
}

@font-face {
    font-family: 'OpenDyslexic';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/opendyslexic-700.woff2') format('woff2');
}

html.a11y-dyslexia-font,
html.a11y-dyslexia-font body,
html.a11y-dyslexia-font .btn,
html.a11y-dyslexia-font .form-control,
html.a11y-dyslexia-font .form-select,
html.a11y-dyslexia-font h1, html.a11y-dyslexia-font h2, html.a11y-dyslexia-font h3,
html.a11y-dyslexia-font h4, html.a11y-dyslexia-font h5, html.a11y-dyslexia-font h6 {
    --bs-body-font-family: 'OpenDyslexic', sans-serif;
    font-family: 'OpenDyslexic', sans-serif;
}

/* --- More spacing (WCAG 1.4.12 text-spacing values) --- */
html.a11y-wide-spacing body {
    letter-spacing: 0.08em;
    word-spacing: 0.16em;
    line-height: 1.8;
}

html.a11y-wide-spacing p,
html.a11y-wide-spacing li {
    margin-bottom: 1em;
}

html.a11y-wide-spacing h1,
html.a11y-wide-spacing h2,
html.a11y-wide-spacing h3 {
    letter-spacing: 0.02em;
    line-height: 1.4;
}

/* --- Reduce motion --- */
html.a11y-reduced-motion *,
html.a11y-reduced-motion *::before,
html.a11y-reduced-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

html.a11y-reduced-motion .meeting-card:hover {
    transform: none;
}

/* --- Reading guide --- */
.a11y-reading-shade {
    position: fixed;
    left: 0;
    width: 100%;
    height: 0;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
    z-index: 1040;
    opacity: 0;
    transition: opacity 150ms ease;
}

html:not(.a11y-reading-guide) .a11y-reading-shade {
    display: none;
}
