/* =========================================================================
   Paperleaf — a paper-toned Ghost theme.
   Plain CSS, no build step. Colour schemes are driven by [data-scheme] on
   <html>; fonts by [data-heading] / [data-body].
   ========================================================================= */

/* ---------------------------------------------------------------- tokens */
:root {
    --sidebar-w: 264px;
    --tabbar-h: 62px;

    --radius-sm: 9px;
    --radius: 14px;
    --radius-lg: 22px;

    --measure: 66ch;

    --font-heading: "Fraunces", Georgia, "Times New Roman", serif;
    --font-body: "Newsreader", Georgia, "Times New Roman", serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

    --step--1: 0.82rem;
    --step-0: 1.03rem;
    --step-1: 1.22rem;
    --step-2: 1.5rem;
    --step-3: 1.92rem;
    --step-4: 2.45rem;
    --step-5: 3.15rem;

    --ease: cubic-bezier(.2, .7, .3, 1);
}

/* Heading + body font mapping (see package.json settings) */
html[data-heading="fraunces"]      { --font-heading: "Fraunces", Georgia, serif; }
html[data-heading="newsreader"]    { --font-heading: "Newsreader", Georgia, serif; }
html[data-heading="playfair"]      { --font-heading: "Playfair Display", Georgia, serif; }
html[data-heading="spectral"]      { --font-heading: "Spectral", Georgia, serif; }
html[data-heading="dm-serif"]      { --font-heading: "DM Serif Display", Georgia, serif; }
html[data-heading="marcellus"]     { --font-heading: "Marcellus", Georgia, serif; }
html[data-heading="space-grotesk"] { --font-heading: "Space Grotesk", system-ui, sans-serif; }
html[data-heading="sora"]          { --font-heading: "Sora", system-ui, sans-serif; }

html[data-body="newsreader"]   { --font-body: "Newsreader", Georgia, serif; }
html[data-body="literata"]     { --font-body: "Literata", Georgia, serif; }
html[data-body="lora"]         { --font-body: "Lora", Georgia, serif; }
html[data-body="source-serif"] { --font-body: "Source Serif 4", Georgia, serif; }
html[data-body="inter"]        { --font-body: "Inter", system-ui, sans-serif; }
html[data-body="work-sans"]    { --font-body: "Work Sans", system-ui, sans-serif; }
html[data-body="ibm-plex-sans"]{ --font-body: "IBM Plex Sans", system-ui, sans-serif; }

/* --------------------------------------------------------------- schemes */
html[data-scheme="paper"] {
    --bg: #f5efe4;
    --bg-2: #efe6d6;
    --surface: #fffdf9;
    --surface-2: #fbf7ef;
    --text: #26221d;
    --muted: #6c6255;
    --border: #e5dac6;
    --accent: #9a5a2b;
    --accent-contrast: #fffdf9;
    --shadow: 0 1px 2px rgba(74, 56, 30, .05), 0 12px 30px -20px rgba(74, 56, 30, .45);
}

html[data-scheme="light"] {
    --bg: #f2f2f4;
    --bg-2: #e9e9ee;
    --surface: #ffffff;
    --surface-2: #fafafb;
    --text: #17171a;
    --muted: #63636e;
    --border: #e2e2e8;
    --accent: #2f5fd0;
    --accent-contrast: #ffffff;
    --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 12px 30px -20px rgba(20, 20, 30, .35);
}

html[data-scheme="blush"] {
    --bg: #fbf1f1;
    --bg-2: #f6e6e7;
    --surface: #fffdfd;
    --surface-2: #fdf6f6;
    --text: #332528;
    /* darkened from #8a6f74: that sat at 4.11:1 on the paper, under the 4.5:1
       threshold. This keeps the same rose-grey hue and reaches 4.68:1. */
    --muted: #806670;
    --border: #f1dede;
    --accent: #a84f6e;
    --accent-contrast: #fffdfd;
    --shadow: 0 1px 2px rgba(90, 50, 60, .05), 0 12px 30px -20px rgba(90, 50, 60, .35);
}

html[data-scheme="sage"] {
    --bg: #eef2ea;
    --bg-2: #e3e9dd;
    --surface: #fffefb;
    --surface-2: #f5f8f1;
    --text: #232c26;
    --muted: #64705f;
    --border: #dde5d6;
    --accent: #4c7357;
    --accent-contrast: #fffefb;
    --shadow: 0 1px 2px rgba(40, 60, 45, .05), 0 12px 30px -20px rgba(40, 60, 45, .35);
}

html[data-scheme="mist"] {
    --bg: #edf1f5;
    --bg-2: #e2e9f0;
    --surface: #ffffff;
    --surface-2: #f6f9fc;
    --text: #1d2733;
    --muted: #5f6b7a;
    --border: #dbe3ec;
    --accent: #3c6f9c;
    --accent-contrast: #ffffff;
    --shadow: 0 1px 2px rgba(30, 50, 70, .05), 0 12px 30px -20px rgba(30, 50, 70, .35);
}

html[data-scheme="dark"],
html[data-scheme="system"][data-resolved-scheme="dark"] {
    --bg: #17161a;
    --bg-2: #1e1c22;
    --surface: #211f26;
    --surface-2: #26242c;
    --text: #ece9f0;
    --muted: #9d97a6;
    --border: #322f39;
    --accent: #cf9a63;
    --accent-contrast: #1a1712;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 14px 34px -20px rgba(0, 0, 0, .85);
}

