/* ==========================================================
   INDUSTRIES PAGE SYSTEM — style.css
   ========================================================== */

/* ── Outer wrapper ──────────────────────────────────────── */
.industries-wrapper {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 48px;
    position: relative !important;
    overflow: visible !important;
}

/* ── Sidebar ────────────────────────────────────────────── */
.industries-sidebar {
    width: 300px;
    min-width: 260px;
    flex-shrink: 0;
    position: sticky !important;
    top: 110px;
    /*max-height: calc(100vh - 140px);*/
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    transition: opacity 0.35s ease, transform 0.35s ease;
    z-index: 10;
    align-self: flex-start !important;
}

.industries-sidebar::-webkit-scrollbar {
    display: none;
}

.industries-sidebar.is-collapsed .indsys-toc {
    transform: translateY(-8px);
    pointer-events: none;
}

.industries-sidebar.is-collapsed:hover .indsys-toc,
.industries-sidebar.is-collapsed:focus-within .indsys-toc {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Content area ───────────────────────────────────────── */
.industries-content {
    flex: 1 !important;
    min-width: 0;
    overflow: visible !important;
}

/* ── TOC ────────────────────────────────────────────── */
.indsys-toc {
    transition: opacity 0.35s ease, transform 0.35s ease;
}

#industries-toc::before {
    content: "On This Page";
    display: block;
    font-size: 10.5px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #b0b8c8;
    margin-bottom: 20px;
    padding-left: 1px;
}

.indsys-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.indsys-toc__item {
    margin: 0;
    padding: 0;
}

.indsys-toc__link {
    display: block;
    padding: 7px 14px;
    border-left: 2px solid transparent;
    color: #606878;
    text-decoration: none;
    font-size: 13px;
    line-height: 1.45;
    border-radius: 0 5px 5px 0;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.indsys-toc__link:hover {
    color: #5389f2;
    background: #f0f4ff;
    border-left-color: #5389f2;
}

.indsys-toc__item--h3 .indsys-toc__link {
    padding-left: 26px;
    font-size: 12px;
    color: #8a93a6;
}

.indsys-toc__item--h3 .indsys-toc__link:hover {
    color: #5389f2;
    background: #f6f8ff;
    border-left-color: #9ab3f7;
}

.indsys-toc__link.is-active {
    color: #5389f2;
    border-left-color: #5389f2;
    background: #eef2ff;
    font-weight: 500;
}

.indsys-toc__item--h3 .indsys-toc__link.is-active {
    color: #5389f2;
    border-left-color: #9ab3f7;
    background: #f4f6ff;
    font-weight: 600;
}

/* ── Recent posts ─────────────────────────── */
.indsys-recent-posts {
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid #eaecf0;
}

.indsys-recent-posts__label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #b0b8c8;
    margin-bottom: 14px;
    padding-left: 2px;
}

.indsys-post-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    text-decoration: none;
    padding: 10px 0;
    border-bottom: 1px solid #f2f4f8;
    transition: opacity 0.2s ease;
}

.indsys-post-card:last-child { border-bottom: none; }
.indsys-post-card:hover { opacity: 0.75; }

.indsys-post-card__thumb {
    flex-shrink: 0;
    width: 130px !important;
    height: 56px;
    overflow: hidden;
    border-radius: 6px;
}

.indsys-post-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.indsys-post-card__body { flex: 1; min-width: 0; }

.indsys-post-card__title {
    margin: 0 0 4px;
    font-size: 13px;
    line-height: 1.4;
    color: #1e2533;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    width: 150px;
}

.indsys-post-card__date {
    font-size: 11px;
    color: #00000082;
}

/* ==========================================================
   RESPONSIVE — MOBILE STICKY NAV BAR
   ========================================================== */

