/* ============================================================
   植被通讯 · 森林植被主题 v4
   Rich visual depth through cards, shadows, counters & typography
   No gradients · No emoji · No SVG · No underlines
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700;900&display=swap');

/* ============================================================
   §1  Design Tokens
   ============================================================ */
:root {
  --font-song: "Noto Serif SC", "Songti SC", STSong, "Source Han Serif SC", SimSun, serif;
  --font-hei:  "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Forest palette */
  --moss-900: #112b1a;
  --moss-800: #163520;
  --moss-700: #1e4a2f;
  --moss-600: #28663f;
  --moss-500: #2d8c4a;
  --moss-400: #3da35d;
  --moss-300: #5cb874;
  --moss-200: #8ed09c;
  --moss-100: #c2e5c8;
  --moss-50:  #eaf5ec;
  --moss-25:  #f4faf5;

  --leaf-500: #8bcf43;
  --leaf-100: #e8f4d6;

  /* Functional */
  --color-primary:      var(--moss-500);
  --color-primary-dark: var(--moss-700);
  --color-bg:           #ffffff;
  --color-bg-page:      #f0f4ed;
  --color-bg-card:      #ffffff;
  --color-bg-sidebar:   #f7faf6;
  --color-text:         #263a2b;
  --color-text-sub:     #4b6150;
  --color-text-muted:   #728a77;
  --color-border:       #cddcc7;
  --color-border-faint: #e0ead9;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(17,43,26,0.05), 0 4px 8px rgba(17,43,26,0.04);
  --shadow-md: 0 2px 4px rgba(17,43,26,0.05), 0 8px 20px rgba(17,43,26,0.06);
  --shadow-lg: 0 4px 8px rgba(17,43,26,0.06), 0 12px 28px rgba(17,43,26,0.08), 0 28px 56px rgba(17,43,26,0.10);
  --shadow-xl: 0 4px 12px rgba(11,27,16,0.08), 0 16px 32px rgba(11,27,16,0.12), 0 32px 64px rgba(11,27,16,0.18);

  /* Layout */
  --page-max-w: 820px;
  --gutter: 2.8rem;

  /* docsify-themeable */
  --theme-color: var(--color-primary);
  --link-text-decoration: none;
  --heading-font-family: var(--font-hei);
  --blockquote-border-color: var(--moss-200);
}

/* ============================================================
   §2  Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-song);
  color: var(--color-text);
  background: var(--color-bg-page);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   §3  Sidebar
   ============================================================ */
.sidebar {
  background: var(--color-bg-sidebar);
  border-right: 1px solid var(--color-border-faint);
  font-family: var(--font-hei);
}

.sidebar .sidebar-nav { padding: 0.6rem 0 1rem; }

.sidebar ul li a {
  color: var(--color-text-sub);
  font-size: 0.93rem;
  line-height: 1.65;
  padding: 0.45rem 1.25rem 0.45rem 1.4rem;
  display: block;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.sidebar ul li a:hover {
  color: var(--moss-600);
  background: var(--moss-50);
  border-left-color: var(--moss-200);
}

.sidebar ul li.active > a {
  color: var(--moss-800);
  font-weight: 700;
  background: var(--moss-50);
  border-left-color: var(--moss-500);
}

.app-sub-sidebar { font-size: 0.88rem; }
.app-sub-sidebar li a {
  color: var(--color-text-muted) !important;
  padding-left: 2.2rem !important;
  font-size: 0.86rem;
}
.app-sub-sidebar li.active > a {
  color: var(--moss-700) !important;
  font-weight: 600;
}

.sidebar .app-name-link {
  font-family: var(--font-hei);
  font-weight: 700;
  color: var(--moss-800);
  font-size: 1rem;
  padding: 0.8rem 1.4rem 0.5rem;
  letter-spacing: 0.04em;
}

/* ============================================================
   §4  Search
   ============================================================ */
.search { margin-bottom: 0.8rem; padding: 0.4rem 0.9rem; }
.search .input-wrap { position: relative; }

.search .input-wrap input {
  display: block; width: 100%; box-sizing: border-box;
  font-family: var(--font-hei);
  font-size: 0.88rem; line-height: 1.3;
  padding: 0.55rem 2.4rem 0.55rem 3.2rem !important;
  border: 1px solid var(--color-border);
  border-radius: 5px;
  background: #fff; color: var(--color-text);
  transition: border-color 0.2s;
}
.search .input-wrap input:focus {
  border-color: var(--moss-400);
  outline: none;
}

.search .clear-button {
  -webkit-appearance: none; appearance: none;
  position: absolute; top: 50%; right: 0.7rem;
  width: 16px !important; min-width: 16px; max-width: 16px;
  height: 16px !important; padding: 0; border: 0;
  background: transparent; transform: translateY(-50%);
  display: none; align-items: center; justify-content: center; cursor: pointer;
}
.search .clear-button.show { display: inline-flex; }
.search .clear-button svg { display: block; width: 16px; height: 16px; }
.search .clear-button svg circle { fill: var(--moss-100); }
.search .clear-button svg path { stroke: var(--moss-700); }
.search .input-wrap input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none; appearance: none; display: none;
}

