/* ==========================================================================
   Blog v3 — thin overlay on top of kb-v3.css
   Reuse kb-v3 class vocabulary for layout/cards; this file adds only the
   blog-specific bits: byline/date meta row, featured-post treatment,
   pagination controls, and migrated-content helpers (video embeds, captions,
   float alignment). All colors come from the shared --et-* design tokens.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Layout escape + page-header artifact (mirrors kb-v3 §1, keyed to data-blog)
   Blog pages render no page-header; the base layout still emits an empty
   .page-header-v3 band, and .main-content-v3 keeps its gutter — both must be
   neutralized here or every blog page opens with ~200px of dead space and
   the dark hero bands render inset instead of full-bleed.
   -------------------------------------------------------------------------- */
body[data-blog] .page-header-v3 {
    display: none;
}

body[data-blog] .main-content-v3.no-page-header {
    margin-top: 4rem; /* fixed header offset */
}

/* Band-based pages (home + search) escape the standard content gutter */
body[data-blog-home] .main-content-v3,
body[data-blog-search] .main-content-v3 {
    max-width: none;
    padding: 0;
    margin: 0;
}

body[data-blog-home] .main-content-v3.no-page-header,
body[data-blog-search] .main-content-v3.no-page-header {
    margin-top: 4rem;
}

/* --------------------------------------------------------------------------
   Sidebar column: content must never widen or overflow the grid track
   (grid items default to min-width:auto — a long nowrap/truncate title can
   otherwise force the card to paint wider than its 1/3 column)
   -------------------------------------------------------------------------- */
body[data-blog] .kb-sidebar-col,
body[data-blog-home] .kb-sidebar-col {
    min-width: 0;
}

body[data-blog] .kb-sidebar-col .card,
body[data-blog-home] .kb-sidebar-col .card {
    max-width: 100%;
    overflow: hidden;
}

body[data-blog] .kb-sidebar-link-label,
body[data-blog-home] .kb-sidebar-link-label {
    min-width: 0;
}

/* --------------------------------------------------------------------------
   Byline / meta row
   -------------------------------------------------------------------------- */
.blog-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem 1rem;
    margin-top: 0.75rem;
    font-size: 0.8125rem;
    color: var(--et-on-surface-variant);
}

.blog-byline {
    row-gap: 0.5rem;
}

/* Post-card meta wraps on smaller cards */
.blog-card-meta {
    flex-wrap: wrap;
    row-gap: 0.375rem;
}

/* --------------------------------------------------------------------------
   Post-card media thumbnail
   -------------------------------------------------------------------------- */
.blog-card-media {
    margin: -0.25rem 0 1rem;
    border-radius: 0.5rem;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    background: var(--et-surface-container);
}

.blog-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --------------------------------------------------------------------------
   Featured post treatment
   -------------------------------------------------------------------------- */
.blog-featured {
    display: block;
    overflow: hidden;
    margin-bottom: 2rem;
    text-decoration: none;
    border-left: 3px solid var(--et-secondary);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.blog-featured:hover {
    transform: translateY(-2px);
}

.blog-featured-media {
    aspect-ratio: 16 / 7;
    background: var(--et-surface-container);
    overflow: hidden;
}

.blog-featured-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-featured-body {
    padding: 1.5rem 1.75rem 1.75rem;
}

.blog-featured-flag {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--et-secondary);
    margin-bottom: 0.5rem;
}

.blog-featured-title {
    font-size: 1.75rem;
    line-height: 1.2;
    font-weight: 800;
    color: var(--et-on-surface);
    margin-bottom: 0.5rem;
}

.blog-featured-excerpt {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--et-on-surface-variant);
}

/* --------------------------------------------------------------------------
   Pagination controls (kb-v3 has no base pagination styles, only a print
   media-query that hides .kb-pagination)
   -------------------------------------------------------------------------- */
.blog-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: 1.5rem;
    border-top: 1px solid var(--et-outline-variant);
}

.blog-pagination-status {
    font-size: 0.875rem;
    color: var(--et-on-surface-variant);
}

.blog-pagination-links {
    display: flex;
    gap: 0.5rem;
}

/* --------------------------------------------------------------------------
   Migrated WordPress content helpers (scoped to .blog-article-content)
   -------------------------------------------------------------------------- */

/* Responsive 16:9 iframe wrapper for video embeds */
.blog-article-content .video-embed {
    position: relative;
    width: 100%;
    max-width: 100%;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    overflow: hidden;
    margin: 1.5rem 0;
    border-radius: 0.5rem;
    background: var(--et-surface-container);
}

.blog-article-content .video-embed iframe,
.blog-article-content .video-embed object,
.blog-article-content .video-embed embed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* WordPress caption blocks */
.blog-article-content .wp-caption {
    max-width: 100%;
    margin: 1.5rem auto;
    text-align: center;
}

.blog-article-content .wp-caption img {
    max-width: 100%;
    height: auto;
}

.blog-article-content .wp-caption-text {
    margin-top: 0.5rem;
    font-size: 0.8125rem;
    color: var(--et-on-surface-variant);
    font-style: italic;
}

/* Alignment helpers from migrated content */
.blog-article-content .aligncenter {
    display: block;
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.blog-article-content .alignleft {
    float: left;
    margin: 0.25rem 1.25rem 1rem 0;
    max-width: 50%;
}

.blog-article-content .alignright {
    float: right;
    margin: 0.25rem 0 1rem 1.25rem;
    max-width: 50%;
}

.blog-article-content .alignnone {
    max-width: 100%;
    height: auto;
}

/* Clear floats at the end of the article body */
.blog-article-content::after {
    content: "";
    display: table;
    clear: both;
}

@media (max-width: 640px) {
    .blog-featured-title {
        font-size: 1.375rem;
    }

    .blog-article-content .alignleft,
    .blog-article-content .alignright {
        float: none;
        display: block;
        margin: 1rem auto;
        max-width: 100%;
    }

    .blog-pagination {
        flex-direction: column;
        align-items: flex-start;
    }
}
