/* 
    MerchStudio version 0.01 - Core CSS File
    Copyright (c) 2025 Michael Lewis White and MerchStudio Inc.
    MerchStudio Client Navigation Menu CSS
    @version client/css/merch_menu.css - 0.01 - 05-14-2025 - totaltec
    
    # included by client/css_load.tpl
*/

/* Sentinel for IntersectionObserver - helps detect when the menu is sticky */
#mm_sentinel {
    height: 1px;
    margin-bottom: -1px;
}

/* Logo Icon Container - Initially hidden on desktop non-sticky */
#mm_logo_icon {
    margin: 5px 0;
    opacity: 0;
    transform: translateX(-30px);
    width: 0; /* Start with no width, will expand */
    height: 40px;
    overflow: hidden; /* Clip content during width animation */
    flex-shrink: 0;
    transition: opacity 0.3s ease-in-out,
                transform 0.3s ease-in-out, 
                width 0.3s ease-in-out;
}
/*#mm_logo_icon a {*/
/*    display: block;*/
/*    width: 100%;*/
/*    height: 100%;*/
/*}*/
#mm_logo_icon .merch_icon,
#mm_logo_icon svg {
    display: block;
    height: 100%; /* Fill height of #mm_logo_icon */
    width: auto;  /* Maintain aspect ratio */
}

/* Hamburger Button - Hidden on desktop */
#mm_hamburger {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: inherit; /* Inherit color from nav for the SVG */
}
#mm_hamburger .merch_icon {
    width: 36px;
    height: 36px;
    fill: currentColor;
}

/* Main Menu Navigation container */
#merch_menu {
    background-color: var(--base);
    border-bottom: 1px solid var(--line);
    padding: 0 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color 0.3s ease-out,
                border-color 0.3s ease-out,
                padding 0.3s ease-out;
}

/* When STICKY: Show logo and cart, adjust their width and transform */
#merch_menu.sticky {
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

#merch_menu.sticky #mm_logo_icon {
    opacity: 1;
    transform: translateX(0);
    width: 53px; /* Animate to actual logo width */
    margin-right: 10px; /* Space after logo, before list_wrap */
}

/* mm_list: Main Menu unordered List */
.mm_list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    flex-wrap: wrap; /* Allow wrapping on smaller screens */
}

/* mm_item: Main Menu List Item */
.mm_item {
    position: relative; /* For positioning dropdowns */
    display: inline-block; /* Keeps items in a row */
}

/* Styling for links and buttons in the menu */
/* mm_link: Main Menu static Link */
/* mm_button: Main Menu toggle Button */
.mm_link,
.mm_link:link,
.mm_link:visited,
.mm_button {
    display: block;
    padding: 15px 20px; /* Generous clickable area */
    text-decoration: none;
    color: var(--text);
    font-family: 'Manrope', sans-serif; /* Body font */
    font-weight: bold; /* Make nav items stand out */
    font-size: 1em; /* Standard text size */
    background-color: transparent;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.3s ease-out,
                background-color 0.3s ease-out;
}

.mm_link:hover,
.mm_button:hover,
.mm_link:focus,
.mm_button:focus {
    color: var(--link_hover);
    background-color: var(--hover);
    outline: none; /* We will use other focus indicators */
}

/* Active state for button when its panel is open */
.mm_button[aria-expanded="true"] {
    background-color: var(--subtle); /* Indicate open state */
    color: var(--accent);
}

/* mm_chevron: Chevron icon for dropdowns */
.mm_chevron {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 8px;
    vertical-align: middle;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 5px solid currentColor; /* Inherits button text color */
    transition: transform 0.3s ease-out;
}

.mm_button[aria-expanded="true"] .mm_chevron {
    transform: rotate(180deg);
}

/* Common panel styling (dropdown and mega) */
/* mm_dropdown_panel: Panel for standard dropdowns */
/* mm_mega_panel: Panel for mega menus */
.mm_dropdown_panel,
.mm_mega_panel {
    position: absolute;
    top: 100%;
    background-color: var(--bg);
    border: 1px solid var(--line);
    border-top: none;
    box-shadow: 0 4px 8px var(--shadow);
    z-index: 90;
    min-width: 220px;
    padding: 10px;
    visibility: hidden; /* Hidden by default */
    opacity: 0;
    transform: translateY(10px); /* Slight animation for slide-down */
    transition: opacity 0.2s ease-out,
                visibility 0.2s ease-out,
                transform 0.2s ease-out,
                background-color 0.3s ease-out,
                border-color 0.3s ease-out,
                box-shadow 0.3s ease-out;
}

/* Default orientation for mega panels if no specific class,
   or explicitly for .orient_left.
   Dropdowns are assumed to always be left-aligned by default. */
.mm_mega_panel.orient_left,
.mm_dropdown_panel { /* Applying default left-align to dropdowns too */
    left: 0;
    right: auto; /* Be explicit */
}

.mm_mega_panel.orient_right {
    left: auto; /* Remove any left positioning */
    right: 0;   /* Align to the right of the parent .mm_item */
}

