/**
 * Blog (listing, topic pages, articles). Loaded only on blog pages, after the
 * theme chain. Everything is under .bl / bl-* so the older single.css rules
 * never reach it.
 *
 * Geist ships 400/500/600 only: nothing here asks for 700 (the browser would
 * fake it). One bold move: the lead story's oversized headline. The rest is
 * quiet: left-aligned on one grid, rows instead of shadowed cards, brand cyan
 * for marks and fills, its darker shade for link text.
 */

.bl {
    --bl-ink: #110229;
    --bl-text: #3a3f55;
    --bl-muted: #6b7088;
    --bl-line: #e6e8ef;
    --bl-wash: #f2f8fb;
    --bl-signal: #5fc2e4;
    --bl-link: #12789c;
    --bl-wrap: 1200px;
    --bl-gutter: clamp(16px, 4vw, 40px);
    --bl-radius-lg: 20px;
    --bl-radius: 12px;

    color: var(--bl-text);
    background: #fff;
    font-family: 'Geist', var(--font-family);
}

body.blog-archive,
body.single-blog-post {
    /* overflow-x: hidden on <body> turns position: sticky off; clip doesn't. */
    overflow-x: clip;
}

/* Resets at one class of weight, so every bl-* rule below (also one class,
   later in the file) wins without !important. */
.bl :where(h1, h2, h3, h4, p, figure, ol, ul) { margin: 0; }
.bl :where(h1, h2, h3, h4) { color: var(--bl-ink); font-weight: 600; }

.bl-wrap {
    max-width: calc(var(--bl-wrap) + 2 * var(--bl-gutter));
    margin-inline: auto;
    padding-inline: var(--bl-gutter);
}

.bl a:focus-visible,
.bl button:focus-visible,
.bl input:focus-visible,
.bl summary:focus-visible {
    outline: 2px solid var(--bl-link);
    outline-offset: 3px;
    border-radius: 4px;
}

.bl-link,
.bl-author a {
    color: var(--bl-link);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

/* ── Listing: intro ───────────────────────────────────────── */

.bl-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
    grid-template-areas:
        "text search"
        "tabs tabs";
    align-items: end;
    column-gap: 48px;
    row-gap: 32px;
    padding-top: clamp(40px, 6vw, 72px);
    padding-bottom: 0;
}

.bl-intro__text { grid-area: text; }

.bl-intro__title {
    font-size: clamp(2.5rem, 5vw, 3.75rem);
    line-height: 1;
    letter-spacing: -0.035em;
}

.bl-intro__lede {
    margin-top: 16px;
    max-width: 56ch;
    font-size: 1.125rem;
    line-height: 1.55;
    color: var(--bl-muted);
}

.bl-search {
    grid-area: search;
    position: relative;
    display: block;
    color: var(--bl-muted);
}

.bl-search svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.bl-search__input {
    width: 100%;
    height: 48px;
    padding: 0 16px 0 44px;
    border: 1px solid var(--bl-line);
    border-radius: var(--bl-radius);
    background: #fff;
    color: var(--bl-ink);
    font: inherit;
    font-size: 1rem;
}

.bl-search__input::placeholder { color: var(--bl-muted); }

.bl-search__input:focus {
    outline: none;
    border-color: var(--bl-link);
    box-shadow: 0 0 0 3px rgba(95, 194, 228, 0.3);
}

.bl-tabs {
    grid-area: tabs;
    display: flex;
    gap: 28px;
    border-bottom: 1px solid var(--bl-line);
    overflow-x: auto;
    scrollbar-width: none;
}

.bl-tabs::-webkit-scrollbar { display: none; }

.bl-tab {
    flex-shrink: 0;
    padding: 0 0 14px;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    color: var(--bl-muted);
    font-size: 0.9375rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 150ms ease, border-color 150ms ease;
}

.bl-tab span {
    margin-left: 4px;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--bl-muted);
    font-variant-numeric: tabular-nums;
}

.bl-tab:hover { color: var(--bl-ink); }

.bl-tab[aria-current="page"] {
    color: var(--bl-ink);
    border-bottom-color: var(--bl-ink);
}

/* ── Posts ───────────────────────────────────────────────── */

.bl-post {
    display: grid;
    grid-template-columns: minmax(120px, 38%) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.bl-post__media {
    display: block;
    aspect-ratio: 4 / 3;
    border-radius: var(--bl-radius);
    overflow: hidden;
    background: var(--bl-wash);
}

.bl-post__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bl-post__placeholder {
    display: block;
    width: 100%;
    height: 100%;
    background: linear-gradient(var(--bl-wash), var(--bl-wash));
}

.bl-post__body {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 0;
}

.bl-post__topic {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--bl-link);
}

