/* AllArounder Accessibility Toolbar - self-hosted, no third-party overlay.
 * A genuine USER-PREFERENCE panel (font size, contrast, link highlight, readable
 * font, spacing, reduced motion). It sits ON TOP of the site's native WCAG 2.1 AA
 * compliance - it is NOT a "make-the-site-accessible" overlay and never claims to be.
 * Night palette via var() with literal fallbacks (renders even if loaded standalone).
 * RTL Hebrew + LTR English aware. The launcher sits opposite #scroll-top in both dirs.
 */

:root {
  --a11y-bg:          var(--void-2, #253220);
  --a11y-bg-2:        var(--void-3, #1b2617);
  --a11y-text:        var(--cream, #F5F0E8);
  --a11y-text-soft:   var(--cream-soft, rgba(245, 240, 232, 0.82));
  --a11y-gold:        var(--gold, #C8A96E);
  --a11y-gold-bright: var(--gold-bright, #E2C488);
  --a11y-ink:         #1e2d1a;
  --a11y-hairline:    var(--hairline, rgba(200, 169, 110, 0.22));
  --a11y-r-card:      var(--r-card, 18px);
  --a11y-r-pill:      var(--r-pill, 999px);
  --a11y-shadow:      var(--shadow-float, 0 26px 70px -18px rgba(0, 0, 0, 0.55));
}

/* ── Launcher button (FAB) - opposite side from #scroll-top ── */
.a11y-fab {
  position: fixed;
  inset-block-end: 24px;
  inset-inline-start: 24px;
  z-index: 2147482000;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  border: 2px solid var(--a11y-gold);
  background: linear-gradient(135deg, var(--a11y-gold-bright), var(--a11y-gold));
  color: var(--a11y-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--a11y-shadow);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.a11y-fab:hover { transform: translateY(-2px); }
.a11y-fab:focus-visible { outline: 3px solid var(--a11y-gold-bright); outline-offset: 3px; }
.a11y-fab svg { width: 26px; height: 26px; display: block; }

/* ── Panel ── */
.a11y-panel {
  position: fixed;
  inset-block-end: 86px;
  inset-inline-start: 24px;
  z-index: 2147482001;
  width: min(330px, calc(100vw - 32px));
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--a11y-bg);
  border: 1px solid var(--a11y-hairline);
  border-radius: var(--a11y-r-card);
  box-shadow: var(--a11y-shadow);
  font-family: 'Assistant', system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 18px 18px 20px;
}
.a11y-panel[hidden] { display: none; }
.a11y-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-block-end: 14px;
}
.a11y-panel-title {
  margin: 0;
  font-family: 'Rubik', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--a11y-text);
}
.a11y-x {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--a11y-hairline);
  background: transparent;
  color: var(--a11y-text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}
.a11y-x:hover { background: rgba(200, 169, 110, 0.12); }
.a11y-x:focus-visible { outline: 3px solid var(--a11y-gold-bright); outline-offset: 2px; }

/* Font-size row */
.a11y-fontrow {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-block-end: 12px;
  border: 1px solid var(--a11y-hairline);
  border-radius: 12px;
  background: var(--a11y-bg-2);
}
.a11y-fontrow .a11y-fontlabel {
  font-size: 0.95rem;
  color: var(--a11y-text-soft);
  text-align: center;
}
.a11y-step {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--a11y-gold);
  background: transparent;
  color: var(--a11y-text);
  font-size: 1.25rem;
  font-weight: 700;
  cursor: pointer;
}
.a11y-step:hover { background: rgba(200, 169, 110, 0.14); }
.a11y-step:focus-visible { outline: 3px solid var(--a11y-gold-bright); outline-offset: 2px; }

/* Toggle options */
.a11y-grid { display: grid; gap: 8px; }
.a11y-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  inline-size: 100%;
  text-align: start;
  padding: 11px 13px;
  border: 1px solid var(--a11y-hairline);
  border-radius: 12px;
  background: var(--a11y-bg-2);
  color: var(--a11y-text);
  font: inherit;
  font-size: 0.97rem;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.a11y-opt:hover { background: rgba(200, 169, 110, 0.10); }
.a11y-opt:focus-visible { outline: 3px solid var(--a11y-gold-bright); outline-offset: 2px; }
.a11y-opt .a11y-check {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--a11y-gold);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--a11y-ink);
  background: transparent;
}
.a11y-opt[aria-pressed="true"] { border-color: var(--a11y-gold); background: rgba(200, 169, 110, 0.16); }
.a11y-opt[aria-pressed="true"] .a11y-check { background: var(--a11y-gold); }
.a11y-opt .a11y-check svg { width: 14px; height: 14px; opacity: 0; }
.a11y-opt[aria-pressed="true"] .a11y-check svg { opacity: 1; }
.a11y-opt .a11y-opt-label { flex: 1; }

