/* ==========================================================================
   Blog Hub & Spokes
   BEM block: bh
   Hub = posts page (home.php): latest stories + curated topic shelves.
   Spoke = archive.php: per-topic grids with pagination.
   Design language shared with the rest of the site: cream alt sections,
   16px cards, pill chips/buttons, editorial hairlines, Outfit headings.
   ========================================================================== */

.bh-hub {
    --bh-primary: var(--sd-color-primary, #36452f);
    --bh-accent: var(--sd-color-cta, #5f7d3a);
    --bh-accent-hover: var(--sd-color-cta-hover, #8db35a);
    --bh-text: var(--sd-color-text, #171717);
    --bh-text-light: var(--sd-color-text-light, #525252);
    --bh-cream: var(--sd-color-cream, #f8f6ee);
    --bh-cream-deep: #efece0;
    --bh-rule: rgba(23, 23, 23, 0.08);
    --bh-radius: 8px;
    --bh-ease: cubic-bezier(0.22, 1, 0.36, 1);

    background: #ffffff;
    color: var(--bh-text);
    -webkit-font-smoothing: antialiased;
}

.bh-hub h1,
.bh-hub h2,
.bh-hub h3 {
    font-family: var(--sd-font-family-primary, 'Outfit', sans-serif);
}

.bh-container {
    max-width: var(--sd-container-max, 1440px);
    margin-inline: auto;
    padding-inline: clamp(1.25rem, 5vw, 3.5rem);
}

/* ── Head — gradient hero, same language as pricing/contact ──── */
.bh-head {
    background: var(--sd-color-primary, #36452f); /* flat, matches nav */
    color: #ffffff;
    padding: clamp(6.5rem, 11vw, 9rem) 0 clamp(2.25rem, 4.5vw, 3.25rem);
}

.bh-overline {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    margin: 0 0 1rem;
}

.bh-head__title {
    /* typography.css paints headings dark; colour must be explicit */
    color: #ffffff;
    font-size: clamp(2.25rem, 5vw, 4rem); /* unified hero title scale */
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin: 0 0 1rem;
}

.bh-head__sub {
    font-size: clamp(1rem, 1.4vw, 1.125rem);
    color: rgba(255, 255, 255, 0.78);
    line-height: 1.65;
    max-width: 600px;
    margin: 0 0 1.75rem;
}

.bh-head__sub p {
    margin: 0;
}

.bh-head__count {
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
    margin: -0.75rem 0 1.5rem;
}

.bh-head__tools {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

/* Topic chips — translucent pills on the dark hero */
.bh-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bh-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    padding: 0.45rem 1rem;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.bh-chip:hover {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
}

.bh-chip--active {
    background: #ffffff;
    border-color: #ffffff;
    color: var(--bh-primary);
}

.bh-chip__count {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--bh-accent-hover);
    font-variant-numeric: tabular-nums;
}

.bh-chip--active .bh-chip__count {
    color: var(--bh-accent);
}

/* Search — dark-hero variant */
.bh-search {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    padding: 0.45rem 1.1rem;
    color: rgba(255, 255, 255, 0.65);
    transition: border-color 0.2s ease;
}

.bh-search:focus-within {
    border-color: var(--bh-accent-hover);
}

.bh-search input {
    border: none;
    background: none;
    outline: none;
    font-family: inherit;
    font-size: 0.875rem;
    color: #ffffff;
    width: 150px;
}

.bh-search input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* ── Section heads ───────────────────────────────────────────── */
.bh-section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}

.bh-section-title {
    font-size: clamp(1.5rem, 2.5vw, 2.125rem);
    letter-spacing: -0.015em;
    margin: 0;
}

.bh-section-desc {
    font-size: 0.9375rem;
    color: var(--bh-text-light);
    line-height: 1.6;
    max-width: 560px;
    margin: 0.5rem 0 0;
}

.bh-section-link {
    flex-shrink: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bh-accent);
    text-decoration: none;
    white-space: nowrap;
    padding-bottom: 4px;
    transition: color 0.2s ease;
}

.bh-section-link:hover {
    color: var(--bh-primary);
}

/* ── Cards ───────────────────────────────────────────────────── */
.bh-card {
    display: flex;
    flex-direction: column;
    background: var(--bh-cream);
    border-radius: var(--bh-radius);
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.3s var(--bh-ease), box-shadow 0.3s ease;
}

.bh-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 40px rgba(23, 23, 23, 0.1);
}

.bh-card__thumb {
    aspect-ratio: 16/9;
    overflow: hidden;
    background: var(--bh-cream-deep);
    position: relative;
}

.bh-card__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s var(--bh-ease);
}

.bh-card:hover .bh-card__thumb img {
    transform: scale(1.04);
}

.bh-card__thumb-fallback {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(54, 69, 47, 0.25);
}

.bh-card__body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.bh-card__cat {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--bh-accent);
    margin-bottom: 0.6rem;
}

.bh-card__title {
    font-size: 1.0625rem;
    color: var(--bh-text);
    line-height: 1.35;
    margin: 0 0 0.75rem;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s ease;
}

.bh-card:hover .bh-card__title {
    color: var(--bh-primary);
}

.bh-card__excerpt {
    font-size: 0.9375rem;
    color: var(--bh-text-light);
    line-height: 1.6;
    margin: 0 0 0.9rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bh-card__meta {
    font-size: 0.75rem;
    color: var(--bh-text-light);
    margin: 0;
}

.bh-card__meta-sep {
    margin: 0 0.3rem;
    opacity: 0.6;
}

/* Featured lead card — spans the grid, horizontal on desktop */
.bh-card--featured {
    flex-direction: row;
    align-items: stretch;
}

.bh-card--featured .bh-card__thumb {
    flex: 0 0 56%;
    aspect-ratio: auto;
    min-height: 340px;
}

.bh-card--featured .bh-card__body {
    padding: clamp(1.5rem, 3vw, 2.5rem);
    justify-content: center;
}

.bh-card--featured .bh-card__title {
    font-size: clamp(1.375rem, 2.4vw, 1.875rem);
    line-height: 1.2;
    flex: 0 0 auto;
    -webkit-line-clamp: 3;
}

/* ── Latest section layout ───────────────────────────────────── */
.bh-latest {
    padding-block: clamp(2.5rem, 5vw, 4rem);
}

.bh-latest__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.bh-latest__grid .bh-card--featured {
    grid-column: 1 / -1;
}

/* ── Topic shelves ───────────────────────────────────────────── */
.bh-shelf {
    padding-block: clamp(2.75rem, 5.5vw, 4.5rem);
}

.bh-shelf--cream {
    background: var(--bh-cream);
}

/* Cards flip to white when the shelf itself is cream */
.bh-shelf--cream .bh-card {
    background: #ffffff;
}

.bh-shelf__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* ── CTA ─────────────────────────────────────────────────────── */
.bh-cta {
    padding-block: clamp(3rem, 6vw, 5rem);
}

.bh-cta__inner {
    background: var(--bh-primary);
    color: #ffffff;
    border-radius: var(--bh-radius);
    padding: clamp(2rem, 4vw, 3rem) clamp(2rem, 4.5vw, 3.5rem);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.bh-cta__title {
    color: #ffffff; /* typography.css dark-heading bleed */
    font-size: clamp(1.375rem, 2.4vw, 1.875rem);
    margin: 0 0 0.4rem;
}

.bh-cta__sub {
    font-size: 0.9375rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.6;
    margin: 0;
    max-width: 520px;
}

.bh-cta__actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.bh-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9375rem;
    font-weight: 600;
    padding: 0.875rem 1.875rem;
    border-radius: 999px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1;
}

.bh-btn--primary {
    background: var(--bh-accent);
    color: #ffffff;
}

.bh-btn--primary:hover {
    background: var(--sd-color-cta-strong, #4f6b30);
    transform: translateY(-1px);
}

.bh-cta .bh-btn--outline {
    color: #ffffff;
    border: 1.5px solid rgba(255, 255, 255, 0.5);
}

.bh-cta .bh-btn--outline:hover {
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.bh-btn--outline {
    color: var(--bh-primary);
    border: 1.5px solid rgba(54, 69, 47, 0.35);
}

.bh-btn--outline:hover {
    border-color: var(--bh-primary);
    background: rgba(54, 69, 47, 0.05);
}

/* ── Spoke pages ─────────────────────────────────────────────── */
.bh-head--spoke {
    padding-bottom: clamp(1.75rem, 3.5vw, 2.5rem);
}

.bh-backlink {
    display: inline-block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.65);
    text-decoration: none;
    margin-bottom: 1.5rem;
    transition: color 0.2s ease;
}

.bh-backlink:hover {
    color: #ffffff;
}

.bh-spoke__results {
    padding-block: clamp(2.5rem, 5vw, 4rem);
}

.bh-spoke__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

/* Pagination (the_posts_pagination output) */
.bh-spoke .navigation.pagination {
    margin-top: clamp(2.5rem, 5vw, 4rem);
}

.bh-spoke .nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.bh-spoke .nav-links .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 0.9rem;
    border: 1.5px solid rgba(23, 23, 23, 0.15);
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bh-text);
    text-decoration: none;
    transition: all 0.2s ease;
}

.bh-spoke .nav-links .page-numbers:hover {
    border-color: var(--bh-primary);
    background: rgba(54, 69, 47, 0.05);
}

.bh-spoke .nav-links .page-numbers.current {
    background: var(--bh-primary);
    border-color: var(--bh-primary);
    color: #ffffff;
}

.bh-spoke .nav-links .page-numbers.dots {
    border: none;
}

.bh-spoke .screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

/* ── Author spoke ────────────────────────────────────────────── */
.bh-author__head {
    display: flex;
    align-items: center;
    gap: clamp(1.5rem, 3vw, 2.5rem);
}

.bh-author__avatar img,
.bh-author__monogram {
    display: block;
    width: clamp(96px, 12vw, 140px);
    height: clamp(96px, 12vw, 140px);
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255, 255, 255, 0.25);
}

/* Initials fallback when no usable avatar image exists */
.bh-author__monogram {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(95, 125, 58, 0.3);
    color: #ffffff;
    font-family: var(--sd-font-family-primary, 'Outfit', sans-serif);
    font-size: clamp(2rem, 3.5vw, 2.75rem);
    font-weight: 600;
    letter-spacing: 0.02em;
}

.bh-author__role {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--bh-accent-hover);
    margin: -0.5rem 0 0.9rem;
}

