/**
 * BV Socials — Facebook feed card grid.
 *
 * Loads after WP Social Ninja's own feed CSS, so these rules win. Layout (column
 * count + gaps) still comes from WP Social Ninja's grid (`.wpsr-row`/`.wpsr-col-*`);
 * this file only styles the card itself.
 */

.bv-fb-card,
.bv-fb-card *,
.bv-fb-card *::before,
.bv-fb-card *::after {
    box-sizing: border-box;
}

/* Keep the grid (negative row margins + long unbroken words) from bleeding past
   the viewport on small screens. Scoped to feeds that contain a BV card. */
.wpsr-fb-feed-wrapper:has(.bv-fb-card) {
    overflow-x: clip;
}

.bv-fb-card-col {
    min-width: 0;
}

/* Card shell — also override WP Social Ninja's default `.wpsr-fb-feed-item` look. */
.bv-fb-card.wpsr-fb-feed-item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    min-width: 0;
    margin: 0;
    padding: 0 0 20px;
    background: #fff;
    border: 0;
    border-radius: 16px;
    box-shadow: none;
    overflow: visible; /* let the badge straddle the top edge */
}

/* Media */
.bv-fb-card__media {
    position: relative;
    width: 100%;
    aspect-ratio: 311 / 385;
    border-radius: 12px 12px 0 0;
    overflow: hidden;
    background: #aaaaaa;
}

@supports not (aspect-ratio: 1 / 1) {
    .bv-fb-card__media {
        height: 0;
        padding-bottom: 123.79%; /* 385 / 311 */
    }
}

.bv-fb-card__media-link {
    display: block;
    width: 100%;
    height: 100%;
}

.bv-fb-card__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@supports not (aspect-ratio: 1 / 1) {
    .bv-fb-card__media-link,
    .bv-fb-card__img,
    .bv-fb-card__media-empty {
        position: absolute;
        inset: 0;
    }
}

.bv-fb-card__media-empty {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #e9eef5, #d8dee8);
}

/* Facebook badge — centred on the top edge of the card */
.bv-fb-card__badge {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #ffffff;
    background: #1977f3;
    border: 4px solid #ffffff;
    border-radius: 50%;
}

.bv-fb-card__badge-icon {
    width: auto;
    height: 18px;
    display: block;
}

/* Body */
.bv-fb-card__body {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    padding: 0 16px;
}

.bv-fb-card__caption {
    display: -webkit-box;
    margin: 0;
    color: #000000;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 20px;
    line-height: 1.2;
    letter-spacing: -0.4px;
    text-decoration: none;
    overflow: hidden;
    overflow-wrap: anywhere;
    word-break: break-word;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

a.bv-fb-card__caption:hover,
a.bv-fb-card__caption:focus {
    color: #000000;
    text-decoration: none;
}

.bv-fb-card__time {
    color: #4a4a4a;
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-weight: 500;
    font-size: 16px;
    line-height: 1.32;
}

/* Mobile: turn the grid into a horizontal swipe slider (CSS scroll-snap, no JS).
   The track gets top padding so the badge that straddles each card isn't clipped
   by the horizontal scroll container. */
@media (max-width: 767px) {
    .wpsr-row:has(.bv-fb-card-col--slider) {
        display: flex;
        flex-wrap: nowrap;
        gap: 16px;
        margin: 0;
        padding: 28px 16px 4px;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding-left: 16px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .wpsr-row:has(.bv-fb-card-col--slider)::-webkit-scrollbar {
        display: none;
    }

    .wpsr-row:has(.bv-fb-card-col--slider) > .bv-fb-card-col--slider {
        flex: 0 0 85%;
        max-width: 85%;
        margin: 0;
        padding: 0;
        scroll-snap-align: start;
    }
}
