/* Overconfigured
   Every colour is a token. The bare :root is the light palette; the media
   query and [data-theme] blocks only redefine tokens, never components. */

/* Fonts (SIL OFL, self-hosted) ------------------------------------------ */

@font-face {
    font-family: "Inter Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Inter Tight Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter-tight-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter Tight Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 900;
    src: url("../fonts/inter-tight-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "JetBrains Mono Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 800;
    src: url("../fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "JetBrains Mono Variable";
    font-style: normal;
    font-display: swap;
    font-weight: 100 800;
    src: url("../fonts/jetbrains-mono-latin-ext-wght-normal.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

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

:root {
    --accent: var(--ghost-accent-color, #199fff);

    --bg: #ffffff;
    --bg-soft: #f5f7f9;
    --ink: #0e1116;
    --text: #2a2f37;
    --muted: #697180;
    --line: #d8dde5;
    --line-strong: #aeb6c2;
    --code-bg: #f5f7f9;
    --accent-text: color-mix(in oklab, var(--accent) 70%, #000);
    --accent-soft: color-mix(in oklab, var(--accent) 12%, var(--bg));
    --btn-bg: var(--ink);
    --btn-text: #ffffff;
    --btn-hover-bg: var(--accent-text);
    --btn-hover-text: #ffffff;
    --shadow: 0 1px 2px rgb(14 17 22 / 6%), 0 8px 24px rgb(14 17 22 / 8%);

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

    --frame-w: 1280px;
    --outer: 0px;      /* space between the viewport edge and the dashed rails */
    --gutter: 16px;    /* space between the rails and the content */
    --header-h: 64px;
    --radius: 6px;

    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b0d11;
        --bg-soft: #13161c;
        --ink: #f2f4f7;
        --text: #c5cad3;
        --muted: #8a919d;
        --line: #252a32;
        --line-strong: #454d59;
        --code-bg: #11141a;
        --accent-text: color-mix(in oklab, var(--accent) 82%, #fff);
        --accent-soft: color-mix(in oklab, var(--accent) 16%, var(--bg));
        --btn-bg: var(--ink);
        --btn-text: #0b0d11;
        --btn-hover-bg: var(--accent);
        --btn-hover-text: #0b0d11;
        --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 40%);
        color-scheme: dark;
    }
}

:root[data-theme="dark"] {
    --bg: #0b0d11;
    --bg-soft: #13161c;
    --ink: #f2f4f7;
    --text: #c5cad3;
    --muted: #8a919d;
    --line: #252a32;
    --line-strong: #454d59;
    --code-bg: #11141a;
    --accent-text: color-mix(in oklab, var(--accent) 82%, #fff);
    --accent-soft: color-mix(in oklab, var(--accent) 16%, var(--bg));
    --btn-bg: var(--ink);
    --btn-text: #0b0d11;
    --btn-hover-bg: var(--accent);
    --btn-hover-text: #0b0d11;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 40%);
    color-scheme: dark;
}

@media (min-width: 768px) {
    :root { --gutter: 32px; }
}
@media (min-width: 1024px) {
    :root { --outer: 24px; }
}

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

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + 24px);
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4, h5, h6 { text-wrap: balance; }
p { text-wrap: pretty; }

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

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

.icon { flex: none; }

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

.skip-link {
    position: absolute;
    top: 8px; left: 8px;
    z-index: 100;
    padding: 8px 12px;
    background: var(--btn-bg);
    color: var(--btn-text);
    font-weight: 500;
    border-radius: var(--radius);
    transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* Frame: dashed rails, full-bleed dashed rules, crosshair ticks -------- */

.site {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}
.site-main {
    flex: 1 0 auto;
    /* Wide and full Koenig cards size against this with cqw. Unlike 100vw,
       cqw leaves out a classic scrollbar, so nothing overhangs the page. */
    container-type: inline-size;
}

.frame {
    width: min(var(--frame-w), 100% - 2 * var(--outer));
    margin-inline: auto;
    padding-inline: var(--gutter);
}

body::before {
    content: "";
    position: fixed;
    inset: 0 auto 0 50%;
    z-index: 43;
    width: min(var(--frame-w), 100% - 2 * var(--outer));
    transform: translateX(-50%);
    border-inline: 1px dashed var(--line);
    pointer-events: none;
}
/* Below 1024px the rails would sit on the screen edge, so drop them. */
@media (max-width: 1023px) {
    body::before { display: none; }
}

.rule {
    position: relative;
    height: 0;
    border-top: 1px dashed var(--line);
}

@media (min-width: 1024px) {
    .rule::before,
    .rule::after {
        content: "";
        position: absolute;
        top: -5px;
        z-index: 41;
        width: 9px;
        height: 9px;
        background:
            linear-gradient(var(--line-strong), var(--line-strong)) center / 1px 100% no-repeat,
            linear-gradient(var(--line-strong), var(--line-strong)) center / 100% 1px no-repeat;
        background-color: var(--bg);
    }
    .rule::before { left: calc((100% - min(var(--frame-w), 100% - 2 * var(--outer))) / 2 - 4px); }
    .rule::after { right: calc((100% - min(var(--frame-w), 100% - 2 * var(--outer))) / 2 - 4px); }
}

/* Shared bits ----------------------------------------------------------- */

.eyebrow {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
}
.eyebrow-accent { color: var(--accent-text); }

.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    font-variant-numeric: tabular-nums;
}
.meta-sep {
    width: 1px;
    height: 10px;
    background: var(--line-strong);
}
.meta-tag {
    color: var(--accent-text);
    text-decoration: none;
}
.meta-tag:hover { text-decoration: underline; text-underline-offset: 3px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 550;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--btn-bg); color: var(--btn-text); }
.btn-primary:hover { background: var(--btn-hover-bg); color: var(--btn-hover-text); }
.btn-ghost { border-color: var(--line); color: var(--ink); background: var(--bg); }
.btn-ghost:hover { border-color: var(--line-strong); background: var(--bg-soft); }
.btn-quiet { color: var(--text); background: transparent; }
.btn-quiet:hover { color: var(--ink); background: var(--bg-soft); }

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.chip {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--text);
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.15s, color 0.15s;
}
.chip:hover { border-color: var(--accent); color: var(--accent-text); }


/* Status badges in the meta line: Featured, Members, Paid. */
.badge {
    display: inline-flex;
    align-items: center;
    height: 18px;
    padding: 0 6px;
    border: 1px solid var(--line-strong);
    border-radius: 4px;
    font-size: 10.5px;
    line-height: 1;
    letter-spacing: 0.05em;
    color: var(--text);
}
.badge-accent {
    border-color: color-mix(in oklab, var(--accent) 55%, transparent);
    color: var(--accent-text);
}

.byline {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}
.avatars { display: flex; }
.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 2px var(--bg);
    background: var(--bg-soft);
}
.avatar + .avatar { margin-left: -8px; }
.avatar-fallback {
    display: grid;
    place-items: center;
    overflow: hidden;
    width: 28px;
    font-size: 0;
}
.avatar-fallback::first-letter { font-size: 12px; font-weight: 600; color: var(--ink); }
.byline-names {
    font-size: 14px;
    font-weight: 550;
    color: var(--ink);
}
.byline-names a {
    position: relative;
    z-index: 1;
    text-decoration: none;
}
.byline-names a:hover { color: var(--accent-text); }
.card .byline,
.lead .byline { margin-top: 4px; }

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

.site-header {
    position: sticky;
    top: 0;
    z-index: 42;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(12px);
    backdrop-filter: saturate(1.4) blur(12px);
    border-bottom: 1px dashed var(--line);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 32px;
    height: var(--header-h);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: none;
    color: var(--ink);
    text-decoration: none;
}
.brand-mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--bg);
    color: var(--accent);
    transition: border-color 0.15s;
}
.brand-mark .icon { width: 18px; height: 18px; stroke-width: 2; }
.brand:hover .brand-mark { border-color: var(--accent); }
.brand-icon { width: 30px; height: 30px; flex: none; border-radius: 8px; object-fit: cover; }
.brand-name {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 650;
    letter-spacing: -0.02em;
}
.brand-text {
    display: flex;
    align-items: baseline;
    gap: 6px;
    white-space: nowrap;
}
.brand-byline {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 450;
    letter-spacing: -0.01em;
    color: var(--muted);
    transition: color 0.15s;
}
.brand:hover .brand-byline { color: var(--text); }
.brand-logo { max-height: 32px; width: auto; }

