/* ===== Design Tokens ===== */
:root {
  --bg: #fafafa;
  --bg-white: #ffffff;
  --text: #1a1a2e;
  --heading: #0f2b46;
  --accent: #1b4f72;
  --accent-hover: #2471a3;
  --muted: #5d6d7e;
  --border: #e5e7eb;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-zh: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --max-width: 700px;
  --header-max: 960px;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ===== Base ===== */
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  min-height: 100vh;
}
body.lang-zh {
  font-family: var(--font-zh);
  letter-spacing: 0.03em;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-serif);
  color: var(--heading);
  line-height: 1.3;
  font-weight: 600;
}
body.lang-zh h1,
body.lang-zh h2,
body.lang-zh h3,
body.lang-zh h4,
body.lang-zh h5,
body.lang-zh h6 {
  font-family: var(--font-zh);
  font-weight: 700;
}
h1 { font-size: 1.75rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.3rem; margin-top: 2.5rem; margin-bottom: 1rem; }
h3 { font-size: 1.1rem; margin-top: 2rem; margin-bottom: 0.75rem; }
p { margin-bottom: 1rem; }
a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}
a:hover { color: var(--accent-hover); text-decoration: underline; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: 0.4rem; }
strong { font-weight: 600; }
hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem 0;
}
blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--muted);
  margin: 1.5rem 0;
}
code {
  font-size: 0.9em;
  background: #f0f0f0;
  padding: 0.15em 0.4em;
  border-radius: 3px;
}
pre {
  background: #f4f4f4;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
}
pre code { background: none; padding: 0; }

/* ===== Layout Shell ===== */
.site-frame {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.site-header {
  border-bottom: 1px solid var(--border);
}
.site-main {
  flex: 1;
  padding: 3.5rem 1.5rem 3rem;
}
.site-main__inner {
  max-width: var(--max-width);
  margin: 0 auto;
}
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  text-align: center;
}

/* ===== Header ===== */
.header-inner {
  max-width: var(--header-max);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--heading);
  text-decoration: none;
}
body.lang-zh .site-name {
  font-family: var(--font-zh);
  font-weight: 700;
}
.site-name:hover { color: var(--accent); text-decoration: none; }
.primary-nav ul {
  list-style: none;
  display: flex;
  gap: 1.75rem;
  align-items: center;
  padding: 0;
  margin: 0;
}
.primary-nav a {
  font-size: 0.95rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}
.primary-nav a:hover { color: var(--accent); text-decoration: none; }
.lang-toggle a {
  font-size: 0.85rem;
  color: var(--muted);
  border: 1px solid var(--border);
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  transition: all 0.15s ease;
}
.lang-toggle a:hover {
  color: var(--accent);
  border-color: var(--accent);
  text-decoration: none;
}

/* ===== Hero (Homepage) ===== */
.hero {
  text-align: center;
  padding: 2rem 1rem 1rem;
}
.hero-inner {
  max-width: 560px;
  margin: 0 auto;
}
.hero-avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1.75rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}
.hero-name {
  font-family: var(--font-serif);
  font-size: 2.25rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 0.5rem;
}
body.lang-zh .hero-name {
  font-family: var(--font-zh);
}
.hero-title {
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 1.25rem;
}
.hero-bio {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.75;
  margin-bottom: 2rem;
}
.hero-links {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.hero-btn {
  display: inline-block;
  padding: 0.6rem 1.75rem;
  border: 1px solid var(--accent);
  border-radius: 4px;
  color: var(--accent);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}
.hero-btn:hover {
  background: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* ===== Page Content ===== */
.page h1 {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.page-body h2 {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.page-body ul {
  list-style: none;
  padding-left: 0;
}
.page-body ul li {
  padding: 0.3rem 0;
}

/* ===== Blog Sections ===== */
.blog-section {
  margin-bottom: 2.5rem;
}
.blog-section:last-child { margin-bottom: 0; }
.blog-category {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent);
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent);
}

/* ===== Blog List ===== */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.post-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--border);
}
.post-item:first-child { padding-top: 0; }
.post-item time {
  font-size: 0.85rem;
  color: var(--muted);
}
.post-item h2,
.post-item h3 {
  font-size: 1.15rem;
  margin: 0.35rem 0 0.5rem;
  border: none;
  padding: 0;
}
.post-item h2 a,
.post-item h3 a {
  color: var(--heading);
  text-decoration: none;
}
.post-item h2 a:hover,
.post-item h3 a:hover {
  color: var(--accent);
}
.post-item p {
  font-size: 0.95rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.6;
}

/* ===== Single Post ===== */
.post-header { margin-bottom: 2rem; }
.post-header h1 {
  margin-bottom: 0.75rem;
  padding-bottom: 0;
  border-bottom: none;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.9rem;
  color: var(--muted);
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.post-tags {
  display: flex;
  gap: 0.5rem;
}
.tag {
  font-size: 0.8rem;
  color: var(--accent);
  background: rgba(27, 79, 114, 0.08);
  padding: 0.15rem 0.6rem;
  border-radius: 3px;
}
.post-body {
  margin-top: 2rem;
}
.post-body h2 {
  margin-top: 2.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.post-body h3 { margin-top: 2rem; }
.post-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.back-link {
  font-size: 0.95rem;
  color: var(--muted);
}
.back-link:hover { color: var(--accent); }

/* ===== Footer ===== */
.footer-inner p {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0.25rem 0;
}
.footer-links a {
  color: var(--muted);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--accent);
}
.footer-links .sep {
  margin: 0 0.5rem;
  color: var(--border);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .header-inner {
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
  }
  .primary-nav ul {
    gap: 1.25rem;
    flex-wrap: wrap;
    justify-content: center;
  }
  .hero { padding: 1.5rem 1rem 0.5rem; }
  .hero-avatar { width: 110px; height: 110px; }
  .hero-name { font-size: 1.75rem; }
  .hero-title { font-size: 0.95rem; }
  .site-main { padding: 2.5rem 1.25rem 2rem; }
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.2rem; }
}
