/**
 * Accessibility Enhancements for MSM Theme
 * Critical UI/UX improvements for better accessibility
 * Generated with Claude Code
 */

/* ====================================================
   FOCUS INDICATORS
   ==================================================== */

/* Enhanced focus indicators for better keyboard navigation */
*:focus {
    outline: 3px solid #00b4d9;
    outline-offset: 2px;
    transition: outline-color 0.2s ease;
}

/* Custom focus styles for buttons */
button:focus,
input[type="submit"]:focus,
input[type="button"]:focus,
.btn:focus,
.primary-cta-button:focus,
.secondary-cta-button:focus {
    outline: 3px solid #00b4d9;
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(0, 180, 217, 0.2);
}

/* Navigation focus indicators */
.navbar-main a:focus,
.menu-nav a:focus,
#overlay a:focus {
    outline: 3px solid #00b4d9;
    outline-offset: 2px;
    background-color: rgba(0, 180, 217, 0.1);
    border-radius: 4px;
}

/* Mobile burger menu focus */
#burger-menu:focus {
    outline: 3px solid #00b4d9;
    outline-offset: 3px;
    box-shadow: 0 0 0 4px rgba(0, 180, 217, 0.2);
}

/* Form field focus enhancements */
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #00b4d9;
    outline-offset: 1px;
    border-color: #00b4d9;
    box-shadow: 0 0 0 3px rgba(0, 180, 217, 0.2);
}

/* Link focus indicators */
a:focus {
    outline: 2px solid #00b4d9;
    outline-offset: 2px;
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}

/* Skip link enhancement */
.skip-link:focus {
    position: fixed;
    top: 10px;
    left: 10px;
    background: #000;
    color: #fff;
    padding: 10px 20px;
    z-index: 9999;
    text-decoration: none;
    border-radius: 4px;
    outline: 3px solid #00b4d9;
}

/* ====================================================
   TOUCH TARGET SIZES (Mobile Accessibility)
   ==================================================== */

/* Ensure minimum touch target size of 44px */
@media (max-width: 768px) {
    button,
    .btn,
    a.contact-item,
    .primary-cta-button,
    .secondary-cta-button,
    .menu-nav a,
    #burger-menu {
        min-height: 44px;
        min-width: 44px;
        padding: 12px 16px;
    }

    /* Mobile menu items */
    #overlay .menu-nav a {
        min-height: 48px;
        display: flex;
        align-items: center;
        padding: 16px 20px;
        font-size: 18px;
    }

    /* Contact form buttons */
    input[type="submit"],
    .wpcf7-submit {
        min-height: 48px;
        padding: 14px 24px;
        font-size: 16px;
    }
}

/* ====================================================
   SCREEN READER AND ARIA ENHANCEMENTS
   ==================================================== */

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

/* Enhanced loading states */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #00b4d9;
    border-radius: 50%;
    animation: loading-spin 1s linear infinite;
}

@keyframes loading-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ====================================================
   HIGH CONTRAST MODE SUPPORT
   ==================================================== */

@media (prefers-contrast: high) {
    /* Enhanced contrast for high contrast mode */
    button,
    .btn,
    .primary-cta-button {
        border: 2px solid;
    }
    
    a:focus {
        outline-width: 4px;
        background-color: yellow;
        color: black;
    }
}

/* ====================================================
   REDUCED MOTION SUPPORT
   ==================================================== */

@media (prefers-reduced-motion: reduce) {
    /* Remove animations for users who prefer reduced motion */
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms;
        animation-iteration-count: 1;
        transition-duration: 0.01ms;
        scroll-behavior: auto;
    }
    
    /* More specific selectors for reduced motion */
    .loading::after,
    .form-message,
    .hero-cta-button,
    .primary-cta-button,
    .secondary-cta-button {
        animation-duration: 0.01ms;
        transition-duration: 0.01ms;
    }
}

/* ====================================================
   KEYBOARD NAVIGATION ENHANCEMENTS
   ==================================================== */

/* Ensure keyboard navigation is visible */
body.keyboard-navigation *:focus {
    outline: 3px solid #00b4d9;
    outline-offset: 2px;
}

body.keyboard-navigation input:focus,
body.keyboard-navigation textarea:focus,
body.keyboard-navigation select:focus,
body.keyboard-navigation button:focus,
body.keyboard-navigation .btn:focus,
body.keyboard-navigation a:focus {
    outline: 3px solid #00b4d9;
    outline-offset: 2px;
}

/* Mobile menu keyboard navigation */
#overlay {
    /* Ensure proper tab order */
}

#overlay.active {
    /* Focus trap for mobile menu */
}

/* FAQ keyboard navigation */
.faq-question {
    cursor: pointer;
}

.faq-question:focus {
    outline: 2px solid #00b4d9;
    outline-offset: 2px;
    background-color: rgba(0, 180, 217, 0.1);
}

/* ====================================================
   ERROR HANDLING AND VALIDATION
   ==================================================== */

/* Form validation error states */
.form-field.error input,
.form-field.error textarea,
.wpcf7-form-control.wpcf7-not-valid {
    border-color: #dc3545;
    outline-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

.form-field.error .error-message,
.wpcf7-not-valid-tip {
    color: #dc3545;
    font-size: 14px;
    margin-top: 5px;
    display: block;
}

/* Success states */
.form-field.success input,
.form-field.success textarea {
    border-color: #28a745;
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.2);
}

/* ====================================================
   MOBILE-SPECIFIC ACCESSIBILITY
   ==================================================== */

@media (max-width: 768px) {
    /* Keep contact info visible on mobile */
    .header-topbar {
        display: block;
        padding: 8px 0;
        background: rgba(0, 180, 217, 0.05);
    }

    .header-topbar .contact-info {
        display: flex;
        justify-content: center;
        gap: 20px;
        flex-wrap: wrap;
    }

    .header-topbar .business-hours {
        display: none; /* Hide on very small screens to save space */
    }

    /* Mobile menu accessibility */
    #burger-menu {
        padding: 12px;
        border: 2px solid transparent;
        border-radius: 4px;
    }

    #burger-menu:focus {
        border-color: #00b4d9;
    }

    /* Mobile navigation improvements */
    #overlay {
        background: rgba(0, 0, 0, 0.95);
        backdrop-filter: blur(8px);
    }

    #overlay .menu-nav {
        max-height: calc(100vh - 200px);
        overflow-y: auto;
        padding: 20px;
    }

    /* Scroll accessibility */
    #overlay .menu-nav::-webkit-scrollbar {
        width: 8px;
    }

    #overlay .menu-nav::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
    }

    #overlay .menu-nav::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 4px;
    }
}

/* ====================================================
   COLOR CONTRAST IMPROVEMENTS
   ==================================================== */

/* Ensure sufficient color contrast for all text */
.text-muted,
.text-muted.small,
.text-muted.text-sm,
.small.text-muted {
    color: #666; /* Improved from default Bootstrap muted */
}

/* Link contrast improvements */
a {
    color: #0066cc;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: #004499;
    text-decoration-thickness: 2px;
}

/* Button contrast improvements */
.btn-secondary {
    background-color: #6c757d;
    border-color: #5a6268;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5a6268;
    border-color: #545b62;
}