/* ============================================================
   Betec accessibility — IS 5568 / WCAG 2.1 AA helpers
   Self-contained: skip link + floating widget + visual modes.
   Applied to <html> as classes so it cascades over the page.
   ============================================================ */

/* --- Skip-to-content link (visible only on keyboard focus) --- */
.a11y-skip {
    position: fixed;
    top: -100px;
    right: 16px;
    background: #000;
    color: #fff;
    padding: 12px 24px;
    z-index: 99999;
    text-decoration: none;
    font-weight: 700;
    font-size: 15px;
    border-radius: 6px !important;
    border: 2px solid #fff;
    transition: top 0.15s ease;
}
.a11y-skip:focus,
.a11y-skip:focus-visible {
    top: 16px;
    outline: 3px solid #2596be;
    outline-offset: 2px;
}

/* --- Toggle button (bottom-right; WhatsApp lives bottom-left) --- */
.a11y-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9990;
    width: 56px;
    height: 56px;
    border-radius: 9999px !important;
    background: #0066cc;
    color: #fff;
    border: 2px solid #fff;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    translate: 0 calc(-1 * var(--cookie-banner-height, 0px));
    transition: background 0.2s, transform 0.2s, box-shadow 0.2s, translate 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.a11y-toggle:hover,
.a11y-toggle:focus-visible {
    background: #2596be;
    transform: scale(1.08);
    outline: 3px solid #fff;
    outline-offset: 3px;
}
.a11y-toggle svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
}

/* --- Panel --- */
.a11y-panel {
    position: fixed;
    bottom: calc(1.5rem + 56px + 12px);
    right: 1.5rem;
    z-index: 9991;
    width: 320px;
    max-width: calc(100vw - 3rem);
    background: #fff;
    color: #111;
    border-radius: 12px !important;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
    padding: 16px;
    font-family: 'Heebo', system-ui, sans-serif;
    direction: rtl;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    translate: 0 calc(-1 * var(--cookie-banner-height, 0px));
    /* WCAG 1.4.3: opacity transition catches text mid-fade with sub-4.5:1
       contrast. Snap opacity; keep transform-only animation for the slide. */
    transition: transform 0.22s ease, translate 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.a11y-panel.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}
.a11y-panel header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 0 12px;
    padding: 0 0 10px;
    border-bottom: 1px solid #e5e7eb;
}
.a11y-panel h2 {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: #111;
}
.a11y-panel .a11y-close {
    background: transparent;
    border: 0;
    font-size: 22px;
    cursor: pointer;
    padding: 4px 10px;
    min-width: 44px;
    min-height: 44px;
    color: #6b7280;
    border-radius: 6px !important;
    line-height: 1;
}
.a11y-panel .a11y-close:hover {
    background: #f3f4f6;
    color: #111;
}

.a11y-panel .a11y-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.a11y-panel button.a11y-opt {
    background: #f3f4f6;
    border: 2px solid transparent;
    color: #111;
    padding: 10px 6px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    min-height: 76px;
    justify-content: center;
    text-align: center;
    font-family: inherit;
    line-height: 1.25;
}
.a11y-panel button.a11y-opt:hover {
    background: #e5e7eb;
}
.a11y-panel button.a11y-opt:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}
.a11y-panel button.a11y-opt.is-active {
    background: #0066cc;
    color: #fff;
    border-color: #2596be;
}
.a11y-panel button.a11y-opt .a11y-ico {
    font-size: 20px;
    line-height: 1;
    font-weight: 700;
}

/* Readable-font picker — radiogroup of font samples */
.a11y-panel .a11y-fonts {
    margin-top: 12px;
}
.a11y-panel .a11y-fonts-label {
    font-size: 12px;
    font-weight: 700;
    color: #4b5563;
    margin: 0 0 6px;
    letter-spacing: 0.02em;
}
.a11y-panel .a11y-fonts-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}
.a11y-panel button.a11y-font {
    background: #f3f4f6;
    border: 2px solid transparent;
    color: #111;
    padding: 8px 2px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    border-radius: 8px !important;
    min-height: 52px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.1;
}
.a11y-panel button.a11y-font .a11y-font-name {
    font-size: 9.5px;
    font-weight: 600;
    /* WCAG 1.4.3: was #6b7280 → 4.39:1 on #f3f4f6. #4b5563 → 7.59:1. */
    color: #4b5563;
    letter-spacing: 0;
}
.a11y-panel button.a11y-font:hover {
    background: #e5e7eb;
}
.a11y-panel button.a11y-font:focus-visible {
    outline: 3px solid #0066cc;
    outline-offset: 2px;
}
.a11y-panel button.a11y-font[aria-checked="true"] {
    background: #0066cc;
    color: #fff;
    border-color: #2596be;
}
.a11y-panel button.a11y-font[aria-checked="true"] .a11y-font-name {
    /* WCAG 1.4.3: rgba(255,255,255,.85) over #0066cc composes to ~#d9e8f7 = 4.46:1. */
    color: #ffffff;
}

