/*
Theme Name: Space Insulation
Theme URI: https://spaceinsulation.ca
Author: Space Insulation
Author URI: https://spaceinsulation.ca
Description: Custom WordPress theme for Space Insulation
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: space-insulation
*/

/* 
 * This theme uses Tailwind CSS loaded via CDN for design fidelity.
 * Custom styles are handled in the head or via specific CSS classes.
 */

/* ==========================================
   WORDPRESS MENU NAVIGATION & SUB-MENUS
   ========================================== */

/* Make the list item container relative so the sub-menu can position absolutely below it */
.menu-item-has-children {
    position: relative;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

/* Style the parent link flex alignment */
.menu-item-has-children > a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

/* Add a caret down icon using pseudo-elements */
.menu-item-has-children > a::after {
    content: "▼";
    font-size: 8px;
    margin-left: 4px;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.menu-item-has-children:hover > a::after {
    transform: rotate(180deg);
}

/* Hide the sub-menu by default and style it as a dropdown card */
.menu-item-has-children .sub-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0.25rem;
    width: 16rem; /* 256px / w-64 */
    background-color: #202e31; /* Match theme secondary dark color */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 1rem; /* rounded-2xl */
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    z-index: 50;
    backdrop-filter: blur(8px);
}

/* Show the sub-menu when hovering the parent li */
.menu-item-has-children:hover .sub-menu {
    display: block;
}

/* Style sub-menu items */
.sub-menu li {
    width: 100%;
}

.sub-menu li a {
    display: block;
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem; /* text-xs */
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.7) !important;
    transition: all 0.3s ease;
}

.sub-menu li a:hover {
    color: #83b735 !important; /* theme primary color */
}

/* Add thin border between items except first */
.sub-menu li:not(:first-child) a {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ==========================================
   RESPONSIVE MOBILE NAVIGATION SUB-MENUS
   ========================================== */
@media (max-width: 1023px) {
    .menu-item-has-children {
        padding-top: 0;
        padding-bottom: 0;
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    
    .menu-item-has-children .sub-menu {
        display: block; /* Always show sub-menu items in mobile menu, stacked nicely */
        position: static;
        width: 100%;
        background-color: transparent;
        border: none;
        box-shadow: none;
        padding-left: 1.5rem; /* pl-6 indent */
        border-left: 2px solid rgba(131, 183, 53, 0.3); /* border-l-2 border-primary/30 */
        margin-top: 0.75rem;
        margin-bottom: 0.75rem;
        border-radius: 0;
        backdrop-filter: none;
    }
    
    .menu-item-has-children .sub-menu li a {
        padding: 0.5rem 0;
        font-size: 1.5rem !important; /* text-2xl matching mobile list */
        font-weight: 700;
        color: rgba(255, 255, 255, 0.6) !important;
    }
    
    .menu-item-has-children .sub-menu li a:hover {
        color: #83b735 !important;
    }
    
    .menu-item-has-children .sub-menu li:not(:first-child) a {
        border-top: none;
    }
}
