/* Accessibility panel - self-hosted stand-in for the third-party overlay
 * (UserWay) used on the old practice website. Two halves:
 *   1. The panel itself, injected into the header by a11y.js. It reuses the
 *      menu-panel and band-btn patterns so it follows the scheme tokens.
 *   2. The effect classes a11y.js sets on <html>. The forced light/dark
 *      scheme is NOT here - it is the data-scheme token blocks in styles.css.
 */

/* -- Panel ------------------------------------------------------------------ */
.a11y .menu-panel {
  right: -50px;
  width: min(340px, calc(100vw - 32px));
  max-height: min(74vh, 560px); overflow: auto;
  padding: 14px;
}
@media (max-width: 24em) { .a11y .menu-panel { right: -58px; } }
.a11y-title {
  font-family: var(--chmg-font-mono); font-size: 0.6875rem; font-weight: 500;
  letter-spacing: 0.14em; color: var(--eyebrow); margin: 2px 0 12px;
}
.a11y-group { padding: 10px 0; border-top: 1px solid var(--hairline); }
.a11y-label { margin: 0 0 8px; font-size: 0.875rem; font-weight: 600; }
.a11y-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.a11y-seg-3 { grid-template-columns: repeat(3, 1fr); }
.a11y-seg .band-btn {
  font-family: var(--chmg-font); font-size: 0.75rem;
  min-height: 40px; padding: 6px 2px;
}
.a11y-switch {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 9px 2px; cursor: pointer; text-align: left;
  font: inherit; font-size: 0.9375rem; color: var(--text);
  background: none; border: 0;
}
.a11y-switch:hover .a11y-knob { border-color: var(--practice); }
.a11y-knob {
  flex: none; width: 40px; height: 24px; border-radius: 12px; position: relative;
  background: var(--page-bg); border: 1px solid var(--hairline);
}
.a11y-knob::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--secondary-text);
  transition: left 0.12s ease-out;
}
.a11y-switch[aria-pressed="true"] .a11y-knob {
  background: var(--selected-bg); border-color: var(--selected-bg);
}
.a11y-switch[aria-pressed="true"] .a11y-knob::after {
  left: 19px; background: var(--selected-ink);
}
.a11y-reset {
  display: block; margin: 8px 0 0; padding: 8px 0; cursor: pointer;
  font: inherit; font-size: 0.9375rem;
  background: none; color: var(--link); border: 0;
  text-decoration: underline; text-underline-offset: 3px;
}
.a11y-privacy {
  margin: 10px 0 0; color: var(--secondary-text);
  font-family: var(--chmg-font-mono); font-size: 0.6875rem;
  letter-spacing: 0.03em; text-transform: uppercase;
}

/* -- Text size: everything on the page is rem-based, so scaling the root
      scales the lot, exactly like browser text-size settings ---------------- */
html.a11y-size-1 { font-size: 112.5%; }
html.a11y-size-2 { font-size: 125%; }
html.a11y-size-3 { font-size: 150%; }

/* -- Highlight links. :not(:focus) keeps the NHS yellow focus state on top -- */
html.a11y-links main a:not(:focus),
html.a11y-links .site-footer a:not(:focus) {
  background: var(--hl-bg);
  text-decoration-thickness: 3px !important;
  border-radius: 3px; padding: 0.05em 0.18em; margin: 0 -0.05em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* -- Space out the text (WCAG 1.4.12 values). Content only: the wordmark
      flag keeps its measured tracking, the panel stays compact -------------- */
html.a11y-spacing main,
html.a11y-spacing .site-footer {
  letter-spacing: 0.12em; word-spacing: 0.16em; line-height: 1.8;
}
html.a11y-spacing main h1, html.a11y-spacing main h2,
html.a11y-spacing main h3, html.a11y-spacing main h4 {
  letter-spacing: 0.03em; line-height: 1.4;
}
html.a11y-spacing main p, html.a11y-spacing main li { margin-bottom: 1.2em; }
html.a11y-spacing .a11y-panel { letter-spacing: normal; word-spacing: normal; }

/* -- Plainer font. The British Dyslexia Association guidance asks for a
      plain, familiar sans-serif - not a specialty "dyslexia font" ----------- */
html.a11y-font main,
html.a11y-font .site-footer {
  font-family: Verdana, Arial, sans-serif;
}

/* -- Reading ruler: a clear band following the pointer, the rest dimmed.
      Sits under the header panels (z 20) so open menus stay readable -------- */
.a11y-ruler-band {
  position: fixed; left: 0; right: 0; top: 38vh; height: 7.5rem;
  z-index: 18; pointer-events: none;
  box-shadow: 0 0 0 200vmax rgba(5, 24, 31, 0.45);
}

/* -- Bigger pointer. Data URIs are allowed by the CSP (img-src 'self' data:);
      ink fill with a white edge stays visible on both schemes --------------- */
html.a11y-cursor body,
html.a11y-cursor body * {
  cursor: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='42'%20height='42'%20viewBox='0%200%2024%2024'%3E%3Cpath%20d='M5.5%201.6v19l4.3-4.1%202.6%206%202.8-1.2-2.6-6h6z'%20fill='%2316232B'%20stroke='%23FFFFFF'%20stroke-width='1.5'%20stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, auto !important;
}
html.a11y-cursor input, html.a11y-cursor textarea { cursor: text !important; }

/* -- Stop movement: the manual twin of prefers-reduced-motion --------------- */
html.a11y-no-motion *,
html.a11y-no-motion *::before,
html.a11y-no-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}
html.a11y-no-motion .fig-grid svg { opacity: 1 !important; transform: none !important; }
