/*!
 * Accessibility Options — widget styles
 * https://wordpress.org/plugins/accessibility-options/
 */

:root {
  --a11y-navy:        #1e1b4b;
  --a11y-navy-soft:   rgba(255,255,255,.18);
  --a11y-bg:          #eef0fb;
  --a11y-card:        #ffffff;
  --a11y-card-fg:     #1f2937;
  --a11y-card-mute:   #f3f4f6;
  --a11y-active:      #1e1b4b;
  --a11y-active-fg:   #ffffff;
  --a11y-reset-bg:    #dbe2f9;
  --a11y-reset-bg-h:  #c7d2f0;
  --a11y-shadow-pill: 0 10px 30px rgba(0,0,0,.18);
  --a11y-shadow-panel:0 24px 60px rgba(15,23,42,.28);
  --a11y-z:           2147483600;
}

/* Launcher — true circle by default, expands to pill on hover/focus.
   All critical properties use !important to survive host theme overrides
   (Bootstrap, SP Page Builder, Helix, etc.). */
.a11y-widget { position: fixed; left: 20px; bottom: 20px; z-index: var(--a11y-z);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--a11y-card-fg); }
.a11y-widget__btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 80px !important;
  height: 80px !important;
  padding: 0 18px !important;
  margin: 0 !important;
  background: var(--a11y-navy) !important;
  color: #fff !important;
  border: 0 !important;
  border-radius: 50% !important;
  cursor: pointer !important;
  box-shadow: var(--a11y-shadow-pill);
  font: 600 15px/1 inherit;
  text-transform: none !important;
  transition: transform .15s, box-shadow .15s, border-radius .25s ease, padding .25s ease;
}
.a11y-widget__btn:hover,
.a11y-widget__btn:focus-visible {
  border-radius: 999px !important;
  padding: 0 22px 0 16px !important;
  justify-content: flex-start !important;
}
.a11y-widget__btn:hover  { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(0,0,0,.22); }
.a11y-widget__btn:focus-visible { outline: 3px solid #fbbf24; outline-offset: 3px; }

.a11y-widget__btn .icon-col {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 4px !important;
  flex-shrink: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}
/* Defensive overrides — protect widget SVGs from global host theme rules
   like `svg { max-width: 100% }` that ship with SP Page Builder, T3, etc. */
.a11y-widget svg { max-width: none !important; min-width: 0 !important; display: block !important; }
.a11y-widget__btn .icon { width: 30px !important; height: 30px !important; flex-shrink: 0 !important; }
.a11y-widget__btn .kbd {
  display: block !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  color: #fff !important;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  letter-spacing: .02em !important;
  text-align: center !important;
  white-space: nowrap !important;
  text-decoration: none !important;
  font-family: inherit !important;
}

.a11y-widget__btn .full-label {
  max-width: 0; opacity: 0; overflow: hidden; white-space: nowrap;
  margin-left: 0; font: 600 15px/1 inherit;
  transition: max-width .3s ease, opacity .2s ease .05s, margin-left .3s ease;
}
.a11y-widget__btn:hover .full-label,
.a11y-widget__btn:focus-visible .full-label {
  max-width: 240px; opacity: 1; margin-left: 14px;
}

.a11y-widget[aria-expanded="true"] .a11y-widget__btn { display: none !important; }

/* Panel */
.a11y-widget__panel {
  position: absolute; left: 0; bottom: 0;
  width: 400px; max-width: calc(100vw - 40px);
  max-height: calc(100vh - 60px);
  display: none; flex-direction: column;
  background: var(--a11y-bg);
  border-radius: 18px;
  box-shadow: var(--a11y-shadow-panel);
  overflow: hidden;
}
.a11y-widget[aria-expanded="true"] .a11y-widget__panel { display: flex; }

.a11y-widget__header {
  flex-shrink: 0;
  background: var(--a11y-navy); color: #fff;
  padding: 16px 18px;
  display: flex; align-items: center; gap: 12px;
}
.a11y-widget__header h2 { margin: 0; font: 600 18px/1 inherit; color: #fff; }
.a11y-widget__shortcut {
  background: var(--a11y-navy-soft);
  padding: 6px 14px; border-radius: 999px;
  font: 600 12px/1 inherit;
}
.a11y-widget__close {
  margin-left: auto; background: none; border: 0; color: #fff;
  cursor: pointer; padding: 4px; line-height: 0;
  border-radius: 6px;
}
.a11y-widget__close:hover { background: rgba(255,255,255,.15); }
.a11y-widget__close svg { width: 24px !important; height: 24px !important; }

.a11y-widget__body { flex: 1 1 auto; overflow-y: auto; padding: 16px; }
.a11y-widget__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.a11y-widget__opt {
  background: var(--a11y-card); color: var(--a11y-card-fg);
  border: 1.5px solid transparent; border-radius: 12px;
  padding: 14px 6px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; min-height: 100px;
  cursor: pointer;
  font: 500 12.5px/1.2 inherit; text-align: center;
  transition: transform .12s, box-shadow .12s, background .12s, border-color .12s;
  position: relative;
  overflow: visible;
}
.a11y-widget__opt:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15,23,42,.08); }
.a11y-widget__opt:focus-visible { outline: 2px solid var(--a11y-navy); outline-offset: 2px; }
.a11y-widget__opt .ic { width: 28px !important; height: 28px !important; flex-shrink: 0; }

