/* Jupyter Notebook 实战指南 — common.css */
:root {
  --bg: #0d0d1a;
  --surface: #131320;
  --surface-2: #1a1a2c;
  --card: #1e1e30;
  --card-hover: #252538;
  --border: rgba(243,118,38,0.14);
  --border-bright: rgba(243,118,38,0.3);
  --text: #e2e8f0;
  --text-2: #94a3b8;
  --text-3: #64748b;
  --accent: #f37626;
  --accent-2: #ffb366;
  --accent-glow: rgba(243,118,38,0.18);
  --blue: #4fc3f7;
  --green: #4ade80;
  --red: #f87171;
  --purple: #c084fc;
  --yellow: #fbbf24;
  --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,13,26,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(243,118,38,0.08) 0%, #131320 45%, #0d0d1a 100%);
}
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(circle at 15% 50%, rgba(243,118,38,0.06) 0%, transparent 50%),
    radial-gradient(circle at 85% 20%, rgba(255,179,102,0.04) 0%, transparent 40%),
    radial-gradient(circle at 55% 85%, rgba(79,195,247,0.04) 0%, transparent 40%);
}

/* Floating notebook cells animation */
.flame-bg {
  position: absolute; inset: 0; pointer-events: none; overflow: hidden;
}
.flame-bg .particle {
  position: absolute;
  border-radius: 4px;
  animation: floatUp 6s linear infinite;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 11px; color: var(--accent); opacity: 0.35;
  white-space: nowrap;
}
@keyframes floatUp {
  0%   { transform: translateY(100vh) scale(0.8); opacity: 0; }
  10%  { opacity: 0.35; }
  90%  { opacity: 0.35; }
  100% { transform: translateY(-60px) scale(1.1); opacity: 0; }
}
.flame-bg .particle:nth-child(1)  { left:5%;  animation-delay:0s;   animation-duration:7s; }
.flame-bg .particle:nth-child(2)  { left:15%; animation-delay:1.2s; animation-duration:6s; }
.flame-bg .particle:nth-child(3)  { left:28%; animation-delay:0.8s; animation-duration:8s; }
.flame-bg .particle:nth-child(4)  { left:42%; animation-delay:2.1s; animation-duration:6.5s; }
.flame-bg .particle:nth-child(5)  { left:58%; animation-delay:0.5s; animation-duration:7.5s; }
.flame-bg .particle:nth-child(6)  { left:70%; animation-delay:1.8s; animation-duration:6s; }
.flame-bg .particle:nth-child(7)  { left:82%; animation-delay:3s;   animation-duration:8s; }
.flame-bg .particle:nth-child(8)  { left:92%; animation-delay:1s;   animation-duration:7s; }

.hero-badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  background: rgba(243,118,38,0.12);
  border: 1px solid rgba(243,118,38,0.3);
  border-radius: 20px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em;
  color: var(--accent); text-transform: uppercase;
  margin-bottom: 1.5rem;
}
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: 800; line-height: 1.15;
  background: linear-gradient(135deg, #fff 0%, var(--accent-2) 50%, var(--accent) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  margin-bottom: 1.2rem;
}
.hero p {
  font-size: 1.1rem; color: var(--text-2);
  max-width: 600px; margin: 0 auto 2rem;
}
.stack-badges {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem;
  margin-bottom: 2.5rem;
}
.stack-badge {
  padding: 0.3rem 0.8rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; font-size: 0.8rem; color: var(--text-2);
}
.hero-cta {
  display: inline-block;
  padding: 0.85rem 2.4rem;
  background: linear-gradient(135deg, var(--accent), #d4621a);
  color: #fff; text-decoration: none;
  font-size: 1rem; font-weight: 700; border-radius: 8px;
  box-shadow: 0 0 24px rgba(243,118,38,0.35);
  transition: transform 0.2s, box-shadow 0.2s;
  margin-bottom: 2rem;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 0 36px rgba(243,118,38,0.5); }
.hero-meta {
  display: flex; justify-content: center; gap: 2rem;
  font-size: 0.88rem; color: var(--text-3);
}

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

.section-header { text-align: center; margin-bottom: 2.5rem; }
.section-header h2 { font-size: 1.9rem; font-weight: 700; color: var(--text); margin-bottom: 0.5rem; }
.section-header p  { color: var(--text-2); font-size: 1rem; }

/* ── CARD GRID ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 1.2rem;
}
.card {
  display: block; text-decoration: none;
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 1.5rem;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  opacity: 0; animation: fadeUp 0.5s ease forwards;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--border-bright);
  box-shadow: 0 8px 30px rgba(243,118,38,0.1);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
.card-num  { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; color: var(--accent); text-transform: uppercase; margin-bottom: 0.5rem; }
.card-title{ font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 0.4rem; line-height: 1.4; }
.card-desc { font-size: 0.85rem; color: var(--text-2); line-height: 1.6; margin-bottom: 0.8rem; }
.card-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.tag {
  padding: 0.2rem 0.55rem;
  background: rgba(243,118,38,0.08); border: 1px solid rgba(243,118,38,0.2);
  border-radius: 20px; font-size: 0.72rem; color: var(--accent-2);
}

/* ── CHAPTER HERO ── */
.chapter-hero {
  padding: 4rem 2rem 3rem; text-align: center;
  background: linear-gradient(180deg, rgba(243,118,38,0.06) 0%, transparent 100%);
  border-bottom: 1px solid var(--border);
}
.ch-num { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; color: var(--accent); text-transform: uppercase; margin-bottom: 0.8rem; }
.chapter-hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; line-height: 1.2; margin-bottom: 0.8rem; }
.chapter-hero p  { color: var(--text-2); font-size: 1rem; max-width: 600px; margin: 0 auto 1.5rem; }
.progress { height: 4px; background: var(--surface-2); border-radius: 2px; max-width: 400px; margin: 0 auto; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 2px; transition: width 0.8s; }

