/* ===========================================================================
   Accessibility Options widget
   A client-side toolbar that lets visitors adjust text size, contrast, fonts
   and motion. All state is persisted to localStorage and re-applied on load.
   Brand colours: navy #08102b, red #e53f25.
   =========================================================================== */

:root {
    --a11y-navy: #08102b;
    --a11y-red: #e53f25;
    --a11y-border: #e4e4e4;
    --a11y-muted: #58595b;
}

/* --- Floating toggle button ------------------------------------------------ */
#a11y-toggle {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99990;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .35);
    background: var(--a11y-navy);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .28);
    transition: transform .18s ease, background .18s ease;
}

#a11y-toggle:hover,
#a11y-toggle:focus-visible {
    background: var(--a11y-red);
    transform: scale(1.06);
    outline: none;
}

#a11y-toggle svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

/* --- Panel ----------------------------------------------------------------- */
#a11y-panel {
    position: fixed;
    right: 20px;
    bottom: 84px;
    z-index: 99991;
    width: 380px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(8, 16, 43, .28);
    padding: 22px;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--a11y-navy);
    -webkit-overflow-scrolling: touch;
}

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

.a11y-panel__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid var(--a11y-border);
    padding-bottom: 14px;
    margin-bottom: 16px;
}

.a11y-panel__title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
    color: var(--a11y-navy);
}

.a11y-panel__title svg {
    width: 22px;
    height: 22px;
    fill: var(--a11y-red);
    flex: 0 0 auto;
}

.a11y-panel__subtitle {
    font-size: 12.5px;
    color: var(--a11y-muted);
    margin: 4px 0 0;
    line-height: 1.4;
}

.a11y-hide-btn {
    flex: 0 0 auto;
    background: #f2f3f6;
    border: 1px solid var(--a11y-border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--a11y-navy);
    cursor: pointer;
    line-height: 1.2;
}

.a11y-hide-btn:hover {
    background: #e9eaef;
}

.a11y-section {
    margin-bottom: 18px;
}

.a11y-section__label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--a11y-red);
    margin-bottom: 10px;
}

.a11y-section__label svg {
    width: 16px;
    height: 16px;
    fill: var(--a11y-red);
}

/* Segmented option buttons (text size + contrast) */
.a11y-options {
    display: grid;
    gap: 10px;
}

.a11y-options.cols-3 {
    grid-template-columns: repeat(3, 1fr);
}

.a11y-options.cols-2 {
    grid-template-columns: repeat(2, 1fr);
}

.a11y-opt {
    border: 1.5px solid var(--a11y-border);
    background: #fff;
    border-radius: 10px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--a11y-navy);
    line-height: 1.25;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.a11y-opt:hover {
    border-color: #b9bcc9;
}

.a11y-opt.is-active {
    border-color: var(--a11y-red);
    color: var(--a11y-red);
    background: #fdeeeb;
}

.a11y-opt .a11y-swatch {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 1px solid #c7c9d4;
    flex: 0 0 auto;
}

/* Toggle rows */
.a11y-toggle-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid var(--a11y-border);
}

.a11y-toggle-row__icon {
    flex: 0 0 auto;
    width: 22px;
    color: var(--a11y-navy);
}

.a11y-toggle-row__icon svg {
    width: 20px;
    height: 20px;
    fill: var(--a11y-navy);
}

.a11y-toggle-row__text {
    flex: 1 1 auto;
    min-width: 0;
}

.a11y-toggle-row__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--a11y-navy);
    margin: 0;
    line-height: 1.25;
}

.a11y-toggle-row__desc {
    font-size: 12px;
    color: var(--a11y-muted);
    margin: 2px 0 0;
    line-height: 1.35;
}

/* Switch */
.a11y-switch {
    flex: 0 0 auto;
    position: relative;
    width: 46px;
    height: 26px;
}

.a11y-switch input {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
}

.a11y-switch__track {
    position: absolute;
    inset: 0;
    background: #cfd2db;
    border-radius: 26px;
    transition: background .18s ease;
    pointer-events: none;
}

.a11y-switch__track::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
    transition: transform .18s ease;
}

