/* ============================================================
   tt 的博客 —— 静态站样式
   编辑部·纸感 排版优先：暖纸底、墨色正文、朱红点缀、衬线长文
   ============================================================ */

:root {
  --paper: #faf7f1;
  --paper-2: #f3eee4;
  --ink: #221f1a;
  --muted: #7b7263;
  --line: rgba(34, 31, 26, 0.14);
  --accent: #b03a1f;
  --accent-soft: rgba(176, 58, 31, 0.08);
  --code-bg: #f2ede2;
  --code-ink: #33302a;
  --serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC",
           "STSong", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC",
          "Hiragino Sans GB", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --maxw: 44rem;
  --tok-kw: #9c3318;
  --tok-str: #6c4f0e;
  --tok-num: #7c5c1a;
  --tok-fn: #1e5a78;
  --tok-cm: #988e7c;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171512;
    --paper-2: #1e1b16;
    --ink: #e7e1d4;
    --muted: #a19784;
    --line: rgba(231, 225, 212, 0.14);
    --accent: #e0714b;
    --accent-soft: rgba(224, 113, 75, 0.1);
    --code-bg: #221e18;
    --code-ink: #dcd4c4;
    --tok-kw: #e5825e;
    --tok-str: #d3ab62;
    --tok-num: #d8c07c;
    --tok-fn: #85b2cd;
    --tok-cm: #8d8371;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 0.3s ease, color 0.3s ease;
}

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

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.4rem; }

/* ---------- 顶栏 ---------- */

.site-head {
  border-bottom: 1px solid var(--line);
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.head-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.95rem;
  padding-bottom: 0.95rem;
}

.brand {
  font-family: var(--serif);
  font-size: 1.22rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.brand::before {
  content: "";
  width: 0.46em;
  height: 0.46em;
  background: var(--accent);
  transform: rotate(45deg);
  margin-right: 0.62em;
  border-radius: 1px;
  flex: none;
}

.brand:hover::before { transform: rotate(135deg); transition: transform 0.35s ease; }

.nav {
  display: flex;
  gap: 1.15rem;
  font-size: 0.86rem;
  letter-spacing: 0.09em;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 0.2rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

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

.nav a.on {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---------- 主区 ---------- */

.main { padding-top: 2.6rem; padding-bottom: 3rem; min-height: 62vh; }

.tagline {
  color: var(--muted);
  font-size: 1.02rem;
  letter-spacing: 0.03em;
  margin: 0 0 2.2rem;
}

.page-title {
  font-family: var(--serif);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0.2rem 0 2rem;
  line-height: 1.3;
}

.count { color: var(--muted); font-weight: 400; font-size: 1rem; }

.muted { color: var(--muted); }

/* ---------- 首页列表 ---------- */

.postlist { display: block; }

.row {
  padding: 1.55rem 0;
  border-bottom: 1px solid var(--line);
  animation: rise 0.5s ease both;
}
.postlist .row:last-child { border-bottom: none; }
.row:nth-child(2) { animation-delay: 0.04s; }
.row:nth-child(3) { animation-delay: 0.08s; }
.row:nth-child(4) { animation-delay: 0.12s; }
.row:nth-child(5) { animation-delay: 0.16s; }
.row:nth-child(6) { animation-delay: 0.2s; }
.row:nth-child(7) { animation-delay: 0.24s; }
.row:nth-child(8) { animation-delay: 0.28s; }

@keyframes rise {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: none; }
}

.row-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.32rem;
  font-weight: 600;
  line-height: 1.45;
  letter-spacing: 0.005em;
}

.row-title a {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: color 0.2s ease, background-size 0.25s ease;
}

.row-title a:hover {
  color: var(--accent);
  background-size: 100% 1px;
}

.row-meta {
  margin-top: 0.55rem;
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.row-desc {
  margin: 0.5rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.75;
}

/* ---------- 标签 chip ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.7rem;
}

.chip {
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.14em 0.85em;
  text-decoration: none;
  transition: color 0.2s ease, border-color 0.2s ease;
}

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

.chip.big { font-size: 0.82rem; padding: 0.3em 1em; }

.cnt { opacity: 0.7; margin-left: 0.15em; }

.wrap-chips { gap: 0.7rem; }

/* ---------- 文章页 ---------- */

.post-head { animation: rise 0.5s ease both; }

.post-title {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4.4vw, 2.35rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.005em;
  margin: 0.4rem 0 1rem;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.post .chips { margin-top: 0.4rem; }

.dot { opacity: 0.55; }

/* 正文 */
.post-body {
  font-family: var(--serif);
  font-size: 1.06rem;
  line-height: 1.95;
  margin-top: 1.9rem;
}

.post-body p { margin: 1.05em 0; }

.post-body h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 2.3em 0 0.75em;
  padding-bottom: 0.3em;
  position: relative;
}

.post-body h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2.4em;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
}

.post-body h3 {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-weight: 700;
  margin: 1.9em 0 0.6em;
}

.post-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  transition: border-color 0.2s ease;
}
.post-body a:hover { border-bottom-color: var(--accent); }

