:root {
    --a11y-panel-radius: 1.2rem;
}

.skip-link {
    position: fixed;
    top: -100px;
    left: 1rem;
    z-index: 200;
    padding: 0.75rem 1.25rem;
    background-color: #111827;
    color: #ffffff;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s ease, box-shadow 0.2s ease;
}

.skip-link:focus {
    top: 1rem;
    outline: 3px solid #facc15;
    box-shadow: 0 10px 25px rgba(17, 24, 39, 0.25);
}

.a11y-toggle {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 120;
    width: 3rem;
    height: 3rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #f5c135, #facc15);
    color: #111827;
    font-size: 1.45rem;
    cursor: pointer;
    box-shadow: 0 15px 40px rgba(17, 24, 39, 0.22);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.a11y-toggle:hover,
.a11y-toggle:focus {
    transform: translateY(-2px);
    box-shadow: 0 22px 48px rgba(17, 24, 39, 0.28);
    outline: none;
}

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

.a11y-panel {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 140;
    width: min(340px, calc(100vw - 2.5rem));
    opacity: 0;
    transform: translateY(0.75rem) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.a11y-panel.is-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

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

.a11y-panel__container {
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 2.5rem);
    background: #ffffff;
    border-radius: var(--a11y-panel-radius);
    box-shadow: 0 22px 50px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(15, 23, 42, 0.08);
    overflow: hidden;
}

.a11y-panel__container::after {
    display: none;
}

.a11y-panel__header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.6rem 0;
    background: transparent;
    color: inherit;
}

