/* Block Flex front-end: isolated, deterministic CSS Grid layout. */
.bf-layout {
    display: block !important;
    position: relative;
    width: var(--bf-width, 100%) !important;
    max-width: var(--bf-max-width, 1440px) !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    background: var(--bf-background, transparent);
    padding: 0 !important;
    clear: both;
}
.bf-layout, .bf-layout *, .bf-layout *::before, .bf-layout *::after { box-sizing: border-box !important; }
.bf-layout.bf-align-left { margin-left: 0 !important; margin-right: auto !important; }
.bf-layout.bf-align-center { margin-left: auto !important; margin-right: auto !important; }
.bf-layout.bf-align-right { margin-left: auto !important; margin-right: 0 !important; }
.bf-layout .bf-grid {
    display: grid !important;
    grid-template-columns: repeat(12, minmax(0, 1fr)) !important;
    grid-auto-rows: 12px !important;
    grid-auto-flow: row !important;
    gap: var(--bf-gap, 18px) !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    align-content: start !important;
    align-items: stretch !important;
    justify-content: stretch !important;
    overflow: visible;
}
.bf-layout .bf-grid > .bf-tile {
    display: block !important;
    position: relative !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    overflow: hidden !important;
    border-radius: var(--bf-radius, 0px) !important;
    background: #f1f3f5;
    isolation: isolate;
    grid-column: var(--bf-d-col-start, 1) / span var(--bf-d-cols, 4) !important;
    grid-row: var(--bf-d-row-start, 1) / span var(--bf-d-rows, 20) !important;
}
.bf-layout .bf-tile-link {
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    color: inherit;
    text-decoration: none;
}
.bf-layout .bf-grid > .bf-tile > .bf-image,
.bf-layout .bf-grid > .bf-tile .bf-tile-link > .bf-image {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    object-fit: var(--bf-fit, cover) !important;
    object-position: var(--bf-position, center) !important;
}
.bf-layout .bf-tile-title {
    position: absolute;
    z-index: 2;
    left: 0;
    right: 0;
    bottom: 0;
    display: block;
    padding: 12px 14px;
    color: #fff;
    font-size: clamp(13px, 1.4vw, 20px);
    font-weight: 700;
    line-height: 1.25;
    background: linear-gradient(transparent, rgba(0,0,0,.65));
    pointer-events: none;
}
.bf-layout .bf-tile a:focus-visible { outline: 3px solid #2271b1; outline-offset: -3px; }
.bf-layout .bf-tile a:hover .bf-image { filter: brightness(.96); }

/* Desktop/tablet deliberately preserve the saved 12-column coordinates. */
@media (min-width: 681px) {
    .bf-layout .bf-grid { grid-template-columns: repeat(12, minmax(0, 1fr)) !important; }
}

/* Mobile gets an independent stacking/order system; images never stretch out of proportion. */
@media (max-width: 680px) {
    .bf-layout {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    .bf-layout .bf-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        grid-auto-rows: 11px !important;
        grid-auto-flow: row !important;
        gap: var(--bf-gap, 12px) !important;
    }
    .bf-layout .bf-grid > .bf-tile {
        grid-column: span var(--bf-m-cols, 4) !important;
        grid-row: span var(--bf-m-rows, 18) !important;
        order: var(--bf-m-order, 1) !important;
        min-width: 0 !important;
    }
    .bf-layout .bf-tile-title { font-size: 14px; padding: 9px 10px; }
}

/* Nested container system — isolated from theme and page-builder styles. */
.bf-layout-nested .bf-composition,
.bf-layout-nested .bf-composition * { box-sizing: border-box !important; }
.bf-layout-nested .bf-composition {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: var(--bf-gap, 18px) !important;
    position: relative !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
}
.bf-layout-nested .bf-node {
    position: relative;
    flex: 0 1 var(--bf-node-width, 100%);
    width: var(--bf-node-width, 100%);
    max-width: 100%;
    min-width: 0 !important;
    min-height: 0;
    height: var(--bf-node-height, auto);
    min-height: var(--bf-node-min-height, 0px);
    border-radius: var(--bf-node-radius, 0px);
    overflow: var(--bf-node-overflow, hidden);
    color: var(--bf-node-text-color, inherit);
}
.bf-layout-nested .bf-node-container {
    display: flex !important;
    flex-direction: var(--bf-node-direction, row) !important;
    flex-wrap: var(--bf-node-wrap, wrap) !important;
    justify-content: var(--bf-node-justify, flex-start) !important;
    align-items: var(--bf-node-align, stretch) !important;
    gap: var(--bf-node-gap, 12px) !important;
    padding: var(--bf-node-padding, 16px) !important;
    background-color: var(--bf-node-bg, transparent) !important;
    position: relative !important;
    isolation: isolate;
}
.bf-layout-nested .bf-node-container > .bf-node-background-image,
.bf-layout-nested .bf-node-container > .bf-node-background-video,
.bf-layout-nested .bf-node-container > .bf-node-background-embed,
.bf-layout-nested .bf-node-container > .bf-node-overlay {
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
    margin: 0 !important;
}
.bf-layout-nested .bf-node-background-image { object-fit: var(--bf-node-background-fit, contain) !important; object-position: center !important; }
.bf-layout-nested .bf-node-background-video { object-fit: var(--bf-node-background-fit, contain) !important; }
.bf-layout-nested .bf-node-background-embed { position: absolute !important; inset: 0 !important; width: 100% !important; height: 100% !important; border: 0 !important; pointer-events: none !important; }
.bf-layout-nested .bf-node-children {
    display: flex !important;
    flex-direction: var(--bf-node-direction, row) !important;
    flex-wrap: var(--bf-node-wrap, wrap) !important;
    justify-content: var(--bf-node-justify, flex-start) !important;
    align-items: var(--bf-node-align, stretch) !important;
    gap: var(--bf-node-gap, 12px) !important;
    position: relative !important;
    z-index: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    height: 100%;
    display: var(--bf-node-children-display, flex) !important;
}
.bf-layout-nested .bf-node-container[data-layout-mode="grid"] .bf-node-children {
    display: grid !important;
    grid-template-columns: repeat(var(--bf-node-grid-columns, 2), minmax(0, 1fr)) !important;
    align-items: var(--bf-node-align, stretch) !important;
    justify-content: stretch !important;
}
.bf-layout-nested .bf-node-container[data-layout-mode="block"] .bf-node-children {
    display: block !important;
}
.bf-layout-nested .bf-node-container[data-layout-mode="block"] .bf-node-children > .bf-node {
    display: block !important;
    width: var(--bf-node-width, 100%) !important;
    margin-bottom: var(--bf-node-gap, 12px) !important;
}
.bf-layout-nested .bf-node-children > .bf-node,
.bf-layout-nested .bf-composition > .bf-node {
    flex: 0 1 var(--bf-node-width, 100%);
    width: var(--bf-node-width, 100%);
    max-width: 100%;
    min-width: 0 !important;
    grid-column: span var(--bf-node-grid-span, 1);
}
.bf-layout-nested .bf-node[data-position="absolute"] {
    position: absolute !important;
    top: var(--bf-node-top, 0px) !important;
    right: var(--bf-node-right, auto) !important;
    bottom: var(--bf-node-bottom, auto) !important;
    left: var(--bf-node-left, 0px) !important;
    z-index: var(--bf-node-z, 1) !important;
    flex: none !important;
}
.bf-layout-nested .bf-node-image-link,
.bf-layout-nested .bf-node-image {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 100%;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
}
.bf-layout-nested .bf-node-image { object-fit: var(--bf-node-fit, contain) !important; object-position: center !important; }
.bf-layout-nested .bf-node-text {
    display: block;
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: normal;
    margin: 0 !important;
    padding: 0;
    color: var(--bf-node-text-color, #222222) !important;
    font-size: var(--bf-node-font-size, 16px) !important;
    font-weight: var(--bf-node-font-weight, 400) !important;
    text-align: var(--bf-node-text-align, left) !important;
    line-height: 1.45;
    overflow-wrap: anywhere !important;
    word-break: normal;
    white-space: normal;
}
.bf-layout-nested .bf-node-button {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    max-width: 100% !important;
    width: auto !important;
    min-height: 0 !important;
    padding: var(--bf-node-btn-py, 9px) var(--bf-node-btn-px, 16px) !important;
    color: var(--bf-node-btn-color, #ffffff) !important;
    background: var(--bf-node-btn-bg, #1769aa) !important;
    border: 0 !important;
    border-radius: var(--bf-node-btn-radius, 6px) !important;
    font-size: var(--bf-node-btn-font, 14px) !important;
    line-height: 1.2 !important;
    text-align: center !important;
    text-decoration: none !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    cursor: pointer;
}
.bf-layout-nested .bf-node-social-list { display: flex !important; flex-wrap: wrap !important; align-items: center !important; gap: 7px !important; min-width: 0 !important; }
.bf-layout-nested .bf-node-social-link {
    display: inline-flex !important;
    flex: 0 1 auto !important;
    align-items: center !important;
    gap: 6px !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 5px 9px !important;
    border-radius: 999px !important;
    background: #f0f2f5 !important;
    color: #26313d !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
    text-decoration: none !important;
    overflow-wrap: anywhere;
}
.bf-layout-nested .bf-node-social-link > span:first-child { display: grid; place-items: center; width: 20px; height: 20px; flex: 0 0 20px; border-radius: 50%; background: #24364b; color: #fff; font-size: 9px; font-weight: 700; }
.bf-layout-nested .bf-node-social-label { min-width: 0; }
.bf-layout-nested .bf-node-shortcode,
.bf-layout-nested .bf-node-shortcode > * { max-width: 100% !important; min-width: 0 !important; box-sizing: border-box !important; }
.bf-layout-nested .bf-node-shortcode img,
.bf-layout-nested .bf-node-shortcode iframe,
.bf-layout-nested .bf-node-shortcode video { max-width: 100% !important; }
.bf-layout-nested .bf-node-shortcode input,
.bf-layout-nested .bf-node-shortcode select,
.bf-layout-nested .bf-node-shortcode textarea { max-width: 100% !important; }
@media (max-width: 680px) {
    .bf-layout-nested .bf-composition { width: 100% !important; }
    .bf-layout-nested .bf-node {
        flex-basis: var(--bf-node-mobile-width, 100%) !important;
        width: var(--bf-node-mobile-width, 100%) !important;
        height: var(--bf-node-mobile-height, auto) !important;
        max-width: 100% !important;
    }
    .bf-layout-nested .bf-node-container,
    .bf-layout-nested .bf-node-children {
        flex-direction: var(--bf-node-mobile-direction, column) !important;
    }
    .bf-layout-nested .bf-node-container[data-mobile-layout-mode="grid"] .bf-node-children {
        display: grid !important;
        grid-template-columns: repeat(var(--bf-node-mobile-grid-columns, 1), minmax(0, 1fr)) !important;
    }
    .bf-layout-nested .bf-node-container[data-mobile-layout-mode="block"] .bf-node-children { display: block !important; }
    .bf-layout-nested .bf-node[data-position="absolute"][data-mobile-position="flow"] {
        position: relative !important;
        inset: auto !important;
        flex: 0 1 var(--bf-node-mobile-width, 100%) !important;
        width: var(--bf-node-mobile-width, 100%) !important;
        max-width: 100% !important;
    }
    .bf-layout-nested .bf-node-children > .bf-node { grid-column: span var(--bf-node-mobile-grid-span, 1); }
    .bf-layout-nested .bf-node-text { font-size: var(--bf-node-mobile-font-size, 15px) !important; }
    .bf-layout-nested .bf-node-social-link { padding: 4px 7px !important; font-size: 11px !important; }
}

/* Block Flex 0.2.2: overlay children are positioned against their parent container. */
.bf-layout-nested .bf-node-container{position:relative!important;isolation:isolate!important}
.bf-layout-nested .bf-node-container>.bf-node-children{position:static!important;height:auto!important;z-index:auto!important}
.bf-layout-nested .bf-node-children>.bf-node:not([data-position="absolute"]){position:relative;z-index:1}
.bf-layout-nested .bf-node-shortcode{display:block!important;width:100%;max-width:100%!important;min-width:0!important;overflow-wrap:anywhere}
.bf-layout-nested .bf-node-shortcode form,.bf-layout-nested .bf-node-shortcode .wpforms-container,.bf-layout-nested .bf-node-shortcode .wpcf7{max-width:100%!important;min-width:0!important}

/* v0.2.3: image elements can host overlay children (shortcodes, text, buttons or nested containers). */
.bf-layout-nested .bf-node-image-stage{position:relative;width:100%;height:100%;min-width:0;line-height:0}
.bf-layout-nested .bf-node-image-stage>.bf-node-image-link{display:block;width:100%;height:100%;max-width:100%;line-height:0}
.bf-layout-nested .bf-node-image-stage>.bf-node-image-link img{display:block;width:100%;height:100%;max-width:100%;object-fit:var(--bf-node-fit,contain)}
.bf-layout-nested .bf-node-image-stage>.bf-node-image{display:block;width:100%;height:100%;max-width:100%;object-fit:var(--bf-node-fit,contain)}
.bf-layout-nested .bf-node-image-children{position:static!important;height:auto!important;z-index:auto!important}
.bf-layout-nested .bf-node-image-children>.bf-node[data-position="absolute"]{position:absolute!important}
.bf-layout-nested .bf-node-image-children>.bf-node:not([data-position="absolute"]){position:relative;z-index:1}


/* BLOCK FLEX 0.2.4 — image-child widgets are rendered as a positioned overlay layer. */
.bf-layout-nested .bf-node-image{position:relative!important;isolation:isolate}
.bf-layout-nested .bf-node-image-stage{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;min-width:0!important;line-height:0!important;z-index:0!important}
.bf-layout-nested .bf-node-image-stage>.bf-node-image-link,
.bf-layout-nested .bf-node-image-stage>.bf-node-image{display:block!important;width:100%!important;height:100%!important;max-width:100%!important}
.bf-layout-nested .bf-node-image-stage img{display:block!important;width:100%!important;height:100%!important;object-fit:var(--bf-node-fit,contain)!important}
.bf-layout-nested .bf-node-image-children{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;z-index:4!important;pointer-events:none}
.bf-layout-nested .bf-node-image-children>.bf-node{pointer-events:auto}
.bf-layout-nested .bf-node-image-children>.bf-node[data-position="absolute"]{position:absolute!important;top:var(--bf-node-top,0px)!important;right:var(--bf-node-right,auto)!important;bottom:var(--bf-node-bottom,auto)!important;left:var(--bf-node-left,0px)!important;z-index:var(--bf-node-z,1)!important}