.post-body ul, .post-body ol { padding-left: 1.5em; margin: 1em 0; }
.post-body li { margin: 0.4em 0; }
.post-body li::marker { color: var(--accent); }

.post-body blockquote {
  margin: 1.6em 0;
  padding: 0.15em 0 0.15em 1.2em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
  font-size: 1.02em;
}
.post-body blockquote p { margin: 0.55em 0; }

.post-body hr {
  border: none;
  margin: 2.6em 0;
}
.post-body hr::after {
  content: "※";
  display: block;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.3em;
}

.post-body img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: 1.5em auto;
  display: block;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.post-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5em 0;
  font-size: 0.95rem;
  font-family: var(--sans);
}
.post-body th {
  border-bottom: 2px solid var(--line);
  text-align: left;
  padding: 0.55em 0.8em;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.post-body td {
  border-bottom: 1px solid var(--line);
  padding: 0.55em 0.8em;
  vertical-align: top;
}

/* 代码 */
.post-body code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  color: var(--code-ink);
  padding: 0.12em 0.42em;
  border-radius: 5px;
}

.post-body pre {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.05em 1.25em;
  overflow-x: auto;
  margin: 1.5em 0;
  line-height: 1.65;
}

.post-body pre code {
  background: none;
  color: inherit;
  padding: 0;
  border-radius: 0;
  font-size: 0.83rem;
  display: block;
}

/* Pygments 语色（暖调，克制） */
.hl .k, .hl .kc, .hl .kd, .hl .kn, .hl .kr, .hl .kt { color: var(--tok-kw); font-weight: 600; }
.hl .s, .hl .s1, .hl .s2, .hl .sd, .hl .se { color: var(--tok-str); }
.hl .m, .hl .mi, .hl .mf, .hl .mo, .hl .mb { color: var(--tok-num); }
.hl .nf, .hl .fm, .hl .nc, .hl .nn { color: var(--tok-fn); }
.hl .c, .hl .c1, .hl .cm, .hl .ch { color: var(--tok-cm); font-style: italic; }
.hl .nb, .hl .bp, .hl .o { color: inherit; }

/* 目录 */
.post-toc {
  margin: 1.6rem 0 0.4rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.2rem 1.1rem;
  background: var(--paper-2);
}
.post-toc summary {
  cursor: pointer;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 0.6rem 0;
  user-select: none;
}
.post-toc summary:hover { color: var(--accent); }
.toc { margin: 0.2rem 0 0.7rem; padding: 0; list-style: none; }
.toc li { margin: 0.34rem 0; }
.toc a { color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.toc a:hover { color: var(--accent); }
.toc .t3 { padding-left: 1.1em; }
.toc .t3 a { font-size: 0.86rem; }

/* 文章尾 */
.post-foot { margin-top: 3rem; }

.pn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem 2.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1.4rem;
}

.pn span {
  display: block;
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.14em;
  margin-bottom: 0.3rem;
}

.pn a {
  font-family: var(--serif);
  font-size: 1.02rem;
  text-decoration: none;
  line-height: 1.5;
}
.pn a:hover { color: var(--accent); }

.pn.next { text-align: right; }

/* ---------- 归档 / 标签页 ---------- */

.arch-year { margin-bottom: 2.4rem; }
.arch-year h2 {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 1rem;
}
.arch-list { list-style: none; margin: 0; padding: 0; }
.arch-list li {
  display: flex;
  gap: 1.1rem;
  align-items: baseline;
  padding: 0.42rem 0;
  border-bottom: 1px dashed var(--line);
}
.arch-list time {
  flex: none;
  width: 3.1em;
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}
.arch-list a {
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.02rem;
}
.arch-list a:hover { color: var(--accent); }

/* ---------- 页脚 ---------- */

.site-foot {
  border-top: 1px solid var(--line);
  margin-top: 3.5rem;
}

.foot-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding-top: 1.2rem;
  padding-bottom: 1.6rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
}

.feed-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--line);
}
.feed-link:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- 响应式 ---------- */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .head-inner { flex-wrap: wrap; row-gap: 0.2rem; }
  .nav { gap: 0.9rem; font-size: 0.8rem; }
  .main { padding-top: 1.9rem; }
  .row { padding: 1.2rem 0; }
  .pn-row { grid-template-columns: 1fr; }
  .pn.next { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
