/*------------------------------------------------------------------
* Project:        NTC Travels & Dreams
* Description:    Accessibility and Performance Enhancements
* Updated:        February 2026
-------------------------------------------------------------------*/

/* Skip to Content Link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #141d40;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
    border-radius: 0 0 4px 0;
    font-weight: bold;
}

.skip-to-content:focus {
    top: 0;
    outline: 3px solid #ffa500;
    outline-offset: 2px;
}

/* Focus Visible Enhancement */
*:focus-visible {
    outline: 3px solid #ffa500 !important;
    outline-offset: 2px !important;
}

/* Reduced Motion for Accessibility */
@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) {
    body {
        border: 2px solid currentColor;
    }
    
    a {
        text-decoration: underline;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    /* Add dark mode styles if needed */
}

/* Ensure minimum tap target size (48x48px) for mobile */
@media (max-width: 768px) {
    a, button, .btn {
        min-height: 48px;
        min-width: 48px;
        padding: 12px;
    }
}

/* 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-width: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Lazy Loading Placeholder */
img[loading="lazy"] {
    
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

img[loading="lazy"]:not([src]) {
    opacity: 0;
}

/* Performance Optimization - Reduce Repaints */
.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* Print Styles for Better Accessibility */
@media print {
    .no-print {
        display: none !important;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    abbr[title]:after {
        content: " (" attr(title) ")";
    }
}

/* Focus Trapping for Modals */
.modal-open {
    overflow: hidden;
}

.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

/* Loading States */
.loading {
    pointer-events: none;
    opacity: 0.6;
    cursor: wait;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
}

@keyframes spinner {
    to {
        transform: rotate(360deg);
    }
}

/* Content Visibility for Performance */
.lazy-content {
    content-visibility: auto;
    contain-intrinsic-size: 0 500px;
}