.bh-author__bio {
    margin-bottom: 1.1rem;
}

.bh-author__meta {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.6);
}

.bh-author__socials {
    display: inline-flex;
    gap: 0.9rem;
}

.bh-author__socials a {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: rgba(255, 255, 255, 0.3);
    transition: color 0.2s ease;
}

.bh-author__socials a:hover {
    color: #ffffff;
}

@media (max-width: 680px) {
    .bh-author__head {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.25rem;
    }
}

.bh-empty {
    text-align: center;
    padding: clamp(3rem, 8vw, 6rem) 1rem;
    color: var(--bh-text-light);
}

.bh-empty p {
    font-size: 1.125rem;
    margin: 0 0 1.5rem;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 1024px) {
    /* Shelves + spoke grids become swipe carousels: every card stays in
       the DOM and reachable (same pattern as the homepage). */
    .bh-shelf__grid,
    .bh-latest__grid {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        scroll-padding-inline: clamp(1.25rem, 5vw, 3.5rem);
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 14px;
        padding-bottom: 0.5rem;
    }

    .bh-shelf__grid::-webkit-scrollbar,
    .bh-latest__grid::-webkit-scrollbar {
        display: none;
    }

    .bh-shelf__grid .bh-card,
    .bh-latest__grid .bh-card {
        flex: 0 0 46%;
        scroll-snap-align: start;
    }

    /* Lead story stays full-width and horizontal */
    .bh-latest__grid .bh-card--featured {
        flex: 0 0 100%;
    }

    /* Spoke grids keep a 2-col grid (pagination, not carousel) */
    .bh-spoke__grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 768px) {
    .bh-head__tools {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .bh-search {
        align-self: flex-start;
    }

    .bh-search input {
        width: 180px;
    }

    .bh-chips {
        gap: 0.4rem;
    }

    .bh-chip {
        font-size: 0.75rem;
        padding: 0.4rem 0.85rem;
    }

    .bh-shelf__grid .bh-card,
    .bh-latest__grid .bh-card {
        flex-basis: 80%;
    }

    .bh-card--featured {
        flex-direction: column;
    }

    .bh-card--featured .bh-card__thumb {
        flex: none;
        aspect-ratio: 16/9;
        min-height: 0;
    }

    .bh-section-head {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .bh-spoke__grid {
        grid-template-columns: 1fr;
    }

    .bh-cta__inner {
        flex-direction: column;
        align-items: flex-start;
    }
}
