/*
Menu CSS based on Live Site's Styles, consolidated and cleaned.
Includes Base (Mobile), Larger Mobile, and Desktop styles for the menu.
*/

/* --- BASE (MOBILE) SIZE - Applies by default, overridden by media queries --- */

/* MAIN MENU TOGGLE (Hamburger Button) */
.menu-toggle {
    display: block; /* Visible by default on mobile */
    padding: 10px;
    margin: 20px 0 0;
    background: #000;
    color: #fff;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 20px;
}
.menu-toggle.toggled-on {
    background: #000; /* Stays same background when toggled on */
}

/* MAIN NAVIGATION (.srt-menu) for Mobile */
.srt-menu {
    display: none; /* Hidden by default on mobile */
}
.srt-menu.toggled-on {
    display: block; /* Becomes visible when 'toggled-on' class is added by JS */
    position: relative; /* Important for stacking context */
    z-index: 10;
}

.srt-menu { /* General menu styling, acts as base for mobile */
    clear: both;
    margin-bottom: 60px; /* Space below the menu */
}
.srt-menu li a { /* General link styles for main menu items on mobile */
    color: #666;
    background: #dadada;
    display: block;
    margin: 1px 0;
    padding: 10px;
    text-decoration: none;
    font-size: .9em;
}
.srt-menu li a:hover { /* Hover state for mobile links */
    background: #000000;
    color: #fff;
}
.srt-menu li li a { /* First sub-level links (traditional dropdown) */
    background: #e8e8e8;
    padding-left: 40px;
}
.srt-menu li li li a { /* Second sub-level links */
    background: #efefef;
    padding-left: 80px;
}


/* --- LARGER MOBILE DEVICES (@media min-width: 481px) --- */
@media only screen and (min-width: 481px) {
    .menu-toggle { /* Adjust toggle positioning for larger mobile */
        margin-top: 10px; /* Adjust margin */
        float: right; /* Float to the right */
    }
}