.bl-post__topic:hover { text-decoration: underline; text-underline-offset: 3px; }

.bl-post__title {
    margin-top: 6px;
    font-size: 1.25rem;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.bl-post__title a {
    color: var(--bl-ink);
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 0 1px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 200ms ease;
}

.bl-post__title a:hover { background-size: 100% 1px; }

.bl-post__summary {
    margin-top: 8px;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--bl-text);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.bl-post__meta {
    display: flex;
    flex-wrap: wrap;
    column-gap: 16px;
    row-gap: 4px;
    margin-top: 12px;
    font-size: 0.8125rem;
    color: var(--bl-muted);
}

.bl-post--compact .bl-post__title { font-size: 1.0625rem; }

/* Lead story: the one big moment */
.bl-lead { padding-top: clamp(32px, 4vw, 48px); }

.bl-post--lead {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(28px, 4vw, 56px);
    align-items: center;
}

.bl-post--lead .bl-post__media {
    aspect-ratio: 3 / 2;
    border-radius: var(--bl-radius-lg);
}

.bl-post--lead .bl-post__topic { font-size: 0.9375rem; }

.bl-post--lead .bl-post__title {
    margin-top: 12px;
    font-size: clamp(2rem, 3.6vw, 3.25rem);
    line-height: 1.04;
    letter-spacing: -0.035em;
    text-wrap: balance;
}

.bl-post--lead .bl-post__summary {
    margin-top: 20px;
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-line-clamp: 4;
    max-width: 46ch;
}

.bl-post--lead .bl-post__meta {
    margin-top: 24px;
    font-size: 0.875rem;
}

.bl-post--lead .bl-post__meta span:first-child {
    color: var(--bl-ink);
    font-weight: 500;
}

/* More articles */
.bl-more { padding-top: clamp(48px, 6vw, 80px); }

.bl-section-title {
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    padding-bottom: 16px;
    margin-bottom: 32px;
    border-bottom: 1px solid var(--bl-line);
}

.bl-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 48px;
    row-gap: 40px;
}

.bl-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    column-gap: 32px;
}

.bl-grid--three .bl-post {
    grid-template-columns: 1fr;
    gap: 16px;
}

.bl-grid--three .bl-post__media { aspect-ratio: 16 / 10; }

/* Search results */
.bl-results { padding-top: 40px; }

.bl-results__count {
    margin-bottom: 32px;
    font-size: 0.9375rem;
    color: var(--bl-muted);
}

/* Pagination */
.bl-pages {
    display: flex;
    align-items: center;
    gap: 24px;
    padding-top: 56px;
    font-size: 0.9375rem;
}

.bl-pages__list { display: flex; gap: 4px; }

.bl-pages__n {
    display: inline-grid;
    place-items: center;
    min-width: 40px;
    height: 40px;
    border-radius: 10px;
    color: var(--bl-text);
}

.bl-pages__n:hover { background: var(--bl-wash); }

.bl-pages__n[aria-current="page"] {
    background: var(--bl-ink);
    color: #fff;
}

.bl-pages__step {
    color: var(--bl-link);
    font-weight: 500;
}

/* Empty */
.bl-empty { padding-block: 72px; }
.bl-empty h2 { font-size: 1.5rem; }
.bl-empty p { margin: 8px 0 16px; color: var(--bl-muted); }

/* Demo panel (listing end, after an article) */
.bl-cta { padding-top: clamp(56px, 7vw, 96px); padding-bottom: clamp(56px, 7vw, 96px); }

.bl-cta__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: clamp(28px, 4vw, 48px);
    border-radius: var(--bl-radius-lg);
    background: var(--bl-wash);
    border-left: 4px solid var(--bl-signal);
}

.bl-cta__title {
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    line-height: 1.15;
    letter-spacing: -0.025em;
}

.bl-cta__text {
    margin-top: 8px;
    max-width: 52ch;
    font-size: 1rem;
    line-height: 1.55;
}

.bl-cta__button { flex-shrink: 0; }

/* ── Article ─────────────────────────────────────────────── */

.bl-progress {
    position: fixed;
    inset: 0 0 auto 0;
    height: 3px;
    z-index: 1000;
    pointer-events: none;
}

.bl-progress span {
    display: block;
    height: 100%;
    background: var(--bl-signal);
    transform: scaleX(0);
    transform-origin: 0 50%;
}

