/* ═══════════════════════════════════════════
   Accessibility widget – fixed FAB + sidebar
   ═══════════════════════════════════════════ */

/* ── FAB toggle (bottom-right) ── */

.a11y-widget__toggle {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(15, 118, 110, 0.35);
  transition: transform 200ms ease, box-shadow 200ms ease;
  -webkit-tap-highlight-color: transparent;
}

.a11y-widget__toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(15, 118, 110, 0.45);
}

.a11y-widget.is-open .a11y-widget__toggle {
  z-index: 70;
}

.a11y-widget__icon {
  width: 26px;
  height: 26px;
}

/* ── backdrop ── */

.a11y-widget__backdrop {
  position: fixed;
  inset: 0;
  z-index: 59;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms;
}

.a11y-widget.is-open .a11y-widget__backdrop {
  opacity: 1;
  visibility: visible;
}

/* ── sidebar panel ── */

.a11y-widget__panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 61;
  width: 320px;
  max-width: 90vw;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1), visibility 300ms;
}

.a11y-widget.is-open .a11y-widget__panel {
  transform: translateX(0);
  visibility: visible;
}

/* ── header ── */

.a11y-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--color-line);
  flex-shrink: 0;
}

.a11y-widget__title {
  font-weight: 700;
  font-size: 1.05rem;
}

.a11y-widget__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-muted);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}

.a11y-widget__close svg {
  width: 20px;
  height: 20px;
}

.a11y-widget__close:hover {
  background: var(--color-line);
  color: var(--color-text);
}

/* ── option grid ── */

.a11y-widget__options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 1rem;
  overflow-y: auto;
  flex: 1;
}

.a11y-widget__option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  padding: 0.85rem 0.5rem;
  border: 1px solid var(--color-line);
  border-radius: 10px;
  background: #fff;
  color: var(--color-text);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
  text-align: center;
  line-height: 1.25;
  -webkit-tap-highlight-color: transparent;
}

.a11y-widget__option svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.a11y-widget__option:hover {
  background: #f0fdf9;
  border-color: var(--color-primary);
}

.a11y-widget__option.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ── footer ── */

.a11y-widget__footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--color-line);
  flex-shrink: 0;
}

.a11y-widget__reset {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--color-line);
  border-radius: 8px;
  background: #fff;
  color: var(--color-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.a11y-widget__reset:hover {
  background: var(--color-line);
  color: var(--color-text);
}

/* ── step indicator badge ── */

.a11y-widget__step-indicator {
  font-size: 0.65rem;
  font-weight: 700;
  min-height: 1em;
}

.a11y-widget__option.is-active .a11y-widget__step-indicator {
  color: rgba(255, 255, 255, 0.8);
}

/* ═══════════════════════════════════════════
   Accessibility overrides – applied to <body>
   ═══════════════════════════════════════════ */

/* ── high contrast ──
   Uses CSS overrides instead of filter to avoid
   breaking position:fixed elements.            */

body.a11y-high-contrast {
  --color-text: #000000;
  --color-muted: #333333;
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-line: #000000;
  --color-primary: #004d40;
}

body.a11y-high-contrast a {
  color: #00007a !important;
}

body.a11y-high-contrast button,
body.a11y-high-contrast [type="submit"] {
  border: 2px solid #000 !important;
}

/* ── highlight links ── */

body.a11y-highlight-links a {
  outline: 2px solid var(--color-primary) !important;
  outline-offset: 2px;
  text-decoration: underline !important;
}

/* ── bigger text (4 steps: off → 1 → 2 → 3) ── */
/* apply on root to avoid nested font-size compounding */

html.a11y-big-text-1 {
  font-size: 102.5% !important;
}

html.a11y-big-text-2 {
  font-size: 105% !important;
}

html.a11y-big-text-3 {
  font-size: 110% !important;
}

/* ── text spacing ── */

body.a11y-text-spacing {
  letter-spacing: 0.08em !important;
  word-spacing: 0.16em !important;
}

body.a11y-text-spacing * {
  letter-spacing: inherit !important;
  word-spacing: inherit !important;
}

/* ── hide images ── */

body.a11y-hide-images img:not(.org-header__logo),
body.a11y-hide-images picture,
body.a11y-hide-images [role="img"],
body.a11y-hide-images video {
  visibility: hidden !important;
}

/* ── dyslexia-friendly ── */

body.a11y-dyslexia-friendly {
  font-family: "OpenDyslexic", "Comic Sans MS", "Arial", sans-serif !important;
}

body.a11y-dyslexia-friendly * {
  font-family: inherit !important;
}

/* ── big cursor ── */

body.a11y-big-cursor,
body.a11y-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M6 2l22 14-10 2 6 12-4 2-6-12-8 8z' fill='%23000' stroke='%23fff' stroke-width='1.5'/%3E%3C/svg%3E") 6 2, auto !important;
}

/* ── stop animations ── */

body.a11y-stop-animations,
body.a11y-stop-animations *,
body.a11y-stop-animations *::before,
body.a11y-stop-animations *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* ── tooltips (show alt/title) ── */

body.a11y-tooltips img[alt]:not([alt=""])::after,
body.a11y-tooltips [aria-label]::after {
  content: attr(aria-label);
}

body.a11y-tooltips img[alt]:not([alt=""]) {
  position: relative;
}

body.a11y-tooltips [title] {
  text-decoration: underline dotted !important;
  text-decoration-thickness: 2px !important;
}

/* ── line height ── */

body.a11y-line-height {
  line-height: 2 !important;
}

body.a11y-line-height * {
  line-height: inherit !important;
}

/* ── text alignment ── */

body.a11y-text-align,
body.a11y-text-align * {
  text-align: left !important;
}
