/* ==========================================================================
   Jefito Press — Ghost theme for Jefitoblog
   Layout: newspaper front page. Colours: warm paper, ink, brick-red accent.
   The accent follows Settings → Design → Brand → Accent color
   (Ghost sets --ghost-accent-color); #B23A22 is the fallback.
   ========================================================================== */

:root {
    --paper: #F3EEE4;
    --paper-dark: #E3D9C6;
    --ink: #1B1A17;
    --ink-soft: #2A2824;
    --ink-mid: #3D3A34;
    --muted: #5C574E;
    --rule: #CFC7B8;
    --on-ink: #D8D1C3;
    --accent: var(--ghost-accent-color, #B23A22);
    --serif: "Newsreader", Georgia, "Times New Roman", serif;
    --sans: "Inter Tight", system-ui, -apple-system, "Segoe UI", sans-serif;
    --wrap: 1200px;
    --measure: 720px;
}

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

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

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

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

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

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

.wrap {
    max-width: var(--wrap);
    margin: 0 auto;
    padding-left: 40px;
    padding-right: 40px;
}

/* ---------- Shared bits ---------- */

.label,
.kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-family: var(--sans);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.kicker { color: var(--accent); }

.lock-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border: 1px solid currentColor;
    color: var(--ink);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 600;
}

.meta {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.section-title {
    margin: 0 0 24px;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 32px;
    line-height: 1.15;
}

.more-link {
    display: inline-block;
    margin-top: 24px;
    font-weight: 600;
    color: var(--accent);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 20px;
    border: 0;
    font-family: var(--sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { text-decoration: none; filter: brightness(0.92); }
.btn-accent { background: var(--accent); color: #fff; }

/* ---------- Header ---------- */

.topbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-top: 14px;
    padding-bottom: 14px;
    font-size: 14px;
    color: var(--muted);
}

.account-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    font-weight: 500;
}
.account-links .nav-list { gap: 20px; }
.account-links a { color: var(--muted); }
.account-links .btn { color: #fff; min-height: 40px; padding: 0 18px; }

.masthead {
    text-align: center;
    padding-top: 24px;
    padding-bottom: 20px;
}
.masthead::before,
.masthead::after {
    content: "";
    display: block;
}
.masthead-title {
    display: inline-block;
    font-family: var(--serif);
    font-weight: 800;
    font-size: clamp(56px, 10vw, 104px);
    line-height: 1;
    letter-spacing: -0.035em;
}
.masthead-title:hover { text-decoration: none; }
.masthead-tagline {
    margin: 10px 0 0;
    font-family: var(--serif);
    font-style: italic;
    font-size: 20px;
    color: var(--ink-mid);
}

/* Rules above and below the masthead block */
.topbar + .masthead { border-top: 1px solid var(--ink); border-bottom: 4px double var(--ink); }

.compact-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-top: 22px;
    padding-bottom: 16px;
}
.compact-title {
    font-family: var(--serif);
    font-weight: 800;
    font-size: 40px;
    line-height: 1;
    letter-spacing: -0.03em;
}
.compact-title:hover { text-decoration: none; }
.compact-header + .series-nav { border-top: 4px double var(--ink); }

.nav-list {
    display: flex;
    flex-wrap: wrap;
    margin: 0;
    padding: 0;
    list-style: none;
}

.series-nav {
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
}
.series-nav > .nav-list,
.series-nav .nav-list {
    justify-content: center;
    gap: 8px 26px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--ink);
}
.series-nav .is-current a { color: var(--accent); }

/* ---------- Front page ---------- */

.front {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    padding: 40px 0;
    border-bottom: 1px solid var(--ink);
}

.lead {
    flex: 999 1 560px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.lead-title {
    margin: 0;
    font-family: var(--serif);
    font-weight: 800;
    font-size: clamp(38px, 5.5vw, 64px);
    line-height: 1.02;
    letter-spacing: -0.025em;
}
.lead-dek {
    margin: 0;
    font-family: var(--serif);
    font-size: 24px;
    line-height: 1.4;
    color: var(--ink-mid);
}
.lead-image { margin-top: 8px; }
.lead-image img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid var(--rule);
}

.rail {
    flex: 1 1 280px;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--rule);
    padding-left: 32px;
}
.rail .label { margin-bottom: 8px; }
.rail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 0;
    border-bottom: 1px solid var(--rule);
}
.rail-title {
    margin: 0;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 20px;
    line-height: 1.2;
}

.desk {
    padding: 40px 0;
    border-bottom: 1px solid var(--ink);
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 32px 40px;
}
.card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
    border-top: 1px solid var(--rule);
}
.card-title {
    margin: 0;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 24px;
    line-height: 1.15;
}
.card-dek {
    margin: 0;
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.45;
    color: var(--ink-mid);
}

