/* ==========================================================================
   Global Accessibility Overrides
   Lazy-loaded dynamically when the Accessibility Toolkit is enabled.
   ========================================================================== */

/* ── Text Size ── */
html[data-a11y-text="sm"] {
  font-size: 75% !important;
}

html[data-a11y-text="md"] {
  font-size: 90% !important;
}

html[data-a11y-text="lg"] {
  font-size: 105% !important;
}

html[data-a11y-text="xl"] {
  font-size: 120% !important;
}

/* ── Text Spacing (WCAG 1.4.12) ── */
html[data-a11y-spacing="sm"] * {
  line-height: 1.35 !important;
  letter-spacing: -0.01em !important;
  word-spacing: normal !important;
}

html[data-a11y-spacing="sm"] p {
  margin-bottom: 1em !important;
}

html[data-a11y-spacing="lg"] * {
  line-height: 1.65 !important;
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
}

html[data-a11y-spacing="lg"] p {
  margin-bottom: 2em !important;
}

html[data-a11y-spacing="xl"] * {
  line-height: 1.95 !important;
  letter-spacing: 0.16em !important;
  word-spacing: 0.22em !important;
}

html[data-a11y-spacing="xl"] p {
  margin-bottom: 2.5em !important;
}

/* ── Dyslexic-Friendly Font ── */
html[data-a11y-dyslexic],
html[data-a11y-dyslexic] body,
html[data-a11y-dyslexic] p,
html[data-a11y-dyslexic] li,
html[data-a11y-dyslexic] span,
html[data-a11y-dyslexic] button,
html[data-a11y-dyslexic] input,
html[data-a11y-dyslexic] label {
  font-family: 'Atkinson Hyperlegible', 'Inter', ui-sans-serif, system-ui, sans-serif !important;
}

/* ── High Contrast Mode ── */
html[data-a11y-contrast] {
  --color-bg: #0F172A !important;
  --color-bg-subtle: #1E293B !important;
  --color-bg-muted: #334155 !important;
  --color-text-primary: #FFFFFF !important;
  --color-text-secondary: #F8FAFC !important;
  --color-text-muted: #CBD5E1 !important;
  --color-border: rgba(255, 255, 255, 0.25) !important;
  --color-border-mid: rgba(255, 255, 255, 0.35) !important;
  background-color: #0F172A !important;
  color: #FFFFFF !important;
}

