/* ============================================================
   吴昱辰 · Luma Studio — 博客样式
   零依赖手写 CSS。亮/暗双主题：跟随系统 + 手动切换。
   气质基调：安静、编辑感、纸面阅读。
   ============================================================ */

/* ---------- 主题变量 ---------- */
:root {
  --bg: #f7f5f0;
  --bg-raised: #efece4;
  --ink: #26241f;
  --ink-secondary: #6f6a5e;
  --ink-faint: #a29c8e;
  --accent: #9a4a32;
  --accent-soft: rgba(154, 74, 50, 0.28);
  --border: #e2ddd2;
  --border-strong: #c9c3b4;
  --code-bg: #efece4;
  --code-border: #e2ddd2;
  --selection: rgba(154, 74, 50, 0.16);

  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "STSong", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC", "Noto Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --mono: "SF Mono", "JetBrains Mono", Menlo, Consolas, "PingFang SC", monospace;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171613;
    --bg-raised: #201e1a;
    --ink: #d9d5ca;
    --ink-secondary: #8f897b;
    --ink-faint: #635e52;
    --accent: #c98263;
    --accent-soft: rgba(201, 130, 99, 0.35);
    --border: #2b2923;
    --border-strong: #3d3a31;
    --code-bg: #201e1a;
    --code-border: #2b2923;
    --selection: rgba(201, 130, 99, 0.22);
    color-scheme: dark;
  }
}

/* 手动切换优先于系统偏好 */
:root[data-theme="light"] {
  --bg: #f7f5f0;
  --bg-raised: #efece4;
  --ink: #26241f;
  --ink-secondary: #6f6a5e;
  --ink-faint: #a29c8e;
  --accent: #9a4a32;
  --accent-soft: rgba(154, 74, 50, 0.28);
  --border: #e2ddd2;
  --border-strong: #c9c3b4;
  --code-bg: #efece4;
  --code-border: #e2ddd2;
  --selection: rgba(154, 74, 50, 0.16);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #171613;
  --bg-raised: #201e1a;
  --ink: #d9d5ca;
  --ink-secondary: #8f897b;
  --ink-faint: #635e52;
  --accent: #c98263;
  --accent-soft: rgba(201, 130, 99, 0.35);
  --border: #2b2923;
  --border-strong: #3d3a31;
  --code-bg: #201e1a;
  --code-border: #2b2923;
  --selection: rgba(201, 130, 99, 0.22);
  color-scheme: dark;
}

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

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.9;
  letter-spacing: 0.02em;
  transition: background-color 0.25s ease, color 0.25s ease;
}

::selection { background: var(--selection); }

a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid var(--accent-soft);
  transition: border-color 0.15s ease;
}
a:hover { border-bottom-color: var(--accent); }

/* ---------- 版心 ---------- */
.page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- 页头 ---------- */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.5rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
}

.site-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.site-title a { color: var(--ink); border-bottom: none; }
.site-title a:hover { color: var(--accent); }

.site-nav {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
  font-size: 0.85rem;
  color: var(--ink-secondary);
}
.site-nav a {
  color: var(--ink-secondary);
  border-bottom: none;
  letter-spacing: 0.06em;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--accent); }

.theme-toggle {
  appearance: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-secondary);
  font-size: 0.95rem;
  line-height: 1;
  padding: 0.2rem;
  position: relative;
  top: 0.1rem;
}
.theme-toggle:hover { color: var(--accent); }
.theme-toggle svg { width: 1rem; height: 1rem; display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
.icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-moon { display: none; }
  :root:not([data-theme="light"]) .icon-sun { display: block; }
}

/* ---------- 首页 ---------- */
.intro {
  padding: 3rem 0 1rem;
}
.intro h1 {
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.02em;
  margin-bottom: 1rem;
}
.intro p {
  color: var(--ink-secondary);
  font-size: 0.98rem;
  max-width: 36rem;
}

.post-list {
  list-style: none;
  padding: 2.5rem 0 2rem;
}
.post-list li {
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--border);
}
.post-list li:first-child { border-top: 1px solid var(--border); }
.post-list time {
  display: block;
  font-size: 0.8rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  margin-bottom: 0.35rem;
}
.post-list .post-title {
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 600;
  line-height: 1.6;
}
.post-list .post-title a { color: var(--ink); border-bottom: none; }
.post-list .post-title a:hover { color: var(--accent); }
.post-list .post-excerpt {
  margin-top: 0.5rem;
  font-size: 0.92rem;
  color: var(--ink-secondary);
}

