/* ============================================
   青辰的野外记录 — 设计系统
   设计语言：安静、克制、有结构（沿用极简博客蓝本）
   ============================================ */

:root {
  --bg: #f7f5f0;
  --bg-card: #ffffff;
  --bg-elev: #f1eee6;
  --text: #2b2926;
  --text-soft: #6f6a5f;
  --line: #e4e0d5;
  --accent: #c2410c;        /* 赭橙（醒目主色） */
  --accent-soft: #fbe9dd;
  --accent-2: #1c5d99;      /* 靛蓝（章节标题色） */
  --header-bg: rgba(247, 245, 240, 0.86);
  --shadow: 0 1px 2px rgba(45, 40, 28, 0.05), 0 10px 28px rgba(45, 40, 28, 0.06);
  --radius: 12px;
}

[data-theme="dark"] {
  --bg: #171614;
  --bg-card: #201f1c;
  --bg-elev: #262420;
  --text: #e9e5db;
  --text-soft: #a49f92;
  --line: #35322b;
  --accent: #f08a4b;
  --accent-soft: #38251a;
  --accent-2: #7ab6ea;
  --header-bg: rgba(23, 22, 20, 0.86);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.35);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

h1, h2, h3, h4 {
  font-family: Georgia, "Times New Roman", "Songti SC", "STSong", "SimSun", serif;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.01em;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

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

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-family: Georgia, "Songti SC", "SimSun", serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.nav { display: flex; gap: 4px; align-items: center; }
.nav a {
  color: var(--text-soft);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  transition: color 0.15s, background-color 0.15s;
}
.nav a:hover { text-decoration: none; color: var(--text); background: var(--bg-elev); }
.nav a.active { color: var(--accent); font-weight: 600; }

.theme-btn {
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-soft);
  width: 34px; height: 34px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s;
}
.theme-btn:hover { transform: rotate(15deg); color: var(--accent); }

/* 移动端导航折叠 */
.nav-toggle { display: none; }

@media (max-width: 720px) {
  .nav-toggle {
    display: flex;
    border: 1px solid var(--line);
    background: var(--bg-card);
    color: var(--text);
    width: 34px; height: 34px;
    border-radius: 10px;
    cursor: pointer;
    align-items: center; justify-content: center;
    font-size: 16px;
  }
  .nav {
    display: none;
    position: absolute;
    top: 60px; left: 0; right: 0;
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 16px 16px;
    border-bottom: 1px solid var(--line);
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 8px; font-size: 15px; }
}

/* ---------- 布局 ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.prose { max-width: 720px; }

/* 文章页布局：正文 + 侧边目录 */
.post-layout {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: minmax(0, 720px) 240px;
  gap: 56px;
  justify-content: center;
}
/* 窄屏：目录始终保持展开的侧边栏，只收窄宽度，不折叠 */
@media (max-width: 1100px) {
  .post-layout {
    grid-template-columns: minmax(0, 1fr) 180px;
    gap: 28px;
    padding: 0 18px;
  }
}
@media (max-width: 620px) {
  /* 极窄屏：侧边栏移到正文上方，仍然完全展开 */
  .post-layout { grid-template-columns: 1fr; gap: 0; }
  .post-layout > div:first-child { grid-row: 2; }
  .post-layout > aside { grid-row: 1; }
}

