/* Blog styles — the listing at /blog and the article pages in public/blog/.
   Loaded AFTER site.css, so it only adds; it never restyles the shared nav,
   footer or buttons. This is the file to edit when changing how articles look;
   the rest of the site is unaffected. */

/* ─── LISTING: SEARCH + TAG FILTERS ─────────────────────────────────────── */

.blog-filters { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }

.search-wrap { position: relative; max-width: 520px; width: 100%; }
.search-ico {
    position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
    font-size: 0.95rem; opacity: 0.6; pointer-events: none;
}
.search-input {
    width: 100%; min-height: 50px; padding: 12px 44px;
    border-radius: 50px; font-family: inherit; font-size: 0.97rem;
    color: var(--text-main); background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.search-input::placeholder { color: #94a3b8; }   /* #64748b fails AA on this bg */
.search-input:focus {
    outline: none; border-color: rgba(59,130,246,0.55);
    box-shadow: 0 0 0 4px rgba(59,130,246,0.14);
}
/* The browser's own clear affordance would sit on top of ours. */
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; border-radius: 50%;
    border: none; cursor: pointer; font-size: 0.85rem;
    background: rgba(255,255,255,0.08); color: var(--text-muted);
}
.search-clear:hover { background: rgba(255,255,255,0.16); color: #fff; }

.tag-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.tag-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 15px; border-radius: 100px; cursor: pointer;
    font-family: inherit; font-size: 0.85rem; font-weight: 600;
    color: var(--text-muted); background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    transition: all 0.18s ease;
}
.tag-chip:hover { color: #fff; border-color: rgba(59,130,246,0.4); background: rgba(59,130,246,0.1); }
.tag-chip .n {
    font-size: 0.72rem; font-weight: 700; padding: 1px 7px;
    border-radius: 100px; background: rgba(255,255,255,0.08); color: inherit;
}
.tag-chip.active {
    color: #fff; background: var(--primary-gradient);
    border-color: transparent; box-shadow: 0 4px 14px rgba(59,130,246,0.3);
}
.tag-chip.active .n { background: rgba(255,255,255,0.22); }

.result-count { color: var(--text-muted); font-size: 0.88rem; margin-bottom: 18px; min-height: 1.2em; }

/* ─── LISTING: CARDS ────────────────────────────────────────────────────── */

/* auto-FILL, not auto-fit: with one or two articles the columns keep their
   width instead of one card stretching across the whole row and blowing the
   cover image up. */
.post-grid {
    display: grid; gap: 22px;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}
@media (max-width: 719px) { .post-grid { grid-template-columns: 1fr; } }

/* The <article> is just the semantic wrapper; the <a> inside does the work. */
.post-card-wrap { display: flex; }

/* The whole card is the link, so the click target is the full box. */
a.post-card {
    display: flex; flex-direction: column; width: 100%;
    border-radius: 20px; overflow: hidden;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
a.post-card:hover {
    transform: translateY(-4px);
    border-color: rgba(59,130,246,0.45);
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
}

/* Fixed aspect box, so mixed image sizes still line the grid up. */
.post-cover { aspect-ratio: 16 / 9; overflow: hidden; background: #1e293b; }
.post-cover img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.35s ease; }
.post-card:hover .post-cover img { transform: scale(1.04); }
.post-cover-fallback {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}
.post-cover-fallback span {
    font-size: 2.6rem; font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; opacity: 0.85;
}

.post-card-body { display: flex; flex-direction: column; gap: 10px; padding: 22px 24px 24px; flex: 1; }
.post-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.post-card .post-meta {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
    font-size: 0.8rem; color: var(--text-muted);
}
.post-card h3 {
    font-size: 1.22rem; line-height: 1.35; color: #fff;
    letter-spacing: -0.4px; margin: 0;
}
.post-card p { color: var(--text-muted); font-size: 0.93rem; margin: 0; }
.post-card .read-more { margin-top: auto; padding-top: 4px; color: #60a5fa; font-weight: 700; font-size: 0.88rem; }

/* ─── ARTICLE PAGE ──────────────────────────────────────────────────────── */

/* site.css makes a bare `header` position:fixed for the floating nav pill.
   An article hero is ordinary page flow, so undo that here — otherwise it
   lifts out of the document and the body text runs underneath it. */
.article-hero {
    position: static; display: block; z-index: auto;
    pointer-events: auto; padding: 140px 0 10px;
}
.article-hero .container-narrow { text-align: left; }
.article-hero .post-meta {
    display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    font-size: 0.85rem; color: var(--text-muted); margin-bottom: 16px;
}
.article-hero h1 {
    font-size: clamp(1.9rem, 4.6vw, 2.85rem); line-height: 1.12;
    letter-spacing: -1.4px; color: #fff; margin-bottom: 14px;
}
.article-hero .lede { font-size: 1.12rem; color: var(--text-muted); line-height: 1.65; }

.breadcrumbs { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 18px; }
.breadcrumbs a { color: #60a5fa; font-weight: 600; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs span { opacity: 0.5; margin: 0 6px; }

/* Long-form body. Generous measure and rhythm — this is the reading surface. */
.article-body { padding: 26px 0 60px; font-size: 1.05rem; line-height: 1.8; color: #cbd5e1; }
.article-body > * + * { margin-top: 1.25em; }

.article-body h2 {
    font-size: 1.62rem; color: #fff; letter-spacing: -0.6px;
    line-height: 1.25; margin-top: 2.2em; margin-bottom: 0.1em;
    padding-top: 0.6em; border-top: 1px solid var(--glass-border);
}
.article-body h3 { font-size: 1.22rem; color: #fff; letter-spacing: -0.3px; margin-top: 1.8em; margin-bottom: 0.1em; }
.article-body h4 { font-size: 1.06rem; color: #e2e8f0; margin-top: 1.6em; margin-bottom: 0.1em; }
.article-body h5 {
    font-size: 0.93rem; color: #cbd5e1; margin-top: 1.5em; margin-bottom: 0.1em;
    text-transform: uppercase; letter-spacing: 0.9px; font-weight: 700;
}
.article-body h6 {
    font-size: 0.85rem; color: var(--text-muted); margin-top: 1.4em; margin-bottom: 0.1em;
    letter-spacing: 0.5px; font-weight: 700;
}

/* Anchor targets sit below the fixed nav instead of under it. */
.article-body :is(h2, h3, h4, h5, h6) { scroll-margin-top: 110px; }

/* A quiet "#" that appears on hover, for linking straight to a section. */
.heading-anchor {
    opacity: 0; margin-left: 0.4em; color: var(--primary);
    font-weight: 600; text-decoration: none !important; font-size: 0.8em;
    transition: opacity 0.15s ease;
}
.article-body :is(h2, h3, h4, h5, h6):hover .heading-anchor,
.heading-anchor:focus { opacity: 1; }

/* ─── TABLE OF CONTENTS ─────────────────────────────────────────────────── */

.toc {
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 18px; padding: 20px 24px; margin-bottom: 2em;
}
.toc-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; width: 100%;
    background: none; border: none; padding: 0; cursor: pointer;
    font-family: inherit; font-size: 0.78rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1.2px; color: var(--text-muted);
}
.toc-head:hover { color: #fff; }
.toc-head .chev { transition: transform 0.25s ease; font-size: 0.7rem; }
.toc-head[aria-expanded="false"] .chev { transform: rotate(-90deg); }

.toc-list { list-style: none; padding: 0; margin: 14px 0 0; }
.toc-list[hidden] { display: none; }
.toc-list li { margin: 0; }
/* !important: .article-body a underlines body links, and the TOC sits inside
   the article body. Navigation links shouldn't read as prose links. */
.toc-list a {
    display: block; padding: 6px 0 6px 12px;
    border-left: 2px solid var(--glass-border);
    color: var(--text-muted); font-size: 0.93rem; line-height: 1.45;
    font-weight: 500;
    text-decoration: none !important; transition: all 0.15s ease;
}
.toc-list a:hover { color: #fff; border-left-color: var(--primary); }
/* Marks the section currently on screen. */
.toc-list a.current { color: #60a5fa; border-left-color: var(--primary); font-weight: 600; }
/* Indent by heading depth. */
.toc-list .lvl-3 a { padding-left: 26px; font-size: 0.89rem; }
.toc-list .lvl-4 a { padding-left: 40px; font-size: 0.86rem; }
.toc-list .lvl-5 a,
.toc-list .lvl-6 a { padding-left: 54px; font-size: 0.83rem; }
.article-body p { margin-top: 1.1em; }
.article-body strong { color: #f1f5f9; font-weight: 700; }
/* :not(.btn) so a button placed in the body keeps its own look. */
.article-body a:not(.btn) { color: #60a5fa; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.article-body a:not(.btn):hover { color: #93c5fd; }

.article-body ul, .article-body ol { padding-left: 1.3em; }
.article-body li { margin-top: 0.55em; }
.article-body li::marker { color: var(--primary); }

.article-body img { border-radius: 16px; border: 1px solid var(--glass-border); display: block; }

.article-body blockquote {
    border-left: 3px solid var(--primary);
    background: rgba(59,130,246,0.07);
    padding: 16px 22px; border-radius: 0 14px 14px 0;
    color: #e2e8f0; font-size: 1.06rem;
}
.article-body blockquote p { margin: 0; }

.article-body code {
    background: rgba(148,163,184,0.14); color: #93c5fd;
    padding: 2px 7px; border-radius: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.88em;
}
.article-body pre {
    background: #0b1220; border: 1px solid var(--glass-border);
    border-radius: 14px; padding: 18px 20px; overflow-x: auto;
}
.article-body pre code { background: none; padding: 0; color: #cbd5e1; font-size: 0.86rem; line-height: 1.65; }

/* Pull-out box for a tip or takeaway inside an article. */
.callout {
    display: flex; gap: 14px; align-items: flex-start;
    background: var(--glass-bg); border: 1px solid var(--glass-border);
    border-radius: 16px; padding: 20px 22px;
}
.callout .ico {
    width: 42px; height: 42px; flex-shrink: 0; border-radius: 12px;
    background: rgba(59,130,246,0.12);
    display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
/* A <p>, not a heading: it labels the box, it isn't a section of the article.
   As a heading it would break the h2→h3→h4 outline screen readers rely on. */
.callout .callout-title {
    color: #fff; font-size: 1rem; font-weight: 700;
    margin: 0 0 4px !important; line-height: 1.4;
}
.callout h4 { color: #fff; font-size: 1rem; margin: 0 0 4px; }
.callout p { color: var(--text-muted); font-size: 0.93rem; margin: 0 !important; }

/* Scrolls sideways on a narrow phone instead of widening the page. */
.article-body table { width: 100%; border-collapse: collapse; font-size: 0.95rem; display: block; overflow-x: auto; }
.article-body thead, .article-body tbody { width: 100%; }
.article-body tr { display: table; width: 100%; table-layout: fixed; }
.article-body th, .article-body td { padding: 11px 14px; border-bottom: 1px solid var(--glass-border); text-align: left; }
.article-body th { color: #fff; font-weight: 700; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.6px; }
.article-body td { color: var(--text-muted); }

/* ─── END-OF-ARTICLE CTA ────────────────────────────────────────────────── */

.article-cta {
    position: relative; overflow: hidden;
    text-align: center; padding: 40px 30px; margin-top: 3em;
    border: 1px solid rgba(59,130,246,0.25);
    background:
        radial-gradient(ellipse 80% 120% at 50% 0%, rgba(59,130,246,0.16), transparent 70%),
        var(--glass-bg);
}
/* Soft glow arc across the top edge. */
.article-cta::before {
    content: ''; position: absolute; top: 0; left: 50%;
    transform: translateX(-50%);
    width: 60%; height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59,130,246,0.85), transparent);
}
.article-cta h3 {
    color: #fff; font-size: 1.45rem; margin: 0 0 10px;
    letter-spacing: -0.5px; line-height: 1.25;
}
.article-cta p {
    color: var(--text-muted); margin: 0 auto 24px;
    max-width: 440px; font-size: 0.98rem;
}
/* Bigger, with a lift and a glow — this is the one thing to click.
   The colour and underline are forced because .article-body a styles every
   link in the body as prose, which would otherwise wash the button out. */
.article-cta .btn {
    min-height: 54px; padding: 15px 36px; font-size: 1.02rem;
    color: #fff !important; text-decoration: none !important;
    box-shadow: 0 8px 24px rgba(59,130,246,0.32);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.article-cta .btn:hover { color: #fff !important; }
.article-cta .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 34px rgba(59,130,246,0.45);
    filter: brightness(1.08);
}
.article-cta .btn:active { transform: translateY(-1px); }
.article-cta .cta-note { font-size: 0.82rem; color: var(--text-muted); margin: 16px 0 0; }

@media (prefers-reduced-motion: reduce) {
    .article-cta .btn, .post-cover img, a.post-card { transition: none; }
    .article-cta .btn:hover, a.post-card:hover { transform: none; }
}

@media (max-width: 620px) {
    .article-hero { padding-top: 120px; }
    .article-body { font-size: 1.01rem; }
}
