/* ══════════════════════════════════════════════════════════════
   BLOG LAYOUT — structural styles for blog.html and blog-post.html.
   Uses qcs_theme.css tokens only (colors, fonts, radius, shadows) —
   no new palette, no rounded-corner "cosmic" treatment.
   ══════════════════════════════════════════════════════════════ */

/* ── SHARED BADGE ── */
.blog-badge {
    display: inline-block; padding: 4px 12px; font-size: 0.68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.06em; background: #fff; color: var(--primary);
    border: 1px solid var(--primary); border-radius: var(--radius-sm); white-space: nowrap;
}

/* ── BLOG LISTING: HERO / TOOLBAR ── */
.blog-hero { background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%); border-bottom: 1px solid var(--border); padding: 160px 0 40px; }

/* Top row: heading + description on the left, search on the right. Stacks on mobile. */
.blog-hero-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.blog-hero-text { flex: 1; min-width: 260px; }
.blog-eyebrow { font-family: 'SF Mono', Menlo, monospace; font-size: 0.72rem; color: var(--primary); text-transform: uppercase; letter-spacing: 0.25em; margin-bottom: 14px; }
.blog-hero-title { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: clamp(1.6rem, 4vw, 3rem); line-height: 1.12; letter-spacing: -0.01em; margin-bottom: 14px; }
.blog-hero-title span { color: var(--primary); }
/* Keeps "Insights & Resources" on one line once the search box has moved to
   its fixed-width column alongside it (≥768px); below that they stack, so
   the title is left free to wrap rather than overflow the viewport. */
@media (min-width: 768px) { .blog-hero-title { white-space: nowrap; } }
.blog-hero-desc { color: var(--muted); font-size: 1rem; max-width: 560px; line-height: 1.6; }

.blog-search { position: relative; width: 100%; flex-shrink: 0; }
@media (min-width: 768px) { .blog-search { width: 320px; margin-top: 4px; } }
.blog-search input {
    width: 100%; padding: 12px 16px 12px 40px; border: 1px solid var(--border2); border-radius: var(--radius-sm);
    font-family: inherit; font-size: 0.9rem; background: #fff;
}
.blog-search input:focus { outline: none; border-color: var(--primary); }
.blog-search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 0.9rem; pointer-events: none; }

/* Category pills always start on their own line, below the row above. */
.blog-cats { margin-top: 24px; display: flex; gap: 8px; flex-wrap: wrap; }
.blog-cat-btn {
    padding: 10px 18px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; font-family: inherit;
    border: 1.5px solid var(--border2); background: transparent; color: var(--text-secondary);
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.blog-cat-btn:hover { border-color: var(--primary); color: var(--primary); }
.blog-cat-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ── FEATURED POST ── */
.blog-featured { margin-bottom: 56px; text-decoration: none; display: block; }
/* The image previously bled flush to the card's border while the text side
   had 40px of padding — an uneven, unfinished-looking rectangle. A uniform
   frame around both sides fixes that. */
.blog-featured-inner {
    display: grid; grid-template-columns: 1fr; gap: 16px; padding: 16px;
    border: 1px solid var(--border); border-radius: 16px; background: #fff; transition: all 0.3s ease;
}
@media (min-width: 900px) { .blog-featured-inner { grid-template-columns: 1.1fr 1fr; } }
.blog-featured-inner:hover { border-color: #000; box-shadow: var(--shadow-lg); }
.blog-featured-img { position: relative; height: 260px; border-radius: 8px; background: var(--bg2); overflow: hidden; }
@media (min-width: 900px) { .blog-featured-img { height: auto; } }
.blog-featured-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); display: block; }
.blog-featured-inner:hover .blog-featured-img img { transform: scale(1.03); }
.blog-featured-badge { position: absolute; top: 16px; left: 16px; }
.blog-featured-body { padding: 24px; display: flex; flex-direction: column; justify-content: center; }
.blog-featured-meta { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; color: var(--muted); font-size: 0.78rem; }
.blog-featured-body h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin-bottom: 16px; line-height: 1.28; }
.blog-featured-inner:hover .blog-featured-body h2 { color: var(--primary); }
.blog-featured-body p { color: var(--text-secondary); margin-bottom: 24px; line-height: 1.7; }
.blog-featured-link { color: var(--primary); font-weight: 700; font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; }

