/* ==========================================================
   Bento Grid Block — bkbg-bento-grid
   ========================================================== */

.bkbg-bento-grid-wrap {
    box-sizing: border-box;
}

.bkbg-bento-grid {
    width: 100%;
    box-sizing: border-box;
}

/* Hover lift effect */
.bkbg-bento-grid[data-hover-lift="1"] .bkbg-bento-cell {
    transition: transform 0.22s ease, box-shadow 0.22s ease;
    cursor: default;
}

.bkbg-bento-grid[data-hover-lift="1"] .bkbg-bento-cell:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.12);
}

/* Scroll animation */
.bkbg-bento-grid[data-animate="1"] .bkbg-bento-cell {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.bkbg-bento-grid[data-animate="1"] .bkbg-bento-cell.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger delay */
.bkbg-bento-grid[data-animate="1"] .bkbg-bento-cell:nth-child(1) { transition-delay: 0.05s; }
.bkbg-bento-grid[data-animate="1"] .bkbg-bento-cell:nth-child(2) { transition-delay: 0.12s; }
.bkbg-bento-grid[data-animate="1"] .bkbg-bento-cell:nth-child(3) { transition-delay: 0.19s; }
.bkbg-bento-grid[data-animate="1"] .bkbg-bento-cell:nth-child(4) { transition-delay: 0.26s; }
.bkbg-bento-grid[data-animate="1"] .bkbg-bento-cell:nth-child(5) { transition-delay: 0.33s; }
.bkbg-bento-grid[data-animate="1"] .bkbg-bento-cell:nth-child(n+6) { transition-delay: 0.4s; }

/* Normalize heading/paragraph margins — WordPress global styles or theme.json
   can inject margins on h1–h6 and p that break cell layout. Inline styles on
   elements override these, but this rule adds a safe CSS-level fallback. */
.bkbg-bento-cell h1,
.bkbg-bento-cell h2,
.bkbg-bento-cell h3,
.bkbg-bento-cell h4,
.bkbg-bento-cell h5,
.bkbg-bento-cell h6 {
    margin-top: 0;
    line-height: 1.2;
    color: inherit;
}

.bkbg-bento-cell p {
    margin-top: 0;
}

.bkbg-bento-eyebrow {
    margin: 0 0 6px;
    font-family: var(--bkbg-bento-eyebrow-font-family, inherit);
    font-size: var(--bkbg-bento-eyebrow-font-size-d, 12px);
    font-weight: var(--bkbg-bento-eyebrow-font-weight, 700);
    font-style: var(--bkbg-bento-eyebrow-font-style, normal);
    text-transform: var(--bkbg-bento-eyebrow-text-transform, uppercase);
    text-decoration: var(--bkbg-bento-eyebrow-text-decoration, none);
    line-height: var(--bkbg-bento-eyebrow-line-height-d, 1.3);
    letter-spacing: var(--bkbg-bento-eyebrow-letter-spacing-d, 0.08em);
    word-spacing: var(--bkbg-bento-eyebrow-word-spacing-d, normal);
}

.bkbg-bento-title {
    font-family: var(--bkbg-bento-title-font-family, inherit);
    font-size: var(--bkbg-bento-title-font-size-d, 26px);
    font-weight: var(--bkbg-bento-title-font-weight, 700);
    font-style: var(--bkbg-bento-title-font-style, normal);
    text-transform: var(--bkbg-bento-title-text-transform, none);
    text-decoration: var(--bkbg-bento-title-text-decoration, none);
    line-height: var(--bkbg-bento-title-line-height-d, 1.2);
    letter-spacing: var(--bkbg-bento-title-letter-spacing-d, normal);
    word-spacing: var(--bkbg-bento-title-word-spacing-d, normal);
}

.bkbg-bento-desc {
    font-family: var(--bkbg-bento-desc-font-family, inherit);
    font-size: var(--bkbg-bento-desc-font-size-d, 15px);
    font-weight: var(--bkbg-bento-desc-font-weight, normal);
    font-style: var(--bkbg-bento-desc-font-style, normal);
    text-transform: var(--bkbg-bento-desc-text-transform, none);
    text-decoration: var(--bkbg-bento-desc-text-decoration, none);
    line-height: var(--bkbg-bento-desc-line-height-d, 1.55);
    letter-spacing: var(--bkbg-bento-desc-letter-spacing-d, normal);
    word-spacing: var(--bkbg-bento-desc-word-spacing-d, normal);
}

.bkbg-bento-btn {
    text-decoration: none;
    transition: opacity 0.15s ease;
}

.bkbg-bento-btn:hover {
    opacity: 0.85;
}

.bkbg-bento-overlay {
    border-radius: inherit;
}

/* Responsive typography — tablet */
@media (max-width: 1024px) {
    .bkbg-bento-eyebrow {
        font-size: var(--bkbg-bento-eyebrow-font-size-t, var(--bkbg-bento-eyebrow-font-size-d, 12px));
        line-height: var(--bkbg-bento-eyebrow-line-height-t, var(--bkbg-bento-eyebrow-line-height-d, 1.3));
        letter-spacing: var(--bkbg-bento-eyebrow-letter-spacing-t, var(--bkbg-bento-eyebrow-letter-spacing-d, 0.08em));
        word-spacing: var(--bkbg-bento-eyebrow-word-spacing-t, var(--bkbg-bento-eyebrow-word-spacing-d, normal));
    }
    .bkbg-bento-title {
        font-size: var(--bkbg-bento-title-font-size-t, var(--bkbg-bento-title-font-size-d, 26px));
        line-height: var(--bkbg-bento-title-line-height-t, var(--bkbg-bento-title-line-height-d, 1.2));
        letter-spacing: var(--bkbg-bento-title-letter-spacing-t, var(--bkbg-bento-title-letter-spacing-d, normal));
        word-spacing: var(--bkbg-bento-title-word-spacing-t, var(--bkbg-bento-title-word-spacing-d, normal));
    }
    .bkbg-bento-desc {
        font-size: var(--bkbg-bento-desc-font-size-t, var(--bkbg-bento-desc-font-size-d, 15px));
        line-height: var(--bkbg-bento-desc-line-height-t, var(--bkbg-bento-desc-line-height-d, 1.55));
        letter-spacing: var(--bkbg-bento-desc-letter-spacing-t, var(--bkbg-bento-desc-letter-spacing-d, normal));
        word-spacing: var(--bkbg-bento-desc-word-spacing-t, var(--bkbg-bento-desc-word-spacing-d, normal));
    }
}

/* Responsive typography — mobile */
@media (max-width: 767px) {
    .bkbg-bento-eyebrow {
        font-size: var(--bkbg-bento-eyebrow-font-size-m, var(--bkbg-bento-eyebrow-font-size-t, var(--bkbg-bento-eyebrow-font-size-d, 12px)));
        line-height: var(--bkbg-bento-eyebrow-line-height-m, var(--bkbg-bento-eyebrow-line-height-t, var(--bkbg-bento-eyebrow-line-height-d, 1.3)));
        letter-spacing: var(--bkbg-bento-eyebrow-letter-spacing-m, var(--bkbg-bento-eyebrow-letter-spacing-t, var(--bkbg-bento-eyebrow-letter-spacing-d, 0.08em)));
        word-spacing: var(--bkbg-bento-eyebrow-word-spacing-m, var(--bkbg-bento-eyebrow-word-spacing-t, var(--bkbg-bento-eyebrow-word-spacing-d, normal)));
    }
    .bkbg-bento-title {
        font-size: var(--bkbg-bento-title-font-size-m, var(--bkbg-bento-title-font-size-t, var(--bkbg-bento-title-font-size-d, 26px)));
        line-height: var(--bkbg-bento-title-line-height-m, var(--bkbg-bento-title-line-height-t, var(--bkbg-bento-title-line-height-d, 1.2)));
        letter-spacing: var(--bkbg-bento-title-letter-spacing-m, var(--bkbg-bento-title-letter-spacing-t, var(--bkbg-bento-title-letter-spacing-d, normal)));
        word-spacing: var(--bkbg-bento-title-word-spacing-m, var(--bkbg-bento-title-word-spacing-t, var(--bkbg-bento-title-word-spacing-d, normal)));
    }
    .bkbg-bento-desc {
        font-size: var(--bkbg-bento-desc-font-size-m, var(--bkbg-bento-desc-font-size-t, var(--bkbg-bento-desc-font-size-d, 15px)));
        line-height: var(--bkbg-bento-desc-line-height-m, var(--bkbg-bento-desc-line-height-t, var(--bkbg-bento-desc-line-height-d, 1.55)));
        letter-spacing: var(--bkbg-bento-desc-letter-spacing-m, var(--bkbg-bento-desc-letter-spacing-t, var(--bkbg-bento-desc-letter-spacing-d, normal)));
        word-spacing: var(--bkbg-bento-desc-word-spacing-m, var(--bkbg-bento-desc-word-spacing-t, var(--bkbg-bento-desc-word-spacing-d, normal)));
    }
}

/* Responsive — stack to 2 cols on tablet, 1 col on mobile */
@media (max-width: 768px) {
    .bkbg-bento-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .bkbg-bento-cell {
        grid-column: span 1 !important;
    }
}

@media (max-width: 480px) {
    .bkbg-bento-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ── Editor: always show cells (frontend.js / IntersectionObserver is not loaded
   inside the block editor, so animated cells would stay invisible) ── */
.editor-styles-wrapper .bkbg-bento-grid[data-animate="1"] .bkbg-bento-cell {
    opacity: 1 !important;
    transform: none !important;
}
