/* BB Blog Grid v1.8.1 */

.bb-blog-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    width: 100%;
}

/* Card — full clickable <a> */
.bb-blog-card {
    position: relative;
    display: block;
    height: 380px;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: #fff;
    transition: transform 300ms ease, box-shadow 300ms ease, border-color 300ms ease;
    will-change: transform;
}

/* Hidden img for native lazy loading */
.bb-blog-lazy {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
    z-index: -1;
}

/* Background image layer */
.bb-blog-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-color: #1a1a1a;
    transition: transform 450ms ease, filter 450ms ease;
    will-change: transform;
}

/* Hover zoom */
.bb-blog-card.bb-zoom:hover .bb-blog-image {
    transform: scale(1.06);
}

/* Optional gradient overlay across image */
.bb-blog-gradient {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 60%);
}

/* Content overlay — default bottom, grows upward because it's anchored to bottom:0 */
.bb-blog-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 28px;
    background: rgba(0, 0, 0, 0.70);
    transition: background 350ms ease, padding 350ms ease, transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
    z-index: 2;
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.bb-blog-card:hover .bb-blog-overlay {
    background: rgba(0, 0, 0, 0.85);
}

/* Overlay position: top */
.bb-overlay-pos-top .bb-blog-overlay {
    top: 0;
    bottom: auto;
}

/* Overlay position: full card */
.bb-overlay-pos-full .bb-blog-overlay {
    inset: 0;
    justify-content: flex-end;
}

/* Meta row */
.bb-blog-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.75);
    transition: color 300ms ease, transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.bb-blog-sep {
    opacity: 0.5;
    margin: 0 4px;
}

/* Title */
.bb-blog-title {
    margin: 0;
    padding: 0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1.35;
    color: #fff;
    transition: color 300ms ease, transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
    will-change: transform;
}

/* Title line clamp — shows N lines in standby, full title on hover.
   The line count comes from --bb-title-lines (set by Elementor control) so
   the hover rule below can override the box model without an inline-style
   specificity fight. */
.bb-title-clamp-yes .bb-blog-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    -webkit-line-clamp: var(--bb-title-lines, 2);
    line-clamp: var(--bb-title-lines, 2);
}

/* On hover, fully unwind the -webkit-box clamp. Just setting line-clamp:unset
   isn't reliable across browsers when display:-webkit-box + overflow:hidden
   are still in effect, so reset those too. */
.bb-title-clamp-yes .bb-blog-card:hover .bb-blog-title,
.bb-title-clamp-yes .bb-blog-card:focus-visible .bb-blog-title {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

/* Word-limited title: swap short and full versions on hover */
.bb-blog-title--has-full .bb-blog-title-full {
    display: none;
}

.bb-blog-card:hover .bb-blog-title--has-full .bb-blog-title-short,
.bb-blog-card:focus-visible .bb-blog-title--has-full .bb-blog-title-short {
    display: none;
}

.bb-blog-card:hover .bb-blog-title--has-full .bb-blog-title-full,
.bb-blog-card:focus-visible .bb-blog-title--has-full .bb-blog-title-full {
    display: inline;
}

/* Excerpt — default visible */
.bb-blog-excerpt {
    margin: 8px 0 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.65);
    transition: max-height 450ms cubic-bezier(0.22, 1, 0.36, 1),
                opacity 300ms ease 80ms,
                margin-top 450ms cubic-bezier(0.22, 1, 0.36, 1),
                transform 450ms cubic-bezier(0.22, 1, 0.36, 1),
                color 300ms ease;
}

/* Read More — visual element inside the card link, always visible in standby.
   Sits directly under the title so users know the card is clickable. */
.bb-blog-readmore-wrap {
    display: block;
    margin-top: 10px;
}

.bb-blog-readmore {
    display: inline-block;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    color: #fff;
    transition: background 250ms ease, color 250ms ease, border-color 250ms ease, transform 250ms ease, text-decoration-color 250ms ease, box-shadow 250ms ease;
    will-change: transform;
}

/* Button variant — boxed with background, border, padding */
.bb-readmore-style-button .bb-blog-readmore {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    text-decoration: none;
}

.bb-readmore-style-button .bb-blog-card:hover .bb-blog-readmore {
    background: rgba(255, 255, 255, 0.22);
}

/* Text / link variant — no box, just text with optional underline */
.bb-readmore-style-text .bb-blog-readmore {
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.bb-readmore-style-text .bb-blog-readmore::after {
    content: " \2192"; /* right arrow */
    display: inline-block;
    transition: transform 250ms ease;
}

.bb-readmore-style-text .bb-blog-card:hover .bb-blog-readmore::after {
    transform: translateX(3px);
}

/* =========================================================
   HOVER REVEAL MODE
   The excerpt is hidden at rest and expands on hover.
   Because the overlay is anchored to bottom:0, the overlay
   grows UPWARD — the title visually slides up, and the
   excerpt appears covering part of the image.
   ========================================================= */
.bb-hover-reveal-yes .bb-blog-excerpt {
    max-height: 0;
    opacity: 0;
    margin-top: 0 !important;
    overflow: hidden;
    transform: translateY(8px);
    pointer-events: none;
}

.bb-hover-reveal-yes .bb-blog-card:hover .bb-blog-excerpt,
.bb-hover-reveal-yes .bb-blog-card:focus-visible .bb-blog-excerpt {
    max-height: 320px;
    opacity: 1;
    margin-top: 10px !important;
    transform: translateY(0);
    pointer-events: auto;
}

/* Optional title lift on hover (value is overridden per-widget via Elementor control) */
.bb-blog-card:hover .bb-blog-title,
.bb-blog-card:hover .bb-blog-meta {
    /* default no shift; overridden by control */
}

/* No posts message */
.bb-blog-no-posts {
    text-align: center;
    padding: 40px 0;
    opacity: 0.5;
}

/* Accessibility */
.bb-blog-card:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .bb-blog-card,
    .bb-blog-image,
    .bb-blog-overlay,
    .bb-blog-title,
    .bb-blog-meta,
    .bb-blog-excerpt {
        transition: none !important;
    }
}
