/* ============================================================
   随记 Suiji.Life — 前端技术文章随记
   个人技术博客 · 静态站样式
   ============================================================ */

:root {
  --bg: #faf9f7;
  --surface: #ffffff;
  --surface-2: #f3f1ec;
  --text: #26261f;
  --text-soft: #4c4a42;
  --muted: #7a756a;
  --border: #e7e4dc;
  --accent: #c33b34;
  --accent-ink: #a52b25;
  --accent-soft: rgba(195, 59, 52, 0.08);
  --code-bg: #f3f1ec;
  --code-text: #3a3a33;
  --shadow: 0 1px 2px rgba(38, 38, 31, 0.04), 0 10px 28px rgba(38, 38, 31, 0.06);
  --radius: 12px;

  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #16150f;
  --surface: #1d1c16;
  --surface-2: #262419;
  --text: #e8e5da;
  --text-soft: #c6c2b2;
  --muted: #938e7c;
  --border: #33301f;
  --accent: #e0655c;
  --accent-ink: #f08a82;
  --accent-soft: rgba(224, 101, 92, 0.12);
  --code-bg: #262419;
  --code-text: #dcd8c8;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.75;
  transition: background 0.25s ease, color 0.25s ease;
}

.container {
  width: min(1020px, 92%);
  margin: 0 auto;
}

.container--narrow {
  width: min(760px, 92%);
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--accent-ink);
}

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.logo {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.logo:hover {
  color: var(--text);
}

.logo .logo-dot {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-links a {
  color: var(--text-soft);
  font-size: 15px;
  padding: 6px 12px;
  border-radius: 8px;
}

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

.nav-links a.active {
  color: var(--accent);
  font-weight: 600;
}

.theme-toggle {
  margin-left: 8px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  transform: rotate(20deg);
  border-color: var(--accent);
}

/* ---------- Hero ---------- */
.hero {
  padding: 88px 0 56px;
  text-align: center;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 320px;
  background: radial-gradient(
    600px 260px at 50% 0%,
    var(--accent-soft),
    transparent 70%
  );
  pointer-events: none;
}

.hero .container {
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-block;
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 4px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(34px, 6vw, 52px);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0.01em;
}

.hero h1 .hl {
  color: var(--accent);
  position: relative;
}

.hero .subtitle {
  margin-top: 18px;
  font-size: 17px;
  color: var(--muted);
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

.hero-stats {
  display: flex;
  gap: 34px;
  justify-content: center;
  margin-top: 34px;
  font-size: 14px;
  color: var(--muted);
}

.hero-stats b {
  display: block;
  font-family: var(--serif);
  font-size: 26px;
  color: var(--text);
  font-weight: 700;
}

/* ---------- 文章列表 ---------- */
.section {
  padding: 56px 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}

.section-head h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
}

.section-head .en {
  font-size: 13px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

.post-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.post-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 30px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  box-shadow: 0 2px 4px rgba(38, 38, 31, 0.05), 0 18px 40px rgba(38, 38, 31, 0.1);
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.post-meta .tag {
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
}

.post-card h3 {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  line-height: 1.45;
  margin-bottom: 8px;
}

.post-card h3 a {
  color: var(--text);
}

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

.post-excerpt {
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.7;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-readmore {
  font-size: 14px;
  font-weight: 600;
}

.post-readmore::after {
  content: " →";
  transition: margin-left 0.15s ease;
}

.post-card:hover .post-readmore::after {
  margin-left: 4px;
}

/* ---------- 关于 / 说明 ---------- */
.about-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 34px 36px;
  box-shadow: var(--shadow);
}

.about-block h2 {
  font-family: var(--serif);
  font-size: 24px;
  margin-bottom: 14px;
}

.about-block p {
  color: var(--text-soft);
  margin-bottom: 12px;
}

.about-block p:last-child {
  margin-bottom: 0;
}

.about-list {
  margin: 10px 0 14px 1.2em;
  color: var(--text-soft);
}

.about-list li {
  margin-bottom: 6px;
}

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding: 40px 0 46px;
  background: var(--surface-2);
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}

.footer-icp a {
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.footer-icp img {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

/* ---------- 文章页 ---------- */
.article {
  padding: 48px 0 24px;
}

.article-header {
  margin-bottom: 40px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--border);
}

.article-header .post-meta {
  margin-bottom: 14px;
}

.article-header h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 4.5vw, 38px);
  line-height: 1.35;
  font-weight: 800;
  margin-bottom: 16px;
}

.article-body {
  font-size: 16.5px;
  color: var(--text-soft);
}

.article-body h2 {
  font-family: var(--serif);
  font-size: 24px;
  color: var(--text);
  margin: 40px 0 16px;
  padding-left: 14px;
  border-left: 4px solid var(--accent);
  line-height: 1.4;
}

.article-body h3 {
  font-family: var(--serif);
  font-size: 19px;
  color: var(--text);
  margin: 30px 0 12px;
}

.article-body p {
  margin-bottom: 18px;
}

.article-body ul,
.article-body ol {
  margin: 0 0 18px 1.4em;
}

.article-body li {
  margin-bottom: 8px;
}

.article-body strong {
  color: var(--text);
  font-weight: 700;
}

.article-body a {
  border-bottom: 1px dashed color-mix(in srgb, var(--accent) 50%, transparent);
}

.article-body blockquote {
  margin: 22px 0;
  padding: 14px 20px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
  color: var(--text);
}

.article-body blockquote p {
  margin-bottom: 0;
}

.article-body code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--code-bg);
  color: var(--accent-ink);
  padding: 2px 7px;
  border-radius: 6px;
  word-break: break-word;
}

[data-theme="dark"] .article-body code {
  color: #f0a49d;
}

.article-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  overflow-x: auto;
  margin: 20px 0 24px;
  line-height: 1.65;
}

.article-body pre code {
  background: none;
  color: var(--code-text);
  padding: 0;
  font-size: 13.5px;
}

.article-footer {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 10px;
}

.article-footer .back-link {
  font-weight: 600;
}

/* ---------- 关于页 ---------- */
.page {
  padding: 56px 0 24px;
}

.page-header {
  margin-bottom: 34px;
}

.page-header h1 {
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 10px;
}

.page-header .lead {
  color: var(--muted);
  font-size: 16px;
}

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .hero {
    padding: 56px 0 40px;
  }

  .hero-stats {
    gap: 22px;
  }

  .post-card {
    padding: 20px 22px;
  }

  .section {
    padding: 40px 0;
  }

  .about-block {
    padding: 26px 24px;
  }

  .nav-links a {
    padding: 6px 8px;
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ---------- 打印 ---------- */
@media print {
  .site-header,
  .theme-toggle,
  .article-footer {
    display: none;
  }
}
