/* ─────────────────────────────────────────────────────────────────
   SOIL GOODMAN — Theme Stylesheet
   Mid-century modern meets editorial restraint
   ───────────────────────────────────────────────────────────────── */

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

:root {
    --parchment: #f4ede0;
    --parchment-dark: #ece4d3;
    --ink: #1c2b1a;
    --ink-soft: rgba(28,43,26,0.75);
    --ink-muted: rgba(28,43,26,0.45);
    --ink-faint: rgba(28,43,26,0.1);
    --gold: #c8a832;
    --gold-soft: rgba(200,168,50,0.5);
    --gold-muted: rgba(200,168,50,0.2);

    --serif: 'Playfair Display', Georgia, serif;
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --radius: 6px;
    --radius-sm: 4px;

    --max-content: 1000px;
    --max-prose: 740px;

    --t: 180ms ease;
}

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

body {
    background: var(--parchment);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.7;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

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

::selection { background: var(--gold-muted); color: var(--ink); }

/* ─── HEADER / NAV ───────────────────────────────────────────── */
.site-header {
    position: sticky; top: 0; z-index: 100;
    background: rgba(244,237,224,0.92);
    backdrop-filter: saturate(140%) blur(8px);
    -webkit-backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 0.5px solid var(--ink-faint);
    padding: 0 2rem; height: 60px;
    display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-mark svg { display: block; }
.logo-name {
    font-family: var(--serif); font-size: 17px;
    color: var(--ink); letter-spacing: 0.02em;
}
.site-nav { display: flex; align-items: center; }
.site-nav a {
    font-size: 12px; color: var(--ink-muted); text-decoration: none;
    letter-spacing: 0.08em; margin-left: 24px; text-transform: uppercase;
    transition: color var(--t);
}
.site-nav a:hover { color: var(--ink); }
.site-nav a.active { color: var(--gold); }

/* ─── MAIN / CONTAINERS ──────────────────────────────────────── */
.site-main { min-height: 70vh; }
.content-container,
main > * {
    max-width: var(--max-content);
    margin: 0 auto;
    padding: 3rem 1.5rem 6rem;
}
.post-full,
.page-full {
    max-width: var(--max-prose);
    margin: 0 auto;
    padding: 3rem 1.5rem 4rem;
}

/* ─── HERO POST (homepage) ──────────────────────────────────── */
.hero-post {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 2.5rem; margin-bottom: 4rem; align-items: center;
}
.hero-img-wrap { display: block; }
.hero-img {
    border-radius: var(--radius); overflow: hidden;
    height: 380px; position: relative;
    background: var(--parchment-dark);
    transition: transform var(--t);
}
.hero-img:hover { transform: translateY(-2px); }
.hero-img img { width: 100%; height: 100%; object-fit: cover; }
.hero-img-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(28,43,26,0.55) 0%, transparent 60%);
    pointer-events: none;
}
.hero-content { padding: 1rem 0; }
.hero-content .post-tag {
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--gold); margin-bottom: 14px; display: block;
    font-weight: 500;
}
h2.hero-title {
    font-family: var(--serif); font-size: 2rem; font-weight: 400;
    line-height: 1.25; margin-bottom: 1rem; color: var(--ink);
    letter-spacing: -0.005em;
}
h2.hero-title a { text-decoration: none; transition: color var(--t); }
h2.hero-title a:hover { color: var(--gold); }
.hero-excerpt {
    font-size: 15px; color: var(--ink-muted); line-height: 1.75;
    margin-bottom: 1.5rem;
}
.read-link {
    display: inline-block;
    font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--ink); text-decoration: none;
    border-bottom: 0.5px solid var(--ink-muted);
    padding-bottom: 2px; transition: color var(--t), border-color var(--t);
}
.read-link:hover { color: var(--gold); border-color: var(--gold); }
.post-meta-small {
    font-size: 11px; color: var(--ink-muted);
    margin-bottom: 12px; letter-spacing: 0.04em;
}

