/* ============================================================
   求索日志 · judeco.cn
   纸墨风：宣纸底 + 朱砂印，衬线标题 + 等宽细节
   ============================================================ */

:root {
  --bg: #f6f4ee;
  --surface: #fffdf8;
  --ink: #26231e;
  --ink-2: #5f5a50;
  --muted: #8a8478;
  --line: #e3ddd0;
  --accent: #bf3f2c;
  --accent-ink: #8f2f20;
  --hover: rgba(38, 35, 30, 0.05);
  --quote-bg: rgba(191, 63, 44, 0.06);
  --code-inline: rgba(38, 35, 30, 0.07);
  --head-bg: rgba(246, 244, 238, 0.86);
  --shadow: 0 8px 28px rgba(38, 35, 30, 0.1);
  --radius: 14px;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", Georgia, "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, "Courier New", monospace;
}

[data-theme="dark"] {
  --bg: #191713;
  --surface: #211e19;
  --ink: #e9e3d7;
  --ink-2: #b7b0a2;
  --muted: #8a8272;
  --line: #343026;
  --accent: #e5604a;
  --accent-ink: #f0826d;
  --hover: rgba(233, 227, 215, 0.06);
  --quote-bg: rgba(229, 96, 74, 0.1);
  --code-inline: rgba(233, 227, 215, 0.1);
  --head-bg: rgba(25, 23, 19, 0.86);
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.85;
  color: var(--ink);
  background: var(--bg);
  background-image: radial-gradient(1100px 480px at 50% -120px, rgba(191, 63, 44, 0.06), transparent);
  transition: background-color 0.25s ease, color 0.25s ease;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fdf6ea; }

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

img { display: block; max-width: 100%; }

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

.container { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ---------- 顶部导航 ---------- */

.site-head {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--head-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.head-in { display: flex; align-items: center; gap: 18px; height: 64px; }

.brand { display: flex; align-items: baseline; gap: 9px; color: var(--ink); }
.brand:hover { color: var(--ink); }

.brand-name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.brand-sub { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-left: 2px; letter-spacing: 0.02em; }

.site-nav { margin-left: auto; display: flex; gap: 2px; }

.site-nav a {
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 15px;
  color: var(--ink-2);
  transition: background 0.15s, color 0.15s;
}

.site-nav a:hover { background: var(--hover); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 600; }

.icon-btn {
  width: 36px;
  height: 36px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  font-size: 15px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, transform 0.15s;
}

.icon-btn::before { content: "☾"; }
[data-theme="dark"] .icon-btn::before { content: "☀"; }

.icon-btn:hover { color: var(--accent); border-color: var(--accent); transform: rotate(-15deg); }

/* ---------- 首页 Hero ---------- */

.hero { text-align: center; padding: 86px 24px 52px; }

.hero-kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.32em;
  color: var(--accent);
  margin-bottom: 18px;
}

.hero-title {
  font-family: var(--serif);
  font-size: clamp(42px, 7vw, 66px);
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.2;
}

.hero-quote {
  font-family: var(--serif);
  color: var(--ink-2);
  font-size: 17px;
  margin-top: 16px;
}

.q-src { font-size: 13px; color: var(--muted); margin-left: 10px; }

.hero-desc {
  color: var(--ink-2);
  max-width: 580px;
  margin: 14px auto 0;
  font-size: 15.5px;
}

.hero-actions { display: flex; justify-content: center; gap: 12px; margin-top: 30px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #fdf6ea;
  font-size: 15px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--sans);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(191, 63, 44, 0.3); color: #fdf6ea; }

.btn.ghost { background: transparent; color: var(--ink-2); border-color: var(--line); }
.btn.ghost:hover { color: var(--accent); border-color: var(--accent); box-shadow: none; }

/* ---------- 卡片 ---------- */

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.card:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: inherit; }

.sec-head { display: flex; align-items: baseline; gap: 14px; margin: 42px 0 18px; }

.sec-head h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 11px;
}

.sec-head h2::before { content: ""; width: 10px; height: 10px; background: var(--accent); border-radius: 2.5px; flex: none; }

.sec-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-left: auto; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  font-family: var(--mono);
  font-size: 12px;
  padding: 2.5px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  transition: color 0.15s, border-color 0.15s;
}

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

/* 置顶 */

.feat { display: grid; grid-template-columns: 340px 1fr; overflow: hidden; margin-bottom: 8px; }

