/* ── DNP Accessibility Widget — palette mirrors site tokens ── */
:root {
  --a11y-ink: var(--ink, #0A0A0A);
  --a11y-paper: var(--paper, #FAFAFA);
  --a11y-paper-pure: var(--paper-pure, #FFFFFF);
  --a11y-accent: var(--accent, #7B33EB);
  --a11y-rule: var(--rule, rgba(10,10,10,0.12));
  --a11y-card: var(--paper-pure, #FFFFFF);
  --a11y-card-border: var(--rule, rgba(10,10,10,0.12));
  --a11y-muted: rgba(10,10,10,0.55);
  --a11y-soft: rgba(10,10,10,0.05);
  --a11y-switch-off: rgba(10,10,10,0.18);
  --a11y-tint: rgba(123,51,235,0.10);
}

/* FAB — side-attached pill on the left (RTL site convention) */
#a11y-fab {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 56px;
  background: var(--a11y-ink);
  color: var(--a11y-paper);
  border: none;
  border-radius: 0 14px 14px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  box-shadow: 2px 4px 20px rgba(10,10,10,0.22);
  transition: background 0.2s, width 0.25s ease;
  overflow: hidden;
  font-family: 'Heebo', sans-serif;
}
#a11y-fab:hover { background: var(--a11y-accent); }
#a11y-fab.collapsed { width: 20px; }
#a11y-fab .a11y-arrow { display: none; font-size: 0.9rem; }
#a11y-fab.collapsed .a11y-arrow { display: flex; }
#a11y-fab.collapsed .a11y-icon { display: none; }
#a11y-fab .a11y-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 10px;
  height: 10px;
  background: var(--a11y-accent);
  border-radius: 50%;
  border: 2px solid var(--a11y-ink);
  display: none;
}
#a11y-fab .a11y-dot.show { display: block; }

/* Backdrop */
#a11y-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10,10,10,0.5);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#a11y-backdrop.show { opacity: 1; pointer-events: auto; }

/* Panel — slides in from the left (opposite to RTL text flow, as is
   conventional for accessibility toolbars on Hebrew sites) */
#a11y-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  max-width: 420px;
  background: var(--a11y-paper);
  z-index: 10001;
  display: flex;
  flex-direction: column;
  direction: rtl;
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 40px rgba(10,10,10,0.18);
  font-family: 'Heebo', sans-serif;
}
#a11y-panel.open { transform: translateX(0); }

.a11y-header {
  flex-shrink: 0;
  background: var(--a11y-ink);
  color: var(--a11y-paper);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.a11y-header-info { display: flex; align-items: center; gap: 0.75rem; }
.a11y-header h2 { font-size: 1.05rem; font-weight: 800; margin: 0; color: var(--a11y-paper); }
.a11y-header p { font-size: 0.78rem; opacity: 0.75; margin: 0.1rem 0 0; color: var(--a11y-paper); }

.a11y-close-btn {
  width: 38px; height: 38px;
  background: rgba(255,255,255,0.12);
  border: none;
  border-radius: 50%;
  color: var(--a11y-paper);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  transition: background 0.15s;
  font-family: inherit;
}
.a11y-close-btn:hover { background: var(--a11y-accent); color: var(--a11y-paper); }

.a11y-body {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

/* Font size card */
.a11y-font-card {
  background: var(--a11y-card);
  border-radius: 12px;
  border: 1px solid var(--a11y-card-border);
  padding: 1rem;
}
.a11y-font-card-top { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.85rem; }
.a11y-icon-box {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--a11y-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--a11y-ink);
}
.a11y-font-card h3 { font-size: 0.9rem; font-weight: 700; color: var(--a11y-ink); margin: 0; }
.a11y-font-card .sub { font-size: 0.75rem; color: var(--a11y-muted); margin: 0.1rem 0 0; }

.a11y-font-btns { display: flex; gap: 0.4rem; }
.a11y-font-btns button {
  flex: 1;
  padding: 0.55rem 0.2rem;
  background: var(--a11y-paper);
  border: 1px solid var(--a11y-card-border);
  border-radius: 8px;
  color: var(--a11y-ink);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
}
.a11y-font-btns button.fs-active,
.a11y-font-btns button:hover:not(:disabled) {
  background: var(--a11y-ink);
  color: var(--a11y-paper);
  border-color: var(--a11y-ink);
}
.a11y-font-btns button:disabled { opacity: 0.35; cursor: not-allowed; }

/* Toggle row */
.a11y-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--a11y-card);
  border-radius: 12px;
  border: 1px solid var(--a11y-card-border);
  cursor: pointer;
  text-align: right;
  transition: border-color 0.15s, background 0.15s;
  font-family: inherit;
}
.a11y-toggle.on {
  background: var(--a11y-tint);
  border-color: var(--a11y-accent);
}
.a11y-toggle:hover { border-color: var(--a11y-ink); }

.a11y-toggle-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--a11y-soft);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
  color: var(--a11y-ink);
}
.a11y-toggle.on .a11y-toggle-icon { background: var(--a11y-accent); color: var(--a11y-paper); }