html[data-scheme="midnight"] {
    --bg: #0c1117;
    --bg-2: #0f1620;
    --surface: #121a24;
    --surface-2: #16202c;
    --text: #e4ecf4;
    --muted: #8a97a6;
    --border: #1e2937;
    --accent: #6fa8ff;
    --accent-contrast: #0a1119;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 14px 34px -20px rgba(0, 0, 0, .9);
}

html[data-scheme="system"] {
    --bg: #f2f2f4;
    --bg-2: #e9e9ee;
    --surface: #ffffff;
    --surface-2: #fafafb;
    --text: #17171a;
    --muted: #63636e;
    --border: #e2e2e8;
    --accent: #2f5fd0;
    --accent-contrast: #ffffff;
    --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 12px 30px -20px rgba(20, 20, 30, .35);
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--step-0);
    line-height: 1.72;
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

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

button { font: inherit; color: inherit; cursor: pointer; }

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.16;
    letter-spacing: -0.012em;
    margin: 0;
    color: var(--text);
}

p { margin: 0 0 1.1em; }

hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 2.4em 0;
}

.icon { width: 18px; height: 18px; flex: 0 0 auto; }

.skip-link {
    position: fixed;
    top: -100px;
    left: 12px;
    z-index: 200;
    background: var(--accent);
    color: var(--accent-contrast);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    transition: top .18s var(--ease);
}
.skip-link:focus { top: 12px; }

:where(a, button, input, summary, [tabindex]):focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 3px;
}

/* --------------------------------------------------------------- layout */
.app-main {
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    padding: 0 clamp(18px, 4vw, 44px) 0;
}

.app-main > * {
    max-width: 880px;
    margin-inline: auto;
}

.app-main > .hero { max-width: 980px; }

/* -------------------------------------------------------------- sidebar */
.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    border-right: 1px solid var(--border);
    background: var(--bg);
    overflow-y: auto;
    overscroll-behavior: contain;
    z-index: 40;
}

.sidebar__inner {
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-height: 100%;
    padding: 30px 22px 26px;
}

.sidebar__brand { display: grid; gap: 10px; }

.brand--text {
    font-family: var(--font-heading);
    font-size: var(--step-2);
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
}
.brand--logo img { max-height: 42px; width: auto; }
.brand__logo--dark { display: none; }

/* Dark schemes. If a dark-mode logo was uploaded, it replaces the normal one.
   If not, the normal logo is turned into a light silhouette so a dark-ink
   wordmark stays readable instead of disappearing into the background. */
html[data-scheme="dark"] .brand--has-dark .brand__logo--light,
html[data-scheme="midnight"] .brand--has-dark .brand__logo--light,
html[data-scheme="system"][data-resolved-scheme="dark"] .brand--has-dark .brand__logo--light { display: none; }
html[data-scheme="dark"] .brand--has-dark .brand__logo--dark,
html[data-scheme="midnight"] .brand--has-dark .brand__logo--dark,
html[data-scheme="system"][data-resolved-scheme="dark"] .brand--has-dark .brand__logo--dark { display: block; }

html[data-scheme="dark"] .brand--logo:not(.brand--has-dark) img,
html[data-scheme="midnight"] .brand--logo:not(.brand--has-dark) img,
html[data-scheme="system"][data-resolved-scheme="dark"] .brand--logo:not(.brand--has-dark) img {
    filter: brightness(0) invert(1);
}

.sidebar__tagline {
    margin: 0;
    color: var(--muted);
    font-size: var(--step--1);
    line-height: 1.5;
}

.sidebar__search {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--muted);
    font-size: var(--step--1);
    transition: border-color .15s var(--ease), color .15s var(--ease);
}
.sidebar__search:hover { border-color: var(--accent); color: var(--text); }

/* ------------------------------------------------------------------ nav */
.nav__list, .nav__sublist, .deck__list, .menu-sheet__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav__list { display: grid; gap: 2px; }

.nav__link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 8px 11px;
    border-radius: 10px;
    color: var(--muted);
    font-size: var(--step--1);
    font-weight: 500;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.nav__link:hover { background: var(--surface-2); color: var(--text); }
.nav__link.is-current { color: var(--text); background: var(--surface); }
.nav__label { flex: 1; }

.nav__group > summary { list-style: none; cursor: pointer; }
.nav__group > summary::-webkit-details-marker { display: none; }
.nav__group[open] > summary { color: var(--text); }
.nav__caret { width: 15px; height: 15px; transition: transform .2s var(--ease); }
.nav__group[open] .nav__caret { transform: rotate(180deg); }

.nav__sublist {
    display: grid;
    gap: 1px;
    margin: 2px 0 6px 22px;
    padding-left: 12px;
    border-left: 1px solid var(--border);
}
.nav__sublink {
    display: block;
    padding: 6px 10px;
    border-radius: 8px;
    color: var(--muted);
    font-size: var(--step--1);
}
.nav__sublink:hover { background: var(--surface-2); color: var(--text); }

/* secondary navigation sits under the primary list, quieter */
.nav--sub {
    margin-top: 2px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}
.nav__link--sub {
    padding-left: 11px;   /* lines the icons up in one column with the main menu */
    font-size: 0.79rem;
    color: var(--muted);
}
.nav__link--sub .icon { width: 15px; height: 15px; opacity: .8; }
.nav__link--sub.is-current { background: transparent; color: var(--text); }

/* ----------------------------------------------------------------- deck */
.deck { display: grid; gap: 10px; }
.deck__title {
    font-family: var(--font-body);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}
