/* LLM 微调实战 — common.css */
:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-2: #21262d;
  --card: #1c2128;
  --card-hover: #262c36;
  --border: rgba(180,185,210,0.12);
  --border-bright: rgba(180,185,210,0.26);
  --text: #e6edf3;
  --text-2: #adbac7;
  --text-3: #768390;
  --accent: #FF9D00;
  --accent-2: #ffbf47;
  --accent-glow: rgba(255,157,0,0.18);
  --green: #4ade80;
  --blue: #60a5fa;
  --red: #f87171;
  --purple: #c084fc;
  --cyan: #22d3ee;
  --radius: 10px;
  --radius-lg: 14px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.7;
  min-height: 100vh;
}

/* ── NAV ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 2rem;
  height: 56px;
  background: rgba(13,17,23,0.94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-back {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  opacity: 0.85;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-back::before { content: '←'; font-size: 1rem; }
.nav-back:hover { opacity: 1; }
.nav-title {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-2);
  font-weight: 500;
}

/* ── HERO (index) ── */
.hero {
  position: relative;
  overflow: hidden;
  padding: 6rem 2rem 5rem;
  text-align: center;
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255,157,0,0.07) 0%, #161b22 40%, #0d1117 100%);
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 50%, rgba(255,157,0,0.07) 0%, transparent 50%),
    radial-gradient(circle at 85% 20%, rgba(255,191,71,0.05) 0%, transparent 40%),
    radial-gradient(circle at 55% 85%, rgba(255,157,0,0.04) 0%, transparent 40%);
  pointer-events: none;
}

/* Flame particle animation */
.flame-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.flame-bg .particle {
  position: absolute;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  animation: flamePulse 3s ease-in-out infinite;
}
.flame-bg .particle:nth-child(1)  { width:8px;  height:12px; left:8%;   bottom:30%; background:rgba(255,157,0,0.5); animation-delay:0s; }
.flame-bg .particle:nth-child(2)  { width:6px;  height:9px;  left:20%;  bottom:50%; background:rgba(255,191,71,0.4); animation-delay:0.5s; }
.flame-bg .particle:nth-child(3)  { width:10px; height:14px; left:40%;  bottom:20%; background:rgba(255,157,0,0.6); animation-delay:1.0s; }
.flame-bg .particle:nth-child(4)  { width:7px;  height:10px; left:60%;  bottom:60%; background:rgba(255,220,100,0.3); animation-delay:0.3s; }
.flame-bg .particle:nth-child(5)  { width:9px;  height:13px; left:75%;  bottom:35%; background:rgba(255,157,0,0.5); animation-delay:0.8s; }
.flame-bg .particle:nth-child(6)  { width:5px;  height:8px;  left:88%;  bottom:55%; background:rgba(255,191,71,0.3); animation-delay:1.5s; }
.flame-bg .particle:nth-child(7)  { width:7px;  height:11px; left:30%;  bottom:70%; background:rgba(255,157,0,0.4); animation-delay:2.0s; }
.flame-bg .particle:nth-child(8)  { width:8px;  height:12px; left:52%;  bottom:45%; background:rgba(255,191,71,0.35);animation-delay:1.2s; }
@keyframes flamePulse {
  0%   { transform: translateY(0) scale(1);   opacity: 0.4; }
  50%  { transform: translateY(-20px) scale(1.2); opacity: 1; }
  100% { transform: translateY(-40px) scale(0.8); opacity: 0; }
}

.hero-badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  border: 1px solid var(--border-bright);
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--accent-2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  background: rgba(255,157,0,0.08);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 1.2rem;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 50%, #fff3cc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
}
.hero p {
  font-size: 1.1rem;
  color: var(--text-2);
  max-width: 600px;
  margin: 0 auto 2.5rem;
  line-height: 1.8;
  position: relative;
}
.hero-meta {
  display: flex;
  justify-content: center;
  gap: 2rem;
  font-size: 0.85rem;
  color: var(--text-3);
  position: relative;
}
.hero-meta span { display: flex; align-items: center; gap: 0.4rem; }

