/* jianxin — a reading-room theme. Paper and ink, with a cool NMIXX-ish accent. */

:root {
    --paper: #f7f4ee;
    --paper-2: #efeae0;
    --ink: #1d1b22;
    --ink-soft: #5b5763;
    --rule: #ddd6c9;
    --accent: #3b4fd8;
    --accent-2: #18b6c9;
    --accent-ink: #ffffff;
    --serif: var(--gh-font-heading, "Fraunces", Georgia, "Noto Serif TC", serif);
    --sans: var(--gh-font-body, "Inter", system-ui, -apple-system, "Noto Sans TC", sans-serif);
    --measure: 40rem;
    --wide: 68rem;
    --gutter: clamp(1rem, 4vw, 2rem);
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #15141a;
        --paper-2: #1d1c24;
        --ink: #ece8f1;
        --ink-soft: #a8a3b3;
        --rule: #2e2c38;
        --accent: #8d9bff;
        --accent-2: #5fd9e8;
        --accent-ink: #12121a;
        color-scheme: dark;
    }
}

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

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

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 400 1.0625rem/1.65 var(--sans);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-2); }

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

.site { min-height: 100vh; display: flex; flex-direction: column; }
.site-main { flex: 1; }

.wrap { width: 100%; max-width: var(--wide); margin: 0 auto; padding: 0 var(--gutter); }
.wrap-narrow { width: 100%; max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header-inner { display: flex; align-items: center; gap: 1.5rem; min-height: 4rem; flex-wrap: wrap; }
.site-title { font: 600 1.25rem/1 var(--serif); color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.site-nav { flex: 1; }
.site-nav ul, .site-footer ul { list-style: none; display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 0; padding: 0; }
.site-nav a, .site-footer a { color: var(--ink-soft); text-decoration: none; font-size: 0.9375rem; }
.site-nav a:hover, .site-nav .nav-current a { color: var(--ink); }

/* Buttons */
.btn {
    display: inline-block; padding: 0.7rem 1.2rem; border-radius: 999px;
    background: var(--accent); color: var(--accent-ink); text-decoration: none;
    font: 600 0.9375rem/1 var(--sans); border: 1px solid var(--accent);
}
.btn:hover { background: var(--accent-2); border-color: var(--accent-2); color: var(--accent-ink); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-soft); }
.btn-small { padding: 0.5rem 0.9rem; font-size: 0.875rem; }

/* Hero */
.hero { padding: clamp(3rem, 10vw, 7rem) 0 clamp(2rem, 6vw, 4rem); }
.hero-small { padding-bottom: 1.5rem; }
.kicker {
    display: inline-block; margin: 0 0 0.75rem; text-decoration: none;
    font: 600 0.75rem/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-title { font: 400 clamp(2.5rem, 8vw, 4.75rem)/1.02 var(--serif); letter-spacing: -0.03em; margin: 0 0 1rem; }
.hero-lede { font: 400 clamp(1.125rem, 2.4vw, 1.375rem)/1.5 var(--serif); color: var(--ink-soft); max-width: 36rem; margin: 0 0 2rem; }
.hero-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* Feed */
.feed { padding-bottom: 4rem; }
.section-label { font: 600 0.75rem/1 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); margin: 0 0 1rem; padding-top: 2rem; border-top: 1px solid var(--rule); }
.post-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.post-card-link { display: block; height: 100%; padding: 1.5rem; border-radius: 1rem; background: var(--paper-2); color: inherit; text-decoration: none; border: 1px solid transparent; transition: border-color .15s, transform .15s; }
.post-card-link:hover { border-color: var(--rule); transform: translateY(-2px); color: inherit; }
.post-card-tag { font: 600 0.75rem/1 var(--sans); color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }
.post-card-title { font: 600 1.375rem/1.2 var(--serif); margin: 0.6rem 0 0.5rem; letter-spacing: -0.01em; }
.post-card-excerpt { color: var(--ink-soft); margin: 0 0 1rem; font-size: 0.9375rem; }
.post-card-meta { color: var(--ink-soft); font-size: 0.8125rem; margin: 0; }
.empty { color: var(--ink-soft); }

.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 2rem; color: var(--ink-soft); font-size: 0.875rem; }

/* Article */
.article { padding: clamp(2.5rem, 8vw, 5rem) 0 3rem; }
.article-header { margin-bottom: 2.5rem; }
.article-title { font: 400 clamp(2.25rem, 6vw, 3.5rem)/1.08 var(--serif); letter-spacing: -0.025em; margin: 0 0 1rem; }
.article-lede { font: italic 400 1.25rem/1.5 var(--serif); color: var(--ink-soft); margin: 0 0 1rem; }
.article-meta { color: var(--ink-soft); font-size: 0.875rem; margin: 0; }
.article-image { margin: 0 auto 2.5rem; max-width: 62rem; }
.article-image img { border-radius: 1rem; width: 100%; }
.article-image figcaption, .gh-content figcaption { color: var(--ink-soft); font-size: 0.8125rem; text-align: center; margin-top: 0.6rem; }
.article-footer { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--rule); font-size: 0.875rem; }
/* Ghost's comments iframe is a light-scheme document. Under a dark parent the
   browser paints it an opaque white backdrop, hiding its (dark-mode) white
   text, so give the iframe a matching scheme to keep it transparent. */
.comments { margin-bottom: 4rem; color-scheme: light; }

/* Reading text */
.gh-content { font: 400 1.1875rem/1.75 var(--serif); }
.gh-content > * + * { margin-top: 1.4em; margin-bottom: 0; }
.gh-content h2 { font: 600 1.75rem/1.25 var(--serif); margin-top: 2.2em; }
.gh-content h3 { font: 600 1.375rem/1.3 var(--serif); margin-top: 2em; }
.gh-content hr { border: 0; text-align: center; margin: 2.5em 0; }
.gh-content hr::after { content: "* * *"; color: var(--ink-soft); letter-spacing: 0.6em; }
.gh-content blockquote { margin-left: 0; padding-left: 1.25rem; border-left: 3px solid var(--accent); color: var(--ink-soft); font-style: italic; }
.gh-content ul, .gh-content ol { padding-left: 1.4em; }
.gh-content li + li { margin-top: 0.4em; }
.gh-content table { width: 100%; border-collapse: collapse; font: 0.9375rem/1.5 var(--sans); }
.gh-content th, .gh-content td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.gh-content code { font-size: 0.85em; background: var(--paper-2); padding: 0.1em 0.35em; border-radius: 0.3em; }

/* Koenig editor cards (required by Ghost) */
.kg-width-wide { position: relative; width: min(85vw, 62rem); left: 50%; transform: translateX(-50%); }
.kg-width-full { position: relative; width: 100vw; left: 50%; transform: translateX(-50%); }
.kg-width-full img { border-radius: 0; }
.kg-image { margin: 0 auto; border-radius: 0.75rem; }

/* Footer */
.site-footer { border-top: 1px solid var(--rule); padding: 2rem 0; color: var(--ink-soft); font-size: 0.8125rem; }
.site-footer-inner { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center; }
.site-footer p { margin: 0; }

.error-page { padding: 6rem var(--gutter); }

@media (max-width: 640px) {
    .site-header-inner { gap: 0.75rem 1.25rem; padding-top: 0.75rem; padding-bottom: 0.75rem; }
    .site-nav { order: 3; flex-basis: 100%; }
}
