/* ===================================
   Performance Optimization CSS
   Fixes for Core Web Vitals
   =================================== */

/* Fix CLS for Revolution Slider - Reserve space */
.rev_slider_wrapper,
.tp-banner-container,
#rev_slider_1_1_wrapper {
    min-height: 700px !important;
    aspect-ratio: 1920 / 700;
}

@media (max-width: 768px) {
    .rev_slider_wrapper,
    .tp-banner-container,
    #rev_slider_1_1_wrapper {
        min-height: 400px !important;
        aspect-ratio: 768 / 400;
    }
}

/* Fix CLS for slider images */
.rev_slider .tp-rs-img,
.rev_slider .rev-slidebg {
    width: 100%;
    height: auto;
    aspect-ratio: 1920 / 700;
    object-fit: cover;
}

/* Preload critical images - prevent layout shift */
img[fetchpriority="high"] {
    content-visibility: auto;
}

/* Fix font loading to prevent CLS */
@font-face {
    font-display: swap;
}

/* Optimize Google Fonts loading */
.wf-loading body,
.wf-loading h1,
.wf-loading h2,
.wf-loading h3,
.wf-loading h4,
.wf-loading h5,
.wf-loading h6 {
    visibility: hidden;
}

.wf-active body,
.wf-active h1,
.wf-active h2,
.wf-active h3,
.wf-active h4,
.wf-active h5,
.wf-active h6,
.wf-inactive body,
.wf-inactive h1,
.wf-inactive h2,
.wf-inactive h3,
.wf-inactive h4,
.wf-inactive h5,
.wf-inactive h6 {
    visibility: visible;
}

/* Reserve space for images to prevent CLS */
img:not([width]):not([height]) {
    aspect-ratio: attr(width) / attr(height);
}

/* Fix layout shift from lazy-loaded images */
img[data-lazyload] {
    min-height: 200px;
    background-color: #f0f0f0;
}

/* Slider container stability */
.slider-section,
.banner-wrapper {
    contain: layout;
}

/* Reduce repaints for better performance */
.header-main,
.topbar {
    will-change: transform;
    transform: translateZ(0);
}

/* Optimize animations */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
