/* Typewriter — a Ghost theme
   Black and white, Courier Prime, light paper-grain background. */

:root {
    --ink: #111111;
    --ink-soft: #333333;
    --paper: #efeeea;
    --paper-dark: #e3e2dd;
    --placeholder: #d9d8d3;
    --font: "Courier Prime", "Courier New", Courier, monospace;
    /* Ghost's brand font settings override these when set */
    --font-body: var(--gh-font-body, var(--font));
    --font-heading: var(--gh-font-heading, var(--font));
    --grain-opacity: 0.6;
    --content-width: 720px;
    --site-width: 1080px;
}

.grain-off    { --grain-opacity: 0; }
.grain-light  { --grain-opacity: 0.35; }
.grain-medium { --grain-opacity: 0.6; }
.grain-heavy  { --grain-opacity: 0.9; }

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

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 18px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Paper grain + faint stains, fixed behind everything */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    opacity: var(--grain-opacity);
    mix-blend-mode: multiply;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)' opacity='0.55'/%3E%3C/svg%3E"),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='1200'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.008' numOctaves='4' seed='7' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0 0.5 1'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)' opacity='0.18'/%3E%3C/svg%3E");
    background-size: 300px 300px, 1200px 1200px;
}

.site { position: relative; z-index: 1; }

.container {
    max-width: var(--site-width);
    margin: 0 auto;
    padding: 0 24px;
}

a { color: var(--ink); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 4px; }

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

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

h1, h2, h3, h4, h5, h6, .site-title { font-family: var(--font-heading); }

.eyebrow {
    margin: 0 0 16px;
    font-size: 14px;
    font-weight: 400;
    letter-spacing: 0.2em;
    text-transform: uppercase;
}

.meta { font-size: 14px; }

.button-outline {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 10px 18px;
    border: 2px solid var(--ink);
}
.button-outline:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

/* Header */
.site-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 32px 0;
    border-bottom: 2px solid var(--ink);
}
.site-title { font-size: 28px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.site-title img { max-height: 48px; width: auto; }

.site-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 28px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.site-nav ul.nav { display: flex; flex-wrap: wrap; gap: 28px; margin: 0; padding: 0; list-style: none; }
.site-nav .nav-current a { text-decoration: underline; text-underline-offset: 4px; }

.nav-toggle {
    display: none;
    width: 44px; height: 44px;
    align-items: center; justify-content: center;
    border: 2px solid var(--ink);
    background: transparent;
    color: var(--ink);
    cursor: pointer;
}

/* Hero */
.hero { padding: 96px 0 72px; border-bottom: 1px dashed var(--ink); }
.hero-title { margin: 0; font-size: 64px; line-height: 1.1; font-weight: 700; max-width: 820px; }
.hero-description { margin: 24px 0 0; max-width: 640px; color: var(--ink-soft); }

/* Featured post */
.post-featured {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 48px;
    padding: 72px 0;
    border-bottom: 1px dashed var(--ink);
}
.post-featured-image { display: block; aspect-ratio: 4 / 3; border: 2px solid var(--ink); background: var(--placeholder); overflow: hidden; }
.post-featured-image img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); }
.post-featured-body { display: flex; flex-direction: column; justify-content: center; gap: 20px; }
.post-featured-body .eyebrow, .post-featured-body p { margin: 0; }
.post-featured-title { margin: 0; font-size: 40px; line-height: 1.15; }

/* Feed */
.post-feed { padding: 48px 0; }
.post-feed > .eyebrow { margin-bottom: 24px; }

