/* ==========================================================================
   Accessibility menu styles (for accessibility_widget.js). Shared by every page. The widget UI itself (.a11y-ui) uses px sizes and is
   excluded from every page adjustment, so the menu stays usable whatever is on.
   ========================================================================== */

/* ---------- Trigger button ---------- */
.a11y-trigger {
    position: fixed; z-index: 9998; bottom: calc(18px + var(--cookie-bar-h, 0px)); right: 18px;
    width: 48px; height: 48px; border-radius: 50%;
    background: #fff; color: #0F172A; border: 2.5px solid #0F172A;
    box-shadow: 0 4px 14px rgba(0,0,0,0.16);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; padding: 0;
    transition: transform .15s ease, bottom .2s ease;
}
.a11y-trigger:hover { transform: scale(1.07); }
.a11y-side-left .a11y-trigger { right: auto; left: 18px; }
.a11y-trigger-hidden .a11y-trigger { display: none; }

/* ---------- Panel ---------- */
.a11y-panel {
    position: fixed; z-index: 9999; top: 0; bottom: 0; right: 0;
    width: 400px; max-width: 100%;
    background: #EEF2F7; color: #0F172A;
    font-family: 'Assistant', Arial, sans-serif; font-size: 16px; line-height: 1.4; direction: rtl; text-align: right;
    display: flex; flex-direction: column;
    box-shadow: -8px 0 30px rgba(0,0,0,0.18);
}
.a11y-panel[hidden] { display: none; }
.a11y-side-left .a11y-panel { right: auto; left: 0; box-shadow: 8px 0 30px rgba(0,0,0,0.18); }