/* ─── DIVIDERS ──────────────────────────────────────────────── */
.divider, .section-divider {
    display: flex; align-items: center; gap: 1rem;
    margin: 0 0 2.5rem;
}
.section-divider { margin: 4rem 0 2.5rem; }
.divider span, .section-divider span {
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--ink-muted); white-space: nowrap;
}
.divider::before, .divider::after,
.section-divider::before, .section-divider::after {
    content: ''; flex: 1; height: 0.5px; background: var(--ink-faint);
}

/* ─── POST GRID ─────────────────────────────────────────────── */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}
.post-grid-2col { grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* ─── POST CARD ─────────────────────────────────────────────── */
.post-card { display: flex; flex-direction: column; }
.card-img-wrap { display: block; transition: transform var(--t); }
.card-img-wrap:hover { transform: translateY(-2px); }
.card-img {
    border-radius: var(--radius-sm); overflow: hidden;
    height: 200px; margin-bottom: 1rem; position: relative;
    background: var(--parchment-dark);
}
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(28,43,26,0.6) 0%, transparent 50%);
    pointer-events: none;
}
.card-tag {
    font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--gold); margin-bottom: 6px; font-weight: 500;
}
.card-title {
    font-family: var(--serif); font-size: 1.05rem;
    font-weight: 400; line-height: 1.35;
    color: var(--ink); margin-bottom: 0.5rem;
}
.card-title a { text-decoration: none; transition: color var(--t); }
.card-title a:hover { color: var(--gold); }
.card-excerpt {
    font-size: 13px; color: var(--ink-muted);
    line-height: 1.6; margin: 6px 0;
}
.card-meta {
    font-size: 11px; color: var(--ink-muted);
    margin-top: auto; padding-top: 8px; letter-spacing: 0.04em;
}

/* ─── FALLBACK ART (when no feature image) ──────────────────── */
.fallback-art {
    width: 100%; height: 100%;
    border-radius: var(--radius-sm); overflow: hidden;
    background: var(--parchment-dark);
}
.fallback-art svg { width: 100%; height: 100%; display: block; }

/* ─── ART HEADER (single post) ──────────────────────────────── */
.art-header {
    width: 100%; height: 420px;
    border-radius: var(--radius); overflow: hidden;
    margin-bottom: 2rem; position: relative;
    background: var(--parchment-dark);
}
.art-header img { width: 100%; height: 100%; object-fit: cover; }
.art-header-overlay {
    position: absolute; inset: 0;
    background: linear-gradient(to top, rgba(28,43,26,0.88) 0%, rgba(28,43,26,0.2) 55%, transparent 100%);
    pointer-events: none;
}
.art-header-content {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 2rem;
}
.art-header-tag {
    font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
    color: var(--gold); margin-bottom: 10px; font-weight: 500;
}
.art-header-title {
    font-family: var(--serif); font-size: 26px; font-weight: 400;
    color: var(--parchment); line-height: 1.3; margin-bottom: 8px;
    letter-spacing: -0.005em;
}
.art-header-meta {
    font-size: 11px; color: rgba(244,237,224,0.5);
    letter-spacing: 0.06em;
}
.art-header-page { height: 280px; }

/* ─── POST META ROW ─────────────────────────────────────────── */
.post-meta {
    display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
    font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--ink-muted); margin-bottom: 1rem;
}
.post-meta-dot { opacity: 0.3; }
.post-meta .post-tag {
    color: var(--gold); font-weight: 500; text-decoration: none;
}
.post-meta .post-tag:hover { text-decoration: underline; }

/* ─── POST TITLE / LEDE ─────────────────────────────────────── */
h1.post-title {
    font-family: var(--serif); font-size: 2.2rem; font-weight: 400;
    line-height: 1.25; color: var(--ink);
    margin-bottom: 1.5rem; letter-spacing: -0.01em;
}
p.lede {
    font-size: 1.1rem; line-height: 1.75; color: var(--ink-soft);
    font-style: italic; font-family: var(--serif);
    margin-bottom: 2rem; padding-bottom: 2rem;
    border-bottom: 0.5px solid var(--ink-faint);
}