.a11y-panel .a11y-reset {
    width: 100%;
    margin-top: 12px;
    background: #dc2626;
    color: #fff;
    border: 0;
    padding: 10px;
    min-height: 44px;
    border-radius: 8px !important;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    transition: background 0.15s;
}
.a11y-panel .a11y-reset:hover {
    background: #b91c1c;
}
.a11y-panel .a11y-reset:focus-visible {
    outline: 3px solid #2596be;
    outline-offset: 2px;
}
.a11y-panel .a11y-statement {
    display: block;
    margin-top: 10px;
    text-align: center;
    font-size: 13px;
    color: #0066cc;
    text-decoration: underline;
    background: transparent;
    border: 0;
    width: 100%;
    min-height: 44px;
    cursor: pointer;
    font-family: inherit;
}
.a11y-panel .a11y-statement:hover {
    color: #003780;
}

/* ============================================================
   Modes applied to <html>
   ============================================================ */

/* Text size — increments above the document default */
html.a11y-text-1 { font-size: 110% !important; }
html.a11y-text-2 { font-size: 120% !important; }
html.a11y-text-3 { font-size: 135% !important; }
html.a11y-text-4 { font-size: 150% !important; }

/* High contrast — black bg / yellow text, green for interactive */
html.a11y-contrast,
html.a11y-contrast body {
    background: #000 !important;
    color: #ffe600 !important;
}
html.a11y-contrast *:not(.a11y-toggle):not(.a11y-toggle *):not(.a11y-panel):not(.a11y-panel *) {
    background-color: #000 !important;
    background-image: none !important;
    color: #ffe600 !important;
    border-color: #ffe600 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}
html.a11y-contrast a:not(.a11y-toggle):not(.a11y-panel a),
html.a11y-contrast button:not(.a11y-toggle):not(.a11y-panel button) {
    color: #00ff7f !important;
    text-decoration: underline !important;
}
html.a11y-contrast img,
html.a11y-contrast video,
html.a11y-contrast svg:not(.a11y-toggle svg):not(.a11y-panel svg) {
    filter: grayscale(1) contrast(1.4) brightness(0.9) !important;
}

/* Grayscale */
html.a11y-grayscale {
    filter: grayscale(1) !important;
}

/* Highlight links — bold + underline + dashed outline */
html.a11y-links a,
html.a11y-links button:not(.a11y-toggle):not(.a11y-panel button) {
    text-decoration: underline !important;
    font-weight: 700 !important;
    outline: 1px dashed currentColor !important;
    outline-offset: 2px !important;
}

/* Readable fonts — radio group; "default" is the absence of any class. */
html.a11y-font-arial,    html.a11y-font-arial *    { font-family: Arial, 'Helvetica Neue', sans-serif !important; letter-spacing: 0.02em !important; }
html.a11y-font-tahoma,   html.a11y-font-tahoma *   { font-family: Tahoma, 'DejaVu Sans', sans-serif !important; letter-spacing: 0.02em !important; }
html.a11y-font-verdana,  html.a11y-font-verdana *  { font-family: Verdana, Geneva, sans-serif !important; letter-spacing: 0.03em !important; }
html.a11y-font-comic,    html.a11y-font-comic *    { font-family: 'Comic Sans MS', 'Chalkboard SE', cursive !important; letter-spacing: 0.02em !important; }

/* Stop animations — manual toggle */
html.a11y-no-anim,
html.a11y-no-anim *,
html.a11y-no-anim *::before,
html.a11y-no-anim *::after {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

/* Motion-driven lists use inline opacity/transform values rather than CSS
   animations. Show their stable end state only while the manual toggle is on. */
html.a11y-no-anim section[aria-label="יכולות הפיתוח שלנו"] [style*="opacity"],
html.a11y-no-anim #portfolio [style*="opacity"],
html.a11y-no-anim main .max-w-4xl [style*="opacity"] {
    opacity: 1 !important;
    transform: none !important;
}

/* The projects tracing beam is driven directly by scroll-linked SVG values. */
html.a11y-no-anim .motion-reduce\:hidden {
    display: none !important;
}

/* Honor the OS-level reduced-motion setting */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Visible focus indicator anywhere the page hasn't set one */
:focus-visible {
    outline: 3px solid #2596be;
    outline-offset: 2px;
}