/* ============================================================
   §5  Main Content Area
   ============================================================ */
.content {
  background: var(--color-bg);
}

.markdown-section {
  max-width: var(--page-max-w);
  margin: 0 auto;
  padding: 2rem var(--gutter) 3.5rem;
  font-family: var(--font-song);
  font-size: 1.06rem;
  line-height: 2.05;
  color: var(--color-text);
}

/* ============================================================
   §6  Headings — Rich, card-based treatments
   ============================================================ */
.markdown-section h1,
.markdown-section h2,
.markdown-section h3,
.markdown-section h4,
.markdown-section h5,
.markdown-section h6 {
  font-family: var(--font-hei);
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.5;
}

/* ---- h1: Section title — bold with square accent ---- */
.markdown-section h1 {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--moss-900);
  margin: 0 0 2rem;
  padding: 0 0 0 1.4rem;
  position: relative;
  letter-spacing: 0.06em;
}

/* Green square accent */
.markdown-section h1::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.38em;
  width: 10px;
  height: 10px;
  background: var(--moss-500);
}

/* ---- h2: Article title — bold heading with left accent ---- */
.markdown-section h2 {
  margin: 3.5rem 0 1rem;
  padding: 0.15rem 0 0.15rem 1.2rem;
  background: none;
  border-left: 6px solid var(--moss-500);
  box-shadow: none;
  color: var(--moss-800);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-radius: 0;
}

/* First h2 right after h1 */
.markdown-section h1 + h2 {
  margin-top: 0.5rem;
}

/* ---- h3 ---- */
.markdown-section h3 {
  font-size: 1.08rem;
  margin: 2rem 0 0.6rem;
  color: var(--moss-700);
  padding-left: 0.9rem;
  border-left: 3px solid var(--moss-300);
}

/* ---- h4 ---- */
.markdown-section h4 {
  font-size: 1rem;
  margin: 1.4rem 0 0.4rem;
  color: var(--moss-700);
}

/* ============================================================
   §7  Body Text & Inline
   ============================================================ */
.markdown-section p {
  margin: 0.5rem 0 1.1rem;
  text-align: justify;
  text-justify: inter-ideograph;
}

.markdown-section a {
  color: var(--moss-500);
  text-decoration: none;
  transition: color 0.15s;
}
.markdown-section a:hover { color: var(--moss-700); }

.markdown-section strong {
  color: var(--moss-800);
  font-weight: 700;
}

.markdown-section em {
  font-style: italic;
  color: var(--color-text-sub);
}

.markdown-section code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.15em 0.4em;
  background: var(--moss-50);
  border: 1px solid var(--color-border-faint);
  border-radius: 3px;
  color: var(--moss-800);
}

.markdown-section blockquote {
  margin: 1.6rem 0;
  padding: 1.1rem 1.4rem;
  border-left: 5px solid var(--moss-400);
  background: var(--color-bg-card);
  color: var(--color-text-sub);
  font-size: 0.97rem;
  border-radius: 0 6px 6px 0;
  box-shadow: var(--shadow-sm);
}
.markdown-section blockquote p { margin: 0.3rem 0; }

.markdown-section ul,
.markdown-section ol {
  padding-left: 1.5rem;
  margin: 0.6rem 0 1.1rem;
}
.markdown-section li { margin: 0.35rem 0; }