/* ─── POST BODY ─────────────────────────────────────────────── */
.post-body { font-size: 17px; line-height: 1.85; color: var(--ink); }
.post-body > * { margin-bottom: 1.5rem; }
.post-body > *:last-child { margin-bottom: 0; }

.post-body p { color: var(--ink); line-height: 1.85; }

.post-body.has-drop-cap > p:first-of-type::first-letter,
.post-body.has-drop-cap > p:first-child::first-letter {
    font-family: var(--serif);
    font-size: 4rem; float: left; line-height: 0.8;
    margin: 0.1em 0.08em 0 0; color: var(--gold);
}

.post-body h2 {
    font-family: var(--serif); font-size: 1.6rem; font-weight: 400;
    line-height: 1.3; margin: 2.5rem 0 1rem; color: var(--ink);
    letter-spacing: -0.005em;
}
.post-body h3 {
    font-family: var(--serif); font-size: 1.3rem; font-weight: 400;
    line-height: 1.35; margin: 2rem 0 0.75rem; color: var(--ink);
}
.post-body h4 {
    font-family: var(--sans); font-size: 0.85rem; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.12em;
    margin: 2rem 0 0.5rem; color: var(--ink-muted);
}

.post-body a {
    color: var(--ink); text-decoration: underline;
    text-decoration-color: var(--gold-soft);
    text-underline-offset: 3px; text-decoration-thickness: 1px;
    transition: text-decoration-color var(--t), color var(--t);
}
.post-body a:hover { color: var(--gold); text-decoration-color: var(--gold); }

.post-body strong { font-weight: 500; color: var(--ink); }
.post-body em { font-style: italic; }

.post-body ul, .post-body ol { padding-left: 1.5rem; }
.post-body li { margin-bottom: 0.5rem; }

.post-body img {
    border-radius: var(--radius-sm);
    margin: 2rem auto 0.5rem;
}
.post-body figure { margin: 2rem 0; }
.post-body figure img { margin: 0; }
.post-body figcaption {
    font-size: 12px; color: var(--ink-muted);
    text-align: center; margin-top: 0.75rem;
    font-style: italic; line-height: 1.5;
}

/* Pull quote */
.post-body blockquote {
    border-left: 2px solid var(--gold);
    margin: 2.5rem 0; padding: 0.5rem 0 0.5rem 1.5rem;
    font-family: var(--serif); font-size: 1.2rem; font-style: italic;
    color: var(--ink-soft); line-height: 1.6;
}
.post-body blockquote p { margin: 0; }

/* Code */
.post-body code {
    font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
    font-size: 0.88em; background: var(--parchment-dark);
    padding: 2px 6px; border-radius: 3px;
    border: 0.5px solid var(--ink-faint);
}
.post-body pre {
    background: var(--ink); color: var(--parchment);
    padding: 1.25rem 1.5rem; border-radius: var(--radius-sm);
    overflow-x: auto; font-size: 13px; line-height: 1.6;
    margin: 1.5rem 0;
}
.post-body pre code {
    background: transparent; padding: 0; border: 0;
    color: inherit; font-size: inherit;
}

/* Horizontal rule */
.post-body hr {
    border: 0; height: 0.5px; background: var(--ink-faint);
    margin: 3rem auto; max-width: 200px;
}

