/* =========================================================
   Playbook — Ghost theme for business & technical playbooks
   Layout geometry follows a directory pattern:
     container 1320px · 192px filter rail + 3-col feed · gap 32px
     cards: 48px logo, 24px title, 1px border, 5px radius, 24px pad
     posts: full-bleed hero + responsive wrapper-width content
   Palette and icons are this theme's own.
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
    --accent: #4f46e5;
    --accent-ink: #ffffff;

    --bg: #ffffff;
    --bg-sunken: #fafafa;
    --surface: #ffffff;
    --surface-2: #f4f4f5;
    --ink: #18181b;
    --ink-2: #3f3f46;
    --muted: #71717a;
    --border: #ebebeb;
    --border-strong: #d4d4d8;

    --hero-bg: #202024;
    --hero-ink: #ffffff;

    --font-sans: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: "Newsreader", Iowan Old Style, Georgia, serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
    --font-system: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

    /* Ghost 5.87+ injects --gh-font-heading / --gh-font-body from Admin */
    --font-title: var(--gh-font-heading, var(--font-sans));
    --font-body: var(--gh-font-body, var(--font-sans));

    --radius: 5px;
    --radius-lg: 12px;
    --radius-xl: 24px;
    --radius-pill: 999px;
    --control-radius: 8px;

    --wrapper: 1320px;
    --rail: 192px;
    --gap: 32px;
}

.title-font-serif { --font-title: var(--gh-font-heading, var(--font-serif)); }
.title-font-mono  { --font-title: var(--gh-font-heading, var(--font-mono)); }
.body-font-serif  { --font-body: var(--gh-font-body, var(--font-serif)); }
.body-font-system { --font-body: var(--gh-font-body, var(--font-system)); }