.a11y-reset {
  margin-block-start: 12px;
  inline-size: 100%;
  padding: 10px 14px;
  border-radius: var(--a11y-r-pill);
  border: 1px solid var(--a11y-hairline);
  background: transparent;
  color: var(--a11y-text-soft);
  font: inherit;
  font-family: 'Rubik', sans-serif;
  font-weight: 600;
  cursor: pointer;
}
.a11y-reset:hover { background: rgba(200, 169, 110, 0.12); color: var(--a11y-text); }
.a11y-reset:focus-visible { outline: 3px solid var(--a11y-gold-bright); outline-offset: 2px; }

.a11y-note {
  margin: 12px 2px 0;
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--a11y-text-soft);
  opacity: 0.85;
}
.a11y-note a { color: var(--a11y-gold-bright); text-underline-offset: 3px; }

@media print { .a11y-fab, .a11y-panel { display: none !important; } }

/* ════════════════════════════════════════════════════════════════════
   APPLIED PREFERENCES - classes toggled on <html>. !important is correct
   here: an accessibility override must win over site styles by design.
   ════════════════════════════════════════════════════════════════════ */

/* Font scaling (cascades to all rem/em-based text) */
html.a11y-fs-1 { font-size: 112.5% !important; }
html.a11y-fs-2 { font-size: 125%   !important; }
html.a11y-fs-3 { font-size: 140%   !important; }

/* High contrast: redefine the Night design tokens so the whole token-driven
   site flips at once, then backstop literal-coloured text + links. */
html.a11y-contrast {
  --void: #000; --void-2: #000; --void-3: #050505; --void-4: #0d0d0d;
  --bg-deep-1: #000; --bg-deep-2: #000; --bg-deep-3: #000; --bg-deep-4: #000;
  --cream: #fff; --cream-soft: #fff; --cream-mute: #f1f1f1; --cream-label: #ffe9a8;
  --gold: #ffe27a; --gold-bright: #fff0b0;
  --hairline: rgba(255, 255, 255, 0.55);
  background: #000 !important;
}
html.a11y-contrast body { background: #000 !important; color: #fff !important; }
html.a11y-contrast p,
html.a11y-contrast li,
html.a11y-contrast span,
html.a11y-contrast h1,
html.a11y-contrast h2,
html.a11y-contrast h3,
html.a11y-contrast h4 { color: #fff !important; }
html.a11y-contrast a { color: #fff200 !important; }
html.a11y-contrast *:focus-visible { outline: 3px solid #fff200 !important; outline-offset: 2px; }

/* Highlight links: underline + box every link */
html.a11y-links a {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  outline: 1px solid currentColor;
  outline-offset: 1px;
}

/* Readable font: switch to a high-legibility stack (Hebrew + Latin safe) */
html.a11y-readable,
html.a11y-readable body,
html.a11y-readable p,
html.a11y-readable li,
html.a11y-readable a,
html.a11y-readable span,
html.a11y-readable button,
html.a11y-readable h1,
html.a11y-readable h2,
html.a11y-readable h3,
html.a11y-readable h4,
html.a11y-readable input,
html.a11y-readable textarea {
  font-family: Arial, "Helvetica Neue", "Segoe UI", system-ui, sans-serif !important;
  letter-spacing: normal !important;
}

/* Extra text spacing (readability / dyslexia aid) */
html.a11y-spacing p,
html.a11y-spacing li,
html.a11y-spacing a,
html.a11y-spacing span {
  line-height: 1.9 !important;
  letter-spacing: 0.04em !important;
  word-spacing: 0.12em !important;
}

/* Reduce motion: kill animation / transition / smooth scroll site-wide */
html.a11y-motion-off *,
html.a11y-motion-off *::before,
html.a11y-motion-off *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