html[data-a11y-contrast] body,
html[data-a11y-contrast] main,
html[data-a11y-contrast] section,
html[data-a11y-contrast] header,
html[data-a11y-contrast] header.site-navbar,
html[data-a11y-contrast] footer,
html[data-a11y-contrast] nav,
html[data-a11y-contrast] article,
html[data-a11y-contrast] aside,
html[data-a11y-contrast] form,
html[data-a11y-contrast] .page-hero,
html[data-a11y-contrast] [class*="bg-white"],
html[data-a11y-contrast] [class*="bg-[#F"],
html[data-a11y-contrast] [class*="bg-[#f"],
html[data-a11y-contrast] [class*="bg-[#E"],
html[data-a11y-contrast] [class*="bg-[#e"],
html[data-a11y-contrast] [class*="bg-slate-50"],
html[data-a11y-contrast] [class*="bg-slate-100"],
html[data-a11y-contrast] [class*="bg-slate-900"],
html[data-a11y-contrast] [class*="bg-slate-950"],
html[data-a11y-contrast] [class*="bg-gray-50"],
html[data-a11y-contrast] [class*="bg-gray-100"] {
  background-color: #0F172A !important;
  color: #FFFFFF !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}

/* Structural cards / containers in High Contrast */
html[data-a11y-contrast] div.rounded-xl,
html[data-a11y-contrast] div.rounded-lg,
html[data-a11y-contrast] div.rounded-\[1\.125rem\],
html[data-a11y-contrast] div.rounded-\[1\.25rem\],
html[data-a11y-contrast] .mobile-panel {
  background-color: #1E293B !important;
  border-color: rgba(255, 255, 255, 0.3) !important;
}

/* Logo visibility in High Contrast */
html[data-a11y-contrast] .site-navbar__logo {
  filter: brightness(0) invert(1) !important;
}

/* Headings & accent text in High Contrast */
html[data-a11y-contrast] h1,
html[data-a11y-contrast] h2,
html[data-a11y-contrast] h3,
html[data-a11y-contrast] h4,
html[data-a11y-contrast] h5,
html[data-a11y-contrast] h6,
html[data-a11y-contrast] .text-section,
html[data-a11y-contrast] .eyebrow,
html[data-a11y-contrast] [class*="text-navy"],
html[data-a11y-contrast] [class*="text-slate-9"],
html[data-a11y-contrast] [class*="text-slate-8"],
html[data-a11y-contrast] [class*="text-slate-7"] {
  color: #FACC15 !important;
}

/* Body text & spans */
html[data-a11y-contrast] p,
html[data-a11y-contrast] li,
html[data-a11y-contrast] span:not(.a11y-pill *):not(.a11y-drawer *),
html[data-a11y-contrast] label,
html[data-a11y-contrast] td,
html[data-a11y-contrast] th {
  color: #FFFFFF !important;
}

/* Links & interactive elements */
html[data-a11y-contrast] a:not(.a11y-pill *):not(.a11y-drawer *) {
  color: #FACC15 !important;
}

/* Drawer contrast adaptations */
html[data-a11y-contrast] .a11y-drawer {
  background-color: #0F172A !important;
  border-color: rgba(250, 204, 21, 0.4) !important;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(250, 204, 21, 0.3) !important;
}

html[data-a11y-contrast] .a11y-drawer__title,
html[data-a11y-contrast] .a11y-label,
html[data-a11y-contrast] .a11y-toggle__text,
html[data-a11y-contrast] .a11y-step-val,
html[data-a11y-contrast] .a11y-enable-card__title {
  color: #FFFFFF !important;
}

html[data-a11y-contrast] .a11y-toggle__sub,
html[data-a11y-contrast] .a11y-enable-card__desc {
  color: #FACC15 !important;
}

html[data-a11y-contrast] .a11y-stepper {
  background: #1E293B !important;
  border-color: rgba(255, 255, 255, 0.2) !important;
}

html[data-a11y-contrast] .a11y-step-btn {
  color: #FFFFFF !important;
}

html[data-a11y-contrast] .a11y-reset-btn {
  border-color: rgba(250, 204, 21, 0.5) !important;
  color: #FACC15 !important;
}

/* ── Underline Links ── */
html[data-a11y-underline] a,
html[data-a11y-underline] a *,
html[data-a11y-underline] [role="link"] {
  text-decoration: underline !important;
  text-decoration-thickness: 2.5px !important;
  text-underline-offset: 4px !important;
  text-decoration-style: solid !important;
  text-decoration-color: #006EDF !important;
}

html[data-a11y-underline][data-a11y-contrast] a,
html[data-a11y-underline][data-a11y-contrast] a *,
html[data-a11y-underline][data-a11y-contrast] [role="link"] {
  text-decoration-color: #FACC15 !important;
}

/* ── Large Cursor ── */
html[data-a11y-cursor],
html[data-a11y-cursor] * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M6 2L6 26L12 20L17 30L20 28.5L15 18.5L23 18.5Z' fill='%230A0F1E' stroke='%23FFFFFF' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 6 2, auto !important;
}

/* ── Reduce Motion ── */
html[data-a11y-motion="true"] *,
html[data-a11y-motion="true"] *::before,
html[data-a11y-motion="true"] *::after {
  animation-duration: 1ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 1ms !important;
  transition-delay: 0ms !important;
  scroll-behavior: auto !important;
}

html[data-a11y-motion="true"] ::view-transition-old(page-content),
html[data-a11y-motion="true"] ::view-transition-new(page-content) {
  animation: none !important;
}