/* ==========================================================================
   Jad Log — a newspaper-inspired Ghost theme
   Paper stock, letterpress rules, editorial type. Version 2.0.0
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Design tokens
   -------------------------------------------------------------------------- */

:root {
    /* Paper stock */
    --bg: #faf8f5;
    --bg-subtle: #f5f0e8;
    --bg-muted: #efe8dc;
    --surface: #fffdf9;

    /* Ink */
    --text: #2d2d2d;
    --text-muted: #57514a;
    --text-faint: #8a8172;

    /* Rules & hairlines */
    --rule: #ddd3c2;
    --rule-strong: #2d2d2d;
    --border: #e5ddcd;
    --border-strong: #cdc2ac;

    /* Accents */
    --accent: #8b2500;
    --accent-hover: #a52e05;
    --accent-contrast: #fffdf9;
    --accent-soft: #f7ece7;
    --sepia: #8b7355;

    --code-bg: #f2ede2;
    --code-border: #ded4c0;

    --shadow-sm: 0 1px 2px rgba(45, 45, 45, 0.05);
    --shadow-md: 0 8px 26px rgba(74, 62, 45, 0.1);

    --radius-sm: 3px;
    --radius: 4px;
    --radius-lg: 6px;
    --radius-pill: 999px;

    /* Type */
    --font-display: var(--gh-font-heading, "Playfair Display", "Iowan Old Style", Georgia, "Times New Roman", serif);
    --font-body: var(--gh-font-body, "Lora", Georgia, "Times New Roman", serif);
    --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

    --wrap: 1180px;
    --content-width: 720px;
    --header-h: 62px;

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* Lamp-lit newsprint, for night readers. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #1a1815;
        --bg-subtle: #201d19;
        --bg-muted: #262221;
        --surface: #201e1a;

        --text: #ece7dd;
        --text-muted: #b6ae9f;
        --text-faint: #8b8375;

        --rule: #3a342b;
        --rule-strong: #d8d2c6;
        --border: #332e27;
        --border-strong: #4a4337;

        --accent: #e0855f;
        --accent-hover: #eda07c;
        --accent-contrast: #1a1815;
        --accent-soft: #2b1f18;
        --sepia: #c2a685;

        --code-bg: #221f1a;
        --code-border: #383227;

        --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
        --shadow-md: 0 8px 26px rgba(0, 0, 0, 0.5);
    }
}

html[data-theme="dark"] {
    --bg: #1a1815;
    --bg-subtle: #201d19;
    --bg-muted: #262221;
    --surface: #201e1a;

    --text: #ece7dd;
    --text-muted: #b6ae9f;
    --text-faint: #8b8375;

    --rule: #3a342b;
    --rule-strong: #d8d2c6;
    --border: #332e27;
    --border-strong: #4a4337;

    --accent: #e0855f;
    --accent-hover: #eda07c;
    --accent-contrast: #1a1815;
    --accent-soft: #2b1f18;
    --sepia: #c2a685;

    --code-bg: #221f1a;
    --code-border: #383227;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 26px rgba(0, 0, 0, 0.5);
}

html[data-theme="light"] { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

/* --------------------------------------------------------------------------
   2. Reset & base
   -------------------------------------------------------------------------- */

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

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 17.5px;
    line-height: 1.7;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
    overflow-wrap: break-word;
}

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

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

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.012em;
    line-height: 1.14;
    color: var(--text);
    text-wrap: balance;
}

p { margin: 0; }

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

input { font: inherit; }

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

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

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

.u-sr-only {
    position: absolute !important;
    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;
    top: -100px;
    left: 16px;
    z-index: 200;
    padding: 10px 18px;
    background: var(--accent);
    color: var(--accent-contrast);
    border-radius: var(--radius);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    transition: top 0.18s var(--ease);
}

.skip-link:focus { top: 14px; }

