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

/* ====== Accessibility Widget ====== */

/* Trigger button */
#a11y-btn {
    display: none; /* shown by JS after load — prevents dead button when JS off */
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9500;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #1a5276;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
    font-size: 22px;
    align-items: center;
    justify-content: center;
    transition: background .2s;
}
#a11y-btn:hover,
#a11y-btn:focus {
    background: #154360;
    outline: 3px solid #f0b429;
    outline-offset: 2px;
}

/* Panel */
#a11y-panel {
    position: fixed;
    bottom: 84px;
    right: 24px;
    z-index: 9500;
    width: 272px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid #d0d7de;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.18);
    padding: 16px;
    display: none;
    font-family: inherit;
    font-size: 13px;
    color: #1a1a1a;
}
#a11y-panel.a11y-open {
    display: block;
}

/* Panel header */
.a11y-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.a11y-panel-header h2 {
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    color: #1a1a1a;
}
#a11y-close {
    background: none;
    border: none;
    cursor: pointer;
    color: #555;
    font-size: 18px;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 4px;
}
#a11y-close:hover,
#a11y-close:focus {
    background: #f0f0f0;
    outline: 2px solid #1a5276;
}

/* Section labels */
.a11y-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #555;
    margin: 0 0 6px;
}

/* Button groups (text size + contrast) */
.a11y-btn-group {
    display: flex;
    gap: 6px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.a11y-btn-group button {
    flex: 1;
    padding: 6px 10px;
    border: 1.5px solid #ccc;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 13px;
    color: #333;
    transition: border-color .15s, background .15s;
    min-width: 0;
    white-space: nowrap;
}
.a11y-btn-group button:hover,
.a11y-btn-group button:focus {
    border-color: #1a5276;
    outline: 2px solid #1a5276;
    outline-offset: 1px;
}
.a11y-btn-group button.active {
    border-color: #1a5276;
    background: #d6eaf8;
    color: #1a5276;
    font-weight: 600;
}

/* 2-per-row grid layout for all button groups */
.a11y-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    flex-wrap: unset; /* override inherited flex-wrap from .a11y-btn-group */
}

/* Icon-above, label-below button style */
.a11y-grid-2 button {
    flex: unset;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 9px 4px;
    font-size: 11px;
    white-space: normal;
    min-height: 52px; /* 44px touch target + padding */
    line-height: 1.2;
}

.a11y-grid-2 button i {
    font-size: 17px;
    line-height: 1;
}

/* Section divider */
.a11y-divider {
    border: none;
    border-top: 1px solid #eee;
    margin: 6px 0 14px;
}

/* Sliders — thumb rides on the color bar */
.a11y-slider-wrap {
    margin-bottom: 14px;
    position: relative;
    height: 24px;
    display: flex;
    align-items: center;
}
.a11y-tint-track,
.a11y-warmth-track {
    position: absolute;
    left: 0;
    right: 0;
    height: 8px;
    border-radius: 4px;
    pointer-events: none;
}
.a11y-tint-track {
    background: linear-gradient(90deg,
        #ff0000, #ff8000, #ffff00, #00ff00,
        #00ffff, #0000ff, #ff00ff, #ff0000);
}
.a11y-warmth-track {
    background: linear-gradient(90deg, #1a4a8a, #e8e8e8, #c87537);
}
.a11y-slider-wrap input[type="range"] {
    position: relative;
    display: block;
    width: 100%;
    height: 24px;
    overflow: visible;
    opacity: 1;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    z-index: 1;
    margin: 0;
    padding: 0;
}
/* Transparent track so gradient bar shows through */
.a11y-slider-wrap input[type="range"]::-webkit-slider-runnable-track {
    background: transparent;
    height: 8px;
    border-radius: 4px;
}
.a11y-slider-wrap input[type="range"]::-moz-range-track {
    background: transparent;
    height: 8px;
    border-radius: 4px;
}
/* White thumb with bank-blue border */
.a11y-slider-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid #1a5276;
    box-shadow: 0 1px 4px rgba(0,0,0,.35);
    cursor: pointer;
    margin-top: -6px;
}
.a11y-slider-wrap input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid #1a5276;
    box-shadow: 0 1px 4px rgba(0,0,0,.35);
    cursor: pointer;
}
.a11y-slider-wrap input[type="range"]:focus {
    outline: none;
}
.a11y-slider-wrap input[type="range"]:focus::-webkit-slider-thumb {
    outline: 2px solid #1a5276;
    outline-offset: 2px;
}
.a11y-slider-wrap input[type="range"]:focus::-moz-range-thumb {
    outline: 2px solid #1a5276;
    outline-offset: 2px;
}

