/*! RespondAble Accessibility Menu v1.3.0 - page styles
 * Every rule is switched on by a data-ra-* attribute on <html>, set by the boot
 * script and the menu. With no attributes set, this file changes nothing.
 * Fonts and cursors load from this folder only (same origin).
 */

/* ---------- Fonts (SIL Open Font License, hosted with this file) ---------- */
@font-face { font-family: 'RA Readable'; src: url('fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'RA Readable'; src: url('fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: 'RA Dyslexic'; src: url('fonts/opendyslexic-latin-400-normal.woff2') format('woff2'); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: 'RA Dyslexic'; src: url('fonts/opendyslexic-latin-700-normal.woff2') format('woff2'); font-weight: 700; font-style: normal; font-display: swap; }

/* ---------- Text spacing (WCAG 1.4.12 values) ---------- */
html[data-ra-spacing] body *:not(ra-a11y-menu) { letter-spacing: 0.12em !important; word-spacing: 0.16em !important; }
html[data-ra-spacing] body p { margin-bottom: 2em !important; }

/* ---------- Line height ---------- */
html[data-ra-line-height="1"] body *:not(ra-a11y-menu) { line-height: 1.5 !important; }
html[data-ra-line-height="2"] body *:not(ra-a11y-menu) { line-height: 1.75 !important; }
html[data-ra-line-height="3"] body *:not(ra-a11y-menu) { line-height: 2 !important; }

/* ---------- Text alignment ---------- */
html[data-ra-align="left"] body *:not(ra-a11y-menu) { text-align: left !important; }
html[data-ra-align="center"] body *:not(ra-a11y-menu) { text-align: center !important; }
html[data-ra-align="right"] body *:not(ra-a11y-menu) { text-align: right !important; }

/* ---------- Readable and dyslexia-friendly fonts (icon fonts left alone) ---------- */
html[data-ra-font="readable"] body *:not(ra-a11y-menu):not([aria-hidden="true"]):not([class*="icon"]):not([class*="fa-"]):not(.material-icons):not(.material-symbols-outlined):not(code):not(pre):not(kbd) {
  font-family: 'RA Readable', Verdana, Tahoma, sans-serif !important;
}
html[data-ra-font="dyslexia"] body *:not(ra-a11y-menu):not([aria-hidden="true"]):not([class*="icon"]):not([class*="fa-"]):not(.material-icons):not(.material-symbols-outlined):not(code):not(pre):not(kbd) {
  font-family: 'RA Dyslexic', 'Comic Sans MS', Verdana, sans-serif !important;
}

/* ---------- Highlight links (WCAG 1.4.1) ---------- */
html[data-ra-links] body a[href],
html[data-ra-links] body [role="link"] {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 3px !important;
  background-color: #ffeb3b !important;
  color: #000 !important;
  outline: 1px solid #000 !important;
}

/* ---------- Pause animations (WCAG 2.2.2, 2.3.3) ---------- */
html[data-ra-pause] *,
html[data-ra-pause] *::before,
html[data-ra-pause] *::after {
  animation-play-state: paused !important;
  transition-duration: 0s !important;
  transition-delay: 0s !important;
  scroll-behavior: auto !important;
}

/* ---------- Hide images ---------- */
html[data-ra-hide-images] body img,
html[data-ra-hide-images] body picture,
html[data-ra-hide-images] body input[type="image"],
html[data-ra-hide-images] body [role="img"]:not(svg) { opacity: 0 !important; }
html[data-ra-hide-images] body *:not(ra-a11y-menu) { background-image: none !important; }

/* ---------- Strong focus outline (WCAG 2.4.7, 2.4.11, 2.4.13) ---------- */
html[data-ra-focus] { scroll-padding-top: var(--ra-sticky-top, 0px); scroll-padding-bottom: var(--ra-sticky-bottom, 0px); }
html[data-ra-focus] body *:not(ra-a11y-menu):focus-visible {
  outline: 3px solid #0b0c0c !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 3px #ffdd00 !important;
}

/* ---------- Larger click targets (WCAG 2.5.8) ---------- */
html[data-ra-targets] body :is(button, [role="button"], select, summary, [role="tab"], [role="menuitem"],
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]):not([type="range"])) {
  min-height: 44px !important;
  min-width: 44px !important;
}
html[data-ra-targets] body input:is([type="checkbox"], [type="radio"]) { width: 24px !important; height: 24px !important; }
html[data-ra-targets] body :is(nav, [role="navigation"]) a[href] { display: inline-block !important; padding-top: 0.6em !important; padding-bottom: 0.6em !important; }
html[data-ra-targets] body p a[href], html[data-ra-targets] body li a[href] { line-height: 2 !important; }