/* Shared small-caps agate type. */
.post-card-kicker,
.post-tag,
.newsletter-eyebrow,
.archive-eyebrow,
.page-eyebrow,
.post-tags-label,
.author-box-label,
.footer-col-title,
.feed-divider-label,
.masthead-dateline,
.section-title {
    font-family: var(--font-ui);
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 0.7rem;
    line-height: 1.4;
}

/* --------------------------------------------------------------------------
   3. Buttons
   -------------------------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
    transition: background-color 0.18s var(--ease), color 0.18s var(--ease),
        border-color 0.18s var(--ease);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.74rem;
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-contrast);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-ghost:hover {
    border-color: var(--text);
    background: var(--bg-subtle);
}

/* --------------------------------------------------------------------------
   4. Header / navigation
   -------------------------------------------------------------------------- */

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

@supports not (backdrop-filter: blur(1px)) {
    .site-header { background: var(--bg); }
}

.site-header-inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 28px;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 20px;
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.site-brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 2px;
    background: var(--accent);
    color: var(--accent-contrast);
    flex: 0 0 auto;
}

.site-logo {
    max-height: 32px;
    width: auto;
}

.site-title {
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.site-nav {
    flex: 1 1 auto;
    display: flex;
    justify-content: flex-start;
}

.site-nav .nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.site-nav .nav li { margin: 0; }

.site-nav .nav a {
    display: inline-block;
    padding: 6px 12px;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid transparent;
    transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.site-nav .nav a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.site-nav .nav .nav-current > a {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.site-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--text-muted);
    transition: color 0.16s var(--ease), border-color 0.16s var(--ease);
}

.theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--text);
    order: 3;
}

.nav-toggle-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 15px;
}