.front-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    padding: 48px 0 56px;
}
.about-block {
    flex: 1 1 420px;
    display: flex;
    flex-direction: column;
}
.about-block .section-title { margin-bottom: 12px; }
.about-block p {
    margin: 0;
    font-family: var(--serif);
    font-size: 19px;
    line-height: 1.55;
    color: var(--ink-mid);
}
.front-footer .subscribe-box { flex: 1 1 420px; margin: 0; }

/* ---------- Subscribe box ---------- */

.subscribe-box {
    background: var(--ink);
    color: var(--paper);
    padding: 36px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.subscribe-box h2 {
    margin: 0;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 30px;
}
.subscribe-box p {
    margin: 0;
    font-size: 16px;
    color: var(--on-ink);
}
.subscribe-form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.subscribe-form input {
    flex: 1 1 200px;
    min-height: 48px;
    padding: 0 14px;
    border: 0;
    border-radius: 0;
    font-family: var(--sans);
    font-size: 16px;
    background: #fff;
    color: var(--ink);
}
.subscribe-form .btn { min-height: 48px; }
.subscribe-form .form-message { display: none; flex-basis: 100%; font-size: 14px; }
.subscribe-form.success .form-success,
.subscribe-form.error .form-error { display: block; }
.subscribe-form.loading .btn { opacity: 0.6; pointer-events: none; }
.subscribe-form.success input,
.subscribe-form.success .btn { display: none; }

/* ---------- Lists (archive, series, author) ---------- */

.list-page { padding-top: 40px; padding-bottom: 56px; }

.list-header {
    max-width: 820px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--ink);
}
.list-header .label { color: var(--muted); }
.list-title {
    margin: 10px 0 8px;
    font-family: var(--serif);
    font-weight: 800;
    font-size: clamp(36px, 5vw, 56px);
    line-height: 1.05;
    letter-spacing: -0.02em;
}
.list-description {
    margin: 0;
    font-family: var(--serif);
    font-size: 20px;
    line-height: 1.5;
    color: var(--ink-mid);
}

.post-list { max-width: 820px; }
.row {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    padding: 24px 0;
    border-bottom: 1px solid var(--rule);
}
.row-text {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.row-title {
    margin: 0;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 26px;
    line-height: 1.15;
}
.row-dek {
    margin: 0;
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.45;
    color: var(--ink-mid);
}
.row-image {
    flex: 0 0 180px;
}
.row-image img {
    width: 180px;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border: 1px solid var(--rule);
}

.pagination {
    max-width: 820px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding-top: 28px;
    font-size: 14px;
}
.pagination-link { font-weight: 600; color: var(--accent); }
.pagination-count { color: var(--muted); }

/* ---------- Post ---------- */

.article {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 48px 20px 24px;
}

.article-header .kicker { margin-bottom: 14px; }
.article-title {
    margin: 0;
    font-family: var(--serif);
    font-weight: 800;
    font-size: clamp(36px, 6vw, 56px);
    line-height: 1.04;
    letter-spacing: -0.025em;
}
.article-dek {
    margin: 16px 0 0;
    font-family: var(--serif);
    font-style: italic;
    font-size: 26px;
    line-height: 1.35;
    color: var(--ink-mid);
}
.byline {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 14px 0;
    border-top: 1px solid var(--ink);
    border-bottom: 1px solid var(--rule);
    font-size: 14px;
    color: var(--muted);
}
.byline a { font-weight: 600; color: var(--ink); }

.article-image { margin: 32px 0 0; }
.article-image figcaption,
.gh-content figcaption {
    margin-top: 8px;
    font-size: 13px;
    color: var(--muted);
    text-align: center;
}

/* Post body */
.gh-content {
    margin-top: 32px;
    font-family: var(--serif);
    font-size: 21px;
    line-height: 1.6;
    color: var(--ink-soft);
    overflow-wrap: break-word;
}
.gh-content > * { margin-top: 0; margin-bottom: 0; }
.gh-content > * + * { margin-top: 22px; }
.gh-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.gh-content h2,
.gh-content h3,
.gh-content h4 {
    font-family: var(--sans);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ink);
    line-height: 1.3;
}
.gh-content > h2, .gh-content > h3, .gh-content > h4 { margin-top: 44px; }
.gh-content h2 { font-size: 16px; }
.gh-content h3 { font-size: 14px; }
.gh-content h4 { font-size: 13px; color: var(--muted); }
.gh-content ul,
.gh-content ol { padding-left: 1.3em; }
.gh-content li + li { margin-top: 8px; }
.gh-content blockquote:not([class]) {
    margin-left: 0;
    margin-right: 0;
    padding-left: 22px;
    border-left: 3px solid var(--accent);
    font-style: italic;
}
.gh-content blockquote.kg-blockquote-alt {
    margin-left: 0;
    margin-right: 0;
    padding: 22px 0;
    border-top: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    font-size: 30px;
    line-height: 1.25;
    font-style: italic;
    text-align: center;
    color: var(--ink);
}
.gh-content hr {
    border: 0;
    border-top: 4px double var(--ink);
    margin-top: 44px;
    margin-bottom: 44px;
}
.gh-content hr + * { margin-top: 0; }
.gh-content pre {
    padding: 16px;
    overflow-x: auto;
    background: var(--ink);
    color: var(--paper);
    font-size: 15px;
}
.gh-content code { font-size: 0.85em; }
.gh-content table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
    font-family: var(--sans);
    font-size: 15px;
}
.gh-content th,
.gh-content td { padding: 8px 12px; border-bottom: 1px solid var(--rule); text-align: left; }
.gh-content iframe { max-width: 100%; }

