/* Mobile Homepage Layout Fixes */

/* Mobile Events Header Positioning Fix - REMOVED DUPLICATE SOLUTION */

/* Mobile Menu Styles */
@media screen and (max-width: 640px) {
    /* Hide desktop menu on mobile */
    .main-nav__nav-bar {
        display: none !important;
    }
    
    /* Show mobile menu button */
    .main-nav__menu-toggle {
        display: block !important;
        background: #000;
        color: #fff;
        border: none;
        padding: 10px 15px;
        position: relative;
        z-index: 1001;
    }
    
    /* Mobile menu overlay styles - override Foundation Reveal */
    #mobileNav.reveal,
    #mobileNav {
        display: none !important;
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: auto !important;
        bottom: auto !important;
        width: 100% !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        background: rgba(10, 7, 3, 0.9) !important;
        z-index: 1000 !important;
        padding: 20px !important;
        box-sizing: border-box !important;
        overflow-y: auto !important;
        transform: none !important;
        transition: none !important;
        border-radius: 0 !important;
        border: none !important;
        margin: 0 !important;
    }
    
    /* Force show when menu is opened */
    #mobileNav.menu-open,
    #mobileNav.reveal.menu-open {
        display: block !important;
    }
    
    #mobileNav ul {
        list-style: none;
        padding: 0;
        margin: 40px 0 0 0;
    }
    
    #mobileNav li {
        margin-bottom: 20px;
    }
    
    #mobileNav a {
        color: #fff;
        font-size: 18px;
        text-decoration: none;
        display: block;
        padding: 10px 0;
        border-bottom: 1px solid rgba(255,255,255,0.2);
    }
    
    #mobileNav .close-button {
        position: absolute;
        top: 20px;
        right: 20px;
        background: none;
        border: none;
        color: #fff;
        font-size: 30px;
        cursor: pointer;
        z-index: 1001;
    }
    
    /* Fix homepage layout stacking on mobile */
    .row {
        margin-left: -0.625rem;
        margin-right: -0.625rem;
    }
    
    /* Ensure proper stacking of Articles and Events sections */
    .small-12.medium-8.columns,
    .small-12.medium-4.columns {
        clear: both;
        float: none;
        width: 100%;
        margin-bottom: 20px;
    }
    
    /* Prevent overlapping content */
    .vspace-small-12 {
        margin-bottom: 20px !important;
        clear: both;
    }
    
    /* Fix slideshow on mobile */
    .slideshow {
        margin-bottom: 20px;
        clear: both;
    }
    
    /* Article tiles responsive spacing */
    .article-tile {
        margin-bottom: 20px;
        clear: both;
    }
    
    /* Fix any floating issues */
    .row::after {
        content: "";
        display: table;
        clear: both;
    }
    
    /* Upcoming Events section - ensure it doesn't overlap */
    .small-12.medium-4.columns {
        position: relative;
        z-index: 1;
        background: #fff;
        padding-top: 20px;
    }
    
    /* Recent Articles section */
    .small-12.medium-8.columns {
        position: relative;
        z-index: 2;
        background: #fff;
        padding-bottom: 20px;
    }
}

/* Fix subnav overlap issue */
.subnav.subnav--main {
    height: auto !important;
    min-height: 53px;
    line-height: 1.3;
}


/* NUCLEAR OPTION: Override ALL subnav spacing AND container height */
.subnav.subnav--main {
    height: auto !important;
    min-height: auto !important;
    white-space: normal !important;
    overflow: visible !important;
}

/* Override the specific SCSS breakpoint that forces 53px height */
@media screen and (min-width: 1025px) and (max-width: 1156px) {
    .subnav.subnav--main {
        height: auto !important;
        min-height: auto !important;
        white-space: normal !important;
        overflow: visible !important;
        line-height: 1 !important;
    }
    
    /* CRITICAL: Remove line spacing for non-articles sections */
    .subnav.subnav--main:not(.articles) .subnav__item {
        line-height: 1 !important;
        margin-bottom: 0 !important;
        padding-bottom: 0.7rem !important;
        vertical-align: top !important;
    }
    
    /* Only articles section gets the line spacing */
    .subnav.subnav--main.articles .subnav__item {
        line-height: 1.3 !important;
        padding-bottom: 0.9rem !important;
        margin-bottom: 0 !important;
    }
}