.a11y-panel__close {
    border: none;
    background: rgba(15, 23, 42, 0.06);
    color: #0f172a;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 50%;
    font-size: 1.05rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.a11y-panel__close:hover,
.a11y-panel__close:focus-visible {
    background: rgba(15, 23, 42, 0.12);
    color: #0d2f73;
    transform: scale(1.05);
    outline: none;
}

.a11y-panel__body {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    padding: 1.05rem 1.15rem 0.95rem;
    background: transparent;
    overflow-y: auto;
}

.a11y-section {
    background: rgba(15, 23, 42, 0.035);
    border-radius: 1rem;
    padding: 0.8rem 0.9rem 0.95rem;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.a11y-section__title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #102a5c;
    margin-bottom: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.a11y-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
}

.a11y-option {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.85rem;
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: #ffffff;
    color: #102a5c;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.a11y-option__icon {
    font-size: 1.05rem;
    color: #1f4ed1;
}

.a11y-option:hover,
.a11y-option:focus-visible {
    transform: translateY(-2px);
    border-color: rgba(31, 78, 209, 0.7);
    box-shadow: 0 14px 28px rgba(31, 78, 209, 0.15);
    background: linear-gradient(120deg, #ffffff 0%, rgba(231, 236, 255, 0.85) 100%);
    outline: none;
}

.a11y-option[aria-pressed='true'] {
    background: linear-gradient(135deg, #15388c, #2563eb);
    color: #f8fafc;
    border-color: rgba(21, 56, 140, 0.85);
    box-shadow: 0 18px 32px rgba(21, 56, 140, 0.28);
}

.a11y-panel__footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1.15rem 0.95rem;
    background: rgba(248, 250, 252, 0.95);
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.a11y-reset {
    border: none;
    background: none;
    color: #1f4ed1;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    text-decoration: none;
}

.a11y-reset::before {
    content: '\u21bb';
    font-size: 0.75rem;
}

.a11y-reset:hover,
.a11y-reset:focus-visible {
    color: #15388c;
    outline: none;
}

@media (max-width: 640px) {
    .a11y-panel {
        right: 0.9rem;
        left: 0.9rem;
        bottom: 1rem;
        width: auto;
    }

    .a11y-panel__container {
        max-height: calc(100vh - 1.5rem);
        border-radius: 1rem;
    }

    .a11y-grid {
        grid-template-columns: repeat(1, minmax(0, 1fr));
    }

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

/* Accessibility states */
html[data-a11y-text-size="large"] {
    font-size: 110%;
}

html[data-a11y-line-height="wide"] body {
    line-height: 1.8;
}

html[data-a11y-font="readable"] body {
    font-family: 'Arial', 'Helvetica Neue', Arial, sans-serif !important;
}

html[data-a11y-contrast="high"] body,
html[data-a11y-contrast="high"] header,
html[data-a11y-contrast="high"] section,
html[data-a11y-contrast="high"] footer,
html[data-a11y-contrast="high"] nav,
html[data-a11y-contrast="high"] [class*="bg-white"],
html[data-a11y-contrast="high"] [class*="bg-slate"],
html[data-a11y-contrast="high"] [class*="bg-brand-primary"] {
    background-color: #0b1120 !important;
    background-image: none !important;
    color: #ffffff !important;
}

html[data-a11y-contrast="high"] a {
    color: #facc15 !important;
    text-decoration: underline !important;
}

html[data-a11y-contrast="high"] .border,
html[data-a11y-contrast="high"] .border-slate-200,
html[data-a11y-contrast="high"] .border-slate-100,
html[data-a11y-contrast="high"] .border-slate-300 {
    border-color: #facc15 !important;
}

html[data-a11y-contrast="high"] .btn,
html[data-a11y-contrast="high"] .button,
html[data-a11y-contrast="high"] button,
html[data-a11y-contrast="high"] .a11y-option,
html[data-a11y-contrast="high"] .a11y-toggle,
html[data-a11y-contrast="high"] .a11y-panel__close {
    background-color: #facc15 !important;
    color: #0b1120 !important;
    border-color: #facc15 !important;
    background-image: none !important;
    box-shadow: none !important;
}

html[data-a11y-contrast="high"] .a11y-panel__container,
html[data-a11y-contrast="high"] .a11y-panel__header,
html[data-a11y-contrast="high"] .a11y-panel__body,
html[data-a11y-contrast="high"] .a11y-option,
html[data-a11y-contrast="high"] .a11y-option[aria-pressed="true"] {
    background-color: #1f2937 !important;
    color: #f8fafc !important;
    border-color: #facc15 !important;
}

html[data-a11y-contrast="high"] .a11y-reset {
    color: #facc15 !important;
}

html[data-a11y-grayscale="on"] img,
html[data-a11y-grayscale="on"] picture,
html[data-a11y-grayscale="on"] video {
    filter: grayscale(100%) !important;
}

html[data-a11y-images="hide"] img,
html[data-a11y-images="hide"] picture,
html[data-a11y-images="hide"] video,
html[data-a11y-images="hide"] figure {
    display: none !important;
}

html[data-a11y-motion="reduce"] *,
html[data-a11y-motion="reduce"] *::before,
html[data-a11y-motion="reduce"] *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

html[data-a11y-links="highlight"] a,
html[data-a11y-links="highlight"] a:visited {
    background-color: #fef08a !important;
    color: #111827 !important;
    text-decoration: underline !important;
    outline: 2px solid #facc15 !important;
    outline-offset: 2px !important;
}

html[data-a11y-focus="bright"] *:focus-visible {
    outline: 3px solid #f97316 !important;
    outline-offset: 4px !important;
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.3) !important;
}

html[data-a11y-structure="show"] h1,
html[data-a11y-structure="show"] h2,
html[data-a11y-structure="show"] h3,
html[data-a11y-structure="show"] h4 {
    border-left: 4px solid #facc15 !important;
    padding-left: 0.75rem !important;
    margin-left: 0 !important;
}

html[data-a11y-structure="show"] [role="dialog"],
html[data-a11y-structure="show"] main,
html[data-a11y-structure="show"] section,
html[data-a11y-structure="show"] nav,
html[data-a11y-structure="show"] footer {
    outline: 2px dashed rgba(250, 204, 21, 0.6) !important;
    outline-offset: 3px !important;
}

html[data-a11y-contrast="high"] .skip-link {
    background-color: #facc15 !important;
    color: #111827 !important;
}

html[data-a11y-contrast="high"] img,
html[data-a11y-contrast="high"] video,
html[data-a11y-contrast="high"] picture {
    filter: contrast(140%) brightness(80%);
}
