/* ============================================================
   Accessibility Overrides (WCAG 2.1 AA)
   Loaded AFTER main.css so these rules win.
   ============================================================ */

/* ----- Skip link: visible on focus only ----- */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0c1c4c;
    color: #fff !important;
    padding: 8px 16px;
    z-index: 10000;
    text-decoration: none;
    border-radius: 0 0 5px 0;
    font-weight: 600;
}
.skip-link:focus {
    top: 0;
    outline: 3px solid #ffbf47;
    outline-offset: 0;
}

/* ----- Visible focus indicators on ALL interactive elements ----- */
a:focus,
a:focus-visible,
button:focus,
button:focus-visible,
input:focus,
input:focus-visible,
textarea:focus,
textarea:focus-visible,
select:focus,
select:focus-visible,
[tabindex]:focus,
[tabindex]:focus-visible {
    outline: 3px solid #ffbf47 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px rgba(255, 191, 71, 0.35) !important;
}

/* Nav links need a focus style that works on dark backgrounds too */
#nav a:focus,
#nav a:focus-visible {
    outline: 3px solid #ffbf47 !important;
    outline-offset: 4px !important;
    background-color: rgba(255, 255, 255, 0.1);
}

/* ----- Contrast fixes ----- */

/* Buttons: light-blue #37c0fb on white text fails WCAG AA (~1.96:1).
   Darken to #0078a8 (white-on-this ~ 4.78:1) */
.button,
input[type="submit"],
input[type="reset"],
input[type="button"] {
    background-color: #0078a8 !important;
    background-image: none !important;
}
.button:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
input[type="button"]:hover {
    background-color: #00608a !important;
}
.button:active,
input[type="submit"]:active,
input[type="reset"]:active,
input[type="button"]:active {
    background-color: #004c6e !important;
}

/* Ghost / not-a-ghost buttons: same fix */
.not-a-ghost-button-full-color {
    background-color: #0078a8 !important;
    border-color: #0078a8 !important;
    color: #fff !important;
}
.not-a-ghost-button-full-color:hover,
.not-a-ghost-button-full-color:active,
.not-a-ghost-button-full-color:focus {
    background-color: #00608a !important;
    border-color: #00608a !important;
    color: #fff !important;
}

.ghost-button-full-color {
    color: #0078a8 !important;
    border: 2px solid #0078a8 !important;
    background-color: #fff !important;
}
.ghost-button-full-color:hover,
.ghost-button-full-color:active,
.ghost-button-full-color:focus {
    background-color: #0078a8 !important;
    border-color: #0078a8 !important;
    color: #fff !important;
}

/* "Click to zoom!" was orange (~#ffa500) on white — fails contrast.
   Use a darker orange (#a65a00) which gives 4.55:1 on white. */
.zoom-hint,
span.zoom-hint {
    color: #a65a00 !important;
    display: block;
    text-align: center;
    font-weight: 600;
    margin-top: 0.5em;
}

/* The pale-grey #999 text on white fails contrast. Bump to #595959 (~7:1). */
input::-webkit-input-placeholder { color: #595959 !important; }
input::-moz-placeholder           { color: #595959 !important; opacity: 1; }
input:-ms-input-placeholder       { color: #595959 !important; }
textarea::-webkit-input-placeholder { color: #595959 !important; }
textarea::-moz-placeholder         { color: #595959 !important; opacity: 1; }
textarea:-ms-input-placeholder     { color: #595959 !important; }

/* Form inputs: ensure visible borders for users who can't see faint outlines */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
textarea {
    border: 2px solid #474747 !important;
    background-color: #fff !important;
    color: #000 !important;
    padding: 8px !important;
    border-radius: 4px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 1rem;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="tel"]:focus,
textarea:focus {
    border-color: #0078a8 !important;
}

/* Form labels: make them visible and properly weighted */
label {
    display: block;
    margin-top: 1em;
    margin-bottom: 0.25em;
    font-weight: 600;
    color: #000 !important;
}

/* Required field indicator */
.required-indicator {
    color: #b00020;
    font-weight: 700;
    margin-left: 2px;
}

/* Error messages */
.field-error {
    color: #b00020;
    font-weight: 600;
    margin-top: 0.25em;
    font-size: 0.95em;
}

/* Screen-reader-only utility class */
.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;
}

/* Honor reduced-motion preferences (the about/corpsnet pages cross-fade
   background images via setInterval; we can't stop the JS from CSS, but
   we can strip transitions for users who don't want motion). */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Make sure the hidden h1 site title is hidden from sighted users but
   still available to assistive tech. The original used display:none
   which removes it from the accessibility tree too. */
.visually-hidden-heading {
    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;
}

/* Footer links: underline so they're distinguishable without color alone */
#footer a {
    text-decoration: underline;
}

/* Ensure all links inside body content are distinguishable without
   relying on color alone (WCAG 1.4.1 Use of Color). */
main a,
.container a:not(.button):not(.ghost-button-full-color):not(.not-a-ghost-button-full-color) {
    text-decoration: underline;
}

/* When an <a> wraps an image (e.g. logo links on home page), the
   underline on adjacent text shouldn't appear under the image. */
a:has(> img:only-child) {
    text-decoration: none;
}
