/* ============================================================
   ACCESSIBILITY PANEL — Fablehesion Standard Component
   Self-contained. Portable across all properties.
   Drop in a11y.css + a11y markup + a11y JS block.
   ============================================================ */

/* --- Skip Link --- */
.a11y-skip {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    z-index: 10000;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s;
}

.a11y-skip:focus {
    top: 0.5rem;
}

/* --- Toggle Button (fixed, bottom-right) --- */
.a11y-toggle {
    position: fixed;
    bottom: 1.2rem;
    right: 1.2rem;
    z-index: 999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.35);
    background: #8B4A62;
    color: #ffffff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s, transform 0.2s;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.a11y-toggle:hover {
    background: #6B3A52;
    border-color: #ffffff;
    transform: scale(1.05);
}

/* --- Panel Drawer --- */
.a11y-panel {
    position: fixed;
    top: 0;
    right: -340px;
    z-index: 9999;
    width: 320px;
    max-width: 90vw;
    height: 100vh;
    height: 100dvh;
    background: #1e1e1e;
    border-left: 1px solid #444444;
    padding: 1.5rem;
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.5);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

.a11y-panel.is-open {
    right: 0;
}

/* --- Panel Header --- */
.a11y-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #444444;
}

.a11y-panel-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 0.02em;
    margin: 0;
}

.a11y-panel-close {
    background: none;
    border: none;
    color: #cccccc;
    font-size: 1.8rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.a11y-panel-close:hover {
    color: #ffffff;
}

/* --- Action Buttons (Reset / Statement) --- */
.a11y-panel-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.a11y-action-btn {
    flex: 1;
    background: #333333;
    border: 1px solid #555555;
    border-radius: 4px;
    color: #ffffff;
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.a11y-action-btn:hover {
    background: #4a4a4a;
    border-color: #888888;
}

/* --- Section Label --- */
.a11y-section-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: #bbbbbb;
    letter-spacing: 0.02em;
    margin-bottom: 0.75rem;
}

/* --- Profile Rows --- */
.a11y-profile {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid #333333;
}

.a11y-profile:last-of-type {
    border-bottom: none;
}

.a11y-profile-toggle {
    flex-shrink: 0;
}

/* --- OFF / ON Switch --- */
.a11y-switch {
    display: flex;
    align-items: center;
    gap: 0;
    background: #333333;
    border: 1px solid #666666;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
}

.a11y-switch-label {
    display: block;
    padding: 0.4rem 0.55rem;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #999999;
    transition: background 0.2s, color 0.2s;
    user-select: none;
}

.a11y-switch-label:first-child {
    border-right: 1px solid #666666;
}

/* OFF state: highlight OFF label */
.a11y-switch[aria-checked="false"] .a11y-switch-label:first-child {
    background: #555555;
    color: #ffffff;
}

/* ON state: highlight ON label */
.a11y-switch[aria-checked="true"] .a11y-switch-label:last-child {
    background: #4a8f4a;
    color: #ffffff;
}

/* --- Profile Info --- */
.a11y-profile-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}

.a11y-profile-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #ffffff;
}

.a11y-profile-desc {
    font-size: 0.78rem;
    color: #aaaaaa;
    line-height: 1.4;
}

/* --- Panel Footer --- */
.a11y-panel-footer {
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid #444444;
    text-align: center;
}

.a11y-panel-footer p {
    font-size: 0.72rem;
    color: #888888;
    letter-spacing: 0.04em;
}

/* ============================================================
   ACCESSIBILITY PROFILES — CSS Effects
   Each profile adds a class to <body>.
   These work on ANY site with standard HTML elements.
   ============================================================ */

/* --- Seizure Safety: Remove all motion --- */
body.a11y-seizure-safe *,
body.a11y-seizure-safe *::before,
body.a11y-seizure-safe *::after {
    animation: none !important;
    transition: none !important;
}

body.a11y-seizure-safe .reveal {
    opacity: 1 !important;
    transform: none !important;
}

/* --- Low Vision Support: High contrast + larger text --- */
body.a11y-low-vision {
    font-size: 125%;
    letter-spacing: 0.02em;
}

body.a11y-low-vision img {
    filter: contrast(1.15);
}

body.a11y-low-vision a {
    text-decoration: underline;
}

/* --- ADHD Friendly: Reduce distractions --- */
body.a11y-adhd *,
body.a11y-adhd *::before,
body.a11y-adhd *::after {
    animation: none !important;
    transition: none !important;
}

body.a11y-adhd .reveal {
    opacity: 1 !important;
    transform: none !important;
}

body.a11y-adhd img {
    filter: saturate(0.7);
}

body.a11y-adhd :focus {
    outline: 3px solid currentColor !important;
    outline-offset: 2px;
}

/* --- Reading & Cognitive Support: Enhanced spacing --- */
body.a11y-reading {
    line-height: 2.2;
    letter-spacing: 0.04em;
    word-spacing: 0.12em;
}

body.a11y-reading p,
body.a11y-reading span,
body.a11y-reading li,
body.a11y-reading td {
    line-height: 2.2;
}

/* --- Keyboard Navigation: Visible focus --- */
body.a11y-keyboard-nav *:focus {
    outline: 3px solid #4a8f4a !important;
    outline-offset: 3px;
}

body.a11y-keyboard-nav a:focus,
body.a11y-keyboard-nav button:focus {
    outline: 3px solid #4a8f4a !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(74, 143, 74, 0.25);
}

body.a11y-keyboard-nav .a11y-skip:focus {
    top: 0.5rem;
}

/* --- Older Adults: Larger text, bigger targets --- */
body.a11y-older-adults {
    font-size: 125%;
    line-height: 1.9;
    letter-spacing: 0.02em;
}

body.a11y-older-adults a,
body.a11y-older-adults button {
    min-height: 48px;
    min-width: 48px;
}

body.a11y-older-adults a {
    text-decoration: underline;
}
