/* -------------------------------------------------- */
/* Toolbar button + panel                              */
/* -------------------------------------------------- */

#gpa-a11y-toolbar {
    position: fixed;
    left: 18px;
    bottom: 18px;
    z-index: 9999;
}

#gpa-a11y-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    height: 54px;
    padding: 0 22px 0 18px;
    border-radius: 50px;
    background: #d9a441;
    color: #0d1a3b;
    border: none;
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
    cursor: pointer;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 0.95rem;
    font-weight: bold;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
#gpa-a11y-toggle:hover {
    background: #f0c364;
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(0,0,0,0.35);
}
#gpa-a11y-toggle svg { width: 26px; height: 26px; flex-shrink: 0; }

#gpa-a11y-panel {
    position: absolute;
    left: 0;
    bottom: 66px;
    width: 460px;
    max-width: calc(100vw - 36px);
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 16px 40px rgba(0,0,0,0.28);
    padding: 24px;
    font-family: Arial, Helvetica, sans-serif;
    opacity: 0;
    transform: translateY(10px) scale(0.97);
    pointer-events: none;
    transform-origin: bottom left;
    transition: opacity 0.18s ease, transform 0.18s ease;
}
#gpa-a11y-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.gpa-a11y-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #eceff1;
}
.gpa-a11y-panel-header h2 {
    font-size: 1.4rem;
    margin: 0;
    color: #00404f;
    text-transform: none;
    letter-spacing: 0.01em;
}
#gpa-a11y-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: #f3f4f6;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #55606a;
}
#gpa-a11y-close:hover { background: #e9eaed; }

.gpa-a11y-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
}

