/* ═══════════════════════════════════════════
   ACCESSIBILITY WIDGET — תקן ישראלי IS 5568
   ═══════════════════════════════════════════ */

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* כפתור צף */
.a11y-toggle {
  position: fixed;
  bottom: 1.75rem;
  right: 1.75rem;
  z-index: 950;
  width: 52px; height: 52px;
  border-radius: 50%;
  background: #1a4fb8;
  color: #fff;
  border: 2px solid #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(26,79,184,0.45);
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}
.a11y-toggle:hover,
.a11y-toggle:focus-visible {
  transform: scale(1.08);
  background: #2563d9;
  box-shadow: 0 6px 28px rgba(26,79,184,0.65);
  outline: none;
}
.a11y-toggle:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* פאנל */
.a11y-panel {
  position: fixed;
  bottom: 5.5rem;
  right: 1.75rem;
  z-index: 951;
  width: min(360px, calc(100vw - 2rem));
  max-height: calc(100vh - 7rem);
  background: #ffffff;
  color: #111;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  direction: rtl;
  text-align: right;
}
.a11y-panel[hidden] { display: none; }

.a11y-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #1a4fb8;
  color: #fff;
}
.a11y-panel__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}
.a11y-panel__close {
  background: transparent;
  border: 0;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
}
.a11y-panel__close:hover,
.a11y-panel__close:focus-visible {
  background: rgba(255,255,255,0.18);
  outline: none;
}

.a11y-panel__body {
  padding: 1rem 1.25rem 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.a11y-group__title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: none;
  color: #555;
  margin: 0 0 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid #eee;
}

/* גודל טקסט */
.a11y-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
}
.a11y-btn {
  background: #f4f6fb;
  border: 1px solid #d8def0;
  color: #1a4fb8;
  padding: 0.7rem 0.5rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.a11y-btn:hover,
.a11y-btn:focus-visible {
  background: #1a4fb8;
  border-color: #1a4fb8;
  color: #fff;
  outline: none;
}
.a11y-current {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: #777;
  text-align: center;
}

/* אפשרויות הפעלה/כיבוי */
.a11y-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: #f4f6fb;
  border: 1px solid #d8def0;
  color: #111;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.92rem;
  text-align: right;
  transition: background .15s, border-color .15s, color .15s;
  margin-bottom: 0.4rem;
}
.a11y-option:last-child { margin-bottom: 0; }
.a11y-option:hover,
.a11y-option:focus-visible {
  background: #e8eefb;
  border-color: #1a4fb8;
  outline: none;
}
.a11y-option__icon {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.95rem;
  border: 1px solid #d8def0;
  flex-shrink: 0;
}
.a11y-option__label {
  flex: 1;
  font-weight: 500;
}
.a11y-option__status {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #c5cde0;
  flex-shrink: 0;
  position: relative;
}
.a11y-option.is-active {
  background: #1a4fb8;
  border-color: #1a4fb8;
  color: #fff;
}
.a11y-option.is-active .a11y-option__icon {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border-color: transparent;
}
.a11y-option.is-active .a11y-option__status {
  background: #fff;
  border-color: #fff;
}
.a11y-option.is-active .a11y-option__status::after {
  content: '';
  position: absolute;
  inset: 3px;
  background: #1a4fb8;
  border-radius: 50%;
}

/* כפתור איפוס */
.a11y-reset {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: #fff;
  border: 1px solid #d8def0;
  color: #b91c1c;
  padding: 0.7rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.a11y-reset:hover,
.a11y-reset:focus-visible {
  background: #b91c1c;
  color: #fff;
  border-color: #b91c1c;
  outline: none;
}

.a11y-footer {
  text-align: center;
  padding-top: 0.5rem;
  border-top: 1px solid #eee;
}
.a11y-statement-link {
  font-size: 0.85rem;
  color: #1a4fb8;
  text-decoration: underline;
  cursor: pointer;
}
.a11y-statement-link:hover,
.a11y-statement-link:focus-visible {
  color: #0f3a8c;
  outline: none;
}

/* מובייל */
@media (max-width: 480px) {
  .a11y-toggle { width: 48px; height: 48px; bottom: 1rem; right: 1rem; }
  .a11y-panel { right: 0.75rem; bottom: 4.5rem; }
}

/* ═══════════════════════════════════════════
   הצהרת נגישות — Modal
   ═══════════════════════════════════════════ */
.a11y-statement {
  position: fixed;
  inset: 0;
  z-index: 970;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.a11y-statement[hidden] { display: none; }
.a11y-statement__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.7);
  cursor: pointer;
}
.a11y-statement__content {
  position: relative;
  background: #fff;
  color: #111;
  border-radius: 14px;
  max-width: 720px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2rem;
  direction: rtl;
  text-align: right;
  font-family: 'Inter', system-ui, sans-serif;
  line-height: 1.7;
}
.a11y-statement__close {
  position: absolute;
  top: 0.85rem;
  left: 0.85rem;
  background: #f3f4f6;
  border: 0;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: #111;
}
.a11y-statement__close:hover,
.a11y-statement__close:focus-visible {
  background: #1a4fb8;
  color: #fff;
  outline: none;
}
.a11y-statement__title {
  margin: 0 0 1rem;
  color: #1a4fb8;
  font-size: 1.5rem;
  font-weight: 700;
}
.a11y-statement__body h3 {
  margin: 1.4rem 0 0.5rem;
  color: #1a4fb8;
  font-size: 1.05rem;
}
.a11y-statement__body p { margin: 0 0 0.75rem; }
.a11y-statement__body ul {
  padding-right: 1.5rem;
  margin: 0 0 1rem;
}
.a11y-statement__body li { margin-bottom: 0.3rem; }
.a11y-statement__body a {
  color: #1a4fb8;
  text-decoration: underline;
}
.a11y-statement__updated {
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: #777;
}

