/* BB Blog Grid v1.9.9
 *
 * Per-viewport controls live in widget.php via add_responsive_control. This
 * stylesheet only owns the static defaults; everything that varies by
 * breakpoint is driven through CSS variables (--bb-*) so the responsive
 * Elementor controls can flip behavior per viewport without class swapping. */

.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;
}

/* Default zoom — overridden per-viewport by image_zoom_scale and forced to
   scale(1) by image_hover_zoom='no'. */
.bb-blog-card:hover .bb-blog-image,
.bb-blog-card:focus-visible .bb-blog-image {
    transform: scale(1.06);
}

/* Gradient overlay — opt-in per viewport via image_gradient_enable. The
   selectors_dictionary on that control writes background:linear-gradient(...)
   when 'yes' and background:transparent when 'no'. */
.bb-blog-gradient {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: transparent;
}

/* Content overlay — position is per-viewport via overlay_position dictionary.
   Default 0.75 alpha keeps white meta/excerpt text above 4.5:1 contrast even
   over a bright photo (WCAG 1.4.3). User can lower it explicitly via the
   Elementor control if their imagery is reliably dark. */
.bb-blog-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 28px;
    background: rgba(0, 0, 0, 0.75);
    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,
.bb-blog-card:focus-visible .bb-blog-overlay {
    background: rgba(0, 0, 0, 0.88);
}

/* 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 — clamp behavior is fed by --bb-title-display, --bb-title-overflow,
   --bb-title-clamp-active CSS variables that title_line_clamp_enable sets per
   viewport. Default (variables unset) = no clamp. */
.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;
    display: var(--bb-title-display, block);
    overflow: var(--bb-title-overflow, visible);
    -webkit-box-orient: vertical;
    -webkit-line-clamp: var(--bb-title-clamp-active, unset);
    line-clamp: var(--bb-title-clamp-active, unset);
}

/* On hover always reveal the full title regardless of clamp state. */
.bb-blog-card:hover .bb-blog-title,
.bb-blog-card:focus-visible .bb-blog-title {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

/* ── Per-viewport text variants (.bb-v) ──
   Title and excerpt each render one <span> per viewport that has its own word
   limit set. Default: only the base variant is visible. The per-widget inline
   <style> emitted by widget.php hides .bb-v--base and shows .bb-v--{bp} inside
   each breakpoint's media query. Hidden variants are display:none so they're
   removed from the accessibility tree. */
.bb-v { display: none; }
.bb-v--base { display: inline; }

/* When the title has at least one truncated viewport variant, hover/focus
   swaps every variant for the full title span. */
.bb-blog-title--has-truncation .bb-blog-title-full { display: none; }
.bb-blog-card:hover .bb-blog-title--has-truncation .bb-v,
.bb-blog-card:focus-visible .bb-blog-title--has-truncation .bb-v {
    display: none;
}
.bb-blog-card:hover .bb-blog-title--has-truncation .bb-blog-title-full,
.bb-blog-card:focus-visible .bb-blog-title--has-truncation .bb-blog-title-full {
    display: inline;
}

/* Excerpt — rest/hover state is driven by --bb-reveal-* CSS variables that
   hover_reveal_enable sets per viewport. Defaults (variables unset) = always
   visible. */
.bb-blog-excerpt {
    margin: 8px 0 0;
    padding: 0;
    font-size: 14px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.65);
    overflow: hidden;
    max-height: var(--bb-reveal-rest-max-h, none);
    opacity: var(--bb-reveal-rest-opacity, 1);
    transform: translateY(var(--bb-reveal-rest-translate, 0));
    pointer-events: var(--bb-reveal-rest-pointer, auto);
    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;
}

.bb-blog-card:hover .bb-blog-excerpt,
.bb-blog-card:focus-visible .bb-blog-excerpt {
    max-height: var(--bb-reveal-hover-max-h, none);
    opacity: var(--bb-reveal-hover-opacity, 1);
    transform: translateY(var(--bb-reveal-hover-translate, 0));
    pointer-events: var(--bb-reveal-hover-pointer, auto);
}

/* 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,
.bb-readmore-style-button .bb-blog-card:focus-visible .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,
.bb-readmore-style-text .bb-blog-card:focus-visible .bb-blog-readmore::after {
    transform: translateX(3px);
}

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

/* Two-tone focus ring for WCAG 2.2 SC 2.4.11: the white outline sits at
   2-4px and the black box-shadow fills 0-4px, producing a 2px black ring
   adjacent to the card with a 2px white ring just outside it. One of the
   two contrasts ≥3:1 against any plausible adjacent surface (dark card
   edge vs light page background, or vice versa). */
.bb-blog-card:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px #000;
}

/* 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;
    }
}