/* --- TABLET & SMALLER LAPTOPS / DESKTOP (@media min-width: 1000px) --- */
@media only screen and (min-width: 1000px) { /* BREAKPOINT CHANGED TO 1000PX */

    /* --- FLEXBOX FOR RIGHT-ALIGNMENT --- */
    /* This rule will only apply if the wrapping div in your HTML has align="right" */
    div[align="right"] {
        display: flex;
        justify-content: flex-end; /* Pushes content to the far right */
        align-items: flex-start; /* Aligns content to the top */
        width: auto;
    }

    /*** MAIN MENU - ESSENTIAL DESKTOP STYLES ***/
    .menu-toggle {
        display: none; /* Hide hamburger button on desktop */
    }
    #menu-main-navigation {
        display: block; /* Ensures it's NOT flex on desktop, allowing child LIs to float */
        width: auto; /* Allows content to determine width, or flex parent to size */
        text-align: left; /* Keeps text aligned left within the nav */
        background-color: transparent; /* Changed to transparent */
    }

    /* Adjustment for #topnav to work with flex parent or general layout */
    #topnav {
        float: none; /* Clear any floats that might conflict with flexbox or modern layout */
        width: auto; /* Ensure it takes width based on content/flex */
        margin-left: 0;
        margin-right: 0;
        /* The inline 'margin-bottom: 40px;' from your HTML will still apply */
    }

    /* Reset basic menu list styles for desktop */
    .srt-menu, .srt-menu * {
        margin: 0;
        padding: 0;
        list-style: none;
    }

    /* Main navigation items container for desktop */
    .srt-menu {
        display: inline-block; /* Allows width to shrink to content, compatible with floated LIs */
        float: none; /* Remove float from the main menu UL to work with flex parent */
        margin: .35em 0 0 0; /* Adjust top margin for vertical alignment */
    }

    /* Main Menu List Item (LI) Styling for Desktop */
    .srt-menu li {
        float: left; /* Keeps main menu items horizontal */
        position: relative; /* For absolute positioning of dropdowns (critical for mega menu) */
        margin-left: 1px; /* Small gap between main menu items */
        height: 42px; /* Set height for main nav items (prioritising 42px from your first 920px block) */
    }
    .srt-menu li li { /* Nested LI items (in dropdowns) */
        width: 100%; /* Take full width of parent ul */
        margin-left: 0px; /* Remove margin for nested items */
        height: auto; /* Auto height for dropdown items */
    }

    /* Link (A) Styling for Desktop - Main Level - ADJUSTED SELECTOR */
    .srt-menu li a { /* <--- Changed from .srt-menu a to .srt-menu li a for higher specificity */
        display: block;
        position: relative;
        text-decoration: none;
        background: transparent; /* Changed from #fff to transparent */
        margin: 0;
        padding: 10px 20px;
        height: 42px;
        line-height: 22px;
        color: #000; /* Main menu item text is BLACK */
        transition: all 0.3s ease;
    }

    /* Hover and Current State for Desktop Main Menu */
    .srt-menu li:hover > a,
    .srt-menu li.current a {
        color: #fff;
        background: #79D3F6; /* Light blue background for hover/active */
    }

    /* Traditional Dropdown (Sub-menu) Styling for Desktop */
    .srt-menu ul {
        position: absolute;
        width: 12em;
        left: 0; /* Align with parent li */
        top: 42px; /* Position below parent li */
        z-index: 99;
        box-shadow: 2px 3px 2px 0px rgba(0, 0, 0, .3);
        background: rgba(0, 0, 0, .9); /* Solid dark background for traditional dropdown container (prioritising 0.9) */
        transition: opacity 0.5s ease, visibility 0.5s ease; /* Smooth appearance - UPDATED TRANSITION */
        opacity: 0; /* Start hidden for transition */
        visibility: hidden; /* Start hidden for transition */
    }
    /* Show dropdown on hover */
    .srt-menu li:hover > ul,
    .srt-menu li.sfHover ul { /* 'sfHover' is likely used by a JavaScript menu library (Superfish) */
        display: block; /* Ensure it appears (overrides display: none) */
        opacity: 1; /* Fade in */
        visibility: visible; /* Become visible */
    }

    /* Traditional Dropdown (Sub-menu) Link Styling for Desktop */
    .srt-menu li ul li a {
        /* border-top: 1px solid rgba(255,255,255,.2); */ /* Kept commented as per your original */
        color: #fff; /* White text for dropdown links */
        padding-left: 20px;
        background: none; /* No specific background, relies on parent ul's dark background from the 0.9 rule */
        text-align: left;
        line-height: normal;
        height: auto;
        padding-top: 8px;
        padding-bottom: 8px;
        transition: background 0.2s ease, color 0.2s ease;
    }
    .srt-menu li ul li a:hover {
        background: #000; /* Black background on hover */
        color: #79D3F6; /* Light blue text on hover */
    }

    /* Multi-level Traditional Dropdown Positioning for Desktop */
    ul.srt-menu li:hover li ul,
    ul.srt-menu li.sfHover li ul {
        top: -999em; /* Hide deeper levels by default */
    }
    ul.srt-menu li li:hover ul,
    ul.srt-menu li li.sfHover ul {
        left: 12em; /* Position next level to the right of parent */
        top: 0;
    }
    ul.srt-menu li li:hover li ul,
    ul.srt-menu li li.sfHover li ul {
        top: -999em;
    }
    ul.srt-menu li li li:hover ul,
    ul.srt-menu li li li.sfHover li ul {
        left: 10em;
        top: 0;
    }

    /* Mega Menu Specific Styles - UPDATED BLOCK */
.has-mega-menu {
    position: relative; /* Essential for positioning the mega menu content relative to this LI */
}

