/* ============================================================
   Ophthalmologist site — Section 11: Accessibility widget
   Adapted from the Levion implementation. Functionality is
   identical (IS 5568 / WCAG 2.0 AA): skip link, persisted state,
   text resize, contrast, grayscale, light bg, readable font,
   link highlight, line/letter spacing, motion freeze, large
   cursor, reset, link to statement. Only the visual layer was
   restyled — accent blue (#1f7ae0) replaces the original
   indigo/purple, and corner radii were softened to match the
   site's other rounded surfaces.
   ============================================================ */

/* ---------- Skip to content (visible only on focus) ---------- */
.a11y-skip {
    position: fixed;
    top: -100px;
    left: 0;
    padding: 0.75rem 1.25rem;
    background: #1f7ae0;                       /* was indigo #6366f1 → site accent */
    color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Noto Sans Hebrew', 'Noto Sans Arabic', system-ui, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 14px 0;
    z-index: 100000;
    transition: top 0.2s ease;
}

.a11y-skip:focus,
.a11y-skip:focus-visible {
    top: 0;
    outline: 2px solid #ffffff;
    outline-offset: -4px;
}

/* ---------- Floating launcher button ----------
   Anchored to the physical bottom-right by Israeli a11y
   convention (same anchor in LTR + RTL). Z-index 60 sits above
   page content but below the panel/backdrop (9998/9999) and the
   nav (100) — those layers don't overlap the bottom-right corner
   so the order is fine in practice. */
.a11y-btn {
    position: fixed;
    bottom: clamp(1rem, 3vw, 1.75rem);
    right: clamp(1rem, 3vw, 1.75rem);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    /* accent-blue radial sheen layered over a dark glass disc —
       mirrors the site's button language (final-cta gradient) */
    background:
        radial-gradient(circle at 30% 30%,
            rgba(31, 122, 224, 0.8) 0%,
            rgba(58, 142, 229, 0.45) 60%,
            rgba(11, 18, 32, 0.6) 100%),
        rgba(11, 18, 32, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 28px -8px rgba(31, 122, 224, 0.7);
    z-index: 60;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Noto Sans Hebrew', 'Noto Sans Arabic', system-ui, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 0;
    transition:
        transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.a11y-btn:hover,
.a11y-btn:focus-visible {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 16px 36px -10px rgba(31, 122, 224, 0.9);
    border-color: rgba(255, 255, 255, 0.45);
    outline: none;
}

/* green focus ring kept — clearly distinct from the blue
   "active/selected" state inside the panel */
.a11y-btn:focus-visible {
    outline: 2px solid #4ade80;
    outline-offset: 3px;
}

.a11y-btn svg {
    width: 26px;
    height: 26px;
    flex-shrink: 0;
}

.a11y-btn__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* Subtle attention pulse so first-time visitors notice the
   widget — also re-tuned to accent blue */
@keyframes a11y-pulse {
    0%, 100% {
        box-shadow:
            0 10px 28px -8px rgba(31, 122, 224, 0.7),
            0 0 0 0 rgba(31, 122, 224, 0.45);
    }
    50% {
        box-shadow:
            0 10px 28px -8px rgba(31, 122, 224, 0.7),
            0 0 0 12px rgba(31, 122, 224, 0);
    }
}

.a11y-btn {
    animation: a11y-pulse 2.6s ease-in-out 1.5s 3;
}

@media (prefers-reduced-motion: reduce) {
    .a11y-btn { animation: none; }
}

/* ---------- WhatsApp launcher (stacked above the a11y button) ----------
   Same 56×56 glass disc + outer-shadow recipe as .a11y-btn, but
   tinted with the WhatsApp brand green so the pill is instantly
   recognizable as a chat affordance (recoloring it to our site
   accent would hurt that recognition — green is the universal
   "this is WhatsApp" cue). Bottom offset = a11y bottom + a11y
   height (56px) + a 0.75rem gap so the two stack cleanly.
   .a11y-widget class keeps it out of the global a11y overrides. */
.wa-btn {
    position: fixed;
    bottom: calc(clamp(1rem, 3vw, 1.75rem) + 56px + 0.75rem);
    right: clamp(1rem, 3vw, 1.75rem);
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background:
        radial-gradient(circle at 30% 30%,
            rgba(74, 222, 128, 0.85) 0%,
            rgba(34, 197, 94, 0.45) 60%,
            rgba(11, 18, 32, 0.6) 100%),
        rgba(11, 18, 32, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: #ffffff;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 28px -8px rgba(74, 222, 128, 0.65);
    z-index: 60;
    line-height: 0;
    transition:
        transform 0.25s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.25s ease,
        border-color 0.25s ease;
}

.wa-btn:hover,
.wa-btn:focus-visible {
    transform: translateY(-3px) scale(1.06);
    box-shadow: 0 16px 36px -10px rgba(74, 222, 128, 0.85);
    border-color: rgba(255, 255, 255, 0.45);
    outline: none;
}

.wa-btn:focus-visible {
    outline: 2px solid #4ade80;
    outline-offset: 3px;
}

.wa-btn svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.wa-btn__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ---------- Backdrop ---------- */
.a11y-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 13, 0.6);            /* tinted to the body bg */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.a11y-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- Panel ----------
   Anchored to the physical right edge so it slides in from the
   same side as the launcher. Inside corners (left side) are
   softly rounded to match the site's rounded-surface language. */
.a11y-panel {
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    width: min(360px, 90vw);
    background: rgba(11, 18, 32, 0.96);          /* was #0f0f12 → ink */
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-left: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 1.6rem 0 0 1.6rem;            /* rounded inside corners */
    z-index: 9999;
    transform: translateX(100%);
    transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    color: #f5f5f7;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Noto Sans Hebrew', 'Noto Sans Arabic', system-ui, sans-serif;
    direction: rtl;
    overflow: hidden;                            /* contain the rounded corners */
}

.a11y-panel.is-open {
    transform: translateX(0);
}

.a11y-panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
}

.a11y-panel__title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
}