.bl-head {
    padding-top: clamp(32px, 5vw, 64px);
    padding-bottom: clamp(28px, 4vw, 40px);
}

.bl-head > * { max-width: 880px; }

.bl-crumbs {
    display: flex;
    gap: 8px;
    font-size: 0.9375rem;
    color: var(--bl-muted);
}

.bl-crumbs a { color: var(--bl-link); font-weight: 500; }
.bl-crumbs a:hover { text-decoration: underline; text-underline-offset: 3px; }

.bl-head__title {
    margin-top: 20px;
    font-size: clamp(2.125rem, 4.6vw, 3.5rem);
    line-height: 1.06;
    letter-spacing: -0.035em;
    text-wrap: balance;
}

.bl-head__standfirst {
    margin-top: 20px;
    max-width: 62ch;
    font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
    line-height: 1.55;
    color: var(--bl-muted);
}

.bl-head__byline {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--bl-line);
}

.bl-avatar {
    flex-shrink: 0;
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bl-ink);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 500;
}

.bl-head__who {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.bl-head__author { color: var(--bl-ink); font-weight: 500; }

.bl-head__dates {
    display: flex;
    flex-wrap: wrap;
    column-gap: 16px;
    font-size: 0.875rem;
    color: var(--bl-muted);
}

.bl-share {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.bl-share__btn {
    position: relative;
    display: inline-grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--bl-line);
    border-radius: 50%;
    background: #fff;
    color: var(--bl-ink);
    cursor: pointer;
    transition: border-color 150ms ease;
}

.bl-share__btn:hover { border-color: var(--bl-ink); }

.bl-share__done {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--bl-ink);
    color: #fff;
    font-size: 0.8125rem;
    white-space: nowrap;
}

.bl-cover img {
    width: 100%;
    max-height: 600px;
    object-fit: cover;
    border-radius: var(--bl-radius-lg);
    background: var(--bl-wash);
}

.bl-layout {
    display: grid;
    grid-template-columns: minmax(0, 700px) 260px;
    justify-content: space-between;
    column-gap: 64px;
    padding-top: clamp(40px, 5vw, 64px);
}

.bl-layout--single .bl-side .bl-toc { display: none; }

.bl-side {
    position: sticky;
    top: 110px;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.bl-side__title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--bl-ink);
    margin-bottom: 12px;
}

.bl-toc ol {
    list-style: none;
    padding: 0;
    border-left: 1px solid var(--bl-line);
}

.bl-toc li a {
    display: block;
    margin-left: -1px;
    padding: 7px 0 7px 16px;
    border-left: 2px solid transparent;
    font-size: 0.875rem;
    line-height: 1.4;
    color: var(--bl-muted);
    transition: color 150ms ease, border-color 150ms ease;
}

.bl-toc li a:hover { color: var(--bl-ink); }

.bl-toc li a[aria-current] {
    color: var(--bl-ink);
    border-left-color: var(--bl-signal);
}

.bl-toc--inline { display: none; }

.bl-side__demo {
    padding: 24px;
    border-radius: var(--bl-radius);
    background: var(--bl-wash);
}

.bl-side__demo-title {
    font-weight: 600;
    color: var(--bl-ink);
    line-height: 1.3;
}

