/* OpenHuman 中文教程 - 单页 SEO 站
   纯 HTML + CSS，零 JS。暗黑模式跟随系统 (prefers-color-scheme)
   风格：墨绿 + 锈红 + 米金 三色，衬线大标题，杂志式不对称排版 */

:root {
  --paper: #fafaf6;
  --paper-soft: #f0eee5;
  --ink: #1a1a1a;
  --ink-soft: #5a5a52;
  --rule: #d6d2c4;
  --moss: #2d5a4a;
  --terracotta: #a85b3a;
  --gold: #c8a560;

  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;

  --max-width: 1240px;
  --header-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #14140f;
    --paper-soft: #1f1f1a;
    --ink: #f0eee5;
    --ink-soft: #b4b0a4;
    --rule: #3a3a32;
    --moss: #6ba88f;
    --terracotta: #d68966;
    --gold: #e3c081;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.7;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: var(--terracotta);
  text-decoration: none;
  border-bottom: 1px dotted var(--terracotta);
  transition: all 0.18s;
}
a:hover {
  color: var(--moss);
  border-bottom-color: var(--moss);
  border-bottom-style: solid;
}

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

/* === Header === */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(250, 250, 246, 0.92);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}

@media (prefers-color-scheme: dark) {
  .site-header { background: rgba(20, 20, 15, 0.92); }
}

.site-header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.site-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  border-bottom: none;
}
.site-logo:hover { color: var(--ink); border-bottom: none; }
.site-logo svg { width: 28px; height: 28px; display: block; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.site-nav a {
  color: var(--ink-soft);
  font-size: 0.95rem;
  font-weight: 500;
  border-bottom: none;
}
.site-nav a:hover { color: var(--ink); border-bottom: none; }

/* === Hero === */
.hero {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 5rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 4rem;
  align-items: center;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 3rem 1.5rem 2rem;
  }
}

.hero-eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.hero-eyebrow::before {
  content: "§";
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.2rem;
  text-transform: none;
  letter-spacing: 0;
}

.hero h1 {
  font-family: var(--serif);
  font-size: clamp(2rem, 4.8vw, 3.6rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 1.4rem;
  color: var(--ink);
}
.hero h1 .accent-moss { color: var(--moss); font-style: italic; font-weight: 600; }
.hero h1 .accent-terra { color: var(--terracotta); font-style: italic; font-weight: 600; }

.hero-lead {
  font-size: 1.08rem;
  line-height: 1.78;
  color: var(--ink-soft);
  max-width: 540px;
  margin: 0 0 2rem;
}
.hero-lead strong { color: var(--moss); font-weight: 600; }

.hero-cta {
  display: inline-flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.4rem;
  font-weight: 600;
  font-size: 0.98rem;
  border-radius: 4px;
  border: 1px solid transparent;
  transition: all 0.18s;
  font-family: inherit;
  cursor: pointer;
}
.btn-primary {
  background: var(--moss);
  color: var(--paper);
  border-color: var(--moss);
  border-bottom: 1px solid var(--moss);
}
.btn-primary:hover {
  background: var(--paper);
  color: var(--moss);
  border-color: var(--moss);
  border-bottom: 1px solid var(--moss);
}
.btn-secondary {
  border-color: var(--ink);
  color: var(--ink);
  background: transparent;
  border-bottom: 1px solid var(--ink);
}
.btn-secondary:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.hero-meta {
  margin: 2rem 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9rem;
  color: var(--ink-soft);
}
.hero-meta a {
  color: var(--terracotta);
  border-bottom: 1px dotted var(--terracotta);
}

.hero-art {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
}
.hero-art svg { width: 100%; max-width: 340px; }
.hero-art::before {
  content: "";
  position: absolute;
  inset: -20px;
  background: radial-gradient(ellipse at center, var(--paper-soft) 0%, transparent 70%);
  z-index: -1;
  border-radius: 50%;
}

@media (max-width: 900px) {
  .hero-art { min-height: 200px; }
  .hero-art svg { max-width: 220px; }
}

/* === Section === */
.section {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3.5rem 1.5rem;
}
.section-narrow { max-width: 880px; }

.section-cap {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin: 0 0 0.75rem;
}

.section h2 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 2.8vw, 2.1rem);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 1rem;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.section h2 .underline {
  background-image: linear-gradient(transparent 70%, var(--gold) 70%);
  background-repeat: no-repeat;
  padding: 0 0.15em;
}

.section h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 1.8rem 0 0.6rem;
  color: var(--ink);
}
.section h3::before {
  content: "¶ ";
  color: var(--terracotta);
  font-family: var(--serif);
  font-weight: 400;
}