.post-card {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 32px;
    padding: 28px 0;
    border-top: 1px solid var(--ink);
}
.post-card-date { flex: 0 0 140px; font-size: 14px; }
.post-card-body { flex: 1 1 480px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.post-card-title { margin: 0; font-size: 26px; line-height: 1.25; }
.post-card-excerpt { margin: 0; color: var(--ink-soft); }
.post-card-tag { flex: 0 0 auto; font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 32px 0;
    border-top: 2px solid var(--ink);
    font-size: 16px;
}

/* Subscribe */
.subscribe {
    margin: 24px 0 96px;
    padding: 56px 48px;
    background: var(--ink);
    color: var(--paper);
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: center;
    justify-content: space-between;
}
.article + .subscribe { max-width: var(--content-width); margin: 0 auto 64px; padding: 40px; }
.subscribe h3 { margin: 0 0 8px; font-size: 32px; }
.subscribe-copy { flex: 1 1 360px; }
.subscribe-copy p { margin: 0; color: #cfcfcf; }
.subscribe-form { flex: 1 1 380px; display: flex; flex-wrap: wrap; gap: 12px; }
.subscribe-form input {
    flex: 1 1 220px;
    min-height: 52px;
    padding: 0 16px;
    border: 2px solid var(--paper);
    border-radius: 0;
    background: transparent;
    color: var(--paper);
    font: inherit;
}
.subscribe-form input::placeholder { color: #bdbdbd; }
.subscribe-form button {
    min-height: 52px;
    padding: 0 24px;
    border: 2px solid var(--paper);
    border-radius: 0;
    background: var(--paper);
    color: var(--ink);
    font: inherit;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
}
.subscribe-form button:hover { background: transparent; color: var(--paper); }
.form-message { display: none; flex-basis: 100%; margin: 0; font-size: 14px; }
.subscribe-form.success .form-success,
.subscribe-form.error .form-error { display: block; }
.subscribe-form.loading button { opacity: 0.6; }

/* Article */
.article { max-width: var(--content-width); margin: 0 auto; padding: 88px 0 64px; font-size: 19px; line-height: 1.75; }
.article-header .eyebrow a { text-decoration: none; }
.article-title { margin: 0 0 24px; font-size: 52px; line-height: 1.12; }
.article-excerpt { margin: 0 0 32px; font-size: 22px; font-style: italic; color: var(--ink-soft); }
.article-byline {
    display: flex; flex-wrap: wrap; align-items: center; gap: 16px;
    padding: 16px 0;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--ink);
    font-size: 15px;
}
.avatar { width: 44px; height: 44px; border: 2px solid var(--ink); border-radius: 50%; background: var(--placeholder); object-fit: cover; filter: grayscale(1); }
.byline-name { font-weight: 700; }

.article-image { margin: 48px 0; }
.article-image img { width: 100%; border: 2px solid var(--ink); filter: grayscale(1); }
figcaption { margin-top: 10px; font-size: 14px; text-align: center; color: var(--ink-soft); }

.article-tags { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 48px; font-size: 14px; text-transform: uppercase; letter-spacing: 0.1em; }
.article-tags a { display: inline-flex; align-items: center; min-height: 44px; padding: 10px 14px; border: 1px solid var(--ink); }

.post-nav {
    max-width: var(--content-width);
    margin: 0 auto 80px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    font-size: 16px;
}
.post-nav a { display: flex; flex-direction: column; gap: 6px; padding: 20px; border: 1px solid var(--ink); }
.post-nav .eyebrow { margin: 0; font-size: 13px; }
.post-nav-next { text-align: right; grid-column: -2; }
.comments { max-width: var(--content-width); margin: 0 auto 80px; }

/* Post content (Koenig editor output) */
.gh-content > * + * { margin-top: 28px; }
.gh-content > :first-child { margin-top: 0; }
.gh-content p, .gh-content ul, .gh-content ol { margin-bottom: 0; }
.gh-content h2 { margin: 56px 0 0; font-size: 30px; line-height: 1.25; }
.gh-content h3 { margin: 48px 0 0; font-size: 24px; line-height: 1.3; }
.gh-content h4 { margin: 40px 0 0; font-size: 20px; }
.gh-content h2 + *, .gh-content h3 + *, .gh-content h4 + * { margin-top: 16px; }
.gh-content a { text-decoration: underline; text-underline-offset: 4px; }
.gh-content a:hover { text-decoration-thickness: 2px; }
.gh-content blockquote {
    margin-left: 0; margin-right: 0;
    padding: 8px 0 8px 28px;
    border-left: 4px solid var(--ink);
    font-size: 24px;
    font-style: italic;
    line-height: 1.5;
}
.gh-content blockquote.kg-blockquote-alt { border: 0; padding: 0 32px; text-align: center; }
.gh-content code { font-family: inherit; background: var(--ink); color: var(--paper); padding: 2px 6px; font-size: 0.9em; }
.gh-content pre {
    padding: 24px;
    border: 2px solid var(--ink);
    background: var(--paper-dark);
    font-family: inherit;
    font-size: 16px;
    line-height: 1.6;
    overflow-x: auto;
}
.gh-content pre code { background: none; color: inherit; padding: 0; }
.gh-content hr { border: 0; height: auto; text-align: center; margin: 56px 0; }
.gh-content hr::after { content: "* * *"; letter-spacing: 1em; }
.gh-content img { filter: grayscale(1); }
.gh-content table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; font-size: 16px; }
.gh-content th, .gh-content td { padding: 10px 14px; border: 1px solid var(--ink); text-align: left; }

/* Required Koenig card widths */
.kg-width-wide { margin-left: -80px; margin-right: -80px; }
.kg-width-full { margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.kg-width-full img { width: 100%; }
.kg-image-card img { margin: 0 auto; }
.kg-gallery-image img { filter: grayscale(1); }

/* Footer */
.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 16px;
    padding: 32px 0 48px;
    border-top: 2px solid var(--ink);
    font-size: 14px;
}
.site-footer nav, .site-footer ul.nav { display: flex; flex-wrap: wrap; gap: 24px; margin: 0; padding: 0; list-style: none; }

.error { text-align: left; }

/* Mobile */
@media (max-width: 800px) {
    body { font-size: 17px; }
    .container { padding: 0 20px; }
    .site-header { padding: 20px 0; }
    .site-title { font-size: 20px; }
    .nav-toggle { display: inline-flex; }
    .site-nav { display: none; flex-basis: 100%; flex-direction: column; align-items: flex-start; gap: 16px; padding-top: 8px; }
    .site-nav.is-open { display: flex; }
    .site-nav ul.nav { flex-direction: column; gap: 16px; }

    .hero { padding: 48px 0 36px; }
    .hero-title { font-size: 34px; line-height: 1.15; }
    .eyebrow { font-size: 12px; }

    .post-featured { padding: 36px 0; gap: 14px; }
    .post-featured-title { font-size: 26px; }

    .post-feed { padding: 32px 0 16px; }
    .post-card { flex-direction: column; gap: 4px; padding: 20px 0; }
    .post-card-date { flex: none; font-size: 13px; }
    .post-card-body { flex: none; }
    .post-card-title { font-size: 20px; }
    .post-card-excerpt { display: none; }
    .post-card-tag { font-size: 12px; }

    .subscribe, .article + .subscribe { margin: 24px 0 32px; padding: 28px 20px; }
    .subscribe h3 { font-size: 22px; }
    .subscribe-form { flex-direction: column; }
    .subscribe-form input { flex: none; }

    .article { padding: 48px 0 40px; font-size: 18px; }
    .article-title { font-size: 34px; }
    .article-excerpt { font-size: 19px; }
    .kg-width-wide { margin-left: 0; margin-right: 0; }
    .gh-content blockquote { font-size: 20px; padding-left: 20px; }

    .site-footer { flex-direction: column-reverse; }
}