/* Not enough room for one line next to the icons on phones: stack it. */
@media (max-width: 479px) {
    .site-header .brand-text { flex-direction: column; gap: 1px; }
    .site-header .brand-name { font-size: 16px; line-height: 1.15; }
    .site-header .brand-byline {
        font-family: var(--font-mono);
        font-size: 10.5px;
        font-weight: 500;
        line-height: 1.2;
        letter-spacing: 0.03em;
        text-transform: uppercase;
    }
}

.site-nav { flex: 1; min-width: 0; }
.site-nav .nav {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.site-nav .nav a {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    height: 32px;
    padding: 0 10px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: background-color 0.15s, color 0.15s;
}
.site-nav .nav a:hover { color: var(--ink); background: var(--bg-soft); }
.site-nav .nav .is-current a { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.nav .icon-external { width: 14px; height: 14px; color: var(--muted); }
.member-actions { display: flex; align-items: center; gap: 4px; }
.nav-member { display: none; }

.header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: auto;
}
.header-member { margin-left: 8px; }

.theme-icon { display: grid; }
.theme-icon-light { display: none; }
:root[data-theme="dark"] .theme-icon-dark { display: none; }
:root[data-theme="dark"] .theme-icon-light { display: grid; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-icon-dark { display: none; }
    :root:not([data-theme="light"]) .theme-icon-light { display: grid; }
}

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

@media (max-width: 859px) {
    .header-inner { gap: 12px; }
    .nav-toggle { display: inline-grid; }
    .site-nav {
        position: fixed;
        inset: var(--header-h) 0 auto 0;
        display: none;
        padding: 8px var(--gutter) 20px;
        background: var(--bg);
        border-bottom: 1px dashed var(--line);
        box-shadow: var(--shadow);
    }
    .nav-open .site-nav { display: block; }
    .site-nav .nav { flex-direction: column; align-items: stretch; gap: 0; }
    .site-nav .nav a {
        display: flex;
        height: 52px;
        padding: 0;
        border-radius: 0;
        border-bottom: 1px dashed var(--line);
        font-size: 17px;
    }
    .site-nav .nav a:hover { background: none; }
    .site-nav .nav .is-current a { box-shadow: none; color: var(--accent-text); }
    .nav-member { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-top: 16px; }
    .nav-member .btn { height: 44px; }
    .nav-member .btn-quiet { border-color: var(--line); }
    .header-member .btn-quiet { display: none; }
}
@media (max-width: 479px) {
    .header-member { display: none; }
}

/* Home: lead post --------------------------------------------------- */

.section-lead { padding-block: 48px 56px; }

.lead {
    position: relative;
    display: grid;
    gap: 32px;
}
.lead-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.lead-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(32px, 4.2vw, 48px);
    font-weight: 600;
    line-height: 1.08;
    letter-spacing: -0.025em;
    color: var(--ink);
}
.lead-excerpt {
    margin: 0;
    max-width: 58ch;
    font-size: 18px;
    line-height: 1.6;
}
.lead-media {
    order: -1;
    overflow: hidden;
    border: 1px solid var(--line);
    background: var(--bg-soft);
    aspect-ratio: 16 / 10;
}
.lead-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.lead:hover .lead-media img { transform: scale(1.02); }

