/* ==========================================================================
   ArtBird Accessibility CSS - ת"י 5568 / WCAG 2.1 Level AA
   ========================================================================== */

/* קישור דילוג לתוכן המרכזי (Skip to Content) */
.skip-to-content-link {
    position: fixed;
    top: -120px;
    right: 20px;
    background: #1e40af;
    color: #ffffff !important;
    padding: 12px 20px;
    font-weight: 800;
    font-size: 1rem;
    border-radius: 0 0 10px 10px;
    z-index: 10000000;
    text-decoration: none;
    transition: top 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    border: 2px solid #93c5fd;
    border-top: none;
}
.skip-to-content-link:focus,
.skip-to-content-link:focus-visible {
    top: 0;
    outline: 3.5px solid #fbbf24;
    outline-offset: 2px;
}

/* ==========================================================================
   כפתור נגישות צף - צד שמאל למטה
   ========================================================================== */
.a11y-floating-trigger {
    position: fixed;
    bottom: max(20px, env(safe-area-inset-bottom, 20px));
    left: max(20px, env(safe-area-inset-left, 20px));
    z-index: 999990;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #1d4ed8;
    color: #ffffff;
    border: 3px solid #ffffff;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.2s ease, box-shadow 0.2s ease;
    padding: 0;
}

.a11y-floating-trigger:hover {
    background: #1e40af;
    transform: scale(1.08);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
}

.a11y-floating-trigger:focus-visible,
.a11y-floating-trigger:focus {
    outline: 3.5px solid #f59e0b;
    outline-offset: 3px;
}

.a11y-floating-trigger svg {
    width: 30px;
    height: 30px;
    fill: currentColor;
    pointer-events: none;
}

/* ==========================================================================
   פאנל תפריט הנגישות (Drawer / Modal)
   ========================================================================== */
.a11y-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999995;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.a11y-backdrop.active {
    display: block;
}

.a11y-panel {
    display: none;
    position: fixed;
    bottom: max(85px, calc(env(safe-area-inset-bottom, 20px) + 65px));
    left: max(20px, env(safe-area-inset-left, 20px));
    width: min(390px, calc(100vw - 40px));
    max-height: min(80vh, 720px);
    background: var(--bg-card, #ffffff);
    color: var(--text-main, #1e293b);
    border: 2px solid #2563eb;
    border-radius: 18px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.3);
    z-index: 999999;
    flex-direction: column;
    overflow: hidden;
    direction: rtl;
    text-align: right;
    animation: a11yPanelIn 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.a11y-panel.active {
    display: flex;
}

@keyframes a11yPanelIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* כותרת הפאנל */
.a11y-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #1d4ed8;
    color: #ffffff;
    border-bottom: 1px solid #1e40af;
    flex-shrink: 0;
}

.a11y-panel-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.a11y-panel-title-wrap svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.a11y-panel-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
}

.a11y-panel-close-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 1.6rem;
    line-height: 1;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease;
}

.a11y-panel-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.a11y-panel-close-btn:focus-visible {
    outline: 2.5px solid #facc15;
    outline-offset: 2px;
}

/* תוכן הפאנל הנגלל */
.a11y-panel-body {
    padding: 16px 18px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* קבוצות פעולות (Categories) */
.a11y-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.a11y-group-title {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--text-muted, #64748b);
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 2px 0;
}

.a11y-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.a11y-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 6px;
}

