/* ========================================
   ACCESSIBILITY STYLES
   Park Community School
   ======================================== */

/* ========================================
   SKIP TO MAIN CONTENT LINK
   Hidden until focused - helps keyboard users
   ======================================== */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 1rem 2rem;
    text-decoration: none;
    font-weight: 600;
    z-index: 10000;
    border-radius: 0 0 8px 8px;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #a3cd42;
    outline-offset: 2px;
}

/* ========================================
   ENHANCED FOCUS INDICATORS
   Visible focus states for keyboard navigation
   ======================================== */

/* Remove default outline only when using mouse */
*:focus {
    outline: none;
}

/* Visible focus for keyboard users */
*:focus-visible {
    outline: 3px solid #a3cd42;
    outline-offset: 2px;
}

/* Links */
a:focus-visible {
    outline: 3px solid #a3cd42;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Buttons */
button:focus-visible,
.button:focus-visible,
.btn:focus-visible,
input[type="submit"]:focus-visible,
input[type="button"]:focus-visible {
    outline: 3px solid #a3cd42;
    outline-offset: 2px;
}

/* Form inputs */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid #a3cd42;
    outline-offset: 0;
    border-color: #a3cd42;
}

/* Cards and interactive elements */
.menu-box:focus-visible,
.card:focus-visible,
.feature-card:focus-visible,
.team-member-card:focus-visible {
    outline: 3px solid #a3cd42;
    outline-offset: 2px;
}

/* Navigation links - high contrast focus */
.site-navigation a:focus-visible {
    outline: 3px solid #a3cd42;
    outline-offset: 2px;
    background: rgba(163, 205, 66, 0.2);
}

/* ========================================
   SCREEN READER ONLY TEXT
   Visually hidden but accessible to screen readers
   ======================================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ========================================
   HIGH CONTRAST MODE SUPPORT
   Respects user's contrast preferences
   ======================================== */
@media (prefers-contrast: high) {
    a {
        text-decoration: underline;
    }
    
    .button, .btn {
        border: 2px solid currentColor;
    }
    
    .card, .menu-box, .feature-card {
        border: 2px solid #333;
    }
}

/* ========================================
   REDUCED MOTION
   Already in main CSS but reinforced here
   ======================================== */
@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;
    }
    
    .skip-link {
        transition: none;
    }
}

/* ========================================
   COLOUR CONTRAST HELPERS
   Use these classes to ensure readable text
   ======================================== */
.text-high-contrast {
    color: #000;
}

.bg-high-contrast {
    background: #fff;
    color: #000;
}

/* Dark backgrounds need white text */
.bg-dark .text-auto,
.bg-dark p,
.bg-dark h1,
.bg-dark h2,
.bg-dark h3,
.bg-dark h4,
.bg-dark li {
    color: #fff;
}

/* ========================================
   LINK STYLING FOR ACCESSIBILITY
   Underlines help identify links
   ======================================== */
.main-content a:not(.button):not(.btn):not(.menu-box) {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.main-content a:not(.button):not(.btn):not(.menu-box):hover {
    text-decoration-thickness: 2px;
}

/* ========================================
   FORM ACCESSIBILITY
   Clear labels and error states
   ======================================== */
label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Required field indicator */
.required::after {
    content: " *";
    color: #dc3545;
}

/* Error state */
.form-error {
    border-color: #dc3545 !important;
}

.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Success state */
.form-success {
    border-color: #28a745 !important;
}

/* ========================================
   MINIMUM TOUCH TARGET SIZE
   44x44px minimum for touch devices
   ======================================== */
@media (hover: none) and (pointer: coarse) {
    a, button, .button, .btn,
    input[type="submit"],
    input[type="button"],
    .menu-box {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Ensure adequate spacing between touch targets */
    nav a, .nav-link {
        padding: 12px 16px;
    }
}

/* ========================================
   TABLE ACCESSIBILITY
   Clear headers and row separation
   ======================================== */
table {
    border-collapse: collapse;
    width: 100%;
}

th {
    text-align: left;
    font-weight: 700;
    background: #f8f9fa;
}

th, td {
    padding: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
}

/* Zebra striping for readability */
tbody tr:nth-child(even) {
    background: #f8f9fa;
}

/* Row hover for mouse users */
@media (hover: hover) {
    tbody tr:hover {
        background: #e8f5e9;
    }
}

/* ========================================
   PRINT ACCESSIBILITY
   Ensure links show URLs when printed
   ======================================== */
@media print {
    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
    
    a[href^="/"]::after {
        content: " (https://pcs.hants.sch.uk" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}