.deck__list { display: grid; gap: 3px; }
.deck__link {
    display: flex;
    gap: 11px;
    padding: 7px 9px;
    border-radius: 10px;
    transition: background .15s var(--ease);
}
.deck__link:hover { background: var(--surface-2); }
.deck__index {
    flex: 0 0 auto;
    width: 20px;
    font-family: var(--font-body);
    font-size: var(--step--1);
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    padding-top: 1px;
}
.deck__text { display: grid; gap: 2px; min-width: 0; }
.deck__post-title {
    font-family: var(--font-heading);
    font-size: var(--step--1);
    line-height: 1.3;
    font-weight: 500;
    color: var(--text);
}
.deck__meta { color: var(--muted); font-size: 0.72rem; }

/* ------------------------------------------------------------ sidebar ft */
.sidebar__foot {
    margin-top: auto;
    display: grid;
    gap: 14px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
}
.sidebar__social { display: flex; gap: 8px; }
.sidebar__social a {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--muted);
    transition: color .15s var(--ease), border-color .15s var(--ease);
}
.sidebar__social a:hover { color: var(--accent); border-color: var(--accent); }
/* The reader's light / dark switch: one round button in the top-right corner,
   quietly transparent so it sits over the paper without cutting into it. */
.theme-switch {
    position: fixed;
    top: 12px;
    right: max(14px, env(safe-area-inset-right));
    z-index: 42;
}
.theme-toggle {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 50%;
    background: color-mix(in srgb, var(--surface) 84%, transparent);
    backdrop-filter: blur(9px) saturate(140%);
    color: var(--muted);
    box-shadow: var(--shadow);
    transition: color .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease);
}
.theme-toggle:hover {
    color: var(--text);
    border-color: var(--accent);
    transform: translateY(-1px);
}
.theme-toggle .icon { width: 18px; height: 18px; }
.theme-toggle .theme-toggle__sun,
.theme-toggle .theme-toggle__moon,
.theme-toggle .theme-toggle__auto { display: none; }
.theme-toggle[data-state="light"] .theme-toggle__sun,
.theme-toggle[data-state="dark"] .theme-toggle__moon,
.theme-toggle[data-state="system"] .theme-toggle__auto { display: block; }

.sidebar__smallprint {
    margin: 0;
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.5;
}

/* -------------------------------------------------------------- buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-family: var(--font-body);
    font-size: var(--step--1);
    font-weight: 600;
    transition: transform .15s var(--ease), background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.btn--block { width: 100%; }
.btn--accent {
    background: var(--accent);
    color: var(--accent-contrast);
}
.btn--accent:hover { transform: translateY(-1px); }
.btn--ghost {
    border-color: var(--border);
    color: var(--text);
}
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

.chip {
    display: inline-block;
    padding: 5px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--muted);
    transition: color .15s var(--ease), border-color .15s var(--ease);
}
.chip:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------------------------------------------------------- hero */
.hero {
    display: grid;
    gap: 22px;
    padding: clamp(26px, 5vw, 46px) 0 clamp(22px, 4vw, 38px);
    border-bottom: 1px solid var(--border);
    margin-bottom: clamp(26px, 5vw, 44px);
}
.hero--image { grid-template-columns: 1.05fr 1fr; align-items: center; gap: clamp(22px, 4vw, 46px); }
.hero__media { border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow); }
.hero__media img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.hero__body { display: grid; gap: 14px; }
.hero__title { font-size: clamp(1.9rem, 3.6vw, var(--step-5)); letter-spacing: -0.025em; }
.hero__excerpt { color: var(--muted); font-size: var(--step-1); margin: 0; max-width: 46ch; }
.hero__more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--accent);
    font-weight: 600;
    font-size: var(--step--1);
}
.hero__more .icon { transition: transform .2s var(--ease); }
.hero__more:hover .icon { transform: translateX(4px); }

/* ---------------------------------------------------------------- feed */
.feed { padding-bottom: 40px; }

.feed__head {
    padding: 34px 0 20px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}
.feed__title { font-size: var(--step-3); }
.feed__desc { margin: 8px 0 0; color: var(--muted); font-size: var(--step--1); }

/* the topics line under the heading, grown from the tags in use */
.feed__topics {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin: 9px 0 0;
    max-width: 62ch;
}
/* Each tag carries its own accent colour, but blended heavily down with the
   muted text colour — it tints the line rather than shouting over it. Tags
   without a colour fall back to the theme accent and a neutral dot. */
.feed__topic {
    color: color-mix(in srgb, var(--tag-color, var(--accent)) 38%, var(--muted));
    font-size: var(--step--1);
    transition: color .15s var(--ease);
}
.feed__topic::before {
    content: "";
    display: inline-block;
    width: 5px;
    height: 5px;
    margin-right: 7px;
    border-radius: 50%;
    background: var(--tag-color, var(--border));
    vertical-align: 1px;
    opacity: .8;
    transition: opacity .15s var(--ease);
}
.feed__topic:hover {
    color: color-mix(in srgb, var(--tag-color, var(--accent)) 72%, var(--text));
}
.feed__topic:hover::before { opacity: 1; }
.feed__topic-sep { color: var(--border); font-size: var(--step--1); }

.grid { display: grid; gap: 26px; }
.grid--posts { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.grid--authors, .grid--tags, .grid--shop { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); }

.empty {
    padding: 40px 0;
    color: var(--muted);
    font-style: italic;
}

/* ---------------------------------------------------------------- card */
.card {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .18s var(--ease), border-color .18s var(--ease);
}
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }

.card__media { display: block; }
.card__img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }

