/* =====================================================================
   WindowsHelper — Accessibility layer (a11y.css)
   Self-contained, offline, CSP-safe. No remote fonts, no CDN.
   Options: High contrast · Reduce motion (opt-in, does not follow the
   OS) · Text size (Normal/Large/Larger) · Readable font · Underline
   links · More spacing · Bigger buttons/targets.
   Preference classes are toggled on <html> by a11y.js.
   ===================================================================== */

/* ---------------------------------------------------------------------
   0. SCREEN-READER-ONLY UTILITY
   Visually hidden but announced by screen readers. Used for the
   comparison table's <caption> and its empty top-left header cell so
   the label is spoken but does not paint on screen.
   --------------------------------------------------------------------- */
.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;
}

/* ---------------------------------------------------------------------
   1. GLOBAL FOCUS VISIBILITY
   Brand-green focus ring for keyboard users on every page.
   --------------------------------------------------------------------- */
:focus-visible {
    outline: 3px solid #10B981 !important;
    outline-offset: 2px !important;
    border-radius: 2px;
}

/* ---------------------------------------------------------------------
   2. SKIP LINK
   Visually hidden until focused, then pinned top-left with a solid bg.
   --------------------------------------------------------------------- */
.a11y-skip-link {
    position: fixed;
    top: -100px;
    left: 12px;
    z-index: 2147483001;
    padding: 12px 20px;
    background: #10B981;
    color: #0f0f23;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.5);
    transition: top 0.15s ease;
}
.a11y-skip-link:focus {
    top: 0;
    outline: 3px solid #ffffff;
    outline-offset: -3px;
}

/* ---------------------------------------------------------------------
   3. WIDGET — floating trigger button (bottom-left)
   --------------------------------------------------------------------- */
.a11y-fab {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 2147483000;
    width: 52px;
    height: 52px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(15, 15, 35, 0.95);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    color: #10B981;
    cursor: pointer;
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    line-height: 1;
}
.a11y-fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 34px rgba(16, 185, 129, 0.35);
    background: rgba(20, 20, 45, 0.98);
}
.a11y-fab svg {
    width: 26px;
    height: 26px;
    display: block;
    fill: currentColor;
}

/* RTL: mirror the fab to the bottom-right so it never fights a
   right-aligned reading flow. */
[dir="rtl"] .a11y-fab {
    left: auto;
    right: 20px;
}
[dir="rtl"] .a11y-panel {
    left: auto;
    right: 20px;
}
[dir="rtl"] .a11y-skip-link {
    left: auto;
    right: 12px;
}

/* ---------------------------------------------------------------------
   4. WIDGET — panel
   Dark card matching the nav aesthetic (blur + subtle border).
   --------------------------------------------------------------------- */
.a11y-panel {
    position: fixed;
    bottom: 84px;
    left: 20px;
    z-index: 2147483000;
    width: 300px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 110px);
    overflow-y: auto;
    padding: 18px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(15, 15, 35, 0.97);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
    color: #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    -webkit-font-smoothing: antialiased;
}
.a11y-panel[hidden] {
    display: none;
}

.a11y-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.a11y-panel-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}
.a11y-panel-title svg {
    width: 20px;
    height: 20px;
    fill: #10B981;
    flex: 0 0 auto;
}
.a11y-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    background: transparent;
    color: #a0a0b2;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.a11y-close:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
}

/* Control groups */
.a11y-group {
    margin-bottom: 8px;
}
.a11y-group-label {
    display: block;
    margin: 4px 0 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #8a8a9e;
}

/* Toggle rows (checkbox + label) */
.a11y-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 8px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.a11y-row:hover {
    border-color: rgba(16, 185, 129, 0.35);
    background: rgba(16, 185, 129, 0.06);
}
.a11y-row input[type="checkbox"] {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #10B981;
    cursor: pointer;
}
.a11y-row .a11y-row-text {
    flex: 1 1 auto;
    font-size: 14px;
    color: #e0e0e0;
}