.nav-toggle-bars span {
    display: block;
    height: 1.5px;
    width: 100%;
    background: currentColor;
    transition: transform 0.2s var(--ease), opacity 0.2s var(--ease);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(1) {
    transform: translateY(5.5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars span:nth-child(3) {
    transform: translateY(-5.5px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   5. Masthead (front page)
   -------------------------------------------------------------------------- */

.masthead {
    background: var(--bg);
    border-top: 4px solid var(--rule-strong);
    padding: 34px 28px 0;
    text-align: center;
}

.masthead-inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding-bottom: 26px;
}

/* The classic double rule closing the nameplate. */
.masthead::after {
    content: "";
    display: block;
    max-width: var(--wrap);
    margin: 0 auto;
    height: 2px;
    border-top: 1px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule-strong);
}

.masthead-dateline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    color: var(--text-faint);
    letter-spacing: 0.22em;
}

.masthead-dateline::before,
.masthead-dateline::after {
    content: "";
    width: 48px;
    height: 0;
    border-top: 1px solid var(--rule);
}

.masthead-title {
    margin: 20px 0 14px;
    font-size: clamp(2.7rem, 7.6vw, 5.4rem);
    font-weight: 800;
    letter-spacing: -0.018em;
    line-height: 0.98;
}

.masthead-tagline {
    max-width: 58ch;
    margin: 0 auto;
    font-size: 1.04rem;
    font-style: italic;
    line-height: 1.6;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   6. Feed wrappers & dividers
   -------------------------------------------------------------------------- */

.feed-wrap {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 52px 28px 88px;
}

.section-head {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 34px;
}

.section-head::after {
    content: "";
    flex: 1 1 auto;
    height: 0;
    border-top: 1px solid var(--rule);
}

.section-heading {
    font-size: 1.4rem;
    margin-bottom: 28px;
}

.feed-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 10px 0 6px;
}

.feed-divider-rule {
    flex: 1 1 auto;
    height: 0;
    border-top: 1px solid var(--rule);
}

.feed-divider-label {
    color: var(--text-faint);
    letter-spacing: 0.24em;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   7. Post grid & cards
   -------------------------------------------------------------------------- */

.post-feed {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 44px 40px;
}

.post-feed--related {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px 28px;
}

.post-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-bottom: 24px;
    border-bottom: 1px dotted var(--border-strong);
}

.post-card-media {
    display: block;
    overflow: hidden;
    background: var(--bg-muted);
    aspect-ratio: 3 / 2;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.post-card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Faint newsprint warmth; the original plate returns on hover. */
    filter: sepia(0.22) saturate(0.92) contrast(1.02);
    transition: transform 0.6s var(--ease), filter 0.4s var(--ease);
}

.post-card:hover .post-card-image {
    transform: scale(1.028);
    filter: sepia(0) saturate(1) contrast(1);
}

.post-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.post-card-kicker {
    position: relative;
    z-index: 2;
    align-self: flex-start;
    color: var(--accent);
    letter-spacing: 0.16em;
    transition: color 0.16s var(--ease);
}

.post-card-kicker:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-card-title {
    font-size: 1.42rem;
    font-weight: 700;
    letter-spacing: -0.014em;
    line-height: 1.16;
}

.post-card-link {
    color: var(--text);
    background-image: linear-gradient(var(--accent), var(--accent));
    background-size: 0% 1px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: background-size 0.3s var(--ease), color 0.2s var(--ease);
}

.post-card:hover .post-card-link {
    color: var(--accent);
    background-size: 100% 1px;
}

/* Stretched click target across the whole card. */
.post-card-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.post-card-excerpt {
    font-size: 0.94rem;
    line-height: 1.62;
    color: var(--text-muted);
}

.post-card-meta {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: auto;
    padding-top: 4px;
    font-family: var(--font-ui);
    font-size: 0.73rem;
    color: var(--text-faint);
}

.post-card-author {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--text-muted);
    transition: color 0.16s var(--ease);
}

.post-card-author:hover { color: var(--accent); }

.post-card-by {
    font-style: italic;
    color: var(--text-faint);
}

.post-card-author-name {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 0.82rem;
    font-weight: 500;
}

.meta-dot { color: var(--border-strong); }

/* --- The lead story ------------------------------------------------------- */

.post-feed--led > .post-card:first-child {
    grid-column: 1 / -1;
    gap: 26px;
    padding-bottom: 0;
    border-bottom: 0;
}

.post-feed--led > .post-card:first-child .post-card-media {
    aspect-ratio: 21 / 9;
}

.post-feed--led > .post-card:first-child .post-card-image {
    filter: sepia(0.16) saturate(0.95) contrast(1.02);
}

.post-feed--led > .post-card:first-child .post-card-title {
    font-size: clamp(2.1rem, 5vw, 3.35rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.05;
    max-width: 24ch;
}

.post-feed--led > .post-card:first-child .post-card-excerpt {
    font-size: 1.14rem;
    line-height: 1.62;
    max-width: 62ch;
}

.post-feed--led > .post-card:first-child .post-card-kicker {
    font-size: 0.74rem;
}

.post-feed--led > .post-card:first-child .post-card-meta {
    padding-top: 6px;
}

.post-feed--led > .post-card:first-child .avatar-sm {
    width: 32px;
    height: 32px;
}

/* --------------------------------------------------------------------------
   8. Avatars
   -------------------------------------------------------------------------- */

.avatar {
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-muted);
    border: 1px solid var(--border);
    flex: 0 0 auto;
    /* A warm, hand-toned print quality. */
    filter: sepia(0.35) saturate(0.85) contrast(1.02);
}

.avatar-sm { width: 24px; height: 24px; }
.avatar-md { width: 48px; height: 48px; }
.avatar-lg { width: 78px; height: 78px; }
.avatar-xl { width: 100px; height: 100px; }

/* --------------------------------------------------------------------------
   9. Pagination
   -------------------------------------------------------------------------- */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 60px;
    padding-top: 36px;
    border-top: 1px solid var(--rule);
}

.pagination a,
.pagination .page-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.16s var(--ease);
    font-variant-numeric: tabular-nums;
}

