/* ============================================================================
 * nika-default — standard reusable editorial blog template.
 *
 * REUSE MODEL: layout below is fixed/standard. To re-skin for another
 * client, change ONLY the BRAND block (or, preferred, inject it per
 * client without forking the theme):
 *     scripts/deploy_ghost_theme.py --client <id> --brand "#0f5132"
 * which stamps a :root{} override into that blog's codeinjection_head.
 * Defaults below are MÛRIA's signed-off coffee/cream identity.
 * ========================================================================== */

:root {
    /* ===== BRAND — the ONLY per-site change ============================== */
    --brand:        #7a5a32;   /* primary: links, eyebrow, accents, buttons */
    --brand-soft:   #a07a4a;   /* lighter accent: dot, eyebrow, table rule  */
    --bg:           #faf7f1;   /* page background                           */
    --surface:      #ffffff;   /* cards                                     */
    --bg-soft:      #f4ecdc;   /* hero / table head / quote / avatar        */
    --line:         #ebe2cf;   /* borders, dividers                         */
    --ink:          #2b2620;   /* headings, strong text                     */
    --ink-soft:     #3d3528;   /* lede, lists, answers                      */
    --muted:        #7a6f5f;   /* meta, captions                            */
    --font-display: "Source Serif Pro", "Noto Serif TC", Georgia, "Songti TC", serif;
    --font-body:    -apple-system, BlinkMacSystemFont, "PingFang TC",
                    "Noto Sans TC", "Microsoft JhengHei", "Helvetica Neue",
                    Arial, sans-serif;
    /* ===== /BRAND ======================================================= */

    /* Standard scale — do not edit per client */
    --radius: 10px;
    --reading: 720px;          /* article column   */
    --wide: 1100px;            /* header/feed/foot  */
    --gap: clamp(20px, 4vw, 32px);
    --shadow: 0 14px 40px -12px rgba(43, 38, 32, .18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--bg);
    line-height: 1.75;
    font-size: 17px;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; transition: opacity .15s ease, border-color .15s ease; }
a:hover { opacity: .72; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--brand); outline-offset: 3px; border-radius: 3px; }
img { max-width: 100%; height: auto; display: block; }
::selection { background: var(--bg-soft); color: var(--ink); }

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

/* ---------- Header — blurred bar, brand dot + display wordmark ---------- */
.site-header {
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    backdrop-filter: saturate(180%) blur(8px);
    position: sticky; top: 0; z-index: 50;
}

.header-inner {
    max-width: var(--wide); margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    height: 66px; padding: 0 24px; gap: 24px;
}

.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand::before {
    content: ""; width: 10px; height: 10px; border-radius: 50%;
    background: var(--brand-soft); flex: none;
}
.brand-logo { max-height: 34px; width: auto; }
.brand-title {
    font-family: var(--font-display);
    font-size: 1.05rem; font-weight: 600;
    color: var(--ink); letter-spacing: 0.2em;
}

.site-nav ul { list-style: none; display: flex; gap: 24px; margin: 0; padding: 0; }
.site-nav a { color: var(--muted); font-size: 0.88rem; letter-spacing: .02em; }
.site-nav a:hover { color: var(--brand); opacity: 1; }

/* ---------- Home / Archive ---------- */
.home-cover img { max-width: var(--wide); margin: 36px auto 0; border-radius: var(--radius); }

.home-intro {
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 2.4vw, 1.4rem);
    line-height: 1.6; color: var(--ink-soft);
    max-width: var(--reading); margin: 52px auto 4px; padding: 0 24px;
}

.archive-header, .author-header {
    max-width: var(--reading); margin: 0 auto;
    padding: 56px 24px 20px; border-bottom: 1px solid var(--line);
}
.archive-header h1 {
    font-family: var(--font-display); font-size: clamp(1.9rem, 4vw, 2.6rem);
    font-weight: 600; letter-spacing: -.012em; margin: 0 0 8px;
}
.archive-description { color: var(--muted); margin: 0; }
.author-header { display: flex; flex-direction: column; align-items: center; text-align: center; }
.author-avatar { width: 84px; height: 84px; border-radius: 50%; margin-bottom: 14px; }

/* Blog hero (DemoBlogPreviewPage) */
.blog-hero { max-width: var(--wide); margin: 0 auto; padding: 64px 24px 48px; }
.blog-hero-eyebrow {
    color: var(--brand-soft); font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .24em; margin: 0 0 16px;
}
.blog-hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 600;
    line-height: 1.1; letter-spacing: -.01em; color: var(--ink);
    margin: 0 0 22px; max-width: 18ch;
}
.blog-hero-lede {
    font-size: clamp(1.05rem, 2.2vw, 1.2rem); line-height: 1.7;
    color: var(--ink-soft); max-width: 42rem; margin: 0;
}

