/* Accessibility Utility Classes */

/* Screen reader only - visually hidden but accessible */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Screen reader only but focusable - shows on focus */
.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus visible styles for keyboard navigation — !important overrides
   the 64+ component CSS files that set outline: none */
:focus-visible {
    outline: 3px solid var(--focus-color, #005fcc) !important;
    outline-offset: 2px !important;
}

/* Skip link styling */
.skip-link {
    background: var(--primary-color, #007bff);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 9999;
    overflow: hidden;
}

.skip-link:focus {
    position: fixed;
    top: 10px;
    left: 10px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn-primary,
    .btn-secondary,
    .btn-danger,
    .btn-warning {
        border: 2px solid currentColor;
    }

    a:focus,
    button:focus {
        outline: 3px solid currentColor;
    }
}

/* Reduced motion support */
@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;
    }
}

/* Ensure links have underlines for visibility */
a:not([class]) {
    text-decoration-skip-ink: auto;
}

/* Required field indicator */
.required-indicator {
    color: var(--danger-color, #dc3545);
    margin-left: 2px;
}

/* WCAG 2.4.11 Focus Not Obscured (Minimum) — keep a keyboard-focused element from scrolling in
   underneath a sticky top bar. scroll-padding-top must sit on the element that actually scrolls:
   - MinOrganisationLayout: .main-area (data-testid="layout-scroll-area") is the scroll container,
     the window never scrolls; its sticky .topbar is 80px (same value as #main-content's
     scroll-margin-top in MinOrganisationLayout.razor.css).
   - MainLayout (ICV): the window scrolls under the sticky 3.5rem .top-row. */
html {
    scroll-padding-top: 3.5rem;
}

[data-testid="layout-scroll-area"] {
    scroll-padding-top: 80px;
}
