/* =============================================================
   Nova Blog Posts — front-end styles
   ============================================================= */

/* ── Block-level width constraint ──────────────────────────── */
/* Inherits site max-width from the Customizer token.
   Without this, the block stretches infinitely when placed
   inside a full-width Section or at the top level in
   entry-content (which excludes wp-block-novafolio-* blocks
   from its own max-width rule).                              */
.nvf-blog-posts {
    max-width: var(--nvf-layout-max-width, 1440px);
    margin-inline: auto;
    box-sizing: border-box;
}

/* When the block itself has alignfull, allow true full-bleed  */
.nvf-blog-posts.alignfull {
    max-width: none;
    margin-inline: 0;
}

/* alignwide: use the wide-width token                         */
.nvf-blog-posts.alignwide {
    max-width: var(--nvf-layout-wide-width, 1440px);
    margin-inline: auto;
}

/* ── Grid layout ───────────────────────────────────────────── */
.nvf-blog-posts__grid {
    display: grid;
    grid-template-columns: repeat(var(--nvf-bp-cols, 3), 1fr);
    gap: var(--nvf-bp-gap, 40px);
}

/* ── Article item ──────────────────────────────────────────── */
.nvf-blog-posts__item {
    display: flex;
    flex-direction: column;
    position: relative;
}

/* ── Image ─────────────────────────────────────────────────── */
.nvf-blog-posts__image {
    position: relative;
    overflow: hidden;
    height: var(--nvf-bp-img-h, 280px);
    border-radius: var(--nvf-bp-img-radius, 0);
}

.nvf-blog-posts__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease-out;
}

.nvf-blog-posts__item:hover .nvf-blog-posts__image img {
    transform: scale(1.03);
}

.nvf-blog-posts__image-link {
    display: block;
    text-decoration: none;
}

/* ── Content ───────────────────────────────────────────────── */
.nvf-blog-posts__content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding-top: var(--nvf-bp-content-pad, 20px);
}

/* ── Meta (date + category) ────────────────────────────────── */
.nvf-blog-posts__meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--nvf-bp-meta-size, 11px);
    font-family: var(--nvf-secondary-font-family, inherit);
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--nvf-color-muted, #6b7280);
    margin-bottom: var(--nvf-bp-meta-mb, 10px);
}

.nvf-blog-posts__meta-line {
    display: inline-block;
    width: 30px;
    height: 1px;
    background: currentColor;
    opacity: 0.5;
    flex-shrink: 0;
}

.nvf-blog-posts__meta-sep {
    font-size: 6px;
    opacity: 0.6;
    line-height: 1;
}

/* ── Title ─────────────────────────────────────────────────── */
.nvf-blog-posts__title {
    margin: 0 0 var(--nvf-bp-title-mb, 12px);
    font-size: var(--nvf-bp-title-size, clamp(1rem, 1.4vw + 0.3rem, 1.35rem));
    font-weight: var(--nvf-bp-title-weight, 600);
    line-height: 1.3;
    letter-spacing: var(--nvf-bp-title-ls, -0.01em);
    text-transform: var(--nvf-bp-title-transform, none);
}