/* Featured card — 2-col image | body */
.featured-wrap { max-width: var(--wide); margin: 0 auto; padding: 0 24px 56px; }
.featured-card {
    display: block; border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; background: var(--surface);
    transition: transform .3s ease, box-shadow .3s ease;
}
.featured-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); opacity: 1; }
.featured-grid { display: grid; grid-template-columns: 1fr 1fr; }
.featured-media { background: var(--bg-soft); overflow: hidden; aspect-ratio: 4/3; }
.featured-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s ease; }
.featured-card:hover .featured-media img { transform: scale(1.05); }
.featured-body { padding: clamp(28px, 5vw, 56px); display: flex; flex-direction: column; justify-content: center; }
.featured-eyebrow {
    color: var(--brand-soft); font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .18em; margin: 0 0 14px;
}
.featured-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 600;
    line-height: 1.3; color: var(--ink); margin: 0 0 16px;
}
.featured-excerpt { color: var(--ink-soft); font-size: 1rem; line-height: 1.7; margin: 0 0 24px; }
.featured-cta {
    align-self: flex-start; color: var(--brand); font-size: .9rem; font-weight: 600;
    border-bottom: 1px solid var(--brand-soft); padding-bottom: 4px;
}

/* "更多文章" divider */
.more-divider {
    max-width: var(--wide); margin: 0 auto; padding: 0 24px 28px;
    display: flex; align-items: center; gap: 16px;
    color: var(--brand-soft); font-size: .72rem;
    text-transform: uppercase; letter-spacing: .24em;
}
.more-divider i { flex: 1; height: 1px; background: var(--line); }

/* Borderless article grid */
.post-feed {
    max-width: var(--wide); margin: 0 auto;
    display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: clamp(28px, 4vw, 44px); padding: 0 24px 80px;
}
.grid-card { display: block; }
.grid-card:hover { opacity: 1; }
.grid-card-media {
    aspect-ratio: 4/3; border-radius: var(--radius);
    overflow: hidden; background: var(--bg-soft); margin-bottom: 16px;
}
.grid-card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .7s ease; }
.grid-card:hover .grid-card-media img { transform: scale(1.05); }
.grid-card-eyebrow {
    color: var(--brand-soft); font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .18em; margin: 0 0 8px;
}
.grid-card-title {
    font-family: var(--font-display); font-size: 1.25rem; font-weight: 600;
    line-height: 1.35; color: var(--ink); margin: 0 0 10px;
    transition: color .15s ease;
}
.grid-card:hover .grid-card-title { color: var(--brand); }
.grid-card-excerpt { color: var(--muted); font-size: .92rem; line-height: 1.65; margin: 0; }

/* Newsletter */
.newsletter { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.newsletter-inner { max-width: var(--wide); margin: 0 auto; padding: 72px 24px; text-align: center; }
.newsletter-icon { color: var(--brand-soft); margin: 0 auto 16px; display: block; }
.newsletter-title { font-family: var(--font-display); font-size: clamp(1.6rem, 3.5vw, 2.1rem); font-weight: 600; margin: 0 0 12px; color: var(--ink); }
.newsletter-copy { color: var(--ink-soft); font-size: 1rem; max-width: 30rem; margin: 0 auto 26px; }
.newsletter-btn {
    display: inline-block; background: var(--brand); color: var(--surface);
    font-size: .92rem; font-weight: 600; padding: 13px 30px; border-radius: 999px;
    transition: transform .15s ease, box-shadow .15s ease;
}
.newsletter-btn:hover { opacity: 1; transform: translateY(-1px); box-shadow: var(--shadow); }
.newsletter-fineprint { color: var(--muted); font-size: .76rem; margin: 18px 0 0; }

@media (max-width: 720px) {
    .featured-grid { grid-template-columns: 1fr; }
    .featured-media { aspect-ratio: 16/9; }
}

/* ---------- Pagination ---------- */
.pagination { text-align: center; padding: 8px 0 72px; font-size: .92rem; color: var(--muted); }
.pagination a {
    display: inline-block; padding: 8px 16px; margin: 0 6px;
    border: 1px solid var(--line); border-radius: 999px; color: var(--ink);
}
.pagination a:hover { border-color: var(--brand); color: var(--brand); opacity: 1; }

/* ---------- Single post — narrow editorial column ---------- */
.post-container { max-width: var(--reading); padding: 0 24px; }

.post-header { padding: 56px 0 0; }
.post-eyebrow, .post-tag {
    display: inline-block; color: var(--brand-soft);
    font-size: 0.72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.24em; margin: 0 0 14px;
}
.post-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.1rem); font-weight: 600;
    line-height: 1.14; letter-spacing: -.014em; color: var(--ink); margin: 0 0 22px;
}
.post-excerpt {
    font-family: var(--font-display); color: var(--ink-soft);
    font-size: clamp(1.1rem, 2.4vw, 1.3rem); line-height: 1.6; margin: 0 0 18px;
}
.post-meta {
    color: var(--muted); font-size: 0.8rem; letter-spacing: .03em;
    display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 44px;
}
.post-author { font-weight: 600; }

