/* ==========================================================================
   Weebly Archive Enhancement & Mobile Responsiveness (weebly-enhance.css)
   Preserves original desktop look (>768px) while ensuring full functionality
   for dropdown menus, lightboxes, search, and mobile phones (<=768px).
   ========================================================================== */

/* 1. Desktop Dropdown Menu Fallback & Reliability */
li.wsite-menu-item-wrap {
    position: relative;
}
@media screen and (min-width: 769px) {
    li.wsite-menu-item-wrap:hover > .wsite-menu-wrap {
        display: block !important;
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        z-index: 99999 !important;
        min-width: 210px !important;
        background: #2b2b2b;
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.28);
    }
    li.wsite-menu-subitem-wrap {
        position: relative;
    }
    li.wsite-menu-subitem-wrap:hover > .wsite-menu-wrap {
        display: block !important;
        position: absolute !important;
        top: 0 !important;
        left: 100% !important;
        z-index: 99999 !important;
        min-width: 200px !important;
    }
    .wsite-menu-wrap .wsite-menu {
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    .wsite-menu-wrap .wsite-menu li a {
        display: block !important;
        padding: 9px 14px !important;
        text-decoration: none !important;
        white-space: nowrap;
    }
}

/* Hide mobile nav bar on desktop */
.hs-mobile-nav-wrapper {
    display: none;
}

/* 2. Mobile & Small Tablet Responsiveness (<= 768px) */
@media screen and (max-width: 768px) {
    html, body {
        max-width: 100% !important;
        overflow-x: hidden !important;
        -webkit-text-size-adjust: 100%;
    }

    /* Make all fixed-width Weebly wrappers fluid */
    .container,
    #wrap,
    #wrapper,
    .wrapper,
    #header-wrap,
    .header-wrap,
    #banner-wrap,
    .banner-wrap,
    #main-wrap,
    .main-wrap,
    #footer-wrap,
    .footer-wrap,
    #header-in,
    #header-container,
    #header,
    #banner,
    #banner-top,
    #banner-bot,
    #main,
    #content,
    #wsite-content,
    #footer,
    .wsite-header,
    .wsite-header-section {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    .container,
    #main,
    #footer {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Stack header table cells cleanly on mobile */
    table#header,
    table#header > tbody,
    table#header > tbody > tr,
    table#header > tbody > tr > td,
    #header-right table,
    #header-right tbody,
    #header-right tr,
    #header-right td {
        display: block !important;
        width: 100% !important;
        text-align: center !important;
        box-sizing: border-box !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }

    #logo {
        float: none !important;
        max-width: 100% !important;
        display: block !important;
        padding: 12px 10px !important;
    }

    #logo,
    #wsite-title {
        text-align: center !important;
        word-break: break-word !important;
        line-height: 1.25 !important;
    }
    #wsite-title {
        font-size: 24px !important;
    }

    #header-right .search,
    #header .wsite-search,
    #search {
        float: none !important;
        margin: 8px auto !important;
        display: inline-block !important;
        max-width: 92% !important;
    }

    /* Hide desktop nav bars and legacy broken triggers on mobile */
    #topnav,
    #navigation,
    #desktop-nav,
    #menu,
    .w-navlist,
    .w-navpane,
    #nav-handle,
    .w-navpane-trigger,
    .hamburger,
    #wsite-menus {
        display: none !important;
    }

    /* Show clean universal mobile navigation bar */
    .hs-mobile-nav-wrapper {
        display: block !important;
        width: 100% !important;
        background: #222831;
        color: #ffffff;
        box-sizing: border-box;
        border-bottom: 2px solid rgba(255,255,255,0.12);
        position: relative;
        z-index: 9999;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    }

    .hs-mobile-nav-bar {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 14px;
        gap: 10px;
    }

    .hs-mobile-menu-btn {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: rgba(255,255,255,0.12);
        color: #ffffff !important;
        border: 1px solid rgba(255,255,255,0.25);
        border-radius: 6px;
        padding: 8px 14px;
        font-size: 15px;
        font-weight: 600;
        cursor: pointer;
        text-decoration: none !important;
    }

    .hs-mobile-search-form {
        display: flex;
        flex: 1;
        max-width: 210px;
    }

    .hs-mobile-search-input {
        width: 100%;
        padding: 7px 10px;
        border-radius: 6px;
        border: 1px solid rgba(255,255,255,0.25);
        background: rgba(255,255,255,0.95);
        color: #111;
        font-size: 14px;
    }

    .hs-mobile-menu-drawer {
        display: none;
        background: #1b2028;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding: 6px 0;
        max-height: 75vh;
        overflow-y: auto;
    }

    .hs-mobile-menu-drawer.open {
        display: block;
    }

    .hs-mobile-menu-list,
    .hs-mobile-submenu-list {
        list-style: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .hs-mobile-menu-item {
        border-bottom: 1px solid rgba(255,255,255,0.07);
    }

    .hs-mobile-item-row {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .hs-mobile-link {
        flex: 1;
        display: block;
        padding: 11px 16px;
        color: #f3f4f6 !important;
        text-decoration: none !important;
        font-size: 15px;
        font-weight: 500;
    }

    .hs-mobile-link.active {
        color: #60a5fa !important;
        font-weight: 700;
        background: rgba(96, 165, 250, 0.1);
    }

    .hs-mobile-sub-toggle {
        background: rgba(255,255,255,0.08);
        color: #ffffff;
        border: none;
        border-left: 1px solid rgba(255,255,255,0.1);
        padding: 11px 16px;
        font-size: 15px;
        cursor: pointer;
    }

    .hs-mobile-submenu-list {
        display: none;
        background: #13171d;
        padding-left: 14px !important;
    }

    .hs-mobile-submenu-list.open {
        display: block;
    }

    .hs-mobile-submenu-list .hs-mobile-link {
        padding: 9px 16px;
        font-size: 14px;
        color: #d1d5db !important;
    }

    /* Stack multi-column tables vertically on mobile */
    .wsite-multicol-table-wrap {
        margin: 0 !important;
    }
    table.wsite-multicol-table,
    tbody.wsite-multicol-tbody,
    tr.wsite-multicol-tr,
    td.wsite-multicol-col {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        margin-bottom: 14px !important;
    }

    /* Make images and embeds responsive without breaking gallery aspect-ratio crop */
    img:not(.galleryImage),
    .wsite-image img,
    #content img:not(.galleryImage) {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Make float images stack cleanly if wide */
    span.imgPusher + span {
        float: none !important;
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
        text-align: center !important;
    }

    iframe,
    object,
    embed,
    video {
        max-width: 100% !important;
    }

    /* Responsive banners on mobile */
    #bannerleft,
    #bannerright {
        float: none !important;
        width: 100% !important;
        height: auto !important;
        top: 0 !important;
        right: 0 !important;
        left: 0 !important;
        padding: 12px !important;
        box-sizing: border-box !important;
    }

    .wsite-header,
    .tall-header-page .wsite-header,
    .short-header-page .wsite-header,
    .landing-page .wsite-header,
    #banner,
    #banner-left {
        height: auto !important;
        min-height: 180px !important;
        margin: 0 auto !important;
        left: 0 !important;
        top: 0 !important;
        background-size: cover !important;
        background-position: center center !important;
    }

    /* Form inputs fit mobile screen */
    .wsite-form-input,
    .wsite-search-input,
    input[type="text"],
    input[type="email"],
    textarea,
    select {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
}

