/* ==========================================================================
   HFL Site Enhancements CSS
   Fixes: hover states, hero banner, trust statements, midpage banners,
          product images, and general visual polish.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. HOVER STATES - All clickable elements get pointer cursor + feedback
   -------------------------------------------------------------------------- */

a,
button,
[role="button"],
[onclick],
input[type="submit"],
input[type="button"],
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce .product a,
summary,
label[for],
select,
.mega-menu-link,
[data-newsletter-close],
.add_to_cart_button,
.product_type_simple,
.product_type_variable {
    cursor: pointer !important;
}

/* Visual feedback on hover for links and buttons */
a:hover,
button:hover,
[role="button"]:hover {
    transition: opacity 0.2s ease, color 0.2s ease, background-color 0.2s ease;
}

/* Navigation buttons - ensure pointer and hover feedback */
nav button,
header button,
.navigation button,
[class*="nav"] button {
    cursor: pointer !important;
}

nav button:hover,
header button:hover {
    opacity: 0.8;
}

/* Product cards - hover lift effect */
.product:hover,
.woocommerce ul.products li.product:hover {
    transform: translateY(-2px);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Add-to-cart and "Select Options" buttons */
.add_to_cart_button:hover,
.product_type_variable:hover,
a.button:hover {
    opacity: 0.85;
    transition: opacity 0.2s ease;
}

/* Navigation menu items with dropdowns */
[class*="mega-menu"] > a:hover,
[class*="menu-item"] > a:hover {
    opacity: 0.8;
}

/* --------------------------------------------------------------------------
   2. HERO BANNER - Image must display as cover, filling the full section
   -------------------------------------------------------------------------- */

/*
 * The fiora_hero widget renders an <img> with Tailwind `w-full h-full object-cover`.
 * Problem: `h-full` doesn't override the image's intrinsic aspect ratio when the
 * image is `display: block`.  The image calculates its height from width, ignoring
 * the 100% height rule.  Fix: make the image absolutely positioned so it stretches
 * to fill its inset-0 parent instead of sizing by intrinsic ratio.
 */
.elementor-widget-fiora_hero .animate-hero-fade-in img,
.elementor-widget-fiora_hero [class*="inset-0"] > img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center top !important;
}

/* Ensure the image parent is a positioned container */
.elementor-widget-fiora_hero .animate-hero-fade-in {
    position: absolute;
    inset: 0;
}

/* Mobile hero adjustments */
@media (max-width: 767px) {
    /* Scale hero heading for mobile readability */
    .elementor-widget-fiora_hero h1 {
        font-size: clamp(2rem, 8vw, 3.5rem) !important;
        line-height: 1.1 !important;
    }

    /* Ensure CTA buttons wrap properly on small screens */
    .elementor-widget-fiora_hero .flex.gap-4 {
        flex-wrap: wrap;
    }
}

/* Tablet hero adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .elementor-widget-fiora_hero h1 {
        font-size: clamp(2.5rem, 5vw, 4rem) !important;
    }
}

/* --------------------------------------------------------------------------
   3. TRUST STATEMENTS - Center and match product-page style
   -------------------------------------------------------------------------- */

/* Center the trust section content */
.home [class*="trust"],
.home [data-id] .elementor-widget-icon-box,
.home .elementor-icon-box-wrapper {
    text-align: center;
}

.home .elementor-icon-box-wrapper .elementor-icon-box-content {
    text-align: center;
}

/* Icon + main phrase + smaller text pattern */
.home .elementor-icon-box-icon {
    margin-bottom: 12px;
}

.home .elementor-icon-box-title {
    font-weight: 700;
    margin-bottom: 6px;
}

.home .elementor-icon-box-description {
    font-size: 0.9em;
    opacity: 0.85;
}

/* Ensure trust/review cards are evenly spaced */
@media (min-width: 768px) {
    .home .elementor-section .elementor-row,
    .home .elementor-section .elementor-container {
        align-items: stretch;
    }
}

/* --------------------------------------------------------------------------
   4. MIDPAGE BANNERS - Responsive text legibility
   -------------------------------------------------------------------------- */

/* Ensure banner text is readable over images */
.home .elementor-section[data-settings*="background"] .elementor-widget-heading h2,
.home .elementor-section[data-settings*="background"] .elementor-widget-heading h3,
.home .elementor-section[data-settings*="background"] .elementor-widget-text-editor {
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Mobile banner text sizing */
@media (max-width: 767px) {
    .home .elementor-section[data-settings*="background"] h2 {
        font-size: clamp(1.5rem, 6vw, 2.5rem);
        line-height: 1.2;
    }

    .home .elementor-section[data-settings*="background"] p,
    .home .elementor-section[data-settings*="background"] .elementor-widget-text-editor {
        font-size: clamp(0.875rem, 3.5vw, 1.125rem);
        line-height: 1.4;
    }

    /* Add darker overlay for mobile legibility */
    .home .elementor-section[data-settings*="background"]::before {
        content: "";
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.15);
        pointer-events: none;
        z-index: 0;
    }

    .home .elementor-section[data-settings*="background"] > .elementor-container {
        position: relative;
        z-index: 1;
    }
}

/* --------------------------------------------------------------------------
   5. PRODUCT IMAGES - Fallback for broken images
   -------------------------------------------------------------------------- */

/* Prevent broken images from showing the default broken icon */
.woocommerce ul.products li.product img,
.wc-block-grid__product-image img {
    min-height: 200px;
    object-fit: cover;
    background-color: #f5f5f5;
}

/* --------------------------------------------------------------------------
   6. INFINITE SCROLL / LOAD MORE - Prevent layout shifts
   -------------------------------------------------------------------------- */

/* Stabilize grid during content load to prevent page jumps */
.woocommerce ul.products {
    min-height: 400px;
}

.woocommerce ul.products li.product {
    contain: layout style;
}

/* Prevent layout shift when new products are appended */
.berocket_lmp_next_page,
[class*="load-more"] {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --------------------------------------------------------------------------
   7. NEWSLETTER POPUP - Ensure proper display
   -------------------------------------------------------------------------- */

/* Make popup backdrop properly cover the page */
[data-newsletter-popup] {
    transition: opacity 0.3s ease;
}

[data-newsletter-popup].hidden {
    display: none !important;
}

[data-newsletter-popup].visible {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Success state styling */
[data-newsletter-success]:not(.hidden) {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* --------------------------------------------------------------------------
   8. GENERAL POLISH
   -------------------------------------------------------------------------- */

/* Smooth transitions site-wide */
a, button, input[type="submit"] {
    transition: color 0.2s ease, background-color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

/* Ensure all interactive elements have focus styles for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #1d5a74;
    outline-offset: 2px;
}
