/* Bootstrap 5 dropped .sr-only — redefine for visually-hidden labels */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0,0,0,0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* ===== Accessibility Widget ===== */
#a11y-fab {
    position: fixed;
    bottom: 100px;
    left: 24px;
    z-index: 9000;
    width: 48px;
    height: 48px;
    background: #c00000;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
#a11y-fab:focus {
    outline: 3px solid #ffcc00;
    outline-offset: 2px;
}
#a11y-panel {
    position: fixed;
    bottom: 156px;
    left: 24px;
    z-index: 9001;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    width: 280px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.18);
    display: none;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}
#a11y-panel.a11y-open { display: block; }
#a11y-panel h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    color: #222;
}
#a11y-panel .a11y-section-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #555;
    margin-bottom: 8px;
    margin-top: 12px;
}
#a11y-panel h3 + .a11y-section-label {
    margin-top: 0;
}
/* 2x2 grid for Colour Contrast buttons */
#a11y-panel .a11y-btn-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-bottom: 4px;
}
/* Flex row for Text Size buttons */
#a11y-panel .a11y-btn-group {
    display: flex;
    gap: 6px;
    margin-bottom: 4px;
}
#a11y-panel .a11y-btn-group .a11y-btn {
    flex: 1;
}
#a11y-panel .a11y-btn {
    padding: 8px 6px;
    font-size: 12px;
    border: 1px solid #ddd;
    background: #f5f5f5;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
}
#a11y-panel .a11y-btn:hover {
    background: #e8e8e8;
}
#a11y-panel .a11y-btn:focus {
    outline: 3px solid #ffcc00;
    outline-offset: 1px;
}
#a11y-panel .a11y-btn.active {
    background: #c00000;
    color: #fff;
    border-color: #c00000;
}
/* Colour Tint and Saturation control rows */
#a11y-panel .a11y-tint-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}
#a11y-panel .a11y-tint-sub {
    font-size: 12px;
    color: #555;
    min-width: 54px;
    flex-shrink: 0;
}
#a11y-panel input[type="color"] {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    border: 1px solid #ddd;
    cursor: pointer;
    padding: 1px;
    background: none;
}
#a11y-panel input[type="color"]:focus {
    outline: 3px solid #ffcc00;
    outline-offset: 2px;
}
#a11y-panel input[type="range"] {
    flex: 1;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
}
#a11y-panel input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 2px;
    background: #bbb;
}
#a11y-panel input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: #bbb;
}
#a11y-panel input[type="range"]::-moz-range-progress {
    height: 4px;
    border-radius: 2px;
    background: #c00000;
}
#a11y-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #c00000;
    cursor: pointer;
    margin-top: -6px;
}
#a11y-panel input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #c00000;
    border: none;
    cursor: pointer;
}
#a11y-panel input[type="range"]:focus {
    outline: none;
}
/* Reset button */
#a11y-panel .a11y-reset-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    padding: 8px;
    font-size: 12px;
    font-weight: 600;
    background: #fff;
    color: #c00000;
    border: 1px solid #c00000;
    border-radius: 4px;
    cursor: pointer;
    text-align: center;
}
#a11y-panel .a11y-reset-btn:hover {
    background: #c00000;
    color: #fff;
}
#a11y-panel .a11y-reset-btn:focus {
    outline: 3px solid #ffcc00;
    outline-offset: 1px;
}
/* WCAG 1.4.3 — Bootstrap text-secondary/text-muted (#797979) fails 4.5:1; darken to #696969 */
.text-secondary, .text-muted { color: #696969 !important; }

/* WCAG 1.4.1 — copyright footer link must be distinguishable without relying on color */
.copyright a { text-decoration: underline; }

/* High contrast overrides */
html.a11y-hc body { background: #000 !important; color: #fff !important; }
html.a11y-hc a { color: #ffff00 !important; }
html.a11y-hc .btn-danger, html.a11y-hc .btn-danger-out-light {
    background: #ffff00 !important; color: #000 !important; border-color: #ffff00 !important;
}