.feat-cover { width: 100%; height: 100%; object-fit: cover; border-right: 1px solid var(--line); }

.feat-body { padding: 24px 28px; display: flex; flex-direction: column; gap: 10px; }

.feat-body h3 { font-family: var(--serif); font-size: 23px; font-weight: 700; line-height: 1.4; }

.feat-body .meta { margin-top: auto; }

.meta { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }

/* 列表卡片 */

.postlist { display: flex; flex-direction: column; gap: 14px; }

.row { display: grid; grid-template-columns: 1fr 180px; gap: 20px; padding: 18px 22px; align-items: center; }

.row-body { min-width: 0; }

.row-date { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.row h3 { font-family: var(--serif); font-size: 19px; font-weight: 700; margin: 5px 0 4px; line-height: 1.45; }

.row:hover h3 { color: var(--accent-ink); }

.row-ex {
  color: var(--ink-2);
  font-size: 14.5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.row-cover {
  width: 180px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.more { text-align: center; margin: 30px 0 10px; font-size: 15px; }

/* 入场动画 */

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

.feat, .postlist .row { animation: rise 0.5s ease both; }
.postlist .row:nth-child(1) { animation-delay: 0.03s; }
.postlist .row:nth-child(2) { animation-delay: 0.08s; }
.postlist .row:nth-child(3) { animation-delay: 0.13s; }
.postlist .row:nth-child(4) { animation-delay: 0.18s; }
.postlist .row:nth-child(5) { animation-delay: 0.23s; }
.postlist .row:nth-child(6) { animation-delay: 0.28s; }
.postlist .row:nth-child(7) { animation-delay: 0.33s; }
.postlist .row:nth-child(8) { animation-delay: 0.38s; }
.postlist .row:nth-child(9) { animation-delay: 0.43s; }

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

.post-head { padding-top: 52px; }

.post-title {
  font-family: var(--serif);
  font-size: clamp(30px, 5vw, 40px);
  font-weight: 800;
  line-height: 1.4;
  margin: 16px 0 12px;
}

.post-meta { font-family: var(--mono); font-size: 13px; color: var(--muted); }

.post-cover {
  width: 100%;
  aspect-ratio: 800 / 450;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid var(--line);
  margin: 28px 0 8px;
}

/* 正文 */

.prose { margin-top: 26px; font-size: 16px; }

.prose p { margin-bottom: 1.25em; }

.prose h2 {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 700;
  margin: 44px 0 16px;
  position: relative;
  padding-left: 16px;
  line-height: 1.5;
}

.prose h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.32em;
  width: 5px;
  height: 1.05em;
  background: var(--accent);
  border-radius: 3px;
}

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

.prose ul, .prose ol { padding-left: 1.7em; margin-bottom: 1.25em; }

.prose li { margin: 0.45em 0; }

.prose li::marker { color: var(--accent); }

.prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(191, 63, 44, 0.4); }

.prose strong { font-weight: 700; }

.prose code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-inline);
  padding: 0.14em 0.45em;
  border-radius: 6px;
}

.prose pre {
  position: relative;
  background: #26231e;
  color: #ece4d4;
  border-radius: 12px;
  padding: 20px 22px;
  margin: 0 0 1.4em;
  overflow-x: auto;
  line-height: 1.75;
  font-size: 13.5px;
}

[data-theme="dark"] .prose pre { background: #12100d; }

.prose pre code { background: none; padding: 0; font-size: inherit; color: inherit; }

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--mono);
  font-size: 12px;
  padding: 3px 11px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #d8d2c4;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s;
}

.copy-btn:hover { opacity: 1; }

.prose blockquote {
  margin: 1.7em 0;
  padding: 13px 20px;
  border-left: 3px solid var(--accent);
  background: var(--quote-bg);
  border-radius: 0 12px 12px 0;
  color: var(--ink-2);
  font-family: var(--serif);
  line-height: 1.9;
}

.note {
  margin: 1.8em 0;
  padding: 13px 17px;
  border: 1px dashed var(--accent);
  border-radius: 12px;
  color: var(--ink-2);
  font-size: 14.5px;
  background: var(--quote-bg);
}

.note-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  border: 1px solid currentColor;
  border-radius: 6px;
  padding: 1px 9px;
  margin-right: 10px;
  vertical-align: 1px;
  white-space: nowrap;
}