.card__body {
    display: flex;
    flex-direction: column;
    gap: 9px;
    padding: 18px 20px 20px;
    flex: 1;
}
.card__eyebrow { display: flex; gap: 8px; }
.card__tag {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
}
.card__title { font-size: var(--step-1); }
.card__title a { transition: color .15s var(--ease); }
.card__excerpt {
    margin: 0;
    color: var(--muted);
    font-size: var(--step--1);
    line-height: 1.6;
    flex: 1;
}
.card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 0.75rem;
}
.card__author { color: var(--text); font-weight: 500; }
.card__sep { opacity: .6; }

/* ------------------------------------------------------------- pager */
.pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 44px 0 10px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.pager__link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-size: var(--step--1);
    font-weight: 600;
}
.pager__link:hover { color: var(--accent); }
.pager__link.is-disabled { color: var(--muted); opacity: .45; }
.pager__count { color: var(--muted); font-size: 0.78rem; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- posts */
.post { padding: 34px 0 20px; }

.post__banner, .page__banner {
    margin: 0 0 30px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.post__banner img, .page__banner img { width: 100%; }
.post__banner figcaption, .page__banner figcaption {
    padding: 10px 4px 0;
    color: var(--muted);
    font-size: 0.78rem;
}

.post__head { margin-bottom: 30px; }
.post__eyebrow { margin-bottom: 14px; }
.post__tag {
    font-size: 0.72rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    font-weight: 600;
}
.post__title {
    font-size: clamp(1.9rem, 4vw, var(--step-5));
    letter-spacing: -0.028em;
    margin-bottom: 16px;
    max-width: 22ch;
}
.post__lede {
    font-size: var(--step-1);
    color: var(--muted);
    max-width: 52ch;
    margin-bottom: 18px;
}
.post__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 0.79rem;
    padding-top: 4px;
}
.post__author { color: var(--text); font-weight: 500; }
.post__author:hover { color: var(--accent); }
.post__sep { opacity: .55; }

/* two-column layouts */
.post.layout-image-left .post__head,
.post.layout-image-right .post__head,
.post.layout-video .post__head {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(20px, 4vw, 40px);
    align-items: center;
}
.post.layout-image-left .post__intro { order: 2; }
.post.layout-image-left .post__side  { order: 1; }

.post__side {
    margin: 0;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    position: relative;
}
.post__side img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

.post__side--video .post__play {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(15, 12, 8, .22);
}
.post__play svg {
    width: 52px;
    height: 52px;
    color: #fff;
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .4));
}

.post__body { margin-top: 6px; }
/* The container spans the full post box, so wide and full-bleed cards can widen
   without ever escaping it. The reading measure is applied to the blocks
   themselves instead of to the container. */
.post__content { max-width: none; }
.post__content > * { max-width: var(--measure); }
.post__content > .kg-width-wide,
.post__content > .kg-width-full,
.post__content > .kg-gallery-card { max-width: none; }

.post__foot {
    margin-top: 44px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
    display: grid;
    gap: 28px;
}

.post__tags { display: flex; flex-wrap: wrap; gap: 8px; }

/* Comment count on cards. The helper prints nothing at all while a post has no
   comments, so the separator is drawn by the count itself — no dangling dot. */
.card__comments:empty { display: none; }
.card__comments:not(:empty)::before {
    content: "·";
    margin-right: 6px;
    opacity: .55;
}

/* Members-only notice, where Ghost cuts the text short */
.gate {
    max-width: var(--measure);
    margin-top: 28px;
    padding: 22px 24px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.gate__title { font-size: var(--step-1); margin-bottom: 8px; }
.gate__text { margin: 0 0 16px; color: var(--muted); }
.gate__actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; }

/* Newsletter signup at the end of a post */
.subscribe {
    max-width: var(--measure);
    margin-top: 42px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}
.subscribe__title { font-size: var(--step-1); margin-bottom: 8px; }
.subscribe__text { margin: 0 0 16px; color: var(--muted); font-size: var(--step--1); }
.subscribe-form__row { display: flex; flex-wrap: wrap; gap: 10px; }
.subscribe-form__input {
    flex: 1 1 220px;
    min-width: 0;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: var(--step--1);
}
.subscribe-form__input::placeholder { color: var(--muted); }
.subscribe-form__status { margin: 10px 0 0; color: #b3261e; font-size: var(--step--1); }
.subscribe-form__ok { margin: 10px 0 0; color: var(--accent); font-size: var(--step--1); }
.subscribe-form .subscribe-form__status,
.subscribe-form .subscribe-form__ok { display: none; }
.subscribe-form.error .subscribe-form__status { display: block; }
.subscribe-form.success .subscribe-form__ok { display: block; }
.subscribe-form.success .subscribe-form__row { display: none; }

/* Ghost's own comment system brings its styling; we only give it room */
.post__comments { margin-top: 48px; }

/* ------------------------------------------------------- table of contents */
.toc {
    max-width: var(--measure);
    margin: 0 0 30px;
    padding: 14px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.toc__summary {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    list-style: none;
    font-size: var(--step--1);
    font-weight: 600;
    letter-spacing: 0.01em;
}
.toc__summary::-webkit-details-marker { display: none; }
.toc__caret { margin-left: auto; width: 15px; height: 15px; transition: transform .2s var(--ease); }
.toc[open] .toc__caret { transform: rotate(180deg); }
.toc__nav { padding-top: 12px; }
.toc__nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.toc__nav a {
    display: block;
    font-size: var(--step--1);
    color: var(--muted);
    line-height: 1.45;
    border-left: 2px solid var(--border);
    padding-left: 12px;
}
.toc__nav a:hover { color: var(--accent); border-left-color: var(--accent); }
.toc__nav .is-sub a { padding-left: 26px; font-size: 0.8rem; }

/* --------------------------------------------------------------- share */
.share { display: grid; gap: 12px; }
.share__trigger {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    justify-self: start;
    padding: 9px 17px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: var(--step--1);
    font-weight: 600;
}
.share__trigger:hover { border-color: var(--accent); color: var(--accent); }

.share-dialog {
    width: min(440px, calc(100vw - 32px));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    color: var(--text);
    padding: 24px;
    box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .5);
    position: relative;
}
.share-dialog::backdrop { background: rgba(20, 16, 12, .45); }
.share-dialog__title { font-size: var(--step-1); margin-bottom: 16px; }
.share-dialog__close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 1.4rem;
    line-height: 1;
}
.share-dialog__close:hover { color: var(--text); background: var(--surface-2); }