/* Segmented control (Text size: Normal / Large) */
.a11y-seg {
    display: flex;
    gap: 6px;
    padding: 4px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
}
.a11y-seg button {
    flex: 1 1 0;
    padding: 8px 6px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: transparent;
    color: #a0a0b2;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.a11y-seg button:hover {
    color: #ffffff;
}
.a11y-seg button[aria-pressed="true"] {
    background: linear-gradient(135deg, #10B981, #059669);
    color: #ffffff;
    border-color: rgba(16, 185, 129, 0.6);
}

/* Reset button — full-width, quiet by default, clear on hover/focus. */
.a11y-reset {
    display: block;
    width: 100%;
    margin-top: 4px;
    padding: 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: transparent;
    color: #a0a0b2;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.a11y-reset:hover {
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.05);
}

/* =====================================================================
   5. PREFERENCE CLASSES (applied to <html>)
   Each scoped so it ONLY changes things when present.
   ===================================================================== */

/* ---- 5a. LARGE TEXT ------------------------------------------------- */
/* The site uses mostly px inline styles, so html{font-size} won't
   cascade. Instead bump common text elements ~1.25x via :where()
   (zero specificity so it's easy for real page rules to sit on top,
   but our multiplier still lands because there is no competing rule of
   this exact kind). Layout stays intact: we only touch font-size and
   allow wrapping. */
/* This site sets font-size inline (style="font-size:20px") on almost every
   heading and paragraph. A stylesheet font-size rule — even :where() or a
   plain class — loses to an inline style, so a font-only approach silently
   fails on exactly the text that matters. Instead we scale the whole page
   with `zoom`, which multiplies rendered size regardless of inline px and
   keeps every element's proportions intact (no font-vs-box mismatch, no
   clipping). `zoom` is a no-op on ancient engines, so it degrades safely. */
html.a11y-large-text body {
    zoom: 1.18;
}
/* Keep the accessibility widget itself at native size: it lives inside <body>,
   so it inherits the 1.18 zoom — counter it with the reciprocal so the control
   the user is touching doesn't grow/shift under them. The on-screen language
   switcher (translations.js, .language-selector.wh-lang-selector) is another
   fixed-position widget injected into <body>, so it needs the same counter-zoom
   or it would visibly balloon out of proportion with the rest of the widget. */
html.a11y-large-text .a11y-fab,
html.a11y-large-text .a11y-panel,
html.a11y-large-text .a11y-skip-link,
html.a11y-large-text .language-selector,
html.a11y-large-text .wh-lang-selector {
    zoom: 0.847458;   /* 1 / 1.18 */
}
/* Let now-larger text wrap instead of overflowing its box. */
html.a11y-large-text :where(p, li, td, th, span, a, h1, h2, h3, .container) {
    overflow-wrap: break-word;
    word-break: normal;
}
/* Text-zoom safety net: never let the zoomed page scroll horizontally
   (phone widths in particular have no margin to absorb the bump). */
html.a11y-large-text,
html.a11y-large-text body {
    overflow-x: hidden;
}

/* ---- 5b. HIGH CONTRAST --------------------------------------------- */
/* Force a near-black / white AAA-ish palette. Broad !important rules so
   inline styles are overridden. */
