/**
 * Accessibility Improvements for Barbara Joyce Abang Website
 * Ensures WCAG 2.1 AA compliance and better usability for assistive technologies
 */

/* Skip Navigation Links */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #462549;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
    z-index: 9999;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 6px;
    outline: 3px solid #e28647;
    outline-offset: 2px;
}

/* Enhanced Focus Indicators */
*:focus {
    outline: 3px solid #462549 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 6px rgba(70, 37, 73, 0.2) !important;
}

/* High Contrast Focus for Interactive Elements */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 3px solid #462549 !important;
    outline-offset: 2px !important;
    background-color: rgba(70, 37, 73, 0.05) !important;
}

/* Screen Reader Only Text */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.sr-only-focusable:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    padding: inherit !important;
    margin: inherit !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* Improved Color Contrast */
/* Brown color improved for better contrast */
.be_kind-brown,
.text-brown {
    color: #b85a1a !important; /* Improved from #e28647 for better contrast */
}

/* Ensure sufficient contrast for muted text */
.text-muted {
    color: #495057 !important; /* Improved from #6c757d */
}

/* Button Accessibility */
button,
.btn {
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
}

button:focus,
.btn:focus {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2), 0 0 0 3px rgba(70, 37, 73, 0.3) !important;
}

button:disabled,
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* Form Field Accessibility */
.form-control:focus {
    border-color: #462549 !important;
    box-shadow: 0 0 0 0.2rem rgba(70, 37, 73, 0.25) !important;
}

.form-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #212529;
}

/* Required Field Indicators */
.required-field::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* Error Message Styling */
.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

.success-message {
    color: #198754;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: block;
}

/* Loading States */
.loading {
    cursor: wait;
}

.loading::after {
    content: "";
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-left: 8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #462549;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Keyboard Navigation for Dropdown */
.dropdown-menu a:focus {
    background-color: #462549;
    color: white;
    outline: none;
}

/* Gallery Accessibility */
.lightbox-button {
    background: none;
    border: none;
    cursor: pointer;
    display: block;
    width: 100%;
}

.lightbox-button:focus {
    outline: 3px solid #462549;
    outline-offset: 2px;
}

.lightbox-button img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.lightbox-button:hover img,
.lightbox-button:focus img {
    transform: scale(1.05);
}

/* Navbar Accessibility */
.navbar-toggler:focus {
    box-shadow: 0 0 0 3px rgba(70, 37, 73, 0.3);
}

.navbar-nav .nav-link:focus {
    background-color: rgba(70, 37, 73, 0.1);
    border-radius: 4px;
}

/* Card Accessibility */
.card:focus-within {
    box-shadow: 0 4px 12px rgba(70, 37, 73, 0.15);
    transform: translateY(-2px);
}

/* Pagination Accessibility */
.pagination .page-link:focus {
    box-shadow: 0 0 0 3px rgba(70, 37, 73, 0.3);
}

/* Social Media Links */
.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.social-link:focus {
    transform: scale(1.1);
    background-color: rgba(70, 37, 73, 0.1);
}

/* High Contrast Mode (optional enhancement) */
@media (prefers-contrast: high) {
    .be_kind-purple {
        color: #000000 !important;
    }
    
    .be_kind-brown {
        color: #000000 !important;
    }
    
    .bg-light {
        background-color: #ffffff !important;
        border: 2px solid #000000 !important;
    }
}

/* Reduced Motion for Users with Vestibular Disorders */
@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;
    }
}

/* Print Accessibility */
@media print {
    .skip-link,
    .navbar,
    .btn,
    .social-links {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
        color: #000000;
        background: #ffffff;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
        color: #000000;
    }
    
    img {
        max-width: 100% !important;
        page-break-inside: avoid;
    }
}

/* Touch Target Accessibility (minimum 44px) */
@media (pointer: coarse) {
    .btn,
    .nav-link,
    .dropdown-item,
    .pagination .page-link {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 12px;
    }
}