.share-dialog__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.share__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--muted);
    font-size: 0.68rem;
    text-align: center;
    transition: color .15s var(--ease), border-color .15s var(--ease);
}
.share__item:hover { color: var(--accent); border-color: var(--accent); }
.share__item .icon { width: 20px; height: 20px; }

/* ---------------------------------------------------------- prev / next */
.siblings {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 46px 0 60px;
}
.siblings__card {
    display: grid;
    gap: 7px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: transform .18s var(--ease), border-color .18s var(--ease);
}
.siblings__card:hover { transform: translateY(-2px); border-color: var(--accent); }
.siblings__card--end { text-align: right; justify-items: end; }
.siblings__dir {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}
.siblings__title { font-family: var(--font-heading); font-size: var(--step-1); line-height: 1.25; }
.siblings__meta { color: var(--muted); font-size: 0.75rem; }

/* ----------------------------------------------------------- author box */
.author-box {
    display: flex;
    gap: 16px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.author-box__img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; }
.author-box__text { display: grid; gap: 6px; }
.author-box__name { font-size: var(--step-1); }
.author-box__bio { margin: 0; color: var(--muted); font-size: var(--step--1); line-height: 1.6; }
.author-box__links { margin: 0; display: flex; gap: 12px; font-size: 0.78rem; }
.author-box__links a { color: var(--accent); }

/* --------------------------------------------------------------- pages */
.page { padding: 40px 0 30px; }
.page--narrow .page__content { max-width: 58ch; }
.page__head { margin-bottom: 28px; }
.page__title { font-size: clamp(1.8rem, 3.6vw, var(--step-4)); margin-bottom: 12px; }
.page__lede { color: var(--muted); font-size: var(--step-1); max-width: 50ch; margin: 0; }
.page__content { max-width: none; }
.page__content > * { max-width: var(--measure); }
.page__content > .kg-width-wide,
.page__content > .kg-width-full,
.page__content > .kg-gallery-card { max-width: none; }
.page--narrow .page__content > * { max-width: 58ch; }

.page-head {
    padding: 42px 0 22px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}
.page-head__title { font-size: var(--step-3); }
.page-head__desc { color: var(--muted); margin: 10px 0 0; max-width: 54ch; }

.tag-banner { margin: 30px auto 0; border-radius: var(--radius-lg); overflow: hidden; }
.tag-banner img { width: 100%; max-height: 260px; object-fit: cover; }

.author-hero {
    display: flex;
    gap: 20px;
    align-items: center;
    padding: 42px 0 26px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 30px;
}
.author-hero__img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; }
.author-hero__name { font-size: var(--step-3); }
.author-hero__bio { color: var(--muted); margin: 8px 0 6px; max-width: 54ch; }
.author-hero__meta { color: var(--muted); font-size: 0.78rem; margin: 0; }

/* authors / tags / shop cards */
.author-card, .tag-card, .product {
    display: grid;
    gap: 8px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
    transition: transform .18s var(--ease), border-color .18s var(--ease);
}
.author-card:hover, .tag-card:hover, .product:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
}
.author-card__avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--surface-2);
    display: grid;
    place-items: center;
}
.author-card__avatar img { width: 100%; height: 100%; object-fit: cover; }
.author-card__initial { font-family: var(--font-heading); font-size: var(--step-1); color: var(--accent); }
.author-card__name { font-family: var(--font-heading); font-size: var(--step-1); }
.author-card__count, .tag-card__count { color: var(--muted); font-size: 0.76rem; }
.tag-card__name { font-family: var(--font-heading); font-size: var(--step-1); }
.tag-card__desc { color: var(--muted); font-size: var(--step--1); line-height: 1.5; }

.product__media { display: block; border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); aspect-ratio: 4 / 3; }
.product__media img { width: 100%; height: 100%; object-fit: cover; }
.product__title { font-family: var(--font-heading); font-size: var(--step-1); }
.product__desc { color: var(--muted); font-size: var(--step--1); line-height: 1.5; }

.contact-links {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr));
    gap: 12px;
    margin-top: 34px;
    padding-top: 26px;
    border-top: 1px solid var(--border);
}
.contact-links__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    font-size: var(--step--1);
    font-weight: 500;
}
.contact-links__item:hover { border-color: var(--accent); color: var(--accent); }

/* --------------------------------------------------------------- error */
.error {
    padding: clamp(50px, 12vh, 130px) 0;
    display: grid;
    gap: 14px;
    justify-items: start;
}
.error__code {
    font-family: var(--font-heading);
    font-size: clamp(4rem, 14vw, 8rem);
    line-height: 1;
    color: var(--accent);
    margin: 0;
    letter-spacing: -0.04em;
}
.error__title { font-size: var(--step-2); }
.error__text { color: var(--muted); max-width: 46ch; margin: 0 0 10px; }

