/* ==========================================================================
   CADEF Accessibility (A11Y)
   Default look is unchanged. Opt-in classes only change appearance when
   the visitor enables options from the accessibility panel.
   ========================================================================== */

/* Skip link: invisible until keyboard focus */
.a11y-skip-link {
    position: absolute;
    left: 12px;
    top: 12px;
    z-index: 100000;
    padding: 12px 16px;
    border-radius: 8px;
    background: #0b3d2e;
    color: #fff !important;
    font-family: Inter, system-ui, sans-serif;
    font-size: 15px;
    font-weight: 600;
    text-decoration: none;
    transform: translateY(-200%);
    transition: transform 0.15s ease;
}

.a11y-skip-link:focus,
.a11y-skip-link:focus-visible {
    transform: translateY(0);
    outline: 3px solid #4aab3d;
    outline-offset: 2px;
}

/* Keyboard focus only — mouse users keep existing styles */
:focus {
    outline: none;
}

:focus-visible {
    outline: 3px solid #4aab3d;
    outline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #4aab3d;
    outline-offset: 3px;
}

/* System preference: reduce motion (does not alter static layout) */
@media (prefers-reduced-motion: reduce) {
    html:not(.a11y-motion-on) *,
    html:not(.a11y-motion-on) *::before,
    html:not(.a11y-motion-on) *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    html:not(.a11y-motion-on) .wow {
        visibility: visible !important;
        animation: none !important;
    }
}

html.a11y-reduce-motion *,
html.a11y-reduce-motion *::before,
html.a11y-reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

html.a11y-reduce-motion .wow {
    visibility: visible !important;
    animation: none !important;
}

/* Opt-in: larger text (scales type without rewriting layout CSS) */
html.a11y-font-large {
    font-size: 112.5%;
}

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

/* Opt-in: underline links for clarity */
html.a11y-underline-links a:not(.btn):not(.btn-default):not(.btn-wizard):not(.navbar-brand):not(.a11y-widget__btn):not(.a11y-skip-link) {
    text-decoration: underline;
    text-underline-offset: 0.18em;
}

/* Opt-in: high contrast — stronger text/background, keeps brand greens */
html.a11y-contrast {
    filter: none;
}

html.a11y-contrast body {
    background: #fff !important;
    color: #111 !important;
}

html.a11y-contrast p,
html.a11y-contrast li,
html.a11y-contrast label,
html.a11y-contrast span,
html.a11y-contrast td,
html.a11y-contrast th {
    color: #111 !important;
}

html.a11y-contrast a:not(.btn):not(.btn-default):not(.header-btn a) {
    color: #064e3b !important;
}

html.a11y-contrast .btn-default,
html.a11y-contrast .btn-primary,
html.a11y-contrast .btn-wizard.btn-next,
html.a11y-contrast .btn-wizard.btn-submit {
    outline: 2px solid #000;
}

/* Floating accessibility control — compact, does not shift page layout */
.a11y-widget {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 99990;
    font-family: Inter, system-ui, sans-serif;
}

.a11y-widget__btn {
    width: 52px;
    height: 52px;
    border: 0;
    border-radius: 999px;
    background: #0b3d2e;
    color: #fff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.a11y-widget__btn:hover {
    background: #145c42;
}

.a11y-widget__btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.a11y-widget__panel {
    position: absolute;
    right: 0;
    bottom: 64px;
    width: min(300px, calc(100vw - 32px));
    background: #fff;
    color: #111;
    border: 1px solid #d7ddd8;
    border-radius: 14px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18);
    padding: 14px;
    display: none;
}

.a11y-widget__panel.is-open {
    display: block;
}

.a11y-widget__title {
    margin: 0 0 10px;
    font-size: 15px;
    font-weight: 700;
}

.a11y-widget__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-top: 1px solid #eef1ef;
    font-size: 13.5px;
}

.a11y-widget__row:first-of-type {
    border-top: 0;
}

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

.a11y-widget__actions button,
.a11y-widget__reset {
    border: 1px solid #cfd6d1;
    background: #f7faf8;
    color: #122;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
}

.a11y-widget__actions button.is-active,
.a11y-widget__toggle.is-active {
    background: #0b3d2e;
    border-color: #0b3d2e;
    color: #fff;
}

.a11y-widget__reset {
    width: 100%;
    margin-top: 10px;
}

.a11y-widget__hint {
    margin: 8px 0 0;
    font-size: 11.5px;
    color: #5b655f;
    line-height: 1.4;
}

.a11y-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Live region for announcements */
.a11y-live {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

@media (max-width: 575.98px) {
    .a11y-widget {
        right: 12px;
        bottom: 12px;
    }

    .a11y-widget__btn {
        width: 48px;
        height: 48px;
    }
}