.pagination a:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.pagination .page-number.current,
.pagination .page-number.active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-contrast);
}

/* --------------------------------------------------------------------------
   10. Single post
   -------------------------------------------------------------------------- */

.post-header {
    padding: 60px 0 0;
}

.post-header-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 28px;
}

.post-tag {
    display: inline-block;
    margin-bottom: 20px;
    color: var(--accent);
    letter-spacing: 0.16em;
    transition: color 0.16s var(--ease);
}

.post-tag:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-title {
    font-size: clamp(2.1rem, 5.4vw, 3.4rem);
    font-weight: 800;
    letter-spacing: -0.022em;
    line-height: 1.06;
}

.post-subtitle {
    margin-top: 22px;
    font-size: clamp(1.1rem, 1.8vw, 1.3rem);
    font-style: italic;
    line-height: 1.6;
    color: var(--text-muted);
}

.post-byline {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-top: 34px;
    padding: 20px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.byline-avatar-link { flex: 0 0 auto; }

.byline-text {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.byline-author-line {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
}

.byline-by {
    font-style: italic;
    color: var(--text-faint);
    font-size: 0.92rem;
}

.byline-name {
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1rem;
    font-weight: 600;
    transition: color 0.16s var(--ease);
}

.byline-name:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.byline-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    font-family: var(--font-ui);
    font-size: 0.73rem;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

.post-feature {
    max-width: 1040px;
    margin: 40px auto 0;
    padding: 0 28px;
}

.post-feature-image {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.post-feature figcaption {
    margin-top: 12px;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    color: var(--text-faint);
    text-align: center;
}

/* --------------------------------------------------------------------------
   11. Article copy (.gh-content)
   -------------------------------------------------------------------------- */

.post-content {
    max-width: var(--content-width);
    margin: 44px auto 0;
    padding: 0 28px;
    font-size: 1.13rem;
    line-height: 1.8;
    color: var(--text);
}

.post-content > * + * {
    margin-top: 1.5em;
}

.post-content h2 {
    margin-top: 2.1em;
    font-size: 1.85rem;
    font-weight: 700;
    letter-spacing: -0.016em;
    line-height: 1.2;
}

.post-content h3 {
    margin-top: 1.85em;
    font-size: 1.4rem;
    font-weight: 700;
}

.post-content h4 {
    margin-top: 1.7em;
    font-size: 1.12rem;
    font-weight: 700;
}

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

/* Editorial drop cap on the opening paragraph. */
.post-content > p:first-of-type::first-letter {
    float: left;
    margin: 0.06em 0.1em 0 0;
    padding: 0;
    font-family: var(--font-display);
    font-size: 3.9em;
    font-weight: 700;
    line-height: 0.78;
    color: var(--accent);
}

.post-content a {
    color: var(--text);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    text-decoration-color: var(--accent);
    transition: color 0.16s var(--ease), background-color 0.16s var(--ease);
}

.post-content a:hover {
    color: var(--accent);
    background: var(--accent-soft);
}

.post-content strong { font-weight: 600; }

.post-content ul,
.post-content ol {
    padding-left: 1.35em;
    margin-top: 1.5em;
}

.post-content li { margin-top: 0.5em; }

.post-content li::marker {
    color: var(--accent);
    font-weight: 600;
}

.post-content blockquote {
    margin: 2em 0;
    padding: 6px 0 6px 26px;
    border-left: 2px solid var(--accent);
    font-size: 1.2rem;
    font-style: italic;
    line-height: 1.6;
    color: var(--text-muted);
}

.post-content blockquote p + p { margin-top: 0.9em; }

.post-content img {
    margin: 2em auto;
    border-radius: var(--radius);
}

.post-content figure { margin: 2.2em 0; }
.post-content figure img { margin: 0 auto; }

.post-content figcaption {
    margin-top: 12px;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    line-height: 1.5;
    color: var(--text-faint);
    text-align: center;
}

.post-content hr {
    margin: 2.6em 0;
    border-top: 1px dotted var(--border-strong);
}

/* Wide and full-bleed media, per the editor's width options. */
.post-content .kg-width-wide {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: min(1040px, calc(100vw - 48px));
    max-width: none;
}

.post-content .kg-width-full {
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    max-width: none;
}

.post-content .kg-width-full img {
    width: 100%;
    border-radius: 0;
}

/* Ghost cards */
.post-content .kg-card { margin: 2.2em 0; }

.post-content .kg-image-card img,
.post-content .kg-gallery-container,
.post-content .kg-embed-card iframe {
    width: 100%;
}

.post-content .kg-bookmark-card {
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--surface);
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.post-content .kg-bookmark-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}

.post-content .kg-bookmark-container {
    display: flex;
    gap: 18px;
    padding: 18px;
    text-decoration: none;
    color: inherit;
    background: none;
}

.post-content .kg-bookmark-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--text);
}