.bl-side__demo p:not(.bl-side__demo-title) {
    margin: 6px 0 16px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.bl-side__demo .btn { width: 100%; }

/* Article text */
.bl-prose {
    font-size: 1.1875rem;
    line-height: 1.7;
    color: var(--bl-text);
}

.bl-prose > * + * { margin-top: 1.1em; }

.bl-prose h2 {
    margin-top: 2.2em;
    font-size: clamp(1.5rem, 2.4vw, 1.875rem);
    line-height: 1.2;
    letter-spacing: -0.025em;
    scroll-margin-top: 110px;
}

.bl-prose h3 {
    margin-top: 1.8em;
    font-size: 1.3125rem;
    line-height: 1.3;
    letter-spacing: -0.015em;
    scroll-margin-top: 110px;
}

.bl-prose h4 { margin-top: 1.6em; font-size: 1.125rem; }

.bl-prose h2 + *, .bl-prose h3 + *, .bl-prose h4 + * { margin-top: 0.6em; }

/* Headings written as bold: keep them heading weight, not double-bold. */
.bl-prose h2 strong, .bl-prose h3 strong { font-weight: inherit; }

.bl-prose p { line-height: 1.7; }
.bl-prose strong { color: var(--bl-ink); font-weight: 600; }

.bl-prose a {
    color: var(--bl-link);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.bl-prose a:hover { text-decoration-thickness: 2px; }

.bl-prose ul, .bl-prose ol { padding-left: 1.4em; }
.bl-prose ul { list-style: disc; }
.bl-prose ol { list-style: decimal; }
.bl-prose li + li { margin-top: 0.45em; }
.bl-prose li::marker { color: var(--bl-link); }
.bl-prose li > ul, .bl-prose li > ol { margin-top: 0.45em; }

.bl-prose blockquote {
    margin-left: 0;
    padding: 4px 0 4px 24px;
    border-left: 3px solid var(--bl-signal);
    font-size: 1.25rem;
    line-height: 1.55;
    color: var(--bl-ink);
}

.bl-prose img {
    width: 100%;
    height: auto;
    border-radius: var(--bl-radius);
}

.bl-prose hr {
    border: 0;
    height: 1px;
    background: var(--bl-line);
    margin-block: 2.4em;
}

.bl-prose code {
    padding: 2px 6px;
    border-radius: 6px;
    background: var(--bl-wash);
    font-size: 0.9em;
}

.bl-prose pre {
    padding: 20px;
    border-radius: var(--bl-radius);
    background: var(--bl-ink);
    color: #e9ecf5;
    overflow-x: auto;
    font-size: 0.9rem;
}

.bl-prose pre code { padding: 0; background: none; }

.bl-prose table {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 0.9375rem;
    line-height: 1.5;
}

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

.bl-prose th {
    color: var(--bl-ink);
    font-weight: 600;
    border-bottom-color: var(--bl-ink);
}

.bl-author {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-top: 56px;
    padding-top: 28px;
    border-top: 1px solid var(--bl-line);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.bl-author strong { color: var(--bl-ink); font-weight: 500; }

/* "Keep reading" after an article sits under the demo panel */
.bl-cta + .bl-more { padding-top: 0; padding-bottom: clamp(56px, 7vw, 96px); }
.bl-article + .bl-cta { padding-bottom: clamp(40px, 5vw, 64px); }

/* ── Narrower screens ────────────────────────────────────── */

@media (max-width: 1023px) {
    .bl-layout,
    .bl-layout--single { grid-template-columns: minmax(0, 1fr); }
    .bl-layout .bl-main { max-width: 700px; }
    .bl-side { display: none; }
    .bl-toc--inline {
        display: block;
        margin-bottom: 36px;
        padding: 16px 20px;
        border-radius: var(--bl-radius);
        background: var(--bl-wash);
    }
    .bl-toc--inline summary {
        cursor: pointer;
        font-weight: 500;
        color: var(--bl-ink);
    }
    .bl-toc--inline ol {
        list-style: none;
        padding: 0;
        margin-top: 12px;
    }
    .bl-toc--inline li a {
        display: block;
        padding: 6px 0;
        color: var(--bl-link);
        font-size: 0.9375rem;
    }

    .bl-grid--three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .bl-grid--three .bl-post:nth-child(3) { display: none; }
}

@media (max-width: 860px) {
    .bl-intro {
        grid-template-columns: 1fr;
        grid-template-areas: "text" "search" "tabs";
        row-gap: 24px;
    }
    .bl-post--lead { grid-template-columns: 1fr; gap: 20px; }
    .bl-grid { grid-template-columns: 1fr; row-gap: 32px; }
}

@media (max-width: 600px) {
    .bl-post { grid-template-columns: 112px minmax(0, 1fr); gap: 16px; }
    .bl-post--lead,
    .bl-grid--three .bl-post { grid-template-columns: 1fr; }
    .bl-post__title { font-size: 1.0625rem; }
    .bl-post--lead .bl-post__title { font-size: 2rem; }
    .bl-post:not(.bl-post--lead) .bl-post__summary { display: none; }
    .bl-grid--three { grid-template-columns: 1fr; }
    .bl-grid--three .bl-post:nth-child(3) { display: grid; }
    .bl-grid--three .bl-post { grid-template-columns: 112px minmax(0, 1fr); }
    .bl-grid--three .bl-post__media { aspect-ratio: 4 / 3; }

    .bl-head__byline { flex-wrap: wrap; }
    .bl-share { margin-left: 0; width: 100%; padding-left: 58px; }
    .bl-cover { padding-inline: 0; }
    .bl-cover img { border-radius: 0; max-height: 320px; }
    .bl-prose { font-size: 1.0625rem; }

    .bl-cta__inner { flex-direction: column; align-items: flex-start; }
    .bl-cta__button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .bl-progress { display: none; }
    .bl *, .bl *::before, .bl *::after { transition: none !important; }
}