.a11y-switch input:checked + .a11y-switch__track {
    background: var(--a11y-red);
}

.a11y-switch input:checked + .a11y-switch__track::before {
    transform: translateX(20px);
}

.a11y-switch input:focus-visible + .a11y-switch__track {
    box-shadow: 0 0 0 3px rgba(229, 63, 37, .35);
}

/* Restore button */
.a11y-restore {
    width: 100%;
    margin-top: 8px;
    border: 1px solid var(--a11y-border);
    background: #f2f3f6;
    border-radius: 10px;
    padding: 13px;
    font-size: 14px;
    font-weight: 700;
    color: var(--a11y-navy);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.a11y-restore:hover {
    background: #e9eaef;
}

.a11y-restore svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* ===========================================================================
   Applied accessibility MODES (classes live on <html>)
   =========================================================================== */

/* Reading guide bar (created by JS) */
#a11y-reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--a11y-red);
    box-shadow: 0 0 0 6px rgba(229, 63, 37, .12);
    z-index: 99980;
    pointer-events: none;
    display: none;
}

html.a11y-reading-guide-on #a11y-reading-guide {
    display: block;
}

/* Dyslexia-friendly typography */
html.a11y-dyslexia body,
html.a11y-dyslexia p,
html.a11y-dyslexia li,
html.a11y-dyslexia a,
html.a11y-dyslexia span,
html.a11y-dyslexia td,
html.a11y-dyslexia th,
html.a11y-dyslexia label,
html.a11y-dyslexia h1,
html.a11y-dyslexia h2,
html.a11y-dyslexia h3,
html.a11y-dyslexia h4,
html.a11y-dyslexia h5,
html.a11y-dyslexia h6,
html.a11y-dyslexia button,
html.a11y-dyslexia input,
html.a11y-dyslexia textarea {
    font-family: "Comic Sans MS", "Trebuchet MS", Verdana, Tahoma, sans-serif !important;
    letter-spacing: .04em !important;
    word-spacing: .12em !important;
    line-height: 1.7 !important;
}
/* keep our own panel readable in its normal font */
html.a11y-dyslexia #a11y-panel,
html.a11y-dyslexia #a11y-panel * {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
}

/* Highlight clickable elements */
html.a11y-highlight-links a,
html.a11y-highlight-links button,
html.a11y-highlight-links [role="button"],
html.a11y-highlight-links input[type="submit"],
html.a11y-highlight-links input[type="button"],
html.a11y-highlight-links label[for],
html.a11y-highlight-links summary {
    outline: 2px solid var(--a11y-red) !important;
    outline-offset: 2px !important;
    background-color: rgba(229, 63, 37, .06) !important;
}
/* don't box our own controls */
html.a11y-highlight-links #a11y-panel a,
html.a11y-highlight-links #a11y-panel button,
html.a11y-highlight-links #a11y-toggle {
    outline: none !important;
    background-color: initial !important;
}

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

/* Colourblind (monochrome) */
html.a11y-mono body {
    filter: grayscale(100%) !important;
}
/* keep the panel/toggle in colour so options stay usable */
html.a11y-mono #a11y-panel,
html.a11y-mono #a11y-toggle {
    filter: grayscale(0%) !important;
}

/* High Contrast — Dark */
html.a11y-hc-dark body {
    background: #000 !important;
    color: #fff !important;
}

html.a11y-hc-dark :is(header, footer, section, article, aside, nav, main, div, ul, ol, li, table, tr, td, th, form) {
    background-color: transparent !important;
    background-image: none !important;
    color: #fff !important;
    border-color: #fff !important;
}

html.a11y-hc-dark :is(p, span, h1, h2, h3, h4, h5, h6, label, strong, em, small, dd, dt, blockquote, figcaption) {
    color: #fff !important;
}

html.a11y-hc-dark a,
html.a11y-hc-dark a * {
    color: #ffea00 !important;
}

html.a11y-hc-dark :is(button, input, select, textarea) {
    background: #000 !important;
    color: #fff !important;
    border: 1px solid #fff !important;
}

/* High Contrast — Light */
html.a11y-hc-light body {
    background: #fff !important;
    color: #000 !important;
}