.a11y-panel__close {
    appearance: none;
    border: 0;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.a11y-panel__close svg {
    width: 18px;
    height: 18px;
    display: block;
    stroke: #ffffff;
}

.a11y-panel__close:hover,
.a11y-panel__close:focus-visible {
    background: rgba(255, 255, 255, 0.22);
    color: #ffffff;
    outline: 2px solid rgba(74, 222, 128, 0.5);
    outline-offset: 2px;
}

.a11y-panel__body {
    padding: 1rem 1.25rem 1.5rem;
    overflow-y: auto;
    flex: 1 1 auto;
}

.a11y-section {
    margin-bottom: 1.4rem;
}

.a11y-section__title {
    margin: 0 0 0.6rem;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(245, 245, 247, 0.5);
}

.a11y-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}

.a11y-feature {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    color: rgba(245, 245, 247, 0.85);
    border-radius: 14px;                         /* slightly rounder than 12px */
    padding: 0.85rem 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.3;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.a11y-feature:hover,
.a11y-feature:focus-visible {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    outline: none;
}

.a11y-feature:focus-visible {
    outline: 2px solid rgba(74, 222, 128, 0.5);
    outline-offset: 2px;
}

/* active/selected — site accent gradient (was indigo→purple) */
.a11y-feature.is-active {
    background: linear-gradient(135deg, #1f7ae0 0%, #3a8ee5 100%);
    border-color: transparent;
    color: #ffffff;
    box-shadow: 0 6px 18px -6px rgba(31, 122, 224, 0.6);
}

.a11y-feature__icon {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.a11y-panel__footer {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex-shrink: 0;
}

.a11y-reset {
    appearance: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.03);
    color: rgba(245, 245, 247, 0.85);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.a11y-reset:hover,
.a11y-reset:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    color: #ffffff;
    outline: 2px solid rgba(74, 222, 128, 0.4);
    outline-offset: 2px;
}

/* statement link hover tied to the accent (was green) */
.a11y-statement-link {
    text-align: center;
    font-size: 0.82rem;
    color: rgba(245, 245, 247, 0.6);
    text-decoration: none;
    padding: 0.4rem;
    border-radius: 8px;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.a11y-statement-link:hover,
.a11y-statement-link:focus-visible {
    color: #3a8ee5;
    background: rgba(31, 122, 224, 0.1);
    outline: none;
}

/* ===========================================================
   GLOBAL ACCESSIBILITY OVERRIDES
   Applied to body's top-level children, excluding the widget.
   These are functional — DO NOT restyle.
   =========================================================== */

html.a11y-text-large   body { font-size: 110% !important; }
html.a11y-text-xlarge  body { font-size: 125% !important; }
html.a11y-text-xxlarge body { font-size: 140% !important; }

/* keep the widget's own typography fixed so resizing the page
   doesn't blow out the panel layout */
.a11y-btn,
.a11y-panel,
.a11y-skip { font-size: 14px; }
.a11y-panel__title { font-size: 17px; }
.a11y-feature { font-size: 12.5px; }
.a11y-section__title { font-size: 11px; }
.a11y-statement-link { font-size: 13px; }
.a11y-reset { font-size: 13.5px; }

html.a11y-contrast-high body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) {
    filter: contrast(1.4) saturate(1.2) !important;
}

html.a11y-contrast-negative body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) {
    filter: invert(1) hue-rotate(180deg) !important;
}
html.a11y-contrast-negative body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) img,
html.a11y-contrast-negative body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) video,
html.a11y-contrast-negative body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) iframe {
    filter: invert(1) hue-rotate(180deg) !important;
}

