/* Blog surfaces — built from the homepage design system, not a second one.
   Colour/shadow/radius tokens come from site.css; never redeclare one here.

   Base typography IS declared here on purpose: every other page carries its own
   inline <style> with the body font, and site.css does not set one, so a page
   that links only site.css falls back to the browser's serif. */

body {
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--muted);
    font-size: 1.0625rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

/* Homepage tokens that live in index.html's inline <style> and are absent from
   site.css. Blog pages carry no inline style, so they are mirrored here with
   the values copied verbatim. Anything site.css already declares (--ink,
   --muted, --faint, --border, --border-strong, --surface-1, --accent,
   --accent-deep, --iris, --r-card, --shadow-card, --gradient, …) is used from
   there. */
:root {
    --font-mono: "JetBrains Mono", "SF Mono", ui-monospace, monospace;
    --tint-teal: #E6F7F7;
    --tint-iris: #F1ECFE;
    --r-pill: 999px;
    --r-tile: 12px;
    --r-panel: 24px;
    --ease-spring: cubic-bezier(.22, 1, .36, 1);
}

/* Same measure and gutters as the homepage, so the content edge lines up with
   the nav lockup above it. */
.wrap {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

.band-soft {
    background: var(--surface-1);
}

/* ---------- shared page furniture ---------- */

/* Verbatim from the homepage .eyebrow. #006D6B / #CDEDED are literals there
   too — the deeper teal is what clears AA on the tint at this size. */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: #006D6B;
    background: var(--tint-teal);
    border: 1px solid #CDEDED;
    border-radius: var(--r-pill);
    padding: 6px 13px;
    margin: 0 0 18px;
}

/* Top padding is the homepage's normal section rhythm (.sec-pad, 58→98px), NOT
   its landing-hero value (160px). The nav is sticky and holds its own flow
   space, so this is pure air under it — 120px read as a void. */
.blog-hero {
    padding: clamp(58px, 6.5vw, 98px) 0 clamp(32px, 3.6vw, 48px);
    text-align: center;
}

/* The index hero carries a single word, so it earns less air on both sides —
   the band edge itself is doing the separating. */
.blog-hero--index {
    padding-top: clamp(44px, 4.6vw, 68px);
    padding-bottom: clamp(20px, 2.2vw, 32px);
}

.blog-hero-title {
    font-size: clamp(2rem, 1.15rem + 3.6vw, 3.5rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.06;
    color: var(--ink);
    max-width: 42rem;
    margin: 0 auto;
    overflow-wrap: break-word;
}

.blog-hero-dek {
    font-size: clamp(1.0625rem, 1rem + .38vw, 1.3rem);
    font-weight: 450;
    line-height: 1.6;
    color: var(--muted);
    max-width: 34rem;
    margin: 20px auto 0;
}

/* Date / reading time as the homepage's hero-meta pills. */
.blog-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 26px 0 0;
}

.blog-meta time,
.blog-meta span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-pill);
    padding: 7px 14px;
    box-shadow: var(--shadow-card);
    font-size: .8125rem;
    font-weight: 600;
    color: var(--muted);
}

.blog-body {
    background: var(--bg);
    padding: clamp(40px, 4.6vw, 64px) 0 clamp(64px, 8vw, 110px);
}

.blog-hero--index + .blog-body {
    padding-top: clamp(28px, 3vw, 40px);
}

/* Hero image gets the full container width and the site's panel chrome, so the
   narrower text measure below it reads as a deliberate choice. */
.blog-figure {
    margin: 0 0 clamp(36px, 4.4vw, 60px);
    border-radius: var(--r-panel);
    overflow: hidden;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    background: linear-gradient(135deg, var(--tint-teal), var(--tint-iris));
}

.blog-figure img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: clamp(220px, 38vw, 460px);
    object-fit: cover;
}

/* ---------- article body ---------- */
/* Plain semantic HTML from the markdown (h1..h3, p, ul, img, table) with no
   classes to hook — everything below reaches it through descendant selectors. */
/* Measured, not guessed: `ch` is the width of "0" (12.45px here) while the
   average character is 8.51px, so a `Nch` max-width renders ~46% more
   characters than N. 39rem lands at ~73 characters; 70ch gave 102. */