/* ── CONTAINER ── */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 4rem 2rem;
}
.section-header {
  text-align: center;
  margin-bottom: 3rem;
}
.section-header h2 { font-size: 1.8rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.section-header p { color: var(--text-3); font-size: 0.95rem; }

/* ── CARDS (index) ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: background 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  opacity: 0;
  transform: translateY(20px);
  animation: cardIn 0.5s ease forwards;
}
.card:hover {
  background: var(--card-hover);
  border-color: var(--border-bright);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(255,157,0,0.15);
}
@keyframes cardIn { to { opacity: 1; transform: translateY(0); } }

.card-num { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); opacity: 0.7; }
.card-title { font-size: 1rem; font-weight: 600; color: var(--text); line-height: 1.4; }
.card-desc { font-size: 0.85rem; color: var(--text-3); line-height: 1.6; flex: 1; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.25rem; }
.tag { font-size: 0.72rem; padding: 0.2rem 0.55rem; border-radius: 6px; background: rgba(255,157,0,0.1); color: var(--accent-2); border: 1px solid rgba(255,157,0,0.2); }

/* ── CHAPTER HERO ── */
.chapter-hero {
  padding: 4.5rem 2rem 3.5rem;
  text-align: center;
  background: radial-gradient(ellipse at top, #161b22 0%, #0d1117 70%);
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}
.chapter-hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 200px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-glow), transparent);
}
.ch-num { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.15em; text-transform: uppercase; color: var(--accent); opacity: 0.6; margin-bottom: 1rem; }
.chapter-hero h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--accent-2), var(--text));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.chapter-hero p { font-size: 1rem; color: var(--text-2); max-width: 560px; margin: 0 auto; line-height: 1.8; }

/* ── CONTENT ── */
.content { max-width: 860px; margin: 0 auto; padding: 3rem 2rem 5rem; }

.content h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--text);
  margin: 3rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.content h2::before {
  content: '';
  position: absolute;
  bottom: -1px; left: 0;
  width: 40px; height: 1px;
  background: var(--accent);
}
.content h3 { font-size: 1.1rem; font-weight: 600; color: var(--accent-2); margin: 2rem 0 0.75rem; }
.content p { color: var(--text-2); margin-bottom: 1.2rem; line-height: 1.85; }
.content ul, .content ol { color: var(--text-2); padding-left: 1.5rem; margin-bottom: 1.2rem; }
.content li { margin-bottom: 0.4rem; line-height: 1.7; }

/* ── PROGRESS ── */
.progress { width: 100%; height: 4px; background: var(--surface-2); border-radius: 2px; margin-bottom: 3rem; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 2px; box-shadow: 0 0 8px var(--accent-glow); transition: width 0.6s ease; }

/* ── DEF LIST ── */
.def-list { display: flex; flex-direction: column; gap: 0.75rem; margin: 1.5rem 0; }
.def-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; border-left: 3px solid var(--accent); }
.def-term { font-size: 0.9rem; font-weight: 700; color: var(--accent-2); margin-bottom: 0.3rem; letter-spacing: 0.02em; }
.def-desc { font-size: 0.9rem; color: var(--text-3); line-height: 1.7; }

/* ── CALLOUT ── */
.callout { border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1.5rem 0; border-left: 3px solid; font-size: 0.92rem; line-height: 1.7; }
.callout strong { display: block; font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 0.4rem; }
.callout.info { background: rgba(255,157,0,0.08); border-color: var(--accent); color: var(--text-2); }
.callout.info strong { color: var(--accent); }
.callout.tip { background: rgba(74,222,128,0.07); border-color: var(--green); color: var(--text-2); }
.callout.tip strong { color: var(--green); }
.callout.warning { background: rgba(255,191,71,0.07); border-color: var(--accent-2); color: var(--text-2); }
.callout.warning strong { color: var(--accent-2); }
.callout.danger { background: rgba(248,113,113,0.08); border-color: var(--red); color: var(--text-2); }
.callout.danger strong { color: var(--red); }

