/* ======================================================
   ACCESSIBILITY TOOLBAR — תקן ישראלי 5568 + WCAG 2.1 AA
   ====================================================== */

.a11y-toolbar {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 99999;
  font-family: var(--font-base);
  direction: rtl;
}

.a11y-toolbar__trigger {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translate(-100%, -50%);
  width: 48px;
  height: 48px;
  border-radius: 12px 0 0 12px;
  background: #1a56db;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: -2px 2px 12px rgba(0,0,0,.2);
  transition: background 200ms, transform 200ms;
}
.a11y-toolbar__trigger:hover,
.a11y-toolbar__trigger:focus-visible {
  background: #1e40af;
  transform: translate(-100%, -50%) scale(1.05);
}
.a11y-toolbar__trigger:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 2px;
}
.a11y-toolbar__trigger[aria-expanded="true"] {
  background: #1e40af;
}

.a11y-toolbar__panel {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%) translateX(100%);
  width: 300px;
  max-height: 85vh;
  background: #fff;
  border-radius: 16px 0 0 16px;
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transition: transform 300ms cubic-bezier(.16,1,.3,1), opacity 200ms;
}
.a11y-toolbar__panel[aria-hidden="false"] {
  transform: translateY(-50%) translateX(0);
  opacity: 1;
  pointer-events: auto;
}

.a11y-toolbar__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e5e7eb;
  background: #f9fafb;
  border-radius: 16px 0 0 0;
  position: sticky;
  top: 0;
  z-index: 1;
}
.a11y-toolbar__title {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0;
}
.a11y-toolbar__close {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: background 150ms, color 150ms;
}
.a11y-toolbar__close:hover,
.a11y-toolbar__close:focus-visible {
  background: #fee2e2;
  color: #b91c1c;
}

.a11y-toolbar__body {
  padding: 12px 16px 20px;
}

.a11y-group {
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #f3f4f6;
}
.a11y-group:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.a11y-group__label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #6b7280;
  margin-bottom: 8px;
}

.a11y-group__controls {
  display: flex;
  gap: 8px;
}
.a11y-group__controls button {
  flex: 1;
  padding: 10px 8px;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-base);
  cursor: pointer;
  color: #374151;
  transition: all 150ms;
  text-align: center;
}
.a11y-group__controls button:hover {
  background: #f3f4f6;
  border-color: #9ca3af;
}
.a11y-group__controls button:focus-visible {
  outline: 3px solid #1a56db;
  outline-offset: 2px;
}
.a11y-group__controls button[aria-pressed="true"] {
  background: #1a56db;
  color: #fff;
  border-color: #1a56db;
}

.a11y-group__controls--stack {
  flex-direction: column;
  gap: 6px;
}
.a11y-group__controls--stack button {
  text-align: right;
  padding: 10px 14px;
}

.a11y-group--reset {
  padding-top: 8px;
}
.a11y-reset-btn {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  border: 2px solid #ef4444;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-base);
  cursor: pointer;
  transition: all 150ms;
}
.a11y-reset-btn:hover {
  background: #fee2e2;
}
.a11y-reset-btn:focus-visible {
  outline: 3px solid #1a56db;
  outline-offset: 2px;
}

.a11y-group--link a {
  display: block;
  padding: 10px 14px;
  border-radius: 8px;
  background: #f3f4f6;
  color: #1a56db;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
  text-align: center;
  transition: background 150ms;
}
.a11y-group--link a:hover {
  background: #e5e7eb;
}
.a11y-group--link a:focus-visible {
  outline: 3px solid #1a56db;
  outline-offset: 2px;
}

.a11y-reading-guide {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  height: 12px;
  background: rgba(26, 86, 219, .18);
  border-top: 2px solid rgba(26, 86, 219, .5);
  border-bottom: 2px solid rgba(26, 86, 219, .5);
  pointer-events: none;
  z-index: 99998;
  transition: top 50ms linear;
}
.a11y-reading-guide[aria-hidden="false"] {
  display: block;
}

body.a11y-high-contrast {
  --bg: #000 !important;
  --surface: #000 !important;
  --surface-hover: #111 !important;
  --text-primary: #fff !important;
  --text-secondary: #ff0 !important;
  --text-tertiary: #0ff !important;
  --accent: #ff0 !important;
  --accent-hover: #ffd700 !important;
  --border: #ff0 !important;
  --border-strong: #ff0 !important;
}
body.a11y-high-contrast * {
  border-color: #ff0 !important;
  text-shadow: none !important;
}
body.a11y-high-contrast img {
  filter: contrast(1.2);
}
body.a11y-high-contrast .site-nav {
  background: #000 !important;
  border-bottom: 2px solid #ff0 !important;
}
body.a11y-high-contrast a {
  color: #ff0 !important;
  text-decoration: underline !important;
}
body.a11y-high-contrast button,
body.a11y-high-contrast .nav-cta {
  border: 2px solid #ff0 !important;
}

body.a11y-invert {
  filter: invert(1) hue-rotate(180deg);
}
body.a11y-invert img,
body.a11y-invert video,
body.a11y-invert iframe,
body.a11y-invert .a11y-toolbar {
  filter: invert(1) hue-rotate(180deg);
}

body.a11y-grayscale {
  filter: grayscale(1);
}
body.a11y-grayscale .a11y-toolbar {
  filter: grayscale(0);
}

body.a11y-highlight-links a {
  outline: 3px solid #ff6600 !important;
  outline-offset: 2px;
  background: rgba(255, 102, 0, .08) !important;
}

body.a11y-highlight-headings h1,
body.a11y-highlight-headings h2,
body.a11y-highlight-headings h3,
body.a11y-highlight-headings h4,
body.a11y-highlight-headings h5,
body.a11y-highlight-headings h6 {
  outline: 3px solid #22c55e !important;
  outline-offset: 2px;
  background: rgba(34, 197, 94, .08) !important;
}

body.a11y-big-cursor,
body.a11y-big-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M8 4l28 20-12 2 8 16-6 2-8-16-10 10z' fill='%23000' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") 4 4, auto !important;
}

body.a11y-line-height * {
  line-height: 2.2 !important;
}

body.a11y-letter-spacing * {
  letter-spacing: 2px !important;
  word-spacing: 4px !important;
}

body.a11y-readable-font * {
  font-family: Arial, Helvetica, sans-serif !important;
}

body.a11y-stop-animations,
body.a11y-stop-animations * {
  animation: none !important;
  transition: none !important;
}
body.a11y-stop-animations .reading-progress {
  display: none !important;
}

*:focus-visible {
  outline: 3px solid #1a56db !important;
  outline-offset: 3px;
}

@media (max-width: 768px) {
  .a11y-toolbar {
    top: auto;
    bottom: 80px;
    transform: none;
  }
  .a11y-toolbar__trigger {
    top: auto;
    bottom: 0;
    transform: translate(-100%, 0);
  }
  .a11y-toolbar__panel {
    top: auto;
    bottom: -10%;
    transform: translateY(0) translateX(100%);
    width: 280px;
    max-height: 70vh;
    border-radius: 16px 0 0 16px;
  }
  .a11y-toolbar__panel[aria-hidden="false"] {
    transform: translateY(0) translateX(0);
  }
}

@media print {
  .a11y-toolbar,
  .a11y-reading-guide {
    display: none !important;
  }
}