.section h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.2rem 0 0.4rem;
  color: var(--moss);
}

.section p {
  font-size: 1rem;
  line-height: 1.78;
  margin: 0.85rem 0;
  color: var(--ink);
}
.section p strong { color: var(--moss); font-weight: 700; }
.section p em { font-style: italic; color: var(--terracotta); font-weight: 500; }

.section ul,
.section ol {
  padding-left: 1.5rem;
  margin: 0.85rem 0;
  line-height: 1.85;
}
.section li { margin: 0.3rem 0; }

/* === Pull-quote === */
.pullquote {
  font-family: var(--serif);
  font-size: 1.4rem;
  font-style: italic;
  line-height: 1.55;
  color: var(--moss);
  border-left: 3px solid var(--terracotta);
  padding: 0.4rem 0 0.4rem 1.5rem;
  margin: 2rem 0;
  max-width: 720px;
}
.pullquote::before {
  content: "❝";
  font-size: 2.4rem;
  color: var(--terracotta);
  line-height: 0;
  position: relative;
  top: 0.5rem;
  margin-right: 0.4rem;
}
.pullquote cite {
  display: block;
  font-style: normal;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-family: var(--sans);
  margin-top: 0.6rem;
  letter-spacing: 0.04em;
}
.pullquote cite::before { content: "— "; }

/* === Diagram === */
.diagram {
  margin: 2.5rem 0;
  padding: 1.5rem;
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.diagram img {
  width: 100%;
  height: auto;
}

@media (prefers-color-scheme: dark) {
  .diagram img {
    filter: invert(0.92) hue-rotate(180deg);
  }
}

.diagram-caption {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-style: italic;
  text-align: center;
  font-family: var(--serif);
}

/* === Stats === */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin: 2.5rem 0;
}
.stat {
  border-top: 2px solid var(--moss);
  padding: 1rem 0 0;
}
.stat-num {
  font-family: var(--serif);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--moss);
  line-height: 1.05;
  margin: 0 0 0.3rem;
  letter-spacing: -0.01em;
}
.stat-num .small { font-size: 1.2rem; color: var(--terracotta); }
.stat-label {
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

/* === Feature Grid === */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.feature {
  padding: 1.3rem 1.4rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--paper);
  transition: all 0.18s;
}
.feature:hover {
  border-color: var(--moss);
  transform: translateY(-2px);
}
.feature h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}
.feature h3::before { content: ""; }
.feature p {
  margin: 0;
  font-size: 0.94rem;
  color: var(--ink-soft);
  line-height: 1.7;
}

/* === FAQ === */
.faq h3 {
  border-top: 1px dotted var(--rule);
  padding-top: 1.4rem;
}
.faq h3:first-of-type {
  border-top: none;
  padding-top: 0;
}

/* === Hairline === */
.hairline {
  border: 0;
  border-top: 1px dashed var(--rule);
  max-width: 80px;
  margin: 2.5rem auto;
}

/* === CTA Final === */
.cta-final {
  background: var(--paper-soft);
  padding: 4rem 1.5rem;
  text-align: center;
  margin-top: 3rem;
}
.cta-final h2 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 1rem;
  color: var(--ink);
}
.cta-final p {
  max-width: 580px;
  margin: 0 auto 1.5rem;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.75;
}

/* === Footer === */
.site-footer {
  border-top: 1px solid var(--rule);
  padding: 2rem 1.5rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  text-align: center;
  line-height: 1.8;
}
.site-footer p { margin: 0.3rem 0; }
.site-footer a {
  color: var(--ink-soft);
  border-bottom: 1px dotted var(--ink-soft);
}
.site-footer a:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

/* ====================================================================
   === Docs 文档页样式 ============================================== */

.docs-layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 3rem;
  min-height: calc(100vh - var(--header-h));
}
@media (max-width: 900px) {
  .docs-layout { grid-template-columns: 1fr; gap: 0; padding: 0 1rem; }
}

.docs-sidebar {
  border-right: 1px solid var(--rule);
  padding: 2rem 1rem 2rem 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}
@media (max-width: 900px) {
  .docs-sidebar {
    position: static; height: auto;
    border-right: none; border-bottom: 1px solid var(--rule);
    padding: 1rem 0; margin-bottom: 1rem;
  }
}

.sidebar-group { margin-bottom: 1.4rem; }
.sidebar-group-title {
  font-size: 0.74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--terracotta);
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.15rem;
  font-family: var(--sans);
}
.sidebar-link {
  display: block;
  padding: 0.42rem 0.75rem;
  border-radius: 4px;
  color: var(--ink-soft);
  font-size: 0.92rem;
  border-bottom: none;
  border-left: 3px solid transparent;
  transition: all 0.15s;
}
.sidebar-link:hover {
  background: var(--paper-soft);
  color: var(--ink);
  border-bottom: none;
}
.sidebar-link.active {
  background: var(--paper-soft);
  color: var(--moss);
  font-weight: 600;
  border-left: 3px solid var(--moss);
}

