/* ========================================================
   WCAG 2.0 AA / ת"י 5568 Accessibility Rules and Styles
   ======================================================== */

/* Focus Visible Requirement */
:focus-visible {
    outline: 3px solid #0056b3 !important;
    outline-offset: 2px !important;
}

/* Skip link (WCAG 2.4.1) */
.a11y-skip-link {
    position: absolute;
    top: -999px;
    right: 20px;
    background: #0056b3;
    color: #ffffff !important;
    padding: 10px 18px;
    z-index: 999999;
    font-weight: bold;
    font-size: 16px;
    border-radius: 0 0 6px 6px;
    text-decoration: none !important;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: top 0.2s ease-in-out;
}
.a11y-skip-link:focus, .a11y-skip-link:active {
    top: 0;
    outline: 3px solid #ffbf47 !important;
}

/* Screen reader only utility */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Trigger Button */
.a11y-btn-trigger {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 99999;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background-color: #0b57d0;
    color: #ffffff;
    border: 2px solid #ffffff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, background-color 0.2s;
}
.a11y-btn-trigger:hover {
    background-color: #0842a0;
    transform: scale(1.08);
}

/* Modal Dialog */
.a11y-modal {
    position: fixed;
    bottom: 85px;
    right: 25px;
    width: 320px;
    max-width: calc(100vw - 40px);
    background: #ffffff;
    color: #1a1a1a;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    border: 1px solid #d0d7de;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    overflow: hidden;
    direction: rtl;
    text-align: right;
}
.a11y-modal-header {
    background: #0b57d0;
    color: #ffffff;
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.a11y-modal-header h2 {
    font-size: 18px;
    margin: 0;
    color: #ffffff;
    font-weight: bold;
}
.a11y-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
    line-height: 1;
}
.a11y-modal-body {
    padding: 16px;
    max-height: 70vh;
    overflow-y: auto;
}
.a11y-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}
.a11y-action-btn {
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    padding: 10px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    transition: background 0.15s, border-color 0.15s;
}
.a11y-action-btn:hover {
    background: #eaeef2;
    border-color: #0b57d0;
}
.a11y-action-btn[aria-pressed="true"] {
    background: #e8f0fe;
    border-color: #0b57d0;
    font-weight: bold;
}
.a11y-btn-title {
    font-size: 13px;
    font-weight: 600;
    color: #24292f;
}
.a11y-btn-val {
    font-size: 11px;
    color: #57609a;
}
.a11y-footer-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-top: 1px solid #eaeef2;
    padding-top: 12px;
}
.a11y-reset-btn {
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    cursor: pointer;
    color: #374151;
}
.a11y-reset-btn:hover {
    background: #e5e7eb;
}
.a11y-statement-link {
    text-align: center;
    font-size: 13px;
    color: #0b57d0;
    text-decoration: underline;
    font-weight: 600;
    padding: 4px;
}

/* ========================================================
   CSS Classes applied to <html>
   ======================================================== */

/* High Contrast */
html.a11y-contrast-high body {
    background-color: #000000 !important;
    color: #ffffff !important;
}
html.a11y-contrast-high a {
    color: #ffff00 !important;
    text-decoration: underline !important;
}
html.a11y-contrast-high * {
    border-color: #ffffff !important;
}

/* Invert Contrast */
html.a11y-contrast-invert {
    filter: invert(1) hue-rotate(180deg) !important;
}
/* Counter-invert widget itself */
html.a11y-contrast-invert #a11y-widget-container {
    filter: invert(1) hue-rotate(180deg) !important;
}

/* Monochrome */
html.a11y-contrast-mono {
    filter: grayscale(100%) !important;
}
html.a11y-contrast-mono #a11y-widget-container {
    filter: none !important;
}

/* Text Size scaling */
html.a11y-text-115 {
    font-size: 115% !important;
}
html.a11y-text-130 {
    font-size: 130% !important;
}
html.a11y-text-150 {
    font-size: 150% !important;
}

/* Readable Font */
html.a11y-readable-font * {
    font-family: Arial, "Helvetica Neue", sans-serif !important;
}

/* Highlight Links */
html.a11y-highlight-links a {
    background-color: #ffff00 !important;
    color: #000000 !important;
    text-decoration: underline !important;
    font-weight: bold !important;
}

/* Highlight Headings */
html.a11y-highlight-headings h1,
html.a11y-highlight-headings h2,
html.a11y-highlight-headings h3,
html.a11y-highlight-headings h4,
html.a11y-highlight-headings h5,
html.a11y-highlight-headings h6 {
    background-color: #2b7de9 !important;
    color: #ffffff !important;
    outline: 2px solid #000000 !important;
    padding: 2px 6px !important;
}

/* Stop Animations */
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;
}

/* Print rule - clear all filters on print */
@media print {
    html[class*="a11y-"] { filter: none !important; }
    #a11y-widget-container { display: none !important; }
}
