/* ==========================================================================
   Cathartic — a comic-strip theme for Rupert Kinnard
   Palette drawn from the "Ooops… I Just Catharted!" cover and the strips:
   newsprint cream, bold teal, Bomber gold, Diva magenta, heavy ink lines.
   ========================================================================== */

:root {
    --ink: #1d1610;
    --paper: #fff6e7;
    --white: #fffdf8;
    --teal: #189e9e;
    --teal-deep: #0d6a6d;
    --gold: #f5a31c;
    --gold-light: #ffc93f;
    --magenta: #e23a78;
    /* --gh-font-* are injected by Ghost when fonts are picked in the admin;
       our comic pairing is the fallback default */
    --font-display: var(--gh-font-heading, "Archivo Black", "Arial Black", sans-serif);
    --font-body: var(--gh-font-body, "Public Sans", -apple-system, "Segoe UI", sans-serif);
    --border: 3px solid var(--ink);
    --shadow: 7px 7px 0 var(--ink);
    --shadow-sm: 4px 4px 0 var(--ink);
    --wrap: 1120px;
}

/* --- Reset-ish --- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--paper);
    line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal-deep); }
a:hover { color: var(--magenta); }

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

/* Halftone dot texture, used on hero + section breaks */
.dots, .hero, .newsletter-cta {
    background-image: radial-gradient(rgba(29, 22, 16, 0.16) 1.3px, transparent 1.3px);
    background-size: 14px 14px;
}

/* --- Panels: everything sits in a comic frame --- */
.panel {
    background: var(--white);
    border: var(--border);
    box-shadow: var(--shadow);
    border-radius: 6px;
}
.panel-tilt { transform: rotate(-1.2deg); transition: transform 0.2s ease; }
.panel-tilt:hover { transform: rotate(0deg); }

/* --- Buttons --- */
.btn {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-decoration: none;
    color: var(--ink);
    background: var(--gold);
    border: var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    padding: 0.65em 1.3em;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover {
    color: var(--ink);
    transform: translate(2px, 2px);
    box-shadow: 2px 2px 0 var(--ink);
}
.btn-primary { background: var(--gold); }
.btn-outline { background: var(--white); }
.btn-subscribe { background: var(--magenta); color: var(--white); }
.btn-subscribe:hover { color: var(--white); }

/* --- Header --- */
.site-header {
    background: var(--paper);
    border-bottom: var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-top: 14px;
    padding-bottom: 14px;
}
.site-logo { text-decoration: none; }
.site-logo img { max-height: 48px; }
.site-logo-text {
    font-family: var(--font-display);
    font-size: 1.5rem;
    color: var(--ink);
    text-shadow: 3px 3px 0 var(--gold);
    letter-spacing: 0.01em;
}
.site-nav { display: flex; align-items: center; gap: 22px; }
.site-nav .nav {
    display: flex;
    gap: 22px;
    list-style: none;
}
.site-nav .nav a {
    font-weight: 800;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-decoration: none;
    color: var(--ink);
    padding-bottom: 2px;
    border-bottom: 3px solid transparent;
}
.site-nav .nav a:hover { border-bottom-color: var(--magenta); }
.nav-toggle { display: none; }

/* --- Hero --- */
.hero { background-color: var(--teal); border-bottom: var(--border); }
.hero-inner {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: 48px;
    padding-top: 72px;
    padding-bottom: 72px;
}
.hero-kicker {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 0.85rem;
    text-transform: uppercase;
    background: var(--gold);
    border: var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-sm);
    padding: 0.3em 1em;
    margin-bottom: 18px;
}
.hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw, 4.2rem);
    line-height: 1.02;
    color: var(--white);
    text-shadow: 4px 4px 0 var(--ink), 8px 8px 0 var(--magenta);
    margin-bottom: 14px;
}
.hero-tagline {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--gold-light);
    text-shadow: 2px 2px 0 var(--ink);
    margin-bottom: 14px;
}
.hero-desc {
    color: var(--white);
    font-weight: 600;
    max-width: 46ch;
    margin-bottom: 26px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-art img {
    border: var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow);
}