/* ---------- 文章页 ---------- */
.article-header { padding: 3.5rem 0 0; }
.article-header h1 {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.65;
  letter-spacing: 0.02em;
}
.article-meta {
  margin-top: 1rem;
  font-size: 0.82rem;
  color: var(--ink-faint);
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
}
.article-meta .sep { margin: 0 0.5em; color: var(--border-strong); }

.article-body { padding: 2.25rem 0 3rem; }

.article-body > p { margin: 0 0 1.4rem; }

.article-body h2 {
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 600;
  line-height: 1.6;
  margin: 3rem 0 1.2rem;
  padding-top: 2.2rem;
  border-top: 1px solid var(--border);
}
.article-body h3 {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.6;
  margin: 2.2rem 0 1rem;
}

.article-body strong { font-weight: 600; color: var(--ink); }
.article-body em { font-style: normal; text-emphasis: dot; -webkit-text-emphasis: dot; }

.article-body ul, .article-body ol {
  margin: 0 0 1.4rem;
  padding-left: 1.6em;
}
.article-body li { margin-bottom: 0.4rem; }
.article-body li::marker { color: var(--ink-faint); }

.article-body blockquote {
  margin: 1.8rem 0;
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: 2px solid var(--accent);
  color: var(--ink-secondary);
}
.article-body blockquote p { margin-bottom: 0.6rem; }
.article-body blockquote p:last-child { margin-bottom: 0; }

.article-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2.5rem auto;
  width: 5rem;
}

/* 行内代码 */
.article-body code {
  font-family: var(--mono);
  font-size: 0.84em;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 4px;
  padding: 0.1em 0.4em;
  letter-spacing: 0;
}

/* 代码块 */
.article-body pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  margin: 1.8rem 0;
  overflow-x: auto;
  line-height: 1.7;
}
.article-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.82rem;
  letter-spacing: 0;
  display: block;
  min-width: max-content;
}

/* 表格 */
.table-wrap { overflow-x: auto; margin: 1.8rem 0; }
.article-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.88rem;
  line-height: 1.7;
}
.article-body th, .article-body td {
  text-align: left;
  padding: 0.55rem 1rem 0.55rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.article-body th {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink-secondary);
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-strong);
}
.article-body td { font-variant-numeric: tabular-nums; }

/* 文末 */
.article-footer {
  padding: 0 0 4rem;
}
.article-footer .backlink {
  font-size: 0.88rem;
  color: var(--ink-secondary);
  border-bottom: none;
}
.article-footer .backlink:hover { color: var(--accent); }

/* ---------- About ---------- */
.about-body { padding: 3rem 0 4rem; }
.about-body h1 {
  font-family: var(--serif);
  font-size: 1.6rem;
  font-weight: 600;
  line-height: 1.6;
  margin-bottom: 1.6rem;
}
.about-body h2 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
  margin: 2.4rem 0 1rem;
}
.about-body p { margin-bottom: 1.3rem; }
.about-body ul { margin: 0 0 1.3rem; padding-left: 1.6em; }
.about-body li { margin-bottom: 0.4rem; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.6rem 0 3rem;
  font-size: 0.8rem;
  color: var(--ink-faint);
  letter-spacing: 0.05em;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.site-footer a { color: var(--ink-secondary); border-bottom: none; }
.site-footer a:hover { color: var(--accent); }

/* ---------- 移动端 ---------- */
@media (max-width: 600px) {
  body { font-size: 16px; }
  .site-header { padding-top: 1.8rem; flex-wrap: wrap; }
  .intro { padding-top: 2.2rem; }
  .intro h1 { font-size: 1.45rem; }
  .article-header { padding-top: 2.4rem; }
  .article-header h1 { font-size: 1.42rem; }
  .article-body h2 { font-size: 1.2rem; margin-top: 2.4rem; padding-top: 1.8rem; }
  .article-body pre { padding: 0.9rem 1rem; border-radius: 6px; }
}
