/* LangChain 实战教程 — 清爽专业浅灰 + 翠绿 accent */
:root {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --card: #ffffff;
  --card-hover: #f0fdf4;
  --border: rgba(15,23,42,0.10);
  --border-bright: rgba(15,23,42,0.20);
  --text: #0f172a;
  --text-2: #334155;
  --text-3: #64748b;
  --accent: #10b981;
  --accent-2: #059669;
  --accent-light: rgba(16,185,129,0.12);
  --accent-glow: rgba(16,185,129,0.18);
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --purple: #8b5cf6;
  --yellow: #eab308;
  --radius: 8px;
  --radius-lg: 12px;
  --max-w: 760px;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'SF Pro Text', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  line-height: 1.75;
  min-height: 100vh;
}

/* ── NAV ───────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 2rem;
  height: 56px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.nav-back {
  color: var(--accent-2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.nav-back::before { content: '←'; }
.nav-back:hover { color: var(--accent); }

.nav-sep { color: var(--text-3); font-size: 0.875rem; }

.nav-title {
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── INDEX HERO ──────────────────────────────── */
.hero {
  position: relative;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f3d2e 100%);
  color: #fff;
  padding: 5rem 2rem 4rem;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 60% at 50% 50%, rgba(16,185,129,0.15) 0%, transparent 70%);
  pointer-events: none;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-light);
  border: 1px solid rgba(16,185,129,0.35);
  border-radius: 999px;
  padding: 0.3rem 1rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #6ee7b7;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
}

.hero h1 span { color: #34d399; }

.hero p {
  font-size: 1.1rem;
  color: #94a3b8;
  max-width: 580px;
  margin: 0 auto 2rem;
  position: relative;
  z-index: 1;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 2.5rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.stat-item { text-align: center; }
.stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: #34d399;
  line-height: 1;
}
.stat-label {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.2rem;
}

/* ── CONTAINER ───────────────────────────────── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* ── CARD LIST (index章节列表) ─────────────────── */
.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  padding: 2.5rem 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.22s ease;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px var(--accent-glow);
  transform: translateY(-2px);
  background: var(--card-hover);
}

.card-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}

.card p {
  font-size: 0.875rem;
  color: var(--text-3);
  line-height: 1.6;
  flex: 1;
}

.card-arrow {
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.4rem;
}

/* ── SECTION TITLES ──────────────────────────── */
.section-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin: 2.5rem 0 0.25rem;
}

.section-sub {
  font-size: 0.9rem;
  color: var(--text-3);
  margin-bottom: 1rem;
}

/* ── CHAPTER HERO ────────────────────────────── */
.chapter-hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #0f3d2e 100%);
  color: #fff;
  padding: 3.5rem 2rem 3rem;
  text-align: center;
}

.ch-num {
  font-size: 0.8rem;
  font-weight: 700;
  color: #6ee7b7;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.75rem;
}

.chapter-hero h1 {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 800;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}

.chapter-hero p {
  font-size: 1rem;
  color: #94a3b8;
  max-width: 600px;
  margin: 0 auto;
}

/* ── CONTENT AREA ────────────────────────────── */
.content {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.content h2 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text);
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--accent-light);
}

.content h2:first-of-type { margin-top: 1.5rem; }

.content h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin: 1.75rem 0 0.5rem;
}

.content h4 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-2);
  margin: 1.25rem 0 0.4rem;
}

.content p {
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.8;
  margin-bottom: 1rem;
}

.content ul, .content ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.content li {
  font-size: 1.05rem;
  color: var(--text-2);
  line-height: 1.8;
  margin-bottom: 0.3rem;
}

.content strong { color: var(--text); font-weight: 700; }

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

/* ── PROGRESS BAR ────────────────────────────── */
.progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 2rem;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── CALLOUT BOXES ───────────────────────────── */
.callout {
  border-radius: var(--radius);
  padding: 1.1rem 1.4rem;
  margin: 1.5rem 0;
  border-left: 4px solid transparent;
  font-size: 1rem;
  line-height: 1.75;
}

.callout-title {
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}