/* --- Sections --- */
.site-main section { padding: 56px 0; }
.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3.5vw, 2.1rem);
    text-shadow: 3px 3px 0 var(--gold-light);
    margin-bottom: 24px;
}
.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.section-more {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    text-decoration: none;
}

/* --- Timeline --- */
.timeline { background: var(--paper); }
.timeline-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 22px;
    list-style: none;
    counter-reset: none;
}
.timeline-strip .panel { padding: 22px; }
.timeline-strip .panel:nth-child(odd) { transform: rotate(-1deg); }
.timeline-strip .panel:nth-child(even) { transform: rotate(1deg); }
.timeline-year {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--white);
    background: var(--teal-deep);
    border: var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow-sm);
    padding: 0.1em 0.5em;
    margin-bottom: 12px;
}
.timeline-strip p { font-size: 0.95rem; }

/* --- Post cards --- */
.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}
.post-card { overflow: hidden; display: flex; flex-direction: column; }
.post-card-image { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: var(--border); }
.post-card-body { padding: 20px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card-tag {
    align-self: flex-start;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--white);
    background: var(--magenta);
    border: 2px solid var(--ink);
    border-radius: 999px;
    padding: 0.15em 0.8em;
}
.post-card-title { font-family: var(--font-display); font-size: 1.15rem; line-height: 1.25; }
.post-card-title a { color: var(--ink); text-decoration: none; }
.post-card-title a:hover { color: var(--teal-deep); }
.post-card-excerpt { font-size: 0.92rem; }
.post-card-meta {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(29, 22, 16, 0.65);
}

/* --- Gallery --- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 28px;
}
.gallery-card {
    position: relative;
    overflow: hidden;
    text-decoration: none;
    transition: transform 0.15s ease;
}
.gallery-card:hover { transform: rotate(-1deg) scale(1.01); }
.gallery-card-image { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.gallery-card-placeholder {
    display: grid;
    place-items: center;
    aspect-ratio: 1 / 1;
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--magenta);
    background: var(--gold-light);
}
.gallery-card-title {
    display: block;
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--ink);
    background: var(--gold);
    border-top: var(--border);
    padding: 10px 14px;
}

/* --- Newsletter CTA --- */
.newsletter-cta { background-color: var(--teal); border-top: var(--border); border-bottom: var(--border); }
.newsletter-panel {
    background: var(--magenta);
    color: var(--white);
    text-align: center;
    padding: 44px 32px;
}
.newsletter-panel h2 {
    font-family: var(--font-display);
    font-size: 1.7rem;
    text-shadow: 3px 3px 0 var(--ink);
    margin-bottom: 10px;
}
.newsletter-panel p { max-width: 52ch; margin: 0 auto 22px; font-weight: 600; }

/* --- List page headers --- */
.page-head {
    background: var(--teal);
    border-bottom: var(--border);
    padding: 48px 0 !important;
}
.page-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3rem);
    color: var(--white);
    text-shadow: 3px 3px 0 var(--ink), 6px 6px 0 var(--magenta);
}
.page-subtitle { color: var(--white); font-weight: 600; margin-top: 10px; }

/* --- Articles --- */
.article-header { max-width: 860px; padding-top: 56px; text-align: center; }
.article-header .article-title {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4.5vw, 2.8rem);
    line-height: 1.1;
    text-shadow: 3px 3px 0 var(--gold-light);
    margin: 14px 0;
}
.article-excerpt { font-size: 1.1rem; font-weight: 600; color: rgba(29, 22, 16, 0.75); }
.article-meta { margin-top: 14px; font-size: 0.85rem; font-weight: 700; color: rgba(29, 22, 16, 0.6); }
.article-meta .reading-time::before { content: "·"; margin: 0 8px; }
.article-tag {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--white);
    background: var(--teal-deep);
    border: 2px solid var(--ink);
    border-radius: 999px;
    padding: 0.2em 0.9em;
    text-decoration: none;
}
.article-image { max-width: 860px; margin: 36px auto; }
.article-image img { border: var(--border); border-radius: 6px; box-shadow: var(--shadow); }
.article-image figcaption { font-size: 0.85rem; text-align: center; margin-top: 12px; color: rgba(29, 22, 16, 0.65); }
.article-footer { max-width: 860px; padding-bottom: 56px; }
.article-tags { display: flex; gap: 10px; flex-wrap: wrap; margin: 28px 0; }
.article-cta { margin-top: 28px; padding: 32px; }

