/*
Theme Name: Smart Child
Theme URI: https://portfolio.michaelcbarber.com/
Description: Child theme for the Smart WordPress theme, customized for Michael C. Barber's portfolio.
Author: Michael C. Barber
Template: smart
Version: 1.9.0
Text Domain: smart-child
*/

/*
Add portfolio-specific CSS customizations below this line.
*/




/* =========================================================
   Case Study Sticky Sidebar — Elementor Hardened
   Parent Container class: case-study-layout
   Sidebar Container class: case-study-sidebar
   No Elementor Pro required.
   ========================================================= */

/* Sticky positioning cannot escape an ancestor that clips overflow. */
body .elementor .case-study-layout,
body .elementor .case-study-layout > .e-con-inner,
body .elementor .case-study-layout .e-con-inner {
    overflow: visible !important;
}

/*
 * Keep the layout container from stretching the sticky sidebar in a way that
 * prevents it from moving independently while the main column scrolls.
 */
body .elementor .case-study-layout {
    align-items: flex-start !important;
}

/* The actual sticky navigation rail. */
body .elementor .case-study-sidebar {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 100px !important;

    align-self: flex-start !important;
    height: fit-content !important;
    min-height: 0 !important;
    max-height: calc(100vh - 120px);

    flex-grow: 0 !important;
    flex-shrink: 0;
    z-index: 20;
}

/*
 * Disable sticky behavior on tablet/mobile, where the navigation usually
 * stacks with the case-study content.
 */
@media (max-width: 1024px) {
    body .elementor .case-study-sidebar {
        position: static !important;
        top: auto !important;
        max-height: none;
        height: auto !important;
    }
}


/* =========================================================
   Smart Theme Sticky Compatibility Fix
   Smart's parent stylesheet sets .wrapper { overflow: hidden; },
   which creates an ancestor that prevents CSS sticky from
   following the viewport. Limit the override to Portfolio
   case-study pages so the rest of Smart retains its defaults.
   ========================================================= */

body.single-portfolio {
    overflow-x: clip !important;
}

body.single-portfolio .wrapper {
    overflow-x: clip !important;
    overflow-y: visible !important;
}

/* Older-browser fallback where overflow: clip is unsupported. */
@supports not (overflow: clip) {
    body.single-portfolio {
        overflow-x: visible !important;
    }

    body.single-portfolio .wrapper {
        overflow: visible !important;
    }
}


/* =========================================================
   Case Study Sticky Sidebar — JS fallback support
   v1.9 uses JavaScript fixed positioning because Smart's
   legacy layout can defeat native CSS sticky.
   ========================================================= */

.mcb-sticky-placeholder {
    display: none;
    visibility: hidden;
    pointer-events: none;
}

.case-study-sidebar.mcb-js-sticky {
    position: fixed !important;
    margin: 0 !important;
    z-index: 999 !important;
}

@media (max-width: 1024px) {
    .mcb-sticky-placeholder {
        display: none !important;
    }

    .case-study-sidebar.mcb-js-sticky {
        position: static !important;
        width: auto !important;
        left: auto !important;
        top: auto !important;
    }
}