@media (min-width: 900px) {
    .section-lead { padding-block: 64px; }
    .lead {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
        align-items: center;
        gap: 56px;
    }
    .lead-body { gap: 20px; }
    .lead-media { order: 0; }
    .lead-no-image { grid-template-columns: minmax(0, 1fr); }
}
.lead-no-image .lead-title { max-width: 22ch; }
.lead-no-image .lead-excerpt { max-width: 62ch; }

/* Optional intro above the lead ("Show intro" setting). */
.intro {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
    padding-block: 64px 56px;
}
.intro-title {
    margin: 0;
    max-width: 18ch;
    font-family: var(--font-heading);
    font-size: clamp(38px, 6vw, 64px);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: -0.032em;
    text-wrap: balance;
    color: var(--ink);
}
.intro-text {
    margin: 0;
    max-width: 56ch;
    font-size: 19px;
    line-height: 1.55;
}
.intro .subscribe-form { width: 100%; max-width: 460px; margin-top: 8px; }

/* Nothing to list yet. */
.empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 64px var(--gutter);
}
.empty-text { margin: 0; font-size: 17px; }

/* Cards and the dashed two-column grid ---------------------------------- */

.card-link { text-decoration: none; transition: color 0.15s; }
.card-link::after { content: ""; position: absolute; inset: 0; }
.card:hover .card-link,
.lead:hover .card-link { color: var(--accent-text); }


