/*
Theme Name:        Shoptimizer Child Theme
Theme URI:         
Description:       Child theme of Shoptimizer
Author:            CommerceGurus
Author URI:        
Template:          shoptimizer
Version:           1.2.2
License:           GNU General Public License v2 or later
License URI:       http://www.gnu.org/licenses/gpl-2.0.html
*/

/* ---------------------------------------------------------------------
 * A. EXISTING CHILD-THEME TWEAKS
 * ------------------------------------------------------------------ */

/* Shoptimizer mega-menu: make 3-column layouts use the whole row */
@media (min-width: 992px) {                /* desktop only */
    /* 1. Let the mega-menu container itself go edge-to-edge */
    .main-navigation .menu-item.full-width > .sub-menu-wrapper > .container {
        max-width: none;                   /* remove 1200 px cap */
        width: 100%;
        padding-left: 0;
        padding-right: 0;
    }

    /* 2. Turn the 3-col sub-menu into a flexible grid */
    .main-navigation .sub-menu.col-3 {
        display: grid;                     /* ditch the old floats */
        grid-template-columns: repeat(3, 1fr);
        column-gap: 2rem;                  /* tweak to taste */
    }
    .main-navigation .sub-menu.col-3 > li {
        float: none;                       /* disable legacy float */
        width: auto;                       /* grid takes over */
    }
}

/* Stack everything again on tablets/phones */
@media (max-width: 991px) {
    .main-navigation .sub-menu.col-3 {
        grid-template-columns: 1fr;
    }
}

/* Shoptimizer – uppercase every submenu item in the primary (main) menu */
#site-navigation .sub-menu a {              /* adjust selector if your nav ID differs */
    text-transform: uppercase;
}

/* ---------------------------------------------------------------------
 * B. MERGED “ADDITIONAL CSS” FROM CUSTOMIZER
 * ------------------------------------------------------------------ */

/* -----------------------------------------------------------
 * 1. Fix for RedNao Custom Fields overflowing the summary column
 * ----------------------------------------------------------- */
.single-product .summary .RNAddToCartContainer,
.single-product .summary .rnColumnContainer {
    box-sizing: border-box !important;
    max-width: 100% !important;
    width: 100% !important;
    min-width: 0 !important;   /* Prevents a minimum width from causing overflow */
}

/* -----------------------------------------------------------
 * 2. Category grid thumbnails – remove grey frame & force square crop
 * ----------------------------------------------------------- */
ul.products.elementor-grid li.product-category .cat-image-wrapper {
    position: relative;
    aspect-ratio: 1 / 1;       /* keep the wrapper perfectly square in modern browsers */
    overflow: hidden;          /* crop anything that sticks out */
}

ul.products.elementor-grid li.product-category .cat-image-wrapper img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;         /* centre-crop so nothing distorts */
    border: 0 !important;      /* nuke Shoptimizer’s default #eee outline */
    background: none !important;
    box-shadow: none !important;
}

/* (Optional fallback for very old browsers without aspect-ratio:)
ul.products.elementor-grid li.product-category .cat-image-wrapper::before {
    content: "";
    float: left;
    padding-top: 100%;
}
*/

/* -----------------------------------------------------------
 * 3. Extra kill-switch: remove border/background from the link
 *    that wraps each category thumbnail
 * ----------------------------------------------------------- */
ul.products.elementor-grid li.product-category a,
ul.products.elementor-grid li.product-category {
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}
