/* Performance Optimizations */

/* Critical CSS optimizations */
* {
    box-sizing: border-box;
}

/* Optimize font loading */
@font-face {
    font-family: 'Syne';
    font-display: swap;
    src: url('https://fonts.googleapis.com/css2?family=Syne:wght@400..800&display=swap') format('woff2');
    font-weight: 400 800;
}

/* Reduce layout shifts */
img {
    height: auto;
    max-width: 100%;
}

/* Optimize animations */
.loading-spinner {
    will-change: transform;
    transform: translateZ(0);
}

.btn,
.gallery__item img,
.social-link {
    will-change: transform;
    transform: translateZ(0);
}

/* Optimize scrolling */
.gallery-modal__content,
.review-modal__content {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Reduce paint operations */
.hero__background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 1;
}

/* Optimize transforms */
.mobile-menu {
    transform: translate3d(-50%, -50%, 0) scale(0.8);
    backface-visibility: hidden;
}

.mobile-menu.active {
    transform: translate3d(-50%, -50%, 0) scale(1);
}

/* Optimize opacity changes */
.loading-screen,
.gallery-modal,
.review-modal {
    will-change: opacity, visibility;
}

/* Contain layout changes */
.hero,
.section {
    contain: layout style;
}

/* Optimize image rendering */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Reduce reflows */
.form-input:focus {
    will-change: border-color;
}

/* Optimize hover states */
@media (hover: hover) {
    .btn:hover,
    .gallery__item:hover img,
    .social-link:hover {
        will-change: transform;
    }
}

/* Critical path optimization */
.hero {
    content-visibility: auto;
    contain-intrinsic-size: 100vh;
}

.section:not(.hero) {
    content-visibility: auto;
    contain-intrinsic-size: 500px;
}

/* Optimize text rendering */
body {
    text-rendering: optimizeSpeed;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Reduce composite layers */
.header {
    will-change: background-color;
    transform: translateZ(0);
}

/* Optimize modal animations */
.gallery-modal__content,
.review-modal__content {
    will-change: transform;
    transform: translateZ(0);
}

/* Preload critical resources */
/* .hero__background img {
    loading: eager;
    fetchpriority: high;
}

/* Lazy load non-critical images */
/* .gallery__item img,
.event__image img {
    loading: lazy;
    decoding: async;
}  */

/* Optimize form performance */
.form-input {
    will-change: border-color;
}

/* Reduce memory usage */
@media (max-width: 767px) {
    .gallery__grid {
        contain: layout;
    }
}

/* Optimize scroll performance */
.mobile-menu-overlay {
    will-change: opacity;
    transform: translateZ(0);
}

/* Reduce JavaScript execution time */
.btn[disabled] {
    pointer-events: none;
    opacity: 0.6;
}

/* Optimize background images */
.hero__background {
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Reduce paint complexity */
.review__rating {
    contain: layout style;
}

/* Optimize table layouts */
.footer__content {
    table-layout: fixed;
}

/* Reduce style recalculation */
.mobile-menu__nav {
    contain: layout style;
}

/* Optimize flexbox performance */
.booking__form {
    contain: layout;
}

/* Critical resource hints */
.preload-font {
    font-display: swap;
}

/* Optimize CSS containment */
.event {
    contain: layout style;
}

.review {
    contain: layout style;
}

.booking {
    contain: layout style;
}

/* Reduce layout thrashing */
.gallery__item {
    contain: layout;
}

/* Optimize animation performance */
@keyframes optimizedFadeInUp {
    from {
        opacity: 0;
        transform: translate3d(0, 30px, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.fade-in-up {
    animation: optimizedFadeInUp 0.6s ease-out forwards;
    will-change: transform, opacity;
}

/* Memory optimization */
.gallery-modal:not(.active),
.review-modal:not(.active) {
    display: none;
}

/* Optimize critical rendering path */
.above-fold {
    contain: layout style paint;
}

/* Reduce composite operations */
.hero__card {
    will-change: transform;
    transform: translateZ(0);
}