/* Koenig editor cards (required by Ghost) */
.kg-width-wide {
    position: relative;
    width: min(1040px, 100vw - 40px);
    left: 50%;
    transform: translateX(-50%);
}
.kg-width-full {
    position: relative;
    width: 100vw;
    left: 50%;
    transform: translateX(-50%);
}
.kg-width-full img { width: 100%; }
.kg-embed-card { display: flex; flex-direction: column; align-items: center; }
.kg-embed-card iframe { width: 100%; aspect-ratio: 16 / 9; height: auto; }
.kg-bookmark-card a { text-decoration: none; }
.kg-callout-card { font-family: var(--sans); font-size: 17px; }
.kg-audio-card,
.kg-file-card { font-family: var(--sans); }

/* Tags under a post */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 36px;
    font-size: 13px;
}
.tag-pill { padding: 8px 14px; border: 1px solid var(--rule); color: var(--muted); }
.tag-pill:first-child { border-color: var(--ink); color: var(--ink); }
.tag-pill:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); }

/* More in this series */
.more-series {
    margin-top: 40px;
    padding-top: 28px;
    border-top: 4px double var(--ink);
}
.more-series-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}
.more-series-head h2 {
    margin: 0;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 28px;
}
.more-series-head .more-link { margin-top: 0; font-size: 14px; }
.more-series-item {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 0;
    border-bottom: 1px solid var(--rule);
}
.more-series-title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 20px;
    line-height: 1.25;
}
.more-series-item .meta { white-space: nowrap; }

.article .subscribe-box { margin-top: 40px; }

.article-comments { margin-top: 48px; }

/* ---------- Locked preview for paid / members-only posts ---------- */

.locked-cta {
    position: relative;
    margin-top: 0;
}
.locked-fade {
    position: absolute;
    left: 0;
    right: 0;
    top: -160px;
    height: 160px;
    background: linear-gradient(to bottom, rgba(243, 238, 228, 0), var(--paper));
    pointer-events: none;
}
.locked-box {
    position: relative;
    margin-top: 8px;
    padding: 40px 36px;
    border-top: 4px double var(--ink);
    border-bottom: 4px double var(--ink);
    text-align: center;
    font-family: var(--sans);
}
.locked-icon { color: var(--accent); margin: 0 auto 14px; display: block; }
.locked-title {
    margin: 0;
    font-family: var(--serif);
    font-weight: 800;
    font-size: 32px;
    line-height: 1.15;
    letter-spacing: -0.015em;
    text-transform: none;
    color: var(--ink);
}
.locked-text {
    max-width: 460px;
    margin: 12px auto 0;
    font-size: 17px;
    line-height: 1.5;
    color: var(--ink-mid);
}
.locked-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin-top: 24px;
}
.locked-actions .btn { min-height: 50px; padding: 0 28px; color: #fff; text-decoration: none; }
.locked-signin { font-size: 14px; color: var(--muted) !important; text-decoration: none !important; }
.locked-signin:hover { text-decoration: underline !important; }

/* ---------- Error ---------- */

.error-page { padding-top: 80px; padding-bottom: 120px; }
.error-page .label { color: var(--accent); }

/* ---------- Footer ---------- */

.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 12px;
    padding-top: 20px;
    padding-bottom: 40px;
    font-size: 13px;
    color: var(--muted);
}
.site-footer::before {
    content: "";
    flex-basis: 100%;
    border-top: 4px double var(--ink);
    margin-bottom: 8px;
}

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
    .wrap { padding-left: 20px; padding-right: 20px; }
    .rail { border-left: 0; padding-left: 0; border-top: 1px solid var(--ink); padding-top: 16px; }
    .series-nav .nav-list { justify-content: flex-start; gap: 8px 18px; }
    .row-image { flex-basis: 96px; }
    .row-image img { width: 96px; }
    .row-title { font-size: 21px; }
    .gh-content { font-size: 19px; }
    .subscribe-box,
    .locked-box { padding: 28px 20px; }
    .topbar-date { display: none; }
}
