/**
 * Accessibility Styles for AppSolutions
 * Enhances website accessibility for users with disabilities
 */

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

/* Focus styles for keyboard navigation */
:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip to main content link - visible only when focused */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    z-index: 100;
    transition: top 0.3s ease;
}

.skip-to-content:focus {
    top: 0;
}

/* Enhanced focus styles for interactive elements */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    text-decoration: underline;
}

/* High contrast focus indicator for dark backgrounds */
.navbar a:focus,
.footer-links a:focus,
.social-links a:focus,
.cta-btn:focus {
    outline: 2px solid white;
    outline-offset: 2px;
    text-decoration: underline;
}

/* Ensure sufficient color contrast for text */
.portfolio-overlay h3,
.portfolio-overlay p {
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Improved form field accessibility */
input,
select,
textarea {
    font-size: 16px; /* Prevents iOS zoom on focus */
}

/* Form labels and placeholders */
label,
::placeholder {
    color: rgba(0, 0, 0, 0.7);
}

/* Accessible form validation */
input:invalid,
select:invalid,
textarea:invalid {
    border-color: #d9534f;
}

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

/* Accessible buttons - ensure minimum touch target size */
button,
.cta-btn,
.nav-link,
.portfolio-dot,
.testimonial-dot {
    min-height: 44px;
    min-width: 44px;
}

/* Ensure text remains visible during webfont load */
html {
    font-display: swap;
}

/* Reduced motion for users who prefer it */
@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;
    }
    
    .text-reveal span {
        transform: none !important;
        opacity: 1 !important;
    }
    
    .floating {
        animation: none !important;
    }
    
    .pulse {
        animation: none !important;
        box-shadow: 0 0 0 3px rgba(44, 107, 237, 0.4);
    }
    
    .loading-bar {
        animation: none !important;
        height: 20px !important;
    }
}

/* Accessible tooltips */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 5px 10px;
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

[data-tooltip]:hover::after,
[data-tooltip]:focus::after {
    opacity: 1;
}

/* Accessible table styles */
table {
    border-collapse: collapse;
    width: 100%;
}

th {
    text-align: left;
    background-color: var(--primary-color);
    color: white;
}

th, td {
    padding: 12px;
    border: 1px solid #ddd;
}

/* Accessible image alternatives */
img {
    max-width: 100%;
    height: auto;
}

/* Ensure sufficient line height for readability */
p, li {
    line-height: 1.5;
}

/* Accessible link underlines */
a {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.nav-link,
.footer-links a,
.social-links a,
.cta-btn {
    text-decoration: none;
}

.nav-link:hover,
.footer-links a:hover,
.social-links a:hover {
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Accessible announcement region for dynamic content changes */
.live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Accessible focus management for modals and dialogs */
.modal:focus,
.dialog:focus {
    outline: none;
}

/* Accessible color scheme for dark mode preference */
@media (prefers-color-scheme: dark) {
    .portfolio-overlay {
        background: linear-gradient(to top, rgba(0, 0, 0, 0.95) 0%, rgba(0, 0, 0, 0.85) 30%, rgba(0, 0, 0, 0.1) 100%);
    }
    
    .app-features span {
        background-color: rgba(58, 123, 219, 0.9);
    }
}