.post-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
}
.post-grid.frame { padding-inline: 0; }

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 36px var(--gutter);
}
.card + .card { border-top: 1px dashed var(--line); }
.card-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 26px;
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -0.018em;
    color: var(--ink);
}
.card-excerpt {
    flex-grow: 1; /* keeps tags and bylines level across a row */
    margin: 0;
    font-size: 16px;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .card { padding: 44px 40px 48px var(--gutter); }
    .card:nth-child(even) { padding: 44px var(--gutter) 48px 40px; }
    .card:nth-child(odd) { border-right: 1px dashed var(--line); }
    .card + .card { border-top: 0; }
    .card:nth-child(n + 3) { border-top: 1px dashed var(--line); }
    .card-title { font-size: 28px; }
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-block: 24px;
}

/* Archive headers (tag, author, page 2+) -------------------------------- */

.archive-header {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-block: 56px 48px;
}
.archive-header-author {
    flex-direction: row;
    align-items: flex-start;
    gap: 24px;
}
.archive-header-author > div { display: flex; flex-direction: column; gap: 14px; }
.archive-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(34px, 5vw, 52px);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.028em;
    color: var(--ink);
}
.archive-text {
    margin: 0;
    max-width: 62ch;
    font-size: 18px;
    line-height: 1.6;
}
.author-photo {
    width: 88px;
    height: 88px;
    flex: none;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--line);
}
.author-links { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; padding: 0; list-style: none; }

@media (max-width: 599px) {
    .archive-header-author { flex-direction: column; }
    .author-photo { width: 72px; height: 72px; }
}

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

.article-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "toc" "main" "share";
    max-width: min(var(--frame-w), 100% - 2 * var(--outer));
}
.article-grid > .article-main,
.article-grid > .article-heading { grid-area: main; }
.article-share { grid-area: share; }
.toc { grid-area: toc; }

@media (max-width: 1099px) {
    .article-grid { justify-content: center; grid-template-columns: minmax(0, 720px); }
}

@media (min-width: 1100px) {
    .article-grid {
        grid-template-columns: 124px minmax(0, 720px) 244px;
        grid-template-areas: "share main toc";
        justify-content: space-between;
        column-gap: 48px;
    }
    .article-grid > .article-heading { grid-column: main-start / toc-end; max-width: 920px; }
}

.article-header { padding-block: 56px 44px; }
.article-heading {
    display: flex;
    flex-direction: column;
    gap: 20px;
}
.article-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: clamp(34px, 5.2vw, 54px);
    font-weight: 600;
    line-height: 1.06;
    letter-spacing: -0.028em;
    color: var(--ink);
}
.article-dek {
    margin: 0;
    max-width: 60ch;
    font-size: 20px;
    line-height: 1.5;
    color: var(--text);
}