/* ─── KOENIG EDITOR CARDS (Ghost native) ────────────────────── */
.kg-card { margin: 2rem 0; }
.kg-image-card img { width: 100%; }
.kg-width-wide img { max-width: calc(var(--max-prose) + 100px); margin-left: -50px; }
.kg-width-full img { max-width: 100vw; margin-left: calc(50% - 50vw); }
.kg-bookmark-card,
.kg-bookmark-container {
    border: 0.5px solid var(--ink-faint);
    border-radius: var(--radius);
    background: var(--parchment-dark);
    text-decoration: none;
    color: var(--ink);
    display: flex;
    overflow: hidden;
    transition: border-color var(--t);
}
.kg-bookmark-card:hover,
.kg-bookmark-container:hover { border-color: var(--gold); }
.kg-bookmark-content { padding: 20px; flex: 1 1 auto; min-width: 0; }
.kg-bookmark-title {
    font-family: var(--serif); font-size: 1.1rem;
    color: var(--ink); margin-bottom: 6px; line-height: 1.3;
}
.kg-bookmark-description {
    font-size: 13px; color: var(--ink-muted);
    line-height: 1.5; margin-bottom: 10px;
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
.kg-bookmark-metadata {
    font-size: 11px; color: var(--ink-muted);
    letter-spacing: 0.04em; display: flex;
    align-items: center; gap: 6px;
}
.kg-bookmark-icon {
    width: 18px; height: 18px; margin-right: 6px;
    object-fit: contain;
}
.kg-bookmark-author { color: var(--ink-muted); font-weight: 500; }
.kg-bookmark-author::after {
    content: '·'; margin: 0 6px; opacity: 0.4;
}
.kg-bookmark-publisher {
    color: var(--ink-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    max-width: 240px;
}
.kg-bookmark-thumbnail {
    flex: 0 0 auto; max-width: 33%;
    position: relative; min-height: 120px;
}
.kg-bookmark-thumbnail img {
    width: 100%; height: 100%; object-fit: cover;
    position: absolute; inset: 0;
}
.kg-callout-card {
    background: var(--parchment-dark);
    border: 0.5px solid var(--ink-faint);
    border-left: 2px solid var(--gold);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
}

/* ─── AFFILIATE BLOCK (for n8n / manual posts) ──────────────── */
.affiliate-block {
    background: var(--parchment-dark);
    border: 0.5px solid var(--ink-faint);
    border-left: 2px solid var(--gold);
    border-radius: var(--radius-sm);
    padding: 1.25rem 1.5rem;
    margin: 2.5rem 0;
    display: flex; align-items: center; gap: 1.25rem;
}
.affiliate-icon {
    width: 48px; height: 48px;
    border-radius: 50%;
    background: var(--gold-muted);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.affiliate-text { flex: 1; }
.affiliate-text p { font-size: 13px; color: var(--ink-muted); margin: 0 0 4px; line-height: 1.5; }
.affiliate-text strong {
    display: block; font-size: 14px; color: var(--ink);
    font-weight: 500; margin-bottom: 4px;
}
.affiliate-link {
    font-size: 12px; color: var(--gold); text-decoration: none;
    letter-spacing: 0.06em; text-transform: uppercase; font-weight: 500;
}
.affiliate-link:hover { text-decoration: underline; }

/* ─── HNTZ CLOSER ───────────────────────────────────────────── */
.hntz-closer {
    margin-top: 3rem; padding-top: 2rem;
    border-top: 0.5px solid var(--ink-faint);
    font-size: 14px; color: var(--ink-muted);
    font-style: italic; font-family: var(--serif);
    line-height: 1.6;
}
.hntz-closer a {
    color: var(--ink); text-decoration: underline;
    text-decoration-color: var(--gold);
    text-underline-offset: 3px;
}
.hntz-closer a:hover { color: var(--gold); }

/* ─── POST AUTHOR + COMMENTS ────────────────────────────────── */
.post-author {
    margin-top: 2.5rem; padding-top: 1.5rem;
    border-top: 0.5px solid var(--ink-faint);
    font-size: 12px; color: var(--ink-muted);
    letter-spacing: 0.04em;
}
.post-author-kicker { display: block; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.12em; font-size: 10px; }
.post-author-name { font-family: var(--serif); font-size: 14px; color: var(--ink); }

.post-comments { margin-top: 4rem; }

/* ─── POST TAGS PILLS ───────────────────────────────────────── */
.post-tags {
    margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 8px;
}
.post-tag-pill {
    font-size: 11px; letter-spacing: 0.06em;
    color: var(--ink-muted);
    border: 0.5px solid var(--ink-faint);
    border-radius: 20px;
    padding: 4px 12px; text-decoration: none;
    transition: border-color var(--t), color var(--t);
}
.post-tag-pill:hover { border-color: var(--gold); color: var(--gold); }

/* ─── PAGE / ARCHIVE HEADER ─────────────────────────────────── */
.page-header, .archive-header {
    text-align: center; margin-bottom: 3rem;
    padding-bottom: 2rem;
    border-bottom: 0.5px solid var(--ink-faint);
}
.archive-kicker {
    display: block; font-size: 10px;
    letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--gold); margin-bottom: 10px;
}
.page-title, .archive-title {
    font-family: var(--serif); font-size: 2.2rem;
    font-weight: 400; line-height: 1.2;
    margin-bottom: 0.75rem; letter-spacing: -0.01em;
}
.page-subtitle, .archive-description {
    font-family: var(--serif); font-style: italic;
    font-size: 1.05rem; color: var(--ink-soft);
    max-width: 540px; margin: 0 auto;
}
.author-avatar {
    width: 90px; height: 90px; border-radius: 50%;
    margin: 0 auto 1rem; object-fit: cover;
    border: 0.5px solid var(--ink-faint);
}

/* ─── EMPTY / ERROR STATES ──────────────────────────────────── */
.empty-state, .error-content {
    text-align: center; padding: 5rem 1rem;
}
.empty-headline,
.error-title {
    font-family: var(--serif); font-size: 1.6rem;
    font-weight: 400; color: var(--ink); margin-bottom: 0.5rem;
}
.empty-sub,
.error-description {
    color: var(--ink-muted); font-size: 14px; margin-bottom: 2rem;
}
.error-code {
    font-family: var(--serif); font-size: 5rem;
    color: var(--gold); margin-bottom: 1rem; line-height: 1;
}

/* ─── PAGINATION ────────────────────────────────────────────── */
.pagination {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 4rem; padding-top: 2rem;
    border-top: 0.5px solid var(--ink-faint);
    font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase;
}
.pagination a { text-decoration: none; color: var(--ink); }
.pagination a:hover { color: var(--gold); }
.pagination .nav-next { margin-left: auto; }

/* ─── FOOTER ────────────────────────────────────────────────── */
.site-footer {
    background: var(--ink); padding: 3rem 2rem; text-align: center;
}
.footer-logo {
    font-family: var(--serif); font-size: 18px;
    color: rgba(244,237,224,0.6); margin-bottom: 0.5rem;
}
.footer-tagline,
.footer-link,
.footer-copy {
    font-size: 12px; color: rgba(244,237,224,0.3); letter-spacing: 0.06em;
}
.footer-link { margin-top: 8px; }
.site-footer a { color: var(--gold); text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }
.footer-copy { margin-top: 1.5rem; font-size: 10px; }

/* ─── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 900px) {
    .post-grid { grid-template-columns: repeat(2, 1fr); }
    .hero-post { gap: 1.5rem; }
}

@media (max-width: 700px) {
    .site-header { padding: 0 1.25rem; }
    .site-nav a { margin-left: 14px; font-size: 11px; }

    .content-container, main > * { padding: 2rem 1.25rem 4rem; }
    .post-full, .page-full { padding: 2rem 1.25rem 3rem; }

    .hero-post { grid-template-columns: 1fr; gap: 1.5rem; margin-bottom: 3rem; }
    .hero-img { height: 240px; }
    h2.hero-title { font-size: 1.6rem; }

    h1.post-title { font-size: 1.7rem; }
    p.lede { font-size: 1rem; }
    .post-body { font-size: 16px; }
    .post-body.has-drop-cap > p:first-of-type::first-letter,
    .post-body.has-drop-cap > p:first-child::first-letter { font-size: 3rem; }

    .art-header { height: 280px; }
    .art-header-content { padding: 1.25rem; }
    .art-header-title { font-size: 20px; }

    .post-grid { grid-template-columns: 1fr; gap: 2rem; }

    .affiliate-block { flex-direction: column; align-items: flex-start; gap: 0.75rem; }
    .affiliate-icon { width: 40px; height: 40px; }

    .kg-width-wide img { max-width: 100%; margin-left: 0; }
}

/* ─── PRINT ─────────────────────────────────────────────────── */
@media print {
    .site-header, .site-footer, .pagination, .post-tags, .hntz-closer { display: none; }
    body { background: white; color: black; }
    .post-body { font-size: 11pt; }
}