.gpa-a11y-option {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: #f6f7f8;
    border: 2px solid transparent;
    border-radius: 14px;
    cursor: pointer;
    color: #262b2f;
    font-size: 1rem;
    font-weight: bold;
    text-align: left;
    line-height: 1.25;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.gpa-a11y-option svg {
    color: var(--gpa-a11y-color, #00697f);
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    transition: color 0.12s ease;
}
.gpa-a11y-option:hover {
    background: #eef1f2;
    border-color: var(--gpa-a11y-color, #00697f);
}
.gpa-a11y-option[aria-pressed="true"] {
    background: var(--gpa-a11y-color, #00566b);
    color: #fff;
    border-color: var(--gpa-a11y-color, #00404f);
}
.gpa-a11y-option[aria-pressed="true"] svg { color: #fff; }

.gpa-a11y-cycling { align-items: center; }
.gpa-a11y-icon-wrap { display: flex; flex-shrink: 0; }
.gpa-a11y-icon-wrap svg {
    color: var(--gpa-a11y-color, #00697f);
    width: 34px;
    height: 34px;
    transition: color 0.12s ease;
}
.gpa-a11y-cycling[aria-pressed="true"] .gpa-a11y-icon-wrap svg { color: #fff; }
.gpa-a11y-option-text {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.gpa-a11y-option-label { line-height: 1.1; }
.gpa-a11y-dots { display: flex; gap: 5px; }
.gpa-a11y-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: rgba(0,0,0,0.2);
    transition: background 0.15s ease, transform 0.15s ease;
}
.gpa-a11y-cycling[aria-pressed="true"] .gpa-a11y-dot { background: rgba(255,255,255,0.4); }
.gpa-a11y-dot.is-active {
    background: #fff;
    transform: scale(1.35);
}

#gpa-a11y-reset {
    display: block;
    width: 100%;
    margin-top: 18px;
    padding: 13px;
    background: #f6f7f8;
    border: none;
    border-radius: 10px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
    color: #262b2f;
}
#gpa-a11y-reset:hover { background: #e9eff0; }

.gpa-a11y-credit {
    display: block;
    margin: 16px 0 0;
    padding-top: 12px;
    border-top: 1px solid #eceff1;
    text-align: center;
    font-size: 0.72rem;
    color: #8a9299;
}
.gpa-a11y-credit a {
    color: #8a9299;
    text-decoration: underline;
}
.gpa-a11y-credit a:hover { color: #00697f; }

@media (max-width: 560px) {
    #gpa-a11y-toolbar { left: 12px; bottom: 12px; }
    #gpa-a11y-toggle { width: 52px; height: 52px; padding: 0; border-radius: 50%; }
    #gpa-a11y-toggle span { display: none; }
    #gpa-a11y-panel { width: calc(100vw - 24px); padding: 18px; bottom: 64px; }
    .gpa-a11y-grid { grid-template-columns: 1fr; }
    .gpa-a11y-option { font-size: 0.92rem; }
}

/* -------------------------------------------------- */
/* The actual functional effects — each one genuinely  */
/* changes real styles, not a cosmetic-only overlay.   */
/* -------------------------------------------------- */

/* Four contrast modes (mutually exclusive — enforced in JS) — each
   filtering top-level sections individually, never body/html
   directly, since a filter on body/html would break the toolbar's
   own fixed positioning (filter creates a new containing block for
   any fixed-position descendant it has). */

/* Light Contrast — boosted brightness/contrast for a crisp, light,
   high-clarity look. */
html.gpa-a11y-lightcontrast > body > *:not(#gpa-a11y-toolbar):not(#gpa-a11y-reading-guide) {
    filter: contrast(1.5) brightness(1.08) saturate(1.15);
}

/* Dark Contrast — a genuine dark-mode effect (invert + hue-rotate,
   the standard CSS "quick dark mode" trick), with photos/videos
   re-inverted back to their normal colours so they don't look like
   negatives. */
html.gpa-a11y-darkcontrast > body > *:not(#gpa-a11y-toolbar):not(#gpa-a11y-reading-guide) {
    filter: invert(1) hue-rotate(180deg);
}
html.gpa-a11y-darkcontrast img,
html.gpa-a11y-darkcontrast video,
html.gpa-a11y-darkcontrast [style*="background-image"] {
    filter: invert(1) hue-rotate(180deg);
}

/* High Contrast — the most aggressive mode, maximising the gap
   between light and dark for the strongest possible differentiation. */
html.gpa-a11y-highcontrast > body > *:not(#gpa-a11y-toolbar):not(#gpa-a11y-reading-guide) {
    filter: contrast(2.1) saturate(0.5) brightness(1.05);
}

/* Invert Colours — a classic full photo-negative inversion, including
   images (distinct from Dark Contrast, which keeps photos normal). */
html.gpa-a11y-invert > body > *:not(#gpa-a11y-toolbar):not(#gpa-a11y-reading-guide) {
    filter: invert(1) hue-rotate(180deg) saturate(1.3);
}

/* Highlight Links — focused on genuine inline text links, not
   button-styled CTAs/nav (which are already visually distinct). */
html.gpa-a11y-links a:not(.btn):not(.nav-list a):not(.footer-links a):not(.link-card):not(#gpa-a11y-toolbar a) {
    background: #ffe600 !important;
    color: #000 !important;
    text-decoration: underline !important;
    box-decoration-break: clone;
}

/* Bigger Text */
html.gpa-a11y-bigtext {
    font-size: 120%;
}

/* Text Spacing (WCAG 1.4.12-style values) */
html.gpa-a11y-spacing body,
html.gpa-a11y-spacing p,
html.gpa-a11y-spacing li,
html.gpa-a11y-spacing a {
    letter-spacing: 0.12em !important;
    word-spacing: 0.16em !important;
}
html.gpa-a11y-spacing p {
    margin-bottom: 2em !important;
}

/* Pause Animations — hero-slider.js checks this class directly;
   this also stops CSS-driven transitions/animations everywhere. */
html.gpa-a11y-pause *,
html.gpa-a11y-pause *::before,
html.gpa-a11y-pause *::after {
    animation-play-state: paused !important;
    transition: none !important;
}

/* Hide Images — real <img> tags, plus every element using an inline
   background-image (hero, About/Volunteer/Donate panels, page
   banners, etc.) */
html.gpa-a11y-hideimages img {
    visibility: hidden !important;
}
html.gpa-a11y-hideimages [style*="background-image"] {
    background-image: none !important;
    background-color: #ccc !important;
}

/* Dyslexia Friendly — a genuinely dyslexia-oriented typeface where
   available, falling back gracefully to a plain, highly legible
   sans-serif everywhere else. */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('https://cdn.jsdelivr.net/fontsource/fonts/opendyslexic@latest/latin-400-normal.woff2') format('woff2'),
         url('https://cdn.jsdelivr.net/fontsource/fonts/opendyslexic@latest/latin-400-normal.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
html.gpa-a11y-dyslexia body,
html.gpa-a11y-dyslexia h1,
html.gpa-a11y-dyslexia h2,
html.gpa-a11y-dyslexia h3,
html.gpa-a11y-dyslexia h4 {
    font-family: 'OpenDyslexic', Verdana, Arial, sans-serif !important;
}

/* Cursor — a larger, high-contrast pointer */
html.gpa-a11y-cursor,
html.gpa-a11y-cursor * {
    cursor: url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI0MCIgaGVpZ2h0PSI0MCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNCAybDE2IDktNi41IDEuNUwxNiAyMGwtMyAxLjMtMi41LTcuM0w0IDE4eiIgZmlsbD0iYmxhY2siIHN0cm9rZT0id2hpdGUiIHN0cm9rZS13aWR0aD0iMS41Ii8+PC9zdmc+') 4 4, auto !important;
}

/* Tooltips — makes existing aria-label/title text visible on-screen
   rather than only available via a native, easy-to-miss browser
   tooltip. */
html.gpa-a11y-tooltips [aria-label],
html.gpa-a11y-tooltips [title] {
    position: relative;
}
html.gpa-a11y-tooltips [aria-label]:hover::after,
html.gpa-a11y-tooltips [aria-label]:focus::after {
    content: attr(aria-label);
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    margin-bottom: 6px;
    background: #1a1a1a;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
}
html.gpa-a11y-tooltips [title]:not([aria-label]):hover::after,
html.gpa-a11y-tooltips [title]:not([aria-label]):focus::after {
    content: attr(title);
    position: absolute;
    left: 50%;
    bottom: 100%;
    transform: translateX(-50%);
    margin-bottom: 6px;
    background: #1a1a1a;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
}

/* Line Height */
html.gpa-a11y-lineheight body,
html.gpa-a11y-lineheight p,
html.gpa-a11y-lineheight li {
    line-height: 2 !important;
}

/* Highlight Headings — same idea as Highlight Links, but for page
   structure. */
html.gpa-a11y-headings h1:not(#gpa-a11y-toolbar h1),
html.gpa-a11y-headings h2:not(#gpa-a11y-toolbar h2),
html.gpa-a11y-headings h3:not(#gpa-a11y-toolbar h3),
html.gpa-a11y-headings h4:not(#gpa-a11y-toolbar h4),
html.gpa-a11y-headings h5,
html.gpa-a11y-headings h6 {
    background: #ffe600 !important;
    color: #000 !important;
    box-decoration-break: clone;
    padding: 0 4px !important;
}

/* Read Aloud — click any paragraph/list item/heading to hear it read
   using the browser's own built-in speech engine (no external
   service). A visible affordance shows which elements are readable. */
html.gpa-a11y-readaloud p,
html.gpa-a11y-readaloud li,
html.gpa-a11y-readaloud h1,
html.gpa-a11y-readaloud h2,
html.gpa-a11y-readaloud h3,
html.gpa-a11y-readaloud h4 {
    cursor: pointer;
}
html.gpa-a11y-readaloud p:hover,
html.gpa-a11y-readaloud li:hover,
html.gpa-a11y-readaloud h1:hover,
html.gpa-a11y-readaloud h2:hover,
html.gpa-a11y-readaloud h3:hover,
html.gpa-a11y-readaloud h4:hover {
    outline: 2px dashed #00695c;
    outline-offset: 3px;
    background: rgba(0,105,92,0.06);
}
.gpa-a11y-readaloud-speaking {
    outline: 3px solid #00695c !important;
    outline-offset: 3px;
    background: rgba(0,105,92,0.12) !important;
}

/* Reading Guide — a horizontal band that follows the cursor/keyboard
   focus down the page, added/positioned by JS. */
#gpa-a11y-reading-guide {
    display: none;
    position: fixed;
    left: 0;
    width: 100%;
    height: 52px;
    background: rgba(255, 230, 0, 0.28);
    border-top: 2px solid rgba(0,0,0,0.35);
    border-bottom: 2px solid rgba(0,0,0,0.35);
    pointer-events: none;
    z-index: 9998;
}
html.gpa-a11y-guide #gpa-a11y-reading-guide {
    display: block;
}

/* Colour Filter — a best-effort assist (contrast/saturation/hue
   adjustment tuned per type) to help separate commonly-confused
   colour pairs. Not a medically-precise correction — genuine
   real-time colour-blindness correction needs more than CSS alone
   can offer, so treat this as a helpful nudge rather than a cure. */
html.gpa-a11y-cf-protanopia > body > *:not(#gpa-a11y-toolbar):not(#gpa-a11y-reading-guide) {
    filter: contrast(1.3) saturate(1.6) hue-rotate(-10deg);
}
html.gpa-a11y-cf-deuteranopia > body > *:not(#gpa-a11y-toolbar):not(#gpa-a11y-reading-guide) {
    filter: contrast(1.3) saturate(1.6) hue-rotate(10deg);
}
html.gpa-a11y-cf-tritanopia > body > *:not(#gpa-a11y-toolbar):not(#gpa-a11y-reading-guide) {
    filter: contrast(1.3) saturate(1.6) hue-rotate(45deg);
}