html.a11y-high-contrast body {
    background: #000000 !important;
    color: #ffffff !important;
}
html.a11y-high-contrast :where(div, section, header, footer, nav, main,
    article, aside, ul, ol, li, p, span, td, th, tr, table, h1, h2, h3,
    h4, h5, h6, blockquote, figure, figcaption, dl, dt, dd) {
    background-color: transparent !important;
    background-image: none !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
    text-shadow: none !important;
    box-shadow: none !important;
}
html.a11y-high-contrast a {
    color: #ffdd00 !important;
    text-decoration: underline !important;
}
html.a11y-high-contrast a:hover,
html.a11y-high-contrast a:focus {
    color: #ffffff !important;
    background: #000000 !important;
}
html.a11y-high-contrast button:not(.a11y-close):not(.a11y-seg-btn),
html.a11y-high-contrast input[type="submit"],
html.a11y-high-contrast input[type="button"] {
    background: #000000 !important;
    color: #ffdd00 !important;
    border: 2px solid #ffdd00 !important;
    text-decoration: underline !important;
    background-image: none !important;
}
html.a11y-high-contrast input,
html.a11y-high-contrast select,
html.a11y-high-contrast textarea {
    background: #000000 !important;
    color: #ffffff !important;
    border: 2px solid #ffffff !important;
}
html.a11y-high-contrast img {
    filter: none;
}
/* Bright, unmistakable focus ring in high-contrast mode. */
html.a11y-high-contrast :focus-visible {
    outline: 4px solid #ffdd00 !important;
    outline-offset: 2px !important;
}
/* Keep the widget legible and on-brand even under high contrast. */
html.a11y-high-contrast .a11y-panel {
    background: #000000 !important;
    border: 2px solid #ffffff !important;
}
html.a11y-high-contrast .a11y-panel .a11y-row,
html.a11y-high-contrast .a11y-panel .a11y-seg {
    border-color: #ffffff !important;
    background: #000000 !important;
}
html.a11y-high-contrast .a11y-panel .a11y-row-text,
html.a11y-high-contrast .a11y-panel .a11y-panel-title,
html.a11y-high-contrast .a11y-panel .a11y-group-label {
    color: #ffffff !important;
}
html.a11y-high-contrast .a11y-seg button[aria-pressed="true"] {
    background: #ffdd00 !important;
    color: #000000 !important;
    border-color: #ffdd00 !important;
}
html.a11y-high-contrast .a11y-fab {
    background: #000000 !important;
    border: 2px solid #ffdd00 !important;
    color: #ffdd00 !important;
}

/* ---- 5c. REDUCE MOTION (opt-in only — does NOT follow the OS) ------
   Motion is ON by default for everyone, including visitors whose OS has
   "reduce motion" turned on. It is only reduced once the visitor
   explicitly turns on the "Reduce motion" toggle in this panel, which
   applies the class below. See a11y.js — the default no longer reads
   `prefers-reduced-motion`. */
html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
}

/* ---- 5d. READABLE (dyslexia-friendly) FONT ------------------------- */
/* Offline stack: Atkinson Hyperlegible if the user has it installed,
   otherwise Verdana — the same wide, distinct-letterform face the desktop
   companion uses for its dyslexia option (British Dyslexia Association
   recommended), so web + app read consistently. Comic Sans (also on the
   BDA list) is a last resort before the generic sans. No @import. */