.article-body { padding-block: 40px 72px; }
.article-page .article-body { padding-top: 48px; }

.article-image { margin: 0 0 40px; }
.article-image img {
    width: 100%;
    /* Never taller than 3:2 at full width; portrait covers get a centred crop. */
    max-height: min(480px, 66.667vw);
    object-fit: cover;
    border: 1px solid var(--line);
    background: var(--bg-soft);
}
.article-image figcaption,
.gh-content figcaption {
    margin-top: 10px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--muted);
    text-align: center;
}

.sticky { position: sticky; top: calc(var(--header-h) + 40px); }

/* Share rail */
.article-share .sticky { display: flex; flex-direction: column; gap: 12px; }
.share-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.share-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.share-btn .icon { width: 17px; height: 17px; }
.share-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.copy-done { display: none; color: var(--accent-text); }
.copy-link.is-copied .copy-idle { display: none; }
.copy-link.is-copied .copy-done { display: grid; }

@media (max-width: 1099px) {
    .article-share { margin-top: 48px; padding-top: 24px; border-top: 1px dashed var(--line); }
    .article-share .sticky { position: static; flex-direction: row; align-items: center; justify-content: space-between; }
}
@media (min-width: 1100px) {
    .share-list { flex-direction: column; }
}

/* Table of contents */
.toc[hidden] { display: none; }
.toc summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    list-style: none;
    cursor: pointer;
}
.toc summary::-webkit-details-marker { display: none; }
.toc summary::after {
    content: "";
    width: 7px;
    height: 7px;
    margin-right: 3px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(-2px) rotate(45deg);
    transition: transform 0.2s;
}
.toc[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.toc-list {
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}
.toc-list a {
    display: block;
    padding: 6px 0 6px 14px;
    border-left: 1px solid var(--line);
    font-size: 14px;
    line-height: 1.4;
    color: var(--muted);
    text-decoration: none;
    transition: color 0.15s, border-color 0.15s;
}
.toc-list a:hover { color: var(--ink); }
.toc-list a.is-active {
    color: var(--accent-text);
    border-left-color: var(--accent);
    box-shadow: inset 1px 0 0 var(--accent);
}

@media (max-width: 1099px) {
    .toc {
        margin-bottom: 32px;
        padding: 14px 16px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--bg);
    }
    .toc-list { max-height: 50vh; overflow-y: auto; }
}
@media (min-width: 1100px) {
    .toc {
        position: sticky;
        top: calc(var(--header-h) + 40px);
        align-self: start;
        max-height: calc(100vh - var(--header-h) - 80px);
        overflow-y: auto;
        overscroll-behavior: contain;
    }
    .toc summary { pointer-events: none; }
    .toc summary::after { display: none; }
}

.article-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-top: 56px;
    padding-top: 24px;
    border-top: 1px dashed var(--line);
}

.article-comments { padding-block: 48px 72px; }
.article-comments .eyebrow { margin-bottom: 20px; }
/* The comments iframe document is light-scheme; a dark-scheme iframe element
   around it would get an opaque white backdrop. Its own CSS handles dark. */
.article-comments iframe { color-scheme: light; }

.related { padding-top: 40px; padding-inline: 0; }
.related-title { padding-inline: var(--gutter); }
.related .card { padding-top: 28px; }
@media (max-width: 767px) {
    .related .card:first-child { padding-top: 20px; }
}

/* Newsletter as the last tile of the home grid. Starting a new row it spans
   both columns; otherwise it fills the empty cell next to the last card. */
.grid-tile {
    display: flex;
    align-items: center;
    padding: 32px var(--gutter);
    border-top: 1px dashed var(--line);
}
.grid-tile .subscribe { width: 100%; margin: 0; }
@media (min-width: 768px) {
    .grid-tile { padding: 32px var(--gutter); }
    .grid-tile:nth-child(odd) { grid-column: 1 / -1; }
    .grid-tile:nth-child(even) { padding-left: 40px; }
    .grid-tile:nth-child(2) { border-top: 0; }
    .grid-tile:nth-child(even) .subscribe-row { flex-direction: column; }
}
@media (min-width: 900px) {
    .grid-tile:nth-child(odd) .subscribe {
        grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
        align-items: center;
        gap: 48px;
        padding: 36px 40px;
    }
}

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