.post-content .kg-bookmark-description {
    margin-top: 6px;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-content .kg-bookmark-metadata {
    margin-top: 12px;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    color: var(--text-faint);
    display: flex;
    align-items: center;
    gap: 8px;
}

.post-content .kg-bookmark-icon {
    width: 18px;
    height: 18px;
    margin: 0;
}

.post-content .kg-bookmark-thumbnail img {
    width: 150px;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: var(--radius-sm);
}

.post-content .kg-callout-card {
    display: flex;
    gap: 16px;
    padding: 20px 22px;
    border: 1px solid var(--border-strong);
    border-left: 3px solid var(--accent);
    border-radius: var(--radius);
    background: var(--bg-subtle);
}

.post-content .kg-callout-emoji {
    font-size: 1.25rem;
    line-height: 1.5;
}

/* --------------------------------------------------------------------------
   12. Code
   -------------------------------------------------------------------------- */

.post-content code {
    font-family: var(--font-mono);
    font-size: 0.83em;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 2px;
    padding: 0.13em 0.4em;
    color: var(--text);
    white-space: break-spaces;
}

.post-content pre {
    position: relative;
    margin: 2em -8px;
    padding: 22px 24px;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-left: 3px solid var(--sepia);
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 0.86rem;
    line-height: 1.68;
    -webkit-overflow-scrolling: touch;
}

.post-content pre code {
    background: none;
    border: 0;
    padding: 0;
    font-size: inherit;
    white-space: pre;
    color: inherit;
}

.copy-code-btn {
    position: absolute;
    top: 9px;
    right: 9px;
    padding: 5px 11px;
    font-family: var(--font-ui);
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--code-border);
    border-radius: var(--radius);
    opacity: 0;
    transition: opacity 0.18s var(--ease), color 0.18s var(--ease),
        border-color 0.18s var(--ease);
}

.post-content pre:hover .copy-code-btn,
.copy-code-btn:focus-visible {
    opacity: 1;
}

.copy-code-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
}

.copy-code-btn.is-copied { color: var(--accent); }

/* --------------------------------------------------------------------------
   13. Post footer — tags & author box
   -------------------------------------------------------------------------- */

.post-footer {
    max-width: var(--content-width);
    margin: 56px auto 0;
    padding: 0 28px;
}

.post-tags {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 12px;
    padding: 24px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.post-tags-label { color: var(--text-faint); }

.post-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-pill {
    display: inline-block;
    padding: 5px 13px;
    font-family: var(--font-ui);
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: all 0.16s var(--ease);
}

.tag-pill:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
}

.author-box {
    display: flex;
    gap: 22px;
    margin-top: 32px;
    padding: 26px;
    border: 1px solid var(--border-strong);
    border-top: 3px solid var(--rule-strong);
    border-radius: var(--radius);
    background: var(--bg-subtle);
}

.author-box-avatar-link { flex: 0 0 auto; }

.author-box-body { min-width: 0; }