.mega-menu-content {
    display: none; /* Hidden by default */
    position: fixed; /* CHANGED: from absolute to fixed to position relative to viewport */
    /* REMOVED: top: 42px; /* Position below the main navigation item (matching your li height) */
    
    left: 20px; /* NEW: 20px from the left edge of the viewport */
    right: 20px; /* NEW: 20px from the right edge of the viewport */
    /* REMOVED: left: 50%; and transform: translateX(-50%); as they are no longer needed with fixed positioning */
    
    max-width: 1200px; /* Limits overall width */
    margin-left: auto; /* NEW: To center it when max-width is hit */
    margin-right: auto; /* NEW: To center it when max-width is hit */

    padding: 20px; /* This padding will create the desired inner spacing */
    box-shadow: 0 5px 15px rgba(0,0,0,0.2); /* Subtle shadow */
    z-index: 100; /* Ensure it's above other content */
    box-sizing: border-box; /* Include padding in width */

    /* Flexbox for columns */
    display: flex; /* Make it a flex container */
    justify-content: space-between; /* Distribute columns evenly with space between */
    flex-wrap: wrap; /* Allow columns to wrap if necessary */
    
    /* Styling for the mega menu container itself */
    background: rgba(0, 0, 0, .9); /* Dark background to match traditional dropdowns */
    color: #fff; /* Default text colour for content within the mega menu */
    
    /* Fade in/out */
    opacity: 0; /* Start hidden for smooth transition */
    visibility: hidden; /* Start hidden for smooth transition */
    transition: opacity 0.5s ease, visibility 0.5s ease; /* Smooth transition - UPDATED TRANSITION */
}

/* Show Mega Menu on hover of parent li */
.has-mega-menu:hover .mega-menu-content {
    display: flex; /* Show when hovered */
    opacity: 1; /* Fade in */
    visibility: visible; /* Become visible */
}

/* Mega Menu Column - Explicit Properties */
.mega-menu-column {
    /* Reset any conflicting inherited styles */
    width: auto !important; /* KEPT: This is essential for column display in flexbox */
    float: none; /* Ensure no floating interferes */
    display: block; /* Ensure it's a block-level flex item */

    /* Flexbox properties */
    flex: 1; /* Shorthand for flex-grow: 1, flex-shrink: 1, flex-basis: 0% */

    /* Existing styles */
    min-width: 200px; /* Minimum width for each column before wrapping */
    padding: 0 15px; /* Padding within each column */
    border-right: 1px solid #eee; /* Vertical separator between columns */
}

.mega-menu-column:last-child {
    border-right: none; /* No border on the last column */
}

.mega-menu-column h3 {
    color: #fff; /* Darker text for headings */
    font-size: 0.9em;
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #ddd; /* Underline headings */
    padding-bottom: 5px;
}

.mega-menu-column ul {
    list-style: none; /* Remove bullet points */
    padding: 0; /* Remove default padding */
    margin: 0; /* CRITICAL: Remove any conflicting margins (especially negative ones) */
    position: static; /* CRITICAL: Override any absolute positioning from general ul rules */
}

/* Ensure the ul within mega menu columns is visible when mega menu is active */
.has-mega-menu:hover .mega-menu-content .mega-menu-column ul {
    opacity: 1 !important; /* Force opacity to 1 */
    visibility: visible !important; /* Force visibility to visible */
}

.mega-menu-column ul li a {
    color: #fff; /* Default link color within columns */
    padding: 5px 0; /* Padding for column links */
    background: transparent !important; /* Ensure transparent background by default */
    display: block; /* Make links fill space for better click area */
    text-decoration: none;
    transition: color 0.2s ease;
    height: auto; /* Ensure auto height */
    line-height: normal; /* Ensure normal line height */
}

.mega-menu-column ul li a:hover {
    color: #79D3F6; /* Light blue text on hover */
    background: #000 !important; /* Ensure black background on hover, overriding any other rule */
}

/* NEW: Rule to handle focus/active states for mega menu links */
.mega-menu-column ul li a:focus,
.mega-menu-column ul li a:active {
    background: #000; /* Ensure no blue background on focus/active */
    color: #79D3F6;
}

/* Adjustments for potential conflicts with existing traditional dropdown rules */
/* Ensure traditional dropdowns don't interfere with mega menu visibility */
.srt-menu li:not(.has-mega-menu):hover > ul {
    display: block; /* Keep traditional dropdowns working as before */
}

}