/* BLACK — Accessibility widget v2
 * Compliant with Israeli Standard IS 5568 / WCAG 2.0 AA.
 */

/* ===== Skip to main content (visible on focus) ===== */
.a11y-skip {
  position: fixed;
  top: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a73e8;
  color: #fff;
  padding: 10px 20px;
  border-radius: 0 0 8px 8px;
  font-family: Arial, sans-serif;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  z-index: 2147483647;
  transition: top 0.15s ease;
}
.a11y-skip:focus {
  top: 0;
  outline: 3px solid #ffd400;
  outline-offset: 2px;
}

/* ===== Floating toggle button ===== */
.a11y-fab {
  position: fixed;
  left: 20px;
  bottom: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #1a73e8;
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  cursor: pointer;
  z-index: 2147483646;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
.a11y-fab:hover { background: #1558b8; transform: scale(1.08); box-shadow: 0 8px 28px rgba(26,115,232,0.55); }
.a11y-fab:focus { outline: 3px solid #ffd400; outline-offset: 3px; }
.a11y-fab svg { width: 30px; height: 30px; fill: #fff; }
html[dir="rtl"] .a11y-fab,
.a11y-fab[data-a11y-rtl="1"] { left: auto; right: 20px; }

/* ===== Panel ===== */
.a11y-panel {
  position: fixed;
  left: 20px;
  bottom: 88px;
  width: 340px;
  max-width: calc(100vw - 40px);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: #ffffff;
  color: #111;
  border: 0;
  border-radius: 14px;
  box-shadow: 0 14px 50px rgba(0,0,0,0.45), 0 0 0 1px rgba(26,115,232,0.15);
  z-index: 2147483647;
  padding: 0 0 14px 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  display: none;
}
html[dir="rtl"] .a11y-panel,
.a11y-panel[dir="rtl"] { left: auto; right: 20px; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, 'Heebo', sans-serif; }
.a11y-panel.is-open { display: block; animation: a11yFade .18s ease; }
@keyframes a11yFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Header */
.a11y-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, #1a73e8, #1558b8);
  color: #fff;
  border-radius: 14px 14px 0 0;
  position: sticky;
  top: 0;
  z-index: 2;
}
.a11y-panel h2 { margin: 0; font-size: 17px; font-weight: 700; color: #fff; letter-spacing: 0.02em; }
.a11y-close {
  background: rgba(255,255,255,0.18);
  color: #fff;
  border: 0;
  font-size: 22px;
  cursor: pointer;
  width: 30px; height: 30px;
  border-radius: 50%;
  line-height: 1;
  padding: 0;
}
.a11y-close:hover, .a11y-close:focus { background: rgba(255,255,255,0.32); outline: 2px solid #ffd400; }

/* Live region */
.a11y-live { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Language switcher — large readable buttons */
.a11y-lang-row { padding: 12px 16px 4px; }
.a11y-lang-label {
  font-size: 11px;
  color: #1a73e8;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 8px;
}
.a11y-lang-pills {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.a11y-lang-pill {
  background: #f5f6f8;
  color: #222;
  border: 1px solid #e1e3e6;
  border-radius: 10px;
  padding: 10px 8px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 52px;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.a11y-lang-pill .a11y-lang-code {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  opacity: 0.7;
}
.a11y-lang-pill .a11y-lang-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.1;
}
.a11y-lang-pill:hover, .a11y-lang-pill:focus {
  background: #e3f0ff;
  border-color: #1a73e8;
  outline: 2px solid #1a73e8;
  outline-offset: 1px;
}
.a11y-lang-pill[aria-pressed="true"] {
  background: #1a73e8;
  color: #fff;
  border-color: #1558b8;
}
.a11y-lang-pill[aria-pressed="true"] .a11y-lang-code { opacity: 0.9; }

/* Sections */
.a11y-panel,
.a11y-panel * { cursor: default; }
.a11y-panel a,
.a11y-panel button,
.a11y-panel [role="button"],
.a11y-panel .a11y-btn,
.a11y-panel .a11y-step,
.a11y-panel .a11y-lang-pill,
.a11y-panel .a11y-close,
.a11y-panel .a11y-reset,
.a11y-panel .a11y-statement-link { cursor: pointer; }

.a11y-section { padding: 4px 16px 0; }
.a11y-section-title {
  margin: 14px 0 10px;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #1a73e8;
  font-weight: 700;
  position: relative;
}
.a11y-section-title::before {
  content: '';
  position: absolute;
  left: -16px;
  right: -16px;
  top: -8px;
  height: 1px;
  background: #eee;
}
.a11y-section:first-of-type .a11y-section-title::before { display: none; }
.a11y-section:first-of-type .a11y-section-title { margin-top: 4px; }

/* Step rows */
.a11y-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
.a11y-row label { flex: 1; font-weight: 600; color: #222; font-size: 13px; }
.a11y-step {
  background: #1a73e8;
  color: #fff;
  border: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
}
.a11y-step:hover, .a11y-step:focus { background: #1558b8; outline: 2px solid #ffd400; }
.a11y-step:disabled { background: #bbb; cursor: not-allowed; }
.a11y-val { min-width: 42px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; color: #1a73e8; }

/* Toggle grid */
.a11y-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.a11y-btn {
  background: #f5f6f8;
  color: #222;
  border: 1px solid #e1e3e6;
  border-radius: 8px;
  padding: 10px 6px;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  text-align: center;
  line-height: 1.2;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.a11y-btn:hover, .a11y-btn:focus { background: #e3f0ff; border-color: #1a73e8; outline: 2px solid #1a73e8; outline-offset: 1px; }
.a11y-btn[aria-pressed="true"] { background: #1a73e8; color: #fff; border-color: #1558b8; }
.a11y-btn .a11y-icon { display: block; font-size: 18px; margin-bottom: 4px; line-height: 1; }
.a11y-btn .a11y-label { display: block; font-weight: 600; }

/* Reset + statement */
.a11y-reset {
  display: block;
  width: calc(100% - 32px);
  margin: 14px 16px 4px;
  padding: 10px;
  background: #d93025;
  color: #fff;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  font-family: inherit;
}
.a11y-reset:hover, .a11y-reset:focus { background: #a52319; outline: 3px solid #ffd400; }
.a11y-statement-link {
  display: block;
  text-align: center;
  margin: 8px 16px 0;
  color: #1a73e8;
  font-size: 12px;
  text-decoration: underline;
}
.a11y-statement-link:hover, .a11y-statement-link:focus { color: #1558b8; outline: 2px solid #1a73e8; outline-offset: 2px; }

/* ============================================================
   Modes applied to <html>
   ============================================================ */

/* High contrast */
html.a11y-contrast,
html.a11y-contrast body,
html.a11y-contrast *:not(.a11y-fab):not(.a11y-fab *):not(.a11y-panel):not(.a11y-panel *):not(.a11y-skip) {
  background-color: #000 !important;
  color: #ffd400 !important;
  border-color: #ffd400 !important;
}
html.a11y-contrast a,
html.a11y-contrast a * { color: #00e5ff !important; text-decoration: underline !important; }
html.a11y-contrast img,
html.a11y-contrast video { filter: grayscale(1) contrast(1.2); }

/* Negative (invert) */
html.a11y-negative { filter: invert(1) hue-rotate(180deg); background: #fff; }
html.a11y-negative img, html.a11y-negative video, html.a11y-negative iframe,
html.a11y-negative .a11y-fab, html.a11y-negative .a11y-panel, html.a11y-negative .a11y-skip {
  filter: invert(1) hue-rotate(180deg);
}

/* Light bg */
html.a11y-light,
html.a11y-light body,
html.a11y-light *:not(.a11y-fab):not(.a11y-fab *):not(.a11y-panel):not(.a11y-panel *):not(.a11y-skip) {
  background-color: #ffffff !important;
  color: #111 !important;
  border-color: #333 !important;
}
html.a11y-light a, html.a11y-light a * { color: #0044cc !important; text-decoration: underline !important; }

/* Grayscale */
html.a11y-grayscale { filter: grayscale(1); }
html.a11y-grayscale .a11y-fab, html.a11y-grayscale .a11y-panel, html.a11y-grayscale .a11y-skip { filter: none; }

/* Highlight links */
html.a11y-links a, html.a11y-links a * {
  text-decoration: underline !important;
  outline: 2px dashed #1a73e8 !important;
  outline-offset: 2px;
  background: #fff8b3 !important;
  color: #0044cc !important;
}

/* Highlight headings */
html.a11y-headings :is(h1,h2,h3,h4,h5,h6) {
  outline: 2px solid #ff6f00 !important;
  outline-offset: 4px;
  background: rgba(255,224,130,0.45) !important;
}

/* Readable / dyslexia-friendly */
html.a11y-readable,
html.a11y-readable body,
html.a11y-readable *:not(.a11y-fab):not(.a11y-fab *):not(.a11y-panel):not(.a11y-panel *) {
  font-family: Arial, Verdana, Tahoma, sans-serif !important;
  letter-spacing: 0.04em !important;
  word-spacing: 0.08em !important;
  line-height: 1.7 !important;
  font-weight: 500 !important;
}

/* Line spacing levels */
html.a11y-line-1 * { line-height: 1.6 !important; }
html.a11y-line-2 * { line-height: 1.9 !important; }
html.a11y-line-3 * { line-height: 2.2 !important; }

/* Letter spacing levels */
html.a11y-letter-1 * { letter-spacing: 0.04em !important; }
html.a11y-letter-2 * { letter-spacing: 0.09em !important; }
html.a11y-letter-3 * { letter-spacing: 0.15em !important; }

/* Stop animations */
html.a11y-no-anim,
html.a11y-no-anim *,
html.a11y-no-anim *::before,
html.a11y-no-anim *::after {
  animation: none !important;
  animation-duration: 0s !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Reading guide — horizontal bar that follows the cursor */
html.a11y-guide { cursor: crosshair; }
html.a11y-guide::after {
  content: '';
  position: fixed;
  left: 0; right: 0;
  height: 60px;
  background: rgba(0,0,0,0.0);
  border-top: 2px solid #1a73e8;
  border-bottom: 2px solid #1a73e8;
  pointer-events: none;
  z-index: 2147483645;
  top: var(--a11y-guide-y, 50vh);
  transform: translateY(-30px);
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.35);
}

/* Big cursor */
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='4,2 4,42 14,32 22,46 28,44 20,30 32,28' fill='black' stroke='white' stroke-width='2'/></svg>") 4 2, auto !important;
}
html.a11y-big-cursor a, html.a11y-big-cursor button, html.a11y-big-cursor [role="button"] {
  cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'><path d='M14 4 L14 28 L20 22 L26 36 L32 34 L26 20 L34 20 Z' fill='%231a73e8' stroke='white' stroke-width='2'/></svg>") 14 4, pointer !important;
}

/* Strong keyboard focus */
html.a11y-focus *:focus { outline: 3px solid #ffd400 !important; outline-offset: 2px !important; }

/* Print */
@media print {
  .a11y-fab, .a11y-panel, .a11y-skip { display: none !important; }
}

/* Mobile */
@media (max-width: 480px) {
  .a11y-fab { width: 50px; height: 50px; left: 12px; bottom: 12px; }
  html[dir="rtl"] .a11y-fab,
  .a11y-fab[data-a11y-rtl="1"] { right: 12px; left: auto; }
  .a11y-panel { left: 12px; right: 12px; bottom: 72px; width: auto; max-width: none; }
  html[dir="rtl"] .a11y-panel,
  .a11y-panel[dir="rtl"] { right: 12px; left: 12px; }
  .a11y-grid { grid-template-columns: 1fr 1fr; }
}
