/* ===== ACCESSIBILITY WIDGET + IS 5568 PREFERENCE CLASSES ===== */
/* User-preference comfort tool (not an automation overlay). Only toggles CSS
   classes on <html>; never mutates content DOM, alt text, or ARIA. */

/* --- Skip link (keyboard: first focusable element) --- */
.skip-link {
  position: absolute;
  inset-inline-start: -9999px;
  top: 0;
  z-index: 100000;
  background: #0E2F54;
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 10px 0;
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { inset-inline-start: 0; }

/* --- Visible keyboard focus (WCAG 2.4.7) --- */
*:focus-visible {
  outline: 3px solid #4E9E2C;
  outline-offset: 2px;
}

/* ===== PREFERENCE CLASSES (applied to <html>) ===== */

/* Text size (zoom keeps a px-based layout proportional) */
html.a11y-text-115 body { zoom: 1.15; }
html.a11y-text-130 body { zoom: 1.30; }
html.a11y-text-150 body { zoom: 1.50; }

/* High contrast */
html.a11y-contrast-high body { filter: contrast(1.4) saturate(1.1); }

/* Inverted colors (dark comfort mode) */
html.a11y-contrast-invert body { filter: invert(1) hue-rotate(180deg); }
html.a11y-contrast-invert body img,
html.a11y-contrast-invert body iframe,
html.a11y-contrast-invert body video,
html.a11y-contrast-invert body canvas { filter: invert(1) hue-rotate(180deg); }

/* Highlight links */
html.a11y-links a {
  text-decoration: underline !important;
  text-underline-offset: 2px;
  box-shadow: inset 0 -2px 0 #4E9E2C;
}

/* Readable font (OS stack only — no webfont, avoids reflow past content) */
html.a11y-readable body,
html.a11y-readable body * { font-family: Arial, "Segoe UI", "Noto Sans Hebrew", sans-serif !important; }

/* Stop animations / reduce motion */
html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* --- Counter-invert the widget so it stays readable in invert mode --- */
html.a11y-contrast-invert #a11y-trigger,
html.a11y-contrast-invert #a11y-panel { filter: invert(1) hue-rotate(180deg); }

/* --- Reset all a11y effects when printing --- */
@media print {
  html[class*="a11y-"] body { filter: none !important; zoom: 1 !important; }
  #a11y-trigger, #a11y-panel { display: none !important; }
}

/* ===== WIDGET UI ===== */
#a11y-trigger {
  position: fixed;
  inset-inline-end: 18px;      /* RTL: left side */
  bottom: 18px;
  z-index: 9998;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, #1F6CB0, #1F6CB0);
  color: #fff;
  font-size: 26px;
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(18,48,80,0.35);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s;
}
#a11y-trigger:hover { transform: scale(1.06); }
@media (max-width: 600px) { #a11y-trigger { bottom: 84px; width: 46px; height: 46px; font-size: 22px; } }

#a11y-panel {
  position: fixed;
  inset-inline-end: 18px;
  bottom: 80px;
  z-index: 9999;
  width: min(300px, 92vw);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 44px rgba(0,0,0,0.28);
  padding: 16px;
  direction: rtl;
  display: none;
  font-family: 'Heebo', Arial, sans-serif;
  border: 1px solid #E6EDF3;
}
#a11y-panel[data-open="true"] { display: block; }
#a11y-panel h2 { font-size: 16px; color: #0E2F54; margin: 0 0 12px; font-weight: 800; }
.a11y-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.a11y-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: #F2F6FA; border: 2px solid transparent; border-radius: 10px;
  padding: 10px 6px; font-family: inherit; font-size: 12px; font-weight: 600;
  color: #0E2F54; cursor: pointer; text-align: center; min-height: 60px; justify-content: center;
}
.a11y-btn .ic { font-size: 20px; }
.a11y-btn[aria-pressed="true"] { border-color: #1F6CB0; background: #E6F0E0; }
.a11y-btn.active { border-color: #1F6CB0; background: #E6F0E0; }
.a11y-reset {
  width: 100%; margin-top: 10px; background: #fff; border: 1.5px solid #ccc;
  border-radius: 10px; padding: 9px; font-family: inherit; font-size: 13px;
  font-weight: 600; color: #444; cursor: pointer;
}
.a11y-reset:hover { background: #f6f6f6; }
.a11y-stmt-link { display: block; text-align: center; margin-top: 8px; font-size: 12px; color: #1F6CB0; }
