/* ===== ACCESSIBILITY & UX ENHANCEMENTS ===== */
/* Following WCAG 2.1 AA guidelines and Google's Material Design accessibility standards */

/* ===== FOCUS MANAGEMENT ===== */
/* Enhanced focus indicators for keyboard navigation */
*:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* Skip to main content link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--color-primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: 9999;
    font-weight: 600;
}

.skip-link:focus {
    top: 6px;
}

/* ===== REDUCED MOTION SUPPORT ===== */
/* Respect user's motion 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) {
    :root {
        --color-primary: #0000ff;
        --color-gray-800: #000000;
        --color-gray-600: #333333;
    }
    
    .tool-card,
    .feature-card {
        border: 2px solid var(--color-gray-800);
    }
}

/* ===== DARK MODE SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --color-primary: #60a5fa;
        --color-primary-hover: #3b82f6;
        --color-gray-50: #111827;
        --color-gray-100: #1f2937;
        --color-gray-200: #374151;
        --color-gray-800: #f9fafb;
        --color-gray-600: #d1d5db;
    }
    
    body {
        background-color: var(--color-gray-50);
        color: var(--color-gray-800);
    }
    
    .header {
        background-color: rgba(31, 41, 55, 0.95);
        border-bottom-color: var(--color-gray-200);
    }
    
    .tool-card,
    .feature-card {
        background-color: var(--color-gray-100);
        border-color: var(--color-gray-200);
    }
}

/* ===== TOUCH TARGET OPTIMIZATION ===== */
/* Ensure all interactive elements meet 44px minimum touch target */
button,
.tool-link,
.nav-link,
input,
select,
textarea {
    min-height: 44px;
    min-width: 44px;
}

/* ===== LOADING STATES ===== */
/* Skeleton loading for better perceived performance */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== ERROR STATES ===== */
.error-message {
    color: var(--color-error);
    font-size: 0.875rem;
    margin-top: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.error-message::before {
    content: "⚠️";
    font-size: 1rem;
}

/* ===== SUCCESS STATES ===== */
.success-message {
    color: var(--color-success);
    font-size: 0.875rem;
    margin-top: var(--space-2);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.success-message::before {
    content: "✅";
    font-size: 1rem;
}

/* ===== FORM ENHANCEMENTS ===== */
/* Better form styling for accessibility */
input,
select,
textarea {
    border: 2px solid var(--color-gray-300);
    border-radius: var(--radius-md);
    padding: var(--space-3) var(--space-4);
    font-size: 1rem;
    transition: var(--transition-normal);
    background-color: white;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input:invalid,
select:invalid,
textarea:invalid {
    border-color: var(--color-error);
}

/* ===== 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;
}

/* ===== PRINT STYLES ===== */
@media print {
    .header,
    .footer,
    .tool-link,
    button {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: black;
        background: white;
    }
    
    .tool-card,
    .feature-card {
        border: 1px solid black;
        page-break-inside: avoid;
        margin-bottom: 1rem;
    }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* GPU acceleration for smooth animations */
.tool-card,
.feature-card,
.tool-link {
    will-change: transform;
    transform: translateZ(0);
}

/* Optimize images for better loading */
img {
    max-width: 100%;
    height: auto;
    loading: lazy;
}





/* ===== RESPONSIVE TYPOGRAPHY ===== */
/* Fluid typography for better readability across devices */
@media (min-width: 320px) and (max-width: 1200px) {
    h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
    h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
    h3 { font-size: clamp(1.25rem, 3vw, 1.5rem); }
    
    body {
        font-size: clamp(0.875rem, 2.5vw, 1rem);
    }
}
