/* Accessibility widget v2 */
.a11y-sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .a11y-btn, .a11y-panel, .a11y-opt, .a11y-size-btn, .a11y-reset, .a11y-close {
    transition: none !important;
  }
}

:root {
  --a11y-primary: #1a5490;
  --a11y-primary-dark: #133e6c;
  --a11y-accent: #ffa726;
  --a11y-bg: #ffffff;
  --a11y-bg-alt: #f4f7fb;
  --a11y-border: #d8dee8;
  --a11y-text: #1a1f2e;
  --a11y-text-muted: #5a6478;
}

.a11y-btn {
  position: fixed; top: 50%; right: 0; transform: translateY(-50%);
  z-index: 9998;
  width: 52px; height: 52px;
  background: var(--a11y-primary); color: #fff;
  border: none; border-radius: 10px 0 0 10px;
  cursor: pointer; padding: 0;
  display: grid; place-items: center;
  box-shadow: -3px 4px 14px rgba(26,84,144,0.32);
  transition: width 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}
.a11y-btn:hover, .a11y-btn:focus-visible {
  width: 58px; outline: none;
  background: var(--a11y-primary-dark);
  box-shadow: -4px 6px 18px rgba(26,84,144,0.45);
}
.a11y-btn svg { width: 30px; height: 30px; }

/* Panel */
.a11y-panel {
  position: fixed; top: 50%; right: 64px; transform: translateY(-50%) translateX(20px);
  z-index: 9999;
  width: 360px; max-width: calc(100vw - 80px);
  max-height: 85vh;
  background: var(--a11y-bg); color: var(--a11y-text);
  border: 1px solid var(--a11y-border); border-radius: 14px;
  box-shadow: 0 16px 48px rgba(15,23,42,0.22), 0 4px 12px rgba(15,23,42,0.08);
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s cubic-bezier(0.2,0.8,0.2,1);
  font-family: 'Rubik', system-ui, -apple-system, Arial, sans-serif;
  font-size: 14px;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.a11y-panel.open { opacity: 1; pointer-events: auto; transform: translateY(-50%) translateX(0); }

.a11y-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--a11y-primary), var(--a11y-primary-dark));
  color: #fff;
  border-bottom: 1px solid var(--a11y-border);
}
.a11y-head-title { display: flex; align-items: center; gap: 10px; }
.a11y-head-title svg { width: 22px; height: 22px; }
.a11y-head-title h3 { font-size: 16px; font-weight: 700; margin: 0; }
.a11y-close {
  background: rgba(255,255,255,0.18); color: #fff;
  border: none; border-radius: 50%; width: 30px; height: 30px;
  cursor: pointer; display: grid; place-items: center;
  transition: background 0.15s ease;
}
.a11y-close:hover { background: rgba(255,255,255,0.32); }
.a11y-close svg { width: 16px; height: 16px; }

.a11y-body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.a11y-body::-webkit-scrollbar { width: 8px; }
.a11y-body::-webkit-scrollbar-thumb { background: var(--a11y-border); border-radius: 4px; }

.a11y-section { margin-bottom: 16px; }
.a11y-section:last-child { margin-bottom: 0; }
.a11y-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  color: var(--a11y-primary); letter-spacing: 0.06em;
  margin-bottom: 8px; padding-right: 4px;
}

.a11y-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.a11y-grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.a11y-opt {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px;
  background: var(--a11y-bg-alt); color: var(--a11y-text);
  border: 1.5px solid transparent;
  border-radius: 8px; cursor: pointer;
  font-family: inherit; font-size: 12.5px; font-weight: 500;
  text-align: right;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  min-height: 38px;
  position: relative;
}
.a11y-opt:hover { background: #e8edf5; }
.a11y-opt svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; }
.a11y-opt.active {
  background: var(--a11y-primary); color: #fff;
  border-color: var(--a11y-primary-dark);
}
.a11y-opt.active svg { opacity: 1; }
.a11y-opt.active::after {
  content: "✓"; position: absolute; top: 2px; left: 4px;
  font-size: 10px; font-weight: 700;
}