html.dark-mode {
    --accent: #8581ff;
    --bg: #0e0e11;
    --bg-sunken: #131317;
    --surface: #16161a;
    --surface-2: #1e1e24;
    --ink: #f4f4f5;
    --ink-2: #d4d4d8;
    --muted: #8f8f99;
    --border: #26262c;
    --border-strong: #3a3a44;
    --hero-bg: #16161a;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
body a { color: inherit; }
body a,
body a:hover,
body a:focus,
body a:active,
body a:visited { text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; }
h1, h2, h3, h4, h5, h6 { font-family: var(--font-title); color: var(--ink); margin: 0; font-weight: 700; line-height: 1.25; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: var(--radius); transition: top .15s; }
.skip-link:focus { top: 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.wrapper { width: 100%; max-width: var(--wrapper); margin: 0 auto; padding: 0 16px; }
.section { padding: 48px 0; }

.section__head {
    display: flex; align-items: center; gap: 16px;
    margin-bottom: 24px;
}
.section__title { font-size: 1.5rem; letter-spacing: -0.02em; }
.section__more { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; font-weight: 600; color: var(--accent); }
.section__more svg { width: 15px; height: 15px; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 18px; border: 1px solid transparent; border-radius: var(--control-radius);
    font-family: var(--font-sans); font-size: .9rem; font-weight: 600; white-space: nowrap;
    transition: background .15s, border-color .15s, color .15s, opacity .15s;
}
.btn svg { width: 16px; height: 16px; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--primary:hover { opacity: .88; }
.btn--ghost { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.btn--ghost:hover { background: var(--surface-2); }
.btn.is-disabled { opacity: .35; pointer-events: none; }

.accent-outline .btn--primary { background: transparent; color: var(--accent); border-color: var(--accent); }
.accent-outline .btn--primary:hover { background: var(--accent); color: var(--accent-ink); opacity: 1; }
.accent-underline .btn--primary {
    background: transparent; color: var(--accent);
    border-color: transparent; border-bottom-color: var(--accent);
    border-radius: var(--control-radius);
}

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; padding: 0;
    background: transparent; border: 0; border-radius: var(--radius);
    color: var(--ink-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 19px; height: 19px; }
.link-btn { background: none; border: 0; padding: 0; display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.link-btn:hover { color: var(--accent); }
.link-btn svg { width: 16px; height: 16px; }

/* ---------- Header: 72px, brand + inline nav + actions ---------- */
.header { position: relative; z-index: 40; background: var(--bg); }
.header__inner { display: flex; align-items: center; gap: 24px; height: 72px; }
.header__brand { display: inline-flex; align-items: center; gap: 10px; height: 42px; flex: none; }
.header__logo { display: block; max-width: 220px; max-height: 42px; width: auto; height: auto; object-fit: contain; }
.header__logo--icon { width: 42px; height: 42px; object-fit: contain; border-radius: var(--radius); }
.header__logo-svg { display: block; width: 42px; height: 42px; color: var(--accent); }
.header__mark {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: var(--radius);
    background: var(--accent); color: var(--accent-ink);
}
.header__mark svg { width: 17px; height: 17px; }
.header__title { font-family: var(--font-title); font-weight: 800; font-size: 1.05rem; letter-spacing: -0.02em; }

.nav { display: flex; align-items: center; gap: 2px; list-style: none; }
.header__menu .nav a { display: block; padding: 7px 12px; border-radius: var(--radius); font-size: .93rem; font-weight: 500; color: var(--ink-2); }
.header__menu .nav a:hover { background: var(--surface-2); color: var(--ink); }
.nav-current a { color: var(--ink); font-weight: 600; }

.header__actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.header__actions > .btn { height: 42px; }
.scheme-toggle { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border-radius: var(--control-radius); }
.scheme-toggle .icon-btn { width: 30px; height: 30px; border-radius: calc(var(--control-radius) - 2px); }
.scheme-toggle .icon-btn svg { width: 16px; height: 16px; }
.scheme-toggle .icon-btn[aria-pressed="true"] { background: var(--bg); color: var(--accent); }

.menu-btn { display: none; }
.menu { border-top: 1px solid var(--border); background: var(--bg); padding: 8px 0 20px; }
.menu__primary .nav { display: block; list-style: none; }
.menu__nav { list-style: none; }
.menu__primary .nav a, .menu__nav a { display: block; padding: 12px 0; font-weight: 600; border-bottom: 1px solid var(--border); }
.menu__primary .nav a { border-radius: 0; color: var(--ink); }
.menu__primary .nav a:hover { background: transparent; color: var(--accent); }
.menu__nav--secondary a { font-weight: 400; color: var(--muted); }

/* ---------- Home hero: full-bleed, 640px, centered ---------- */
.hero {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 640px; padding: 64px 16px; overflow: hidden;
    background: var(--hero-bg); background-size: cover; background-position: center;
    color: var(--hero-ink); text-align: center; position: relative;
}
.hero.has-img::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.48), rgba(0,0,0,.68));
}
.hero.is-compact { min-height: 300px; }
.hero__content { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 840px; }
.hero__title {
    font-size: clamp(2.25rem, 5.2vw, 3.675rem);
    line-height: 1.02; letter-spacing: -0.03em; color: inherit;
}
.hero__title span { color: var(--accent); }
.hero .subscribe-form { margin-top: 32px; }

/* ---------- Subscribe forms ---------- */
.subscribe-form { position: relative; display: flex; width: 100%; max-width: 440px; }
.subscribe-form__input {
    flex: 1 1 auto; min-width: 0; padding: 12px 18px;
    font: inherit; font-size: .94rem; color: var(--ink);
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--control-radius);
}
.subscribe-form__input::placeholder { color: var(--muted); }

/* joined: one softly rounded rectangle, input and button share the shell */
.subscribe-form.is-joined { padding: 4px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--control-radius); }
.subscribe-form.is-joined .subscribe-form__input { border: 0; background: transparent; border-radius: calc(var(--control-radius) - 2px); }
.subscribe-form.is-joined .btn { flex: none; }

/* separate rectangular input + button */
.subscribe-form.is-rounded { gap: 8px; flex-wrap: wrap; }
.subscribe-form.is-rounded .subscribe-form__input { border-radius: var(--control-radius); }