.prose {
    max-width: 39rem;
    margin: 0 auto;
    color: var(--muted);
    font-size: 1.0625rem;
    line-height: 1.75;
    overflow-wrap: break-word;
}

.prose > :first-child {
    margin-top: 0;
}

.prose > :last-child {
    margin-bottom: 0;
}

/* Fallback only: the title is normally lifted into the hero by build-blog.mjs. */
.prose h1 {
    font-size: clamp(2rem, 1.3rem + 2.6vw, 3rem);
    font-weight: 800;
    letter-spacing: -.03em;
    line-height: 1.08;
    color: var(--ink);
    margin: 0 0 18px;
    scroll-margin-top: 96px;
}

.prose h2 {
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
    font-weight: 700;
    letter-spacing: -.022em;
    line-height: 1.18;
    color: var(--ink);
    margin: clamp(44px, 5vw, 64px) 0 16px;
    scroll-margin-top: 96px;
}

.prose h2::before {
    content: "";
    display: block;
    width: 34px;
    height: 3px;
    border-radius: var(--r-pill);
    background: var(--gradient);
    margin-bottom: 18px;
}

.prose h3 {
    font-size: clamp(1.125rem, 1.05rem + .35vw, 1.3rem);
    font-weight: 700;
    letter-spacing: -.01em;
    line-height: 1.3;
    color: var(--ink);
    margin: 34px 0 10px;
    scroll-margin-top: 96px;
}

.prose p {
    margin: 0 0 22px;
}

.prose strong {
    color: var(--ink);
    font-weight: 700;
}

.prose a {
    color: var(--accent-deep);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color .18s ease;
}

.prose a:hover {
    color: var(--accent);
}

.prose ul,
.prose ol {
    margin: 0 0 24px;
    padding-left: 24px;
}

.prose li {
    margin: 0 0 10px;
}

.prose li::marker {
    color: var(--accent);
}

/* Vendor images carry no width/height, so a lazy one has no intrinsic size and
   collapses to the 2px border box until it loads. `aspect-ratio: auto 16/9`
   reserves a sensible box up front and hands back to the real ratio on load. */
.prose img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    aspect-ratio: auto 16 / 9;
    object-fit: cover;
    background: var(--surface-1);
    border-radius: var(--r-card);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    margin: 30px 0;
}

.prose blockquote {
    margin: 30px 0;
    padding: 20px 24px;
    background: var(--tint-teal);
    border-left: 3px solid var(--accent);
    border-radius: 0 var(--r-tile) var(--r-tile) 0;
    color: var(--ink);
}

.prose blockquote p:last-child {
    margin-bottom: 0;
}

.prose code {
    font-family: var(--font-mono);
    font-size: .88em;
    color: var(--accent-deep);
    background: var(--surface-1);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 6px;
}

.prose pre {
    overflow-x: auto;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-tile);
    padding: 18px 20px;
    margin: 26px 0;
}

.prose pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}

/* Wide tables scroll inside their own card, never widen the page. */
.prose .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 30px 0;
    border: 1px solid var(--border);
    border-radius: var(--r-tile);
    background: var(--bg);
    box-shadow: var(--shadow-card);
}

.prose table {
    border-collapse: collapse;
    width: 100%;
    min-width: 520px;
    font-size: .95rem;
}

.prose th,
.prose td {
    text-align: left;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.prose th {
    font-family: var(--font-mono);
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--faint);
    background: var(--surface-1);
    white-space: nowrap;
}

.prose tr:last-child td {
    border-bottom: none;
}

/* ---------- article CTA (the homepage .final-panel) ---------- */
.blog-cta {
    display: block;
    margin: clamp(56px, 7vw, 88px) 0 0;
    padding: clamp(40px, 6vw, 68px) clamp(24px, 5vw, 52px);
    border: 1px solid var(--border);
    border-radius: var(--r-panel);
    background: linear-gradient(135deg, var(--tint-teal), var(--tint-iris));
    text-align: center;
    position: relative;
    overflow: hidden;
}