/* ── CODE ── */
pre {
  background: #090d12;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  font-size: 0.875rem;
  line-height: 1.75;
  position: relative;
}
pre::before { content: attr(data-lang); position: absolute; top: 0.5rem; right: 0.75rem; font-size: 0.7rem; color: var(--text-3); font-family: inherit; letter-spacing: 0.05em; text-transform: uppercase; }
code { font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', Consolas, monospace; font-size: 0.875em; }
p code, li code { background: rgba(255,157,0,0.1); color: var(--accent-2); padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.85em; }

.kw { color: #FF9D00; font-weight: 600; }
.fn { color: #ffbf47; }
.st { color: #4ade80; }
.cm { color: #9c8c6e; font-style: italic; }
.ty { color: #22d3ee; }
.nu { color: #c084fc; }
.at { color: #f87171; }
.pr { color: #60a5fa; }

/* ── 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; } }
.two-col-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; }
.two-col-item h4 { font-size: 0.9rem; font-weight: 700; color: var(--accent); margin-bottom: 0.75rem; }
.two-col-item ul { font-size: 0.875rem; color: var(--text-3); padding-left: 1.2rem; }
.two-col-item li { margin-bottom: 0.35rem; }

/* ── ASCII FLOW ── */
.ascii-flow {
  background: #090d12;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  margin: 1.5rem 0;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  line-height: 1.9;
  color: var(--text-2);
  overflow-x: auto;
  white-space: pre;
}

/* ── COMPARE TABLE ── */
.compare-table { width: 100%; border-collapse: collapse; margin: 1.5rem 0; font-size: 0.875rem; }
.compare-table th { background: var(--surface-2); color: var(--accent-2); font-weight: 600; padding: 0.75rem 1rem; text-align: left; border: 1px solid var(--border); }
.compare-table td { padding: 0.65rem 1rem; border: 1px solid var(--border); color: var(--text-2); vertical-align: top; }
.compare-table tr:nth-child(even) td { background: rgba(255,157,0,0.03); }
.compare-table tr:hover td { background: rgba(255,157,0,0.06); }

/* ── CHAPTER NAV ── */
.chapter-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border); }
.chapter-nav a { display: flex; flex-direction: column; gap: 0.25rem; padding: 0.875rem 1.25rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); text-decoration: none; color: var(--text); transition: background 0.2s, border-color 0.2s; min-width: 0; max-width: 48%; }
.chapter-nav a:hover { background: var(--card); border-color: var(--border-bright); }
.chapter-nav .label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-3); }
.chapter-nav .title { font-size: 0.9rem; font-weight: 600; color: var(--accent-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-nav .prev { align-items: flex-start; }
.chapter-nav .next { align-items: flex-end; margin-left: auto; }

/* ── SITE FOOTER ── */
.site-footer { text-align: center; padding: 1.5rem; font-size: 0.82rem; color: var(--text-3); border-top: 1px solid var(--border); }
.site-footer a { color: var(--accent); text-decoration: none; opacity: 0.8; }
.site-footer a:hover { opacity: 1; }

/* ── HIGHLIGHT BOX ── */
.highlight-box { background: linear-gradient(135deg, rgba(255,157,0,0.08), rgba(255,191,71,0.04)); border: 1px solid var(--border-bright); border-radius: var(--radius-lg); padding: 1.5rem; margin: 1.5rem 0; }

/* ── STEP LIST ── */
.step-list { counter-reset: step; list-style: none; padding: 0; margin: 1.5rem 0; }
.step-list li { counter-increment: step; padding: 0.75rem 0.75rem 0.75rem 3.5rem; position: relative; border-left: 1px solid var(--border); margin-left: 1.5rem; margin-bottom: 0.5rem; color: var(--text-2); font-size: 0.92rem; line-height: 1.7; }
.step-list li::before { content: counter(step); position: absolute; left: -1.5rem; top: 0.65rem; width: 2rem; height: 2rem; background: var(--card); border: 1px solid var(--border-bright); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; font-weight: 700; color: var(--accent); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .nav { padding: 0 1rem; }
  .content { padding: 2rem 1.25rem 4rem; }
  .chapter-hero { padding: 3rem 1.25rem 2.5rem; }
  .container { padding: 3rem 1.25rem; }
  .ascii-flow { font-size: 0.72rem; padding: 1rem; }
  .compare-table { font-size: 0.8rem; }
  .chapter-nav { flex-direction: column; }
  .chapter-nav a { max-width: 100%; }
}
