/* ==========================================================================
   COMPONENT: home-blog (front-page.php blog-first composition)
   ========================================================================== */
.bc-home-blog__hero-wrap {
    width: 100%;
    max-width: none;
    padding: 0;
}
/* Hero split: big card + most-read sidebar (2/3 + 1/3). */
.bc-home-blog__hero-split {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 0;
    align-items: stretch;
}
.bc-home-blog__hero-main {
    height: 100%;
    position: relative;
}
.bc-home-blog__hero-main > .bc-hero-card {
    height: 100%;
}

/* Hero carousel */
.bc-hero-carousel {
    position: relative;
    height: 100%;
    min-height: 520px;
    overflow: hidden;
}
.bc-hero-carousel__slide {
    position: absolute;
    inset: 0;
    height: 100%;
}
.bc-hero-carousel__slide .bc-hero-card {
    height: 100%;
}

/* Alpine transition classes — crossfade */
.bc-hero-carousel__fade-enter {
    transition: opacity 600ms var(--ease-in-out, ease);
}
.bc-hero-carousel__fade-enter-start { opacity: 0; }
.bc-hero-carousel__fade-enter-end { opacity: 1; }
.bc-hero-carousel__fade-leave {
    transition: opacity 600ms var(--ease-in-out, ease);
}
.bc-hero-carousel__fade-leave-start { opacity: 1; }
.bc-hero-carousel__fade-leave-end { opacity: 0; }

.bc-hero-carousel__dots {
    position: absolute;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 4;
}
.bc-hero-carousel__dot {
    position: relative;
    width: 24px;
    height: 4px;
    padding: 0;
    border: 0;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-in-out, ease), width var(--duration-fast) var(--ease-in-out, ease);
}
/* Invisible hit-area expander — meets 48×48 WCAG minimum without pushing layout */
.bc-hero-carousel__dot::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 48px;
    min-height: 48px;
}
.bc-hero-carousel__dot.is-active {
    background: var(--accent-primary);
    width: 40px;
}
@media (max-width: 1100px) {
    .bc-hero-carousel { min-height: 380px; }
}
.bc-home-blog__hero-aside {
    position: relative;
}
@media (max-width: 1100px) {
    .bc-home-blog__hero-split {
        grid-template-columns: 1fr;
    }
}

/* Secondary row grid (below the split). */
.bc-home-blog__hero-grid {
    display: grid;
    gap: 0;
}
.bc-home-blog__hero-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}
.bc-home-blog__hero-grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 1100px) {
    .bc-home-blog__hero-grid--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 700px) {
    .bc-home-blog__hero-grid--3,
    .bc-home-blog__hero-grid--2 {
        grid-template-columns: 1fr;
    }
}

/* Hero card — full-bleed image with overlay text (brightcurios.com parity) */
.bc-hero-card {
    position: relative;
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    text-decoration: none;
    color: #fff;
    isolation: isolate;
}
.bc-hero-card--big {
    aspect-ratio: auto;
    min-height: 520px;
    height: 100%;
}
.bc-hero-card--big .bc-hero-card__title {
    font-size: clamp(1.75rem, 3.2vw, 3rem);
    max-width: 32ch;
}
.bc-hero-card__excerpt {
    font-size: var(--text-base, 1rem);
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.82);
    margin: 0.5rem 0 0;
    max-width: 56ch;
}
@media (max-width: 1100px) {
    .bc-hero-card--big {
        min-height: 380px;
        aspect-ratio: 16 / 10;
    }
}
.bc-hero-card__cover {
    position: absolute;
    inset: 0;
    z-index: 1;
}
.bc-hero-card__cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--duration-slow, 600ms) var(--ease-in-out, ease);
}
.bc-hero-card:hover .bc-hero-card__cover img {
    transform: scale(1.04);
}
.bc-hero-card::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85) 0%,
        rgba(0, 0, 0, 0.55) 35%,
        rgba(0, 0, 0, 0.15) 65%,
        transparent 100%
    );
    pointer-events: none;
}
.bc-hero-card__overlay {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 3;
    padding: var(--space-6) var(--space-6) var(--space-6);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.bc-hero-card__cats {
    font-size: var(--text-xs);
    font-weight: var(--fw-semibold);
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.85);
    text-transform: none;
}
.bc-hero-card__title {
    font-size: clamp(1.5rem, 2.2vw, 2rem);
    line-height: 1.15;
    font-weight: var(--fw-extrabold);
    letter-spacing: var(--tracking-tight);
    color: #fff;
    margin: 0;
}
.bc-hero-card__meta {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.75);
    margin-top: 0.25rem;
}
.bc-hero-card__date::before {
    content: '·';
    margin-right: 0.75rem;
    color: rgba(255, 255, 255, 0.4);
}
@media (max-width: 700px) {
    .bc-hero-card {
        aspect-ratio: 16 / 11;
    }
    .bc-hero-card__overlay {
        padding: var(--space-4);
    }
}

/* Inside a carousel the dots (absolute, bottom:1rem, z-index 4) overlap the
   overlay text (z-index 3) on mobile because the overlay is anchored to the
   bottom too. Push the overlay up so the dots get their own strip. */