/* ACTIVE state — light tint of brand colour, dark text/icon, brand-coloured border,
   plus a checkmark badge in the top-right. Uses color-mix() for auto-derived tint
   that adapts to whatever brand colour the user picks (Chrome 111+, FF 113+, Safari 16.2+). */
.a11y-widget__opt[aria-pressed="true"] {
  background: color-mix(in srgb, var(--a11y-active) 14%, white);
  border-color: var(--a11y-active);
  color: var(--a11y-card-fg);
}
.a11y-widget__opt::after {
  content: '';
  position: absolute;
  top: -7px; right: -7px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background-color: var(--a11y-active);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><path d='M5 12 l4 4 l10 -10'/></svg>");
  background-size: 62%;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(0);
  transition: transform .18s cubic-bezier(.4,0,.2,1);
  pointer-events: none;
}
.a11y-widget__opt[aria-pressed="true"]::after { transform: scale(1); }

/* Disabled state — only fades when NOT also pressed. With cycling enabled, this
   path is rarely hit, but kept for safety / future non-cycling features. */
.a11y-widget__opt[aria-disabled="true"] { cursor: not-allowed; }
.a11y-widget__opt[aria-disabled="true"]:not([aria-pressed="true"]) {
  opacity: .55; background: var(--a11y-card-mute);
}

/* Level indicator — horizontal dashes (CDSL-style) instead of dots */
.a11y-widget__opt .lvl { display: inline-flex; gap: 4px; }
.a11y-widget__opt .lvl i {
  width: 14px; height: 3px; border-radius: 1px;
  background: currentColor; opacity: .25;
  display: inline-block;
}
.a11y-widget__opt .lvl i.on { opacity: 1; }

.a11y-widget__footer { flex-shrink: 0; padding: 14px 16px 16px; }
.a11y-widget__reset {
  width: 100%;
  background: var(--a11y-reset-bg); color: var(--a11y-navy);
  border: 0; border-radius: 12px;
  padding: 14px;
  font: 600 14px/1 inherit;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .15s;
}
.a11y-widget__reset:hover { background: var(--a11y-reset-bg-h); }
.a11y-widget__reset svg { width: 20px !important; height: 20px !important; }

@media (max-width: 480px) {
  .a11y-widget__btn .full-label { display: none; }
  .a11y-widget__btn:hover { padding: 10px 16px; }
  .a11y-widget__panel { width: calc(100vw - 24px); }
  .a11y-widget { left: 12px; bottom: 12px; }
}

