/* NABA 2026 - Critical CSS Performance Enhancements */

/* Preloading states */
.loading {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.loaded {
    opacity: 1;
    transform: translateY(0);
}

/* Enhanced reveal animations */
[data-reveal]:not(.no-js) {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-reveal].revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animations */
[data-reveal="1"] { transition-delay: 0.1s; }
[data-reveal="2"] { transition-delay: 0.2s; }
[data-reveal="3"] { transition-delay: 0.3s; }
[data-reveal="4"] { transition-delay: 0.4s; }
[data-reveal="5"] { transition-delay: 0.5s; }

/* Performance optimizations */
.will-animate {
    will-change: transform, opacity;
}

.gpu-accelerated {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Image lazy loading */
img[data-src] {
    background: linear-gradient(90deg,
        rgba(17,24,39,0.05) 0%,
        rgba(17,24,39,0.08) 50%,
        rgba(17,24,39,0.05) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

img.loaded {
    animation: none;
    background: none;
}

/* Course images */
.course-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    border-radius: 8px 8px 0 0;
    transition: transform 0.3s ease;
}

.course-card:hover .course-img {
    transform: scale(1.05);
}

.course-image {
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
}

.course-image picture {
    display: block;
    width: 100%;
    height: 200px;
}

/* ECTS badge positioned over image */
.ects-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    z-index: 2;
}

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

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    [data-reveal],
    [data-reveal].revealed,
    .loading,
    .loaded,
    img[data-src] {
        transition: none !important;
        animation: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

/* High contrast support */
@media (prefers-contrast: high) {
    :root {
        --line: rgba(17,24,39,.3);
        --muted: #ffffff;
    }

    .card {
        border-width: 2px;
    }
}

/* Print styles */
@media print {
    .band,
    #progressBar,
    [data-reveal],
    .loading,
    img[data-src] {
        display: none !important;
    }

    .hero-visual,
    .card {
        background: white !important;
        box-shadow: none !important;
        border: 1px solid black !important;
    }
}

/* Focus management per accessibility */
.js-focus-visible :focus:not(.focus-visible) {
    outline: none;
}

.js-focus-visible .focus-visible {
    outline: 2px dashed var(--accent);
    outline-offset: 4px;
}

/* Custom scrollbar per webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--muted);
}

::-webkit-scrollbar-thumb {
    background: rgba(17,24,39,.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(17,24,39,.4);
}

/* CSS Container Queries support */
@container (max-width: 768px) {
    .hero-visual {
        width: 90%;
        height: 50%;
    }
}
