/* Loadline — a Ghost theme for lewysjones.co.uk
   ------------------------------------------------------------------------- */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-normal.woff2") format("woff2");
}
@font-face {
    font-family: "Inter";
    font-style: italic;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-italic.woff2") format("woff2");
}
@font-face {
    font-family: "Space Grotesk";
    font-style: normal;
    font-weight: 300 700;
    font-display: swap;
    src: url("../fonts/space-grotesk-normal.woff2") format("woff2");
}
@font-face {
    font-family: "JetBrains Mono";
    font-style: normal;
    font-weight: 100 800;
    font-display: swap;
    src: url("../fonts/jetbrains-mono-normal.woff2") format("woff2");
}

/* Tokens ------------------------------------------------------------------ */

:root {
    --font-heading: var(--gh-font-heading, "Space Grotesk"), ui-sans-serif, system-ui, sans-serif;
    --font-body: var(--gh-font-body, "Inter"), ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --brand: var(--ghost-accent-color, #2b54e0);

    --bg: #f8f7f4;
    --surface: #ffffff;
    --surface-2: #f0eee9;
    --text: #15171c;
    --text-2: #4a505c;
    --text-3: #6d7380;
    --border: #e3e0d8;
    --border-strong: #cfcbc1;
    --accent: var(--brand);
    --accent-text: #ffffff;
    --accent-soft: color-mix(in srgb, var(--brand) 10%, transparent);
    --p95: #e2860b;
    --ok: #16a34a;
    --cover-bg: #eceef3;
    --cover-ink: #15171c;
    --cover-line-mix: 82%;

    --code-bg: #14161c;
    --code-bar: #1b1e26;
    --code-text: #e6e8ef;
    --code-border: #262a35;

    --shadow: 0 1px 2px rgb(20 20 30 / 0.04), 0 8px 24px -12px rgb(20 20 30 / 0.12);
    --radius: 14px;
    --radius-sm: 8px;

    --container: 1180px;
    --narrow: 720px;
    --gutter: clamp(16px, 4vw, 32px);

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root[data-scheme="system"] {
        --bg: #0e1015;
        --surface: #151820;
        --surface-2: #1b1f29;
        --text: #eceef3;
        --text-2: #b4b9c6;
        --text-3: #8a90a0;
        --border: #252a36;
        --border-strong: #343a48;
        --accent: color-mix(in srgb, var(--brand) 55%, #ffffff);
        --accent-text: #0e1015;
        --accent-soft: color-mix(in srgb, var(--brand) 22%, transparent);
        --p95: #f5a524;
        --cover-bg: #0d1016;
        --cover-ink: #ffffff;
        --cover-line-mix: 100%;
        --code-bg: #0a0c10;
        --code-bar: #11141a;
        --code-border: #232836;
        --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -16px rgb(0 0 0 / 0.6);
        color-scheme: dark;
    }
}

:root[data-scheme="dark"] {
    --bg: #0e1015;
    --surface: #151820;
    --surface-2: #1b1f29;
    --text: #eceef3;
    --text-2: #b4b9c6;
    --text-3: #8a90a0;
    --border: #252a36;
    --border-strong: #343a48;
    --accent: color-mix(in srgb, var(--brand) 55%, #ffffff);
    --accent-text: #0e1015;
    --accent-soft: color-mix(in srgb, var(--brand) 22%, transparent);
    --p95: #f5a524;
    --cover-bg: #0d1016;
    --cover-ink: #ffffff;
    --cover-line-mix: 100%;
    --code-bg: #0a0c10;
    --code-bar: #11141a;
    --code-border: #232836;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 12px 32px -16px rgb(0 0 0 / 0.6);
    color-scheme: dark;
}

/* Base -------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 88px;
}

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; }
img { height: auto; display: block; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0;
    text-wrap: balance;
}

p { margin: 0; }

button { font: inherit; color: inherit; }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

::selection { background: var(--accent-soft); }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    z-index: 100;
    padding: 10px 16px;
    background: var(--accent);
    color: var(--accent-text);
    border-radius: var(--radius-sm);
}
.skip-link:focus { top: 16px; }

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.site-main { flex: 1 0 auto; padding-bottom: clamp(56px, 8vw, 96px); }
/* Sections with their own background or padding run straight into the footer */
.site-main:has(> :last-child:is(.related, .topics, .post-feed-section)) { padding-bottom: 0; }

.container {
    width: 100%;
    max-width: calc(var(--container) + var(--gutter) * 2);
    margin: 0 auto;
    padding: 0 var(--gutter);
}
.container-narrow {
    width: 100%;
    max-width: calc(var(--narrow) + var(--gutter) * 2);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-3);
    display: block;
}

/* Buttons & pills --------------------------------------------------------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s, border-color .15s, color .15s, transform .15s;
}
.button svg { width: 16px; height: 16px; }
.button:active { transform: translateY(1px); }

.button-primary { background: var(--accent); color: var(--accent-text); }
.button-primary:hover { background: color-mix(in srgb, var(--accent) 85%, var(--text)); }

.button-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.button-ghost:hover { border-color: var(--text-3); background: var(--surface); }

.text-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--accent);
}
.text-link svg { width: 16px; height: 16px; transition: transform .15s; }
.text-link:hover svg { transform: translateX(3px); }

.tag-pill, .members-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.6;
}
.tag-pill { background: var(--accent-soft); color: var(--accent); }
.tag-pill:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }
.members-pill { background: color-mix(in srgb, var(--p95) 14%, transparent); color: color-mix(in srgb, var(--p95) 75%, var(--text)); }
.members-pill svg { width: 12px; height: 12px; }

/* Header ------------------------------------------------------------------ */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 68px;
}

.site-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-heading);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
    flex-shrink: 0;
}
.site-logo { max-height: 36px; width: auto; }