.callout.info {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #1e3a5f;
}
.callout.info .callout-title { color: #1d4ed8; }

.callout.tip {
  background: #f0fdf4;
  border-color: var(--accent);
  color: #14532d;
}
.callout.tip .callout-title { color: var(--accent-2); }

.callout.warning {
  background: #fffbeb;
  border-color: var(--orange);
  color: #78350f;
}
.callout.warning .callout-title { color: #b45309; }

.callout.danger {
  background: #fef2f2;
  border-color: var(--red);
  color: #7f1d1d;
}
.callout.danger .callout-title { color: #b91c1c; }

/* ── CODE ────────────────────────────────────── */
pre {
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.7;
  margin: 1.25rem 0;
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', Menlo, monospace;
  font-size: 0.88em;
}

p code, li code {
  background: #e2e8f0;
  color: #0f172a;
  padding: 0.1em 0.4em;
  border-radius: 4px;
  font-size: 0.875em;
}

/* Syntax highlighting */
.kw { color: #c792ea; font-weight: 600; }   /* keyword */
.ty { color: #82aaff; }                      /* type */
.st { color: #c3e88d; }                      /* string */
.cm { color: #546e7a; font-style: italic; }  /* comment */
.fn { color: #82aaff; }                      /* function */
.nu { color: #f78c6c; }                      /* number */
.at { color: #ffcb6b; }                      /* attribute/decorator */
.pr { color: #89ddff; }                      /* property/operator */

/* ── DEF LIST ─────────────────────────────────── */
.def-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.def-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
  align-items: start;
}

.def-term {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent-2);
  padding-top: 0.1rem;
  font-family: 'JetBrains Mono', monospace;
}

.def-desc {
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.7;
}

/* ── TWO-COL ─────────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin: 1.5rem 0;
}

@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

.col-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.col-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.6rem;
}

.col-card ul { padding-left: 1.2rem; }
.col-card li { font-size: 0.9rem; color: var(--text-2); line-height: 1.7; }

/* ── CHAPTER NAV ─────────────────────────────── */
.chapter-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin: 3rem 0 1.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.chapter-nav a {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.25rem;
  max-width: 260px;
  transition: all 0.2s;
}

.chapter-nav a:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 8px var(--accent-glow);
}

.chapter-nav .label {
  font-size: 0.75rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chapter-nav .title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.chapter-nav .prev { align-items: flex-start; }
.chapter-nav .next { align-items: flex-end; margin-left: auto; }

/* ── SITE FOOTER ─────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-3);
}

.site-footer a { color: var(--accent-2); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* ── INTRO CARDS (index page) ─────────────────── */
.intro-section {
  padding: 3rem 0 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.intro-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
  padding-bottom: 3rem;
}

.intro-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  transition: all 0.2s;
}

.intro-card:hover {
  border-color: var(--accent);
  box-shadow: 0 3px 12px var(--accent-glow);
}

.intro-card-icon {
  font-size: 1.75rem;
  margin-bottom: 0.6rem;
}

.intro-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.intro-card p {
  font-size: 0.85rem;
  color: var(--text-3);
  line-height: 1.6;
}

.chapters-section { padding: 3rem 0 2rem; }

/* ── TABLE ───────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 1.5rem 0; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th {
  background: #e2e8f0;
  color: var(--text);
  font-weight: 700;
  text-align: left;
  padding: 0.7rem 1rem;
  border-bottom: 2px solid var(--border-bright);
}

td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  vertical-align: top;
}

tr:hover td { background: var(--surface-2); }

/* ── STEP LIST ───────────────────────────────── */
.steps {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
  counter-reset: step;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  align-items: flex-start;
}

.steps li::before {
  content: counter(step);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.15rem;
}

/* ── BADGE ───────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.15em 0.55em;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}
.badge-green { background: #d1fae5; color: #065f46; }
.badge-blue  { background: #dbeafe; color: #1e40af; }
.badge-orange{ background: #fef3c7; color: #92400e; }
.badge-red   { background: #fee2e2; color: #991b1b; }
.badge-purple{ background: #ede9fe; color: #5b21b6; }

/* ── RESPONSIVE ──────────────────────────────── */
@media (max-width: 768px) {
  .nav { padding: 0 1rem; }
  .hero { padding: 3.5rem 1.25rem 3rem; }
  .content { padding: 2rem 1rem 3rem; }
  .container { padding: 0 1rem; }
  .chapter-nav { flex-direction: column; }
  .chapter-nav .next { margin-left: 0; align-items: flex-start; }
  .chapter-nav a { max-width: 100%; }
  .def-item { grid-template-columns: 1fr; }
  .card-list { grid-template-columns: 1fr; }
}