.markdown-section hr {
  border: none;
  height: 0;
  margin: 3rem 0;
}

/* ============================================================
   §8  Images & Captions — Shadow card treatment
   ============================================================ */
.content-image,
.cover-logo,
.figure-card img {
  display: block;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.content-image {
  width: 100%;
  margin: 1.6rem auto 0.3rem;
  border: 1px solid var(--color-border-faint);
  border-radius: 6px;
  background: var(--color-bg-card);
  box-shadow: var(--shadow-md);
}

.content-image--narrow {
  max-width: 540px;
}

/* docsify-image-caption wrapper */
.markdown-section div[style*="display: inline-block"][style*="text-align: center"] {
  display: block !important;
  width: fit-content;
  max-width: 100%;
  margin: 1.6rem auto 1.4rem;
}
.markdown-section div[style*="display: inline-block"][style*="text-align: center"] > .content-image {
  margin: 0 auto 0;
}
.markdown-section div[style*="display: inline-block"][style*="text-align: center"] > br {
  display: none;
}

/* Image caption */
.markdown-section .img-caption {
  display: block;
  margin: 0.5rem auto 2rem;
  padding: 0;
  max-width: 88%;
  color: var(--color-text-muted);
  font-family: var(--font-song);
  font-size: 0.86rem;
  line-height: 1.75;
  text-align: center;
}

/* Native figure/figcaption */
.markdown-section figure {
  margin: 1.6rem auto 2rem;
  text-align: center;
}
.markdown-section figure img { margin: 0 auto; }
.markdown-section figcaption {
  margin-top: 0.5rem;
  color: var(--color-text-muted);
  font-family: var(--font-song);
  font-size: 0.86rem;
  line-height: 1.75;
}

/* Figure grid */
.figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.2rem;
  margin: 1.6rem 0;
}
.figure-card {
  padding: 0.9rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border-faint);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}
.figure-card img {
  width: 100%;
  border-radius: 4px;
  border: 1px solid var(--color-border-faint);
}
.figure-card h3 { margin: 0.65rem 0 0.2rem; font-size: 1rem; }
.figure-card p { margin: 0; color: var(--color-text-muted); font-size: 0.88rem; }

/* ============================================================
   §9  Cover Page — Deep green + elevated white card
   ============================================================ */
section.cover {
  min-height: 100vh;
  background: var(--moss-800) !important;
  background-image: none !important;
  position: relative;
  overflow: hidden;
}

.cover.show {
  background: var(--moss-800) !important;
  background-image: none !important;
}

section.cover .mask { background: transparent; }

/* Subtle large decorative circles on cover */
section.cover::before {
  content: "";
  position: absolute;
  top: -120px;
  right: -120px;
  width: 480px;
  height: 480px;
  border-radius: 50%;
  background: rgba(255,255,255,0.025);
  pointer-events: none;
}
section.cover::after {
  content: "";
  position: absolute;
  bottom: -80px;
  left: -80px;
  width: 360px;
  height: 360px;
  border-radius: 50%;
  background: rgba(255,255,255,0.02);
  pointer-events: none;
}

section.cover .cover-main {
  color: var(--color-text);
  max-width: min(640px, 92vw);
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* Cover card */
.cover-panel {
  margin: 0 auto;
  width: min(480px, 100%);
  padding: 3.5rem 3rem 3rem;
  background: #ffffff;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow-xl);
}

/* Green top accent */
.cover-panel::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: var(--moss-500);
}

.cover-logo {
  width: 72px;
  margin: 0 auto 1.4rem;
}

.cover-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.cover-issue,
.cover-date {
  margin: 0;
  font-family: var(--font-hei);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--moss-500);
}

.cover-issue::after {
  content: "|";
  margin: 0 0.6rem;
  color: var(--color-border);
  font-weight: 300;
}

section.cover h1 {
  margin: 0.8rem 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--moss-900);
  line-height: normal;
  letter-spacing: 0;
  font-synthesis: none;
}

/* Override: no square accent on cover h1 */
section.cover h1::before { display: none; }

.cover-title-cn {
  display: block;
  font-family: var(--font-hei);
  font-size: clamp(2.8rem, 5.5vw, 3.6rem);
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: 0.14em;
  color: var(--moss-900);
}

