/* ============================================
   Scapewatch — 主题样式
   暖色调、大留白、系统字体、深浅色切换
   ============================================ */

:root {
  --bg:        #fdfcfa;
  --bg-soft:   #f6f3ed;
  --bg-code:   #f2efe8;
  --text:      #1c1917;
  --text-soft: #3d3934;
  --muted:     #7c736a;
  --accent:    #a8500a;
  --accent-soft: rgba(168, 80, 10, 0.08);
  --border:    #e8e2d7;
  --radius:    10px;
  --maxw:      720px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --font-serif: Georgia, "Songti SC", "SimSun", "Noto Serif SC", serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas,
               "Liberation Mono", monospace;
}

[data-theme="dark"] {
  --bg:        #191713;
  --bg-soft:   #221f19;
  --bg-code:   #24211a;
  --text:      #ece7de;
  --text-soft: #cbc3b6;
  --muted:     #978d80;
  --accent:    #e8a03c;
  --accent-soft: rgba(232, 160, 60, 0.12);
  --border:    #322d24;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s ease, color .25s ease;
}

img, svg, video { max-width: 100%; height: auto; }

a {
  color: inherit;
  text-decoration: none;
}

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

/* ---------- 布局 ---------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
}

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

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 650;
  font-size: 16px;
  letter-spacing: -.01em;
}

.brand-mark {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 14.5px;
}

.nav a {
  color: var(--muted);
  transition: color .18s ease;
}

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

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: all .18s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--muted);
  transform: rotate(180deg);
}

/* ---------- 首页 hero ---------- */
.hero {
  padding: 64px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 40px;
}

.hero-title {
  margin: 0 0 18px;
  font-family: var(--font-serif);
  font-size: clamp(27px, 4.6vw, 38px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -.02em;
}

.hero-text {
  color: var(--text-soft);
  font-size: 16.5px;
  max-width: 58ch;
}

.hero-text p { margin: 0 0 12px; }
.hero-text p:last-child { margin-bottom: 0; }

/* ---------- 文章列表 ---------- */
.section-label {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--muted);
}

.post-list { margin-bottom: 24px; }

.post-item {
  padding: 26px 0;
  border-bottom: 1px solid var(--border);
}

.post-item:last-child { border-bottom: none; }

.post-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 620;
  line-height: 1.45;
  letter-spacing: -.015em;
  transition: color .18s ease;
}

.post-link:hover .post-title { color: var(--accent); }

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  font-size: 13.5px;
  color: var(--muted);
}

.dot { opacity: .45; }

.tag-sep { opacity: .4; margin: 0 1px; }

.tag-inline {
  color: var(--accent);
  font-size: 13px;
}

a.tag-inline:hover { text-decoration: underline; text-underline-offset: 3px; }

.post-summary {
  margin: 0;
  color: var(--text-soft);
  font-size: 15px;
  line-height: 1.7;
}

/* ---------- 文章页 ---------- */
.page-title {
  margin: 56px 0 28px;
  font-family: var(--font-serif);
  font-size: clamp(24px, 4vw, 31px);
  font-weight: 500;
  letter-spacing: -.02em;
}

.page-intro { color: var(--text-soft); margin-bottom: 32px; }

.post { padding: 56px 0 24px; }

.post-header { margin-bottom: 36px; }

.post-heading {
  margin: 0 0 14px;
  font-family: var(--font-serif);
  font-size: clamp(26px, 4.4vw, 34px);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -.02em;
}

/* ---------- 正文排版 ---------- */
.prose {
  font-size: 16.5px;
  line-height: 1.82;
  color: var(--text-soft);
  letter-spacing: .002em;
}

.prose > *:first-child { margin-top: 0; }

.prose h2 {
  margin: 2.1em 0 .7em;
  font-size: 22px;
  font-weight: 640;
  line-height: 1.45;
  color: var(--text);
  letter-spacing: -.01em;
}