.brand-mark {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent);
    color: var(--accent-text);
}
.brand-mark svg { width: 18px; height: 18px; stroke-width: 2.4; }

.site-nav { margin-right: auto; }
.site-nav .nav {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-nav .nav a {
    display: block;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-2);
    transition: color .15s, background-color .15s;
}
.site-nav .nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav .nav-current a { color: var(--text); background: var(--surface-2); }

.header-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}
.header-actions .button { height: 36px; padding: 0 14px; font-size: 14px; }
.header-signin {
    padding: 0 10px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
}
.header-signin:hover { color: var(--text); }

.icon-button {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    transition: background-color .15s, color .15s;
}
.icon-button:hover { background: var(--surface-2); color: var(--text); }
.icon-button svg { width: 19px; height: 19px; display: block; }
.icon-button > span { display: block; line-height: 0; }

.scheme-toggle .icon-sun { display: none; }
:root[data-scheme="dark"] .scheme-toggle .icon-sun { display: block; }
:root[data-scheme="dark"] .scheme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root[data-scheme="system"] .scheme-toggle .icon-sun { display: block; }
    :root[data-scheme="system"] .scheme-toggle .icon-moon { display: none; }
}

.menu-toggle { display: none; }
.burger, .burger::before, .burger::after {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: currentColor;
    transition: transform .2s, opacity .2s;
}
.burger { position: relative; }
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; }
.burger::after { top: 6px; }
.menu-open .burger { background: transparent; }
.menu-open .burger::before { transform: translateY(6px) rotate(45deg); }
.menu-open .burger::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 860px) {
    .header-inner { gap: 8px; }
    .site-brand { margin-right: auto; }
    .menu-toggle { display: grid; }
    .header-signin { display: none; }
    .site-nav {
        position: fixed;
        inset: 68px 0 auto 0;
        padding: 12px var(--gutter) 20px;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        box-shadow: var(--shadow);
        display: none;
    }
    .menu-open .site-nav { display: block; }
    .site-nav .nav { flex-direction: column; }
    .site-nav .nav a { padding: 12px; font-size: 17px; border-radius: var(--radius-sm); }
}

@media (max-width: 480px) {
    .header-actions .button-primary { display: none; }
    .brand-name { font-size: 17px; }
}

/* Hero -------------------------------------------------------------------- */

.hero {
    position: relative;
    padding: clamp(48px, 8vw, 104px) 0 clamp(40px, 6vw, 72px);
    overflow: hidden;
}
.hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 10%, transparent 70%);
    -webkit-mask-image: radial-gradient(ellipse 80% 70% at 70% 30%, #000 10%, transparent 70%);
    opacity: .6;
    pointer-events: none;
}

.hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: clamp(32px, 5vw, 72px);
    align-items: center;
}

.hero-title {
    margin-top: 16px;
    font-size: clamp(40px, 6vw, 68px);
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1.02;
}
.hero-description {
    margin-top: 20px;
    max-width: 34em;
    font-size: clamp(17px, 1.6vw, 20px);
    color: var(--text-2);
}
.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