/* ═══════════════════════════════════════════
   מצבי נגישות — מופעלים דרך data-a11y על <html>
   ═══════════════════════════════════════════ */

/* ניגודיות גבוהה */
html[data-a11y-high-contrast] body,
html[data-a11y-high-contrast] body * {
  background: #000 !important;
  color: #ffff00 !important;
  border-color: #ffff00 !important;
}
html[data-a11y-high-contrast] body a,
html[data-a11y-high-contrast] body a * {
  color: #00ffff !important;
}
html[data-a11y-high-contrast] body img,
html[data-a11y-high-contrast] body video,
html[data-a11y-high-contrast] body iframe {
  filter: contrast(1.4) brightness(1.05);
}
html[data-a11y-high-contrast] .a11y-panel,
html[data-a11y-high-contrast] .a11y-panel *,
html[data-a11y-high-contrast] .a11y-statement,
html[data-a11y-high-contrast] .a11y-statement * {
  background: revert !important;
  color: revert !important;
  border-color: revert !important;
}

/* ניגודיות הפוכה */
html[data-a11y-negative-contrast] body {
  filter: invert(100%) hue-rotate(180deg);
}
html[data-a11y-negative-contrast] body img,
html[data-a11y-negative-contrast] body video,
html[data-a11y-negative-contrast] body iframe {
  filter: invert(100%) hue-rotate(180deg);
}

/* רקע בהיר */
html[data-a11y-light-mode] body {
  background: #ffffff !important;
  color: #111 !important;
}
html[data-a11y-light-mode] body * {
  background-color: transparent !important;
  color: #111 !important;
  border-color: #ccc !important;
}
html[data-a11y-light-mode] body a,
html[data-a11y-light-mode] body a * {
  color: #1a4fb8 !important;
}
html[data-a11y-light-mode] .a11y-panel,
html[data-a11y-light-mode] .a11y-panel *,
html[data-a11y-light-mode] .a11y-statement,
html[data-a11y-light-mode] .a11y-statement * {
  background-color: revert !important;
  color: revert !important;
  border-color: revert !important;
}

/* גוונים אפורים */
html[data-a11y-grayscale] body {
  filter: grayscale(100%);
}

/* גופן קריא */
html[data-a11y-readable-font] body,
html[data-a11y-readable-font] body *:not(.a11y-panel):not(.a11y-panel *):not(.a11y-statement):not(.a11y-statement *) {
  font-family: Arial, 'Segoe UI', Tahoma, sans-serif !important;
  letter-spacing: 0.02em !important;
  line-height: 1.7 !important;
}

/* הדגשת קישורים */
html[data-a11y-highlight-links] body a:not(.a11y-panel a):not(.a11y-statement a) {
  text-decoration: underline !important;
  outline: 2px dashed #ffd400 !important;
  outline-offset: 2px !important;
  background: rgba(255,212,0,0.12) !important;
}

/* הדגשת כותרות */
html[data-a11y-highlight-headings] body :is(h1,h2,h3,h4,h5,h6):not(.a11y-panel *):not(.a11y-statement *) {
  outline: 2px solid #00d4ff !important;
  outline-offset: 4px !important;
  background: rgba(0,212,255,0.08) !important;
}

/* סמן גדול */
html[data-a11y-big-cursor],
html[data-a11y-big-cursor] body,
html[data-a11y-big-cursor] body * {
  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 d='M3 2l7 18 2.5-7.5L20 10z' fill='%23000' stroke='%23fff' stroke-width='1.5' stroke-linejoin='round'/></svg>") 0 0, auto !important;
}
html[data-a11y-big-cursor] body a,
html[data-a11y-big-cursor] body button,
html[data-a11y-big-cursor] body [role="button"] {
  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 d='M6 2v16l4-4 3 7 3-1.5-3-7h6z' fill='%23000' stroke='%23fff' stroke-width='1.5' stroke-linejoin='round'/></svg>") 0 0, pointer !important;
}

/* עצירת אנימציות */
html[data-a11y-stop-animations],
html[data-a11y-stop-animations] *,
html[data-a11y-stop-animations] *::before,
html[data-a11y-stop-animations] *::after {
  animation-duration: 0s !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0s !important;
  transition-delay: 0s !important;
  scroll-behavior: auto !important;
}
html[data-a11y-stop-animations] video,
html[data-a11y-stop-animations] iframe[src*="vimeo"],
html[data-a11y-stop-animations] iframe[src*="youtube"] {
  visibility: hidden;
}

/* גודל טקסט דינמי */
html[data-a11y-font-scale] body {
  font-size: calc(1em * var(--a11y-font-scale, 1));
}