/* --------------------------------------------------------------- footer */
.site-foot {
    padding: 40px 0 30px;
    margin-top: 40px;
}
.site-foot__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 18px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.78rem;
}
.site-foot__copy, .site-foot__meta, .site-foot__colophon { margin: 0; }
.site-foot__colophon { margin-left: auto; }
.site-foot a:hover { color: var(--accent); }

/* ---------------------------------------------------------- progress */
.progress {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: 3px;
    z-index: 60;
    pointer-events: none;
}
.progress__bar {
    display: block;
    height: 100%;
    width: 0;
    background: var(--accent);
    transition: width .12s linear;
}

/* ------------------------------------------------------------- tab bar */
.tabbar {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 55;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: saturate(150%) blur(12px);
    border-top: 1px solid var(--border);
    grid-template-columns: repeat(4, 1fr);
}
.tabbar__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 0.62rem;
    letter-spacing: 0.02em;
}
.tabbar__item .icon { width: 21px; height: 21px; }
.tabbar__item.is-current, .tabbar__item:hover { color: var(--text); }
.tabbar__item--accent { color: var(--accent); }

/* --------------------------------------------------------------- sheets */
.sheet-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    background: rgba(18, 14, 10, .45);
    opacity: 0;
    transition: opacity .3s var(--ease);
}
.sheet-overlay.is-open { opacity: 1; }
.sheet-overlay[hidden] { display: none; }

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 80;
    max-height: 82vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 8px 22px calc(28px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform .32s var(--ease);
    touch-action: pan-y;
}
.sheet__grabber { touch-action: none; }
.sheet[hidden] { display: none; }
.sheet.is-open { transform: translateY(0); }
.sheet__grabber {
    display: block;
    width: 46px;
    height: 4px;
    margin: 6px auto 16px;
    border: 0;
    border-radius: 999px;
    background: var(--border);
}
.sheet__hint { color: var(--muted); font-size: var(--step--1); margin-top: 12px; }

/* live search results inside the search sheet */
.search-results { margin-top: 18px; }
.search-results__count,
.search-results__empty {
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.78rem;
}
.search-results__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 3px;
}
.search-results__item a {
    display: grid;
    gap: 3px;
    padding: 11px 12px;
    border-radius: var(--radius);
    transition: background .15s var(--ease);
}
.search-results__item a:hover { background: var(--surface-2); }
.search-results__title {
    font-family: var(--font-heading);
    font-size: var(--step-1);
    line-height: 1.25;
}
.search-results__date { color: var(--muted); font-size: 0.72rem; }
.search-results__excerpt {
    color: var(--muted);
    font-size: var(--step--1);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.search-form {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.search-form__input {
    flex: 1;
    border: 0;
    background: transparent;
    font: inherit;
    color: var(--text);
    outline: none;
    font-size: var(--step-1);
}

.menu-sheet { display: grid; gap: 10px; }
.menu-sheet__list { display: grid; gap: 2px; }
.menu-sheet__link {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 12px;
    border-radius: var(--radius);
    font-family: var(--font-heading);
    font-size: var(--step-1);
}
.menu-sheet__link:hover { background: var(--surface-2); color: var(--accent); }
.menu-sheet__link--sub {
    padding-left: 42px;
    font-family: var(--font-body);
    font-size: var(--step-0);
    color: var(--muted);
}

/* the shared navigation partial also renders inside the mobile sheet */
.menu-sheet .nav__list { gap: 2px; }
.menu-sheet .nav__link {
    padding: 12px 12px;
    font-family: var(--font-heading);
    font-size: var(--step-1);
    color: var(--text);
}
.menu-sheet .nav__link .icon { width: 20px; height: 20px; }
.menu-sheet .nav__link--sub {
    padding-left: 40px;
    font-family: var(--font-body);
    font-size: var(--step-0);
    color: var(--muted);
}
.menu-sheet .nav--sub,
.menu-sheet .nav__list + .nav__list {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* -------------------------------------------------------------- lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(12, 10, 8, .93);
    padding: 4vh 4vw;
}
.lightbox[hidden] { display: none; }
.lightbox__img { max-width: 100%; max-height: 92vh; border-radius: 8px; }
.lightbox__close,
.lightbox__nav {
    position: absolute;
    border: 0;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
}
.lightbox__close { top: 18px; right: 18px; width: 42px; height: 42px; font-size: 1.5rem; }
.lightbox__nav { top: 50%; transform: translateY(-50%); width: 46px; height: 46px; font-size: 1.6rem; }
.lightbox__nav--prev { left: 16px; }
.lightbox__nav--next { right: 16px; }
.lightbox__count {
    position: absolute;
    top: 26px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, .75);
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.04em;
}
.lightbox__caption {
    position: absolute;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%);
    max-width: min(680px, 84vw);
    margin: 0;
    text-align: center;
    color: rgba(255, 255, 255, .82);
    font-size: 0.82rem;
    line-height: 1.5;
}
.lightbox__caption:empty { display: none; }

/* -------------------------------------------------------- ghost content */
.post__content, .page__content {
    font-size: var(--step-0);
    line-height: 1.78;
}
.post__content > * + *, .page__content > * + * { margin-top: 1.15em; }

.post__content h2, .page__content h2 { font-size: var(--step-2); margin-top: 1.9em; }
.post__content h3, .page__content h3 { font-size: var(--step-1); margin-top: 1.6em; }
.post__content h4, .page__content h4 { font-size: var(--step-0); margin-top: 1.4em; }