html.a11y-hc-light :is(header, footer, section, article, aside, nav, main, div, ul, ol, li, table, tr, td, th, form) {
    background-color: transparent !important;
    background-image: none !important;
    color: #000 !important;
    border-color: #000 !important;
}

html.a11y-hc-light :is(p, span, h1, h2, h3, h4, h5, h6, label, strong, em, small, dd, dt, blockquote, figcaption) {
    color: #000 !important;
}

html.a11y-hc-light a,
html.a11y-hc-light a * {
    color: #0000ee !important;
    text-decoration: underline !important;
}

html.a11y-hc-light :is(button, input, select, textarea) {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #000 !important;
}

/* Never let high-contrast overrides bleed into our own widget */
html.a11y-hc-dark #a11y-panel,
html.a11y-hc-dark #a11y-panel *,
html.a11y-hc-light #a11y-panel,
html.a11y-hc-light #a11y-panel * {
    color: var(--a11y-navy) !important;
    border-color: var(--a11y-border) !important;
}

html.a11y-hc-dark #a11y-panel,
html.a11y-hc-light #a11y-panel {
    background: #fff !important;
}

html.a11y-hc-dark #a11y-panel .a11y-opt.is-active,
html.a11y-hc-light #a11y-panel .a11y-opt.is-active {
    color: var(--a11y-red) !important;
    border-color: var(--a11y-red) !important;
}

/* Screen-reader-assist hover cue */
html.a11y-read-aloud [data-a11y-speaking="true"] {
    outline: 2px dashed var(--a11y-red) !important;
    outline-offset: 2px;
}

@media (max-width: 480px) {
    #a11y-panel {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 78px;
    }

    #a11y-toggle {
        right: 14px;
        bottom: 14px;
    }
}

/* ---------------------------------------------------------------------------
   High-visibility cursor
   A large black-on-white arrow, drawn as an inline SVG data URI so it needs no
   extra request and scales cleanly. Chosen over a decorative mouse trail: it
   helps people who lose track of the pointer without adding motion, which would
   have contradicted the "Reduce UI Animations" option in the same panel.
   The 4/28 hotspot keeps the click point at the arrow tip.
--------------------------------------------------------------------------- */
.a11y-big-cursor,
.a11y-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 32 32'%3E%3Cpath d='M6 2 26 18h-8.5l4.5 9.5-4 2-4.5-9.5L6 26Z' fill='%23fff' stroke='%23000' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, auto !important;
}

/* Anything clickable keeps a pointer, still enlarged. */
.a11y-big-cursor a,
.a11y-big-cursor button,
.a11y-big-cursor [role="button"],
.a11y-big-cursor input[type="submit"],
.a11y-big-cursor input[type="button"],
.a11y-big-cursor label,
.a11y-big-cursor select,
.a11y-big-cursor summary {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 32 32'%3E%3Cpath d='M12 2c-1.1 0-2 .9-2 2v12l-2.5-2.5a2 2 0 0 0-3 2.6l6 9A4 4 0 0 0 14 27h8a4 4 0 0 0 4-4v-8a2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0-4 0V4c0-1.1-.9-2-2-2Z' fill='%23fff' stroke='%23000' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E") 10 2, pointer !important;
}

/* Make the keyboard focus ring obvious too — the same need, without a mouse. */
.a11y-big-cursor :focus-visible {
    outline: 3px solid #000 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 6px #fff !important;
}

/* ---------------------------------------------------------------------------
   "Visually impaired" preset button
--------------------------------------------------------------------------- */
.a11y-preset {
    align-items: center;
    background: #f4f6f8;
    border: 1px solid #d7dce1;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    text-align: left;
    width: 100%;
}

.a11y-preset:hover {
    background: #eaeef2;
}

.a11y-preset.is-active {
    background: #0b2a4a;
    border-color: #0b2a4a;
    color: #fff;
}

.a11y-preset svg {
    flex: 0 0 auto;
    height: 22px;
    width: 22px;
}

.a11y-preset__title {
    font-weight: 700;
    margin: 0;
}

.a11y-preset__desc {
    font-size: 12px;
    margin: 2px 0 0;
    opacity: .8;
}
