/* ── DNP Finance Accessibility Widget — תקנות נגישות 2013 / ת"י 5568 (WCAG 2.1 AA) ── */
:root {
  --a11y-ink: #0b0b12;
  --a11y-paper: #f6f5fb;
  --a11y-paper-pure: #ffffff;
  --a11y-accent: #7d37eb;
  --a11y-rule: #eceaf3;
  --a11y-card: #ffffff;
  --a11y-card-border: #eceaf3;
  --a11y-muted: rgba(11, 11, 18, 0.55);
  --a11y-soft: rgba(11, 11, 18, 0.05);
  --a11y-switch-off: rgba(11, 11, 18, 0.18);
  --a11y-tint: rgba(125, 55, 235, 0.10);
}

/* FAB — pill attached to the left edge (RTL convention) */
#a11y-fab {
  position: fixed; left: 0; top: 50%; transform: translateY(-50%);
  width: 48px; height: 56px;
  background: var(--a11y-accent); color: #fff;
  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(11,11,18,0.22);
  transition: background .2s, color .2s, width .25s ease;
  overflow: hidden; font-family: "Assistant", "Heebo", sans-serif;
}
#a11y-fab:hover { background: #6b2fd1; }
#a11y-fab.on-dark { background: #fff !important; color: #0b0b12 !important; }
#a11y-fab.on-dark:hover { background: var(--a11y-accent) !important; color: #fff !important; }
#a11y-fab.collapsed { width: 20px; }
#a11y-fab .a11y-arrow { display: none; font-size: .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: #fff;
  border-radius: 50%; border: 2px solid var(--a11y-accent); display: none;
}
#a11y-fab .a11y-dot.show { display: block; }

#a11y-backdrop {
  position: fixed; inset: 0; background: rgba(11,11,18,.5);
  z-index: 10000; opacity: 0; pointer-events: none; transition: opacity .2s;
}
#a11y-backdrop.show { opacity: 1; pointer-events: auto; }

#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 .3s cubic-bezier(.4,0,.2,1);
  box-shadow: 4px 0 40px rgba(11,11,18,.18);
  font-family: "Assistant", "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: .75rem; }
.a11y-header h2 { font-size: 1.05rem; font-weight: 800; margin: 0; color: var(--a11y-paper); }
.a11y-header p { font-size: .78rem; opacity: .75; margin: .1rem 0 0; color: var(--a11y-paper); }

.a11y-close-btn {
  width: 38px; height: 38px; background: rgba(255,255,255,.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 .15s; font-family: inherit;
}
.a11y-close-btn:hover { background: var(--a11y-accent); }

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

.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: .75rem; margin-bottom: .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: .9rem; font-weight: 700; color: var(--a11y-ink); margin: 0; }
.a11y-font-card .sub { font-size: .75rem; color: var(--a11y-muted); margin: .1rem 0 0; }

.a11y-font-btns { display: flex; gap: .4rem; }
.a11y-font-btns button {
  flex: 1; padding: .55rem .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 .15s, color .15s, border-color .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: .35; cursor: not-allowed; }

.a11y-toggle {
  width: 100%; display: flex; align-items: center; gap: .85rem; padding: .85rem 1rem;
  background: var(--a11y-card); border-radius: 12px; border: 1px solid var(--a11y-card-border);
  cursor: pointer; text-align: right; transition: border-color .15s, background .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: .88rem; font-weight: 700; color: var(--a11y-ink); margin: 0; }
.a11y-toggle-text p { font-size: .74rem; color: var(--a11y-muted); margin: .1rem 0 0; }

.a11y-switch { position: relative; width: 46px; height: 26px; border-radius: 999px; flex-shrink: 0; background: var(--a11y-switch-off); transition: background .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,.15); transition: right .2s; right: 3px;
}
.a11y-switch.on .a11y-switch-knob { right: calc(100% - 23px); }

.a11y-reset-btn {
  width: 100%; padding: .75rem; background: var(--a11y-ink); border: 1px solid var(--a11y-ink);
  border-radius: 10px; font-size: .85rem; font-weight: 700; color: var(--a11y-paper); cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: .5rem; transition: background .15s, border-color .15s; font-family: inherit; margin-top: .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: .76rem; color: var(--a11y-muted); margin: 0 0 .3rem; line-height: 1.6; }
.a11y-statement small { font-size: .7rem; color: #888; }
.a11y-statement a { color: var(--a11y-accent); text-decoration: none; font-weight: 600; }
.a11y-statement a:hover { text-decoration: underline; }

#a11y-reading-guide {
  position: fixed; left: 0; right: 0; height: 48px; pointer-events: none; z-index: 9998;
  border-top: 2px solid rgba(125,55,235,.35); border-bottom: 2px solid rgba(125,55,235,.35);
  background: rgba(125,55,235,.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: .02em !important; }
.accessibility-text-spacing { letter-spacing: .12em !important; word-spacing: .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 stay at base size regardless of the font-size toggle */
#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: .75rem; }
#a11y-panel .a11y-statement small { font-size: .7rem; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
