/*
Theme Name: Avada Child
Description: Child theme for Avada theme
Author: ThemeFusion
Author URI: https://theme-fusion.com
Template: Avada
Version: 1.0.0
Text Domain:  Avada
*/

/* Fix logo display - prevent zooming and maintain aspect ratio */
.fusion-logo img,
.fusion-logo a img,
.fusion-sticky-logo img,
.fusion-mobile-logo img,
.fusion-standard-logo img {
    width: auto !important;
    height: auto !important;
    max-width: 300px !important;  /* Reasonable max width for logo */
    max-height: 65px !important;   /* Maintain proper height */
    object-fit: contain !important;
    object-position: left center !important;
}

/* Ensure logo container doesn't crop the image */
.fusion-logo,
.fusion-logo a,
.fusion-sticky-logo,
.fusion-mobile-logo,
.fusion-standard-logo {
    display: inline-block !important;
    overflow: visible !important;
    max-width: 300px !important;
    height: auto !important;
}

/* Override any inline styles */
.fusion-logo img[style*="resize"] {
    width: auto !important;
    height: auto !important;
    max-height: 65px !important;
}

/* Mobile logo fix */
@media only screen and (max-width: 1024px) {
    .fusion-mobile-logo img,
    .fusion-logo img {
        max-height: 50px !important;
        max-width: 200px !important;
    }
}

/* =============================================================================
   PERFORMANCE OPTIMIZATIONS
   ============================================================================= */

/* Improve font loading performance */
@font-face {
    font-display: swap;
}

/* Optimize critical above-the-fold rendering */
.fusion-header-wrapper {
    contain: layout style;
}

.fusion-builder-container {
    contain: layout;
}

/* Improve image loading performance */
img {
    height: auto;
    max-width: 100%;
}

/* WooCommerce product images - ensure they load properly */
.woocommerce-product-gallery img,
.woocommerce-product-gallery__image img,
.single-product .images img,
.product .images img {
    opacity: 1 !important;
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    transition: none !important;
}

/* Fix WooCommerce gallery wrapper */
.woocommerce-product-gallery,
.woocommerce-product-gallery__wrapper,
.woocommerce-product-gallery__image {
    opacity: 1 !important;
    display: block !important;
}

/* Avada-specific WooCommerce fixes */
.fusion-woocommerce-single-product .images img,
.fusion-product-images img,
.avada-woocommerce .product-images img {
    opacity: 1 !important;
    visibility: visible !important;
    display: block !important;
}

/* Ensure zoom functionality still works */
.woocommerce-product-gallery__trigger {
    display: block !important;
    opacity: 1 !important;
}

/* Lazy loading placeholder - but not for WooCommerce */
img[loading="lazy"]:not(.woocommerce-product-gallery img) {
    opacity: 0;
    transition: opacity 0.3s;
}

img[loading="lazy"].loaded:not(.woocommerce-product-gallery img) {
    opacity: 1;
}

/* Critical layout styles for above-the-fold content */
.fusion-page-title-bar {
    display: block;
    position: relative;
}

.fusion-breadcrumbs {
    contain: layout style;
}

/* Optimize buttons and interactive elements */
.fusion-button,
button,
input[type="submit"] {
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Prevent layout shifts */
.fusion-builder-row {
    min-height: 1px;
}

/* Optimize flexbox containers */
.fusion-flex-container {
    display: flex;
    align-items: center;
}

/* Mobile-first responsive design */
@media (max-width: 768px) {
    .fusion-builder-container {
        padding: 0 15px;
    }
    
    .fusion-page-title-bar {
        min-height: 80px;
    }
}

/* =============================================================================
   LCP OPTIMIZATION - CONTENT VISIBILITY
   ============================================================================= */

/* Use content-visibility for better LCP by skipping below-fold rendering */
.fusion-footer-wrapper {
    content-visibility: auto;
    contain-intrinsic-size: 400px;
}

.fusion-builder-row:not(:first-child) {
    content-visibility: auto;
    contain-intrinsic-size: 200px;
}

/* Optimize image containers for better LCP */
.fusion-imageframe,
.woocommerce-product-gallery {
    contain: layout style;
}

/* Prevent layout shifts for responsive images */
picture img,
img[srcset] {
    height: auto;
    max-width: 100%;
}

/* Enhanced WebP support styling */
picture {
    display: block;
    width: 100%;
}

picture img {
    display: block;
    width: 100%;
    height: auto;
}

/* Optimize critical above-the-fold images */
.fusion-logo img[fetchpriority="high"],
.woocommerce-product-gallery img[fetchpriority="high"] {
    will-change: auto;
    transform: translateZ(0);
}