.a11y-size-row {
  display: flex; align-items: center; gap: 6px;
  background: var(--a11y-bg-alt); border-radius: 8px; padding: 6px;
}
.a11y-size-btn {
  flex: 0 0 auto; width: 34px; height: 34px;
  background: #fff; color: var(--a11y-primary);
  border: 1.5px solid var(--a11y-border); border-radius: 6px;
  cursor: pointer; font-size: 16px; font-weight: 700;
  font-family: inherit;
  display: grid; place-items: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.a11y-size-btn:hover { background: var(--a11y-primary); color: #fff; border-color: var(--a11y-primary); }
.a11y-size-label {
  flex: 1; text-align: center; font-size: 13px; font-weight: 600;
  color: var(--a11y-text);
}

.a11y-foot { padding: 12px 16px; border-top: 1px solid var(--a11y-border); background: var(--a11y-bg-alt); }
.a11y-reset {
  width: 100%; padding: 10px;
  background: #c0392b; color: #fff; border: none;
  border-radius: 8px; cursor: pointer; font-family: inherit;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background 0.15s ease;
}
.a11y-reset:hover { background: #a5311e; }
.a11y-reset svg { width: 14px; height: 14px; }
.a11y-statement {
  display: block; margin-top: 10px;
  text-align: center; font-size: 12px;
  color: var(--a11y-primary); text-decoration: underline;
}
.a11y-statement:hover { color: var(--a11y-primary-dark); }

/* Reading ruler */
.a11y-ruler {
  position: fixed; left: 0; right: 0; height: 60px;
  background: rgba(255,235,59,0.18); pointer-events: none;
  z-index: 9997; display: none;
  border-top: 2px solid rgba(255,193,7,0.55);
  border-bottom: 2px solid rgba(255,193,7,0.55);
}
html.a11y-ruler .a11y-ruler { display: block; }

@media (max-width: 600px) {
  .a11y-panel { width: 320px; right: 64px; }
  .a11y-grid { gap: 5px; }
  .a11y-opt { font-size: 12px; padding: 8px; }
}

/* === Mode classes applied to <html> === */

/* Text size — site uses absolute px throughout, so zoom is the only reliable scaler */
html.a11y-fs-1 body { zoom: 1.08; }
html.a11y-fs-2 body { zoom: 1.16; }
html.a11y-fs-3 body { zoom: 1.24; }
html.a11y-fs-4 body { zoom: 1.34; }
html.a11y-fs-5 body { zoom: 1.45; }

/* Keep widget at native size regardless of zoom level */
html.a11y-fs-1 .a11y-btn, html.a11y-fs-1 .a11y-panel, html.a11y-fs-1 .a11y-ruler { zoom: calc(1 / 1.08); }
html.a11y-fs-2 .a11y-btn, html.a11y-fs-2 .a11y-panel, html.a11y-fs-2 .a11y-ruler { zoom: calc(1 / 1.16); }
html.a11y-fs-3 .a11y-btn, html.a11y-fs-3 .a11y-panel, html.a11y-fs-3 .a11y-ruler { zoom: calc(1 / 1.24); }
html.a11y-fs-4 .a11y-btn, html.a11y-fs-4 .a11y-panel, html.a11y-fs-4 .a11y-ruler { zoom: calc(1 / 1.34); }
html.a11y-fs-5 .a11y-btn, html.a11y-fs-5 .a11y-panel, html.a11y-fs-5 .a11y-ruler { zoom: calc(1 / 1.45); }

/* Line spacing */
html.a11y-line *,
html.a11y-line { line-height: 1.9 !important; }
html.a11y-line-tight * { line-height: 1.3 !important; }

/* Letter spacing */
html.a11y-letter * { letter-spacing: 0.08em !important; }

/* Word spacing */
html.a11y-word * { word-spacing: 0.18em !important; }

/* High contrast */
html.a11y-contrast body,
html.a11y-contrast section,
html.a11y-contrast footer,
html.a11y-contrast nav,
html.a11y-contrast .menu-card,
html.a11y-contrast .info-card,
html.a11y-contrast .rev,
html.a11y-contrast .rev-card,
html.a11y-contrast .story-quote,
html.a11y-contrast .stick-cta,
html.a11y-contrast .nav-modal-sheet { background: #fff !important; }
html.a11y-contrast body, html.a11y-contrast *:not(.a11y-panel):not(.a11y-panel *):not(.a11y-btn):not(.a11y-btn *) {
  color: #000 !important; border-color: #000 !important; text-shadow: none !important;
}
html.a11y-contrast a,
html.a11y-contrast strong { color: #00339a !important; }

/* Inverted contrast */
html.a11y-invert { filter: invert(1) hue-rotate(180deg); background: #fff; }
html.a11y-invert img, html.a11y-invert video, html.a11y-invert iframe,
html.a11y-invert .a11y-btn, html.a11y-invert .a11y-panel { filter: invert(1) hue-rotate(180deg); }

/* Grayscale */
html.a11y-grayscale { filter: grayscale(1); }
html.a11y-grayscale .a11y-btn, html.a11y-grayscale .a11y-panel { filter: grayscale(0); }

/* Low saturation */
html.a11y-desat { filter: saturate(0.3); }
html.a11y-desat .a11y-btn, html.a11y-desat .a11y-panel { filter: saturate(1); }

/* Highlight links */
html.a11y-links a, html.a11y-links a * { text-decoration: underline !important; font-weight: 700 !important; }
html.a11y-links a { outline: 2px dashed currentColor; outline-offset: 2px; }

/* Highlight headings */
html.a11y-headings h1, html.a11y-headings h2, html.a11y-headings h3, html.a11y-headings h4, html.a11y-headings h5 {
  outline: 2px solid #1a5490 !important;
  background: rgba(26,84,144,0.08) !important;
  padding: 4px 8px !important;
}

/* Readable font */
html.a11y-readable, html.a11y-readable *:not(.a11y-panel):not(.a11y-panel *):not(.a11y-btn):not(.a11y-btn *) {
  font-family: Arial, Helvetica, sans-serif !important;
}

/* Dyslexia-friendly font (Verdana fallback — wide spacing, clear letter shapes) */
html.a11y-dyslexia, html.a11y-dyslexia *:not(.a11y-panel):not(.a11y-panel *):not(.a11y-btn):not(.a11y-btn *) {
  font-family: 'Verdana', 'Tahoma', sans-serif !important;
  letter-spacing: 0.05em !important;
  word-spacing: 0.1em !important;
}

/* Big cursor */
html.a11y-cursor, html.a11y-cursor *,
html.a11y-cursor a, html.a11y-cursor button {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'><path d='M3 2l7 18 2-8 8-2z' fill='%23000' stroke='%23fff' stroke-width='1.5'/></svg>") 4 4, auto !important;
}

/* Strong focus */
html.a11y-focus *:focus, html.a11y-focus *:focus-visible {
  outline: 3px solid #ffa726 !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 3px rgba(255,167,38,0.4) !important;
}

/* Stop animations */
html.a11y-no-motion *, html.a11y-no-motion *::before, html.a11y-no-motion *::after {
  animation-duration: 0.001s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001s !important;
  scroll-behavior: auto !important;
}

/* Hide images */
html.a11y-no-img img, html.a11y-no-img video, html.a11y-no-img picture, html.a11y-no-img iframe {
  visibility: hidden !important;
}

/* Focus styles inside panel */
.a11y-btn:focus-visible, .a11y-panel button:focus-visible, .a11y-panel a:focus-visible {
  outline: 3px solid var(--a11y-accent); outline-offset: 2px;
}