html.a11y-readable-font :where(body, p, li, a, span, td, th, label,
    button, input, select, textarea, h1, h2, h3, h4, h5, h6,
    blockquote, figcaption, .container, .content) {
    font-family: "Atkinson Hyperlegible", Verdana, "Comic Sans MS",
        Tahoma, sans-serif !important;
    letter-spacing: 0.03em !important;
    line-height: 1.6 !important;
}
/* Leave the widget's own chrome on the site font for consistency. */
html.a11y-readable-font .a11y-fab,
html.a11y-readable-font .a11y-close {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* ---- 5e. UNDERLINE LINKS -------------------------------------------- */
/* Scoped to content links only — nav items and buttons already have
   strong non-underline affordances (borders/pills), and underlining
   those looks broken rather than helpful. `footer` is included because
   the homepage (index.html) has no <main>/.container/.content wrapper at
   all — without it, this toggle was a silent no-op on the most-visited
   page. The footer's link list (Fixes, Install guide, Privacy Policy,
   etc.) is plain text with no button styling, so underlining it is safe.
   The category tiles, the describe-chip pills, and the primary CTA
   buttons on the homepage are deliberately NOT in this list — they are
   plain <a> tags with no distinguishing class inside plain <div>s, so
   there's no clean way to include "real" content links from that same
   markup without also underlining those button/tile links; leaving the
   list as-is (nav/tiles/CTAs unmatched) is the safe under-reach. */
html.a11y-underline-links :where(main, article, .container, .content,
    .page, #content, footer, p, li, td, th, blockquote, figcaption) a:not(.wh-nav-cta):not(.describe-chip):not(.a11y-fab):not(.a11y-close) {
    text-decoration: underline !important;
    text-underline-offset: 2px;
}

/* ---- 5f. MORE SPACING (readable body text) -------------------------- */
html.a11y-spacing :where(body, p, li, td, th, span, a, label, blockquote,
    figcaption, dt, dd) {
    line-height: 1.7 !important;
    letter-spacing: 0.02em !important;
    word-spacing: 0.12em !important;
}
html.a11y-spacing :where(p, li) {
    margin-bottom: 0.9em;
}

/* ---- 5g. BIGGER BUTTONS / TARGETS ------------------------------------ */
/* !important: the site sets padding/sizing via inline styles on almost every
   button and link (see the large-text note above), so a plain declaration
   here would silently lose to those inline styles and the toggle would do
   nothing. */
html.a11y-big-targets :where(button, a, input[type="submit"],
    input[type="button"], input[type="checkbox"], input[type="radio"],
    select) {
    min-height: 44px !important;
    min-width: 44px !important;
    padding-top: max(10px, 0.6em) !important;
    padding-bottom: max(10px, 0.6em) !important;
}
/* Plain content <a> links default to display:inline, which ignores
   min-height/padding-block entirely — so the rule above is a no-op on them
   without this. Scoped to known non-flex content/CTA links (not a blanket
   `a` selector) so we never force inline-block onto a page's logo/brand
   link, which relies on its OWN flex layout for icon+text and would break
   if blockified to plain flow. */
html.a11y-big-targets :where(.describe-chip, .wh-footer-link, .wh-nav-cta) {
    display: inline-block !important;
}
/* Keep the widget's own compact controls (segmented buttons, close
   button, toggle rows) usable and un-distorted — they already meet the
   44px target via their own layout. These need !important too now: the
   base rule above gained !important (it has to, to beat the site's inline
   padding), so a non-important reset here would no longer win against it. */
html.a11y-big-targets .a11y-seg button,
html.a11y-big-targets .a11y-close,
html.a11y-big-targets .a11y-row input[type="checkbox"] {
    min-height: 0 !important;
    min-width: 0 !important;
    padding-top: initial !important;
    padding-bottom: initial !important;
}
html.a11y-big-targets .a11y-fab {
    min-height: 0 !important;
    min-width: 0 !important;
}

/* ---- 5h. LARGER TEXT (third step: Normal / Large / Larger) --------- */
/* Same `zoom` technique as 5a (large-text), scaled further. Mutually
   exclusive with a11y-large-text — a11y.js only ever applies one of the
   two textSize classes at a time. */
/* 1.3 rather than a full 1.4 — still a clear third step up from Large's 1.18,
   but a smaller jump keeps phone widths (360-414px) from overflowing
   horizontally on top of the overflow-x guard below. */
html.a11y-larger-text body {
    zoom: 1.3;
}
html.a11y-larger-text .a11y-fab,
html.a11y-larger-text .a11y-panel,
html.a11y-larger-text .a11y-skip-link,
html.a11y-larger-text .language-selector,
html.a11y-larger-text .wh-lang-selector {
    zoom: 0.769231;   /* 1 / 1.3 */
}
html.a11y-larger-text :where(p, li, td, th, span, a, h1, h2, h3, .container) {
    overflow-wrap: break-word;
    word-break: normal;
}
/* Text-zoom safety net: never let the zoomed page scroll horizontally
   (phone widths in particular have no margin to absorb the bump). Only
   overflow-x is hidden — overflow-y is left alone so content never clips
   vertically. */
html.a11y-larger-text,
html.a11y-larger-text body {
    overflow-x: hidden;
}
