/* ============================================================
   KEDEM — Accessibility widget (עמידה בתקן הישראלי 5568 / WCAG 2.0 AA)
   Loaded after styles.css — reuses the site's :root tokens.
   ============================================================ */

/* ---------- Floating toggle button ---------- */
.a11y-toggle {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 9999;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: none;
  background: var(--charcoal, #2A2218);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s ease, background 0.2s ease;
}
.a11y-toggle:hover,
.a11y-toggle:focus-visible {
  background: var(--gold-dark, #9A7535);
  transform: scale(1.06);
}
.a11y-toggle:focus-visible {
  outline: 3px solid #ffe14d;
  outline-offset: 3px;
}
.a11y-toggle svg { width: 28px; height: 28px; }

/* ---------- Panel ---------- */
.a11y-panel {
  position: fixed;
  bottom: 84px;
  left: 20px;
  z-index: 9999;
  width: min(320px, calc(100vw - 40px));
  max-height: min(600px, calc(100vh - 120px));
  overflow-y: auto;
  background: #fff;
  color: #1a1a1a;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  font-family: var(--f-body, Arial, sans-serif);
  transform: translateY(12px) scale(0.98);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.a11y-panel.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.a11y-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: var(--charcoal, #2A2218);
  color: #fff;
  border-radius: 16px 16px 0 0;
  position: sticky;
  top: 0;
}
.a11y-panel-head h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}
.a11y-close {
  border: none;
  background: transparent;
  color: #fff;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.a11y-close:hover,
.a11y-close:focus-visible { background: rgba(255, 255, 255, 0.15); }

.a11y-body {
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.a11y-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  background: #fafafa;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  color: #1a1a1a;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.a11y-item svg { width: 22px; height: 22px; }
.a11y-item:hover { background: #f0e9d8; }
.a11y-item[aria-pressed="true"] {
  background: var(--gold, #C9A455);
  border-color: var(--gold-dark, #9A7535);
  color: #1a1a1a;
}
.a11y-item:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 2px;
}
.a11y-fontrow {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #e2e2e2;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fafafa;
}
.a11y-fontrow span { font-size: 12.5px; font-weight: 600; }
.a11y-fontbtns { display: flex; gap: 6px; }
.a11y-fontbtns button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #d8d8d8;
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}
.a11y-fontbtns button:hover { background: #f0e9d8; }
.a11y-fontbtns button:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 1px;
}

.a11y-footrow {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}
.a11y-reset,
.a11y-statement-btn {
  border: 1px solid #d8d8d8;
  background: #fff;
  border-radius: 10px;
  padding: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  color: #1a1a1a;
  text-decoration: none;
  display: block;
}
.a11y-reset:hover,
.a11y-statement-btn:hover { background: #f0e9d8; }
.a11y-reset:focus-visible,
.a11y-statement-btn:focus-visible {
  outline: 3px solid #1a73e8;
  outline-offset: 2px;
}

/* ---------- Statement modal ---------- */
.a11y-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.a11y-modal-backdrop.open { display: flex; }
.a11y-modal {
  background: #fff;
  color: #1a1a1a;
  border-radius: 14px;
  max-width: 560px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  padding: 28px;
  font-family: var(--f-body, Arial, sans-serif);
  line-height: 1.7;
  font-size: 14.5px;
}
.a11y-modal h2 { font-size: 20px; margin-bottom: 14px; }
.a11y-modal p { margin-bottom: 12px; }
.a11y-modal .a11y-close { color: #1a1a1a; position: static; margin-inline-start: auto; display: flex; }
.a11y-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

/* ============================================================
   ACTIVE ACCESSIBILITY MODES (applied on <html>)
   ============================================================ */

/* Underline all links */
html.a11y-underline a { text-decoration: underline !important; }

/* Highlight headings */
html.a11y-headings h1,
html.a11y-headings h2,
html.a11y-headings h3,
html.a11y-headings h4,
html.a11y-headings h5,
html.a11y-headings h6 {
  background: #fff59d !important;
  color: #111 !important;
  outline: 2px solid #f2c200;
  box-shadow: none !important;
  -webkit-text-fill-color: #111 !important;
}

/* Readable font */
html.a11y-readable-font body,
html.a11y-readable-font h1,
html.a11y-readable-font h2,
html.a11y-readable-font h3,
html.a11y-readable-font h4,
html.a11y-readable-font h5,
html.a11y-readable-font h6,
html.a11y-readable-font p,
html.a11y-readable-font a,
html.a11y-readable-font span,
html.a11y-readable-font li,
html.a11y-readable-font button,
html.a11y-readable-font input,
html.a11y-readable-font textarea {
  font-family: Arial, Helvetica, sans-serif !important;
  letter-spacing: 0.02em !important;
  line-height: 1.7 !important;
}

/* Grayscale */
html.a11y-grayscale { filter: grayscale(1) !important; }

/* High contrast (black background / yellow text — familiar pattern on IL gov & institutional sites) */
html.a11y-contrast,
html.a11y-contrast body {
  background: #000 !important;
}
html.a11y-contrast * {
  background-color: #000 !important;
  color: #ffe14d !important;
  border-color: #ffe14d !important;
  box-shadow: none !important;
  text-shadow: none !important;
  -webkit-text-fill-color: #ffe14d !important;
}
html.a11y-contrast a,
html.a11y-contrast a * { color: #7fc4ff !important; -webkit-text-fill-color: #7fc4ff !important; }
html.a11y-contrast img,
html.a11y-contrast video {
  filter: grayscale(1) contrast(1.15) !important;
  background: #000 !important;
}
html.a11y-contrast svg { fill: currentColor !important; }
/* Keep the accessibility widget itself legible while contrast mode is on */
html.a11y-contrast .a11y-toggle,
html.a11y-contrast .a11y-toggle * { background-color: var(--charcoal, #2A2218) !important; color: #fff !important; -webkit-text-fill-color: #fff !important; border-color: #fff !important; }
html.a11y-contrast .a11y-panel,
html.a11y-contrast .a11y-panel * { background-color: #fff !important; color: #1a1a1a !important; -webkit-text-fill-color: #1a1a1a !important; }
html.a11y-contrast .a11y-panel-head,
html.a11y-contrast .a11y-panel-head * { background-color: var(--charcoal, #2A2218) !important; color: #fff !important; -webkit-text-fill-color: #fff !important; }
html.a11y-contrast .a11y-item[aria-pressed="true"] { background-color: var(--gold, #C9A455) !important; }
html.a11y-contrast .a11y-modal,
html.a11y-contrast .a11y-modal * { background-color: #fff !important; color: #1a1a1a !important; -webkit-text-fill-color: #1a1a1a !important; }

/* Stop animations / autoplay video */
html.a11y-stop-anim *,
html.a11y-stop-anim *::before,
html.a11y-stop-anim *::after {
  animation-play-state: paused !important;
  transition: none !important;
}
html.a11y-stop-anim video { display: none !important; }
html.a11y-stop-anim [data-a11y-poster-fallback] { display: block !important; }

/* Large cursor */
html.a11y-big-cursor,
html.a11y-big-cursor * {
  cursor: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l16 8-6.5 2 3.5 7-3 1.5-3.5-7L6 18z' fill='%23000' stroke='%23fff' stroke-width='1.2'/%3E%3C/svg%3E") 2 2, auto !important;
}

/* Strong visible keyboard focus */
html.a11y-focus-ring *:focus {
  outline: 3px solid #1a73e8 !important;
  outline-offset: 3px !important;
}

@media (max-width: 480px) {
  .a11y-toggle { bottom: 14px; left: 14px; width: 46px; height: 46px; }
  .a11y-toggle svg { width: 24px; height: 24px; }
  .a11y-panel { left: 14px; bottom: 70px; }
}