.nvf-blog-posts__title a {
    color: var(--nvf-color-headings, #111);
    text-decoration: none;
    transition: opacity 0.2s ease;
}

.nvf-blog-posts__title a:hover {
    opacity: 0.65;
}

/* ── Excerpt ───────────────────────────────────────────────── */
.nvf-blog-posts__excerpt {
    margin: 0 0 var(--nvf-bp-excerpt-mb, 18px);
    font-size: var(--nvf-bp-excerpt-size, 14px);
    letter-spacing: var(--nvf-bp-excerpt-ls, normal);
    line-height: 1.65;
    color: var(--nvf-color-text, #374151);
    opacity: 0.85;
}

/* ── Read more button (matches blog archive .nvf-post-button) ── */
.nvf-blog-posts .nvf-post-button {
    margin-top: auto;
}

.nvf-blog-posts .nvf-post-button a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--nvf-blog-readmore-gap, 10px);
    font-size: var(--nvf-blog-rm-size, 14px) !important;
    font-weight: var(--nvf-blog-rm-w, 500) !important;
    letter-spacing: var(--nvf-blog-rm-ls, 0.06em);
    text-transform: var(--nvf-blog-rm-tf, none);
    padding: var(--nvf-blog-rm-pad-y, 12px) var(--nvf-blog-rm-pad-x, 18px);
    border-radius: var(--nvf-blog-rm-radius, 999px);
    background: var(--nvf-blog-rm-bg, var(--nvf-color-button-bg));
    color: var(--nvf-blog-rm-color, var(--nvf-color-button-text));
    text-decoration: none;
    border: 1px solid rgba(15, 23, 42, 0.12);
    white-space: nowrap;
    line-height: 1;
    position: relative;
    overflow: hidden;
    transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.nvf-blog-posts .nvf-post-button a:hover {
    background: var(--nvf-blog-rm-bg-hover, var(--nvf-color-button-bg-hover));
    color: var(--nvf-blog-rm-hover, var(--nvf-color-button-text-hover));
    border-color: var(--nvf-blog-rm-bg-hover, var(--nvf-color-button-bg-hover));
}

.nvf-blog-posts .nvf-post-button a :is(.nvf-post-button-text, .nvf-post-button-arrow-start, .nvf-post-button-arrow-end) {
    color: inherit !important;
    border-color: currentColor !important;
}

.nvf-blog-posts .nvf-post-button a :is(.nvf-post-button-arrow-start, .nvf-post-button-arrow-end) {
    position: relative;
    border-radius: 0;
    box-shadow: none;
    flex: 0 0 auto;
}

.nvf-blog-posts .nvf-post-button a :is(.nvf-post-button-arrow-start, .nvf-post-button-arrow-end)::after {
    content: none;
}

.nvf-blog-posts .nvf-post-button a .nvf-post-button-text {
    white-space: nowrap;
    flex: 0 0 auto;
}

.nvf-blog-posts .nvf-post-button a .nvf-post-button-arrow-start {
    width: 14px;
    height: 1px;
    background: currentColor;
    transform-origin: left;
    transform: scaleX(0);
    opacity: 0;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.nvf-blog-posts .nvf-post-button a .nvf-post-button-arrow-end {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    border: 1px solid currentColor;
    transform: translate(-4px);
    transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.nvf-blog-posts .nvf-post-button a:hover .nvf-post-button-arrow-start {
    transform: scaleX(1);
    opacity: 1;
}

.nvf-blog-posts .nvf-post-button a:hover .nvf-post-button-arrow-end {
    transform: translate(0);
    background: currentColor;
}

/* =============================================================
   STYLE VARIANT: CARD
   ============================================================= */
.nvf-blog-posts--card .nvf-blog-posts__item {
    background: var(--nvf-color-light-1, #fff);
    border-radius: var(--nvf-radius-card, 16px);
    overflow: hidden;
    box-shadow: var(--nvf-shadow-card, 0 18px 55px rgba(15, 23, 42, 0.06));
    border: 1px solid var(--nvf-color-border, rgba(148, 163, 184, 0.18));
    transition: transform 0.26s ease, box-shadow 0.26s ease;
}

.nvf-blog-posts--card .nvf-blog-posts__item:hover {
    transform: translateY(-4px);
    box-shadow: var(--nvf-shadow-card-hover, 0 24px 70px rgba(15, 23, 42, 0.1));
}

.nvf-blog-posts--card .nvf-blog-posts__content {
    padding: 24px 28px 28px;
}

.nvf-blog-posts--card .nvf-blog-posts__image {
    border-radius: 0;
}

/* =============================================================
   STYLE VARIANT: OVERLAY
   ============================================================= */
.nvf-blog-posts--overlay .nvf-blog-posts__item {
    position: relative;
    border-radius: var(--nvf-radius-card, 16px);
    overflow: hidden;
    min-height: var(--nvf-bp-img-h, 280px);
}

.nvf-blog-posts--overlay .nvf-blog-posts__image-link {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.nvf-blog-posts--overlay .nvf-blog-posts__image {
    height: 100%;
    border-radius: 0;
}

.nvf-blog-posts--overlay .nvf-blog-posts__content {
    position: relative;
    z-index: 1;
    padding: 28px;
    margin-top: auto;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
    color: #fff;
}

.nvf-blog-posts--overlay .nvf-blog-posts__title a {
    color: #fff;
}

.nvf-blog-posts--overlay .nvf-blog-posts__meta {
    color: rgba(255,255,255,0.7);
}

.nvf-blog-posts--overlay .nvf-blog-posts__excerpt {
    color: rgba(255,255,255,0.85);
}

.nvf-blog-posts--overlay .nvf-blog-posts__readmore-btn {
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}

.nvf-blog-posts--overlay .nvf-blog-posts__readmore-btn:hover {
    background: rgba(255,255,255,0.15);
    border-color: rgba(255,255,255,0.6);
    color: #fff;
}

/* =============================================================
   META POSITION VARIANTS
   ============================================================= */

/* above-image: meta sits before the image block */
.nvf-blog-posts--meta-above-image .nvf-blog-posts__meta {
    order: -1;
    margin-bottom: 14px;
}

/* =============================================================
   RESPONSIVE
   ============================================================= */
@media (max-width: 900px) {
    .nvf-blog-posts--cols-3 .nvf-blog-posts__grid,
    .nvf-blog-posts--cols-4 .nvf-blog-posts__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .nvf-blog-posts__grid {
        grid-template-columns: 1fr !important;
        gap: var(--nvf-bp-gap-mobile, 32px);
    }
}

/* ── Empty state ───────────────────────────────────────────── */
.nvf-blog-posts-empty {
    text-align: center;
    padding: 40px 20px;
    font-size: 14px;
    color: var(--nvf-color-muted, #6b7280);
    opacity: 0.7;
}

/* ── Reduced motion ────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .nvf-blog-posts__image img,
    .nvf-blog-posts--card .nvf-blog-posts__item,
    .nvf-blog-posts__readmore-btn {
        transition-duration: 1ms !important;
    }
    .nvf-blog-posts__item:hover .nvf-blog-posts__image img {
        transform: none;
    }
    .nvf-blog-posts--card .nvf-blog-posts__item:hover {
        transform: none;
    }
}
