.a11y-widget {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.a11y-widget__toggle {
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 10px 0 0 10px;
    background: var(--green);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: -2px 2px 8px rgba(0,0,0,0.15);
    transition: background 0.2s;
}

.a11y-widget__toggle:hover {
    background: #3d6a54;
}

.a11y-widget__toggle svg {
    width: 26px;
    height: 26px;
    fill: currentColor;
}

.a11y-widget__panel {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    border-radius: 12px 0 0 12px;
    box-shadow: -4px 0 20px rgba(0,0,0,0.12);
    padding: 24px 20px;
    width: 220px;
    display: none;
    flex-direction: column;
    gap: 20px;
    z-index: 10000;
}

.a11y-widget.open .a11y-widget__panel {
    display: flex;
}

.a11y-widget.open .a11y-widget__toggle {
    display: none;
}

.a11y-widget__section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.a11y-widget__font-controls {
    display: flex;
    gap: 6px;
}

.a11y-widget__font-controls button {
    flex: 1;
    height: 40px;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    color: var(--dark);
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.a11y-widget__font-controls button:hover {
    border-color: var(--green);
    color: var(--green);
}

.a11y-widget__font-controls button.active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.a11y-widget__font-controls button span {
    line-height: 1;
}

.a11y-widget__font-controls button:nth-child(1) span { font-size: 14px; }
.a11y-widget__font-controls button:nth-child(2) span { font-size: 17px; }
.a11y-widget__font-controls button:nth-child(3) span { font-size: 21px; }

.a11y-widget__contrast-controls {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.a11y-widget__contrast-controls button {
    height: 38px;
    border: 2px solid var(--card-border);
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    font-size: 13px;
    color: var(--dark);
    transition: all 0.15s;
    text-align: left;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.a11y-widget__contrast-controls button:hover {
    border-color: var(--green);
}

.a11y-widget__contrast-controls button.active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.a11y-widget__contrast-controls button .swatch {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    flex-shrink: 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.a11y-widget__contrast-controls button[data-contrast="normal"] .swatch {
    background: #fafaf7;
}
.a11y-widget__contrast-controls button[data-contrast="high"] .swatch {
    background: #000;
}
.a11y-widget__contrast-controls button[data-contrast="inverted"] .swatch {
    background: linear-gradient(135deg, #1a1a2e 50%, #e0c097 50%);
}

.a11y-widget__reset {
    border: none;
    background: none;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--green);
    text-decoration: underline;
    text-align: center;
    padding: 4px;
}

.a11y-widget__reset:hover {
    color: #3d6a54;
}

.a11y-widget__close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--dark);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s;
}

.a11y-widget__close:hover {
    background: rgba(0,0,0,0.06);
}

.a11y-widget__close svg {
    width: 16px;
    height: 16px;
}

/* ── Contrast modes applied to <html> ──────────────── */

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

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

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

/* Keep the widget readable in high-contrast/inverted */
html.a11y-high-contrast .a11y-widget__panel,
html.a11y-inverted .a11y-widget__panel {
    filter: none;
}

/* ── Header adaptation for zoom (desktop only) ────── */

@media (min-width: 961px) {
    html.a11y-zoom-1 .header { padding: 0 20px; }
    html.a11y-zoom-1 .header__logo img { width: 170px; }
    html.a11y-zoom-1 .header__nav { gap: 16px; }
    html.a11y-zoom-1 .header__actions { gap: 16px; }
    html.a11y-zoom-1 .header__actions .btn.btn--yellow { padding: 14px 20px; }

    html.a11y-zoom-2 .header { padding: 0 12px; }
    html.a11y-zoom-2 .header__logo img { width: 140px; }
    html.a11y-zoom-2 .header__nav { gap: 10px; }
    html.a11y-zoom-2 .header__nav a,
    html.a11y-zoom-2 .header__nav .menu-item a { letter-spacing: 0; }
    html.a11y-zoom-2 .header__actions { gap: 12px; }
    html.a11y-zoom-2 .header__actions .btn.btn--yellow { padding: 12px 16px; }
}

/* ── Zoom: hamburger fallback on narrower screens ──── */

@media (max-width: 1500px) {
    html.a11y-zoom-2 .header__nav { display: none; }
    html.a11y-zoom-2 .header__nav.open { display: flex; flex-direction: column; position: absolute; top: 120px; left: 0; right: 0; background: #fff; padding: 20px; gap: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 99; }
    html.a11y-zoom-2 .header__hamburger { display: block; }
    html.a11y-zoom-2 .header__actions .btn.btn--yellow { display: none; }
    html.a11y-zoom-2 .header__actions { margin-left: auto; }
}

@media (max-width: 1700px) {
    html.a11y-zoom-1 .header__nav { display: none; }
    html.a11y-zoom-1 .header__nav.open { display: flex; flex-direction: column; position: absolute; top: 120px; left: 0; right: 0; background: #fff; padding: 20px; gap: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 99; }
    html.a11y-zoom-1 .header__hamburger { display: block; }
    html.a11y-zoom-1 .header__actions .btn.btn--yellow { display: none; }
    html.a11y-zoom-1 .header__actions { margin-left: auto; }

    html.a11y-zoom-2 .header__nav { display: none; }
    html.a11y-zoom-2 .header__nav.open { display: flex; flex-direction: column; position: absolute; top: 120px; left: 0; right: 0; background: #fff; padding: 20px; gap: 12px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); z-index: 99; }
    html.a11y-zoom-2 .header__hamburger { display: block; }
    html.a11y-zoom-2 .header__actions .btn.btn--yellow { display: none; }
    html.a11y-zoom-2 .header__actions { margin-left: auto; }
}

/* ── Mobile adjustments ────────────────────────────── */

@media (max-width: 768px) {
    .a11y-widget__panel {
        width: 200px;
        padding: 20px 16px;
    }
}