/* ── POSTS GRID ── */
.blog-grid { display: grid; grid-template-columns: 1fr; gap: 28px; }
@media (min-width: 640px) { .blog-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .blog-grid { grid-template-columns: repeat(3, 1fr); } }
.blog-card {
    display: flex; flex-direction: column; height: 100%;
    border: 1px solid var(--border); border-radius: 14px; padding: 12px;
    background: #fcfcfc; transition: all 0.3s ease; text-decoration: none;
}
.blog-card:hover { background: #fff; border-color: #000; box-shadow: var(--shadow-lg); transform: translateY(-4px); }
.blog-card-img { position: relative; height: 190px; overflow: hidden; border-radius: 8px; background: var(--bg2); }
.blog-card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s var(--ease); display: block; }
.blog-card:hover .blog-card-img img { transform: scale(1.03); }
.blog-card-badge { position: absolute; top: 12px; left: 12px; }
.blog-card-body { padding: 12px 4px 4px; display: flex; flex-direction: column; flex: 1; }
.blog-card-meta { font-size: 0.75rem; color: var(--muted); margin-bottom: 10px; display: flex; gap: 6px; align-items: center; }
.blog-card h3 { font-size: 1.05rem; line-height: 1.4; margin-bottom: 10px; color: var(--text); transition: color 0.15s; }
.blog-card:hover h3 { color: var(--primary); }
.blog-card p {
    font-size: 0.85rem; color: var(--muted); line-height: 1.6; margin-bottom: 16px; flex: 1;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.blog-card-readmore { font-size: 0.8rem; font-weight: 700; color: var(--primary); margin-top: auto; }

/* ── PAGINATION ── */
.blog-pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 56px; flex-wrap: wrap; }
.blog-page-btn {
    min-width: 40px; height: 40px; padding: 0 14px; border: 1.5px solid var(--border2); background: #fff;
    color: var(--text-secondary); font-weight: 700; font-size: 0.85rem; font-family: inherit;
    cursor: pointer; border-radius: var(--radius-sm); transition: all 0.15s;
}
.blog-page-btn:hover:not(:disabled):not(.active) { border-color: var(--primary); color: var(--primary); }
.blog-page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; cursor: default; }
.blog-page-btn:disabled { opacity: 0.4; cursor: default; }

/* ══════════════════════════════════════════════════════════════
   BLOG POST — dark header band, article + sticky sidebar, TOC,
   share buttons, related posts.
   ══════════════════════════════════════════════════════════════ */

.bp-header {
    position: relative; overflow: hidden;
    background: #111111; color: #fff; padding: 150px 0 56px;
}
/* Layer stack, back to front: the post's own cover image (blurred + darkened,
   set via JS once the post loads — falls back to nothing, just the plain
   #111111 base, for posts without a cover) → brand-colored glow blobs →
   dot-grid texture → content. Same #111111 base as the site's other dark
   sections (e.g. #cta) either way, all still dark enough to keep the white
   text comfortably readable. */
