/* =====================================================================
   Accessibility widget + skip link (task 6.6, decision ה-83), from the
   wcag-accessibility-widget skill. Modes are classes on <html>, set by
   components/store/a11y-widget.tsx (store), a11y.js (static site) and the
   course app's components/a11y-widget.tsx. Three identical copies:
   sag-clinic-new/a11y.css, the store's app/(store)/v3/store-a11y.css and
   דור/sag-course-app/app/a11y.css — edit one, copy it to the others.
   Never filter/transform an ancestor of a fixed element (the skill's
   "critical bug"): contrast recolours with CSS instead.
   ===================================================================== */

:root { --a11y-mark: #c00000; }

/* ---- skip link: hidden until focused ---- */
.a11y-skip {
  position: fixed; top: 10px; right: 10px; z-index: 9999;
  padding: 10px 18px; border-radius: 999px;
  background: #151515; color: #fff; font: 600 15px/1.4 'Heebo', Arial, sans-serif;
  transform: translateY(-200%);
}
.a11y-skip:focus { transform: none; outline: 3px solid #964E41; outline-offset: 2px; }
#main-content:focus { outline: none; }

/* ---- the trigger button: bottom right (WhatsApp is bottom left) ---- */
.a11y-btn {
  position: fixed; right: 20px; bottom: 28px; z-index: 200;
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center;
  background: #151515; color: #fff; border: 2px solid #fff;
  box-shadow: 0 4px 18px rgba(0,0,0,.25); cursor: pointer;
}
.a11y-btn svg { width: 26px; height: 26px; fill: currentColor; }
.a11y-btn:focus-visible { outline: 3px solid var(--a11y-mark); outline-offset: 3px; }
@media (max-width: 899px) { .a11y-btn { bottom: 150px; } }   /* above the mobile cart bar */
body.lv-cart-open .a11y-btn { display: none; }

/* ---- the panel ---- */
.a11y-panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 200;
  width: min(300px, calc(100vw - 40px)); max-height: calc(100vh - 120px); overflow: auto;
  padding: 16px 18px; border-radius: 14px;
  background: #fff; color: #151515; border: 1px solid #ddd;
  box-shadow: 0 14px 40px rgba(0,0,0,.2);
  font: 400 15px/1.5 'Heebo', Arial, sans-serif; text-align: right;
}
@media (max-width: 899px) { .a11y-panel { bottom: 210px; max-height: calc(100vh - 240px); } }
.a11y-panel__title { font-size: 17px; font-weight: 600; margin: 0 0 10px; }
.a11y-panel button { font: inherit; color: inherit; cursor: pointer; }
.a11y-sizes { padding: 6px 0 10px; border-bottom: 1px solid #eee; margin-bottom: 4px; }
.a11y-sizes__buttons { display: flex; gap: 6px; margin-top: 6px; }
.a11y-sizes__buttons button {
  flex: 1; min-height: 40px; border-radius: 8px;
  border: 1px solid #bbb; background: #fff;
}
.a11y-sizes__buttons button[aria-pressed="true"] { background: #151515; color: #fff; border-color: #151515; }
.a11y-panel__foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid #eee; }
.a11y-panel__foot button { background: none; border: 0; text-decoration: underline; padding: 6px 0; }
.a11y-panel__foot a { color: #964E41; text-decoration: underline; }
.a11y-panel :focus-visible { outline: 3px solid var(--a11y-mark); outline-offset: 2px; }

/* the switch: px sizes and a physical left anchor, so it stays put in RTL and in every font mode */
.a11y-switch {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 44px; padding: 6px 0; background: none; border: 0; text-align: right;
}
.a11y-switch__track {
  position: relative; flex-shrink: 0; width: 44px; height: 24px; border-radius: 999px;
  background: #6b6b6b;
}
.a11y-switch[aria-checked="true"] .a11y-switch__track { background: #964E41; }
.a11y-switch__thumb {
  position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3);
  transform: translateX(3px); transition: transform .2s;
}
.a11y-switch[aria-checked="true"] .a11y-switch__thumb { transform: translateX(23px); }

/* ================== the modes ================== */

/* keyboard focus highlight */
html.a11y-keyboard *:focus,
html.a11y-keyboard *:focus-visible { outline: 3px solid var(--a11y-mark) !important; outline-offset: 3px !important; }

/* no animations (the OS reduced-motion setting is already honoured by the V3 CSS) */
html.a11y-no-anim *, html.a11y-no-anim *::before, html.a11y-no-anim *::after {
  animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important;
  transition-duration: 0.001ms !important; transition-delay: 0s !important;
}
html.a11y-no-anim { scroll-behavior: auto !important; }
html.a11y-no-anim [data-reveal] { opacity: 1 !important; transform: none !important; }

/* high contrast: recolour, never filter */
html.a11y-contrast body,
html.a11y-contrast body *:not(img):not(video):not(picture):not(svg) {
  background-color: #000 !important; color: #fff !important; border-color: #fff !important;
}
html.a11y-contrast body * { box-shadow: none !important; text-shadow: none !important; }
html.a11y-contrast a { color: #ff0 !important; }
html.a11y-contrast input, html.a11y-contrast textarea,
html.a11y-contrast select, html.a11y-contrast button { border: 1px solid #fff !important; }
html.a11y-contrast ::placeholder { color: #d9d9d9 !important; opacity: 1; }
html.a11y-contrast { --a11y-mark: #ff5252; background-color: #000 !important; }
html.a11y-contrast .a11y-switch__track { background-color: #000 !important; box-shadow: 0 0 0 1px #fff !important; }
html.a11y-contrast .a11y-switch__thumb { background-color: #fff !important; }
html.a11y-contrast .a11y-sizes__buttons button[aria-pressed="true"] { background-color: #ff0 !important; color: #000 !important; }

/* text size: the V3 CSS sizes text in px, so the root font-size would change nothing — zoom the page */
html.a11y-font-lg body { zoom: 1.15; }
html.a11y-font-sm body { zoom: 0.9; }

/* readable font (simple selectors only inside :not()) */
html.a11y-readable body *:not(i):not(svg):not(code):not(pre):not([class*="icon"]) {
  font-family: Arial, Helvetica, sans-serif !important; letter-spacing: 0.015em;
}

/* mark headings */
html.a11y-headings h1, html.a11y-headings h2,
html.a11y-headings h3, html.a11y-headings h4 { outline: 2px dashed var(--a11y-mark) !important; outline-offset: 6px; }

/* mark links and buttons, except the widget's own controls */
html.a11y-links a,
html.a11y-links button:not([role="switch"]):not(#a11y-btn) { outline: 2px solid #3b82f6 !important; text-decoration: underline !important; }