.a11y-head {
    background: #005FBC; color: #fff; padding: 16px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0;
}
.a11y-head h2 { font-family: 'Heebo', Arial, sans-serif; font-size: 19px; font-weight: 800; margin: 0; color: #fff; }
.a11y-head .a11y-kbd { font-weight: 400; font-size: 14px; opacity: 0.85; margin-right: 8px; direction: ltr; unicode-bidi: isolate; }
.a11y-close {
    width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer; flex-shrink: 0;
    background: rgba(255,255,255,0.18); color: #fff; font-size: 20px;
    display: flex; align-items: center; justify-content: center;
}
.a11y-close:hover { background: rgba(255,255,255,0.3); }

.a11y-body { overflow-y: auto; padding: 18px; flex: 1; }

.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; font-weight: 700; font-size: 16px; }
.a11y-switch {
    position: relative; width: 52px; height: 30px; border-radius: 999px; border: 2px solid #0F172A;
    background: #fff; cursor: pointer; padding: 0; flex-shrink: 0;
}
.a11y-switch::after {
    content: ''; position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: #0F172A; transition: right .15s ease;
}
.a11y-switch[aria-checked="true"] { background: #005FBC; border-color: #005FBC; }
.a11y-switch[aria-checked="true"]::after { right: 25px; background: #fff; }

.a11y-grid { display: grid; grid-template-columns: 1fr 1fr; grid-auto-rows: 1fr; gap: 12px; }
.a11y-tile {
    position: relative; background: #fff; color: #0F172A; border: 2px solid transparent; border-radius: 16px;
    padding: 18px 10px 14px; min-height: 112px; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
    font-family: inherit; font-size: 15px; font-weight: 700; text-align: center; line-height: 1.25;
    transition: border-color .15s, background .15s;
}
.a11y-tile:hover { border-color: #94A3B8; }
.a11y-tile i { font-size: 26px; }
.a11y-tile.is-on { border-color: #005FBC; background: #E6F0FB; }
.a11y-tile.is-on::before {
    content: '\2713'; position: absolute; top: 8px; left: 10px; width: 20px; height: 20px; border-radius: 50%;
    background: #005FBC; color: #fff; font-size: 12px; line-height: 20px; text-align: center;
}
.a11y-state { font-size: 13px; font-weight: 600; color: #005FBC; min-height: 16px; }
.a11y-dots { display: flex; gap: 4px; justify-content: center; direction: rtl; } /* level 1 fills from the right */
.a11y-dots span { width: 18px; height: 4px; border-radius: 2px; background: #CBD5E1; }
.a11y-dots span.on { background: #005FBC; }

.a11y-reset {
    width: 100%; margin-top: 18px; padding: 14px; border: none; border-radius: 14px; cursor: pointer;
    background: #F36F21; color: #fff; font-family: inherit; font-size: 16px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: 10px;
}
.a11y-reset:hover { background: #C6560F; }
.a11y-extra { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.a11y-extra a, .a11y-extra button {
    display: flex; align-items: center; gap: 10px; padding: 10px 6px;
    background: none; border: none; cursor: pointer; text-align: right;
    color: #0F172A; font-family: inherit; font-size: 15px; font-weight: 600; text-decoration: none;
}
.a11y-extra a:hover, .a11y-extra button:hover { color: #005FBC; text-decoration: underline; }
.a11y-note { margin: -4px 0 6px; padding-right: 32px; font-size: 13px; color: #475569; }

.a11y-ui :focus-visible { outline: 3px solid #F36F21 !important; outline-offset: 2px; }

/* "Large widget" switch */
.a11y-big .a11y-panel { width: 480px; font-size: 18px; }
.a11y-big .a11y-tile { font-size: 18px; min-height: 132px; }
.a11y-big .a11y-tile i { font-size: 32px; }
.a11y-big .a11y-head h2 { font-size: 22px; }

/* Tooltip for the "descriptions" feature */
.a11y-tooltip {
    position: fixed; z-index: 10000; pointer-events: none; max-width: 280px;
    background: #0F172A; color: #fff; font: 600 15px/1.4 'Assistant', Arial, sans-serif;
    padding: 8px 12px; border-radius: 8px; direction: rtl; text-align: right;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.a11y-tooltip[hidden] { display: none; }

@media (max-width: 600px) {
    .a11y-panel, .a11y-big .a11y-panel { width: 100%; }
    .a11y-trigger { width: 44px; height: 44px; bottom: calc(14px + var(--cookie-bar-h, 0px)); right: 14px; }
    .a11y-side-left .a11y-trigger { left: 14px; }
}

/* ==========================================================================
   Page adjustments. Each is a class on <html> set by a11y.js.
   Everything is scoped to skip the widget UI: :not(.a11y-ui, .a11y-ui *)
   ========================================================================== */

/* Text size: rem-based, so scaling the root size scales the site's text */
html.a11y-text-1 { font-size: 112.5% !important; }
html.a11y-text-2 { font-size: 125% !important; }
html.a11y-text-3 { font-size: 140% !important; }

/* Text spacing */
html.a11y-spacing-1 body *:not(.a11y-ui, .a11y-ui *) { letter-spacing: 0.06em !important; word-spacing: 0.12em !important; }
html.a11y-spacing-2 body *:not(.a11y-ui, .a11y-ui *) { letter-spacing: 0.12em !important; word-spacing: 0.24em !important; }
html.a11y-spacing-3 body *:not(.a11y-ui, .a11y-ui *) { letter-spacing: 0.18em !important; word-spacing: 0.36em !important; }

/* Line height */
html.a11y-lineheight-1 body *:not(.a11y-ui, .a11y-ui *) { line-height: 1.9 !important; }
html.a11y-lineheight-2 body *:not(.a11y-ui, .a11y-ui *) { line-height: 2.2 !important; }
html.a11y-lineheight-3 body *:not(.a11y-ui, .a11y-ui *) { line-height: 2.5 !important; }

/* Text alignment */
html.a11y-align-1 body *:not(.a11y-ui, .a11y-ui *) { text-align: right !important; }
html.a11y-align-2 body *:not(.a11y-ui, .a11y-ui *) { text-align: center !important; }
html.a11y-align-3 body *:not(.a11y-ui, .a11y-ui *) { text-align: left !important; }

/* Readable font. OpenDyslexic has no Hebrew, so this switches to a plain,
   evenly spaced system font with wider spacing — the standard approach for Hebrew. */
html.a11y-dyslexia body *:not(.a11y-ui, .a11y-ui *):not(i):not([class*="fa-"]) {
    font-family: Arial, 'Helvetica Neue', sans-serif !important; font-style: normal !important;
    letter-spacing: 0.04em; word-spacing: 0.1em;
}

/* Highlight links */
html.a11y-links body a:not(.a11y-ui *) {
    text-decoration: underline !important; text-underline-offset: 3px;
    outline: 2px solid #F36F21 !important; outline-offset: 2px; border-radius: 2px;
}

/* Big cursor */
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 48 48'%3E%3Cpath d='M6 3l0 38 10-10 7 15 7-3-7-15 14 0z' fill='%23000' stroke='%23fff' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 6 3, auto !important;
}

/* Hide images */
html.a11y-images body img:not(.a11y-ui img) { visibility: hidden !important; }
html.a11y-images body [style*="background-image"], html.a11y-images .lecture-photo { background-image: none !important; background-color: #E2E8F0 !important; }

/* Stop animations — also applied automatically when the OS asks for reduced motion */
html.a11y-animations *:not(.a11y-ui, .a11y-ui *),
html.a11y-animations *::before, html.a11y-animations *::after {
    animation-play-state: paused !important; transition: none !important; scroll-behavior: auto !important;
}
html.a11y-animations { scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-play-state: paused !important; transition: none !important; }
    html { scroll-behavior: auto !important; }
}

/* Contrast 1: dark */
html.a11y-contrast-1 body, html.a11y-contrast-1 body *:not(.a11y-ui, .a11y-ui *):not(img) {
    background-color: #000 !important; color: #fff !important; border-color: #fff !important; box-shadow: none !important; text-shadow: none !important;
}
html.a11y-contrast-1 body *:not(.a11y-ui, .a11y-ui *):not([style*="background-image"]):not(.lecture-photo) { background-image: none !important; }
html.a11y-contrast-1 body a:not(.a11y-ui *), html.a11y-contrast-1 body a:not(.a11y-ui *) * { color: #FFE14D !important; }
html.a11y-contrast-1 ::placeholder { color: #BBB !important; }

/* Contrast 2: light */
html.a11y-contrast-2 body, html.a11y-contrast-2 body *:not(.a11y-ui, .a11y-ui *):not(img) {
    background-color: #fff !important; color: #000 !important; border-color: #000 !important; box-shadow: none !important; text-shadow: none !important;
}
html.a11y-contrast-2 body *:not(.a11y-ui, .a11y-ui *):not([style*="background-image"]):not(.lecture-photo) { background-image: none !important; }
html.a11y-contrast-2 body a:not(.a11y-ui *), html.a11y-contrast-2 body a:not(.a11y-ui *) * { color: #0033CC !important; }

/* Contrast 3 (inverted colors) and saturation are CSS filters; they share one
   filter property so both can be on at once. Images are re-inverted to look normal. */
html.a11y-contrast-3 { --a11y-f-contrast: invert(1) hue-rotate(180deg); }
html.a11y-saturation-1 { --a11y-f-sat: saturate(0.4); }
html.a11y-saturation-2 { --a11y-f-sat: saturate(2); }
html.a11y-saturation-3 { --a11y-f-sat: grayscale(1); }
html.a11y-contrast-3 body > *:not(.a11y-ui),
html[class*="a11y-saturation-"] body > *:not(.a11y-ui) {
    filter: var(--a11y-f-contrast, ) var(--a11y-f-sat, );
}
html.a11y-contrast-3 body { background: #000; }
html.a11y-contrast-3 body img:not(.a11y-ui img),
html.a11y-contrast-3 body iframe,
html.a11y-contrast-3 body [style*="background-image"],
html.a11y-contrast-3 .lecture-photo { filter: invert(1) hue-rotate(180deg); }