.bp-header-bg {
    position: absolute; inset: -10%; z-index: 0; pointer-events: none;
    background-size: cover; background-position: center;
    filter: blur(10px) brightness(0.4) saturate(1.15);
}
.bp-header::before, .bp-header::after {
    content: ''; position: absolute; z-index: 1; border-radius: 50%; filter: blur(70px); pointer-events: none;
}
.bp-header::before { width: 560px; height: 560px; background: radial-gradient(circle, rgba(226,19,108,0.65), transparent 70%); top: -240px; right: -100px; }
.bp-header::after { width: 500px; height: 500px; background: radial-gradient(circle, rgba(0,85,197,0.6), transparent 70%); bottom: -240px; left: 5%; }
.bp-header .bp-header-dots {
    position: absolute; inset: 0; z-index: 2; pointer-events: none; opacity: 0.8;
    background-image: radial-gradient(rgba(255,255,255,0.22) 1.3px, transparent 1.3px);
    background-size: 28px 28px;
    -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), transparent);
    mask-image: linear-gradient(180deg, rgba(0,0,0,0.9), transparent);
}
.bp-header > .container { position: relative; z-index: 3; }
.bp-breadcrumb { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 0.8rem; color: rgba(255,255,255,0.55); margin-bottom: 20px; }
.bp-breadcrumb a { color: rgba(255,255,255,0.55); text-decoration: none; }
.bp-breadcrumb a:hover { color: #fff; }
.bp-header .blog-badge { background: transparent; color: #fff; border-color: rgba(255,255,255,0.4); margin-bottom: 16px; }
.bp-header h1 { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: clamp(1.4rem, 2.6vw, 1.9rem); line-height: 1.28; max-width: 820px; margin-bottom: 20px; color: #fff; }
.bp-byline { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.85rem; color: rgba(255,255,255,0.7); }
.bp-byline strong { color: rgba(255,255,255,0.95); }

.bp-layout-wrap { background: var(--bg2); padding: 48px 0 0; }
/* qcs_theme.css's shared .container adds its own 5% side padding on top of
   being centered at max-width — fine site-wide, but here it just eats into
   the two-column layout's width for no benefit. Drop it at desktop widths
   only, where the grid actually needs the room; mobile/tablet keep the
   theme's default edge padding. */
@media (min-width: 960px) { .bp-layout-wrap .container { padding-left: 0; padding-right: 0; } }
.bp-layout { display: grid; grid-template-columns: 1fr; gap: 32px; align-items: start; }
@media (min-width: 960px) { .bp-layout { grid-template-columns: minmax(0, 1fr) 340px; } }
.bp-article-col { min-width: 0; }
.bp-cover { margin-bottom: 24px; overflow: hidden; border: 1px solid var(--border); }
.bp-cover img { width: 100%; display: block; max-height: 480px; object-fit: cover; }
.bp-card { background: #fff; border: 1px solid var(--border); padding: clamp(24px, 4vw, 48px); margin-bottom: 24px; }

.bp-toc { border: 1px solid var(--border); margin-bottom: 32px; }
.bp-toc-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px; border-bottom: 1px solid var(--border); font-weight: 800; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; }
.bp-toc-list { list-style: none; padding: 10px; margin: 0; }
.bp-toc-link { display: flex; gap: 10px; padding: 8px 12px; text-decoration: none; color: var(--text-secondary); border-left: 2px solid transparent; font-size: 0.85rem; line-height: 1.4; transition: all 0.15s; }
.bp-toc-link:hover { background: var(--bg2); border-left-color: var(--primary); color: var(--primary); }
.bp-toc-link.lvl2 { padding-left: 30px; font-size: 0.8rem; }

.bp-share { display: flex; align-items: center; gap: 10px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.bp-share span { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); }
.bp-share button { width: 32px; height: 32px; border: 1px solid var(--border2); background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; border-radius: var(--radius-sm); color: var(--text-secondary); }
.bp-share button:hover { border-color: var(--primary); color: var(--primary); }

/* position:sticky alone can't be used here — html/body carry a deliberate
   overflow-x:hidden (theme-wide, keeps other pages from scrolling
   sideways), and that makes the browser treat html/body as the sticky
   containing block instead of the real viewport, so the sidebar would
   just scroll away like a normal element. JS-positioned fixed/absolute
   (wired up in initStickySidebar below) sidesteps that entirely — same
   fixed→absolute-rest technique the reference layout itself uses. */
.bp-sidebar { position: relative; }
@media (max-width: 960px) { .bp-sidebar { position: static; } }
.bp-sidebar-card { background: #fff; border: 1px solid var(--border); padding: 36px; }
.bp-sidebar-card h2 { font-size: 1.4rem; margin-bottom: 8px; }
.bp-sidebar-card > p { color: var(--muted); font-size: 0.92rem; margin-bottom: 24px; }
.bp-sidebar-card .pbk-form-embed-form { gap: 18px; }
/* The 340px sidebar is too narrow for .pbk-form-row's side-by-side inputs —
   flex:1 without min-width:0 hits their content-based minimum width and
   overflows the card instead of shrinking, so stack them here instead. */
.bp-sidebar-card .pbk-form-row { flex-direction: column; gap: 18px; }
.bp-sidebar-card .pbk-form-row input, .bp-sidebar-card .pbk-form-embed-form textarea { padding: 15px 18px; font-size: 1rem; }
.bp-sidebar-card .btn-primary { width: 100%; padding: 17px 36px; font-size: 1.02rem; }

.bp-related { background: var(--bg2); padding: 56px 0 72px; margin-top: 56px; }
.bp-related h2 { margin-bottom: 28px; font-size: 1.5rem; }
.bp-related-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 640px) { .bp-related-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }

@media (max-width: 640px) {
    .blog-hero { padding: 140px 0 32px; }
    .bp-header { padding: 130px 0 40px; }
}