.subscribe {
    display: grid;
    gap: 20px;
    margin-block: 56px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--bg-soft);
}
.subscribe-copy { display: flex; flex-direction: column; gap: 8px; }
.subscribe-title {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.015em;
    color: var(--ink);
}
.subscribe-text { margin: 0; font-size: 15px; line-height: 1.55; color: var(--text); }
.subscribe-row { display: flex; gap: 8px; }
.input {
    flex: 1 1 auto;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--ink);
    font: 15px/1 var(--font-body);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--muted); }
.input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.subscribe-form .btn { height: 44px; padding-inline: 18px; }
.btn-loading { display: none; }
.subscribe-form.loading .btn-label { display: none; }
.subscribe-form.loading .btn-loading { display: inline; }
.form-note { display: none; margin: 10px 0 0; font-size: 14px; }
.subscribe-form.success .form-success { display: block; color: var(--accent-text); }
.subscribe-form.error .form-error { display: block; color: #d6453d; }

@media (max-width: 479px) {
    .subscribe { padding: 22px 18px; }
    .subscribe-row { flex-direction: column; }
}

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

.site-footer { margin-top: auto; }
.footer-inner {
    display: grid;
    gap: 36px;
    padding-block: 48px;
}
.footer-brand { display: flex; flex-direction: column; gap: 14px; }
.footer-note { margin: 0; max-width: 40ch; font-size: 15px; line-height: 1.55; color: var(--muted); }
.footer-col { display: flex; flex-direction: column; gap: 14px; }
.footer-col .eyebrow { font-size: 12px; }
.footer-col .nav {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}
.footer-col .nav a {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 15px;
    color: var(--text);
    text-decoration: none;
}
.footer-col .nav a:hover { color: var(--accent-text); }
.footer-base {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 24px;
    padding-block: 18px 22px;
    font-family: var(--font-mono);
    font-size: 12px;
    letter-spacing: 0.02em;
    color: var(--muted);
}
.footer-base a { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.footer-base a:hover { color: var(--ink); }

@media (min-width: 768px) {
    .footer-inner { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 48px; padding-block: 56px; }
}

/* Paywall box Ghost renders inside gated posts. Its inline accent background
   gives white-on-accent text that fails contrast, so it takes the theme's
   subscribe look instead. */
.gh-content .gh-post-upgrade-cta { margin-top: 40px; font-family: var(--font-body); color: var(--text); }
.gh-content .gh-post-upgrade-cta-content {
    width: 100%;
    padding: 40px 28px;
    border: 1px dashed var(--line-strong);
    border-radius: 0;
    background: var(--bg-soft) !important;
}
.gh-content .gh-post-upgrade-cta h2 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 24px;
    line-height: 1.25;
    letter-spacing: -0.015em;
    text-wrap: balance;
    color: var(--ink);
}
.gh-content .gh-post-upgrade-cta .gh-btn {
    display: inline-flex;
    align-items: center;
    height: 40px;
    margin-top: 22px;
    padding: 0 18px;
    border-radius: var(--radius);
    background: var(--btn-bg);
    color: var(--btn-text) !important;
    font-size: 15px;
    font-weight: 550;
    text-decoration: none;
}
.gh-content .gh-post-upgrade-cta .gh-btn:hover { background: var(--btn-hover-bg); color: var(--btn-hover-text) !important; }
.gh-content .gh-post-upgrade-cta p { margin: 16px 0 0; }
.gh-content .gh-post-upgrade-cta small { font-size: 15px; color: var(--text); }
.gh-content .gh-post-upgrade-cta small a { color: var(--accent-text); font-weight: 550; }

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

.error {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
    padding-block: 120px 140px;
}
.error .btn { margin-top: 12px; }

/* Back to top ----------------------------------------------------------- */

.to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 35;
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    box-shadow: var(--shadow);
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s, color 0.15s, border-color 0.15s;
}
.to-top[hidden] { display: none; }
.to-top.is-visible { opacity: 1; transform: none; }
.to-top:hover { color: var(--accent-text); border-color: var(--accent); }
.to-top .icon { width: 18px; height: 18px; }