section.cover h1 small {
  display: block;
  position: static !important;
  font-family: var(--font-hei);
  font-size: clamp(0.78rem, 1.2vw, 0.92rem);
  font-weight: 400;
  letter-spacing: 0.28em;
  color: var(--color-text-muted);
  text-transform: uppercase;
}

.cover-english {
  margin: 1rem 0 0;
  font-family: var(--font-hei);
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--color-text-sub);
  letter-spacing: 0.04em;
}

/* Thin divider line */
.cover-leaf-line {
  display: block;
  margin: 1.5rem auto 0;
  width: 48px;
  height: 1px;
  background: var(--moss-300);
}

/* CTA button */
.cover-action { margin: 1.5rem 0 0; }

section.cover .cover-main > .cover-action a {
  display: inline-block;
  font-family: var(--font-hei);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: #ffffff;
  background: var(--moss-600);
  border: 2px solid var(--moss-600);
  padding: 0.72rem 2.6rem;
  border-radius: 4px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

section.cover .cover-main > .cover-action a:hover {
  background: var(--moss-700);
  border-color: var(--moss-700);
  box-shadow: var(--shadow-md);
  color: #ffffff;
}

/* ============================================================
   §10  Directory / Table of Contents — Numbered cards
   ============================================================ */
.directory-subtitle {
  font-family: var(--font-hei);
  font-size: 0.88rem;
  color: var(--color-text-muted);
  letter-spacing: 0.1em;
  margin: 0;
  text-align: center;
  padding-bottom: 0.4rem;
}

.directory-note, .section-lead {
  color: var(--color-text-muted);
  font-size: 0.94rem;
}

/* SVG divider removed from JS template */

/* CSS Counter for section numbering */
.directory-shell {
  margin-top: 1.8rem;
  counter-reset: dir-section;
}

/* ---- Directory block: elevated card with number ---- */
.directory-block {
  counter-increment: dir-section;
  position: relative;
  margin: 0 0 1.4rem;
  padding: 1.3rem 1.5rem 1.2rem 5rem;
  background: var(--color-bg-card);
  border-left: 5px solid var(--moss-500);
  border-radius: 0 6px 6px 0;
  box-shadow: var(--shadow-md);
}

/* Large decorative section number */
.directory-block::before {
  content: counter(dir-section, decimal-leading-zero);
  position: absolute;
  left: 1.1rem;
  top: 1.15rem;
  font-family: var(--font-hei);
  font-size: 2.2rem;
  font-weight: 900;
  line-height: 1;
  color: var(--moss-100);
  letter-spacing: -0.02em;
}

.directory-block--section-only {
  padding-bottom: 1rem;
}

/* Override h2 card treatment for directory headings */
h2.directory-heading,
.directory-block h2.directory-heading,
.markdown-section .directory-heading {
  margin: 0 !important;
  padding: 0 !important;
  background: none !important;
  box-shadow: none !important;
  border-left: none !important;
  border-radius: 0 !important;
  font-family: var(--font-hei);
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--moss-800);
  border: 0 !important;
  line-height: 1.5;
  letter-spacing: 0.06em;
}

.directory-heading a {
  color: inherit;
  text-decoration: none;
  transition: color 0.15s;
}
.directory-heading a:hover { color: var(--moss-500); }

.directory-links {
  margin: 0.5rem 0 0;
  padding-left: 0;
  list-style: none;
  counter-reset: article-num;
}

.directory-links li {
  counter-increment: article-num;
  display: flex;
  align-items: baseline;
  margin: 0;
  padding: 0.25rem 0;
  font-family: var(--font-song);
  font-size: 0.96rem;
  line-height: 1.8;
  color: var(--color-text);
}

/* Article number — flexbox baseline ensures perfect alignment */
.directory-links li::before {
  content: counter(article-num) ".";
  flex-shrink: 0;
  width: 1.6rem;
  font-family: var(--font-hei);
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--moss-400);
}

.directory-links li a {
  color: var(--color-text);
  text-decoration: none;
  transition: color 0.15s;
}
.directory-links li a:hover { color: var(--moss-500); }

/* ============================================================
   §11  Pagination
   ============================================================ */
