/* ── VitalAILabs accessibility layer ─────────────────────────────────
   Contract: with the footer toggle OFF (html has no data-a11y attribute)
   this file changes NOTHING except rendering the small footer toggle
   itself. Every enhancement is scoped under html[data-a11y="on"] or the
   fine-tune attributes (data-a11y-textsize / -motion / -font), which are
   only ever set while the toggle is on.
   State lives in localStorage under "val-a11y" (per visitor). */

/* ── Footer toggle + options (the always-visible affordance) ── */
.a11y-controls {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.a11y-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  opacity: 0.75;
}
.a11y-toggle:hover { opacity: 1; }
.a11y-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  border-radius: 4px;
  opacity: 1;
}
.a11y-toggle-track {
  position: relative;
  width: 30px;
  height: 16px;
  border-radius: 8px;
  border: 1px solid currentColor;
  flex: none;
  transition: background 0.15s;
}
.a11y-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
  transition: left 0.15s;
}
.a11y-toggle[aria-checked="true"] .a11y-toggle-track::after { left: 16px; }
.a11y-toggle[aria-checked="true"] { opacity: 1; }

.a11y-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 16px;
  padding: 10px 14px;
  border: 1px solid currentColor;
  border-radius: 10px;
  max-width: 640px;
}
.a11y-panel[hidden] { display: none; }
.a11y-panel label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.a11y-panel input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: currentColor;
  cursor: pointer;
}
.a11y-seg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.a11y-seg-label { margin-right: 2px; }
.a11y-seg button {
  background: none;
  border: 1px solid currentColor;
  border-radius: 6px;
  color: inherit;
  cursor: pointer;
  padding: 2px 8px;
  font-family: inherit;
  font-size: 11px;
  line-height: 1.4;
  opacity: 0.8;
}
.a11y-seg button[aria-pressed="true"] {
  opacity: 1;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.a11y-seg button:nth-child(2) { font-size: 13px; }
.a11y-seg button:nth-child(3) { font-size: 15px; }
.a11y-reset {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  opacity: 0.8;
}
.a11y-reset:hover { opacity: 1; }
.a11y-panel a { color: inherit; }
.a11y-panel :is(button, input, a):focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.a11y-status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Skip link (active only in accessibility mode) ── */
.a11y-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
}
html[data-a11y="on"] .a11y-skip:focus {
  left: 16px;
  top: 16px;
  padding: 12px 20px;
  background: #12343b;
  color: #f8f4ec;
  border: 2px solid #e1b382;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  outline: none;
}

/* ── Mode ON: strong visible focus everywhere ── */
html[data-a11y="on"] :is(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--amber, #e8912d) !important;
  outline-offset: 2px !important;
}
/* The skip link parks focus on <main tabindex="-1">; no ring on the container. */
html[data-a11y="on"] main[tabindex]:focus,
html[data-a11y="on"] main[tabindex]:focus-visible {
  outline: none !important;
}

/* ── Mode ON: contrast boost ──
   Dark editorial pages (landing/what/how/why/case-studies/contact/newsletter). */
html[data-a11y="on"][data-theme="dark"] {
  --text: #f4eee2;
  --text-muted: #c0b7a6;
  --border: rgba(225, 179, 130, 0.28);
  --divider-a: rgba(225, 179, 130, 0.45);
}
/* Light pages (vaultiq) use a different variable set. */
html[data-a11y="on"]:not([data-theme="dark"]) {
  --text-light: #5c6b80;
  --text-secondary: #3d4a5c;
}
/* The footer address line fails 4.5:1 on every page (12px at 0.6 opacity). */
html[data-a11y="on"] .footer-text {
  opacity: 1;
  font-size: 13px;
}
/* Footer legal links ship with inline opacity:0.6; restore full contrast in mode. */
html[data-a11y="on"] .footer-text a {
  opacity: 1 !important;
}

/* ── Mode ON: underline links inside body copy ── */
html[data-a11y="on"] :is(p, li, td) a:not([class]) {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Text size (opt-in, zoom keeps px-based layouts intact) ── */
html[data-a11y-textsize="1"] body { zoom: 1.1; }
html[data-a11y-textsize="2"] body { zoom: 1.25; }

/* ── Reduce motion (opt-in or inherited from OS preference) ── */
html[data-a11y-motion="reduce"] *,
html[data-a11y-motion="reduce"] *::before,
html[data-a11y-motion="reduce"] *::after {
  animation-duration: 0.01ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.01ms !important;
  transition-delay: 0s !important;
}
html[data-a11y-motion="reduce"] { scroll-behavior: auto !important; }
/* Decorative animated hero canvas: hide rather than let it keep moving. */
html[data-a11y-motion="reduce"] #heroCanvas { display: none; }

/* ── Readable font (opt-in) ── */
html[data-a11y-font="readable"] body,
html[data-a11y-font="readable"] body * {
  font-family: Verdana, "Segoe UI", Arial, sans-serif !important;
  letter-spacing: normal !important;
}