/* Post content ---------------------------------------------------------- */

.gh-content {
    font-size: 18px;
    line-height: 1.7;
    color: var(--text);
    overflow-wrap: break-word;
}
.gh-content > * { margin-block: 0; }
.gh-content > * + * { margin-top: 1.3em; }

.gh-content h2,
.gh-content h3,
.gh-content h4 {
    position: relative;
    font-family: var(--font-heading);
    color: var(--ink);
    scroll-margin-top: calc(var(--header-h) + 24px);
}
.gh-content h2 { margin-top: 2.2em; font-size: 30px; font-weight: 600; line-height: 1.22; letter-spacing: -0.02em; }
.gh-content h3 { margin-top: 1.9em; font-size: 23px; font-weight: 600; line-height: 1.3; letter-spacing: -0.012em; }
.gh-content h4 { margin-top: 1.7em; font-size: 19px; font-weight: 600; line-height: 1.4; }
.gh-content > :is(h2, h3, h4) + * { margin-top: 0.6em; }
.gh-content > :first-child { margin-top: 0; }

.heading-anchor {
    position: absolute;
    top: 50%;
    left: -30px;
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 4px;
    color: var(--muted);
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity 0.15s, color 0.15s;
}
.heading-anchor .icon { width: 16px; height: 16px; }
.gh-content :is(h2, h3, h4):hover .heading-anchor,
.heading-anchor:focus-visible { opacity: 1; }
.heading-anchor:hover { color: var(--accent-text); }
@media (max-width: 859px) {
    .heading-anchor { display: none; }
}

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

.gh-content strong { font-weight: 650; color: var(--ink); }

.gh-content ul,
.gh-content ol { padding-left: 1.4em; }
.gh-content li + li { margin-top: 0.45em; }
.gh-content li > ul,
.gh-content li > ol { margin-top: 0.45em; }
.gh-content li::marker { color: var(--muted); }
.gh-content ol li::marker { font-family: var(--font-mono); font-size: 0.85em; }

.gh-content blockquote:not([class]) {
    margin-inline: 0;
    padding: 2px 0 2px 22px;
    border-left: 2px solid var(--accent);
    color: var(--ink);
}
.gh-content blockquote.kg-blockquote-alt {
    margin-inline: 0;
    padding: 0.4em 0;
    border: 0;
    font-family: var(--font-heading);
    font-size: 26px;
    font-style: normal;
    font-weight: 500;
    line-height: 1.35;
    letter-spacing: -0.012em;
    text-align: center;
    color: var(--ink);
}

.gh-content hr,
.gh-content .kg-hr-card hr {
    height: 0;
    margin-block: 2.6em;
    border: 0;
    border-top: 1px dashed var(--line-strong);
}

.gh-content :not(pre) > code {
    padding: 0.12em 0.36em;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: var(--code-bg);
    font-family: var(--font-mono);
    font-size: 0.84em;
    color: var(--ink);
}

.code-block { position: relative; }
.gh-content pre {
    margin: 0;
    padding: 18px 20px;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--code-bg);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 14px;
    line-height: 1.65;
    tab-size: 4;
    -webkit-overflow-scrolling: touch;
}
.gh-content pre code { font: inherit; background: none; border: 0; padding: 0; }
.code-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    height: 26px;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--bg);
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, border-color 0.15s;
}
.code-block:hover .code-copy,
.code-copy:focus-visible,
.code-copy.is-copied { opacity: 1; }
.code-copy:hover { color: var(--ink); border-color: var(--line-strong); }
.code-copy.is-copied { color: var(--accent-text); border-color: var(--accent); }
@media (hover: none) {
    .code-copy { opacity: 1; }
}