.docsify-pagination-container {
  margin-top: 3rem;
  padding: 1.2rem 1.4rem;
  font-family: var(--font-hei);
  background: var(--color-bg-card);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
}

.pagination-item-label {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
}

.pagination-item-title {
  color: var(--moss-700);
  font-weight: 600;
}

/* ============================================================
   §12  Scrollbar
   ============================================================ */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb {
  background: var(--moss-200);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--moss-400); }

/* ============================================================
   §13  Responsive — Tablet
   ============================================================ */
@media screen and (max-width: 768px) {
  :root { --gutter: 1.2rem; }

  .markdown-section {
    font-size: 1rem;
    line-height: 1.95;
  }

  .markdown-section h1 {
    font-size: 1.45rem;
    padding-left: 1.2rem;
  }
  .markdown-section h1::before {
    width: 8px; height: 8px;
  }

  .markdown-section h2 {
    font-size: 1.12rem;
    margin-top: 2.6rem;
    padding: 0.85rem 1.1rem;
  }

  .markdown-section h3 {
    font-size: 0.98rem;
    padding-left: 0.7rem;
  }

  .markdown-section p { text-align: left; }

  /* Cover */
  section.cover::before { width: 280px; height: 280px; top: -60px; right: -80px; }
  section.cover::after { width: 200px; height: 200px; bottom: -40px; left: -50px; }

  .cover-panel {
    width: min(100%, 380px);
    padding: 2.4rem 1.5rem 2rem;
  }
  .cover-logo { width: 60px; margin-bottom: 1.1rem; }
  .cover-issue, .cover-date { font-size: 0.78rem; letter-spacing: 0.08em; }
  .cover-title-cn {
    font-size: clamp(2rem, 10vw, 2.8rem);
    letter-spacing: 0.1em;
  }
  section.cover h1 small { font-size: 0.74rem; letter-spacing: 0.14em; }
  .cover-english { font-size: 0.82rem; margin-top: 0.7rem; }
  .cover-leaf-line { width: 32px; margin-top: 1.1rem; }
  .cover-action { margin-top: 1.2rem; }
  section.cover .cover-main > .cover-action a {
    padding: 0.6rem 1.8rem; font-size: 0.86rem;
  }

  /* Directory */
  .directory-block {
    padding: 1rem 1.1rem 0.9rem 4rem;
  }
  .directory-block::before { font-size: 1.8rem; left: 0.8rem; top: 0.9rem; }
  h2.directory-heading { font-size: 1.06rem !important; }
  .directory-links li { font-size: 0.92rem; padding-left: 1rem; }

  /* Captions */
  .markdown-section .img-caption { font-size: 0.82rem; max-width: 100%; }

  .figure-card { padding: 0.6rem; }
}

/* ============================================================
   §14  Responsive — Phone
   ============================================================ */
@media screen and (max-width: 480px) {
  :root { --gutter: 0.9rem; }

  .markdown-section {
    font-size: 0.96rem;
    line-height: 1.88;
  }

  .markdown-section h1 {
    font-size: 1.25rem;
    padding-left: 1rem;
  }
  .markdown-section h1::before { width: 7px; height: 7px; }

  .markdown-section h2 {
    font-size: 1.04rem;
    padding: 0.7rem 0.9rem;
    margin-top: 2rem;
  }

  .markdown-section h3 { font-size: 0.94rem; }

  /* Cover */
  .cover-panel { padding: 2rem 1.1rem 1.7rem; }
  .cover-title-cn { font-size: clamp(1.8rem, 9vw, 2.2rem); }

  /* Directory */
  .directory-block {
    padding-left: 3.2rem;
  }
  .directory-block::before { font-size: 1.5rem; left: 0.6rem; }
}

/* ============================================================
   §15  Print
   ============================================================ */
@media print {
  .sidebar, .app-nav, .search, .cover { display: none !important; }
  .markdown-section { max-width: 100%; padding: 0; }
  .markdown-section h1 { padding-left: 0; }
  .markdown-section h1::before { display: none; }
  .markdown-section h2 {
    background: none; box-shadow: none; border-left: 3px solid #333;
    border-radius: 0; padding: 0.3rem 0.8rem;
  }
  .content-image { border: 1px solid #ccc; box-shadow: none; }
  .directory-block { box-shadow: none; border: 1px solid #ccc; }
}
