/* ==========================================================================
   Панель доступности (תפריט נגישות) — работает с любым шаблоном
   Режимы включаются классами на <html>: a11y-contrast, a11y-light, a11y-gray,
   a11y-links, a11y-headings, a11y-font, a11y-spacing, a11y-noanim, a11y-cursor, a11y-zoom
   ========================================================================== */

/* ---------- Кнопка и панель ---------- */
.a11y-widget { position: fixed; top: 38%; z-index: 2147483000; font-family: Arial, "Segoe UI", sans-serif; direction: rtl; line-height: 1.4; }
.a11y-widget.a11y-pos-left { left: 0; }
.a11y-widget.a11y-pos-right { right: 0; }
.a11y-widget *, .a11y-widget *::before, .a11y-widget *::after { box-sizing: border-box; }
.a11y-toggle { display: grid; place-items: center; width: 54px; height: 54px; border: 0; cursor: pointer; background: #0b57d0; color: #fff; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.a11y-pos-left .a11y-toggle { border-radius: 0 10px 10px 0; }
.a11y-pos-right .a11y-toggle { border-radius: 10px 0 0 10px; }
.a11y-toggle:hover { background: #0842a0; }
.a11y-toggle:focus-visible, .a11y-widget button:focus-visible, .a11y-widget a:focus-visible { outline: 3px solid #ffbf00; outline-offset: 2px; }
.a11y-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.a11y-panel { position: absolute; top: -120px; width: 330px; max-width: calc(100vw - 70px); max-height: min(620px, calc(100vh - 40px)); overflow-y: auto;
  background: #fff; color: #1a1a1a; border-radius: 12px; box-shadow: 0 16px 50px rgba(0,0,0,.35); padding: 0 0 14px; }
.a11y-pos-left .a11y-panel { left: 58px; }
.a11y-pos-right .a11y-panel { right: 58px; }
.a11y-panel[hidden] { display: none; }
.a11y-head { display: flex; align-items: center; justify-content: space-between; background: #0b57d0; color: #fff; padding: 12px 16px; border-radius: 12px 12px 0 0; }
.a11y-head h2 { margin: 0; font-size: 18px; color: #fff; font-weight: 700; font-family: inherit; }
.a11y-close { background: none; border: 0; color: #fff; font-size: 28px; line-height: 1; width: 36px; height: 36px; cursor: pointer; border-radius: 6px; }
.a11y-close:hover { background: rgba(255,255,255,.15); }
.a11y-zoom-row { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 14px 16px 6px; }
.a11y-zoom-row button { width: 56px; height: 44px; border: 2px solid #0b57d0; background: #fff; color: #0b57d0; border-radius: 8px; font-size: 18px; font-weight: 700; cursor: pointer; }
.a11y-zoom-row button:hover { background: #eaf1fd; }
.a11y-zoom-val { min-width: 60px; text-align: center; font-weight: 700; font-size: 17px; color: #1a1a1a; }
.a11y-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 10px 14px; }
.a11y-grid button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 68px; padding: 8px 6px;
  border: 2px solid #d6dbe3; background: #f7f9fc; color: #1a1a1a; border-radius: 10px; cursor: pointer; font: 600 14px/1.25 Arial, sans-serif; text-align: center; }
.a11y-grid button:hover { border-color: #0b57d0; }
.a11y-grid button[aria-pressed="true"] { background: #0b57d0; border-color: #0b57d0; color: #fff; }
.a11y-foot { display: flex; gap: 8px; margin: 6px 14px 0; }
.a11y-foot > * { flex: 1; }
.a11y-reset { display: block; padding: 11px; border: 0; border-radius: 8px; background: #1a1a1a; color: #fff; font: 700 15px Arial, sans-serif; cursor: pointer; }
.a11y-reset:hover { background: #333; }
.a11y-statement { display: flex; align-items: center; justify-content: center; padding: 9px; border: 2px solid #0b57d0; border-radius: 8px; color: #0b57d0 !important; font: 700 15px Arial, sans-serif; text-decoration: none !important; }
.a11y-statement:hover { background: #eaf1fd; }

/* Сама панель не меняется режимами */
#a11y-widget, #a11y-widget * { filter: none !important; zoom: 1 !important; letter-spacing: normal !important; word-spacing: normal !important; }

/* ---------- Режимы ---------- */

/* Увеличение (текст и элементы) */
html.a11y-zoom body > *:not(#a11y-widget) { zoom: var(--a11y-zoom, 1); }

/* Оттенки серого */
html.a11y-gray body > *:not(#a11y-widget) { filter: grayscale(1) !important; }

/* Тёмная высокая контрастность */
html.a11y-contrast body,
html.a11y-contrast body *:not(#a11y-widget, #a11y-widget *, img, video, svg, svg *) {
  background-color: #000 !important; color: #fff !important; border-color: #fff !important; text-shadow: none !important; box-shadow: none !important; }
html.a11y-contrast body *:not(#a11y-widget, #a11y-widget *) { background-image: none !important; }
html.a11y-contrast body *:not(#a11y-widget, #a11y-widget *)::before,
html.a11y-contrast body *:not(#a11y-widget, #a11y-widget *)::after { background-color: transparent !important; background-image: none !important; }
html.a11y-contrast a:not(#a11y-widget *), html.a11y-contrast a:not(#a11y-widget *) * { color: #ffe500 !important; }
html.a11y-contrast button:not(#a11y-widget *), html.a11y-contrast input, html.a11y-contrast textarea, html.a11y-contrast select { border: 2px solid #fff !important; }
html.a11y-contrast svg:not(#a11y-widget svg) { color: #fff !important; }

/* Светлая высокая контрастность */
html.a11y-light body,
html.a11y-light body *:not(#a11y-widget, #a11y-widget *, img, video, svg, svg *) {
  background-color: #fff !important; color: #000 !important; border-color: #000 !important; text-shadow: none !important; box-shadow: none !important; }
html.a11y-light body *:not(#a11y-widget, #a11y-widget *) { background-image: none !important; }
html.a11y-light body *:not(#a11y-widget, #a11y-widget *)::before,
html.a11y-light body *:not(#a11y-widget, #a11y-widget *)::after { background-color: transparent !important; background-image: none !important; }
html.a11y-light a:not(#a11y-widget *), html.a11y-light a:not(#a11y-widget *) * { color: #0033cc !important; }
html.a11y-light button:not(#a11y-widget *), html.a11y-light input, html.a11y-light textarea, html.a11y-light select { border: 2px solid #000 !important; }

/* Выделение ссылок и фокуса */
html.a11y-links a:not(#a11y-widget *) { text-decoration: underline !important; text-underline-offset: 3px; outline: 2px dashed currentColor; outline-offset: 2px; }
html.a11y-links a:not(#a11y-widget *):hover { outline-style: solid; }
html.a11y-links *:focus { outline: 3px solid #ffbf00 !important; outline-offset: 3px !important; }

/* Выделение заголовков */
html.a11y-headings h1:not(#a11y-widget *), html.a11y-headings h2:not(#a11y-widget *), html.a11y-headings h3:not(#a11y-widget *),
html.a11y-headings h4:not(#a11y-widget *), html.a11y-headings h5:not(#a11y-widget *), html.a11y-headings h6:not(#a11y-widget *) {
  outline: 2px solid #0b57d0 !important; outline-offset: 4px; background-color: rgba(11,87,208,.08) !important; }

/* Читаемый шрифт */
html.a11y-font body *:not(#a11y-widget, #a11y-widget *, svg, svg *) { font-family: Arial, Helvetica, sans-serif !important; font-weight: 500; }

/* Интервалы текста (WCAG 1.4.12) */
html.a11y-spacing body *:not(#a11y-widget, #a11y-widget *) { letter-spacing: .08em !important; word-spacing: .16em !important; line-height: 1.8 !important; }
html.a11y-spacing p:not(#a11y-widget *) { margin-bottom: 2em !important; }

/* Остановка анимаций */
html.a11y-noanim *, html.a11y-noanim *::before, html.a11y-noanim *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important; }

/* Большой курсор */
html.a11y-cursor, html.a11y-cursor * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath d='M4 2l16 9-7 2-3 7z' fill='black' stroke='white' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E") 4 2, auto !important; }

@media (max-width: 600px) {
  .a11y-widget { top: auto; bottom: 90px; }
  .a11y-toggle { width: 48px; height: 48px; }
  .a11y-panel { top: auto; bottom: 0; }
}
@media print { .a11y-widget { display: none !important; } }
