/* Accessibility-focused CSS styles */

/* Skip Navigation Link - Accessible to screen readers and keyboard users */
.skip-link {
    position: absolute;
    top: -100%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-primary);
    color: var(--color-white);
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--border-radius-md);
    z-index: 10000;
    text-decoration: none;
    font-weight: 600;
    transition: top var(--transition-fast);
}

.skip-link:focus {
    top: var(--spacing-sm);
    outline: var(--focus-outline);
    outline-offset: 2px;
}

/* Enhanced Focus Styles for Keyboard Navigation */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[tabindex]:focus {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

/* Ensure focus is visible on all interactive elements */
.btn:focus,
.nav-link:focus,
.social-link:focus {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

/* Screen Reader Only - Visually hidden but accessible */
.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;
}

/* Show on focus for keyboard users */
.sr-only:focus,
.visually-hidden:focus {
    position: static;
    width: auto;
    height: auto;
    padding: var(--spacing-sm) var(--spacing-md);
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background: var(--color-primary);
    color: var(--color-white);
}

/* Ensure adequate color contrast */
.high-contrast-text {
    color: var(--color-black);
}

/* Remove animations for users who prefer 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;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #003366;
        --color-secondary: #006666;
        --color-gray: #333333;
    }

    .btn {
        border-width: 3px;
    }

    a {
        text-decoration: underline;
    }
}

/* Forced colors mode (Windows High Contrast) */
@media (forced-colors: active) {
    .btn {
        border: 2px solid currentColor;
    }

    .nav-link[aria-current="page"]::after {
        background-color: currentColor;
    }
}

/* Minimum touch target size (44x44px for WCAG AAA) */
.btn,
.nav-link,
.social-link,
button,
a[role="button"],
input[type="submit"],
input[type="button"] {
    min-height: 44px;
    min-width: 44px;
}

/* Text sizing - ensure base font is at least 16px */
html {
    font-size: 100%; /* Respects user's browser settings */
}

/* Line height for readability (WCAG recommends 1.5) */
body {
    line-height: 1.6;
}

p,
li {
    line-height: 1.6;
}

/* Paragraph spacing (at least 2em for WCAG AAA) */
p + p {
    margin-top: 1.5em;
}

/* Link distinction - underline links in body text */
main p a,
main li a,
article p a,
article li a {
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

main p a:hover,
main li a:hover,
article p a:hover,
article li a:hover {
    text-decoration-thickness: 2px;
}

/* Ensure form labels are associated with inputs */
label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 500;
}

/* Error states with clear visual indication */
.error {
    border-color: #c53030 !important;
    background-color: #fff5f5;
}

.error-message {
    color: #c53030;
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-xs);
}

/*Required field indicator */
.required::after {
    content: " (required)";
    color: var(--color-gray);
}
     

/* Focus indicator for complex components */
[role="menu"]:focus-within,
[role="listbox"]:focus-within,
[role="dialog"]:focus-within {
    outline: var(--focus-outline);
    outline-offset: 2px;
}

/* Ensure images have proper alt text styling when broken */
img {
    font-family: var(--font-primary);
    font-size: var(--font-size-sm);
    color: var(--color-gray);
}

/* Table accessibility */
table {
    border-collapse: collapse;
    width: 100%;
}

th {
    text-align: left;
    font-weight: 600;
    background-color: var(--color-off-white);
}

th,
td {
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--color-light-gray);
}

/* Caption for tables */
caption {
    padding: var(--spacing-sm);
    font-weight: 600;
    text-align: left;
}

/* Print styles for accessibility */
@media print {
    /* Show full URLs for links */
    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: var(--color-gray);
    }

    /* Don't show URL for navigation links */
    nav a[href]::after {
        content: none;
    }

    /* Ensure text is black on white */
    body {
        color: #000;
        background: #fff;
    }

    /* Remove backgrounds */
    .hero,
    .cta-section {
        background: #fff !important;
        color: #000 !important;
    }
}