.msg-success, .msg-error { display: none; position: absolute; top: calc(100% + 8px); left: 4px; font-size: .84rem; }
.msg-success { color: #17864a; }
.msg-error { color: #c2334c; }
.subscribe-form.success .msg-success { display: block; }
.subscribe-form.error .msg-error { display: block; }
.subscribe-form.success .subscribe-form__input, .subscribe-form.loading .subscribe-form__input { opacity: .5; }

/* ---------- Directory: 192px rail + feed ---------- */
.section-directory { padding-top: 40px; }
.pb-directory { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); gap: var(--gap); }
.pb-directory.has-top-filter { grid-template-columns: minmax(0, 1fr); }
.pb-directory > .pb-directory__feed:only-child { grid-column: 1 / -1; min-width: 0; }
.pb-directory__filter { align-self: start; position: sticky; top: 24px; }

.pb-filter { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.pb-filter__categories, .pb-filter__list { display: contents; }
.pb-filter__list { list-style: none; }
.filter-btn {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 10px; background: transparent; border: 0; border-radius: var(--radius);
    font-size: .93rem; font-weight: 500; color: var(--ink-2); text-align: left;
    transition: background .15s, color .15s;
}
.filter-btn:hover { background: var(--surface-2); color: var(--ink); }
.filter-btn.is-active { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.filter-btn__icon { display: inline-flex; flex: none; color: var(--tag-accent, var(--muted)); }
.filter-btn__icon svg { width: 16px; height: 16px; }
.filter-btn.is-active .filter-btn__icon { color: var(--tag-accent, var(--accent)); }
.filter-btn__name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-btn__count { flex: none; font-size: .78rem; font-variant-numeric: tabular-nums; color: var(--muted); }

.pb-directory.has-top-filter .pb-directory__filter { position: static; margin-bottom: 24px; }
.pb-directory.has-top-filter .pb-filter { flex-direction: row; flex-wrap: wrap; gap: 8px; }
.pb-directory.has-top-filter .filter-btn { width: auto; border: 1px solid var(--border); border-radius: var(--control-radius); padding: 7px 14px; }
.pb-directory.has-top-filter .filter-btn.is-active { border-color: var(--accent); color: var(--accent); background: transparent; }
.pb-directory.has-top-filter .filter-btn__icon { display: none; }

.feed-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; min-height: 36px; }
.feed-toolbar__status { margin: 0; font-size: .86rem; color: var(--muted); }
.view-toggle { display: inline-flex; gap: 2px; margin-left: auto; padding: 3px; background: var(--surface-2); border-radius: var(--radius); }
.view-toggle .icon-btn { width: 30px; height: 30px; }
.view-toggle .icon-btn[aria-pressed="true"] { background: var(--bg); color: var(--accent); }

/* ---------- Feed + cards ---------- */
.pb-feed { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); }
.pb-feed--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pb-feed__empty { margin: 32px 0; color: var(--muted); }

.pb-card {
    position: relative; display: flex; flex-direction: column;
    min-height: 0; padding: 20px; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    transition: border-color .18s, box-shadow .18s, transform .18s;
}
.pb-card:hover {
    border-color: var(--border-strong);
    box-shadow: 0 12px 30px rgba(24, 24, 27, .07);
    transform: translateY(-2px);
}
.pb-card[data-show="false"] { display: none; }
.pb-card__link { position: absolute; inset: 0; z-index: 1; }
.pb-card__content { position: relative; z-index: 2; pointer-events: none; display: flex; flex-direction: column; flex: 1; }
.pb-card__content a { pointer-events: auto; }

.pb-card__media { flex: none; margin: 0 0 10px; }
.pb-card__img { width: 48px; height: 48px; object-fit: cover; border-radius: var(--radius); }
.pb-card__media--fallback span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 48px; height: 48px; border-radius: var(--radius);
    background: var(--surface-2); color: var(--accent);
    font-family: var(--font-mono); font-size: .7rem; font-weight: 700;
    text-transform: uppercase; overflow: hidden;
}
.pb-card__title { font-size: 1.35rem; line-height: 1.25; margin-bottom: 8px; letter-spacing: -0.02em; }
.pb-card__excerpt { margin: 0; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.pb-card__tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 16px; }
.pb-card__featured { display: inline-flex; color: var(--accent); }
.pb-card__featured svg { width: 15px; height: 15px; }
.pb-card__locked { display: inline-flex; margin-left: auto; color: var(--muted); }
.pb-card__locked svg { width: 15px; height: 15px; }