.prose h3 {
  margin: 1.8em 0 .6em;
  font-size: 18px;
  font-weight: 640;
  color: var(--text);
}

.prose h4 {
  margin: 1.5em 0 .5em;
  font-size: 16px;
  font-weight: 640;
  color: var(--text);
}

.prose p { margin: 0 0 1.25em; }

.prose a {
  color: var(--accent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: border-color .18s ease;
}

.prose a:hover { border-bottom-color: var(--accent); }

.prose strong { color: var(--text); font-weight: 640; }

.prose ul, .prose ol {
  margin: 0 0 1.25em;
  padding-left: 1.4em;
}

.prose li { margin: .4em 0; }

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

.prose blockquote {
  margin: 1.6em 0;
  padding: 2px 0 2px 20px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-style: normal;
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose code {
  font-family: var(--font-mono);
  font-size: .875em;
  padding: .15em .4em;
  background: var(--bg-code);
  border-radius: 5px;
  color: var(--text);
}

/* 代码块固定深色底：深浅主题下视觉统一，也免了维护两套高亮配色 */
.prose pre {
  margin: 1.6em 0;
  padding: 18px 20px;
  background: #1b1a17;
  border: 1px solid #2b2820;
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
  color: #e8e3d9;
}

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

/* 覆盖 chroma 自带的蓝黑底，统一成暖色深底 */
.prose .chroma { background: #1b1a17; }

/* 注释、行号一类弱化文字提亮，深底上更清楚 */
.prose .chroma .c,
.prose .chroma .c1,
.prose .chroma .cm,
.prose .chroma .cs,
.prose .chroma .ch,
.prose .chroma .cp,
.prose .chroma .cpf,
.prose .chroma .go,
.prose .chroma .gp {
  color: #9aa4ad;
}

.prose hr {
  margin: 2.6em 0;
  border: none;
  border-top: 1px solid var(--border);
}

.prose img {
  display: block;
  margin: 1.8em auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.prose table {
  width: 100%;
  margin: 1.6em 0;
  border-collapse: collapse;
  font-size: 14.5px;
}

.prose th, .prose td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.prose th {
  font-weight: 600;
  color: var(--text);
  background: var(--bg-soft);
}

.prose tr:last-child td { border-bottom: none; }

/* ---------- 文末导航 ---------- */
.post-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 56px 0 40px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
  font-size: 14.5px;
}

.post-nav {
  color: var(--muted);
  max-width: 46%;
  transition: color .18s ease;
}

.post-nav:hover { color: var(--accent); }

.post-nav.right { margin-left: auto; text-align: right; }

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 36px 0 20px;
  font-size: 14.5px;
}

.pagination a { color: var(--accent); }

/* ---------- 标签云 ---------- */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 40px;
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-soft);
  transition: all .18s ease;
}

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

.tag-count {
  font-size: 12px;
  color: var(--muted);
}

/* ---------- 404 ---------- */
.notfound { border-bottom: none; }

.back-home {
  color: var(--accent);
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  transition: border-color .18s ease;
}

.back-home:hover { border-bottom-color: var(--accent); }

/* ---------- 页脚 ---------- */
.site-footer {
  margin-top: 72px;
  padding: 30px 0 44px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--muted);
}

.footer-line { margin: 0 0 6px; }
.footer-line:last-child { margin-bottom: 0; }

/* ---------- 响应式 ---------- */
@media (max-width: 640px) {
  .wrap { padding: 0 18px; }
  .nav { gap: 15px; font-size: 14px; }
  .nav a:nth-child(3) { display: none; }
  .hero { padding: 48px 0 32px; margin-bottom: 32px; }
  .post { padding: 36px 0 16px; }
  .post-footer { flex-direction: column; gap: 12px; }
  .post-nav { max-width: 100%; }
  .post-nav.right { margin-left: 0; text-align: left; }
  .prose { font-size: 16px; }
}