.subnav .subnav__item {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Add 0.7rem padding for non-articles sections */
.subnav:not(.articles) .subnav__item {
    padding-bottom: 0.7rem !important;
}

/* BRUTAL OVERRIDE: Articles selected items get 16px, audio-programs gets 12px */
@media screen and (min-width: 1025px) {
    /* Reset all selected item anchor padding to 16px first */
    .subnav .subnav__item--is-selected > a {
        padding-bottom: 16px !important;
    }
    
    /* Then brutally override ONLY audio-programs to 12px */
    .subnav.audio-programs .subnav__item--is-selected > a {
        padding-bottom: 12px !important;
    }
}

.subnav.articles .subnav__item {
    padding-bottom: 0.9rem !important;
}

@media screen and (min-width: 1025px) {
    /* Allow container to grow naturally */
    .subnav.subnav--main {
        height: auto !important;
        min-height: auto !important;
        white-space: normal !important;
        overflow: visible !important;
    }
    
    /* Reset padding AND margin for all subnav items */
    .subnav.subnav--main .subnav__item {
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* Apply 0.7rem padding to non-articles sections */
    .subnav.subnav--main:not(.articles) .subnav__item {
        padding-bottom: 0.7rem !important;
        margin-bottom: 0 !important;
    }
    
    /* Apply 0.9rem padding to articles section */
    .subnav.subnav--main.articles .subnav__item {
        padding-bottom: 0.9rem !important;
        margin-bottom: 0 !important;
    }
    
    /* Apply padding to selected items in articles section only */
    .subnav.subnav--main.articles .subnav__item.subnav__item--is-selected {
        padding-bottom: 0.9rem !important;
        margin-bottom: 0 !important;
    }
}

@media screen and (min-width: 1025px) and (max-width: 1156px) {
    .subnav.subnav--main {
        height: auto !important;
        min-height: auto !important;
        white-space: normal !important;
        overflow: visible !important;
        padding-bottom: 10px;
    }
    
    .subnav.subnav--main .subnav__item {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
        display: inline-block;
        vertical-align: top;
    }
    
    /* Non-articles sections get 0.7rem padding */
    .subnav.subnav--main:not(.articles) .subnav__item {
        margin-bottom: 0 !important;
        padding-bottom: 0.7rem !important;
    }
    
    /* Articles section gets 0.9rem padding */
    .subnav.subnav--main.articles .subnav__item {
        margin-bottom: 0 !important;
        padding-bottom: 0.9rem !important;
    }
}

/* Tablet and small desktop adjustments */
@media screen and (min-width: 641px) and (max-width: 1024px) {
    /* Ensure proper spacing on tablets */
    .vspace-small-12 {
        margin-bottom: 30px;
    }
    
    /* Hide mobile menu toggle on larger screens */
    .main-nav__menu-toggle {
        display: none !important;
    }
    
    #mobileNav {
        display: none !important;
    }
}

/* ARTICLES NAVIGATION FIX - Hide duplicate subnav */
/* Hide mobile subnav on desktop to prevent double navigation */
@media screen and (min-width: 641px) {
    .subnav--mobile {
        display: none !important;
    }
}

/* Hide desktop subnav on mobile - mobile nav includes subnav */
@media screen and (max-width: 640px) {
    .subnav--main {
        display: none !important;
    }
}

/* DROPDOWN WIDTH FIX - Prevent dropdowns from being too wide */
.pgs-dropdown {
    max-width: 200px !important;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ADMIN PANEL FIX - Prevent zoom/scale issues in Craft admin */
/* Target Craft admin panel specifically */
body:has(#global-container),
#global-container,
#global-container * {
    /* Reset webkit text size adjustments that cause zoom issues */
    -webkit-text-size-adjust: 100% !important;
    -ms-text-size-adjust: 100% !important;
    text-size-adjust: 100% !important;

    /* Reset any problematic transformations */
    transform: none !important;
    zoom: 1 !important;

    /* Reset font scaling to prevent zoom appearance */
    font-size: inherit !important;
}

/* SLIDESHOW PADDING FIX - Remove beige strip above article slideshows */
/* The l-full-padding class adds 10px padding which creates a visible gap */
.l-full-padding {
    padding-top: 0 !important;
}