/*
 * Accessibility Panel — Premium Branded Design
 * Dark theme, compact grid, zero scroll, matches Side Launcher.
 */

/* ── Skip Link (keyboard users) ───────────────────────────── */
#a11y-skip-link {
    position: absolute;
    top: -100px;
    left: 20px;
    background: #0ea5e9;
    color: #fff;
    padding: 10px 18px;
    border-radius: 8px;
    z-index: 9999999;
    font-weight: 700;
    font-size: 13px;
    text-decoration: none;
    transition: top 0.2s;
}
#a11y-skip-link:focus { top: 16px; outline: 3px solid #fbbf24; outline-offset: 2px; }

/* ── Panel Container ────────────────────────────────────────── */
.a11y-panel {
    /* Positioned by Side Launcher JS/CSS override */
    position: fixed;
    right: 52px;
    top: 50%;
    transform: translateY(-50%) translateX(20px);
    z-index: 99998;

    width: 280px;
    background: #0f172a;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: -12px 0 48px rgba(0,0,0,0.5), 0 8px 32px rgba(0,0,0,0.4);
    overflow: hidden;

    /* Hidden by default */
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, transform 0.25s cubic-bezier(0.34,1.56,0.64,1), visibility 0.22s;
}
.a11y-panel.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateY(-50%) translateX(0);
}

/* ── Header ─────────────────────────────────────────────────── */
.a11y-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.a11y-header-left {
    display: flex;
    align-items: center;
    gap: 7px;
}
.a11y-header-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #0ea5e9;
    animation: a11y-pulse 2s infinite;
}
@keyframes a11y-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.a11y-header-left span {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #e2e8f0;
}
.a11y-reset-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: #64748b;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.a11y-reset-btn:hover { background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(239,68,68,0.3); }

/* ── Body Grid ──────────────────────────────────────────────── */
.a11y-grid-wrap {
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.a11y-row-label {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #475569;
    margin: 0 0 4px 2px;
    padding: 0;
}
.a11y-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
    margin-bottom: 2px;
}
.a11y-grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

/* ── Buttons ────────────────────────────────────────────────── */
.a11y-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 9px 4px 8px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
    color: #94a3b8;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    line-height: 1;
    font-family: inherit;
}
.a11y-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}
.a11y-btn:hover {
    background: rgba(14,165,233,0.12);
    border-color: rgba(14,165,233,0.3);
    color: #e2e8f0;
    transform: translateY(-1px);
}
.a11y-btn.is-active,
.a11y-btn[aria-pressed="true"] {
    background: rgba(14,165,233,0.2);
    border-color: #0ea5e9;
    color: #38bdf8;
}

/* ── Mobile override ────────────────────────────────────────── */
@media (max-width: 768px) {
    .a11y-panel {
        right: 56px !important;
        top: auto !important;
        bottom: 20px !important;
        transform: translateX(20px) !important;
    }
    .a11y-panel.is-open {
        transform: translateX(0) !important;
    }
}

/* ═══ STATE MODIFIERS (applied to <html> root) ═══════════════ */
html.a11y-high-contrast     { filter: contrast(160%) saturate(120%) brightness(85%); }
html.a11y-negative-contrast { filter: invert(100%) hue-rotate(180deg); }
html.a11y-grayscale         { filter: grayscale(100%); }
html.a11y-dyslexic *        { font-family: 'Comic Sans MS', 'Arial', sans-serif !important; }
html.a11y-pause-animations * {
    animation-play-state: paused !important;
    transition: none !important;
    scroll-behavior: auto !important;
}
html.a11y-highlight-links a {
    text-decoration: underline !important;
    text-decoration-color: #fbbf24 !important;
    text-decoration-thickness: 3px !important;
}

/* ═══ Reading Aids ════════════════════════════════════════════ */
#a11y-reading-guide {
    position: fixed;
    left: 0; right: 0;
    height: 3px;
    background: #fbbf24;
    z-index: 999998;
    pointer-events: none;
    display: none;
    box-shadow: 0 0 8px rgba(251,191,36,0.6);
}
#a11y-reading-mask-top,
#a11y-reading-mask-bottom {
    position: fixed;
    left: 0; right: 0;
    background: rgba(0,0,0,0.8);
    z-index: 999997;
    pointer-events: none;
    display: none;
}
