.ytfb {
    --ytfb-height: 320px;
    --ytfb-height-mobile: 280px;
    --ytfb-radius: 8px;
    --ytfb-duration: 600ms;
    --ytfb-image-fit: cover;
    --ytfb-parallax-bleed: 80px;
    position: relative;
    min-height: var(--ytfb-height);
    perspective: 1200px;
    outline: none;
}

.ytfb__motion {
    position: relative;
    width: 100%;
    min-height: var(--ytfb-height);
}

.ytfb__inner {
    position: relative;
    width: 100%;
    min-height: var(--ytfb-height);
    transform-style: preserve-3d;
    transition: transform var(--ytfb-duration) cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ytfb[data-trigger="hover"]:is(:hover, :focus-within) .ytfb__inner,
.ytfb[data-trigger="hover"].is-flipped .ytfb__inner,
.ytfb[data-trigger="click"].is-flipped .ytfb__inner {
    transform: rotateY(180deg);
}

.ytfb--vertical[data-trigger="hover"]:is(:hover, :focus-within) .ytfb__inner,
.ytfb--vertical[data-trigger="hover"].is-flipped .ytfb__inner,
.ytfb--vertical[data-trigger="click"].is-flipped .ytfb__inner {
    transform: rotateX(180deg);
}

.ytfb[data-trigger="click"],
.ytfb--mobile-tap {
    cursor: pointer;
    touch-action: manipulation;
}

.ytfb:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 4px;
}

.ytfb__face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    overflow: hidden;
    min-height: var(--ytfb-height);
    color: var(--ytfb-text-color, #fff);
    background: #1f2937;
    border-radius: var(--ytfb-radius);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.ytfb__face--back {
    transform: rotateY(180deg);
    pointer-events: none;
}

.ytfb__face--image-only {
    align-items: center;
    background: transparent;
    justify-content: center;
}

.ytfb__face--image-only .ytfb__image {
    object-fit: contain;
}

.ytfb--vertical .ytfb__face--back {
    transform: rotateX(180deg);
}

.ytfb[data-trigger="hover"]:is(:hover, :focus-within) .ytfb__face--front,
.ytfb[data-trigger="hover"].is-flipped .ytfb__face--front,
.ytfb[data-trigger="click"].is-flipped .ytfb__face--front {
    pointer-events: none;
}

.ytfb[data-trigger="hover"]:is(:hover, :focus-within) .ytfb__face--back,
.ytfb[data-trigger="hover"].is-flipped .ytfb__face--back,
.ytfb[data-trigger="click"].is-flipped .ytfb__face--back {
    pointer-events: auto;
}

.ytfb__image,
.ytfb__overlay {
    position: absolute;
    inset: 0;
}

.ytfb__image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: var(--ytfb-image-fit);
}

.ytfb__image--parallax {
    inset: calc(var(--ytfb-parallax-bleed) / -2);
    width: calc(100% + var(--ytfb-parallax-bleed));
    height: calc(100% + var(--ytfb-parallax-bleed));
    max-width: none;
}

.ytfb--fit-contain .ytfb__image--parallax {
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: 100%;
}

.ytfb--image-only-width .ytfb__face--image-only .ytfb__image {
    position: relative;
    inset: auto;
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: none;
}

.ytfb--image-only-height .ytfb__face--image-only .ytfb__image {
    position: relative;
    inset: auto;
    width: auto;
    max-width: none;
    height: 100%;
    max-height: 100%;
}

.ytfb__face--front .ytfb__image {
    object-position: var(--ytfb-front-position);
}

.ytfb__face--back .ytfb__image {
    object-position: var(--ytfb-back-position);
}

.ytfb__overlay {
    z-index: 1;
    background: var(--ytfb-overlay, rgba(15, 23, 42, 0.45));
}

.ytfb__content {
    position: relative;
    z-index: 2;
    box-sizing: border-box;
    width: 100%;
    padding: clamp(1rem, 4%, 2rem);
    color: inherit;
}

.ytfb--position-top .ytfb__face {
    justify-content: flex-start;
}

.ytfb--position-bottom .ytfb__face {
    justify-content: flex-end;
}

.ytfb--align-left .ytfb__content {
    text-align: left;
}

.ytfb--align-center .ytfb__content {
    text-align: center;
}

.ytfb--align-right .ytfb__content {
    text-align: right;
}

.ytfb__meta {
    margin-bottom: 0.35rem;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.3;
    text-transform: uppercase;
}

.ytfb__title {
    margin: 0;
    color: inherit;
    font-size: 1.65rem;
    line-height: 1.15;
    letter-spacing: 0;
}

.ytfb__body {
    margin-top: 0.75rem;
    color: inherit;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.ytfb__body > :first-child {
    margin-top: 0;
}

.ytfb__body > :last-child {
    margin-bottom: 0;
}

.ytfb__action {
    margin: 1rem 0 0;
}

.ytfb__button {
    max-width: 100%;
    white-space: normal;
}

.ytfb--shadow-none .ytfb__face {
    box-shadow: none;
}

.ytfb--shadow-small .ytfb__face {
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
}

.ytfb--shadow-medium .ytfb__face {
    box-shadow: 0 14px 35px rgba(15, 23, 42, 0.18);
}

.ytfb--shadow-large .ytfb__face {
    box-shadow: 0 22px 55px rgba(15, 23, 42, 0.24);
}

.ytfb .ytfb__face--image-only {
    box-shadow: none;
}

@media (max-width: 640px) {
    .ytfb,
    .ytfb__motion,
    .ytfb__inner,
    .ytfb__face {
        min-height: var(--ytfb-height-mobile);
    }

    .ytfb__title {
        font-size: 1.35rem;
    }

    .ytfb__content {
        padding: 1rem;
    }

    .ytfb__face {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ytfb--mobile-stack {
        min-height: 0;
        perspective: none;
        cursor: auto;
    }

    .ytfb--mobile-stack .ytfb__motion {
        min-height: 0;
    }

    .ytfb--mobile-stack .ytfb__inner {
        display: grid;
        gap: 1rem;
        min-height: 0;
        transform: none !important;
        transform-style: flat;
    }

    .ytfb--mobile-stack .ytfb__face {
        position: relative;
        min-height: var(--ytfb-height-mobile);
        transform: none;
        backface-visibility: visible;
        -webkit-backface-visibility: visible;
        pointer-events: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ytfb__inner {
        transition: none;
    }
}