.gh-content table:not(.kg-card table) {
    display: block;
    width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
}
.gh-content table:not(.kg-card table) th,
.gh-content table:not(.kg-card table) td {
    padding: 10px 14px 10px 0;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
.gh-content table:not(.kg-card table) th {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom-color: var(--line-strong);
}

.gh-content img { margin-inline: auto; }
.gh-content figure { margin-inline: 0; }
.gh-content .kg-image-card img { border-radius: 4px; }

/* Koenig card widths. Wide stops short of the side columns. Full does too
   while they are there, fills the rails between 1024px and 1099px, and goes
   edge to edge below that, where the rails are hidden. */
.gh-content .kg-width-wide,
.gh-content .kg-width-full {
    position: relative;
    width: min(100cqw - 2 * var(--gutter), 100% + 96px);
    max-width: none;
    margin-left: 50%;
    transform: translateX(-50%);
}
.gh-content .kg-width-wide img,
.gh-content .kg-width-full img { width: 100%; }
@media (max-width: 1099px) {
    .gh-content .kg-width-full { width: min(var(--frame-w), 100cqw - 2 * var(--outer)); }
    .gh-content .kg-width-full img { border-radius: 0; }
    .gh-content .kg-width-full figcaption { padding-inline: var(--gutter); }
}

/* Recolour Ghost's own card styles through the tokens. cards.min.css paints
   several cards white with #222 text, which would leave white boxes in dark
   mode, so these selectors are written to outrank it. */
.gh-content .kg-bookmark-card a.kg-bookmark-container,
.gh-content .kg-file-card a.kg-file-card-container,
.gh-content .kg-product-card .kg-product-card-container,
.gh-content .kg-audio-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: none;
    background: var(--bg);
    color: var(--ink);
    text-decoration: none;
    transition: border-color 0.15s;
}
.gh-content .kg-bookmark-card a.kg-bookmark-container:hover,
.gh-content .kg-file-card a.kg-file-card-container:hover { border-color: var(--line-strong); }
.gh-content .kg-bookmark-title { font-family: var(--font-heading); color: var(--ink); }
.gh-content .kg-bookmark-description,
.gh-content .kg-bookmark-metadata,
.gh-content .kg-bookmark-author,
.gh-content .kg-bookmark-publisher,
.gh-content .kg-product-card .kg-product-card-description p,
.gh-content .kg-product-card .kg-product-card-description ul,
.gh-content .kg-product-card .kg-product-card-description ol,
.gh-content .kg-file-card-caption,
.gh-content .kg-file-card-metadata,
.gh-content .kg-file-card-filesize,
.gh-content .kg-product-card-description,
.gh-content .kg-audio-time,
.gh-content .kg-audio-duration { color: var(--muted); opacity: 1; } /* cards.min.css fades some with opacity */
.gh-content .kg-file-card-title,
.gh-content .kg-product-card-title,
.gh-content .kg-audio-title { color: var(--ink); background: transparent; }
.gh-content .kg-audio-player-container button,
.gh-content .kg-audio-player-container svg { color: var(--ink); }
.gh-content .kg-cta-sponsor-label span:not(a span) { color: var(--text); }
.gh-content .kg-callout-card { border-radius: 8px; }
.gh-content .kg-callout-card-grey,
.gh-content .kg-callout-card-white { background: var(--bg-soft); border: 1px solid var(--line); }
.gh-content .kg-callout-card-blue { background: var(--accent-soft); }
.gh-content .kg-callout-text { font-size: 17px; line-height: 1.6; }
.gh-content .kg-embed-card { display: flex; flex-direction: column; align-items: center; }

@media (max-width: 599px) {
    .gh-content { font-size: 17px; }
    .gh-content h2 { font-size: 25px; }
    .gh-content h3 { font-size: 20px; }
    .gh-content pre { margin-inline: calc(-1 * var(--gutter)); border-radius: 0; border-inline: 0; font-size: 13px; }
    .code-copy { right: 4px; }
}

/* Motion ---------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