/* Reset link */
#a11y-reset {
    display: block;
    text-align: center;
    color: #1a5276;
    background: none;
    border: none;
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: 4px;
    cursor: pointer;
    width: 100%;
    font-size: 13px;
    text-decoration: underline;
}
#a11y-reset:hover,
#a11y-reset:focus {
    color: #154360;
    outline: 2px solid #1a5276;
    outline-offset: 2px;
}

/* Effect overlay (backdrop-filter) */
#a11y-effect-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
    backdrop-filter: var(--a11y-backdrop, none);
    -webkit-backdrop-filter: var(--a11y-backdrop, none);
}

/* Warmth overlay */
#a11y-warmth-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9001;
    background-color: var(--a11y-warmth-color, transparent);
    opacity: var(--a11y-warmth-opacity, 0);
    mix-blend-mode: overlay;
    transition: opacity .15s;
}

/* ====== Accessibility Feature Rules ====== */

/* Highlight Title */
body.a11y-highlight-title h1,
body.a11y-highlight-title h2,
body.a11y-highlight-title h3,
body.a11y-highlight-title h4,
body.a11y-highlight-title h5,
body.a11y-highlight-title h6 {
    background-color: #ffff00 !important;
    color: #000 !important;
}

/* Highlight Links — border only, no background fill */
body.a11y-highlight-links a {
    outline: 2px solid currentColor !important;
    outline-offset: 2px !important;
}

/* Dyslexia Font */
body.a11y-dyslexia-font,
body.a11y-dyslexia-font * {
    font-family: 'OpenDyslexic', sans-serif !important;
}

/* Letter Spacing */
body.a11y-letter-spacing,
body.a11y-letter-spacing p,
body.a11y-letter-spacing li,
body.a11y-letter-spacing td,
body.a11y-letter-spacing span {
    letter-spacing: 0.12em !important;
}

/* Line Height */
body.a11y-line-height,
body.a11y-line-height p,
body.a11y-line-height li,
body.a11y-line-height td {
    line-height: 1.8 !important;
}

/* Font Weight */
body.a11y-font-weight p,
body.a11y-font-weight li,
body.a11y-font-weight td,
body.a11y-font-weight span,
body.a11y-font-weight a {
    font-weight: 700 !important;
}

/* Stop Animations */
body.a11y-stop-animations *,
body.a11y-stop-animations *::before,
body.a11y-stop-animations *::after {
    animation: none !important;
    transition: none !important;
}

/* Big Cursor — 48px arrow SVG inlined as data URI, hotspot at 6 6 */
body.a11y-big-cursor,
body.a11y-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpolygon points='6,2 6,42 16,32 22,46 27,44 21,30 36,30' fill='white' stroke='black' stroke-width='2'/%3E%3C/svg%3E") 6 6, auto !important;
}

/* Reading Guide — horizontal band that follows the cursor */
#a11y-reading-guide {
    position: fixed;
    left: 0;
    width: 100%;
    height: 40px;
    background: rgba(255, 255, 0, 0.25);
    pointer-events: none;
    z-index: 8999; /* below widget overlays at 9000–9001 */
    display: none;
}

body.a11y-reading-guide-active #a11y-reading-guide {
    display: block;
}

/* Mobile adjustments */
@media (max-width: 480px) {
    #a11y-btn  { bottom: 16px; right: 16px; }
    #a11y-panel {
        right: 8px;
        left: 8px;
        width: auto;
        bottom: 76px;
        max-height: calc(100vh - 84px);
    }
}

/* Text size zoom */
body.a11y-font-1 { zoom: 1.125; }
body.a11y-font-2 { zoom: 1.25;  }

/* Skip link */
.skip-to-main {
    position: absolute;
    left: -9999px;
    top: 4px;
    z-index: 10000;
    padding: 8px 16px;
    background: #1a3a5c;
    color: #fff;
    font-weight: bold;
    text-decoration: none;
    border-radius: 0 0 4px 4px;
}
.skip-to-main:focus {
    left: 50%;
    transform: translateX(-50%);
}
/* Screen-reader only utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