.author-box-label { color: var(--text-faint); }

.author-box-name {
    margin-top: 7px;
    font-size: 1.2rem;
    font-weight: 700;
}

.author-box-name a:hover { color: var(--accent); }

.author-box-bio {
    margin-top: 10px;
    font-size: 0.96rem;
    line-height: 1.65;
    color: var(--text-muted);
}

.author-box-links {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin-top: 14px;
    font-family: var(--font-ui);
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.author-box-links a {
    color: var(--accent);
    border-bottom: 1px solid transparent;
    transition: border-color 0.16s var(--ease);
}

.author-box-links a:hover { border-bottom-color: var(--accent); }

.author-box-location { color: var(--text-faint); }

/* --------------------------------------------------------------------------
   14. Newsletter — the subscription coupon
   -------------------------------------------------------------------------- */

.newsletter {
    margin: 84px auto 0;
    max-width: var(--wrap);
    padding: 0 28px;
}

.newsletter-inner { width: 100%; }

.newsletter-box {
    padding: 48px 56px 52px;
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    background: var(--bg-subtle);
    text-align: center;
    position: relative;
}

/* Double rule framing, like a coupon in the classifieds. */
.newsletter-box::after {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid var(--rule);
    border-radius: 2px;
    pointer-events: none;
}

.newsletter-eyebrow {
    display: block;
    color: var(--accent);
    letter-spacing: 0.24em;
    margin-bottom: 16px;
}

.newsletter-heading {
    max-width: 26ch;
    margin: 0 auto;
    font-size: clamp(1.75rem, 3.6vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.018em;
    line-height: 1.12;
}

.newsletter-ornament {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin: 20px 0 18px;
}

.newsletter-ornament::before,
.newsletter-ornament::after {
    content: "";
    width: 56px;
    height: 0;
    border-top: 1px solid var(--rule);
}

.newsletter-ornament span {
    font-size: 0.55rem;
    color: var(--sepia);
    letter-spacing: 0.4em;
}

.newsletter-subheading {
    max-width: 54ch;
    margin: 0 auto;
    font-size: 1rem;
    font-style: italic;
    line-height: 1.65;
    color: var(--text-muted);
}

.newsletter-form-wrap {
    max-width: 520px;
    margin: 32px auto 0;
}

.newsletter-form { width: 100%; }

.newsletter-field {
    display: flex;
    gap: 0;
    padding: 0;
    background: var(--surface);
    border: 1px solid var(--rule-strong);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.newsletter-field:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.newsletter-input {
    flex: 1 1 auto;
    min-width: 0;
    padding: 14px 18px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.98rem;
    outline: none;
}

.newsletter-input::placeholder {
    font-style: italic;
    color: var(--text-faint);
}

.newsletter-button {
    flex: 0 0 auto;
    padding: 14px 26px;
    border: 0;
    border-left: 1px solid var(--rule-strong);
    background: var(--accent);
    color: var(--accent-contrast);
    font-family: var(--font-ui);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    transition: background-color 0.18s var(--ease);
}

.newsletter-button:hover { background: var(--accent-hover); }

.newsletter-button[disabled] {
    opacity: 0.6;
    cursor: progress;
}

.newsletter-note {
    margin-top: 14px;
    font-family: var(--font-ui);
    font-size: 0.74rem;
    letter-spacing: 0.02em;
    color: var(--text-faint);
    text-align: center;
}

.newsletter-status {
    display: none;
    margin-top: 14px;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    color: #a83232;
    text-align: center;
}

.newsletter-status:not(:empty) { display: block; }
.newsletter-status--success { color: var(--accent); }

/* Ghost's members.js drives these states. */
.newsletter-form .newsletter-status--success { display: none; }
.newsletter-form.success .newsletter-field,
.newsletter-form.success .newsletter-note { display: none; }
.newsletter-form.success .newsletter-status--success { display: block; }
.newsletter-form.error .newsletter-field { border-color: #a83232; }

.newsletter-member {
    padding: 22px 26px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
}

.newsletter-member-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
}

.newsletter-member-email {
    margin-top: 5px;
    font-size: 0.88rem;
    color: var(--text-faint);
    word-break: break-all;
}

.newsletter-member-link {
    display: inline-block;
    margin-top: 12px;
    font-family: var(--font-ui);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--accent);
}

.newsletter-member-link:hover { color: var(--accent-hover); }

/* --------------------------------------------------------------------------
   15. Related
   -------------------------------------------------------------------------- */

.related {
    margin-top: 84px;
    padding: 56px 0 84px;
    border-top: 3px solid var(--rule-strong);
    background: var(--bg-subtle);
}

.related-inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 0 28px;
}

.related .post-card { border-bottom: 0; padding-bottom: 0; }

/* --------------------------------------------------------------------------
   16. Archive, error & empty states
   -------------------------------------------------------------------------- */

.archive-header {
    padding: 62px 0 48px;
    border-top: 4px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule);
    background: var(--bg-subtle);
    text-align: center;
}