html.a11y-grayscale body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) {
    filter: grayscale(1) !important;
}

html.a11y-light-bg,
html.a11y-light-bg body { background: #ffffff !important; }
html.a11y-light-bg body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip),
html.a11y-light-bg body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) * {
    background-color: #ffffff !important;
    background-image: none !important;
    color: #111111 !important;
    border-color: #cccccc !important;
    box-shadow: none !important;
    -webkit-text-fill-color: #111111 !important;
}
html.a11y-light-bg body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) a,
html.a11y-light-bg body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) a * {
    color: #0033cc !important;
    -webkit-text-fill-color: #0033cc !important;
    text-decoration: underline !important;
}

html.a11y-readable-font body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip),
html.a11y-readable-font body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) * {
    font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif !important;
    font-weight: 400 !important;
    letter-spacing: 0 !important;
}

html.a11y-highlight-links body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) a,
html.a11y-highlight-links body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) button {
    outline: 2px solid #ffd54a !important;
    outline-offset: 2px !important;
    background-color: rgba(255, 213, 74, 0.18) !important;
    text-decoration: underline !important;
}

html.a11y-line-height body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip),
html.a11y-line-height body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) * {
    line-height: 1.95 !important;
}

html.a11y-letter-spacing body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip),
html.a11y-letter-spacing body > *:not(.a11y-widget):not(.a11y-backdrop):not(.a11y-panel):not(.a11y-btn):not(.a11y-skip) * {
    letter-spacing: 0.08em !important;
    word-spacing: 0.12em !important;
}

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

html.a11y-big-cursor,
html.a11y-big-cursor *,
html.a11y-big-cursor *::before,
html.a11y-big-cursor *::after {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><path fill="white" stroke="black" stroke-width="2" d="M5 5 L5 33 L13 26 L18 36 L23 34 L18 24 L29 23 Z"/></svg>') 4 4, auto !important;
}
/* the inner pointer color is the only cursor accent — site
   accent blue (was green) so it matches the brand */
html.a11y-big-cursor a,
html.a11y-big-cursor button,
html.a11y-big-cursor [role="button"],
html.a11y-big-cursor input,
html.a11y-big-cursor textarea {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 40 40"><path fill="%231f7ae0" stroke="black" stroke-width="2" d="M5 5 L5 33 L13 26 L18 36 L23 34 L18 24 L29 23 Z"/></svg>') 4 4, pointer !important;
}

@media (max-width: 480px) {
    .a11y-panel {
        width: 100vw;
        border-radius: 0;
    }
}