.post-feature-image { margin: 0 0 44px; }
.post-feature-image img {
    border-radius: var(--radius); aspect-ratio: 16/9;
    object-fit: cover; width: 100%;
}
.post-feature-image figcaption {
    color: var(--muted); font-size: 0.8rem; text-align: center; margin-top: 10px;
}

/* ---------- Post body — sans body + display headings, airy rhythm ------- */
.post-content { font-size: 1.075rem; line-height: 1.85; color: var(--ink); }
.post-content > *:first-child { margin-top: 0; }
.post-content h2, .post-content h3, .post-content h4 {
    font-family: var(--font-display); font-weight: 600; color: var(--ink);
    line-height: 1.25; margin: 2.4em 0 .6em;
}
.post-content h2 { font-size: clamp(1.5rem, 3.2vw, 2rem); }
.post-content h3 { font-size: 1.32rem; color: var(--brand); }
.post-content p { margin: 1.05em 0; }
.post-content ul, .post-content ol { padding-left: 1.4em; margin: 1.05em 0; }
.post-content li { margin: .45em 0; color: var(--ink-soft); }
.post-content strong { color: var(--ink); }
.post-content hr { border: 0; border-top: 1px solid var(--line); margin: 2.6em 0; }

.post-content blockquote {
    font-family: var(--font-display); font-style: italic;
    font-size: 1.15rem; color: var(--ink-soft);
    border-left: 3px solid var(--brand-soft);
    background: var(--bg-soft); border-radius: 0 8px 8px 0;
    margin: 32px 0; padding: 14px 26px;
}
.post-content blockquote p { margin: .4em 0; }

.post-content a {
    color: var(--brand);
    border-bottom: 1px solid color-mix(in srgb, var(--brand) 38%, transparent);
}
.post-content a:hover { opacity: 1; border-bottom-color: var(--brand); }
.post-content a.m2-internal { border-bottom: 1px dotted var(--brand); }

.post-content table {
    width: 100%; border-collapse: collapse; margin: 34px 0;
    font-size: 0.93rem; border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden;
}
.post-content th {
    background: var(--bg-soft); color: var(--brand); text-align: left;
    font-weight: 700; text-transform: uppercase;
    font-size: 0.7rem; letter-spacing: .06em;
    padding: 13px 16px; border-bottom: 2px solid var(--brand-soft);
}
.post-content td { padding: 13px 16px; border-bottom: 1px solid var(--line); }
.post-content tbody tr:nth-child(even) { background: color-mix(in srgb, var(--bg-soft) 45%, var(--surface)); }
.post-content img { border-radius: var(--radius); margin: 30px auto; }
.post-content figure { margin: 30px 0; }
.post-content figcaption { color: var(--muted); font-size: .8rem; text-align: center; margin-top: 10px; }

.post-content code {
    background: var(--bg-soft); padding: 2px 7px;
    border-radius: 5px; font-size: .88em;
}
.post-content pre {
    background: var(--ink); color: var(--bg-soft);
    padding: 20px; border-radius: var(--radius);
    overflow-x: auto; margin: 28px 0; font-size: .9rem;
}
.post-content pre code { background: transparent; padding: 0; color: inherit; }

.post-tags {
    max-width: var(--reading); margin: 48px auto 0;
    padding: 26px 24px 0; border-top: 1px solid var(--line);
    display: flex; gap: 8px; flex-wrap: wrap;
}
.post-tags .post-tag {
    background: var(--bg-soft); color: var(--brand);
    padding: 5px 14px; border-radius: 999px;
    text-transform: none; letter-spacing: 0; margin: 0; font-size: .8rem;
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 52px 0; margin-top: 72px; }
.footer-inner {
    max-width: var(--wide); margin: 0 auto;
    display: flex; justify-content: space-between; align-items: center;
    gap: 16px; flex-wrap: wrap; color: var(--muted); font-size: .85rem;
}
.footer-copy {
    font-family: var(--font-display); font-size: 1rem;
    letter-spacing: .16em; color: var(--ink);
}
.footer-tagline { color: var(--muted); }

/* ---------- Error ---------- */
.error-container { text-align: center; padding: 110px 24px; }
.error-code { font-family: var(--font-display); font-size: 5.5rem; margin: 0 0 12px; color: var(--brand); }
.error-message { color: var(--muted); margin: 0 0 32px; font-size: 1.1rem; }
.error-home {
    display: inline-block; padding: 13px 26px;
    border: 1px solid var(--brand); border-radius: 999px; color: var(--brand);
}
.error-home:hover { background: var(--brand); color: var(--surface); opacity: 1; }

/* ---------- Responsive / a11y ---------- */
@media (max-width: 640px) {
    body { font-size: 16px; }
    .header-inner { height: auto; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 20px; }
    .site-nav ul { flex-wrap: wrap; gap: 14px; }
    .post-header { padding-top: 36px; }
    .footer-inner { flex-direction: column; align-items: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; scroll-behavior: auto !important; }
}