/* כפתורי התאמות בתוך הפאנל */
.a11y-tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    background: var(--bg-main, #f8fafc);
    border: 1.5px solid var(--border-color, #cbd5e1);
    border-radius: 10px;
    color: var(--text-main, #0f172a);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    text-align: center;
    min-height: 56px;
    user-select: none;
}

.a11y-tool-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    flex-shrink: 0;
}

.a11y-tool-btn:hover {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

.a11y-tool-btn:focus-visible {
    outline: 2.5px solid #2563eb;
    outline-offset: 2px;
}

.a11y-tool-btn.active {
    background: #1d4ed8 !important;
    border-color: #1e40af !important;
    color: #ffffff !important;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.a11y-tool-btn.active svg {
    fill: #ffffff !important;
}

/* פוטר הפאנל / כפתורי איפוס והצהרה */
.a11y-panel-footer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color, #cbd5e1);
}

.a11y-btn-reset {
    background: #fee2e2;
    color: #b91c1c;
    border: 1.5px solid #fca5a5;
    padding: 10px 14px;
    border-radius: 10px;
    font-weight: 800;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.15s ease;
}
.a11y-btn-reset:hover {
    background: #fecaca;
    border-color: #f87171;
}

.a11y-btn-statement {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 14px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1.5px solid #bfdbfe;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.88rem;
    text-decoration: none;
    transition: all 0.15s ease;
    text-align: center;
}
.a11y-btn-statement:hover {
    background: #dbeafe;
    border-color: #60a5fa;
}

/* תאימות מצב כהה מובנה של האתר (Dark Mode) */
[data-mode="dark"] .a11y-panel {
    background: #0f172a;
    color: #f8fafc;
    border-color: #3b82f6;
}
[data-mode="dark"] .a11y-tool-btn {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}
[data-mode="dark"] .a11y-tool-btn:hover {
    background: #2563eb;
    color: #ffffff;
}
[data-mode="dark"] .a11y-btn-statement {
    background: #1e293b;
    border-color: #3b82f6;
    color: #93c5fd;
}

/* ==========================================================================
   מחלקות הפעלה גלובליות של הנגישות (Global Accessibility Modifiers)
   ========================================================================== */

/* 1. הגדלת והקטנת גופן */
html.a11y-font-size-1 { font-size: 112% !important; }
html.a11y-font-size-2 { font-size: 125% !important; }
html.a11y-font-size-3 { font-size: 140% !important; }
html.a11y-font-size-decrease { font-size: 90% !important; }

/* 2. גופן קריא נגיש */
html.a11y-readable-font body,
html.a11y-readable-font button,
html.a11y-readable-font input,
html.a11y-readable-font select,
html.a11y-readable-font textarea,
html.a11y-readable-font p,
html.a11y-readable-font a,
html.a11y-readable-font span,
html.a11y-readable-font li {
    font-family: Arial, 'Assistant', 'Heebo', sans-serif !important;
}

/* 3. הדגשת קישורים */
html.a11y-highlight-links a:not(.a11y-floating-trigger):not(.a11y-tool-btn):not(.a11y-btn-statement):not(.a11y-btn-reset) {
    text-decoration: underline !important;
    text-underline-offset: 4px !important;
    text-decoration-thickness: 2.5px !important;
    font-weight: 800 !important;
    background-color: #fef08a !important;
    color: #854d0e !important;
}

/* 4. הדגשת כותרות */
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 {
    border-right: 5px solid #2563eb !important;
    padding-right: 8px !important;
    background-color: rgba(37, 99, 235, 0.08) !important;
    border-radius: 0 4px 4px 0 !important;
}

/* 5. ריווח טקסט */
html.a11y-text-spacing body,
html.a11y-text-spacing p,
html.a11y-text-spacing div,
html.a11y-text-spacing span,
html.a11y-text-spacing a,
html.a11y-text-spacing li {
    line-height: 1.9 !important;
    letter-spacing: 0.08em !important;
    word-spacing: 0.16em !important;
}

/* 6. ניגודיות כהה מוחלטת (High Contrast Dark) */
html.a11y-contrast-dark {
    background: #000000 !important;
}
html.a11y-contrast-dark body,
html.a11y-contrast-dark .site-wrapper,
html.a11y-contrast-dark main,
html.a11y-contrast-dark header,
html.a11y-contrast-dark footer,
html.a11y-contrast-dark .content-box,
html.a11y-contrast-dark .card,
html.a11y-contrast-dark .top-navbar {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #facc15 !important;
}
html.a11y-contrast-dark p,
html.a11y-contrast-dark span:not(.mini-role-tag):not(.badge),
html.a11y-contrast-dark div:not(.a11y-panel):not(.a11y-panel *) {
    color: #ffffff !important;
}
html.a11y-contrast-dark a:not(.a11y-tool-btn):not(.a11y-btn-reset):not(.a11y-btn-statement) {
    color: #facc15 !important;
    text-decoration: underline !important;
}
html.a11y-contrast-dark h1,
html.a11y-contrast-dark h2,
html.a11y-contrast-dark h3,
html.a11y-contrast-dark h4 {
    color: #facc15 !important;
}

/* 7. ניגודיות בהירה מוחלטת (High Contrast Light) */
html.a11y-contrast-light {
    background: #ffffff !important;
}
html.a11y-contrast-light body,
html.a11y-contrast-light .site-wrapper,
html.a11y-contrast-light main,
html.a11y-contrast-light header,
html.a11y-contrast-light footer,
html.a11y-contrast-light .content-box,
html.a11y-contrast-light .top-navbar {
    background-color: #ffffff !important;
    color: #000000 !important;
    border-color: #000000 !important;
}
html.a11y-contrast-light p,
html.a11y-contrast-light span,
html.a11y-contrast-light h1,
html.a11y-contrast-light h2,
html.a11y-contrast-light h3 {
    color: #000000 !important;
}
html.a11y-contrast-light a:not(.a11y-tool-btn):not(.a11y-btn-reset):not(.a11y-btn-statement) {
    color: #0000ee !important;
    text-decoration: underline !important;
}

/* 8. מונוכרום / גווני אפור */
html.a11y-grayscale body {
    filter: grayscale(100%) !important;
}

/* שמירה על פאנל הנגישות ללא מונוכרום/היפוך כדי שימשיך להיות קריא */
html.a11y-grayscale .a11y-panel,
html.a11y-grayscale .a11y-floating-trigger {
    filter: none !important;
}

/* 9. הדגשת פוקוס למקלדת */
html.a11y-focus-outline *:focus,
html.a11y-focus-outline *:focus-visible {
    outline: 3.5px solid #2563eb !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.3) !important;
}

/* 10. סמן עכבר מוגדל */
html.a11y-big-cursor,
html.a11y-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='36' height='36' viewBox='0 0 36 36'%3E%3Cpath d='M2 2 L2 29 L9 22 L16 35 L20 33 L14 20 L24 20 Z' fill='%23000000' stroke='%23ffffff' stroke-width='2.5'/%3E%3C/svg%3E"), default !important;
}

/* 11. עצירת אנימציות ותנועה */
html.a11y-stop-animations *,
html.a11y-stop-animations *::before,
html.a11y-stop-animations *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}
