/* =================================================================
   MOBILE NAVIGATION STYLES (Dedicated File)
   ================================================================= */

/* 1. Hamburger Menu (Hidden on Desktop) */
.hamburger-menu {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
}

.hamburger-menu .bar {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #660000;
    margin: 5px 0;
    transition: 0.4s;
}

/* 2. Mobile Logic (< 768px) */
@media (max-width: 768px) {

    /* Show Hamburger */
    .hamburger-menu {
        display: block;
        order: 1;
        /* Left */
    }

    /* Logo to Right */
    .logo {
        order: 2;
        /* Right */
    }

    .header-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 5px 20px;
    }

    /* Primary Nav: Initially Hidden, Slide/Overlay */
    .primary-nav {
        /* display: none; */
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #E0D9D5;
        border-top: 1px solid #660000;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        z-index: 1000;

        /* Dropdown Animation Logic */
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-in-out;
    }

    /* Active State */
    .primary-nav.active {
        max-height: 100vh;
    }

    .primary-nav ul {
        flex-direction: column;
        align-items: center;
        padding: 20px 0;
        width: 100%;
    }

    .primary-nav li {
        width: 100%;
        text-align: center;
        border-left: none;
        margin-bottom: 15px;
        padding: 0;
    }

    .primary-nav a {
        display: block;
        padding: 10px;
        font-size: 1.2rem;
    }

    /* Dropdown Handling */
    .dropdown-content {
        position: static;
        display: block;
        box-shadow: none;
        border: none;
        background-color: transparent;
        width: 100%;

        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease-in-out;
    }

    /* Open Class */
    .dropdown.active .dropdown-content {
        max-height: 500px;
    }

    .dropdown-content a {
        background-color: #E0D9D5;
        /* Match main menu background */
        padding: 10px 0;
        text-align: center;
        border-bottom: 1px solid #d0c8be;
    }

    /* Vision Grid Vertical Stack */
    .vision-grid {
        display: flex;
        flex-direction: column;
        gap: 30px;
        padding-bottom: 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .vision-item {
        width: 100%;
        flex: none;
        /* Reset flex */
        background-color: transparent;
        padding: 20px;
        border-radius: 10px;
        box-shadow: none;
        margin: 0;
        text-align: center;
    }

    /* Objectives List Vertical Stack */
    .objectives-list {
        display: flex;
        flex-direction: column;
        gap: 30px;
        padding: 0;
        padding-bottom: 20px;
        width: 100%;
        box-sizing: border-box;
        list-style: none;
    }

    .objective-item {
        width: 100%;
        flex: none;
        /* Reset flex */
        flex-direction: column;
        text-align: center;
        background-color: transparent;
        padding: 20px;
        border-radius: 10px;
        border: none;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .objective-item .objective-icon {
        margin: 0 auto;
        order: -1;
        /* Ensure image is always on top */
    }

    /* Hide Scrollbars (Safety) */
    .vision-grid::-webkit-scrollbar,
    .objectives-list::-webkit-scrollbar {
        display: none;
    }

    /* Hide Carousel Dots */
    .carousel-indicators {
        display: none !important;
    }

    /* About Page Hero Adjustments */
    #page-hero {
        height: auto !important;
        min-height: 30vh !important;
        padding: 50px 20px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center !important;
    }

    #page-hero h1 {
        font-size: 3rem !important;
        padding: 0 !important;
        margin: 0;
        width: 100%;
        line-height: 1.2;
        /* Allow long words like 'COLLABORATIONS' to break correctly */
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    /* Specific Override for unusually long Sponsors hero text on mobile */
    #page-hero.sponsorships-hero h1 {
        font-size: 2.2rem !important;
    }
}

/* Global Overflow Protection */
@media (max-width: 768px) {

    html,
    body {
        /* Using clip instead of hidden keeps it from becoming a scroll container, 
           which preserves position: sticky for the header on mobile. */
        overflow-x: clip;
        max-width: 100vw;
    }

    * {
        box-sizing: border-box;
    }
}

/* Law Journal Fixes */
@media (max-width: 768px) {
    .journal-card img {
        height: auto !important;
        width: 90% !important;
        max-width: 220px !important;
        margin: 0 auto;
        padding: 10px !important;
        object-fit: contain;
        display: block;
    }

    .journal-card {
        padding: 10px 0;
        width: 100%;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .journal-container {
        max-width: 100% !important;
        padding: 30px 5% !important;
        gap: 30px !important;
    }

    .journal-card-content {
        width: 100%;
        padding: 0 15px;
        text-align: center;
    }

    .journal-card-content h3 {
        white-space: normal !important;
        word-wrap: break-word;
        font-size: 1.2rem !important;
        margin: 10px 0;
        line-height: 1.3;
    }

    .journal-card-content a {
        display: inline-block;
        max-width: 100%;
    }

    /* Merchandise Page Mobile Stack */
    .slider-arrow {
        display: none !important;
    }

    #merch-items-grid {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        width: 100% !important;
        gap: 50px !important;
        padding: 40px 0 !important;
        min-width: 0 !important;
    }

    .merch-item {
        width: 100% !important;
        max-width: 320px;
        flex-shrink: 1 !important;
    }

    .merch-img-wrapper {
        height: auto !important;
        min-height: 250px;
    }

    .merch-item h3 {
        min-height: auto !important;
        margin: 15px 0 !important;
    }

    .slider-viewport {
        overflow-x: hidden !important;
        padding: 0 20px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}