.post__content a, .page__content a {
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
    text-underline-offset: 3px;
    transition: text-decoration-color .15s var(--ease);
}
.post__content a:hover, .page__content a:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

.post__content blockquote, .page__content blockquote {
    margin: 1.8em 0;
    padding-left: 22px;
    border-left: 3px solid var(--accent);
    font-family: var(--font-heading);
    font-size: var(--step-1);
    font-style: italic;
    color: var(--text);
}
.post__content blockquote cite { display: block; margin-top: .6em; font-size: var(--step--1); font-style: normal; color: var(--muted); }

.post__content ul, .post__content ol, .page__content ul, .page__content ol { padding-left: 1.3em; }
.post__content li, .page__content li { margin-bottom: .5em; }

.post__content code, .page__content code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 2px 6px;
    border-radius: 6px;
}
.post__content pre, .page__content pre {
    background: #14161c;
    color: #e8e6f0;
    padding: 20px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.6;
}
.post__content pre code, .page__content pre code { background: none; border: 0; padding: 0; color: inherit; }

.post__content img, .page__content img { border-radius: var(--radius); }
.post__content figure, .page__content figure { margin: 1.8em 0; }
.post__content figcaption, .page__content figcaption { color: var(--muted); font-size: 0.8rem; text-align: center; margin-top: 8px; }

.post__content table, .page__content table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.post__content th, .post__content td, .page__content th, .page__content td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; }

.post__content hr, .page__content hr { margin: 2.6em auto; width: 60px; border-top: 2px solid var(--accent); }

/* Ghost card kit */
.kg-card { margin: 1.8em 0; }
.kg-image-card img, .kg-embed-card iframe, .kg-video-card video { border-radius: var(--radius); }
.kg-video-card video { width: 100%; }

/* Embeds. Ghost writes fixed width/height attributes onto the iframe (200×113),
   so a theme has to size them itself — otherwise a video collapses into a
   narrow strip: full width, but only 113px tall. Video services get a proper
   16:9 box; everything else is at least capped to the column. */
.kg-embed-card {
    width: 100%;
    max-width: 100%;
}
.kg-embed-card iframe {
    display: block;
    width: 100%;
    max-width: 100%;
}
.kg-embed-card iframe[src*="youtu"],
.kg-embed-card iframe[src*="vimeo"] {
    height: auto;
    aspect-ratio: 16 / 9;
    border: 0;
}
.kg-bookmark-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
}
.kg-bookmark-container { display: flex; gap: 16px; padding: 16px; }
.kg-bookmark-content { display: grid; gap: 4px; }
.kg-bookmark-title { font-family: var(--font-heading); font-size: var(--step-1); }
.kg-bookmark-description { color: var(--muted); font-size: var(--step--1); }
.kg-bookmark-metadata { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; color: var(--muted); }
.kg-bookmark-icon { width: 18px; height: 18px; }
.kg-bookmark-thumbnail { flex: 0 0 120px; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }
.kg-callout-card {
    display: flex;
    gap: 14px;
    padding: 18px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.kg-nft-card { border-radius: var(--radius); overflow: hidden; }

/* --- Koenig galleries: rows of equal-height images with tight, even gaps --- */
.kg-gallery-card {
    margin: 2em 0;
    border-radius: var(--radius);
    overflow: hidden;
}
.kg-gallery-container {
    display: flex;
    flex-direction: column;
    max-width: 100%;
}
.kg-gallery-row {
    display: flex;
    flex-direction: row;
    justify-content: center;
}
.kg-gallery-row:not(:first-of-type) { margin-top: 6px; }
.kg-gallery-image {
    flex: 1 1 0;      /* inline flex from the editor still wins where present */
    min-width: 0;
}
.kg-gallery-image:not(:first-of-type) { margin-left: 6px; }
.kg-gallery-image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}
.kg-gallery-card figcaption { padding: 10px 2px 0; }

/* lightGallery needs a link around each image to build its thumbnails. That link
   is added by main.js — this keeps it invisible in the layout. */