/* Decorative response-time chart */
.load-chart {
    margin: 0;
    padding: 18px 18px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-3);
}
.load-chart-head, .load-chart-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.load-chart-title { color: var(--text); font-weight: 600; }
.load-chart-legend { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-p50 { background: var(--accent); }
.dot-p95 { background: var(--p95); margin-left: 8px; }
.load-chart svg { display: block; width: 100%; height: 200px; margin: 14px 0; overflow: visible; }
.load-chart .grid line { stroke: var(--border); stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.load-chart .threshold { stroke: var(--text-3); stroke-dasharray: 6 5; vector-effect: non-scaling-stroke; opacity: .7; }
.load-chart .threshold-label { fill: var(--text-3); font-size: 11px; font-family: var(--font-mono); }
.load-chart .area { fill: var(--accent-soft); }
.load-chart .line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.load-chart .line-p50 { stroke: var(--accent); }
.load-chart .line-p95 { stroke: var(--p95); }
.load-chart-foot { padding-top: 12px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.load-chart-foot b { color: var(--ok); }

@media (prefers-reduced-motion: no-preference) {
    .load-chart .line { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: draw 2.2s cubic-bezier(.4, 0, .2, 1) .2s forwards; }
    .load-chart .line-p95 { animation-delay: .5s; }
    .load-chart .area { opacity: 0; animation: fade 1s ease 1.2s forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes fade { to { opacity: 1; } }

@media (max-width: 860px) {
    .hero-inner { grid-template-columns: 1fr; }
    .load-chart svg { height: 160px; }
}

/* Sections ------------------------------------------------------------------ */

.section-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 28px;
}
.section-title {
    margin-top: 6px;
    font-size: clamp(26px, 3vw, 34px);
}

.series-feature, .post-feed-section, .topics, .related {
    padding: clamp(40px, 6vw, 72px) 0;
}
.series-feature {
    background: var(--surface);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.series-track {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: part;
}
.series-step { counter-increment: part; }
.series-step a {
    display: flex;
    flex-direction: column;
    gap: 8px;
    height: 100%;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.series-step a:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.series-num::before {
    content: counter(part, decimal-leading-zero);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
}
.series-step-title {
    font-family: var(--font-heading);
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
}
.series-step-meta { margin-top: auto; font-size: 13px; color: var(--text-3); }

/* Homepage tools strip */
.tools-feature { padding: clamp(40px, 6vw, 72px) 0 0; }
.tool-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 16px;
}
.tool-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background:
        radial-gradient(ellipse 70% 90% at 100% 0%, var(--accent-soft), transparent 70%),
        var(--surface);
    transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tool-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.tool-card-icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-soft);
    color: var(--accent);
}
.tool-card-icon svg { width: 20px; height: 20px; }
.tool-card-title { font-family: var(--font-heading); font-size: 21px; font-weight: 600; letter-spacing: -0.015em; }
.tool-card-text { color: var(--text-2); font-size: 15.5px; }
.tool-card .text-link { margin-top: auto; padding-top: 4px; }

/* Post feed ----------------------------------------------------------------- */

.post-feed {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
    gap: 20px;
}

.post-card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s, transform .15s;
    position: relative;
}
.post-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }

.post-card-image { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.post-card-image img { width: 100%; height: 100%; object-fit: cover; }

.post-card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 12px;
    padding: 22px;
}
.post-card-tags { display: flex; flex-wrap: wrap; gap: 6px; position: relative; z-index: 1; }
.post-card-title { font-size: 21px; line-height: 1.25; letter-spacing: -0.015em; }
.post-card-title a::after { content: ""; position: absolute; inset: 0; }
.post-card-title a:focus-visible { outline: none; }
.post-card:has(.post-card-title a:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.post-card-excerpt {
    color: var(--text-2);
    font-size: 15.5px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.post-card-meta {
    margin-top: auto;
    padding-top: 6px;
    display: flex;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-3);
}

/* The newest post gets more room on the first page */
.home-template:not(.paged) .post-feed-section .post-card:first-child {
    grid-column: 1 / -1;
}
.home-template:not(.paged) .post-feed-section .post-card:first-child .post-card-body { padding: clamp(24px, 4vw, 40px); }
.home-template:not(.paged) .post-feed-section .post-card:first-child .post-card-title { font-size: clamp(26px, 3vw, 34px); max-width: 24em; }
.home-template:not(.paged) .post-feed-section .post-card:first-child .post-card-excerpt { font-size: 17px; max-width: 46em; }
@media (min-width: 861px) {
    .home-template:not(.paged) .post-feed-section .post-card.has-image:first-child { flex-direction: row; }
    .home-template:not(.paged) .post-feed-section .post-card.has-image:first-child .post-card-image { flex: 0 0 50%; aspect-ratio: auto; }
}

/* Pagination */
.pagination {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 16px;
    margin-top: 40px;
}
.pagination .button:last-child { justify-self: end; }
.pagination-info { font-family: var(--font-mono); font-size: 13px; color: var(--text-3); }

/* Topics */
.topics { border-top: 1px solid var(--border); }
.topic-list { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.topic {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-weight: 600;
    transition: border-color .15s, color .15s;
}
.topic:hover { border-color: var(--accent); color: var(--accent); }
.topic-count { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--text-3); }

/* Archive headers ------------------------------------------------------------ */

.archive-header { padding: clamp(48px, 7vw, 88px) 0 8px; }
.archive-title { margin-top: 10px; font-size: clamp(36px, 5vw, 56px); font-weight: 700; letter-spacing: -0.03em; }
.archive-description { margin-top: 14px; max-width: 40em; font-size: 18px; color: var(--text-2); }
.archive-header + .post-feed-section { padding-top: 32px; }

.author-header-inner { display: flex; align-items: center; gap: 28px; }
.author-header-avatar { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.author-links { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; margin: 14px 0 0; padding: 0; font-size: 15px; color: var(--text-3); }
.author-links a { color: var(--accent); font-weight: 600; }
@media (max-width: 600px) {
    .author-header-inner { flex-direction: column; align-items: flex-start; }
    .author-header-avatar { width: 80px; height: 80px; }
}

/* Article ----------------------------------------------------------------- */

.reading-progress {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 60;
    height: 3px;
    pointer-events: none;
}
.reading-progress span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--p95));
    transform: scaleX(0);
    transform-origin: 0 50%;
}

