/**
 * HICL HSIA WCAG 2.1 AA Accessibility Styles
 * Ensures portal pages meet contrast, focus, and motion requirements.
 */

/* ── Skip Navigation Link ───────────────────────────────────────────── */
.skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    z-index: 10000;
    padding: 0.5rem 1rem;
    background: #000;
    color: #fff;
    text-decoration: none;
    font-weight: bold;
}
.skip-link:focus {
    top: 0;
}

/* ── Focus Indicators (WCAG 2.4.7) ─────────────────────────────────── */
*:focus-visible {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(0, 95, 204, 0.25);
}

/* Remove default outline for mouse users */
:focus:not(:focus-visible) {
    outline: none;
}

/* ── Screen Reader Only (visually hidden) ───────────────────────────── */
.sr-only,
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── High Contrast Mode ─────────────────────────────────────────────── */
@media (forced-colors: active) {
    .hicl-page button,
    .hicl-page .btn {
        border: 2px solid ButtonText;
    }
    .hicl-page input,
    .hicl-page select,
    .hicl-page textarea {
        border: 1px solid ButtonText;
    }
}

/* ── Reduced 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;
    }
}

/* ── Minimum Touch Target Size (WCAG 2.5.8 — 44×44px) ──────────────── */
.hicl-page button,
.hicl-page .btn,
.hicl-page a[role="button"],
.hicl-page input[type="submit"],
.hicl-page input[type="button"] {
    min-height: 44px;
    min-width: 44px;
    padding: 0.625rem 1rem;
}

.hicl-page input[type="text"],
.hicl-page input[type="email"],
.hicl-page input[type="tel"],
.hicl-page input[type="password"],
.hicl-page select {
    min-height: 44px;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
}

/* ── Form Error States ──────────────────────────────────────────────── */
.hicl-page .form-group.has-error input,
.hicl-page .form-group.has-error select {
    border-color: #d32f2f;
    border-width: 2px;
}

.hicl-page .form-group.has-error .error-message {
    color: #d32f2f;
    font-weight: 600;
    margin-top: 0.25rem;
}

/* Ensure error messages are not color-only (add icon) */
.hicl-page .form-group.has-error .error-message::before {
    content: "\26A0\FE0F ";
}

/* ── Text Contrast Minimum (4.5:1 for normal text, 3:1 for large) ──── */
.hicl-page {
    color: #212121;
    background-color: #ffffff;
}

.hicl-page .text-muted {
    color: #616161; /* 7.0:1 ratio on white */
}

.hicl-page .text-secondary {
    color: #424242; /* 11.7:1 ratio on white */
}

/* ── Link Styling (not color-only) ──────────────────────────────────── */
.hicl-page a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.hicl-page a:hover {
    text-decoration-thickness: 2px;
}

/* ── Live Region Defaults ───────────────────────────────────────────── */
[aria-live="polite"],
[aria-live="assertive"],
[role="alert"],
[role="status"] {
    /* Ensure live regions are readable */
    min-height: 1em;
}

/* ── Print Accessibility ────────────────────────────────────────────── */
@media print {
    .hicl-page a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #333;
    }
}
