/* ==========================================================================
   ווידג'ט נגישות + תוספי נגישות לפי תקן IS 5568 ו-WCAG 2.1 AA.
   - תפריט קבוע צף בצד שמאל (RTL) שניתן לפתיחה ע"י לחיצה או מקש Tab+Enter
   - מצבי תצוגה: גודל גופן, ניגודיות, גרייסקייל, הדגשת קישורים, השהיית אנימציות
   - ניתן ליבטל כל מצב או לאפס הכל לברירת המחדל
   - העדפות נשמרות ב-localStorage כדי שלא יחזרו בכל גלישה
   ========================================================================== */

:root {
  --a11y-zoom: 1;
}

/* skip-to-content link — נגיש רק במקלדת */
.a11y-skip-link {
  position: absolute;
  top: -1000px;
  right: 0;
  background: #000;
  color: #fff;
  padding: 12px 24px;
  z-index: 99999;
  font-weight: 800;
  text-decoration: none;
  border: 3px solid var(--orange);
}
.a11y-skip-link:focus {
  top: 0;
  outline: 3px solid var(--orange);
}

/* כפתור פתיחת התפריט */
.a11y-trigger {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--orange, #FF6A00);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 900;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}
.a11y-trigger:hover,
.a11y-trigger:focus-visible {
  transform: scale(1.08);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  outline: 3px solid #fff;
  outline-offset: 3px;
}
.a11y-trigger svg { width: 28px; height: 28px; fill: #fff; }

/* התפריט עצמו */
.a11y-panel {
  position: fixed;
  bottom: 90px;
  left: 20px;
  width: 320px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: #ffffff;
  color: #1A1410;
  border-radius: 18px;
  padding: 24px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.30);
  z-index: 9998;
  border: 1.5px solid rgba(0, 0, 0, 0.10);
  display: none;
  font-family: inherit;
  direction: rtl;
}
.a11y-panel[aria-hidden="false"] { display: block; }

.a11y-panel h2 {
  font-size: 1.15rem;
  margin: 0 0 6px;
  color: #1A1410;
  font-weight: 900;
  letter-spacing: -0.01em;
}
.a11y-panel p.a11y-subtitle {
  font-size: 0.85rem;
  color: rgba(26, 20, 16, 0.6);
  margin: 0 0 18px;
  line-height: 1.4;
}

.a11y-section {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  padding: 14px 0;
}
.a11y-section:first-of-type { border-top: none; padding-top: 0; }
.a11y-section h3 {
  font-size: 0.78rem;
  font-weight: 800;
  color: rgba(26, 20, 16, 0.55);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: 0 0 10px;
}

.a11y-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.a11y-btn {
  flex: 1;
  min-width: 0;
  padding: 10px 8px;
  background: #f5f5f5;
  border: 1.5px solid rgba(0, 0, 0, 0.10);
  border-radius: 10px;
  color: #1A1410;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
}
.a11y-btn:hover,
.a11y-btn:focus-visible {
  background: var(--orange, #FF6A00);
  color: #fff;
  border-color: var(--orange, #FF6A00);
  outline: 2px solid #fff;
  outline-offset: 2px;
}
.a11y-btn[aria-pressed="true"] {
  background: var(--orange, #FF6A00);
  color: #fff;
  border-color: var(--orange, #FF6A00);
}

.a11y-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  cursor: pointer;
}
.a11y-toggle-row span {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1A1410;
}
.a11y-switch {
  width: 40px;
  height: 22px;
  background: #ccc;
  border-radius: 99px;
  position: relative;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.2s;
}
.a11y-switch::before {
  content: "";
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.a11y-switch[aria-pressed="true"] { background: var(--orange, #FF6A00); }
.a11y-switch[aria-pressed="true"]::before { transform: translateX(-18px); }
.a11y-switch:focus-visible { outline: 3px solid var(--orange, #FF6A00); outline-offset: 2px; }

.a11y-reset {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: transparent;
  border: 1.5px solid rgba(0, 0, 0, 0.20);
  border-radius: 10px;
  color: #1A1410;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.18s;
}
.a11y-reset:hover,
.a11y-reset:focus-visible {
  background: #1A1410;
  color: #fff;
  border-color: #1A1410;
}

.a11y-statement-link {
  display: block;
  margin-top: 14px;
  font-size: 0.82rem;
  color: rgba(26, 20, 16, 0.6);
  text-align: center;
  text-decoration: underline;
}
.a11y-statement-link:hover,
.a11y-statement-link:focus-visible { color: var(--orange, #FF6A00); }

/* ============ מצבי תצוגה (מופעלים דרך classes על <html>) ============ */

/* 1. גודל גופן */
html.a11y-zoom-110 { font-size: 110%; }
html.a11y-zoom-120 { font-size: 120%; }
html.a11y-zoom-130 { font-size: 130%; }

/* 2. ניגודיות גבוהה */
html.a11y-contrast-high {
  filter: contrast(1.4);
  background: #000 !important;
}
html.a11y-contrast-high body {
  background: #000 !important;
  color: #fff !important;
}
html.a11y-contrast-high * {
  background-color: #000 !important;
  color: #ffff00 !important;
  border-color: #fff !important;
}
html.a11y-contrast-high a,
html.a11y-contrast-high a * {
  color: #00ffff !important;
}

/* 3. ניגודיות מהופכת */
html.a11y-contrast-inverted {
  filter: invert(1) hue-rotate(180deg);
}
html.a11y-contrast-inverted img,
html.a11y-contrast-inverted video,
html.a11y-contrast-inverted iframe {
  filter: invert(1) hue-rotate(180deg);
}

/* 4. גרייסקייל */
html.a11y-grayscale {
  filter: grayscale(100%);
}

/* 5. הדגשת קישורים */
html.a11y-highlight-links a {
  background: #ffff00 !important;
  color: #000 !important;
  text-decoration: underline !important;
  font-weight: 900 !important;
  padding: 2px 4px !important;
  outline: 2px solid #000 !important;
}

/* 6. הדגשת כותרות */
html.a11y-highlight-headings h1,
html.a11y-highlight-headings h2,
html.a11y-highlight-headings h3 {
  background: #fff3cd !important;
  border-right: 4px solid var(--orange, #FF6A00) !important;
  padding: 6px 12px !important;
  border-radius: 4px;
}

/* 7. השהיית אנימציות */
html.a11y-no-animations *,
html.a11y-no-animations *::before,
html.a11y-no-animations *::after {
  animation-duration: 0.001s !important;
  animation-delay: 0s !important;
  transition-duration: 0.001s !important;
  transition-delay: 0s !important;
  scroll-behavior: auto !important;
}

/* 8. גופן קריא */
html.a11y-readable-font *,
html.a11y-readable-font *::before,
html.a11y-readable-font *::after {
  font-family: Arial, "Open Sans Hebrew", "Segoe UI", sans-serif !important;
  letter-spacing: 0.03em !important;
  word-spacing: 0.05em !important;
  line-height: 1.7 !important;
}

/* 9. תזוזת עכבר גדולה (cursor enlarged) */
html.a11y-big-cursor,
html.a11y-big-cursor * {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48"><polygon points="6,6 6,40 14,32 20,44 28,40 22,28 36,28" fill="black" stroke="white" stroke-width="2"/></svg>') 6 6, auto !important;
}

/* 10. focus indicator חזק */
html.a11y-strong-focus *:focus-visible,
html.a11y-strong-focus *:focus {
  outline: 3px solid var(--orange, #FF6A00) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px rgba(255, 106, 0, 0.30) !important;
}

/* תמיכה ב-prefers-reduced-motion (ברירת מחדל מערכת) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001s !important;
    transition-duration: 0.001s !important;
  }
}
