/* ── Makima Blog ────────────────────────────────────────────────
   quiet design for loud thoughts
   ────────────────────────────────────────────────────────────── */

/* Google Fonts via China-compatible mirror, with fallback */
@import url('https://fonts.loli.net/css2?family=Inter:wght@300;400;500;600&family=Lora:ital,wght@0,400;0,600;1,400&family=JetBrains+Mono:wght@400&family=Noto+Serif+SC:wght@400;600;700&display=swap');

:root {
    --bg: #ede8e0;
    --bg-card: #f4f0e9;
    --bg-hover: #e6e0d6;
    --text: #3d3529;
    --text-dim: #7d7264;
    --text-muted: #a89d8e;
    --text-bright: #2a2118;
    --accent: #b87736;
    --accent-soft: #c98a45;
    --accent-dim: #956230;
    --accent-glow: rgba(184, 119, 54, 0.08);
    --accent-glow-strong: rgba(184, 119, 54, 0.14);
    --border: #d9d1c4;
    --border-hover: #cbc2b3;
    --font-body: 'Lora', Georgia, serif;
    --font-ui: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --max-width: 680px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.8;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Nav ─────────────────────────────────────────────────────── */
nav {
    font-family: var(--font-ui);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.75rem 2rem;
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
}

.logo {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: opacity 0.25s var(--ease-out);
}

.logo:hover { opacity: 0.7; }

.nav-links {
    display: flex;
    gap: 1.75rem;
    align-items: center;
}

.nav-links a {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-decoration: none;
    text-transform: lowercase;
    letter-spacing: 0.06em;
    transition: color 0.25s var(--ease-out);
}

.nav-links a:hover { color: var(--accent); }

/* ── Main ────────────────────────────────────────────────────── */
main {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem 5rem;
    width: 100%;
    flex: 1;
}

/* ── Back link ───────────────────────────────────────────────── */
.back {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    color: var(--text-dim);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 2.5rem;
    letter-spacing: 0.04em;
    transition: color 0.25s var(--ease-out);
}

.back:hover { color: var(--accent); }

/* ── Index ───────────────────────────────────────────────────── */
.intro {
    margin-bottom: 3.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}

.intro h1 {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--accent);
    margin-bottom: 1rem;
    letter-spacing: 0.01em;
}

.tagline {
    font-size: 0.88rem;
    color: var(--text-dim);
    line-height: 1.7;
    max-width: 520px;
}

.subscribe {
    margin-top: 1rem;
    font-family: var(--font-ui);
    font-size: 0.72rem;
}

.subscribe a {
    color: var(--text-dim);
    text-decoration: none;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
    transition: all 0.25s var(--ease-out);
}

.subscribe a:hover {
    color: var(--accent);
    border-color: var(--accent-dim);
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.empty {
    color: var(--text-dim);
    font-style: italic;
    font-size: 0.88rem;
}

/* ── Post card (index) ───────────────────────────────────────── */
.post-card {
    display: block;
    text-decoration: none;
    padding: 1.25rem 1.25rem;
    border-radius: 8px;
    transition: all 0.25s var(--ease-out);
    border: 1px solid transparent;
}

.post-card:hover {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75em;
    margin-bottom: 0.3rem;
}

.post-card time {
    font-family: var(--font-ui);
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.post-card .tw {
    font-family: var(--font-ui);
    font-size: 0.62rem;
    color: var(--accent-dim);
    background: var(--accent-glow);
    padding: 0.15em 0.5em;
    border-radius: 3px;
    letter-spacing: 0.06em;
    text-transform: lowercase;
}

.post-card h2 {
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--text);
    line-height: 1.4;
    margin-bottom: 0.3rem;
    transition: color 0.2s var(--ease-out);
}

.post-card:hover h2 { color: var(--accent-dim); }

.post-card .excerpt {
    font-size: 0.78rem;
    color: var(--text-dim);
    line-height: 1.55;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Post ────────────────────────────────────────────────────── */
.post header {
    margin-bottom: 3rem;
    padding-bottom: 1.75rem;
    border-bottom: 1px solid var(--border);
}

.post header time {
    font-family: var(--font-ui);
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    display: block;
    margin-bottom: 0.2rem;
}

.themeword {
    font-family: var(--font-ui);
    font-size: 0.66rem;
    color: var(--accent);
    letter-spacing: 0.1em;
    text-transform: lowercase;
    display: inline-block;
    margin-bottom: 0.75rem;
}

.reading-time {
    font-family: var(--font-ui);
    font-size: 0.66rem;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    margin-left: 1rem;
}

.post header h1 {
    font-size: 1.6rem;
    font-weight: 400;
    color: var(--text-bright);
    line-height: 1.3;
}

/* ── Prose ───────────────────────────────────────────────────── */
.prose { font-size: 1rem; }

.prose p { margin-bottom: 1.4rem; }

.prose h2 {
    font-size: 1.15rem;
    font-weight: 400;
    color: var(--text-bright);
    margin: 3rem 0 1rem;
    letter-spacing: 0.01em;
}

.prose h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-bright);
    margin: 2rem 0 0.75rem;
}