.mm_mega_panel.orient_middle {
    left: 50%;
    /* Temporarily remove translateY from base to avoid conflict,
       will re-add it in the .open state for this specific orientation */
    transform: translateX(-50%);
}

.mm_dropdown_panel.open,
.mm_mega_panel.orient_left.open,
.mm_mega_panel.orient_right.open {
    visibility: visible;
    opacity: 1;
    transform: translateY(0); /* Slide down into view */
}

/* Specific open state for middle-oriented mega panels */
.mm_mega_panel.orient_middle.open {
    visibility: visible;
    opacity: 1;
    /* Combine centering with the slide-down effect */
    transform: translateX(-50%) translateY(0);
}

/* Submenu lists and links styling */
/* mm_submenu_list: List within dropdown/mega panels */
.mm_submenu_list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* mm_submenu_item: List item within submenu */
.mm_submenu_item {
    /* Spacing for submenu items if needed */
}

/* mm_submenu_link: Link within submenu */
.mm_submenu_link,
.mm_submenu_link:link,
.mm_submenu_link:visited {
    display: block;
    padding: 10px 15px;
    text-decoration: none;
    color: var(--text);
    font-size: 0.95em;
    white-space: nowrap;
    transition: color 0.3s ease-out,
                background-color 0.3s ease-out;
}

.mm_submenu_link:hover,
.mm_submenu_link:focus {
    color: var(--link_hover);
    background-color: var(--hover);
    outline: none;
}

/* Mega Menu Specifics */
.mm_mega_panel {
    min-width: inherit; /* Removed 450px due to wild behavior on IOS */
    padding: 20px;
}

/* mm_mega_content: Container for columns in mega menu */
.mm_mega_content {
    display: flex;
    gap: 20px; /* Space between columns */
}

/* mm_mega_column: Column within mega menu */
.mm_mega_column {
    flex: 1; /* Distribute space among columns */
    min-width: 150px; /* Minimum width for a column */
}

/* mm_mega_heading: Heading for a mega menu column */
.mm_mega_heading {
    font-family: 'DM Serif Display', serif;
    font-size: 1.1em;
    color: var(--text);
    margin-top: 0;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--line);
    transition: color 0.3s ease-out,
                border-color 0.3s ease-out;
}

.mm_mega_heading a:link,
.mm_mega_heading a:visited,
.mm_mega_heading a:active {
    color: var(--text);
    text-decoration: none;
}

.mm_mega_heading a:hover,
.mm_mega_heading a:focus {
    text-decoration: underline;
    color: var(--link_hover);
}

/* Responsive Considerations */
@media (max-width: 800px) {
    #merch_menu.sticky {
        padding: 0 10px;
    }
    
    #mm_logo_icon,
    #mm_cart_wrap {
        transform: translateX(0); 
        width: 62px;
    }
    
    /* Display logo icon when menu is sticky */
    .sticky #mm_logo_icon {
        opacity:1;
    }
    
    #mm_cart_wrap {
        opacity:1;
    }

    #mm_hamburger {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    #mm_list_wrap {
        display: none; /* Hide the main list by default on mobile */
        /* When .open, it will become the panel */
        position: absolute;
        top: 100%; /* Position below the nav bar (assumes nav bar height is consistent) */
        left: 0;
        right: 0; /* Or width: 100%; */
        background-color: var(--bg);
        border-top: 1px solid var(--line);
        box-shadow: 0 3px 5px rgba(0,0,0,0.1);
        z-index: 90; /* Below the main nav bar's z-index (if nav is 100) */
        max-height: calc(100vh - 50px); /* Example: viewport height minus nav bar height */
        overflow-y: auto;
        /* Ensure no inherited transforms from desktop panel states affect this */
        transform: none;
    }
    
    #mm_list_wrap.open { /* This class will be toggled by JavaScript */
        display: block;
    }

    .mm_list {
        flex-direction: column;
        width: 100%;
        justify-content: flex-start;
        flex-wrap: nowrap; /* Prevent wrapping within the vertical mobile menu */
    }
    
    .mm_item {
        display: block; /* Stack items */
        width: 100%; /* Full width for each item */
    }
    
    .mm_link,
    .mm_button {
        text-align: left; /* Align text left when stacked */
        width: 100%; /* Ensure full width for touch */
        box-sizing: border-box; /* Include padding in width */
        border-bottom: 1px solid var(--line);
    }

    .mm_dropdown_panel,
    .mm_mega_panel {
        position: static; /* Panels become part of the flow */
        width: 100%;
        box-sizing: border-box;
        box-shadow: none;
        border-left: none;
        border-right: none;
        border-bottom: 1px solid var(--line);
        transform: translateY(0); /* No animation needed */
    }
    
    .mm_mega_panel.orient_left,
    .mm_mega_panel.orient_right,
    .mm_mega_panel.orient_middle,
    .mm_mega_panel.orient_left.open,
    .mm_mega_panel.orient_right.open,
    .mm_mega_panel.orient_middle.open {
        left: auto;
        right: auto;
        transform: none; /* Explicitly remove all transforms on mobile */
    }
    
    .mm_mega_content {
        flex-direction: column; /* Stack columns in mega menu */
    }
}