.article-header {
    max-width: calc(860px + var(--gutter) * 2);
    padding-top: clamp(40px, 7vw, 88px);
    padding-bottom: clamp(28px, 4vw, 40px);
    text-align: center;
}
.article-tags { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; }
.article-title {
    margin-top: 18px;
    font-size: clamp(34px, 5.2vw, 56px);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.06;
}
.article-excerpt {
    margin: 18px auto 0;
    max-width: 36em;
    font-size: clamp(18px, 2vw, 21px);
    color: var(--text-2);
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 6px 10px;
    margin-top: 26px;
    font-size: 15px;
    color: var(--text-3);
}
.meta-author { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; }
.meta-reading { display: inline-flex; align-items: center; gap: 6px; }
.meta-reading svg { width: 15px; height: 15px; }

/* Feature images are cropped to a banner so the article text starts near the top of the screen */
.article-image { max-width: calc(1000px + var(--gutter) * 2); margin-top: 0; margin-bottom: clamp(32px, 5vw, 56px); }
.article-image img {
    width: 100%;
    aspect-ratio: 21 / 9;
    max-height: 42vh;
    object-fit: cover;
    border-radius: var(--radius);
    background: var(--surface-2);
}
@media (max-width: 600px) {
    .article-image img { aspect-ratio: 16 / 9; max-height: none; }
}
.article-image figcaption, .gh-content figcaption {
    margin-top: 10px;
    text-align: center;
    font-size: 14px;
    color: var(--text-3);
}

.article-layout {
    position: relative;
    max-width: calc(var(--container) + var(--gutter) * 2);
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* Table of contents sits in the left margin on wide screens */
.toc { display: none; }
@media (min-width: 1240px) {
    .toc:not([hidden]) {
        display: block;
        position: absolute;
        top: 0;
        bottom: 0;
        left: var(--gutter);
        width: 220px;
    }
    .toc-title, .toc-list { position: sticky; }
    .toc-title { top: 100px; }
    .toc-list { top: 128px; }
}
.toc-title { font-family: var(--font-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); margin-bottom: 12px; }
.toc-list { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); max-height: calc(100vh - 160px); overflow: auto; }
.toc-list a {
    display: block;
    margin-left: -1px;
    padding: 5px 0 5px 14px;
    border-left: 2px solid transparent;
    font-size: 14px;
    line-height: 1.4;
    color: var(--text-3);
    transition: color .15s, border-color .15s;
}
.toc-list .toc-h3 a { padding-left: 26px; font-size: 13.5px; }
.toc-list a:hover { color: var(--text); }
.toc-list a.active { color: var(--accent); border-left-color: var(--accent); }

/* Content ----------------------------------------------------------------- */

.gh-content {
    max-width: var(--narrow);
    margin: 0 auto;
    font-size: 18.5px;
    line-height: 1.72;
    overflow-wrap: break-word;
}
@media (max-width: 600px) { .gh-content { font-size: 17.5px; } }

.gh-content > * + * { margin-top: 1.4em; }
.gh-content > :first-child { margin-top: 0; }

.gh-content h2 { margin-top: 2.2em; font-size: 1.6em; letter-spacing: -0.02em; }
.gh-content h3 { margin-top: 1.9em; font-size: 1.28em; }
.gh-content h4 { margin-top: 1.7em; font-size: 1.1em; }
.gh-content h2 + *, .gh-content h3 + *, .gh-content h4 + * { margin-top: .7em; }

.gh-content a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
    transition: text-decoration-color .15s;
}
.gh-content a:hover { text-decoration-color: currentColor; }

.gh-content strong { font-weight: 650; }

.gh-content ul, .gh-content ol { padding-left: 1.4em; }
.gh-content li + li { margin-top: .45em; }
.gh-content li::marker { color: var(--text-3); }

.gh-content hr {
    border: 0;
    height: 1px;
    background: var(--border);
    margin: 3em 0;
}

.gh-content blockquote:not([class]) {
    margin-left: 0;
    margin-right: 0;
    padding: 4px 0 4px 22px;
    border-left: 3px solid var(--accent);
    font-size: 1.08em;
    color: var(--text-2);
}
.gh-content blockquote.kg-blockquote-alt {
    font-family: var(--font-heading);
    font-size: 1.5em;
    line-height: 1.35;
    text-align: center;
    padding: 0 1em;
    color: var(--text);
}