.prose figure { margin: 2em 0; }

.prose figure svg, .prose figure img {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.figcaption, .prose figcaption {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin-top: 10px;
}

/* 上一篇 / 下一篇 */

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 48px; }

.pn-card { padding: 15px 18px; display: flex; flex-direction: column; gap: 4px; }

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

.pn-label { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.pn-title { font-size: 14.5px; font-weight: 600; line-height: 1.5; }

.pn-card:hover .pn-title { color: var(--accent-ink); }

.license { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: center; margin: 30px 0 8px; }

/* ---------- 页面通用标题 ---------- */

.page-title { font-family: var(--serif); font-size: 34px; font-weight: 800; margin: 54px 0 8px; }

.page-sub { color: var(--ink-2); margin-bottom: 34px; font-size: 15px; }

/* ---------- 归档 ---------- */

.year { margin-bottom: 38px; }

.year h2 {
  font-family: var(--serif);
  font-size: 20px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 6px;
}

.year h2::before { content: ""; width: 10px; height: 10px; background: var(--accent); border-radius: 2.5px; }

.tl { list-style: none; }

.tl a {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  gap: 14px;
  align-items: baseline;
  padding: 10px 2px;
  border-bottom: 1px dashed var(--line);
  color: inherit;
}

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

.tl-date { font-family: var(--mono); font-size: 13px; color: var(--accent-ink); white-space: nowrap; }

.tag-sec .tl a { grid-template-columns: 96px 1fr auto; }

.tl-title { font-size: 15.5px; transition: color 0.15s; }

.tl-tags { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- 标签页 ---------- */

.tag-sec { margin-bottom: 34px; }

.tag-sec h2 {
  font-family: var(--serif);
  font-size: 20px;
  margin-bottom: 6px;
}

.tag-sec h2 sup { font-family: var(--mono); font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------- 关于 ---------- */

.about p { margin-bottom: 1.2em; }

/* ---------- 404 ---------- */

.err { text-align: center; padding: 120px 24px 80px; }

.err-code {
  font-family: var(--mono);
  font-size: 96px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.err-quote { font-family: var(--serif); color: var(--ink-2); margin: 22px 0 34px; font-size: 17px; }

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

.site-foot {
  margin-top: 90px;
  border-top: 1px solid var(--line);
  padding: 34px 0 40px;
  text-align: center;
}

.foot-brand { font-family: var(--serif); font-size: 15px; color: var(--ink-2); margin-bottom: 10px; }

.foot-line { font-family: var(--mono); font-size: 12.5px; color: var(--muted); line-height: 2.1; }

.foot-line a { color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }

.foot-line a:hover { color: var(--accent); }

/* ---------- 阅读进度 / 回到顶部 ---------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0;
  background: var(--accent);
  z-index: 90;
  transition: width 0.08s linear;
}

.totop {
  position: fixed;
  right: 24px;
  bottom: 28px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 17px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.2s, transform 0.2s, color 0.2s, border-color 0.2s;
  z-index: 80;
}

.totop.show { opacity: 1; pointer-events: auto; transform: none; }

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

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

@media (max-width: 760px) {
  .head-in { height: 56px; gap: 10px; }
  .brand-sub { display: none; }
  .site-nav a { padding: 6px 9px; font-size: 14px; }
  .hero { padding: 56px 18px 36px; }
  .hero-actions .btn { padding: 9px 16px; font-size: 14px; }
  .feat { grid-template-columns: 1fr; }
  .feat-cover { height: auto; aspect-ratio: 16 / 9; border-right: none; border-bottom: 1px solid var(--line); }
  .row { grid-template-columns: 1fr 110px; gap: 14px; padding: 14px 16px; }
  .row-cover { width: 110px; }
  .row h3 { font-size: 17px; }
  .row-ex { -webkit-line-clamp: 2; font-size: 13.5px; }
  .sec-head h2 { font-size: 19px; }
  .post-nav { grid-template-columns: 1fr; }
  .pn-card.next { text-align: left; }
  .tl a { grid-template-columns: 60px 1fr; }
  .tl-tags { display: none; }
  .page-title { margin-top: 40px; }
  .err-code { font-size: 72px; }
}

@media (max-width: 420px) {
  .container, .container-narrow { padding: 0 18px; }
  .row { grid-template-columns: 1fr 88px; }
  .row-cover { width: 88px; }
}

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