.bc-hero-carousel .bc-hero-card__overlay {
    padding-bottom: calc(var(--space-6) + 1.5rem);
}
@media (max-width: 700px) {
    .bc-hero-carousel .bc-hero-card__overlay {
        padding-bottom: calc(var(--space-4) + 1.5rem);
    }
}

/* ==========================================================================
   Mobile overflow hardening — every hero ancestor is explicitly width-capped
   and every text node breaks on long words. Without these, very long titles
   (esp. with the alt-text fallback when the featured image 404s) push the
   card wider than the viewport on 414px devices.
   ========================================================================== */
@media (max-width: 900px) {
    .bc-home-blog__hero-wrap,
    .bc-home-blog__hero-split,
    .bc-home-blog__hero-main,
    .bc-home-blog__hero-aside,
    .bc-hero-carousel,
    .bc-hero-carousel__slide,
    .bc-hero-card {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }
    .bc-hero-card__cover,
    .bc-hero-card__cover img {
        max-width: 100%;
    }
    .bc-hero-card__overlay {
        max-width: 100%;
        box-sizing: border-box;
    }
    .bc-hero-card__title,
    .bc-hero-card--big .bc-hero-card__title {
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    .bc-hero-card--big .bc-hero-card__title {
        font-size: clamp(1.25rem, 5.5vw, 2rem);
        line-height: 1.2;
    }
    .bc-hero-card__excerpt {
        max-width: 100%;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .bc-hero-card__cats,
    .bc-hero-card__meta {
        max-width: 100%;
        flex-wrap: wrap;
    }
    /* Hero carousel slide: Alpine may leave display:none inline style on
       inactive slides but old Alpine versions can leave them in layout —
       defensive: force display rules to respect x-show. */
    .bc-hero-carousel__slide[style*="display: none"] { display: none !important; }
}

/* Most-read sidebar */
.bc-most-read {
    background: var(--bg-surface-1);
    border-left: 1px solid var(--border-subtle);
    padding: var(--space-6);
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    position: sticky;
    top: calc(var(--header-height, 72px) + 1rem);
    max-height: calc(100vh - var(--header-height, 72px) - 2rem);
    overflow-y: auto;
}
@media (max-width: 1100px) {
    .bc-most-read {
        position: static;
        max-height: none;
        border-left: none;
        border-top: 1px solid var(--border-subtle);
    }
}
.bc-most-read__label {
    font-family: var(--font-mono, inherit);
    font-size: var(--text-xs);
    font-weight: var(--fw-bold);
    letter-spacing: 0.18em;
    color: var(--accent-primary);
    text-transform: uppercase;
}
.bc-most-read__list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
}
.bc-most-read__item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-subtle);
}
.bc-most-read__item:last-child {
    border-bottom: none;
}
.bc-most-read__rank {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: var(--radius-sm);
    background: var(--accent-primary);
    color: var(--navy-950, #020617);
    font-weight: var(--fw-extrabold);
    font-size: var(--text-sm);
    line-height: 1;
}
.bc-most-read__link {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-decoration: none;
    color: var(--text-primary);
    min-width: 0;
}
.bc-most-read__cat {
    font-family: var(--font-mono, inherit);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    font-weight: var(--fw-bold);
    color: var(--text-secondary);
}
.bc-most-read__title {
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    line-height: 1.35;
    color: var(--text-primary);
}
.bc-most-read__link:hover .bc-most-read__title {
    color: var(--accent-primary);
}

.bc-home-blog__section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
    flex-wrap: wrap;
}
.bc-home-blog__section-title {
    font-size: var(--text-2xl);
    font-weight: var(--fw-extrabold);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
    margin: 0;
}
.bc-home-blog__section-link {
    font-size: var(--text-sm);
    font-weight: var(--fw-semibold);
    color: var(--text-link);
    text-decoration: none;
    white-space: nowrap;
}
.bc-home-blog__section-link:hover {
    color: var(--accent-primary);
}

/* Category carousel (home) */
.bc-cat-section {
    padding-bottom: var(--space-10);
}
.bc-cat-section__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
    flex-wrap: wrap;
}
.bc-cat-section__controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.bc-cat-section__arrow {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-surface-1);
    border: 1px solid var(--border-default);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-in-out, ease);
}
.bc-cat-section__arrow:hover:not(:disabled) {
    background: var(--accent-primary);
    color: var(--navy-950, #020617);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}
.bc-cat-section__arrow:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.bc-cat-section__track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(300px, 1fr);
    gap: var(--space-6);
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 0.5rem;
    /* Show roughly 3 cards at a time on wide viewports */
}
.bc-cat-section__track::-webkit-scrollbar {
    display: none;
}
.bc-cat-section__track > .bc-blog-card,
.bc-cat-section__track > article.bc-blog-card,
.bc-cat-section__track > a.bc-blog-card {
    scroll-snap-align: start;
    min-width: 0;
}
@media (min-width: 900px) {
    .bc-cat-section__track {
        grid-auto-columns: calc((100% - var(--space-6) * 2) / 3);
    }
}
@media (max-width: 899px) {
    .bc-cat-section__track {
        grid-auto-columns: calc((100% - var(--space-6)) / 2);
    }
}
@media (max-width: 600px) {
    .bc-cat-section__track {
        grid-auto-columns: 85%;
    }
    .bc-cat-section__arrow {
        display: none;
    }
}