/* ---------- Large cursor ---------- */
html[data-ra-cursor="black"], html[data-ra-cursor="black"] * { cursor: url('cursors/arrow-black.svg') 7 4, auto !important; }
html[data-ra-cursor="white"], html[data-ra-cursor="white"] * { cursor: url('cursors/arrow-white.svg') 7 4, auto !important; }
html[data-ra-cursor="black"] :is(a[href], button, [role="button"], [role="link"], label, select, summary, input[type="checkbox"], input[type="radio"], input[type="submit"], input[type="button"]) { cursor: url('cursors/hand-black.svg') 17 3, pointer !important; }
html[data-ra-cursor="white"] :is(a[href], button, [role="button"], [role="link"], label, select, summary, input[type="checkbox"], input[type="radio"], input[type="submit"], input[type="button"]) { cursor: url('cursors/hand-white.svg') 17 3, pointer !important; }
html[data-ra-cursor] :is(input:not([type]), input[type="text"], input[type="email"], input[type="search"], input[type="tel"], input[type="url"], input[type="password"], input[type="number"], textarea, [contenteditable="true"]) { cursor: text !important; }

/* ---------- Contrast modes ---------- */
html[data-ra-contrast="dark"] body,
html[data-ra-contrast="dark"] body *:not(ra-a11y-menu):not(img):not(video):not(picture):not(canvas):not(iframe) {
  background-color: #000 !important; color: #fff !important; border-color: #fff !important;
}
html[data-ra-contrast="dark"] body :is(a[href], a[href] *, [role="link"]) { color: #ffeb3b !important; }
html[data-ra-contrast="light"] body,
html[data-ra-contrast="light"] body *:not(ra-a11y-menu):not(img):not(video):not(picture):not(canvas):not(iframe) {
  background-color: #fff !important; color: #000 !important; border-color: #000 !important;
}
html[data-ra-contrast="light"] body :is(a[href], a[href] *, [role="link"]) { color: #0645ad !important; text-decoration: underline !important; }

/* Invert and saturation share one filter on <html>. A filter on the root element does
   not break position: fixed, unlike a filter on <body>. */
html[data-ra-contrast="invert"] { --ra-f-invert: invert(1) hue-rotate(180deg); }
html[data-ra-saturation="low"] { --ra-f-sat: saturate(0.5); }
html[data-ra-saturation="high"] { --ra-f-sat: saturate(2); }
html[data-ra-saturation="gray"] { --ra-f-sat: grayscale(1); }
html[data-ra-contrast="invert"], html[data-ra-saturation] { filter: var(--ra-f-invert, ) var(--ra-f-sat, ) !important; }
/* Re-invert media so photos and video look normal (the menu re-inverts itself) */
html[data-ra-contrast="invert"] :is(img, video, canvas, iframe) { filter: invert(1) hue-rotate(180deg) !important; }

/* Windows high-contrast / forced colors: the system palette wins; drop our filters */
@media (forced-colors: active) {
  html[data-ra-contrast], html[data-ra-saturation] { filter: none !important; }
  html[data-ra-contrast] :is(img, video, canvas, iframe) { filter: none !important; }
}

/* ---------- Captions (WCAG 1.2.2) ---------- */
html[data-ra-cue-size="1"] ::cue { font-size: 150%; }
html[data-ra-cue-size="2"] ::cue { font-size: 200%; }
html[data-ra-cue-bg] ::cue { background-color: #000 !important; color: #fff !important; }

/* ---------- Generated helpers: transcripts, glossary terms, read-aloud highlight ---------- */
.ra-transcript { margin: 0.75em 0 1.25em; border: 1px solid currentColor; border-radius: 6px; padding: 0.5em 0.75em; max-width: 100%; }
.ra-transcript > summary { cursor: pointer; font-weight: 700; padding: 0.25em 0; }
.ra-transcript ol { list-style: none; margin: 0.5em 0 0; padding: 0; max-height: 18em; overflow: auto; }
.ra-transcript li { display: flex; gap: 0.75em; align-items: baseline; padding: 0.2em 0; }
.ra-transcript button { font: inherit; font-variant-numeric: tabular-nums; border: 1px solid currentColor; border-radius: 4px; background: transparent; color: inherit; padding: 0.1em 0.4em; cursor: pointer; flex: none; }
.ra-term { text-decoration: underline dotted 2px !important; text-underline-offset: 3px !important; cursor: help !important; }
.ra-term:hover, .ra-term[aria-expanded="true"] { background-color: #fff3b0 !important; color: #000 !important; }
[data-ra-reading] { outline: 3px dashed #1a5fb4 !important; outline-offset: 3px !important; }
::highlight(ra-word) { background-color: #ffdd00; color: #000; }

/* ---------- Script-driven motion frozen by "Pause animations" ---------- */
[data-ra-fz-transform] { transform: var(--ra-fz-transform) !important; }
[data-ra-fz-translate] { translate: var(--ra-fz-translate) !important; }
[data-ra-fz-left] { left: var(--ra-fz-left) !important; }
[data-ra-fz-top] { top: var(--ra-fz-top) !important; }
[data-ra-fz-margin-left] { margin-left: var(--ra-fz-margin-left) !important; }
[data-ra-fz-margin-top] { margin-top: var(--ra-fz-margin-top) !important; }
[data-ra-fz-transform], [data-ra-fz-left], [data-ra-fz-top], [data-ra-fz-margin-left], [data-ra-fz-margin-top], [data-ra-fz-translate] { transition: none !important; }