/* 3. Lightbox Modal (Touch & Desktop Friendly) */
.hs-lightbox-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}
.hs-lightbox-overlay.open {
    display: flex;
}
.hs-lightbox-content {
    position: relative;
    max-width: 92vw;
    max-height: 90vh;
    text-align: center;
}
.hs-lightbox-img {
    max-width: 90vw;
    max-height: 82vh;
    width: auto;
    height: auto;
    border-radius: 4px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.6);
    background: #fff;
}
.hs-lightbox-caption {
    color: #f3f4f6;
    margin-top: 10px;
    font-size: 15px;
    font-family: sans-serif;
}
.hs-lightbox-close {
    position: fixed;
    top: 16px;
    right: 20px;
    background: rgba(255,255,255,0.18);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 42px;
    height: 42px;
    font-size: 24px;
    line-height: 42px;
    cursor: pointer;
    z-index: 100001;
}
.hs-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.18);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    font-size: 22px;
    cursor: pointer;
    z-index: 100001;
}
.hs-lightbox-prev { left: 16px; }
.hs-lightbox-next { right: 16px; }

/* 4. Client-Side Search Results Modal */
.hs-search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 100000;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 50px 16px 20px;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.hs-search-overlay.open {
    display: flex;
}
.hs-search-modal {
    background: #ffffff;
    color: #1f2937;
    width: 100%;
    max-width: 640px;
    border-radius: 10px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.35);
    overflow: hidden;
    max-height: 82vh;
    display: flex;
    flex-direction: column;
}
.hs-search-header {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #f3f4f6;
    border-bottom: 1px solid #e5e7eb;
    gap: 10px;
}
.hs-search-input-modal {
    flex: 1;
    padding: 9px 12px;
    font-size: 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}
.hs-search-close-btn {
    background: #e5e7eb;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}
.hs-search-results {
    padding: 12px 16px;
    overflow-y: auto;
    flex: 1;
}
.hs-search-item {
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
}
.hs-search-item a {
    font-size: 16px;
    font-weight: 600;
    color: #1d4ed8 !important;
    text-decoration: none;
}
.hs-search-item a:hover {
    text-decoration: underline;
}
.hs-search-snippet {
    font-size: 13px;
    color: #4b5563;
    margin-top: 4px;
    line-height: 1.4;
}
