/**
 * Accessibility Fixes for CleanCollective
 * Addresses color contrast, touch targets, and other a11y issues
 */

/* ===========================================
   COLOR CONTRAST FIXES (WCAG AA Compliance)
   =========================================== */

/* Ensure all text meets 4.5:1 contrast ratio */
.low-contrast-text,
.service-feature-list li,
.feature-list li,
.includes-list li {
    color: #1a1a1a !important; /* Darker text for better contrast */
}

/* Button contrast improvements */
button,
.btn,
.cta-button {
    background-color: #044847 !important;
    color: #ffffff !important;
    font-weight: 600;
}

button:hover,
.btn:hover,
.cta-button:hover {
    background-color: #033635 !important;
}

/* Link contrast */
a {
    color: #044847;
    text-decoration: underline;
}

a:hover,
a:focus {
    color: #033635;
    text-decoration: underline;
}

/* Navigation link contrast */
nav a,
.nav-link {
    color: #1a1a1a !important;
    font-weight: 500;
}

nav a:hover,
.nav-link:hover {
    color: #044847 !important;
}

/* Footer text contrast */
footer,
#global-footer {
    color: #1a1a1a;
}

footer a,
#global-footer a {
    color: #044847;
}

footer h4,
#global-footer h4 {
    color: #044847 !important;
}

/* Light text on dark backgrounds */
.hero h1,
.hero p,
.dark-section {
    color: #ffffff !important;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ===========================================
   TOUCH TARGET SIZE (Minimum 44x44px)
   =========================================== */

/* All clickable elements (except skip-link) */
button,
.btn,
a:not(.skip-link):not(.skip-to-content),
input[type="submit"],
input[type="button"],
.tab-btn,
.accordion-toggle,
.mobile-menu-toggle {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
}

/* Navigation links */
nav a,
.nav-link,
.dropdown-item {
    min-height: 44px;
    padding: 12px 16px;
    display: inline-flex;
    align-items: center;
}

/* Mobile menu toggle specifically */
.mobile-menu-toggle,
.hamburger-menu,
button[aria-label*="menu"] {
    min-height: 48px;
    min-width: 48px;
    padding: 12px;
}

/* Form inputs */
input,
textarea,
select {
    min-height: 44px;
    padding: 12px 16px;
    font-size: 16px; /* Prevents zoom on iOS */
}

textarea {
    min-height: 120px;
}

/* Tab buttons */
.tab-btn,
.experience-tab-btn,
.service-tab {
    min-height: 44px;
    padding: 12px 24px;
}

/* ===========================================
   FOCUS INDICATORS (Keyboard Navigation)
   =========================================== */

/* Visible focus for all interactive elements */
*:focus {
    outline: 3px solid #044847;
    outline-offset: 2px;
}

button:focus,
a:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid #044847;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(4, 72, 71, 0.2);
}

/* Skip to content link - HIDDEN until focused */
.skip-to-content {
    position: absolute !important;
    top: -100px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: #044847 !important;
    color: white !important;
    padding: 12px 24px !important;
    text-decoration: none !important;
    z-index: 10000 !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.skip-to-content:focus {
    top: 10px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ===========================================
   HEADING HIERARCHY VISUAL AIDS
   =========================================== */

/* Ensure headings are properly sized and weighted */
h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h2 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.875rem;
}

h3 {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}

h4 {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.625rem;
}

h5 {
    font-size: clamp(1.125rem, 2vw, 1.25rem);
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

h6 {
    font-size: clamp(1rem, 1.5vw, 1.125rem);
    font-weight: 500;
    line-height: 1.5;
    margin-bottom: 0.5rem;
}

/* ===========================================
   FORM ACCESSIBILITY
   =========================================== */

/* Label visibility */
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1a1a1a;
}

/* Required field indicators */
input:required + label::after,
textarea:required + label::after {
    content: " *";
    color: #d32f2f;
}

/* Error states */
input:invalid,
textarea:invalid {
    border-color: #d32f2f;
}

input:invalid:focus,
textarea:invalid:focus {
    outline-color: #d32f2f;
    box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.2);
}

/* Success states */
input:valid,
textarea:valid {
    border-color: #388e3c;
}

/* ===========================================
   MOBILE ACCESSIBILITY
   =========================================== */

@media (max-width: 767px) {
    /* Increase touch targets on mobile (except skip-link) */
    button,
    .btn,
    a:not(.skip-link):not(.skip-to-content),
    input[type="submit"] {
        min-height: 48px;
        min-width: 48px;
        padding: 14px 28px;
    }

    /* Ensure text is readable on small screens */
    body {
        font-size: 16px;
        line-height: 1.6;
    }

    /* Navigation spacing on mobile */
    nav a,
    .nav-link {
        min-height: 48px;
        padding: 14px 20px;
    }
}

/* ===========================================
   REDUCED MOTION (Respect User Preferences)
   =========================================== */

@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) {
    /* Increase contrast in high contrast mode */
    body {
        background-color: #ffffff;
        color: #000000;
    }

    button,
    .btn {
        background-color: #000000;
        color: #ffffff;
        border: 2px solid #000000;
    }

    a {
        color: #0000ff;
        text-decoration: underline;
    }

    a:visited {
        color: #800080;
    }
}

/* ===========================================
   SCREEN READER UTILITIES
   =========================================== */

/* Visually hidden but accessible to screen readers */
.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-width: 0;
}

/* Skip link for keyboard users - HIDDEN until focused */
.skip-link {
    position: absolute !important;
    top: -100px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: #044847 !important;
    color: white !important;
    padding: 12px 24px !important;
    text-decoration: none !important;
    z-index: 10000 !important;
    font-weight: 600 !important;
    opacity: 0 !important;
    pointer-events: none !important;
    transition: top 0.3s ease, opacity 0.3s ease !important;
}

.skip-link:focus {
    top: 10px !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

/* ===========================================
   SPECIFIC PAGE FIXES
   =========================================== */

/* Review cards - ensure proper contrast */
.review-card,
.testimonial-card {
    background-color: #ffffff;
    color: #1a1a1a;
    border: 1px solid #e0e0e0;
}

.review-author,
.testimonial-author {
    color: #044847;
    font-weight: 600;
}

/* Service cards */
.service-card,
.feature-card {
    background-color: #ffffff;
    color: #1a1a1a;
}

.service-card h3,
.feature-card h3 {
    color: #044847;
}

/* CTA sections */
.cta-section {
    background-color: #044847;
    color: #ffffff;
}

.cta-section h2,
.cta-section p {
    color: #ffffff !important;
}

/* ===========================================
   PRINT ACCESSIBILITY
   =========================================== */

@media print {
    /* Ensure good contrast when printing */
    * {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a,
    a:visited {
        text-decoration: underline;
    }

    /* Show URLs for links */
    a[href]::after {
        content: " (" attr(href) ")";
    }

    /* Hide navigation and other non-essential elements */
    nav,
    .no-print,
    footer {
        display: none;
    }
}