/* Effect classes */
/* Font scaling — uses CSS `zoom` on body. We previously tried `transform: scale()`
   for speed, but it broke `position: fixed` elements (because transform creates
   a new containing block) and caused layout shifts on scroll-sticky elements.
   `zoom` is slower (full repaint, ~1s on heavy DOMs) but correct.
   Browser support: Chrome/Edge/Safari forever, Firefox 126+ (May 2024). */
html.a11y-fs--2 body { zoom: 0.85 !important; }
html.a11y-fs--1 body { zoom: 0.92 !important; }
html.a11y-fs-1  body { zoom: 1.10 !important; }
html.a11y-fs-2  body { zoom: 1.22 !important; }
html.a11y-fs-3  body { zoom: 1.38 !important; }

/* Counter-zoom the widget itself so the launcher and panel stay constant size. */
html.a11y-fs--2 .a11y-widget { zoom: 1.176 !important; }
html.a11y-fs--1 .a11y-widget { zoom: 1.087 !important; }
html.a11y-fs-1  .a11y-widget { zoom: 0.909 !important; }
html.a11y-fs-2  .a11y-widget { zoom: 0.820 !important; }
html.a11y-fs-3  .a11y-widget { zoom: 0.725 !important; }

html.a11y-spacing-1, html.a11y-spacing-1 *  { letter-spacing: .04em !important; word-spacing: .12em !important; }
html.a11y-spacing-2, html.a11y-spacing-2 *  { letter-spacing: .08em !important; word-spacing: .2em  !important; }

html.a11y-line-1, html.a11y-line-1 *  { line-height: 1.7 !important; }
html.a11y-line-2, html.a11y-line-2 *  { line-height: 2.1 !important; }

html.a11y-sat-1 { filter: saturate(.5) !important; }
html.a11y-sat-2 { filter: saturate(0)  !important; }

html.a11y-invert            { filter: invert(1) hue-rotate(180deg) !important; }
html.a11y-invert.a11y-sat-1 { filter: invert(1) hue-rotate(180deg) saturate(.5) !important; }
html.a11y-invert.a11y-sat-2 { filter: invert(1) hue-rotate(180deg) saturate(0)  !important; }

html.a11y-invert .a11y-widget,
html.a11y-invert .a11y-widget * { filter: invert(1) hue-rotate(180deg) !important; }

html.a11y-links a, html.a11y-links a * {
  background: #fde047 !important; color: #000 !important;
  text-decoration: underline !important; outline: 2px solid #f59e0b !important;
}

html.a11y-dyslexia, html.a11y-dyslexia * {
  font-family: "Comic Sans MS", "Trebuchet MS", Verdana, Tahoma, sans-serif !important;
  letter-spacing: .03em !important; word-spacing: .1em !important;
}

html.a11y-cursor, html.a11y-cursor * {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 40 40'><path d='M4 2 L4 34 L13 25 L18 36 L23 34 L18 23 L30 23 Z' fill='black' stroke='white' stroke-width='2'/></svg>") 0 0, auto !important;
}

html.a11y-no-images img,
html.a11y-no-images video,
html.a11y-no-images picture,
html.a11y-no-images svg:not(.a11y-widget *) { visibility: hidden !important; }

html.a11y-pause *,
html.a11y-pause *::before,
html.a11y-pause *::after {
  animation-play-state: paused !important;
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

html.a11y-tts p, html.a11y-tts h1, html.a11y-tts h2, html.a11y-tts h3,
html.a11y-tts h4, html.a11y-tts h5, html.a11y-tts h6,
html.a11y-tts li, html.a11y-tts a, html.a11y-tts span { cursor: text !important; }

.a11y-mask-top, .a11y-mask-bot {
  position: fixed; left: 0; right: 0;
  background: rgba(0,0,0,.7);
  z-index: calc(var(--a11y-z) - 1);
  pointer-events: none;
  transition: height .08s linear, top .08s linear;
}
.a11y-mask-top { top: 0; height: 0; }
.a11y-mask-bot { bottom: 0; top: 100vh; }