.gh-content table:not(.gist table) {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: .88em;
}
.gh-content th, .gh-content td { padding: 10px 14px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.gh-content th { font-weight: 650; color: var(--text); background: var(--surface-2); }

.gh-content figure { margin-left: 0; margin-right: 0; }
.gh-content .kg-image { border-radius: var(--radius-sm); margin: 0 auto; }
.gh-content .kg-width-wide { position: relative; width: min(1040px, calc(100vw - var(--gutter) * 2)); left: 50%; transform: translateX(-50%); }
.gh-content .kg-width-wide img { width: 100%; }
.gh-content .kg-width-full { position: relative; width: 100vw; left: 50%; transform: translateX(-50%); }
.gh-content .kg-width-full img { width: 100%; border-radius: 0; }
.gh-content .kg-width-full figcaption { padding: 0 var(--gutter); }

/* Inline code */
.gh-content :not(pre) > code {
    padding: .12em .38em;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: .84em;
    color: var(--text);
}

/* Code blocks */
.gh-content pre {
    margin: 0;
    padding: 18px 20px;
    overflow-x: auto;
    background: var(--code-bg);
    color: var(--code-text);
    border: 1px solid var(--code-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 14.5px;
    line-height: 1.65;
    tab-size: 4;
    -webkit-overflow-scrolling: touch;
}
.gh-content pre code { font-family: inherit; background: none; padding: 0; border: 0; color: inherit; }
.gh-content > pre, .gh-content .kg-code-card { margin-top: 1.6em; }
.gh-content .kg-code-card + *, .gh-content .code-block + * { margin-top: 1.6em; }

.code-block { position: relative; }
.code-block pre { border-top-left-radius: 0; border-top-right-radius: 0; border-top: 0; }
.code-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 7px 10px 7px 16px;
    background: var(--code-bar);
    border: 1px solid var(--code-border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: #8b93a7;
}
.code-lang { text-transform: lowercase; letter-spacing: .03em; }
.code-copy {
    padding: 4px 10px;
    border: 1px solid #2d3341;
    border-radius: 6px;
    background: transparent;
    color: #c4cad8;
    font-family: var(--font-mono);
    font-size: 12px;
    cursor: pointer;
    transition: background-color .15s, color .15s;
}
.code-copy:hover { background: #262b37; color: #fff; }

/* Prism — a calm palette that works on the dark code background in both schemes */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #6b7489; font-style: italic; }
.token.punctuation { color: #9aa3b8; }
.token.property, .token.tag, .token.constant, .token.symbol, .token.deleted { color: #ff8f7a; }
.token.boolean, .token.number { color: #f7b267; }
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted { color: #a5d98b; }
.token.operator, .token.entity, .token.url { color: #7fd1d9; }
.token.atrule, .token.attr-value, .token.keyword { color: #c49bff; }
.token.function, .token.class-name { color: #82aaff; }
.token.regex, .token.important, .token.variable { color: #ffd479; }
.token.key, .token.key.atrule { color: #82aaff; }
.token.important, .token.bold { font-weight: bold; }
.token.italic { font-style: italic; }

/* Ghost cards ----------------------------------------------------------------- */

.gh-content .kg-callout-card { border-radius: var(--radius-sm); }
.gh-content .kg-bookmark-container { border-radius: var(--radius-sm); border-color: var(--border); color: var(--text) !important; text-decoration: none !important; background: var(--surface); }
.gh-content .kg-bookmark-description, .gh-content .kg-bookmark-metadata { color: var(--text-2); }
.gh-content .kg-toggle-card { border-color: var(--border); }
.gh-content .kg-button-card a.kg-btn-accent { background: var(--accent); color: var(--accent-text); }

/* Members CTA (gated content) */
.content-cta {
    margin-top: 2.4em;
    padding: clamp(28px, 5vw, 44px);
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    position: relative;
}
.content-cta::before {
    content: "";
    position: absolute;
    left: 0; right: 0;
    bottom: 100%;
    height: 120px;
    background: linear-gradient(transparent, var(--bg));
    pointer-events: none;
}
.content-cta-icon {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
}
.content-cta-icon svg { width: 22px; height: 22px; }
.content-cta h2 { margin-top: 16px; font-size: 26px; }
.content-cta p { margin: 10px auto 0; max-width: 30em; color: var(--text-2); font-size: 17px; }
.content-cta-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 24px; }
.gh-content .content-cta a { text-decoration: none; }
.gh-content .content-cta .button-primary { color: var(--accent-text); }
.gh-content .content-cta .button-ghost { color: var(--text); }

/* Series navigation in posts ------------------------------------------------- */

.series-nav { margin-top: clamp(40px, 6vw, 64px); }
.series-box {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.series-box summary {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 52px 18px 20px;
    position: relative;
    cursor: pointer;
    list-style: none;
}
.series-box summary::-webkit-details-marker { display: none; }
.series-box summary::after {
    content: "+";
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 22px;
    color: var(--text-3);
}
.series-box[open] summary::after { content: "−"; }
.series-box-title { font-family: var(--font-heading); font-size: 19px; font-weight: 600; }
.series-list { margin: 0; padding: 4px 20px 18px 44px; border-top: 1px solid var(--border); }
.series-list li { padding: 6px 0; }
.series-list li::marker { font-family: var(--font-mono); font-size: 13px; color: var(--text-3); }
.series-list a { color: var(--text-2); }
.series-list a:hover { color: var(--accent); }
.series-list a[aria-current] { color: var(--text); font-weight: 650; }
.series-list a[aria-current]::after { content: "  ← you are here"; font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--accent); white-space: pre; }

.series-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.series-pager a {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color .15s;
}
.series-pager a:hover { border-color: var(--accent); }
.series-next { grid-column: 2; text-align: right; }
.series-pager-title { font-family: var(--font-heading); font-weight: 600; line-height: 1.3; }
@media (max-width: 600px) {
    .series-pager { grid-template-columns: 1fr; }
    .series-next { grid-column: 1; }
}

/* Article footer ------------------------------------------------------------- */

.article-footer { margin-top: clamp(40px, 6vw, 64px); }
.article-taglist { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 24px; padding: 0; }

.share {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 18px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.share-label { margin-right: 6px; font-family: var(--font-mono); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.share a, .share button {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: transparent;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.share a:hover, .share button:hover { border-color: var(--accent); color: var(--accent); }

.author-box {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-top: 32px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.author-box-avatar { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.author-box-name { margin-top: 4px; font-size: 22px; }
.author-box-bio { margin-top: 8px; color: var(--text-2); font-size: 16px; }

.article-comments { margin-top: 48px; }

.related { margin-top: clamp(40px, 6vw, 72px); background: var(--surface); border-top: 1px solid var(--border); }
.related .post-card { background: var(--bg); }

/* Subscribe -------------------------------------------------------------------- */

.subscribe {
    padding: clamp(48px, 7vw, 80px) 0;
    background: var(--text);
    color: var(--bg);
    position: relative;
    overflow: hidden;
}
.subscribe::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(color-mix(in srgb, var(--bg) 8%, transparent) 1px, transparent 1px),
        linear-gradient(90deg, color-mix(in srgb, var(--bg) 8%, transparent) 1px, transparent 1px);
    background-size: 48px 48px;
    mask-image: linear-gradient(90deg, transparent, #000);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000);
    pointer-events: none;
}
.subscribe-inner {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 40px;
    align-items: center;
}
.subscribe .eyebrow { color: color-mix(in srgb, var(--bg) 60%, var(--text)); }
.subscribe h2 { margin-top: 8px; font-size: clamp(28px, 3.5vw, 40px); }
.subscribe-copy p:last-child { margin-top: 12px; max-width: 32em; color: color-mix(in srgb, var(--bg) 75%, var(--text)); }

.subscribe-form { display: flex; flex-wrap: wrap; gap: 10px; }
.subscribe-form input {
    flex: 1 1 220px;
    height: 50px;
    padding: 0 20px;
    border: 1px solid color-mix(in srgb, var(--bg) 25%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg) 8%, transparent);
    color: var(--bg);
    font: inherit;
    font-size: 16px;
}
.subscribe-form input::placeholder { color: color-mix(in srgb, var(--bg) 55%, var(--text)); }
.subscribe-form input:focus { outline: none; border-color: var(--accent); }
.subscribe-form .button { height: 50px; padding: 0 26px; }
.subscribe .button-primary { background: var(--bg); color: var(--text); }
.subscribe .button-primary:hover { background: color-mix(in srgb, var(--bg) 85%, var(--text)); }
.subscribe-form .label-loading, .subscribe-form .form-message { display: none; }
.subscribe-form .form-message { flex-basis: 100%; font-size: 15px; }
.subscribe-form.loading .label-default { display: none; }
.subscribe-form.loading .label-loading { display: inline; }
.subscribe-form.success .form-success { display: block; }
.subscribe-form.error .form-error { display: block; color: #ff9b8a; }

@media (max-width: 860px) {
    .subscribe-inner { grid-template-columns: 1fr; gap: 24px; }
}

/* Footer ------------------------------------------------------------------- */

.site-footer {
    padding: 48px 0 32px;
    border-top: 1px solid var(--border);
    font-size: 15px;
}
.subscribe + .site-footer { border-top: 0; }
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 32px;
}
.footer-description { margin-top: 12px; max-width: 26em; color: var(--text-3); }
.footer-links { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.footer-links .nav { display: flex; flex-wrap: wrap; gap: 6px 20px; list-style: none; margin: 0; padding: 0; }
.footer-links .nav a { color: var(--text-2); font-weight: 500; }
.footer-links .nav a:hover { color: var(--accent); }
.footer-social { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.footer-social a { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--text-3); }
.footer-social a:hover { color: var(--text); background: var(--surface-2); }
.footer-social svg { width: 18px; height: 18px; }
.footer-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: var(--text-3);
}
.footer-meta a:hover { color: var(--accent); }

/* Interactive tools ------------------------------------------------------------ */

.tool { margin-bottom: clamp(40px, 6vw, 64px); }
.tool-grid {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: 20px;
    align-items: start;
}
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr; } }

.tool-panel {
    padding: clamp(20px, 3vw, 32px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.tool-panel-title { font-size: 20px; margin-bottom: 20px; }

.field + .field { margin-top: 20px; }
.field label { display: flex; justify-content: space-between; align-items: baseline; font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.field-hint { margin-top: 6px; font-size: 13.5px; line-height: 1.5; color: var(--text-3); }
.field-hint code { font-family: var(--font-mono); font-size: .92em; }
.field-row { display: flex; gap: 8px; }
.field input[type="number"], .field select {
    width: 100%;
    min-width: 0;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font: inherit;
    font-family: var(--font-mono);
    font-size: 16px;
}
.field select { font-family: var(--font-body); font-size: 15px; flex: 0 0 auto; width: auto; cursor: pointer; }
.field input:focus, .field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-suffix { position: relative; }
.field-suffix span { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-family: var(--font-mono); font-size: 14px; color: var(--text-3); pointer-events: none; }
.field-suffix input { padding-right: 44px; }
.field input[type="range"] { width: 100%; accent-color: var(--accent); }
.range-value { font-family: var(--font-mono); font-weight: 500; color: var(--accent); }

.result-big {
    margin-top: 6px;
    font-family: var(--font-heading);
    font-size: clamp(56px, 9vw, 88px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    color: var(--accent);
}
.result-unit { font-size: .4em; letter-spacing: -0.01em; color: var(--text); }
.result-sub { margin-top: 10px; color: var(--text-2); }
.result-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0 0;
}
.result-stats div { padding: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.result-stats dt { font-size: 12.5px; color: var(--text-3); }
.result-stats dd { margin: 4px 0 0; font-family: var(--font-mono); font-size: 18px; font-weight: 600; }
@media (max-width: 520px) { .result-stats { grid-template-columns: 1fr; } }

.result-chart { margin: 24px 0 0; }
.result-chart figcaption { font-size: 13.5px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.result-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.rc-base { stroke: var(--border-strong); }
.rc-guide { stroke: var(--border); stroke-dasharray: 3 4; }
.rc-axis { font-family: var(--font-mono); font-size: 12px; fill: var(--text-3); }
.rc-open { stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 8 6; }
.rc-closed { fill: none; stroke: var(--p95); stroke-width: 3; stroke-linecap: round; }
.rc-dot { fill: var(--surface); stroke: var(--p95); stroke-width: 2.5; }
.rc-dot-slow { fill: var(--p95); }
.rc-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; font-size: 13px; color: var(--text-2); }
.rc-key { display: inline-block; width: 18px; height: 3px; border-radius: 2px; }
.rc-key-open { background: var(--accent); }
.rc-key-closed { background: var(--p95); margin-left: 12px; }
.result-warning:not(:empty) {
    margin-top: 16px;
    padding: 12px 14px;
    border-left: 3px solid var(--p95);
    background: color-mix(in srgb, var(--p95) 9%, transparent);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 14.5px;
    color: var(--text-2);
}

.tool-code { margin-top: 20px; }
.tool-code-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs { display: inline-flex; padding: 4px; gap: 4px; background: var(--bg); border: 1px solid var(--border); border-radius: 999px; }
.tabs button {
    padding: 7px 14px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
}
.tabs button[aria-selected="true"] { background: var(--accent); color: var(--accent-text); }
.tool-code .code-copy { color: var(--text-2); border-color: var(--border-strong); }
.tool-code .code-copy:hover { background: var(--surface-2); color: var(--text); }
.tool-pre {
    margin: 0;
    padding: 18px 20px;
    overflow-x: auto;
    background: var(--code-bg);
    color: var(--code-text);
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.65;
}
.tool-pre code { font-family: inherit; }
.tool-code-note { margin-top: 12px; font-size: 14.5px; color: var(--text-2); }

/* Percentiles explainer */
.tool[data-tool="percentiles"] { --c-avg: #e5484d; --c-p99: #8e4ec6; }
:root[data-scheme="dark"] .tool[data-tool="percentiles"] { --c-avg: #ff6b6b; --c-p99: #b48cf0; }
@media (prefers-color-scheme: dark) {
    :root[data-scheme="system"] .tool[data-tool="percentiles"] { --c-avg: #ff6b6b; --c-p99: #b48cf0; }
}

.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 24px; }
.presets-label { font-size: 14px; font-weight: 600; color: var(--text-2); margin-right: 4px; }
.presets button {
    padding: 7px 14px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    background: var(--bg);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-2);
    cursor: pointer;
    transition: border-color .15s, color .15s;
}
.presets button:hover { border-color: var(--accent); color: var(--accent); }

.pct-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 700px) { .pct-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pct-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    position: relative;
}
/* Drawn as a bar over the left border rather than a thick border, which would meet the
   thinner top and bottom borders at a mitred (slanted) corner */
.pct-stat::before {
    content: "";
    position: absolute;
    top: -1px;
    bottom: -1px;
    left: -1px;
    width: 3px;
    background: var(--stripe, var(--border-strong));
}
.pct-stat-avg { --stripe: var(--c-avg); }
.pct-stat-p50 { --stripe: var(--accent); }
.pct-stat-p95 { --stripe: var(--p95); }
.pct-stat-p99 { --stripe: var(--c-p99); }
.pct-stat-label { font-size: 12.5px; color: var(--text-3); }
.pct-stat-value { font-family: var(--font-mono); font-size: clamp(17px, 2.2vw, 22px); font-weight: 600; }

.pct-chart { margin: 24px 0 0; }
.pct-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.pct-chart figcaption { margin-top: 8px; font-size: 13px; color: var(--text-3); }
.pc-bar { fill: var(--accent); fill-opacity: .7; transition: height .2s, y .2s; }
.pc-axis { stroke: var(--border-strong); }
.pc-tick { font-family: var(--font-mono); font-size: 12px; fill: var(--text-3); }
.pc-mark { stroke-width: 2; stroke-dasharray: 5 4; }
.pc-label { font-family: var(--font-mono); font-size: 13px; font-weight: 700; }
.pc-mark-avg { stroke: var(--c-avg); } .pc-label-avg { fill: var(--c-avg); }
.pc-mark-p50 { stroke: var(--accent); } .pc-label-p50 { fill: var(--accent); }
.pc-mark-p95 { stroke: var(--p95); } .pc-label-p95 { fill: var(--p95); }
.pc-mark-p99 { stroke: var(--c-p99); } .pc-label-p99 { fill: var(--c-p99); }

.pct-insight { margin-top: 20px; font-size: 17px; line-height: 1.6; }
.pct-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px 32px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.pct-controls .field + .field { margin-top: 0; }
.pct-controls output { font-family: var(--font-mono); font-weight: 500; color: var(--accent); }
@media (max-width: 700px) { .pct-controls { grid-template-columns: 1fr; } }

/* Cover charts (live latency charts in place of generated feature images) ---- */

.cover-chart {
    --chart-accent: #5b82ff;
    --cover-line: color-mix(in srgb, var(--chart-accent) var(--cover-line-mix), #000);
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    container-type: inline-size;
    font-family: var(--font-mono);
    background:
        radial-gradient(ellipse 60% 85% at var(--glow-x, 50%) 30%, color-mix(in srgb, var(--chart-accent) 26%, transparent), transparent 70%),
        radial-gradient(color-mix(in srgb, var(--cover-ink) 8%, transparent) 1px, transparent 1.6px) 0 0 / 20px 20px,
        var(--cover-bg);
}
.cover-chart[data-tag="k6"] { --chart-accent: #9b7bff; }
.cover-chart[data-tag="tips"] { --chart-accent: #2fc28f; }
.cover-chart[data-tag="postman"] { --chart-accent: #ff7a45; }
.cover-chart[data-tag="pokeapi"] { --chart-accent: #ff5c6c; }

.post-card-image .cover-chart { position: absolute; inset: 0; }
.article-image .cover-chart { aspect-ratio: 21 / 9; max-height: 42vh; height: auto; border-radius: var(--radius); }
@media (max-width: 600px) {
    .article-image .cover-chart { aspect-ratio: 16 / 9; max-height: none; }
}

.cover-fallback { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-chart.is-live .cover-fallback { display: none; }

.cover-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cover-grid, .cover-axis, .cover-threshold { stroke: var(--cover-ink); vector-effect: non-scaling-stroke; }
.cover-grid { stroke-opacity: .08; stroke-width: 1; stroke-dasharray: 4 7; }
.cover-axis { stroke-opacity: .18; stroke-width: 1; }
.cover-threshold { stroke-opacity: .4; stroke-width: 1.5; stroke-dasharray: 8 7; }
.cover-area-top { stop-color: var(--chart-accent); stop-opacity: .32; }
.cover-area-bottom { stop-color: var(--chart-accent); stop-opacity: 0; }
.cover-p50, .cover-p95 { fill: none; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.cover-p50 { stroke: var(--cover-line); stroke-width: 3; }
.cover-p95 { stroke: var(--p95); stroke-width: 2.5; }
.article-image .cover-p50 { stroke-width: 4; }
.article-image .cover-p95 { stroke-width: 3.5; }

.cover-plot { clip-path: inset(0 100% 0 0); transition: clip-path 1.8s cubic-bezier(.4, 0, .2, 1); }
.cover-chart.is-drawn .cover-plot { clip-path: inset(0 0 0 0); }
@media (prefers-reduced-motion: reduce) {
    .cover-plot { clip-path: none; transition: none; }
}

.cover-label {
    position: absolute;
    font-size: clamp(9px, 1.55cqi, 15px);
    line-height: 1;
    white-space: nowrap;
    color: color-mix(in srgb, var(--cover-ink) 55%, transparent);
}
.cover-tag {
    left: 7%;
    top: 16%;
    display: flex;
    align-items: center;
    gap: .6em;
    font-size: clamp(10px, 1.75cqi, 17px);
    font-weight: 700;
    color: var(--cover-ink);
}
.cover-dot { width: .7em; height: .7em; border-radius: 50%; background: var(--chart-accent); }
.cover-metric { right: 7%; top: 16%; }
.cover-limit { right: 7%; transform: translateY(calc(-100% - 6px)); color: color-mix(in srgb, var(--cover-ink) 70%, transparent); }
.cover-stats { left: 7%; top: 80%; }
.cover-stats b { font-weight: 500; color: #2fc28f; }
.cover-site { right: 7%; top: 80%; }
@container (max-width: 520px) {
    .cover-metric, .cover-stats, .cover-site { display: none; }
}

/* Error pages ------------------------------------------------------------------ */

.error-page { padding: clamp(64px, 12vw, 140px) 0 40px; text-align: center; }
.error-page .archive-description { margin-left: auto; margin-right: auto; }
.error-page .hero-actions { justify-content: center; }
.error-code {
    font-family: var(--font-mono);
    font-size: clamp(64px, 12vw, 120px);
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--accent), var(--p95));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.error-details { text-align: left; margin-top: 32px; font-size: 14px; }