/* --- Ghost content (.gh-content wraps {{content}}) --- */
.gh-content { max-width: 720px; padding-top: 8px; padding-bottom: 40px; }
.gh-content > * + * { margin-top: 1.2em; }
.gh-content h2, .gh-content h3 {
    font-family: var(--font-display);
    line-height: 1.2;
    margin-top: 1.8em;
}
.gh-content h2 { font-size: 1.5rem; text-shadow: 2px 2px 0 var(--gold-light); }
.gh-content h3 { font-size: 1.2rem; }
.gh-content blockquote {
    border-left: 6px solid var(--gold);
    background: var(--white);
    border-top: 2px solid var(--ink);
    border-right: 2px solid var(--ink);
    border-bottom: 2px solid var(--ink);
    padding: 16px 20px;
    font-style: italic;
}
.gh-content img { border: var(--border); border-radius: 6px; box-shadow: var(--shadow-sm); }
.gh-content .kg-width-wide { max-width: 1000px; margin-left: 50%; transform: translateX(-50%); width: calc(100vw - 48px); }
.gh-content .kg-width-full { max-width: none; margin-left: 50%; transform: translateX(-50%); width: calc(100vw - 48px); }
.gh-content pre {
    background: var(--ink);
    color: var(--paper);
    border-radius: 6px;
    padding: 16px;
    overflow-x: auto;
}
.gh-content ul, .gh-content ol { padding-left: 1.4em; }
.gh-content hr {
    border: none;
    border-top: 3px dashed var(--ink);
    margin: 2em 0;
}

/* --- Pagination --- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 0 24px 56px;
}
.pagination-page { font-weight: 800; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.06em; }

/* --- Error page --- */
.error-page { text-align: center; padding: 96px 24px !important; }
.error-burst {
    display: inline-block;
    font-family: var(--font-display);
    font-size: 3rem;
    color: var(--white);
    background: var(--magenta);
    border: var(--border);
    box-shadow: var(--shadow);
    border-radius: 6px;
    padding: 0.2em 0.6em;
    transform: rotate(-4deg);
    margin-bottom: 28px;
}
.error-page .page-title { color: var(--ink); text-shadow: 3px 3px 0 var(--gold-light); }
.error-page .page-subtitle { color: rgba(29, 22, 16, 0.7); margin-bottom: 28px; }

/* --- Empty states --- */
.empty-note { padding: 28px; font-weight: 600; }
.empty-note code { background: var(--gold-light); padding: 0.1em 0.4em; border-radius: 4px; }

/* --- Footer --- */
.site-footer {
    background: var(--ink);
    color: var(--paper);
    border-top: 6px solid var(--gold);
    padding: 44px 0;
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    gap: 32px;
    flex-wrap: wrap;
}
.footer-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    text-shadow: 2px 2px 0 var(--magenta);
}
.footer-blurb p { max-width: 44ch; margin-top: 8px; font-size: 0.9rem; opacity: 0.85; }
.footer-meta { font-size: 0.85rem; text-align: right; }
.footer-meta a { color: var(--gold-light); }
.footer-meta p + p { margin-top: 6px; }

/* --- Responsive --- */
@media (max-width: 900px) {
    .hero-inner { grid-template-columns: 1fr; gap: 32px; padding-top: 48px; padding-bottom: 48px; }
    .post-grid, .gallery-grid, .timeline-strip { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 620px) {
    .post-grid, .gallery-grid, .timeline-strip { grid-template-columns: 1fr; }
    .footer-meta { text-align: left; }

    .nav-toggle {
        display: flex;
        flex-direction: column;
        gap: 5px;
        background: var(--gold);
        border: var(--border);
        border-radius: 6px;
        box-shadow: var(--shadow-sm);
        padding: 10px 9px;
        cursor: pointer;
    }
    .nav-toggle span { width: 22px; height: 3px; background: var(--ink); }
    .site-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        align-items: flex-start;
        background: var(--paper);
        border-bottom: var(--border);
        padding: 20px 24px;
    }
    .site-nav .nav { flex-direction: column; gap: 14px; }
    body.nav-open .site-nav { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
