/* ═══════════════════════════════════════════════════════
   Albireo - Accessibility Widget
   Floating button + panel with accessibility controls
   ═══════════════════════════════════════════════════════ */

/* ─── Accessibility Toggle Button ────────────────────── */
.a11y-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--soft-gold, #d4a574);
    color: #0a0e1a;
    border: 2px solid rgba(255,255,255,0.2);
    font-size: 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    line-height: 1;
}

[dir="rtl"] .a11y-toggle {
    left: auto;
    right: 20px;
}

.a11y-toggle:hover,
.a11y-toggle:focus {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
    outline: 2px solid var(--soft-gold, #d4a574);
    outline-offset: 2px;
}

/* ─── Panel ──────────────────────────────────────────── */
.a11y-panel {
    position: fixed;
    bottom: 80px;
    left: 20px;
    z-index: 9998;
    width: 290px;
    max-height: 80vh;
    overflow-y: auto;
    background: var(--deep-space, #0f1420);
    border: 1px solid rgba(212,165,116,0.3);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.5);
    transform: translateY(10px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
}

[dir="rtl"] .a11y-panel {
    left: auto;
    right: 20px;
}

.a11y-panel.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.a11y-panel-title {
    color: var(--soft-gold, #d4a574);
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.a11y-reset {
    font-size: 0.75rem;
    color: var(--warm-cream, #faf8f5);
    opacity: 0.6;
    cursor: pointer;
    background: none;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 3px 10px;
    transition: opacity 0.2s;
}

.a11y-reset:hover { opacity: 1; }

/* ─── Control Groups ─────────────────────────────────── */
.a11y-group {
    margin-bottom: 14px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.a11y-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.a11y-group-label {
    font-size: 0.8rem;
    color: rgba(250,248,245,0.6);
    margin-bottom: 8px;
    display: block;
}

/* Size buttons (A- A A+) */
.a11y-size-btns {
    display: flex;
    gap: 6px;
}

.a11y-size-btns button {
    flex: 1;
    padding: 8px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: var(--warm-cream, #faf8f5);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
}

.a11y-size-btns button:hover,
.a11y-size-btns button:focus {
    background: rgba(212,165,116,0.15);
    border-color: var(--soft-gold, #d4a574);
}

/* Toggle options */
.a11y-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.a11y-option-label {
    font-size: 0.88rem;
    color: var(--warm-cream, #faf8f5);
}

/* Toggle switch */
.a11y-switch {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}

.a11y-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.a11y-switch-slider {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.12);
    border-radius: 22px;
    cursor: pointer;
    transition: background 0.2s;
}

.a11y-switch-slider::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    bottom: 3px;
    left: 3px;
    background: var(--warm-cream, #faf8f5);
    border-radius: 50%;
    transition: transform 0.2s;
}

[dir="rtl"] .a11y-switch-slider::before {
    left: auto;
    right: 3px;
}

.a11y-switch input:checked + .a11y-switch-slider {
    background: var(--soft-gold, #d4a574);
}

.a11y-switch input:checked + .a11y-switch-slider::before {
    transform: translateX(18px);
}

[dir="rtl"] .a11y-switch input:checked + .a11y-switch-slider::before {
    transform: translateX(-18px);
}

.a11y-switch input:focus + .a11y-switch-slider {
    box-shadow: 0 0 0 2px rgba(212,165,116,0.4);
}

/* Link to accessibility statement */
.a11y-statement-link {
    display: block;
    text-align: center;
    color: var(--soft-gold, #d4a574);
    font-size: 0.78rem;
    margin-top: 12px;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════
   Active accessibility modes (applied to <html>)
   ═══════════════════════════════════════════════════════ */

/* High contrast */
html.a11y-high-contrast body {
    background: #000 !important;
    color: #fff !important;
}

html.a11y-high-contrast .card,
html.a11y-high-contrast .section,
html.a11y-high-contrast .main-nav,
html.a11y-high-contrast .site-footer {
    background: #111 !important;
    border-color: #fff !important;
}

html.a11y-high-contrast a {
    color: #ffff00 !important;
}

html.a11y-high-contrast .btn,
html.a11y-high-contrast .btn-primary {
    background: #ffff00 !important;
    color: #000 !important;
    border: 2px solid #ffff00 !important;
}

html.a11y-high-contrast img {
    filter: contrast(1.2);
}

/* Highlight links */
html.a11y-highlight-links a {
    outline: 2px solid var(--soft-gold, #d4a574) !important;
    outline-offset: 2px;
    text-decoration: underline !important;
}

/* Stop animations */
html.a11y-no-animations,
html.a11y-no-animations * {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

html.a11y-no-animations .animate-on-scroll,
html.a11y-no-animations .animate-scale,
html.a11y-no-animations .animate-slide-right {
    opacity: 1 !important;
    transform: none !important;
}

/* Readable font */
html.a11y-readable-font body,
html.a11y-readable-font * {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: 0.02em;
}

/* Large cursor */
html.a11y-large-cursor,
html.a11y-large-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32'%3E%3Ccircle cx='16' cy='16' r='14' fill='%23d4a574' stroke='%23000' stroke-width='2'/%3E%3Ccircle cx='16' cy='16' r='4' fill='%23000'/%3E%3C/svg%3E") 16 16, auto !important;
}

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

/* ─── Responsive ─────────────────────────────────────── */
@media (max-width: 480px) {
    .a11y-panel {
        left: 10px;
        right: 10px;
        width: auto;
    }
    [dir="rtl"] .a11y-panel {
        left: 10px;
        right: 10px;
    }
}