/* ---------- 首页 Hero ---------- */
.hero {
  padding: 52px 0 44px;
  text-align: center;
}
.hero .eyebrow {
  font-size: 13px;
  letter-spacing: 0.28em;
  color: var(--accent-2);
  text-transform: uppercase;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(34px, 6vw, 52px);
  margin-bottom: 20px;
}
.hero .tagline {
  font-size: 17px;
  color: var(--text-soft);
  max-width: 560px;
  margin: 0 auto 36px;
}
.hero .links { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* 按钮 */
.btn {
  display: inline-block;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text);
  font-size: 14px;
  transition: all 0.18s;
}
.btn:hover { text-decoration: none; border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { opacity: 0.88; color: #fff; }

/* 首页四色按钮 */
.btn.c1, .btn.c2, .btn.c3, .btn.c4 {
  color: #fff;
  font-weight: 600;
  border: none;
  padding: 11px 24px;
}
.btn.c1 { background: #c2410c; }   /* 赭橙 */
.btn.c2 { background: #1c5d99; }   /* 靛蓝 */
.btn.c3 { background: #2f6b57; }   /* 墨绿 */
.btn.c4 { background: #7c3f6d; }   /* 绛紫 */
.btn.c1:hover, .btn.c2:hover, .btn.c3:hover, .btn.c4:hover {
  color: #fff;
  filter: brightness(1.12);
  transform: translateY(-2px);
}
[data-theme="dark"] .btn.c1 { background: #d4551f; }
[data-theme="dark"] .btn.c2 { background: #2872b8; }
[data-theme="dark"] .btn.c3 { background: #3a8069; }
[data-theme="dark"] .btn.c4 { background: #955084; }

/* ---------- 首页：自然的意义 引文块 ---------- */
.feature-quote {
  display: block;
  position: relative;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  padding: 30px 34px 26px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-quote:hover {
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: 0 4px 10px rgba(45,40,28,.09), 0 18px 40px rgba(45,40,28,.12);
}
.feature-quote .fq-label {
  display: block;
  font-family: Georgia, "Songti SC", "SimSun", serif;
  font-size: 20px; font-weight: 700;
  color: var(--accent-2);
  margin-bottom: 12px;
}
.feature-quote p {
  font-family: Georgia, "Times New Roman", "Songti SC", "STSong", serif;
  font-size: 18px;
  line-height: 2;
  color: var(--text);
  margin-bottom: 14px;
}
.feature-quote .fq-more { font-size: 14px; color: var(--accent); font-weight: 600; }
@media (max-width: 560px) {
  .feature-quote { padding: 24px 20px 20px; }
  .feature-quote p { font-size: 16.5px; line-height: 1.95; }
}

/* ---------- 区块 ---------- */
.section { padding: 64px 0; border-top: 1px solid var(--line); }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 32px;
}
.section-head h2 { font-size: 26px; }
.section-head .more { font-size: 14px; color: var(--text-soft); }

/* 卡片 */
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 900px) { .card-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .card-grid { grid-template-columns: 1fr; } }

.card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.card:hover { transform: translateY(-3px); text-decoration: none; box-shadow: 0 4px 8px rgba(45,40,28,.08), 0 16px 36px rgba(45,40,28,.1); }
.card .thumb { aspect-ratio: 3 / 2; overflow: hidden; background: var(--bg-elev); }
.card .thumb.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 44px;
  background: linear-gradient(135deg, var(--bg-elev), var(--accent-soft));
}
.card .thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.card:hover .thumb img { transform: scale(1.04); }
.card .body { padding: 18px 20px 20px; }
.card .body .meta { font-size: 12px; color: var(--text-soft); letter-spacing: 0.08em; margin-bottom: 6px; }
.card .body h3 { font-size: 18px; color: var(--text); margin-bottom: 6px; }
.card .body p { font-size: 14px; color: var(--text-soft); line-height: 1.7; }

/* ---------- 相册 ---------- */
.gallery {
  columns: 3 300px;
  column-gap: 18px;
}
.gallery figure {
  break-inside: avoid;
  margin-bottom: 18px;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--line);
  cursor: zoom-in;
}
.gallery figure img { width: 100%; transition: transform 0.35s; }
.gallery figure:hover img { transform: scale(1.03); }
.gallery figcaption {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.6;
}
.gallery figcaption b { color: var(--text); display: block; font-weight: 600; font-size: 14px; margin-bottom: 2px; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0;
  z-index: 100;
  background: rgba(12, 11, 9, 0.94);
  display: none;
  align-items: center; justify-content: center;
  flex-direction: column;
  gap: 14px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 78vh; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
.lightbox .lb-caption { color: #cfc9bd; font-size: 14px; max-width: 80vw; text-align: center; }
.lightbox .lb-close {
  position: absolute; top: 18px; right: 22px;
  background: none; border: none; color: #cfc9bd;
  font-size: 32px; cursor: pointer; line-height: 1;
}
.lightbox .lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #cfc9bd;
  font-size: 40px; cursor: pointer; padding: 10px 18px;
}
.lightbox .lb-prev { left: 8px; }
.lightbox .lb-next { right: 8px; }

/* ---------- 文章（日记）排版 ---------- */
.article-head { padding: 40px 0 20px; }
.article-head .kicker { font-size: 13px; letter-spacing: 0.2em; color: var(--accent-2); margin-bottom: 12px; }
.article-head h1 { font-size: clamp(26px, 4.5vw, 38px); margin-bottom: 14px; }
.article-head .date { color: var(--text-soft); font-size: 14px; }

.article-body { padding-bottom: 80px; }
/* 正文内一级标题（长文分部，如「在自然圈实现的梦想」） */
.article-body h1 {
  font-size: 30px;
  margin: 64px 0 24px;
  padding-top: 40px;
  border-top: 2px solid var(--accent-soft);
  color: var(--accent);
  scroll-margin-top: 84px;
}
body.essay .article-head h1 { color: var(--accent); }

.article-body h2 {
  font-size: 22px;
  margin: 48px 0 16px;
  scroll-margin-top: 84px;
  color: var(--accent-2);
}
.article-body h3 {
  font-size: 19px;
  margin: 36px 0 12px;
  scroll-margin-top: 84px;
  color: var(--accent);
}
.article-body p { margin: 0 0 20px; font-size: 16.5px; line-height: 1.95; }
.article-body figure { margin: 28px 0; }
.article-body figure img { border-radius: var(--radius); box-shadow: var(--shadow); }
.article-body figcaption {
  font-size: 12.5px; color: var(--text-soft);
  text-align: center; margin-top: 10px;
}
.article-body blockquote {
  margin: 28px 0;
  padding: 4px 0 4px 20px;
  border-left: 3px solid var(--accent);
  color: var(--text-soft);
  font-size: 15px;
}
.article-body hr { border: none; border-top: 1px solid var(--line); margin: 48px 0; }

/* 表格 */
.article-body .table-wrap { overflow-x: auto; margin: 28px 0; -webkit-overflow-scrolling: touch; }
.article-body table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 14.5px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.article-body th, .article-body td {
  border-bottom: 1px solid var(--line);
  padding: 11px 14px;
  text-align: left;
  vertical-align: top;
  line-height: 1.7;
}
.article-body th {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}
.article-body tbody tr:last-child td { border-bottom: none; }
.article-body tbody tr:hover { background: var(--bg-elev); }
.article-body td b { color: var(--text); }

/* 野外日记正文图片统一 350px */
body.diary .article-body figure img {
  width: 350px;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* 文章尾注 */
.article-footer {
  margin-top: 64px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  font-size: 14px; color: var(--text-soft);
}

/* 侧边目录 */
.toc-side { position: sticky; top: 84px; align-self: start; padding-top: 40px; }
.toc-side .toc-title {
  font-size: 12px; letter-spacing: 0.22em;
  color: var(--text-soft); margin-bottom: 14px;
}
.toc-side ul { list-style: none; border-left: 1px solid var(--line); }
.toc-side li a {
  display: block;
  padding: 6px 0 6px 16px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  font-size: 13.5px;
  color: var(--text-soft);
  line-height: 1.5;
  transition: color 0.15s, border-color 0.15s;
}
.toc-side li a:hover { text-decoration: none; color: var(--text); }
.toc-side li.toc-h1 a,
.toc-side li.toc-h1 span {
  display: block;
  padding: 10px 0 6px 16px;
  font-size: 13.5px;
  color: var(--accent);
  font-weight: 700;
}
.toc-side li.toc-sub a { padding-left: 28px; }
.toc-side li a.toc-active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
@media (max-width: 1100px) {
  .toc-side { padding-top: 40px; }
  .toc-side li a { font-size: 13px; padding-left: 12px; }
}
@media (max-width: 620px) {
  /* 极窄屏：不再吸顶，作为展开的目录块放在正文上方 */
  .toc-side {
    position: static;
    padding: 24px 0 4px;
    margin-bottom: 8px;
  }
}

/* ---------- 关于页 ---------- */
.about-grid { display: grid; grid-template-columns: 240px 1fr; gap: 48px; padding: 40px 0 72px; }
@media (max-width: 720px) { .about-grid { grid-template-columns: 1fr; } }
.avatar-box { text-align: center; }
.avatar {
  width: 100%; max-width: 220px;
  aspect-ratio: 3 / 4;
  border-radius: 14px;
  object-fit: cover;
  object-position: center top;
  margin: 0 auto 16px;
  border: 4px solid var(--bg-card);
  box-shadow: var(--shadow);
}
.about-body h2 {
  font-size: 22px; margin: 40px 0 12px;
  padding-bottom: 8px; border-bottom: 1px solid var(--line);
  color: var(--accent-2);
}
.about-body h3 { font-size: 17px; margin: 22px 0 0; color: var(--accent); }
.about-body .meta-line {
  font-size: 13px; color: var(--text-soft);
  margin-bottom: 6px;
}
.about-body .sub {
  font-size: 16px; font-weight: 700; color: var(--text);
  margin: 16px 0 0;
}
.about-body .info-bar {
  font-size: 14px; color: var(--text-soft);
  border-left: 3px solid var(--accent);
  padding-left: 14px; margin: 12px 0 4px; line-height: 1.9;
}
.about-body ul { list-style: none; margin: 8px 0; }
.about-body li { padding: 7px 0 7px 22px; position: relative; color: var(--text-soft); }
.about-body li::before { content: "·"; position: absolute; left: 6px; color: var(--accent); font-weight: 700; }
.about-body li b { color: var(--text); font-weight: 600; }

/* ---------- 页脚 ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 36px 0;
  text-align: center;
  color: var(--text-soft);
  font-size: 13px;
}
.site-footer a { color: var(--text-soft); }
.site-footer a:hover { color: var(--accent); }

/* ---------- 返回顶部 ---------- */
.back-top {
  position: fixed; right: 22px; bottom: 26px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 16px;
  display: none;
  box-shadow: var(--shadow);
  z-index: 40;
}
.back-top.show { display: block; }
