/* Explain: Styles for the floating accessibility menu and its options. */
/* ==========================================================================
   Accessibility menu — shared on every page
   ========================================================================== */

.a11y-widget {
    position: fixed;
    z-index: 90;
    inset-inline-start: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: calc(100vw - 2rem);
}

.a11y-fab {
    display: grid;
    place-items: center;
    width: 3rem;
    height: 3rem;
    flex: 0 0 auto;
    border-radius: 9999px;
    border: 1px solid var(--primary-color);
    background: var(--surface-color);
    color: var(--primary-color);
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.a11y-fab:hover {
    background: var(--primary-color);
    color: #12100a;
    transform: translateY(-2px);
}

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

.a11y-panel {
    display: none;
    flex-direction: column;
    gap: 1.1rem;
    width: min(20rem, calc(100vw - 2rem));
    max-height: 78vh;
    overflow-y: auto;
    padding: 1.15rem 1.2rem 1.3rem;
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    background: var(--surface-color);
    box-shadow: var(--shadow-soft);
}

.a11y-panel.is-open {
    display: flex;
}

.a11y-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.a11y-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-color);
}

.a11y-close {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 auto;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    color: var(--text-color);
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease;
}

.a11y-close:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.a11y-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.a11y-label {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.a11y-size-row {
    display: flex;
    gap: 0.5rem;
}

.a11y-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex: 1 1 0;
    min-height: 44px;
    padding: 0.5rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 0.7rem;
    background: var(--surface-2);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.a11y-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.a11y-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.a11y-scale-indicator {
    margin: 0;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary-color);
}

.a11y-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 44px;
    cursor: pointer;
}

.a11y-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.a11y-switch-track {
    position: relative;
    flex: 0 0 auto;
    width: 2.75rem;
    height: 1.5rem;
    border-radius: 9999px;
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    transition: background 0.25s ease, border-color 0.25s ease;
}

.a11y-switch-track::after {
    content: '';
    position: absolute;
    top: 0.14rem;
    inset-inline-start: 0.14rem;
    width: 1.05rem;
    height: 1.05rem;
    border-radius: 9999px;
    background: var(--text-muted);
    transition: transform 0.25s ease, background 0.25s ease;
}

.a11y-switch input:checked + .a11y-switch-track {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.a11y-switch input:checked + .a11y-switch-track::after {
    background: #12100a;
    transform: translateX(1.2rem);
}

html[dir="rtl"] .a11y-switch input:checked + .a11y-switch-track::after {
    transform: translateX(-1.2rem);
}

.a11y-switch input:focus-visible + .a11y-switch-track {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.a11y-switch-text {
    font-size: 0.95rem;
    color: var(--text-color);
}

/* ---------- Text size scaling ---------- */
html.a11y-text-sm {
    font-size: 87.5%;
}

html.a11y-text-lg {
    font-size: 112.5%;
}

html.a11y-text-xl {
    font-size: 125%;
}

/* Keep the top bar tidy while the text is enlarged */
html.a11y-text-lg .header-search,
html.a11y-text-xl .header-search {
    display: none !important;
}

html.a11y-text-lg .site-header nav > ul,
html.a11y-text-xl .site-header nav > ul {
    gap: 0.85rem;
}

html.a11y-text-xl #siteHeader .brand-name {
    display: none;
}

/* ---------- High contrast mode ---------- */
html.a11y-contrast {
    --primary-color: #ffd400;
    --primary-hover: #ffe666;
    --secondary-color: #7df3e6;
    --accent-color: #7df3e6;
    --background-color: #000000;
    --surface-color: #0b0b0b;
    --surface-2: #171717;
    --text-color: #ffffff;
    --text-muted: #eaeaea;
    --border-color: #ffffff;
    --gold-line: rgba(255, 212, 0, 0.75);
    --shadow-soft: 0 20px 50px rgba(0, 0, 0, 0.9);
    --paper-color: #ffffff;
    --paper-color-alt: #f2f2f2;
    --ink-color: #000000;
    --ink-muted: #1a1a1a;
    --paper-border: #000000;
    --paper-rule: rgba(0, 0, 0, 0.55);
}

html.a11y-contrast .hero-scrim {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.96), rgba(0, 0, 0, 0.82) 42%, rgba(0, 0, 0, 0.99));
}

html.a11y-contrast .hero-title {
    background: none;
    -webkit-text-fill-color: #ffffff;
    color: #ffffff;
}

html.a11y-contrast .section-eyebrow {
    color: var(--primary-color);
}

html.a11y-contrast .field-input::placeholder,
html.a11y-contrast .header-search-input::placeholder,
html.a11y-contrast .search-page-input::placeholder {
    color: #cfcfcf;
}

html.a11y-contrast img {
    filter: contrast(1.06) saturate(1.05);
}

html.a11y-contrast .media-frame,
html.a11y-contrast .gallery-item,
html.a11y-contrast .video-frame,
html.a11y-contrast .portrait-frame {
    border-color: #ffffff;
    border-width: 2px;
}

/* ---------- Extra-readable font mode ---------- */
html.a11y-readable {
    --font-heading: 'Assistant', 'Heebo', Arial, sans-serif;
    --font-body: 'Assistant', 'Heebo', Arial, sans-serif;
}

html.a11y-readable body {
    line-height: 1.95;
    letter-spacing: 0.015em;
}

html.a11y-readable .section-title,
html.a11y-readable .hero-title,
html.a11y-readable .tl-title,
html.a11y-readable .section-eyebrow {
    letter-spacing: 0.01em;
}

html.a11y-readable .tl-text,
html.a11y-readable .section-lead,
html.a11y-readable .wall-text,
html.a11y-readable .story-body,
html.a11y-readable .faq-answer {
    line-height: 1.9;
}

html.a11y-readable .nav-link,
html.a11y-readable .footer-link,
html.a11y-readable .mobile-link,
html.a11y-readable .more-link,
html.a11y-readable .tl-more {
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ---------- Visible keyboard focus ---------- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .a11y-fab,
    .a11y-btn,
    .a11y-switch-track,
    .a11y-switch-track::after {
        transition: none;
    }
}