body {
    font-family: sans-serif;
    margin: 0;
    /* Add a transition for smooth adjustments if we change properties on it */
    transition: padding-left 0.3s ease-in-out;
}

body.no-scroll {
    overflow: hidden;
    /* Add padding to the top of the body to prevent content from being hidden by the fixed header.
       This value should be roughly the height of the header. */
    padding-top: 80px;
}

/* Make the header placeholder fixed to the top of the viewport */
div#header-placeholder {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000; /* Ensure it stays on top of other content */
}

/* Header Styles */
.site-header {
    background-color: #2d3748; /* Dark grey from other pages */
    padding: 0 40px; /* Adjusted padding for better mobile spacing */
    align-items: center;
    justify-content: space-between;
    /* The placeholder is now fixed, so the header itself can be a simple flex container */
    display: flex;
    transition: padding 0.1s ease;
    height: 80px;
    transition: height 0.1s ease-in-out, padding 0.1s ease-in-out;
}

/* --- Mobile Menu Toggle (Hamburger) --- */
.mobile-menu-toggle {
    display: none; /* Hidden on desktop */
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1001; /* Above the menu */
    order: -1; /* Position it to the left of the logo */
}

.mobile-menu-toggle .hamburger-bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 5px 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Hamburger animation to 'X' */
.mobile-menu-toggle.is-active .hamburger-bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.mobile-menu-toggle.is-active .hamburger-bar:nth-child(2) {
    opacity: 0;
}
.mobile-menu-toggle.is-active .hamburger-bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}


/* --- End Hamburger --- */

.site-logo img {
    height: 60px;
    padding: 16px 0px 10px 3px;
    /* New styles for animation */
    transition: height 0.1s ease, padding 0.1s ease;
}

/* Main Menu Container */
.main-menu, .main-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Top Level Menu Items */
.main-menu > ul {
    display: flex; /* Aligns items horizontally */
}

.main-menu > ul > li {
    position: relative; /* Needed for submenu positioning */
}

.main-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 25px 20px;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s ease, padding 0.3s ease; /* Added padding transition */
}

/* --- Scrolled State --- */
/* This class will be added by JavaScript when the user scrolls down */
.site-header.scrolled {
    /* padding-top: 5px;
    padding-bottom: 0;
    height: 8vh; */
}

.site-header.scrolled .site-logo img {
    /* height: 45px; Shrink the logo */
}

/* Sub-menu Styles */
.sub-menu {
    position: absolute;
    top: 80%;
    left: 0;
    background-color: #2d3748; /* Slightly lighter than header */
    min-width: 250px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 100;

    /* Animation setup */
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease-in-out;
    padding-bottom: 5px;
}

/* Show submenu on hover */
.main-menu > ul > li:hover > .sub-menu {
    max-height: 600px; /* A large enough value to show all items */
}

/* On mobile, we use a class toggle instead of hover */
.main-menu li.submenu-open > .sub-menu {
    max-height: 600px;
}


.sub-menu a {
    padding: 1px 20px;
    white-space: nowrap;
}

.sub-menu a:hover {
    background-color: #ED8C00; /* LIXI Orange */
}

/* Hide icons in the sub-menu */
.sub-menu img {
    display: none;
}

#content {
    padding-top: 100px !important;
}

/* --- Media Query for Mobile/Tablet --- */
/* This is where the magic happens. Adjust max-width as needed. */
@media (max-width: 1024px) {
    .site-header {
        justify-content: space-between; /* Space between hamburger and logo */
    }

    .mobile-menu-toggle {
        display: block; /* Show the hamburger */
    }

    .site-logo {
        /* Center the logo by removing the flex-grow from the nav */
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
    }

    .main-menu {
        /* Mobile menu panel styles */
        position: fixed;
        top: 0;
        left: -300px; /* Start off-screen */
        width: 300px;
        height: 100vh;
        background-color: #2d3748;
        padding-top: 100px; /* Space for header */
        box-shadow: 4px 0 15px rgba(0,0,0,0.2);
        transition: left 0.3s ease-in-out;
        z-index: 999;
        overflow-y: auto; /* Allow scrolling if menu is long */
    }

    .main-menu.mobile-menu-open {
        left: 0; /* Slide in */
    }

    .main-menu > ul {
        flex-direction: column; /* Stack items vertically */
    }

    .main-menu a {
        padding: 15px 20px; /* Adjust padding for mobile */
        justify-content: flex-start;
    }

    /* On mobile, disable the desktop hover effect and ensure sub-menus are closed by default. */
    .main-menu > ul > li:hover > .sub-menu {
        max-height: 0;
    }
    /* This rule shows the sub-menu only when the parent has the 'submenu-open' class. */
    .main-menu > ul > li.submenu-open > .sub-menu {
        max-height: 600px; /* A large enough value to show all items */
    }

    /* Sub-menu adjustments for mobile */
    .sub-menu {
        position: static; /* No longer absolute */
        background-color: #465052; /* Match header for a nested feel */
        box-shadow: none;
        min-width: 100%;
        border-top: 1px solid #555;
        padding-bottom: 0;
    }

    .sub-menu a {
        padding-left: 40px; /* Indent sub-menu items */
    }

    /* Add an indicator for items with sub-menus */
    .main-menu .has-submenu > a {
        position: relative;
    }
    .main-menu .has-submenu > a::after {
        content: '▼';
        font-size: 0.7em;
        position: absolute;
        right: 20px;
        transition: transform 0.2s ease;
    }
    .main-menu .has-submenu.submenu-open > a::after {
        transform: rotate(180deg);
    }
}
