.bfba {
    --bfba-border-width: var(--section-border, 2px);
    --bfba-radius: var(--card-radius, 24px);
    --bfba-gap: var(--site-grid-gap, 1rem);
    --bfba-button-border: var(--button-border-color, #111);
    --bfba-button-bg: var(--button-bg-color, #fff);
    --bfba-button-text: var(--button-text-color, #111);
    --bfba-button-hover-bg: var(--button-hover-bg-color, #111);
    --bfba-button-hover-text: var(--button-hover-text-color, #fff);
    --bfba-font-nav: var(--font-family-navigation, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    --bfba-font-body: var(--font-family-body, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
    --bfba-position: 50%;
    --bfba-object-x: 50%;
    --bfba-object-y: 50%;
    display: block;
    margin: 0 0 var(--bfba-gap);
    font-family: var(--bfba-font-body);
}

.bfba-stage,
.bfba-side-grid {
    border: var(--bfba-border-width) solid var(--bfba-button-border);
    border-radius: var(--bfba-radius);
    background: #fff;
    overflow: hidden;
    box-sizing: border-box;
}

.bfba-stage {
    position: relative;
    aspect-ratio: var(--bfba-aspect-ratio, 16 / 9);
    width: 100%;
    touch-action: none;
    user-select: none;
}

.bfba-layer {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.bfba-layer--before {
    z-index: 1;
}

.bfba-layer--after {
    z-index: 2;
    clip-path: inset(0 0 0 var(--bfba-position));
}

.bfba--hover .bfba-layer--after {
    clip-path: none;
    opacity: 0;
    transition: opacity 220ms ease-in-out;
}

.bfba--hover.bfba--reveal-hover .bfba-stage:hover .bfba-layer--after,
.bfba--hover.bfba--reveal-hover .bfba-stage:focus .bfba-layer--after,
.bfba--hover.bfba--reveal-hover .bfba-stage:focus-within .bfba-layer--after,
.bfba--hover.bfba--reveal-auto .bfba-stage:hover .bfba-layer--after,
.bfba--hover.bfba--reveal-auto .bfba-stage:focus .bfba-layer--after,
.bfba--hover.bfba--reveal-auto .bfba-stage:focus-within .bfba-layer--after,
.bfba--hover.is-revealed .bfba-layer--after {
    opacity: 1;
}

.bfba-media {
    width: 100%;
    height: 100%;
    display: block;
    max-width: none;
    object-position: var(--bfba-object-x, 50%) var(--bfba-object-y, 50%);
}

.bfba-side-panel {
    --bfba-panel-object-x: var(--bfba-object-x, 50%);
    --bfba-panel-object-y: var(--bfba-object-y, 50%);
}

.bfba-side-panel .bfba-media {
    object-position: var(--bfba-panel-object-x, var(--bfba-object-x, 50%)) var(--bfba-panel-object-y, var(--bfba-object-y, 50%));
}

.bfba--fit-cover .bfba-media {
    object-fit: cover;
}

.bfba--fit-contain .bfba-media {
    object-fit: contain;
    background: #000;
}

.bfba-label,
.bfba-hover-hint {
    position: absolute;
    z-index: 4;
    left: 1rem;
    top: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 1.32rem;
    padding: 0.24rem 0.58rem;
    border: 0;
    border-radius: 999px;
    background: #000;
    color: #fff;
    font-family: var(--bfba-font-nav);
    font-size: 0.78rem;
    font-weight: 500;
    line-height: 1.05;
    text-align: center;
    text-transform: none;
    letter-spacing: 0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: geometricPrecision;
}

.bfba-label--after {
    left: auto;
    right: 1rem;
}

.bfba--hover .bfba-layer--before .bfba-label,
.bfba--hover .bfba-layer--after .bfba-label {
    left: 50%;
    right: auto;
    top: 1rem;
    transform: translateX(-50%);
    transition: opacity 220ms ease-in-out;
}

.bfba--hover.bfba--reveal-hover .bfba-stage:hover .bfba-layer--before .bfba-label,
.bfba--hover.bfba--reveal-hover .bfba-stage:focus .bfba-layer--before .bfba-label,
.bfba--hover.bfba--reveal-hover .bfba-stage:focus-within .bfba-layer--before .bfba-label,
.bfba--hover.bfba--reveal-auto .bfba-stage:hover .bfba-layer--before .bfba-label,
.bfba--hover.bfba--reveal-auto .bfba-stage:focus .bfba-layer--before .bfba-label,
.bfba--hover.bfba--reveal-auto .bfba-stage:focus-within .bfba-layer--before .bfba-label,
.bfba--hover.is-revealed .bfba-layer--before .bfba-label {
    opacity: 0;
}

.bfba-hover-hint {
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    transition: opacity 180ms ease;
}

.bfba--hover.bfba--reveal-hover .bfba-stage:hover .bfba-hover-hint,
.bfba--hover.bfba--reveal-hover .bfba-stage:focus .bfba-hover-hint,
.bfba--hover.bfba--reveal-hover .bfba-stage:focus-within .bfba-hover-hint,
.bfba--hover.bfba--reveal-auto .bfba-stage:hover .bfba-hover-hint,
.bfba--hover.bfba--reveal-auto .bfba-stage:focus .bfba-hover-hint,
.bfba--hover.bfba--reveal-auto .bfba-stage:focus-within .bfba-hover-hint,
.bfba--hover.is-revealed .bfba-hover-hint {
    opacity: 0;
}

.bfba-handle {
    position: absolute;
    z-index: 6;
    inset-block: 0;
    left: var(--bfba-position);
    width: 0;
    padding: 0;
    border: 0;
    background: transparent;
    color: #fff;
    cursor: ew-resize;
    transform: translateX(-50%);
}

.bfba-handle:focus-visible .bfba-handle-knob {
    outline: 3px solid currentColor;
    outline-offset: 3px;
}

.bfba-handle-line {
    position: absolute;
    inset-block: 0;
    left: 50%;
    width: 2px;
    min-width: 2px;
    background: #000;
    transform: translateX(-50%);
}

.bfba-handle-knob {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 2.32rem;
    height: 2.32rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: #000;
    color: #fff;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 1.28rem;
    font-weight: 500;
    line-height: 1;
    transform: translate(-50%, -50%);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.bfba-handle:hover .bfba-handle-knob {
    background: #000;
    color: #fff;
}

.bfba-handle-icon {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 999px;
    pointer-events: none;
}

.bfba-handle-icon + .bfba-handle-fallback {
    display: none;
}

.bfba-handle-fallback {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
}

.bfba-side-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
}

.bfba-side-panel {
    position: relative;
    aspect-ratio: var(--bfba-aspect-ratio, 16 / 9);
    min-width: 0;
    overflow: hidden;
    cursor: grab;
    touch-action: none;
}

.bfba-side-panel.is-panning {
    cursor: grabbing;
}

.bfba-side-panel + .bfba-side-panel {
    border-left: var(--bfba-border-width) solid var(--bfba-button-border);
}

.bfba-notice {
    border: 2px solid #b32d2e;
    border-radius: 14px;
    padding: 1rem;
    background: #fff;
    color: #1d2327;
}

@media (max-width: 700px) {
    .bfba-side-grid {
        grid-template-columns: 1fr;
    }

    .bfba-side-panel.is-panning {
        cursor: grabbing;
    }

    .bfba-side-panel + .bfba-side-panel {
        border-left: 0;
        border-top: var(--bfba-border-width) solid var(--bfba-button-border);
    }

    .bfba-label,
    .bfba-hover-hint {
        font-size: 0.72rem;
        min-height: 1.75rem;
        padding: 0.3rem 0.6rem;
    }

    .bfba-handle-knob {
        width: 2.7rem;
        height: 2.7rem;
    }
}



@media (hover: none), (pointer: coarse) {
    .bfba--hover.bfba--reveal-auto .bfba-stage:hover .bfba-layer--after,
    .bfba--hover.bfba--reveal-auto .bfba-stage:focus .bfba-layer--after,
    .bfba--hover.bfba--reveal-auto .bfba-stage:focus-within .bfba-layer--after {
        opacity: 0;
    }

    .bfba--hover.bfba--reveal-auto.is-revealed .bfba-layer--after {
        opacity: 1;
    }

    .bfba--hover.bfba--reveal-auto .bfba-stage:hover .bfba-layer--before .bfba-label,
    .bfba--hover.bfba--reveal-auto .bfba-stage:focus .bfba-layer--before .bfba-label,
    .bfba--hover.bfba--reveal-auto .bfba-stage:focus-within .bfba-layer--before .bfba-label {
        opacity: 1;
    }

    .bfba--hover.bfba--reveal-auto.is-revealed .bfba-layer--before .bfba-label {
        opacity: 0;
    }

    .bfba--hover.bfba--reveal-auto .bfba-stage:hover .bfba-hover-hint,
    .bfba--hover.bfba--reveal-auto .bfba-stage:focus .bfba-hover-hint,
    .bfba--hover.bfba--reveal-auto .bfba-stage:focus-within .bfba-hover-hint {
        opacity: 1;
    }

    .bfba--hover.bfba--reveal-auto.is-revealed .bfba-hover-hint {
        opacity: 0;
    }
}

.bfba--click-reveal-enabled .bfba-stage {
    cursor: pointer;
}


.bfba-fit-toggle {
    appearance: none;
    position: absolute;
    left: 50%;
    bottom: 0.75rem;
    transform: translateX(-50%);
    z-index: 8;
    display: inline-grid;
    place-items: center;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 999px;
    background: #000;
    color: #fff;
    font-family: var(--bfba-font-nav, system-ui, sans-serif);
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 0.45rem 1.2rem rgba(0, 0, 0, 0.18);
    opacity: 0.82;
    transition: opacity 160ms ease, transform 160ms ease;
}

.bfba-fit-toggle:hover,
.bfba-fit-toggle:focus-visible,
.bfba-fit-toggle.is-contain {
    opacity: 1;
    transform: translateX(-50%) scale(1.04);
}


/* v01.50 normal side-by-side fit toggle visibility */
.bfba--side {
    position: relative;
}

.bfba--side > .bfba-fit-toggle {
    display: inline-grid !important;
    visibility: visible;
    pointer-events: auto;
    z-index: 30;
    bottom: 0.65rem;
}

.bfba--side.bfba--fit-cover .bfba-side-panel .bfba-media,
.bfba--side.bfba--fit-cover .bfba-side-panel picture img {
    object-fit: cover;
}

.bfba--side.bfba--fit-contain .bfba-side-panel .bfba-media,
.bfba--side.bfba--fit-contain .bfba-side-panel picture img {
    object-fit: contain;
}

/* v01.52 pannable content hint, modelled on SlideGallery's scroll cue. */
.bfba-pan-hint {
    position: absolute;
    left: 50%;
    bottom: clamp(2.7rem, 9vh, 4.7rem);
    z-index: 24;
    display: inline-flex;
    align-items: center;
    gap: 0.72rem;
    padding: 0.62rem 1.02rem;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.64);
    color: #fff;
    font-family: var(--bfba-font-nav, system-ui, sans-serif);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    line-height: 1;
    text-transform: uppercase;
    box-shadow: 0 10px 32px rgba(0, 0, 0, 0.28);
    transform: translateX(-50%);
    pointer-events: none;
    animation: bfba-pan-hint-float 1.55s ease-in-out infinite;
}

.bfba-pan-hint[hidden] {
    display: none !important;
}

.bfba-pan-hint__icon {
    position: relative;
    display: inline-block;
    width: 2.35rem;
    height: 1.42rem;
    border: 2px solid currentColor;
    border-radius: 999px;
    opacity: 0.96;
}

.bfba-pan-hint__icon::before,
.bfba-pan-hint__icon::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 0.42rem;
    height: 0.42rem;
    border-top: 2px solid currentColor;
    border-left: 2px solid currentColor;
    opacity: 0.95;
}

.bfba-pan-hint__icon::before {
    left: 0.34rem;
    transform: translateY(-50%) rotate(-45deg);
}

.bfba-pan-hint__icon::after {
    right: 0.34rem;
    transform: translateY(-50%) rotate(135deg);
}

.bfba-pan-hint__dot {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.42rem;
    height: 0.42rem;
    border-radius: 999px;
    background: currentColor;
    transform: translate(-50%, -50%);
    animation: bfba-pan-dot-x 1.55s ease-in-out infinite;
}

.bfba-pan-hint.is-bfba-pan-y .bfba-pan-hint__icon {
    width: 1.42rem;
    height: 2.35rem;
}

.bfba-pan-hint.is-bfba-pan-y .bfba-pan-hint__icon::before,
.bfba-pan-hint.is-bfba-pan-y .bfba-pan-hint__icon::after {
    left: 50%;
    right: auto;
    top: auto;
}

.bfba-pan-hint.is-bfba-pan-y .bfba-pan-hint__icon::before {
    top: 0.35rem;
    transform: translateX(-50%) rotate(45deg);
}

.bfba-pan-hint.is-bfba-pan-y .bfba-pan-hint__icon::after {
    bottom: 0.35rem;
    transform: translateX(-50%) rotate(225deg);
}

.bfba-pan-hint.is-bfba-pan-y .bfba-pan-hint__dot {
    animation-name: bfba-pan-dot-y;
}

.bfba-pan-hint.is-bfba-pan-both .bfba-pan-hint__icon {
    width: 2.2rem;
    height: 2.2rem;
}

.bfba-pan-hint.is-bfba-pan-both .bfba-pan-hint__icon::before {
    left: 0.38rem;
    top: 0.38rem;
    transform: rotate(0deg);
}

.bfba-pan-hint.is-bfba-pan-both .bfba-pan-hint__icon::after {
    right: 0.38rem;
    bottom: 0.38rem;
    top: auto;
    transform: rotate(180deg);
}

.bfba-pan-hint.is-bfba-pan-both .bfba-pan-hint__dot {
    animation-name: bfba-pan-dot-both;
}

@keyframes bfba-pan-hint-float {
    0%, 100% { transform: translateX(-50%) translateY(0); opacity: 0.9; }
    50% { transform: translateX(-50%) translateY(0.36rem); opacity: 1; }
}

@keyframes bfba-pan-dot-x {
    0%, 100% { transform: translate(-50%, -50%) translateX(-0.42rem); opacity: 0.95; }
    50% { transform: translate(-50%, -50%) translateX(0.42rem); opacity: 0.45; }
}

@keyframes bfba-pan-dot-y {
    0%, 100% { transform: translate(-50%, -50%) translateY(-0.42rem); opacity: 0.95; }
    50% { transform: translate(-50%, -50%) translateY(0.42rem); opacity: 0.45; }
}

@keyframes bfba-pan-dot-both {
    0%, 100% { transform: translate(-50%, -50%) translate(-0.34rem, -0.34rem); opacity: 0.95; }
    50% { transform: translate(-50%, -50%) translate(0.34rem, 0.34rem); opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
    .bfba-pan-hint,
    .bfba-pan-hint__dot {
        animation: none;
    }
}


.bfba-fit-toggle {
    opacity: 0;
    pointer-events: none;
}

@media (hover: none), (pointer: coarse) {
    .bfba-fit-toggle {
        opacity: 0.72;
        pointer-events: auto;
    }
}

/* Let the Cover/Fit toggle hide again after switching into Fit/Contain mode. */
.bfba-fit-toggle.is-contain {
    opacity: 0;
    pointer-events: none;
}

.bfba-set-style-demo {
    --bfba-style-demo-gap: 0.55rem;
}
.bfba-set-style-demo__controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--bfba-style-demo-gap);
    margin: 0 0 0.85rem;
}
.bfba-set-style-demo__button {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    padding: 0.48rem 0.78rem;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.08);
    color: inherit;
    font-family: var(--bfba-font-nav, system-ui, sans-serif);
    font-size: 0.78rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.bfba-set-style-demo__button:hover,
.bfba-set-style-demo__button:focus-visible,
.bfba-set-style-demo__button.is-active {
    background: #000;
    color: #fff;
    transform: translateY(-1px);
}
.bfba-set-style-demo__view[hidden] {
    display: none !important;
}