.archive-header-inner {
    max-width: var(--content-width);
    margin: 0 auto;
    padding: 0 28px;
}

.archive-header--author .avatar-xl {
    margin: 0 auto 22px;
}

.archive-eyebrow {
    display: block;
    color: var(--accent);
    letter-spacing: 0.24em;
    margin-bottom: 16px;
}

.archive-title {
    font-size: clamp(2.1rem, 4.8vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.02em;
}

.archive-description {
    margin-top: 16px;
    font-size: 1.04rem;
    font-style: italic;
    line-height: 1.65;
    color: var(--text-muted);
}

.archive-meta {
    margin-top: 18px;
    font-family: var(--font-ui);
    font-size: 0.74rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-faint);
    font-variant-numeric: tabular-nums;
}

.error-page {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 28px;
}

.error-inner {
    max-width: 600px;
    text-align: center;
    border-top: 4px solid var(--rule-strong);
    border-bottom: 1px solid var(--rule);
    padding: 48px 0;
}

.error-code {
    font-family: var(--font-display);
    font-size: clamp(4rem, 13vw, 7rem);
    font-weight: 800;
    line-height: 1;
    color: var(--accent);
}

.error-title {
    margin-top: 14px;
    font-size: clamp(1.55rem, 3.4vw, 2.15rem);
    font-weight: 700;
}

.error-text {
    margin-top: 14px;
    font-style: italic;
    color: var(--text-muted);
}

.error-inner .hero-actions { justify-content: center; }

.empty-state {
    padding: 70px 0;
    text-align: center;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}

.empty-state-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
}

.empty-state-text {
    margin-top: 8px;
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.96rem;
}

/* --------------------------------------------------------------------------
   17. Footer — the colophon
   -------------------------------------------------------------------------- */

.site-footer {
    border-top: 3px solid var(--rule-strong);
    background: var(--bg-subtle);
}

.site-footer-inner {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 52px 28px 40px;
    display: grid;
    grid-template-columns: 1.1fr 1.7fr;
    gap: 56px;
}

.footer-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
}

.footer-tagline {
    margin-top: 12px;
    max-width: 38ch;
    font-size: 0.95rem;
    font-style: italic;
    line-height: 1.62;
    color: var(--text-muted);
}

.footer-cols {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 32px;
}

.footer-col-title {
    color: var(--text-faint);
    letter-spacing: 0.2em;
    margin-bottom: 16px;
}

.footer-list,
.footer-nav .nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.footer-nav .nav { margin-bottom: 9px; }

.footer-list a,
.footer-nav .nav a {
    font-family: var(--font-ui);
    font-size: 0.82rem;
    color: var(--text-muted);
    transition: color 0.16s var(--ease);
}

.footer-list a:hover,
.footer-nav .nav a:hover { color: var(--accent); }

