/* ============================================================
   ACCESSIBILITY TOOLBAR (header toggle + dropdown panel)
   ============================================================ */
.a11y-toolbar {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-right: 1rem;
}

.a11y-toolbar__toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    cursor: pointer;
    white-space: nowrap;
}

.a11y-toolbar__toggle:focus-visible,
.a11y-panel__close:focus-visible,
.a11y-option:focus-visible,
.a11y-reset-all:focus-visible {
    outline: 2px solid var(--primary-alt, #185FA5);
    outline-offset: 2px;
}

.a11y-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #fff;
    color: #212529;
    border-radius: 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
    z-index: 10001;
}

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

.a11y-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #e8e8e8;
}

.a11y-panel__title {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.a11y-panel__close {
    background: none;
    border: none;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    color: #555;
}

.a11y-panel__body {
    padding: 14px 16px;
    max-height: 70vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

.a11y-group {
    margin-bottom: 16px;
}

.a11y-group h3 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #666;
    margin: 0 0 8px;
}

.a11y-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.a11y-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 10px 4px;
    background: #f4f6f8;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    font-size: 11px;
    text-align: center;
    color: #212529;
    cursor: pointer;
}

.a11y-option i {
    font-size: 16px;
}

.a11y-option:hover {
    background: #e9ecef;
}

.a11y-option[aria-pressed="true"] {
    background: #185FA5;
    border-color: #185FA5;
    color: #fff;
}

.a11y-reset-all {
    width: 100%;
    padding: 8px;
    background: #212529;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
}

/* ============================================================
   GLOBAL DISPLAY ADJUSTMENTS (applied to <html>)
   ============================================================ */
html.a11y-contrast-high body,
html.a11y-contrast-high body * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

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

html.a11y-contrast-high img {
    filter: grayscale(100%) contrast(120%);
}

html.a11y-contrast-dark body,
html.a11y-contrast-dark body * {
    background-color: #111 !important;
    color: #eee !important;
    border-color: #444 !important;
}

html.a11y-contrast-dark a {
    color: #8ab4f8 !important;
}

/* The toolbar itself keeps its own readable colors even under contrast modes. */
html.a11y-contrast-high .a11y-toolbar,
html.a11y-contrast-high .a11y-toolbar *,
html.a11y-contrast-dark .a11y-toolbar,
html.a11y-contrast-dark .a11y-toolbar * {
    background-color: revert !important;
    color: revert !important;
    border-color: revert !important;
}

html.a11y-highlight-links a {
    background: #ffff00 !important;
    color: #000 !important;
    text-decoration: underline !important;
    outline: 1px solid #000 !important;
}

html.a11y-invert {
    filter: invert(1) hue-rotate(180deg);
}

html.a11y-invert img,
html.a11y-invert video,
html.a11y-invert iframe {
    filter: invert(1) hue-rotate(180deg);
}

html.a11y-desaturate {
    filter: grayscale(100%);
}

html.a11y-line-height body,
html.a11y-line-height p,
html.a11y-line-height li,
html.a11y-line-height div {
    line-height: 2 !important;
}

html.a11y-letter-spacing body,
html.a11y-letter-spacing p,
html.a11y-letter-spacing li,
html.a11y-letter-spacing a,
html.a11y-letter-spacing span {
    letter-spacing: 0.08em !important;
    word-spacing: 0.16em !important;
}

html.a11y-big-cursor,
html.a11y-big-cursor * {
    cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 24 24"><path d="M3 2l7.07 16.97 2.51-7.39 7.39-2.51z" fill="black" stroke="white" stroke-width="1.2"/></svg>') 4 4, auto !important;
}

html.a11y-hide-images img,
html.a11y-hide-images picture,
html.a11y-hide-images svg:not(.a11y-bar svg):not(.a11y-panel svg) {
    visibility: hidden !important;
}

@media (max-width: 480px) {
    .a11y-toolbar__toggle span {
        display: none;
    }

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