.tag-pill {
    display: inline-flex; align-items: center; padding: 3px 9px;
    border-radius: var(--radius); background: var(--surface-2);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    font-family: var(--font-sans); font-size: .74rem; font-weight: 600;
    letter-spacing: .01em; color: var(--accent);
}
a.tag-pill:hover { background: var(--accent); color: var(--accent-ink); }

/* internal-tag chips: #level-advanced -> LEVEL advanced */
.pb-chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin-top: 12px; }
.pb-chip {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 8px; border-radius: var(--radius);
    border: 1px solid var(--border);
    font-family: var(--font-mono); font-size: .72rem; color: var(--ink-2);
}
.pb-chip b { font-weight: 500; font-size: .66rem; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }

/* list view */
.pb-feed.is-list { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.pb-feed.is-list .pb-card { min-height: 0; flex-direction: row; align-items: flex-start; gap: 20px; }
.pb-feed.is-list .pb-card__media { margin: 0; flex: none; }
.pb-feed.is-list .pb-card__title { font-size: 1.25rem; margin-bottom: 8px; }
.pb-feed.is-list .pb-card__excerpt { max-width: 86ch; }
.pb-feed.is-list .pb-card__tags { margin-top: 0; padding-top: 14px; }

/* ---------- Blog cards ---------- */
.post-card {
    position: relative; display: flex; flex-direction: column;
    border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    transition: border-color .15s;
}
.post-card:hover { border-color: var(--border-strong); }
.post-card__media { margin: 0; aspect-ratio: 16 / 9; background: var(--surface-2); }
.post-card__media img { width: 100%; height: 100%; object-fit: cover; }
.post-card__content { display: flex; flex-direction: column; gap: 10px; padding: 24px; flex: 1; }
.post-card__tag { font-size: .74rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--accent); }
.post-card__title { font-size: 1.2rem; letter-spacing: -0.02em; }
.post-card__excerpt { margin: 0; color: var(--muted); font-size: .92rem; }
.post-card__meta { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 12px; font-size: .8rem; color: var(--muted); }
.post-card__author { font-weight: 600; color: var(--ink-2); }

/* ---------- Post hero: full-bleed, 576px, left-aligned ---------- */
.post-hero {
    display: flex; flex-direction: column; justify-content: center;
    min-height: 576px; padding: 64px 16px;
    background: var(--hero-bg); background-size: cover; background-position: center;
    color: var(--hero-ink); text-align: left;
    position: relative;
}
.post-hero.has-img::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,.55), rgba(0,0,0,.75));
}
.post-hero.is-archive { min-height: 360px; }
.post-hero__content { position: relative; width: 100%; max-width: calc(var(--wrapper) - 32px); margin: 0 auto; }
.post-hero__eyebrow { display: block; margin-bottom: 12px; font-family: var(--font-sans); font-size: .76rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; opacity: .7; }
.post-hero__title { font-size: clamp(1.9rem, 3.6vw, 2.74rem); line-height: 1.28; letter-spacing: -0.025em; color: inherit; }
.post-hero__excerpt { margin-top: 16px; font-size: 1.02rem; opacity: .8; }
.post-hero__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-top: 24px; font-size: .86rem; opacity: .85; }
.post-hero__authors { display: flex; align-items: center; gap: 10px; }
.post-hero__byline { font-weight: 600; }
.post-hero__locked { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.post-hero__locked svg { width: 15px; height: 15px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.post-hero__authors .avatar + .avatar { margin-left: -16px; }
.author__avatar { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; margin-bottom: 16px; }
.post-hero .pb-chips { margin-top: 20px; }
.post-hero .pb-chip { border-color: rgba(255, 255, 255, .28); color: inherit; }
.post-hero .pb-chip b { color: inherit; opacity: .65; }

.breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; font-size: .84rem; opacity: .75; }
.breadcrumb a:hover { color: var(--accent); }

/* ---------- Post body: responsive homepage-width wrapper ---------- */
.gh-content {
    width: 100%; max-width: none; margin: 56px auto;
    font-size: 1.1rem; line-height: 1.6; color: var(--ink-2);
}
.gh-content > * + * { margin-top: 1.4em; }
.gh-content > :first-child { margin-top: 0; }
.gh-content p { margin: 0; line-height: 1.7; }
.gh-content a { color: var(--accent); text-decoration: none; }
.gh-content h2, .gh-content h3, .gh-content h4 { color: var(--ink); scroll-margin-top: 24px; }
.gh-content h2 { font-size: 2.03rem; line-height: 1.36; margin-top: 2em; letter-spacing: -0.025em; }
.gh-content h3 { font-size: 1.45rem; margin-top: 1.7em; }
.gh-content h4 { font-size: 1.15rem; margin-top: 1.5em; }
.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content ul { list-style: disc; }
.gh-content ol { list-style: decimal; }
.gh-content li + li { margin-top: .4em; }
.gh-content ol > li::marker { font-family: var(--font-mono); font-weight: 700; color: var(--accent); }
.gh-content blockquote { margin: 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--accent); color: var(--ink); font-size: 1.12rem; }
.gh-content hr { border: 0; border-top: 1px solid var(--border); margin: 2.6em 0; }
.gh-content img, .gh-content video { border-radius: var(--radius); }
.gh-content figcaption { margin-top: 10px; text-align: center; font-size: .84rem; color: var(--muted); }
.gh-content strong { color: var(--ink); }
.gh-content table { width: 100%; border-collapse: collapse; font-size: .94rem; }
.gh-content th, .gh-content td { padding: 10px 14px; border: 1px solid var(--border); text-align: left; }
.gh-content th { background: var(--surface-2); color: var(--ink); }
.gh-content li input[type="checkbox"] { margin-right: 8px; accent-color: var(--accent); }