.blog-cta::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(60% 80% at 50% -10%, rgba(255, 255, 255, .6), transparent 60%);
}

.blog-cta > * {
    position: relative;
    z-index: 1;
}

.blog-cta h2 {
    font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -.022em;
    line-height: 1.12;
    color: var(--ink);
    max-width: 34rem;
    margin: 0 auto 14px;
}

.blog-cta p {
    font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem);
    font-weight: 450;
    line-height: 1.6;
    color: var(--muted);
    max-width: 34rem;
    margin: 0 auto 30px;
}

.blog-cta-row {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Scoped so the nav's own .btn-primary keeps site.css sizing. */
.blog-cta .btn {
    font-size: 1rem;
}

.blog-cta .btn-primary {
    padding: 15px 28px;
}

/* ---------- index ---------- */
.blog-more {
    margin-top: auto;
    padding-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: .9rem;
    font-weight: 600;
    color: var(--accent-deep);
}

.blog-more svg {
    width: 14px;
    height: 14px;
    transition: transform .18s var(--ease-spring);
}

/* The card chrome is the homepage .feature / .who-card treatment. */
.blog-feature,
.blog-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--r-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    color: inherit;
    text-decoration: none;
    transition: transform .24s var(--ease-spring), box-shadow .24s var(--ease-spring), border-color .24s var(--ease-spring);
}

.blog-feature:hover,
.blog-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-strong);
}

.blog-feature:hover .blog-more svg,
.blog-card:hover .blog-more svg {
    transform: translateX(3px);
}

.blog-feature:focus-visible,
.blog-card:focus-visible {
    outline: none;
    box-shadow: var(--shadow-card), 0 0 0 3px rgba(0, 184, 185, .35);
}

.blog-feature {
    display: grid;
    grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
}

.blog-feature-media {
    position: relative;
    min-height: clamp(240px, 26vw, 340px);
    background: linear-gradient(135deg, var(--tint-teal), var(--tint-iris));
    border-right: 1px solid var(--border);
}

.blog-feature-media img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.blog-feature-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(28px, 3.4vw, 44px);
}

.blog-feature-body h2 {
    font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.9rem);
    font-weight: 700;
    letter-spacing: -.022em;
    line-height: 1.18;
    color: var(--ink);
    margin: 0 0 12px;
}

.blog-feature-body p {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--muted);
    margin: 0;
}

/* An auto margin would eat the free space and defeat justify-content:center. */
.blog-feature-body .blog-more {
    margin-top: 0;
    padding-top: 22px;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
    gap: clamp(18px, 2.2vw, 26px);
    margin-top: clamp(18px, 2.2vw, 26px);
}

.blog-card {
    display: flex;
    flex-direction: column;
}

.blog-card-img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: linear-gradient(135deg, var(--tint-teal), var(--tint-iris));
    border-bottom: 1px solid var(--border);
}

.blog-card-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    padding: 24px;
}

.blog-card-body h2 {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -.015em;
    line-height: 1.3;
    color: var(--ink);
    margin: 0 0 9px;
}

.blog-card-body p {
    font-size: .92rem;
    line-height: 1.55;
    color: var(--muted);
    margin: 0;
}

.blog-kicker {
    display: block;
    font-family: var(--font-mono);
    font-size: .7rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--faint);
    margin: 0 0 12px;
}

/* ---------- responsive ---------- */
@media (max-width: 860px) {
    /* Grid columns become rows cleanly — no flex basis to reinterpret as height. */
    .blog-feature {
        grid-template-columns: 1fr;
    }

    .blog-feature-media {
        min-height: 0;
        aspect-ratio: 16 / 9;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
}

@media (max-width: 560px) {
    .wrap {
        padding: 0 18px;
    }

    .prose {
        font-size: 1rem;
    }

    .blog-cta-row {
        flex-direction: column;
        align-items: stretch;
    }

    .blog-cta-row .btn {
        width: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .blog-feature,
    .blog-card,
    .blog-more svg {
        transition: none;
    }

    .blog-feature:hover,
    .blog-card:hover,
    .blog-feature:hover .blog-more svg,
    .blog-card:hover .blog-more svg {
        transform: none;
    }
}
