:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #637083;
  --border: #d9e2ec;
  --accent: #0f766e;
  --accent-soft: #e6fffb;
  --nav: #22324a;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 6px 20px rgba(15,118,110,.10), 0 2px 6px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 32px rgba(15,118,110,.14), 0 4px 10px rgba(0,0,0,.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Header ─────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
}

.site-header-inner,
.site-footer-inner,
.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header-inner {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.brand {
  color: var(--nav);
  font-weight: 760;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.site-nav a,
.button {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--nav);
  font-size: 13px;
  font-weight: 650;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}

.site-nav a:hover,
.button:hover {
  border-color: #99f6e4;
  background: var(--accent-soft);
  color: #0b5f59;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

.button.primary {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
  box-shadow: 0 1px 4px rgba(15,118,110,.3);
}

.button.primary:hover {
  background: #0b5f59;
  border-color: #0b5f59;
  color: #fff;
  box-shadow: 0 4px 12px rgba(15,118,110,.35);
}

/* ── Page shell ──────────────────────────────────────── */

.page {
  padding: 40px 0 64px;
}

/* ── Hero ────────────────────────────────────────────── */

.hero {
  position: relative;
  padding: 48px 44px 44px;
  margin-bottom: 48px;
  border: 1px solid #a7e3db;
  border-radius: 16px;
  background: linear-gradient(140deg, #f0fdfa 0%, #ecfdf5 40%, #f0f9ff 100%);
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 90% 10%, rgba(134,239,172,.18) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 10% 90%, rgba(103,232,249,.12) 0%, transparent 70%);
  pointer-events: none;
}

.hero > * { position: relative; }

.hero .eyebrow {
  margin-bottom: 10px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: -.5px;
  background: linear-gradient(135deg, #172033 30%, #0f766e 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero .lede {
  margin-bottom: 0;
}

.hero-stats {
  display: flex;
  gap: 20px;
  margin: 14px 0 24px;
}

.hero-stats span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.hero-stats span::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: .6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ── Page & post headers ─────────────────────────────── */

.page-header,
.post-header {
  margin-bottom: 32px;
}

h1, h2, h3 {
  letter-spacing: 0;
}

h1 {
  margin: 0 0 10px;
  font-size: 36px;
  line-height: 1.14;
}

h2 {
  margin: 0;
  font-size: 22px;
}

h3 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.35;
}

.eyebrow,
.post-meta {
  margin: 0 0 8px;
  color: #0b5f59;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.lede {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

/* ── Section heading ─────────────────────────────────── */

.section {
  margin-top: 8px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* ── Post cards ──────────────────────────────────────── */

.post-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 14px;
}

.post-card {
  padding: 22px 20px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
  display: flex;
  flex-direction: column;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #99f6e4;
}

.post-card h3 a {
  color: var(--ink);
  transition: color .15s;
}

.post-card h3 a:hover {
  color: var(--accent);
  text-decoration: none;
}

.post-card p {
  margin: 6px 0 0;
  color: #475569;
  font-size: 14.5px;
  line-height: 1.6;
  flex: 1;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.reading-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Tag colors ──────────────────────────────────────── */

.tag-row,
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-row a,
.tag-cloud a {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 650;
  transition: opacity .15s, box-shadow .15s;
  border: 1px solid transparent;
}

.tag-row a:hover,
.tag-cloud a:hover {
  opacity: .8;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

/* 5 hue variants — assigned via tagColorIndex filter */
.tc-1 { background: #f0fdfa; color: #0d6b63; border-color: #99f6e4; }
.tc-2 { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.tc-3 { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.tc-4 { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.tc-5 { background: #fdf2f8; color: #9d174d; border-color: #fbcfe8; }

/* ── Archive list ────────────────────────────────────── */

.archive-list {
  display: grid;
  gap: 10px;
}

.archive-item {
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 4px;
  transition: box-shadow .18s ease, border-color .18s ease;
}

.archive-item:hover {
  box-shadow: var(--shadow-md);
  border-color: #99f6e4;
}

.archive-item p {
  margin: 0;
  color: #475569;
  line-height: 1.6;
}

.archive-item time {
  color: var(--muted);
  font-size: 13px;
}

/* ── Article content ─────────────────────────────────── */

.post-header .post-meta-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.post-header .post-meta {
  margin: 0;
}

.post-header .reading-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.content {
  max-width: 820px;
  line-height: 1.78;
}

.content h2 {
  margin-top: 36px;
  margin-bottom: 10px;
}

.content p,
.content ul,
.content ol {
  color: #334155;
}

.content code {
  padding: 2px 5px;
  border-radius: 4px;
  background: #eef2f7;
  font-size: .88em;
}

.content pre {
  overflow-x: auto;
  padding: 18px 20px;
  border-radius: 10px;
  background: #172033;
  color: #f8fafc;
  box-shadow: var(--shadow-md);
}

.content pre code {
  background: none;
  padding: 0;
  font-size: .9em;
}

/* ── Footer ──────────────────────────────────────────── */

.site-footer {
  border-top: 1px solid var(--border);
  background: #fff;
}

.site-footer-inner {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

/* ── Theme toggle button ─────────────────────────────── */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--nav);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  transition: border-color .15s, background .15s, box-shadow .15s;
  flex-shrink: 0;
  white-space: nowrap;
}

.theme-toggle:hover {
  border-color: #99f6e4;
  background: var(--accent-soft);
  box-shadow: var(--shadow-sm);
}

.theme-icon::before { content: "🌙"; }
[data-theme="dark"] .theme-icon::before { content: "☀️"; }
.theme-label::before { content: "深色"; }
[data-theme="dark"] .theme-label::before { content: "浅色"; }

/* ── Dark theme ──────────────────────────────────────── */

:root[data-theme="dark"] {
  --bg:          #0d1117;
  --panel:       #161b22;
  --ink:         #e6edf3;
  --muted:       #7d8590;
  --border:      #30363d;
  --accent:      #2dd4bf;
  --accent-soft: #0d2e2b;
  --nav:         #cdd9e5;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.35), 0 1px 2px rgba(0,0,0,.25);
  --shadow-md:   0 6px 20px rgba(0,0,0,.45), 0 2px 6px rgba(0,0,0,.3);
  --shadow-lg:   0 12px 32px rgba(0,0,0,.55), 0 4px 10px rgba(0,0,0,.35);
}

[data-theme="dark"] .site-header {
  background: rgba(13,17,23,.96);
}

[data-theme="dark"] .site-footer {
  background: #161b22;
}

[data-theme="dark"] .site-nav a,
[data-theme="dark"] .theme-toggle {
  background: #1c2433;
  color: var(--nav);
  border-color: #3d4f63;
}

[data-theme="dark"] .site-nav a:hover,
[data-theme="dark"] .theme-toggle:hover {
  border-color: #2dd4bf;
  background: var(--accent-soft);
  color: #5ef0e4;
}

[data-theme="dark"] .button {
  background: #1c2433;
  color: var(--nav);
  border-color: #3d4f63;
}

[data-theme="dark"] .button:hover {
  border-color: #2dd4bf;
  background: var(--accent-soft);
  color: #5ef0e4;
}

[data-theme="dark"] .button.primary {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

[data-theme="dark"] .button.primary:hover {
  background: #2dd4bf;
  border-color: #2dd4bf;
  color: #0d1117;
}

[data-theme="dark"] .hero {
  background: linear-gradient(140deg, #0d1f1c 0%, #0d1a2a 100%);
  border-color: #1e3a35;
}

[data-theme="dark"] .hero::before {
  background:
    radial-gradient(ellipse 60% 50% at 90% 10%, rgba(45,212,191,.08) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 10% 90%, rgba(56,189,248,.06) 0%, transparent 70%);
}

[data-theme="dark"] .hero h1 {
  background: linear-gradient(135deg, #e6edf3 30%, #2dd4bf 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

[data-theme="dark"] .hero-stats span::before {
  background: #2dd4bf;
}

[data-theme="dark"] .post-card {
  background: #161b22;
}

[data-theme="dark"] .post-card p {
  color: #8b9ab0;
}

[data-theme="dark"] .post-card h3 a {
  color: #e6edf3;
}

[data-theme="dark"] .archive-item {
  background: #161b22;
}

[data-theme="dark"] .archive-item p {
  color: #8b9ab0;
}

[data-theme="dark"] .archive-item:hover {
  border-color: #2dd4bf;
}

[data-theme="dark"] .content p,
[data-theme="dark"] .content ul,
[data-theme="dark"] .content ol {
  color: #b0bec8;
}

[data-theme="dark"] .content code {
  background: #1c2433;
  color: #e6edf3;
}

/* Dark tag colors — deeper hue backgrounds, brighter text */
[data-theme="dark"] .tc-1 { background: #0d2520; color: #2dd4bf; border-color: #1a4040; }
[data-theme="dark"] .tc-2 { background: #0d1f3c; color: #60a5fa; border-color: #1e3a6e; }
[data-theme="dark"] .tc-3 { background: #1a0e3c; color: #a78bfa; border-color: #2e1a6e; }
[data-theme="dark"] .tc-4 { background: #2a1a00; color: #fbbf24; border-color: #4a3000; }
[data-theme="dark"] .tc-5 { background: #2a0a1a; color: #f472b6; border-color: #4a1430; }

/* ── Mobile ──────────────────────────────────────────── */

@media (max-width: 760px) {
  .site-header-inner,
  .site-footer-inner,
  .page {
    width: min(100% - 20px, 1120px);
  }

  .site-header-inner {
    align-items: center;
    padding: 0;
  }

  h1 {
    font-size: 28px;
  }

  .hero {
    padding: 32px 24px 28px;
  }

  .hero h1 {
    font-size: 30px;
  }

  .hero-stats {
    gap: 14px;
  }
}