/* ── CONTENT ── */
.content {
  max-width: 820px; margin: 0 auto; padding: 3rem 2rem 5rem;
}
.content h2 {
  font-size: 1.5rem; font-weight: 700; color: var(--text);
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.content h3 { font-size: 1.15rem; font-weight: 600; color: var(--text-2); margin: 1.8rem 0 0.7rem; }
.content h4 { font-size: 1rem; font-weight: 600; color: var(--accent-2); margin: 1.4rem 0 0.5rem; }
.content p  { color: var(--text-2); margin-bottom: 1rem; }
.content strong { color: var(--text); }
.content a  { color: var(--accent); }
.content ul, .content ol { margin: 0.8rem 0 1rem 1.5rem; color: var(--text-2); }
.content li { margin-bottom: 0.4rem; line-height: 1.7; }

/* ── CODE ── */
pre {
  background: #090912; border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius); padding: 1.25rem 1.5rem;
  overflow-x: auto; font-size: 0.875rem; line-height: 1.7;
  margin: 1rem 0 1.5rem;
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}
code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875em;
  background: rgba(243,118,38,0.1); border: 1px solid rgba(243,118,38,0.2);
  color: var(--accent-2); border-radius: 4px; padding: 0.1em 0.45em;
}
pre code { background: none; border: none; color: inherit; padding: 0; font-size: inherit; }