.kg-gallery-image a,
.kg-image-card a { display: block; text-decoration: none; }
.kg-toggle-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 16px; }
.kg-toggle-heading { display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
/* Wide and full-bleed cards simply fill the post box. That box is already
   centred inside the page and stops short of the sidebar, so a card can widen
   without ever running underneath the navigation. */
.post__content > .kg-width-wide,
.post__content > .kg-width-full,
.page__content > .kg-width-wide,
.page__content > .kg-width-full {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
}
.post__content > .kg-width-full img,
.page__content > .kg-width-full img { border-radius: 0; }

/* =========================================================================
   Additions. Each one has its own heading, so any single feature can be
   lifted out again without disturbing the others.
   ========================================================================= */

/* ----- footnotes ----- */
.post__content sup {
    font-size: 0.72em;
    line-height: 0;
    vertical-align: super;
}
.post__content sup a {
    text-decoration: none;
    padding: 0 2px;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.post__content .footnotes {
    margin-top: 2.6em;
    padding-top: 1.4em;
    border-top: 1px solid var(--border);
    font-size: var(--step--1);
    color: var(--muted);
}
.post__content .footnotes ol { padding-left: 1.4em; }
.post__content .footnotes li { margin-bottom: .6em; }
.post__content .footnotes a { text-decoration: none; color: var(--accent); }

/* ----- the editor cards that were still unstyled ----- */
.kg-file-card,
.kg-audio-card,
.kg-product-card,
.kg-signup-card,
.kg-button-card { margin: 1.8em 0; }

.kg-file-card-container,
.kg-audio-card-container,
.kg-product-card-container,
.kg-signup-card-container {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    overflow: hidden;
}
.kg-file-card-container { display: flex; gap: 16px; align-items: center; padding: 16px 18px; }
.kg-file-card-contents { display: grid; gap: 3px; min-width: 0; }
.kg-file-card-title { font-family: var(--font-heading); font-size: var(--step-1); }
.kg-file-card-caption,
.kg-file-card-metadata { color: var(--muted); font-size: 0.78rem; }
.kg-file-card-icon { flex: 0 0 auto; width: 34px; height: 34px; color: var(--accent); }

.kg-audio-card-container { display: grid; gap: 12px; padding: 16px 18px; }
.kg-audio-thumbnail { width: 64px; height: 64px; border-radius: var(--radius-sm); overflow: hidden; }
.kg-audio-title { font-family: var(--font-heading); font-size: var(--step-1); }
.kg-audio-player-container { display: flex; align-items: center; gap: 12px; }
.kg-audio-player { flex: 1; min-width: 0; }
.kg-audio-duration,
.kg-audio-current-time { color: var(--muted); font-size: 0.76rem; font-variant-numeric: tabular-nums; }

.kg-product-card-container { display: grid; gap: 12px; padding: 18px; }
.kg-product-card-image { border-radius: var(--radius-sm); overflow: hidden; }
.kg-product-card-title { font-family: var(--font-heading); font-size: var(--step-1); }
.kg-product-card-description { color: var(--muted); font-size: var(--step--1); line-height: 1.6; }
.kg-product-card-button { justify-self: start; }
.kg-product-card-rating { color: var(--accent); font-size: 0.8rem; }

.kg-signup-card-container { display: grid; gap: 10px; padding: 24px; text-align: center; }
.kg-signup-card-heading { font-size: var(--step-1); }
.kg-signup-card-subheading { color: var(--muted); font-size: var(--step--1); }
.kg-signup-card-form { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.kg-signup-card-input {
    flex: 1 1 220px;
    min-width: 0;
    padding: 10px 15px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    font: inherit;
    font-size: var(--step--1);
}
.kg-signup-card-button { border-radius: 999px; }
.kg-signup-card-disclaimer { color: var(--muted); font-size: 0.74rem; }

.kg-button-card { display: flex; }
.kg-button-card .kg-btn {
    padding: 11px 20px;
    border-radius: 999px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-weight: 600;
    text-decoration: none;
}
.kg-button-card.kg-align-center { justify-content: center; }

/* ----- a series of posts ----- */
.series {
    max-width: var(--measure);
    margin-top: 46px;
    padding: 22px 24px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.series__title { font-size: var(--step-1); margin-bottom: 12px; }
.series__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 7px;
    counter-reset: series;
}
.series__item { counter-increment: series; }
.series__link {
    display: flex;
    gap: 11px;
    color: var(--muted);
    font-size: var(--step--1);
    line-height: 1.5;
}
.series__link::before {
    content: counter(series) ".";
    flex: 0 0 auto;
    min-width: 1.6em;
    color: var(--border);
    font-variant-numeric: tabular-nums;
}
.series__link:hover { color: var(--accent); }
.series__item.is-current .series__link { color: var(--text); font-weight: 600; }
.series__item.is-current .series__link::before { color: var(--accent); }

/* ----- 404: offer something to read ----- */
.error__more {
    margin-top: 40px;
    padding-top: 34px;
    border-top: 1px solid var(--border);
}
.error__more-title { font-size: var(--step-2); margin-bottom: 22px; }

/* ----- selected text, in the paper's own accent ----- */
::selection {
    background: color-mix(in srgb, var(--accent) 26%, transparent);
}

/* ----- more contrast, whenever the reader's system asks for it ----- */
@media (prefers-contrast: more) {
    html[data-scheme] {
        --border: color-mix(in srgb, var(--text) 45%, var(--bg));
        --muted: color-mix(in srgb, var(--text) 80%, var(--bg));
    }
    .card,
    .siblings__card,
    .toc,
    .gate,
    .subscribe,
    .series { border-width: 2px; }
}

/* --------------------------------------------------------- motion pref */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: .001ms !important;
        transition-duration: .001ms !important;
    }
}

/* ----------------------------------------------------------- responsive */
@media (max-width: 1180px) {
    .hero--image { grid-template-columns: 1fr; }
}

@media (max-width: 1024px) {
    :root { --sidebar-w: 0px; }
    .sidebar { display: none; }
    .app-main { margin-left: 0; padding-bottom: calc(var(--tabbar-h) + 40px + env(safe-area-inset-bottom)); }
    .progress { left: 0; }
    .tabbar { display: grid; }
}

@media (max-width: 720px) {
    :root { --step-4: 2.1rem; --step-5: 2.5rem; }
    .post.layout-image-left .post__head,
    .post.layout-image-right .post__head,
    .post.layout-video .post__head {
        grid-template-columns: 1fr;
    }
    .post.layout-image-left .post__intro { order: 1; }
    .post.layout-image-left .post__side  { order: 2; }
    .siblings { grid-template-columns: 1fr; }
    .siblings__card--end { text-align: left; justify-items: start; }
    .share-dialog__grid { grid-template-columns: repeat(3, 1fr); }
    .site-foot__colophon { margin-left: 0; }
    .author-hero { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 460px) {
    .share-dialog__grid { grid-template-columns: repeat(2, 1fr); }
    .feed__head { flex-wrap: wrap; }
}