.gh-content code { font-family: var(--font-mono); font-size: .86em; padding: .15em .4em; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink); }
.gh-content pre {
    position: relative; overflow-x: auto; padding: 18px 20px;
    border-radius: var(--radius); background: #16181d; color: #e6e9ef;
    font-family: var(--font-mono); font-size: .86rem; line-height: 1.6;
}
.gh-content pre code { padding: 0; background: none; border: 0; color: inherit; font-size: inherit; }
.code-copy {
    position: absolute; top: 10px; right: 10px; padding: 5px 9px;
    border-radius: 4px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16);
    color: #cfd6e4; font-family: var(--font-sans); font-size: .74rem; opacity: 0; transition: opacity .15s;
}
.gh-content pre:hover .code-copy, .code-copy:focus-visible { opacity: 1; }

.heading-anchor { margin-left: 8px; opacity: 0; color: var(--muted); display: inline-flex; vertical-align: middle; transition: opacity .15s; }
.heading-anchor svg { width: 16px; height: 16px; }
h2:hover .heading-anchor, h3:hover .heading-anchor, .heading-anchor:focus-visible { opacity: 1; }

/* inline TOC — stays inside the single column */
.toc { padding: 20px 24px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-sunken); }
.toc__title { display: block; margin-bottom: 10px; font-family: var(--font-sans); font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.toc__list { list-style: none; font-size: .94rem; }
.toc__list li + li { margin-top: 6px; }
.toc__list a { color: var(--ink-2); text-decoration: none; }
.toc__list a:hover { color: var(--accent); }
.toc__list a.is-active { color: var(--accent); font-weight: 600; }
.toc__list .toc-h3 { padding-left: 16px; font-size: .9rem; }

.post__tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 48px; }
.post__share { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); font-size: .88rem; color: var(--muted); }
.post__share a:hover { color: var(--accent); }