.prose em {
    color: var(--accent);
    font-style: italic;
}

.prose strong {
    color: var(--text-bright);
    font-weight: 600;
}

.prose a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: var(--accent-dim);
    transition: text-decoration-color 0.2s;
}

.prose a:hover { text-decoration-color: var(--accent); }

.prose code {
    font-family: var(--font-mono);
    font-size: 0.82em;
    background: #f0e9de;
    padding: 0.15em 0.4em;
    border-radius: 3px;
    color: var(--accent-dim);
}

.prose pre {
    background: #f5efe6;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.prose pre code {
    background: none;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1.6;
    color: var(--text);
}

.prose blockquote {
    border-left: 2px solid var(--accent);
    padding-left: 1.25rem;
    margin: 1.5rem 0;
    color: var(--text-dim);
    font-style: italic;
}

.prose ul, .prose ol { margin: 1rem 0 1.5rem 1.5rem; }
.prose li { margin-bottom: 0.5rem; }

.prose hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 3rem 0;
}

/* ── Footer ──────────────────────────────────────────────────── */
footer {
    font-family: var(--font-ui);
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-voice {
    font-size: 0.68rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

.footer-links {
    display: flex;
    gap: 1.25rem;
}

.footer-links a {
    font-size: 0.68rem;
    color: var(--text-dim);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--accent); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 600px) {
    html { font-size: 16px; }
    main { padding: 0 1.25rem 3rem; }
    nav { padding: 1.25rem; gap: 0.75rem; }
    .nav-links { gap: 0.75rem; }
    .nav-links a, .nav-lang, .nav-sep { font-size: 0.65rem; }
    .logo { font-size: 0.8rem; }
    .footer-inner { flex-direction: column; gap: 0.75rem; text-align: center; }
    .intro h1 { font-size: 1.25rem; }
    .post header h1 { font-size: 1.3rem; }
}

/* ── Selection ──────────────────────────────────────────────── */
::selection {
    background: rgba(193, 127, 62, 0.18);
    color: var(--text-bright);
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Chinese / CJK Typography ──────────────────────────────── */
html[lang="zh"] body,
html[lang="zh-CN"] body,
html[lang="zh-TW"] body {
    font-family: 'Noto Serif SC', 'Songti SC', 'SimSun', serif;
    line-height: 2;
    letter-spacing: 0.02em;
}

html[lang="zh"] .prose,
html[lang="zh-CN"] .prose,
html[lang="zh-TW"] .prose {
    font-size: 1rem;
    text-align: justify;
    word-break: break-all;
}

html[lang="zh"] .prose p,
html[lang="zh-CN"] .prose p {
    margin-bottom: 1.6rem;
    text-indent: 2em;
}

html[lang="zh"] .prose h2,
html[lang="zh-CN"] .prose h2 {
    font-family: 'Noto Serif SC', 'Songti SC', serif;
    font-weight: 700;
    margin: 3rem 0 1.2rem;
    text-indent: 0;
}

html[lang="zh"] .prose h3,
html[lang="zh-CN"] .prose h3 {
    font-family: 'Noto Serif SC', 'Songti SC', serif;
    font-weight: 600;
    text-indent: 0;
}

html[lang="zh"] .prose blockquote,
html[lang="zh-CN"] .prose blockquote {
    text-indent: 0;
}

html[lang="zh"] .prose li,
html[lang="zh-CN"] .prose li {
    text-indent: 0;
}

html[lang="zh"] .post header h1,
html[lang="zh-CN"] .post header h1 {
    font-family: 'Noto Serif SC', 'Songti SC', serif;
    font-weight: 700;
    line-height: 1.5;
}

html[lang="zh"] .intro h1,
html[lang="zh-CN"] .intro h1 {
    font-family: 'Noto Serif SC', 'Songti SC', serif;
}

/* Language badge */
.lang-badge {
    font-family: var(--font-ui);
    font-size: 0.58rem;
    color: var(--text-muted);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    padding: 0.1em 0.45em;
    border-radius: 3px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: inline-block;
}

/* Language switcher (on post pages) */
.lang-switch {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    color: var(--accent);
    text-decoration: none;
    letter-spacing: 0.04em;
    display: inline-block;
    margin-left: 1rem;
    border-bottom: 1px solid var(--accent-dim);
    padding-bottom: 1px;
    transition: border-color 0.2s;
}
.lang-switch:hover { border-color: var(--accent); }

/* Language pills (on index cards) */
.lang-pills {
    display: inline-flex;
    gap: 0.35em;
    margin-left: 0.5em;
}

.lang-pill {
    font-family: var(--font-ui);
    font-size: 0.58rem;
    color: var(--text-dim);
    background: var(--bg-hover);
    border: 1px solid var(--border);
    padding: 0.1em 0.45em;
    border-radius: 3px;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: color 0.2s, border-color 0.2s;
}

.lang-pill.active {
    color: var(--accent-dim);
    border-color: var(--accent-dim);
}

.lang-pill:hover {
    color: var(--accent);
    border-color: var(--accent);
}

/* Nav language switcher */
.nav-sep {
    color: var(--text-muted);
    font-size: 0.72rem;
    margin: 0 0.25rem;
}

.nav-lang {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    color: var(--text-dim);
    text-decoration: none;
    letter-spacing: 0.04em;
    transition: color 0.2s;
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

.nav-lang:hover {
    color: var(--accent);
}

.nav-lang[data-lang="zh"] {
    font-family: 'Noto Serif SC', var(--font-ui);
}

/* Post navigation (prev/next) */
.post-nav {
    font-family: var(--font-ui);
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.post-nav a {
    font-size: 0.78rem;
    color: var(--text-dim);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.2s;
    max-width: 45%;
    line-height: 1.5;
}

.post-nav a:hover { color: var(--accent); }

.post-nav-prev { text-align: left; }
.post-nav-next { text-align: right; margin-left: auto; }

/* ── Dark Mode ─────────────────────────────────────────────── */
[data-theme="dark"] {
    --bg: #1a1916;
    --bg-card: #21201c;
    --bg-hover: #282723;
    --text: #c4bfb5;
    --text-dim: #8a8478;
    --text-muted: #5a554b;
    --text-bright: #e8e4dc;
    --accent: #d4a060;
    --accent-soft: #e0b375;
    --accent-dim: #a07a3a;
    --accent-glow: rgba(212, 160, 96, 0.08);
    --accent-glow-strong: rgba(212, 160, 96, 0.14);
    --border: #2e2d28;
    --border-hover: #3d3b34;
}

[data-theme="dark"] .prose code {
    background: #252420;
}

[data-theme="dark"] .prose pre {
    background: #1f1e1a;
}

[data-theme="dark"] ::selection {
    background: rgba(212, 160, 96, 0.25);
}

/* Smooth theme transition */
body,
body * {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* ── Theme Toggle Button ───────────────────────────────────── */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    color: var(--text-dim);
    padding: 0.2em 0.35em;
    border-radius: 4px;
    transition: color 0.2s;
    line-height: 1;
    vertical-align: middle;
}

.theme-toggle:hover {
    color: var(--accent);
}
