/* Facebook Feed — kabdalis2 design system (2026-06-11 redesign).
   Clean responsive card-grid:
   - Each post is its own card with image at NATURAL aspect-ratio (no cropping)
   - Grid adapts to screen width via auto-fit + minmax (1 col on mobile,
     2-4 cols on tablet/desktop based on available space)
   - No dark overlays, no backdrop-blur, no fixed widget height
   - Image fills card width; height varies per image (portrait, landscape,
     square all rendered as-is)
   view.js adds .fb (no .b-card frame — the cards themselves are the surface). */

.kabdalis-facebook-feed.fb{
    display: block;
    width: 100%;
}

/* Optional outer header (rendered only if widget editor sets headerText) */
.facebook-feed-container,
.facebook-feed-container-wrapper{
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.facebook-feed-header{
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 4px;
}
.facebook-feed-header h2,
.facebook-feed-header h3{
    font-family: var(--font-display);
    font-weight: var(--display-w);
    letter-spacing: var(--display-ls);
    font-size: 1.3rem;
    line-height: 1.15;
    margin: 0;
    color: var(--ink);
}

/* ── Post grid ──────────────────────────────────────────────────────── */

.facebook-posts-list{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: clamp(16px, 2vw, 22px);
    align-items: start; /* each card sizes to its own image height */
}

.no-posts-message,
.loading-message{
    padding: 24px;
    text-align: center;
    color: var(--muted);
    font-style: italic;
    grid-column: 1 / -1;
}

/* ── Single post card ────────────────────────────────────────────────── */

.fb-post{
    display: flex;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .25s cubic-bezier(.2,.7,.2,1),
                box-shadow .25s ease,
                border-color .25s ease;
}
.fb-post:hover{
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent) 25%, var(--line));
    box-shadow: 0 20px 38px -22px color-mix(in srgb, var(--ink) 30%, transparent);
}
.fb-post-link{
    display: flex;
    flex-direction: column;
    width: 100%;
    color: inherit;
    text-decoration: none;
}

/* ── Media ──────────────────────────────────────────────────────────── */

.fb-post-media{
    position: relative;
    width: 100%;
    background: var(--surface2);
    /* Cap very tall portraits so the card stays balanced — image still
       shows in full, just constrained at the bottom on extreme ratios. */
    max-height: 520px;
    overflow: hidden;
}
.fb-post-image{
    display: block;
    width: 100%;
    height: auto;            /* natural aspect-ratio preserved */
    max-height: 520px;
    object-fit: cover;       /* falls back to crop if max-height engages */
    object-position: center;
    transition: transform .55s cubic-bezier(.2,.7,.2,1);
}
.fb-post:hover .fb-post-image{ transform: scale(1.025); }

/* Video play badge — small accent-circle in bottom-right of media */
.fb-post-video-badge{
    position: absolute;
    bottom: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 92%, transparent);
    color: var(--on-accent);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--ink) 40%, transparent);
}
.fb-post-video-badge i{
    font-size: .95rem;
    line-height: 1;
    padding-left: 2px; /* optical centering */
}

/* "+N" indicator when post has multiple images */
.fb-post-more-badge{
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .03em;
}

/* ── Card body ──────────────────────────────────────────────────────── */

.fb-post-body{
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.fb-post-message{
    margin: 0;
    color: var(--ink);
    font-size: .92rem;
    line-height: 1.5;
    /* Cap visual height with a 4-line clamp on cards that have an image. */
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
/* When no image, allow text to flow longer */
.fb-post:not(:has(.fb-post-media)) .fb-post-message{
    -webkit-line-clamp: unset;
    font-size: .95rem;
}

.fb-post-meta{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    font-size: .78rem;
    color: var(--ink-soft);
}

.fb-post-cta{
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: .01em;
}
.fb-post-cta .facebook-brand-icon{
    width: 14px;
    height: 14px;
    color: currentColor;
}

.fb-post-stats{
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--muted);
}
.fb-post-stat{
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--font-mono);
    font-size: .72rem;
    letter-spacing: .02em;
    white-space: nowrap;
}
.fb-post-stat i{ font-size: .72rem; }
.fb-post-date{ color: var(--muted); }

/* ── Empty / error state ───────────────────────────────────────────── */

.fb-empty{
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    padding: 32px 24px;
    border-radius: var(--radius);
    background: color-mix(in srgb, var(--accent) 5%, var(--surface));
    border: 1px solid var(--line);
}
.fb-empty-icon{
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
}
.fb-empty-icon .facebook-brand-icon{
    width: 26px;
    height: 26px;
    color: currentColor;
}
.fb-empty-text{
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 480px;
}
.fb-empty-title{
    font-family: var(--font-display);
    font-weight: var(--display-w);
    letter-spacing: var(--display-ls);
    font-size: 1.05rem;
    color: var(--ink);
    line-height: 1.25;
}
.fb-empty-body{
    margin: 0;
    color: var(--ink-soft);
    line-height: 1.55;
    font-size: .9rem;
}

/* ── Wide-screen tuning ─────────────────────────────────────────────── */

/* Comfort mode on extra-wide screens — let images breathe a bit more */
@media (min-width: 1280px){
    .facebook-posts-list{
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}