.post-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--gap); }
.post-nav__item { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius); transition: border-color .15s; }
.post-nav__item:hover { border-color: var(--border-strong); }
.post-nav__item--next { text-align: right; }
.post-nav__label { display: block; font-size: .76rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.post-nav__title { display: block; margin-top: 8px; font-family: var(--font-title); font-weight: 700; letter-spacing: -0.015em; color: var(--ink); }

/* ---------- Koenig cards ---------- */
.kg-card + .kg-card { margin-top: 1.4em; }
.kg-width-wide { width: min(100vw - 32px, 1000px); margin-left: 50%; transform: translateX(-50%); }
.kg-width-full { width: calc(100vw - 32px); margin-left: 50%; transform: translateX(-50%); }
.kg-image { margin-left: auto; margin-right: auto; }
.kg-embed-card, .kg-video-card, .kg-audio-card { display: flex; flex-direction: column; align-items: center; }
.kg-embed-card iframe { max-width: 100%; }

.kg-callout-card { display: flex; gap: 12px; padding: 18px 20px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); }
.kg-callout-card-accent { background: color-mix(in srgb, var(--accent) 10%, transparent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.kg-callout-emoji { line-height: 1.5; }
.kg-callout-text { flex: 1; }

.kg-toggle-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 20px; }
.kg-toggle-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
.kg-toggle-heading-text { font-family: var(--font-title); font-size: 1.05rem; font-weight: 700; margin: 14px 0; }
.kg-toggle-card-icon { width: 16px; height: 16px; transition: transform .2s; }
.kg-toggle-card[data-kg-toggle-state="close"] .kg-toggle-content { display: none; }
.kg-toggle-card[data-kg-toggle-state="open"] .kg-toggle-card-icon { transform: rotate(180deg); }
.kg-toggle-content { padding-bottom: 14px; }

.kg-bookmark-card a.kg-bookmark-container { display: flex; text-decoration: none; color: inherit; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.kg-bookmark-content { flex: 1; padding: 20px; min-width: 0; }
.kg-bookmark-title { font-family: var(--font-title); font-weight: 700; color: var(--ink); }
.kg-bookmark-description { margin-top: 6px; color: var(--muted); font-size: .9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kg-bookmark-metadata { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: .82rem; color: var(--muted); }
.kg-bookmark-icon { width: 18px; height: 18px; }
.kg-bookmark-thumbnail { flex: 0 0 34%; }
.kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; }

.kg-button-card { display: flex; }
.kg-button-card.kg-align-center { justify-content: center; }
.kg-btn { display: inline-flex; align-items: center; padding: 11px 22px; border-radius: var(--control-radius); font-family: var(--font-sans); font-weight: 600; text-decoration: none; }
.kg-btn-accent { background: var(--accent); color: var(--accent-ink); }

.kg-header-card { padding: 48px 32px; text-align: center; border-radius: var(--radius-lg); background: var(--bg-sunken); }
.kg-header-card-header { font-family: var(--font-title); font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; }
.kg-header-card-subheader { margin-top: 12px; color: var(--muted); }

.kg-product-card-container { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.kg-gallery-container { display: flex; flex-direction: column; gap: 10px; }
.kg-gallery-row { display: flex; gap: 10px; }
.kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }
.kg-blockquote-alt { font-style: italic; color: var(--muted); border: 0; padding-left: 0; text-align: center; }
.kg-nft-card, .kg-file-card { border: 1px solid var(--border); border-radius: var(--radius); }
.kg-file-card-container { display: flex; align-items: center; gap: 16px; padding: 16px 20px; text-decoration: none; color: inherit; }
.kg-file-card-title { font-weight: 700; color: var(--ink); }
.kg-file-card-caption { color: var(--muted); font-size: .88rem; }

html.dark-mode .hero:not(.has-img),
html.dark-mode .post-hero:not(.has-img) { border: 1px solid var(--border); }
html.dark-mode .hero:not(.has-img),
html.dark-mode .post-hero:not(.has-img) { border-inline: 0; border-top: 0; }

/* ---------- Footer: Source-inspired social row + three-part bar ---------- */
.footer { margin-top: 72px; color: var(--ink); }
.footer__social {
    display: flex; align-items: center; justify-content: center; gap: 20px;
    margin-bottom: 20px;
}
.footer__social a { color: var(--ink); transition: color .15s, opacity .15s; }
.footer__social a:hover { color: var(--accent); opacity: .8; }
.footer__social svg { width: 20px; height: 20px; }

.footer__bar {
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
    padding: 20px 0; border-top: 1px solid var(--border);
    font-size: .92rem; font-weight: 600;
}
.footer__menu { grid-column: 2; min-width: 0; }
.footer__menu ul {
    display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
    gap: 8px 28px; margin: 0; padding: 0; list-style: none;
}
.footer__menu a:hover { color: var(--accent); }
.footer__copyright { grid-column: 1; grid-row: 1; justify-self: start; margin: 0; color: var(--muted); font-size: .84rem; font-weight: 400; }
.footer__note { margin: 16px 0 32px; text-align: center; font-size: .86rem; color: var(--muted); }
.footer__bar:last-child { margin-bottom: 32px; }

/* ---------- Pagination / error ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 40px; }
.pagination-count { font-size: .86rem; color: var(--muted); }

.error { padding: 120px 0; text-align: center; }
.error__code { margin: 0; font-family: var(--font-mono); font-size: 3.4rem; font-weight: 700; color: var(--accent); }
.error__title { margin-top: 8px; font-size: 2rem; letter-spacing: -0.03em; }
.error__text { margin: 14px auto 28px; max-width: 46ch; color: var(--muted); }
.error__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.error__details { list-style: none; margin-top: 24px; font-size: .86rem; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .pb-directory { grid-template-columns: minmax(0, 1fr); }
    .pb-directory:not(.has-top-filter) .pb-directory__filter {
        position: relative; z-index: 30; width: min(100%, 240px); margin-bottom: 8px;
    }
    .pb-directory:not(.has-top-filter) .pb-filter { display: block; position: relative; }
    .pb-directory:not(.has-top-filter) .pb-filter__trigger .filter-btn {
        width: 100%; border: 1px solid var(--border); border-radius: var(--control-radius); padding: 9px 12px;
        background: var(--surface);
    }
    .pb-directory:not(.has-top-filter) .pb-filter__trigger .filter-btn:hover,
    .pb-directory:not(.has-top-filter) .pb-filter__trigger .filter-btn.is-active {
        border-color: var(--accent); color: var(--ink); background: var(--surface);
    }
    .pb-directory:not(.has-top-filter) .pb-filter__categories {
        display: none; position: absolute; top: calc(100% + 6px); left: 0; z-index: 40;
        width: 100%; padding: 6px;
        background: var(--surface); border: 1px solid var(--border); border-radius: var(--control-radius);
        box-shadow: 0 16px 36px rgba(24, 24, 27, .12);
    }
    .pb-directory:not(.has-top-filter) .pb-filter__categories::before {
        content: ""; position: absolute; right: 0; bottom: 100%; left: 0; height: 7px;
    }
    .pb-directory:not(.has-top-filter) .pb-filter:hover .pb-filter__categories,
    .pb-directory:not(.has-top-filter) .pb-filter:focus-within .pb-filter__categories,
    .pb-directory:not(.has-top-filter) .pb-filter.is-open .pb-filter__categories { display: block; }
    .pb-directory:not(.has-top-filter) .pb-filter__list {
        display: flex; flex-direction: column; gap: 2px; max-height: min(60vh, 440px); overflow-y: auto;
    }
    .pb-directory:not(.has-top-filter) .pb-filter__list .filter-btn { width: 100%; padding: 8px 10px; }
    .pb-directory:not(.has-top-filter) .filter-btn__icon { display: inline-flex; }
    .pb-feed, .pb-feed--3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
    .header__menu { display: none; }
    .menu-btn { display: inline-flex; }
    .hero { min-height: 520px; }
    .post-hero { min-height: 460px; }
    .kg-width-wide, .kg-width-full { width: 100%; margin-left: 0; transform: none; }
}
@media (max-width: 680px) {
    .hero { min-height: 440px; padding: 48px 16px; }
    .post-hero { min-height: 400px; padding: 48px 16px; }
    .gh-content { margin: 40px auto; font-size: 1.05rem; }
    .pb-feed, .pb-feed--3 { grid-template-columns: minmax(0, 1fr); }
    .pb-feed.is-list .pb-card { flex-direction: column; gap: 0; }
    .pb-feed.is-list .pb-card__media { margin-bottom: 16px; }
    .footer { margin-top: 48px; }
    .footer__bar { padding: 18px 0; }
    .footer__bar:last-child { margin-bottom: 24px; }
    .footer__menu ul { gap: 8px 18px; }
    .scheme-toggle:not(.scheme-toggle--footer) { display: none; }
    .section { padding: 32px 0; }
    .subscribe-form.is-joined { flex-wrap: nowrap; }
}

@media print {
    .header, .footer, .post-nav, .pagination, .post__share, .toc { display: none !important; }
    .hero, .post-hero { min-height: auto; padding: 0; background: none; color: #000; }
    .hero.has-img::before, .post-hero.has-img::before { display: none; }
}