.docs-main {
  padding: 2rem 0 4rem;
  min-width: 0;
  max-width: 780px;
}

.docs-content h1 {
  font-family: var(--serif);
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  font-weight: 800;
  margin: 0 0 0.6rem;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.22;
}

.docs-content h2 {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2.2rem 0 0.8rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  color: var(--ink);
  letter-spacing: -0.005em;
}

.docs-content h3 {
  font-size: 1.13rem;
  font-weight: 700;
  margin: 1.8rem 0 0.55rem;
  color: var(--ink);
}
.docs-content h3::before { content: "¶ "; color: var(--terracotta); font-family: var(--serif); font-weight: 400; }

.docs-content h4 {
  font-size: 1rem;
  font-weight: 700;
  margin: 1.3rem 0 0.4rem;
  color: var(--moss);
}

.docs-content p {
  margin: 0.85rem 0;
  line-height: 1.78;
}
.docs-content p strong { color: var(--moss); font-weight: 700; }
.docs-content p em { font-style: italic; color: var(--terracotta); }

.docs-content ul,
.docs-content ol {
  padding-left: 1.5rem;
  margin: 0.85rem 0;
  line-height: 1.85;
}
.docs-content li { margin: 0.35rem 0; }

.docs-content code {
  font-family: "SF Mono", Consolas, "Liberation Mono", monospace;
  font-size: 0.88em;
  background: var(--paper-soft);
  padding: 0.15em 0.42em;
  border-radius: 3px;
  color: var(--terracotta);
}
.docs-content pre {
  background: var(--paper-soft);
  padding: 1.1rem 1.3rem;
  border-radius: 6px;
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--rule);
  font-size: 0.9rem;
  line-height: 1.55;
}
.docs-content pre code {
  background: none; padding: 0; color: var(--ink);
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 0.94rem;
}
.docs-content th,
.docs-content td {
  border: 1px solid var(--rule);
  padding: 0.55rem 0.75rem;
  text-align: left;
  vertical-align: top;
}
.docs-content th {
  background: var(--paper-soft);
  font-weight: 600;
}

.docs-content kbd {
  background: var(--paper-soft);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.1rem 0.4rem;
  font-family: "SF Mono", monospace;
  font-size: 0.85em;
  box-shadow: 0 1px 0 var(--rule);
}

.docs-content blockquote {
  border-left: 3px solid var(--terracotta);
  background: var(--paper-soft);
  margin: 1.2rem 0;
  padding: 0.7rem 1.1rem;
  color: var(--ink-soft);
  border-radius: 0 4px 4px 0;
  font-style: italic;
}
.docs-content blockquote p:first-child { margin-top: 0; }
.docs-content blockquote p:last-child { margin-bottom: 0; }

.docs-meta {
  color: var(--ink-soft);
  font-size: 0.85rem;
  margin: 0 0 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}
.docs-meta-version {
  display: inline-block;
  background: var(--paper-soft);
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  font-family: "SF Mono", monospace;
  font-size: 0.85em;
}
.docs-meta-updated::before { content: "📅 "; }

.callout {
  border-radius: 4px;
  padding: 0.95rem 1.15rem;
  margin: 1.3rem 0;
  border-left: 4px solid;
  background: var(--paper-soft);
  font-size: 0.95rem;
  line-height: 1.7;
}
.callout p:first-child { margin-top: 0; }
.callout p:last-child { margin-bottom: 0; }
.callout-info { border-left-color: #3b82f6; }
.callout-warning { border-left-color: #f59e0b; }
.callout-danger { border-left-color: #ef4444; }
.callout-tip { border-left-color: var(--moss); }
.callout-title {
  font-weight: 700;
  margin-bottom: 0.35rem;
  display: block;
}

.docs-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  gap: 1rem;
  flex-wrap: wrap;
}
.docs-nav-prev,
.docs-nav-next {
  flex: 1 1 220px;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  border-bottom: 1px solid var(--rule);
  transition: all 0.15s;
}
.docs-nav-next { text-align: right; }
.docs-nav-prev:hover,
.docs-nav-next:hover {
  border-color: var(--moss);
  border-bottom-color: var(--moss);
}
.docs-nav-label {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.25rem;
  opacity: 0.7;
}
.docs-nav-title {
  display: block;
  color: var(--moss);
  font-weight: 600;
}