/* Syntax highlight */
.kw { color: #c084fc; }  /* keyword */
.ty { color: #4fc3f7; }  /* type */
.st { color: #4ade80; }  /* string */
.cm { color: #475569; }  /* comment */
.fn { color: #fbbf24; }  /* function */
.nu { color: #fb923c; }  /* number */
.at { color: #38bdf8; }  /* attribute */
.pr { color: #f97316; }  /* prompt/output */
.mg { color: #a78bfa; }  /* magic command */
.op { color: #e2e8f0; }  /* output text */

/* ── CALLOUT ── */
.callout {
  border-radius: var(--radius); padding: 1rem 1.25rem;
  margin: 1.2rem 0; font-size: 0.92rem; line-height: 1.7;
  border-left: 3px solid;
}
.callout strong { display: block; margin-bottom: 0.3rem; font-size: 0.78rem; letter-spacing: 0.06em; }
.callout.info    { background: rgba(79,195,247,0.07);  border-color: #4fc3f7; color: #bae6fd; }
.callout.info strong    { color: #4fc3f7; }
.callout.tip     { background: rgba(74,222,128,0.07);  border-color: #4ade80; color: #bbf7d0; }
.callout.tip strong     { color: #4ade80; }
.callout.warning { background: rgba(251,191,36,0.07);  border-color: #fbbf24; color: #fef08a; }
.callout.warning strong { color: #fbbf24; }
.callout.danger  { background: rgba(248,113,113,0.07); border-color: #f87171; color: #fecaca; }
.callout.danger strong  { color: #f87171; }

/* ── SCREENSHOT ── */
.screenshot-box {
  margin: 1.5rem 0;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.screenshot-box img {
  display: block; width: 100%; height: auto;
}
.screenshot-caption {
  background: var(--surface-2);
  padding: 0.6rem 1rem;
  font-size: 0.82rem; color: var(--text-3);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 0.4rem;
}
.screenshot-caption::before { content: '📸'; }

/* Annotation overlay */
.screenshot-annotated {
  position: relative; display: inline-block; width: 100%;
}
.annotation {
  position: absolute;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem; font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
}
.annotation::before {
  content: '';
  position: absolute; left: -6px; top: 50%;
  transform: translateY(-50%);
  border: 5px solid transparent;
  border-right-color: var(--accent);
}

/* ── NOTEBOOK UI MOCKUP ── */
.nb-ui {
  background: #fff; border-radius: var(--radius-lg);
  overflow: hidden; margin: 1.5rem 0;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.1);
}
.nb-toolbar {
  background: #f5f5f5; border-bottom: 1px solid #ddd;
  padding: 0.5rem 1rem;
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.78rem; color: #333;
}
.nb-toolbar-btn {
  background: #e8e8e8; border: 1px solid #ccc;
  border-radius: 4px; padding: 0.2rem 0.6rem;
  font-size: 0.72rem; cursor: pointer; color: #333;
}
.nb-cell {
  display: flex; align-items: stretch;
  border-bottom: 1px solid #eee;
}
.nb-cell-num {
  min-width: 56px; padding: 0.8rem 0.5rem;
  text-align: right; font-size: 0.75rem; color: #999;
  font-family: monospace; background: #f9f9f9;
  border-right: 1px solid #eee;
  display: flex; align-items: flex-start; justify-content: flex-end;
  padding-top: 0.9rem;
}
.nb-cell-body { flex: 1; padding: 0.8rem 1rem; }
.nb-cell-code { background: #fff; }
.nb-cell-markdown { background: #fff; }
.nb-cell-output { background: #fff; padding: 0.5rem 1rem 0.8rem; }
.nb-cell.active { border-left: 3px solid #2196f3; }
.nb-cell.running { border-left: 3px solid var(--accent); }
.nb-code-text { font-family: monospace; font-size: 0.85rem; color: #333; line-height: 1.6; }
.nb-output-text { font-family: monospace; font-size: 0.85rem; color: #444; line-height: 1.6; background: #f9f9f9; padding: 0.5rem; border-radius: 4px; }
.nb-md-rendered { font-size: 0.9rem; color: #333; line-height: 1.7; }
.nb-md-rendered h1 { font-size: 1.4rem; color: #111; margin-bottom: 0.5rem; }
.nb-md-rendered h2 { font-size: 1.1rem; color: #333; margin-bottom: 0.3rem; }

/* ── TABLE ── */
.compare-table {
  width: 100%; border-collapse: collapse; margin: 1rem 0 1.5rem;
  font-size: 0.88rem;
}
.compare-table th {
  background: var(--surface-2); color: var(--accent);
  padding: 0.65rem 1rem; text-align: left;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  border-bottom: 1px solid var(--border-bright);
}
.compare-table td {
  padding: 0.65rem 1rem; border-bottom: 1px solid var(--border);
  color: var(--text-2); vertical-align: top; line-height: 1.6;
}
.compare-table tr:last-child td { border-bottom: none; }
.compare-table tr:hover td { background: rgba(243,118,38,0.03); }

/* ── KEYBOARD SHORTCUT ── */
.kbd-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem;
  margin: 1rem 0 1.5rem;
}
.kbd-item {
  display: flex; align-items: center; gap: 0.8rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 0.6rem 0.9rem;
}
.kbd-key {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 28px; padding: 0 0.5rem;
  background: var(--card); border: 1px solid rgba(255,255,255,0.15);
  border-bottom: 3px solid rgba(0,0,0,0.4);
  border-radius: 5px; font-family: monospace;
  font-size: 0.78rem; font-weight: 700; color: var(--text);
  white-space: nowrap;
}
.kbd-desc { font-size: 0.83rem; color: var(--text-2); }

/* ── TWO COLUMN ── */
.two-col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem;
  margin: 1rem 0 1.5rem;
}
@media (max-width: 640px) {
  .two-col { grid-template-columns: 1fr; }
  .kbd-grid { grid-template-columns: 1fr; }
}
.two-col > div {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem;
}
.two-col h4 { margin-top: 0; }

/* ── CHAPTER NAV ── */
.chapter-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 3rem; padding-top: 2rem;
  border-top: 1px solid var(--border);
  gap: 1rem;
}
.chapter-nav a {
  display: inline-flex; align-items: center; gap: 0.5rem;
  padding: 0.65rem 1.2rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-2);
  text-decoration: none; font-size: 0.88rem; font-weight: 500;
  transition: border-color 0.2s, color 0.2s;
}
.chapter-nav a:hover { border-color: var(--accent); color: var(--accent); }
.chapter-nav .prev::before { content: '←'; }
.chapter-nav .next::after  { content: '→'; }

/* ── DEF LIST ── */
.def-list { margin: 0.8rem 0 1.5rem; }
.def-list dt { font-weight: 700; color: var(--accent-2); margin-top: 0.8rem; }
.def-list dd { margin-left: 1.2rem; color: var(--text-2); font-size: 0.9rem; }

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