@media (max-width: 1024px) {

    /* Wrapper becomes a vertical flex column */
    .industries-wrapper {
        flex-direction: column !important;
        gap: 0 !important;
        align-items: stretch !important;
    }

    /* ─────────────────────────────────────────────────────
       SIDEBAR → sticky nav bar
       Naturally sticks only AFTER the user scrolls to it.
       Un-sticks when the wrapper container ends.
    ───────────────────────────────────────────────────── */
    .industries-sidebar {
        order: 1 !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 999 !important;
        width: 100% !important;
        min-width: unset !important;
        max-height: none !important;
        overflow: visible !important;
        align-self: auto !important;
        background: #111827 !important;
        transition: none !important;
    }

    /* Hide "On This Page" label on mobile */
    #industries-toc::before {
        display: none !important;
    }

    /* ── Toggle button injected by JS ── */
    .indsys-mobile-toggle {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        width: 100% !important;
        padding: 15px 20px !important;
        background: transparent !important;
        border: none !important;
        outline: none !important;
        cursor: pointer !important;
        color: #ffffff !important;
        font-size: 15px !important;
        font-weight: 700 !important;
        text-align: left !important;
        box-sizing: border-box !important;
        -webkit-tap-highlight-color: transparent !important;
    }

    /* Chevron icon — rotate when open */
    .indsys-mobile-chevron {
        display: flex !important;
        align-items: center !important;
        flex-shrink: 0 !important;
        transition: transform 0.28s ease !important;
        color: #ffffff !important;
    }

    .industries-sidebar.mobile-open .indsys-mobile-chevron {
        transform: rotate(180deg) !important;
    }

    /* ── TOC list hidden by default ── */
    .industries-sidebar .indsys-toc__list {
        display: none !important;
        margin: 0 !important;
        padding: 4px 0 10px !important;
        list-style: none !important;
        background: #1a2233 !important;
    }

    /* Dropdown visible when open */
    .industries-sidebar.mobile-open .indsys-toc__list {
        display: block !important;
    }

    /* ── TOC links in dark dropdown ── */
    .industries-sidebar .indsys-toc__link {
        padding: 11px 20px !important;
        color: #94a3b8 !important;
        font-size: 13.5px !important;
        background: transparent !important;
        border-left: 3px solid transparent !important;
        border-radius: 0 !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: unset !important;
    }

    .industries-sidebar .indsys-toc__item:last-child .indsys-toc__link {
        border-bottom: none !important;
    }

    .industries-sidebar .indsys-toc__link:hover {
        color: #ffffff !important;
        background: rgba(83, 137, 242, 0.12) !important;
        border-left-color: #5389f2 !important;
    }

    .industries-sidebar .indsys-toc__link.is-active {
        color: #ffffff !important;
        background: rgba(83, 137, 242, 0.18) !important;
        border-left-color: #5389f2 !important;
        font-weight: 600 !important;
    }

    .industries-sidebar .indsys-toc__item--h3 .indsys-toc__link {
        padding-left: 34px !important;
        font-size: 12.5px !important;
        color: #64748b !important;
    }

    /* ── Content area (middle) ── */
    .industries-content {
        order: 2 !important;
        padding-top: 28px !important;
    }

    /* ── Recent posts wrapper injected by JS after content ── */
    .indsys-mobile-posts-wrap {
        order: 3 !important;
        width: 100% !important;
        padding: 32px 0 !important;
        box-sizing: border-box !important;
    }

    /* Hide original recent posts from inside sidebar — JS moves them */
    .industries-sidebar .indsys-recent-posts {
        display: none !important;
    }

    /* Cancel desktop collapse effects on mobile */
    .industries-sidebar.is-collapsed .indsys-toc {
        opacity: 1 !important;
        transform: none !important;
        pointer-events: auto !important;
    }
}

@media (max-width: 640px) {
    .indsys-mobile-toggle {
        padding: 14px 16px !important;
        font-size: 14px !important;
    }

    .industries-sidebar .indsys-toc__link {
        padding: 10px 16px !important;
        font-size: 13px !important;
    }

    .industries-sidebar .indsys-toc__item--h3 .indsys-toc__link {
        padding-left: 28px !important;
    }
}

/* ==========================================================
   ELEMENTOR OVERRIDES
   Elementor adds overflow:hidden on parent containers which
   BREAKS position:sticky. These overrides fix that.
   ========================================================== */

.elementor-element.industries-wrapper,
.elementor-element.industries-sidebar,
.elementor-element.industries-content {
    overflow: visible !important;
}

.elementor-element.industries-sidebar {
    position: sticky !important;
    align-self: flex-start !important;
}

.elementor-element.industries-wrapper {
    align-items: flex-start !important;
}

/* New Elementor Flexbox Containers (e-con) */
.e-con.industries-wrapper,
.e-con.industries-sidebar,
.e-con.industries-content {
    overflow: visible !important;
}

.e-con.industries-sidebar {
    position: sticky !important;
    align-self: flex-start !important;
}

/* Inner wrappers Elementor generates */
.industries-wrapper > .e-con-inner,
.industries-wrapper .elementor-container,
.industries-wrapper .elementor-row {
    overflow: visible !important;
    align-items: flex-start !important;
    width: 100%;
}

.industries-sidebar.e-con,
.industries-sidebar > .e-con-inner {
    overflow: visible !important;
}
