/* =============================================================
   Crankshaft Category Filter — Frontend: Guest Posts Section
   ============================================================= */

/* Section wrapper — break out of content width (42rem) to match the theme's wide width (80rem) */
.csf-guest-posts {
    width: var(--wp--style--global--wide-size, 80rem);
    max-width: 100vw;
    padding-top: 3.5rem;
    padding-bottom: 3.5rem;
    margin-top: 0;
    margin-bottom: 0;
    margin-left: calc((var(--wp--style--global--wide-size, 80rem) - 100%) / -2);
    box-sizing: border-box;
    font-family: var(--wp--preset--font-family--jost), sans-serif;
}

/* Heading */
.csf-guest-posts__heading {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0 0 2.25rem;
}

/* Grid */
.csf-guest-posts__grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr; /* default: single column (mobile-first) */
}

.csf-cols-2 .csf-guest-posts__grid {
    grid-template-columns: repeat(2, 1fr);
}

.csf-cols-3 .csf-guest-posts__grid {
    grid-template-columns: repeat(3, 1fr);
}

.csf-cols-4 .csf-guest-posts__grid {
    grid-template-columns: repeat(4, 1fr);
}

/* ── Tablet ≤1024px: switch to vw-based full-bleed so the
      section aligns exactly with the viewport edges instead of
      relying on the wide-size calc that breaks on iPad Pro ── */
@media (max-width: 1024px) {
    .csf-guest-posts {
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (max-width: 900px) {
    .csf-cols-4 .csf-guest-posts__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ── Tablet: 3 cols → 2, tighten spacing ───────────────────── */
@media (max-width: 768px) {
    .csf-guest-posts {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
        padding-left: 1.25rem;
        padding-right: 1.25rem;
    }

    .csf-cols-3 .csf-guest-posts__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .csf-guest-posts__grid {
        gap: 1.25rem;
    }

    .csf-guest-posts__heading {
        font-size: 1.4rem;
        margin-bottom: 1.75rem;
    }

    .csf-guest-posts__title {
        font-size: 1.15rem;
    }
}

/* ── Mobile: single column, reset wide breakout ────────────── */
@media (max-width: 480px) {
    .csf-guest-posts {
        width: 100%;
        margin-left: 0;
        padding-top: 2rem;
        padding-bottom: 2rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .csf-cols-2 .csf-guest-posts__grid,
    .csf-cols-3 .csf-guest-posts__grid,
    .csf-cols-4 .csf-guest-posts__grid {
        grid-template-columns: 1fr;
    }

    .csf-guest-posts__grid {
        gap: 1rem;
    }

    .csf-guest-posts__heading {
        font-size: 1.2rem;
        letter-spacing: 0.07em;
        margin-bottom: 1.25rem;
    }

    .csf-guest-posts__title {
        font-size: 1.05rem;
    }

    .csf-guest-posts__body {
        padding: 1rem 1rem 1.25rem;
        gap: 0.5rem;
    }

    .csf-guest-posts__meta {
        flex-wrap: wrap;
        gap: 0.4rem 0.75rem;
    }

    .csf-guest-posts__view-all {
        margin-top: 1.5rem;
    }

    .csf-guest-posts__view-all-btn {
        display: block;
        text-align: center;
        padding: 0.7rem 1.5rem;
        font-size: 0.8rem;
    }

}

/* Card — white background matching the theme post cards */
.csf-guest-posts__card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    border-radius: 4px;
}

/* Thumbnail — 4:3 to match the theme's post card ratio */
.csf-guest-posts__img-wrap {
    display: block;
    overflow: hidden;
    aspect-ratio: 4 / 3;
}

.csf-guest-posts__img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.csf-guest-posts__card:hover .csf-guest-posts__img-wrap img {
    transform: scale(1.05);
}

/* Body */
.csf-guest-posts__body {
    padding: 1.25rem 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    flex: 1;
}

/* Category label */
.csf-guest-posts__cat {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    opacity: 0.6;
    color: inherit;
}

.csf-guest-posts__cat:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Post title */
.csf-guest-posts__title {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.4;
    font-weight: 700;
}

.csf-guest-posts__title a {
    text-decoration: none;
    color: inherit;
}

.csf-guest-posts__title a:hover {
    text-decoration: underline;
}

/* Excerpt */
.csf-guest-posts__excerpt {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    opacity: 0.75;
}

/* Meta row: date + read more */
.csf-guest-posts__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.82rem;
    margin-top: auto;
    padding-top: 0.75rem;
    opacity: 0.65;
}

.csf-guest-posts__meta time {
    flex-shrink: 0;
}

.csf-guest-posts__read-more {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    color: inherit;
    border-bottom: 1px solid currentColor;
    white-space: nowrap;
}

.csf-guest-posts__read-more:hover {
    opacity: 0.6;
}

/* Author */
.csf-guest-posts__author {
    margin: 0;
    font-size: 0.85rem;
    opacity: 0.65;
}

.csf-guest-posts__author a {
    text-decoration: none;
    color: inherit;
    font-weight: 600;
}

.csf-guest-posts__author a:hover {
    text-decoration: underline;
}

/* View All button */
.csf-guest-posts__view-all {
    text-align: center;
    margin-top: 2rem;
}

.csf-guest-posts__view-all-btn {
    display: inline-block;
    padding: 0.75rem 2.25rem;
    border: 2px solid currentColor;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
    color: inherit;
    transition: background 0.2s, color 0.2s;
}

.csf-guest-posts__view-all-btn:hover {
    background: #1d2327;
    border-color: #1d2327;
    color: #fff;
}

/* Pagination */
.csf-pagination {
    margin-top: 2rem;
    display: flex;
    justify-content: center;
}

.csf-pagination .page-numbers {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.csf-pagination .page-numbers li {
    margin: 0;
}

.csf-pagination .page-numbers a,
.csf-pagination .page-numbers span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    color: inherit;
    transition: background 0.15s, border-color 0.15s;
}

.csf-pagination .page-numbers a:hover {
    background: #f0f0f0;
    border-color: #aaa;
}

.csf-pagination .page-numbers span.current {
    background: #1d2327;
    border-color: #1d2327;
    color: #fff;
}

/* ── Pagination: Tablet (≤768px) ───────────────────────────── */
@media (max-width: 768px) {
    .csf-pagination {
        margin-top: 1.75rem;
    }

    .csf-pagination .page-numbers {
        gap: 5px;
    }

    .csf-pagination .page-numbers a,
    .csf-pagination .page-numbers span {
        min-width: 38px;
        height: 38px;
        font-size: 0.8rem;
        padding: 0 10px;
    }
}

/* ── Pagination: Mobile (≤480px) ───────────────────────────── */
@media (max-width: 480px) {
    .csf-pagination {
        margin-top: 1.5rem;
    }

    .csf-pagination .page-numbers {
        gap: 4px;
        row-gap: 6px;
    }

    /* Larger touch targets on mobile (≥44px recommended) */
    .csf-pagination .page-numbers a,
    .csf-pagination .page-numbers span {
        min-width: 40px;
        height: 44px;
        font-size: 0.82rem;
        padding: 0 8px;
        border-radius: 6px;
    }

    /* Prev / Next arrows: wider so they're easy to tap */
    .csf-pagination .page-numbers .prev,
    .csf-pagination .page-numbers .next {
        min-width: 52px;
        padding: 0 12px;
        font-size: 1rem;
    }

    /* Dots (…) — no border, just text */
    .csf-pagination .page-numbers .dots {
        border-color: transparent;
        background: transparent;
        min-width: 24px;
        padding: 0 2px;
    }
}