.footer-note {
    max-width: 30ch;
    margin-bottom: 16px;
    font-size: 0.9rem;
    font-style: italic;
    line-height: 1.6;
    color: var(--text-muted);
}

.site-footer-bottom {
    max-width: var(--wrap);
    margin: 0 auto;
    padding: 20px 28px 34px;
    border-top: 1px solid var(--rule);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    font-family: var(--font-ui);
    font-size: 0.74rem;
    color: var(--text-faint);
}

.footer-credit a {
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-strong);
}

.footer-credit a:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Ghost's default portal button clashes with the nameplate nav. */
.gh-portal-triggerbtn-container { display: none !important; }

/* --------------------------------------------------------------------------
   18. Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
    .site-footer-inner {
        grid-template-columns: 1fr;
        gap: 40px;
    }
}

@media (max-width: 900px) {
    .post-feed,
    .post-feed--related {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 36px 28px;
    }

    .newsletter-box { padding: 40px 32px 44px; }

    .masthead { padding: 28px 20px 0; }
}

@media (max-width: 860px) {
    .site-header-inner {
        padding: 0 20px;
        gap: 12px;
    }

    .nav-toggle { display: inline-flex; }

    .site-nav {
        position: fixed;
        top: var(--header-h);
        left: 0;
        right: 0;
        display: block;
        padding: 10px 20px 18px;
        background: var(--bg);
        border-bottom: 1px solid var(--rule-strong);
        box-shadow: var(--shadow-md);
        transform: translateY(-12px);
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
    }

    .site-nav.is-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }

    .site-nav .nav {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }

    .site-nav .nav a {
        display: block;
        padding: 12px 4px;
        border-bottom: 1px dotted var(--border-strong);
    }

    .site-cta { display: none; }

    .feed-wrap,
    .related-inner,
    .newsletter,
    .post-content,
    .post-header-inner,
    .post-footer,
    .post-feature,
    .archive-header-inner,
    .site-footer-inner,
    .site-footer-bottom {
        padding-left: 20px;
        padding-right: 20px;
    }

    .post-header { padding-top: 42px; }
    .author-box { flex-direction: column; gap: 18px; }
    .footer-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }

    .post-feed--led > .post-card:first-child .post-card-title {
        max-width: none;
    }
}

@media (max-width: 640px) {
    body { font-size: 16.5px; }

    .post-feed,
    .post-feed--related {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .post-content {
        font-size: 1.06rem;
        line-height: 1.74;
    }

    .masthead-title { margin: 16px 0 12px; }
    .masthead-dateline::before,
    .masthead-dateline::after { width: 22px; }

    .newsletter-box {
        padding: 32px 22px 36px;
    }

    .newsletter-box::after { inset: 4px; }

    .newsletter-field {
        flex-direction: column;
    }

    .newsletter-input {
        padding: 13px 16px;
        text-align: center;
    }

    .newsletter-button {
        width: 100%;
        padding: 14px 20px;
        border-left: 0;
        border-top: 1px solid var(--rule-strong);
    }

    .footer-cols { grid-template-columns: 1fr; gap: 28px; }

    .site-footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .post-content pre {
        margin-left: -12px;
        margin-right: -12px;
        border-radius: var(--radius-sm);
        font-size: 0.8rem;
    }

    .post-content > p:first-of-type::first-letter {
        font-size: 3.3em;
    }

    .error-page { padding: 80px 20px; }
}

/* --------------------------------------------------------------------------
   19. Motion & print
   -------------------------------------------------------------------------- */

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

@media print {
    .site-header,
    .site-footer,
    .newsletter,
    .related,
    .post-footer,
    .skip-link,
    .theme-toggle,
    .nav-toggle,
    .copy-code-btn {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
        font-size: 11.5pt;
    }

    .post-content {
        max-width: none;
        padding: 0;
        font-size: 11pt;
    }

    a { text-decoration: underline; }
}