.a11y-toggle-text { flex: 1; }
.a11y-toggle-text h3 { font-size: 0.88rem; font-weight: 700; color: var(--a11y-ink); margin: 0; }
.a11y-toggle-text p { font-size: 0.74rem; color: var(--a11y-muted); margin: 0.1rem 0 0; }

.a11y-switch {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  flex-shrink: 0;
  background: var(--a11y-switch-off);
  transition: background 0.2s;
}
.a11y-switch.on { background: var(--a11y-accent); }
.a11y-switch-knob {
  position: absolute;
  top: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--a11y-paper-pure);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
  transition: right 0.2s;
  right: 3px;
}
.a11y-switch.on .a11y-switch-knob { right: calc(100% - 23px); }

/* Reset & statement */
.a11y-reset-btn {
  width: 100%;
  padding: 0.75rem;
  background: var(--a11y-ink);
  border: 1px solid var(--a11y-ink);
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--a11y-paper);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
  margin-top: 0.25rem;
}
.a11y-reset-btn:hover { background: var(--a11y-accent); border-color: var(--a11y-accent); }

.a11y-statement {
  padding: 1rem;
  background: var(--a11y-card);
  border-radius: 10px;
  text-align: center;
  border: 1px solid var(--a11y-card-border);
}
.a11y-statement p { font-size: 0.76rem; color: var(--a11y-muted); margin: 0 0 0.3rem; line-height: 1.6; }
.a11y-statement small { font-size: 0.7rem; color: #888; }
.a11y-statement a { color: var(--a11y-accent); text-decoration: none; font-weight: 600; }
.a11y-statement a:hover { text-decoration: underline; }

/* Reading guide */
#a11y-reading-guide {
  position: fixed;
  left: 0;
  right: 0;
  height: 48px;
  pointer-events: none;
  z-index: 9998;
  border-top: 2px solid rgba(123,51,235,0.35);
  border-bottom: 2px solid rgba(123,51,235,0.35);
  background: rgba(123,51,235,0.06);
  display: none;
}
#a11y-reading-guide.show { display: block; }

/* Body-level effects */
.accessibility-high-contrast { filter: contrast(1.4) !important; }
.accessibility-high-contrast * { border-color: currentColor !important; }
.accessibility-grayscale { filter: grayscale(100%) !important; }
.accessibility-high-contrast.accessibility-grayscale { filter: contrast(1.4) grayscale(100%) !important; }

.accessibility-highlight-links a {
  background: #FFEB3B !important;
  color: #000 !important;
  text-decoration: underline !important;
  padding: 2px 4px !important;
}

.accessibility-readable-font,
.accessibility-readable-font * {
  font-family: Arial, Helvetica, sans-serif !important;
  letter-spacing: 0.02em !important;
}

.accessibility-text-spacing {
  letter-spacing: 0.12em !important;
  word-spacing: 0.32em !important;
}
.accessibility-text-spacing p,
.accessibility-text-spacing li,
.accessibility-text-spacing span,
.accessibility-text-spacing div { line-height: 2 !important; }

.accessibility-stop-animations *,
.accessibility-stop-animations *::before,
.accessibility-stop-animations *::after {
  animation: none !important;
  transition: none !important;
}

.accessibility-large-cursor,
.accessibility-large-cursor * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path fill="black" stroke="white" stroke-width="1" d="M5.5 3.21V20.8l4.86-4.86h8.43L5.5 3.21z"/></svg>') 0 0, auto !important;
}

/* Panel/FAB always at base font size */
#a11y-fab,
#a11y-panel,
#a11y-panel * { font-size: 1rem; }
#a11y-panel h2 { font-size: 1.05rem; }
#a11y-panel .sub,
#a11y-panel .a11y-toggle-text p,
#a11y-panel .a11y-statement p { font-size: 0.75rem; }
#a11y-panel .a11y-statement small { font-size: 0.7rem; }

@media (max-width: 480px) {
  #a11y-panel { max-width: 100%; }
}
