/* Explain: Styles for the floating accessibility widget and modes. */
/* =========================================================
   Accessibility — floating widget + accessibility modes
   Based on Israeli Standard SI 5568 (WCAG 2.0 AA)
   ========================================================= */

/* ---------- Floating trigger button ---------- */
.a11y-toggle-btn {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    z-index: 60;
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    border: 2px solid #ffffff;
    background: var(--primary-color);
    color: #ffffff;
    font-size: 1.6rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.28);
    transition: transform 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.a11y-toggle-btn:hover {
    background: var(--primary-hover);
    transform: scale(1.06);
}

.a11y-toggle-btn:focus-visible {
    outline: 3px solid #0f172a;
    outline-offset: 3px;
}

/* ---------- Panel ---------- */
.a11y-panel {
    position: fixed;
    bottom: 5.5rem;
    right: 1.25rem;
    z-index: 61;
    width: min(21rem, calc(100vw - 2rem));
    max-height: min(78vh, 42rem);
    overflow-y: auto;
    padding: 1.1rem;
    background: #ffffff;
    color: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 1.25rem;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.3);
    font-family: var(--font-body);
    text-align: right;
}

.a11y-panel[hidden] {
    display: none;
}

.a11y-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.a11y-panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--primary-color);
    font-family: var(--font-heading);
}

.a11y-close-btn {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-color);
    cursor: pointer;
    transition: background 0.2s ease;
}

.a11y-close-btn:hover {
    background: var(--surface-alt);
}

.a11y-close-btn:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

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

.a11y-section-title {
    margin: 0 0 0.5rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
}

.a11y-font-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.a11y-font-btn {
    flex: 1;
    min-height: 44px;
    border-radius: 0.75rem;
    border: 1px solid #cbd5e1;
    background: var(--surface-color);
    color: var(--text-color);
    font-size: 1.05rem;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.a11y-font-btn:hover {
    background: #eef2ff;
    border-color: var(--primary-color);
}

.a11y-font-btn:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.a11y-font-value {
    min-width: 3.75rem;
    text-align: center;
    font-weight: 800;
    color: var(--primary-color);
}

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

.a11y-opt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 4.75rem;
    padding: 0.5rem 0.35rem;
    border-radius: 0.85rem;
    border: 1px solid #cbd5e1;
    background: var(--surface-color);
    color: var(--text-color);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.a11y-opt i {
    font-size: 1.15rem;
}

.a11y-opt:hover {
    background: #eef2ff;
    border-color: var(--primary-color);
}

.a11y-opt:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

.a11y-opt[aria-pressed="true"] {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
}

.a11y-reset-btn {
    width: 100%;
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border-radius: 0.85rem;
    border: 1px solid #fca5a5;
    background: #fef2f2;
    color: #b91c1c;
    font-weight: 800;
    cursor: pointer;
    transition: background 0.2s ease;
}

.a11y-reset-btn:hover {
    background: #fee2e2;
}

.a11y-reset-btn:focus-visible {
    outline: 3px solid #b91c1c;
    outline-offset: 2px;
}

.a11y-note {
    margin: 0.75rem 0 0;
    font-size: 0.72rem;
    line-height: 1.5;
    color: var(--text-muted);
    text-align: center;
}

/* =========================================================
   Accessibility modes (applied to <html>)
   ========================================================= */

/* ----- Text size ----- */
html.a11y-scale-1 { font-size: 112.5%; }
html.a11y-scale-2 { font-size: 125%; }
html.a11y-scale-3 { font-size: 137.5%; }
html.a11y-scale-4 { font-size: 150%; }

/* ----- Readable font ----- */
html.a11y-readable-font body,
html.a11y-readable-font body :not(i):not(.fa-solid):not(.fa-regular):not(.fa-brands) {
    font-family: Arial, "Segoe UI", Tahoma, sans-serif !important;
}

/* ----- Highlight links ----- */
html.a11y-links a {
    background-color: #fde68a !important;
    color: #7c2d12 !important;
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
    outline: 2px solid #b45309 !important;
    border-radius: 3px !important;
}

/* ----- Text spacing ----- */
html.a11y-spacing body,
html.a11y-spacing p,
html.a11y-spacing li,
html.a11y-spacing h1,
html.a11y-spacing h2,
html.a11y-spacing h3,
html.a11y-spacing a {
    line-height: 1.9 !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.14em !important;
}

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

/* ----- Big cursor ----- */
html.a11y-big-cursor,
html.a11y-big-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Cpath d='M5 3 L5 32 L13 24 L18 37 L24 35 L19 22 L30 22 Z' fill='%23000' stroke='%23fff' stroke-width='2'/%3E%3C/svg%3E") 5 3, auto !important;
}

/* ----- Grayscale ----- */
html.a11y-grayscale header,
html.a11y-grayscale main,
html.a11y-grayscale footer {
    filter: grayscale(100%) !important;
}

/* ----- Invert colors ----- */
html.a11y-invert header,
html.a11y-invert main,
html.a11y-invert footer {
    filter: invert(100%) hue-rotate(180deg) !important;
}

html.a11y-invert header img,
html.a11y-invert main img,
html.a11y-invert footer img,
html.a11y-invert video {
    filter: invert(100%) hue-rotate(180deg) !important;
}

/* ----- High contrast (dark) ----- */
html.a11y-contrast body {
    background: #000000 !important;
}

html.a11y-contrast header,
html.a11y-contrast main,
html.a11y-contrast footer {
    background: #000000 !important;
    color: #ffffff !important;
}

html.a11y-contrast header *,
html.a11y-contrast main *,
html.a11y-contrast footer * {
    background-color: transparent !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

html.a11y-contrast header a,
html.a11y-contrast main a,
html.a11y-contrast footer a,
html.a11y-contrast header button,
html.a11y-contrast main button,
html.a11y-contrast footer button {
    color: #ffff00 !important;
    text-decoration: underline !important;
}

html.a11y-contrast main img,
html.a11y-contrast header img,
html.a11y-contrast footer img {
    filter: contrast(1.1) !important;
}

/* ----- Responsive tweaks ----- */
@media (max-width: 480px) {
    .a11y-panel {
        right: 0.75rem;
        bottom: 5.25rem;
        width: calc(100vw - 1.5rem);
    }

    .a11y-toggle-btn {
        right: 0.75rem;
        bottom: 0.9rem;
    }
}