/* Accessibility widget: floating button (bottom-left) + options panel. Loaded on every page. */
.dh-a11y {
  --a11y-ink: #2c2d66;
  --a11y-blue: #99beff;
  --a11y-cream: #fff5df;
  --a11y-gold: #cfb682;
  position: fixed;
  left: max(16px, env(safe-area-inset-left, 0px));
  bottom: max(16px, env(safe-area-inset-bottom, 0px));
  z-index: 2147483000;
  direction: rtl;
  font-family: "Heebo", "Noto Sans Hebrew", Arial, sans-serif;
  line-height: 1.4;
}

.dh-a11y *,
.dh-a11y *::before,
.dh-a11y *::after {
  box-sizing: border-box;
}

.dh-a11y__toggle {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--a11y-ink);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 22px -8px rgba(44, 45, 102, 0.75);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.dh-a11y__toggle svg {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

@media (hover: hover) {
  .dh-a11y__toggle:hover {
    transform: scale(1.06);
    background: #3a3c85;
  }
}

.dh-a11y__toggle:focus-visible,
.dh-a11y__opt:focus-visible,
.dh-a11y__btn:focus-visible,
.dh-a11y__link:focus-visible,
.dh-a11y__close:focus-visible {
  outline: 3px solid var(--a11y-blue);
  outline-offset: 3px;
}

.dh-a11y__panel {
  position: absolute;
  left: 0;
  bottom: 64px;
  width: min(320px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 100px));
  max-height: min(560px, calc(100dvh - 100px));
  overflow-y: auto;
  padding: 14px;
  border-radius: 16px;
  background: #fff;
  color: var(--a11y-ink);
  border: 1px solid rgba(44, 45, 102, 0.15);
  box-shadow: 0 18px 48px -16px rgba(44, 45, 102, 0.55);
}

.dh-a11y__panel[hidden] {
  display: none;
}

.dh-a11y__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dh-a11y__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.dh-a11y__close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--a11y-ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.dh-a11y__close:hover {
  background: rgba(44, 45, 102, 0.08);
}

.dh-a11y__size {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: var(--a11y-cream);
  font-size: 0.95rem;
  font-weight: 600;
}

.dh-a11y__size-ctrls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dh-a11y__btn {
  min-width: 40px;
  height: 40px;
  padding: 0 10px;
  border: 1px solid rgba(44, 45, 102, 0.25);
  border-radius: 10px;
  background: #fff;
  color: var(--a11y-ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.dh-a11y__btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.dh-a11y__level {
  min-width: 3.2em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.dh-a11y__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.dh-a11y__opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 84px;
  padding: 10px 6px;
  border: 1px solid rgba(44, 45, 102, 0.2);
  border-radius: 12px;
  background: #fff;
  color: var(--a11y-ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.dh-a11y__opt svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dh-a11y__opt[aria-pressed="true"] {
  background: var(--a11y-ink);
  border-color: var(--a11y-ink);
  color: #fff;
}

@media (hover: hover) {
  .dh-a11y__opt:hover {
    border-color: var(--a11y-ink);
  }
}

.dh-a11y__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(44, 45, 102, 0.12);
}

.dh-a11y__link {
  color: var(--a11y-ink);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 600px) {
  .dh-a11y {
    left: max(12px, env(safe-area-inset-left, 0px));
    bottom: max(12px, env(safe-area-inset-bottom, 0px));
  }
  .dh-a11y__toggle {
    width: 46px;
    height: 46px;
  }
  .dh-a11y__toggle svg {
    width: 26px;
    height: 26px;
  }
  .dh-a11y__panel {
    bottom: 58px;
  }
}

/* ---------- Effects applied to the page (classes on <html>) ---------- */

/* Text size: scales the page content (not the widget itself) */
html.dh-a11y-fs-1 main { zoom: 1.1; }
html.dh-a11y-fs-2 main { zoom: 1.2; }
html.dh-a11y-fs-3 main { zoom: 1.3; }

/* High contrast / grayscale (filters on the root keep fixed elements in place) */
html.dh-a11y-contrast { filter: contrast(1.35); }
html.dh-a11y-gray { filter: grayscale(1); }
html.dh-a11y-contrast.dh-a11y-gray { filter: grayscale(1) contrast(1.35); }

/* Highlight links */
html.dh-a11y-links a:not(.dh-a11y__link) {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  outline: 2px solid #ffcc00 !important;
  outline-offset: 2px !important;
}

/* Readable font */
html.dh-a11y-font body,
html.dh-a11y-font body *:not(svg):not(svg *) {
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important;
  letter-spacing: 0.01em !important;
}

/* Stop animations */
html.dh-a11y-still *,
html.dh-a11y-still *::before,
html.dh-a11y-still *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}

/* Text spacing */
html.dh-a11y-spacing main p,
html.dh-a11y-spacing main li,
html.dh-a11y-spacing main span,
html.dh-a11y-spacing main a {
  line-height: 1.9 !important;
  letter-spacing: 0.04em !important;
  word-spacing: 0.12em !important;
}
