/* ==========================================================================
   Matplotlib 数据可视化作品集 — 全局样式
   精英商务高级风：藏青墨蓝 + 米白象牙 + 低饱和金棕
   纯静态样式，不引用任何外部字体、图标库或 CDN 资源。
   ========================================================================== */

/* 1. 设计变量 */
:root {
  --navy-900: #101b2c;
  --navy-800: #16243a;
  --navy-700: #1e3050;
  --navy-600: #2a3f63;
  --ivory-50: #fcfaf5;
  --ivory-100: #f6f2e9;
  --ivory-200: #efe9dc;
  --paper: #fffdf8;
  --gold-500: #a88450;
  --gold-400: #bea074;
  --gold-300: #d6c5a4;
  --ink-900: #1b2533;
  --ink-700: #3a4656;
  --ink-500: #6d7789;
  --line: #ddd7c9;
  --line-strong: #c9c1ae;
  --shadow-sm: 0 6px 18px rgba(16, 27, 44, .045);
  --shadow-md: 0 16px 34px rgba(16, 27, 44, .10);
  --font-serif: Georgia, "Times New Roman", "Songti SC", "STSong", "SimSun", serif;
  --font-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", Consolas, Menlo, "Courier New", monospace;
  --radius: 6px;
  --container: 1180px;
}

/* 2. 基础重置与排版 */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--ivory-50);
  color: var(--ink-900);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 600;
  color: var(--navy-800);
  line-height: 1.35;
}
p { margin: 0; }
a { color: inherit; }
img { max-width: 100%; }
button { font: inherit; }
.container {
  width: min(var(--container), calc(100% - 64px));
  margin-inline: auto;
}
.eyebrow {
  margin: 0 0 10px;
  color: var(--gold-500);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.eyebrow--light { color: var(--gold-400); }

/* 3. 顶部导航栏 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(252, 250, 245, .96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  flex: 0 0 auto;
}
.brand__mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--gold-500);
  background: var(--navy-800);
  color: var(--gold-400);
  font-family: var(--font-serif);
  font-size: 15px;
}
.brand__text { display: flex; flex-direction: column; line-height: 1.25; }
.brand__text strong { font-family: var(--font-serif); font-size: 16px; color: var(--navy-800); }
.brand__text small { margin-top: 3px; font-size: 9px; letter-spacing: .18em; color: var(--ink-500); }
.nav { display: flex; align-items: center; gap: 30px; }
.nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border: 0;
  background: none;
  color: var(--ink-700);
  font-size: 14px;
  text-decoration: none;
  cursor: pointer;
  transition: color .2s ease;
}
.nav__link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 2px;
  height: 1px;
  background: var(--gold-500);
  transform: scaleX(0);
  transition: transform .2s ease;
}
.nav__link:hover, .nav__link:focus-visible, .nav__link.is-active { color: var(--navy-800); }
.nav__link:hover::after, .nav__link:focus-visible::after, .nav__link.is-active::after { transform: scaleX(1); }
.nav__caret { font-size: 10px; color: var(--gold-500); }
.nav__dropdown { position: relative; }
.nav__menu {
  position: absolute;
  top: calc(100% + 14px);
  right: 0;
  width: 318px;
  padding: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 38px rgba(16, 27, 44, .13);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
.nav__dropdown:hover .nav__menu, .nav__dropdown:focus-within .nav__menu {
  opacity: 1; visibility: visible; transform: translateY(0);
}
.nav__menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 4px;
  color: var(--ink-700);
  font-size: 13px;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.nav__menu a:hover { background: var(--ivory-100); color: var(--navy-800); }
.nav__menu a.is-active { background: var(--ivory-200); color: var(--navy-800); font-weight: 600; }
.nav__menu-num { flex: 0 0 28px; font-family: var(--font-serif); font-size: 14px; color: var(--gold-500); }
.nav__burger {
  display: none;
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
  color: var(--navy-800);
  cursor: pointer;
}

/* 4. 首页 Hero */
.hero {
  position: relative;
  overflow: hidden;
  padding: 92px 0 86px;
  background: var(--navy-800);
  color: var(--ivory-100);
  border-bottom: 3px solid var(--gold-500);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent);
  mask-image: linear-gradient(to bottom, #000, transparent);
}
.hero::after {
  content: "";
  position: absolute;
  right: -140px; top: -180px;
  width: 540px; height: 540px;
  border: 1px solid rgba(190,160,116,.28);
  border-radius: 50%;
  box-shadow: 0 0 0 62px rgba(190,160,116,.05), 0 0 0 124px rgba(190,160,116,.035);
}
.hero__inner { position: relative; z-index: 1; }
.hero__title {
  max-width: 840px;
  color: var(--ivory-50);
  font-size: clamp(32px, 4.4vw, 50px);
  letter-spacing: .02em;
}
.hero__lead {
  max-width: 700px;
  margin-top: 20px;
  color: rgba(246,242,233,.78);
  font-size: 15px;
  line-height: 1.95;
}
.hero__rule { width: 86px; height: 1px; margin: 30px 0 24px; background: var(--gold-400); }
.hero__meta {
  display: flex; flex-wrap: wrap; gap: 12px 36px;
  color: rgba(246,242,233,.62);
  font-size: 12px;
  letter-spacing: .06em;
}
.hero__meta span { position: relative; padding-left: 14px; }
.hero__meta span::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 5px; height: 5px; background: var(--gold-400); transform: rotate(45deg);
}

/* 5. 通用区块标题 */
.section { padding: 76px 0; }
.section__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; padding-bottom: 20px; margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
}
.section__head h2 { font-size: 30px; letter-spacing: .01em; }
.section__hint { color: var(--ink-500); font-size: 12px; letter-spacing: .04em; }

/* 6. 首页章节卡片 */
.chapter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
.chapter-card {
  position: relative;
  display: flex; flex-direction: column;
  min-height: 326px;
  padding: 26px 24px 22px;
  overflow: hidden;
  background: var(--ivory-100);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}
.chapter-card::before {
  content: "";
  position: absolute; left: 0; top: 0; width: 100%; height: 2px;
  background: var(--gold-500);
  transform: scaleX(0); transform-origin: left;
  transition: transform .25s ease;
}
.chapter-card:hover, .chapter-card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--gold-300);
  box-shadow: var(--shadow-md);
  outline: none;
}
.chapter-card:hover::before, .chapter-card:focus-visible::before { transform: scaleX(1); }
.chapter-card__top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; }
.chapter-card__num { font-family: var(--font-serif); font-size: 38px; line-height: 1; color: var(--navy-700); }
.chapter-card__arrow {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: 50%;
  color: var(--gold-500); font-size: 13px;
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}
.chapter-card:hover .chapter-card__arrow {
  background: var(--gold-500); border-color: var(--gold-500); color: #fff;
}
.chapter-card__kicker { color: var(--gold-500); font-size: 10px; font-weight: 700; letter-spacing: .2em; }
.chapter-card__title { margin: 8px 0 12px; font-size: 18px; line-height: 1.5; }
.chapter-card__desc { color: var(--ink-700); font-size: 13px; line-height: 1.8; }
.chapter-card__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.chapter-card__tags span {
  padding: 3px 9px; border: 1px solid var(--line); border-radius: 3px;
  color: var(--ink-500); font-size: 11px;
}
.chapter-card__cta {
  display: flex; align-items: center; gap: 8px;
  margin-top: auto; padding-top: 20px;
  color: var(--navy-700); font-size: 12px; font-weight: 600; letter-spacing: .06em;
}
.chapter-card__cta span { color: var(--gold-500); transition: transform .25s ease; }
.chapter-card:hover .chapter-card__cta span { transform: translateX(5px); }

/* 7. 首页使用说明 */
.section--note { padding-top: 0; }
.notice {
  display: grid; grid-template-columns: 1.1fr 2fr; gap: 32px;
  padding: 30px 34px;
  background: var(--ivory-100);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-500);
  border-radius: 4px;
}
.notice h3 { font-size: 20px; }
.notice p { margin-top: 8px; color: var(--ink-500); font-size: 13px; }
.notice__list { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 22px; margin: 0; padding: 0; list-style: none; }
.notice__list li {
  padding-left: 16px; border-left: 1px solid var(--line-strong);
  color: var(--ink-700); font-size: 13px; line-height: 1.8;
}
.notice__list strong { display: block; margin-bottom: 4px; color: var(--navy-800); font-family: var(--font-serif); font-size: 14px; }

/* 8. 子页面章节标题区 */
.page-head { padding: 42px 0 52px; background: var(--ivory-100); border-bottom: 1px solid var(--line); }
.breadcrumb { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; color: var(--ink-500); font-size: 12px; }
.breadcrumb a { text-decoration: none; transition: color .2s ease; }
.breadcrumb a:hover { color: var(--gold-500); }
.breadcrumb span[aria-current] { color: var(--navy-800); }
.page-head h1 { max-width: 900px; font-size: clamp(30px, 3.6vw, 42px); letter-spacing: .01em; }
.page-head__lead { max-width: 860px; margin-top: 16px; color: var(--ink-700); font-size: 15px; line-height: 1.95; }
.page-head__meta {
  display: flex; flex-wrap: wrap; gap: 16px 56px;
  margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line-strong);
}
.page-head__meta div { min-width: 150px; }
.meta-label { display: block; margin-bottom: 4px; color: var(--ink-500); font-size: 11px; letter-spacing: .14em; }
.meta-value { color: var(--navy-800); font-family: var(--font-serif); font-size: 16px; }

/* 9. 知识要点与章节学习心得 */
.knowledge-panel {
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 40px; margin-bottom: 30px; padding: 30px 34px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-500);
  border-radius: var(--radius);
}
.knowledge-panel h3 { margin-bottom: 16px; font-size: 20px; }
.knowledge-panel__aside { padding-left: 32px; border-left: 1px solid var(--line); }
.point-list { margin: 0; padding: 0; list-style: none; }
.point-list li {
  position: relative; margin-bottom: 9px; padding-left: 18px;
  color: var(--ink-700); font-size: 13px; line-height: 1.85;
}
.point-list li::before {
  content: ""; position: absolute; left: 0; top: 9px;
  width: 5px; height: 5px; background: var(--gold-400); transform: rotate(45deg);
}
.reflection {
  margin: 0; padding-left: 16px; border-left: 2px solid var(--gold-300);
  color: var(--ink-700); font-size: 13.5px; line-height: 2;
}

/* 10. 案例分区 */
.cases { display: grid; gap: 26px; }
.case {
  overflow: hidden;
  background: var(--ivory-100);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.case__head {
  display: flex; align-items: flex-start; gap: 22px;
  padding: 24px 28px;
  background: rgba(255,255,255,.42);
  border-bottom: 1px solid var(--line);
}
.case__index {
  flex: 0 0 62px; padding-right: 20px; text-align: center;
  border-right: 1px solid var(--line-strong);
}
.case__index span { display: block; color: var(--gold-500); font-size: 9px; font-weight: 700; letter-spacing: .2em; }
.case__index strong {
  display: block; margin-top: 2px; color: var(--navy-800);
  font-family: var(--font-serif); font-size: 25px; font-weight: 600; line-height: 1.2;
}
.case__title { margin-bottom: 8px; font-size: 21px; }
.case__intro { max-width: 900px; color: var(--ink-700); font-size: 14px; line-height: 1.85; }
.case__body { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); }
.code-pane { min-width: 0; border-right: 1px solid var(--line); }
.code-pane__bar {
  display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 16px;
  background: var(--navy-800); color: rgba(246,242,233,.78);
  font-size: 11px; letter-spacing: .1em;
}
.code-pane__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-400); }
.copy-btn {
  margin-left: auto; padding: 3px 10px;
  border: 1px solid rgba(246,242,233,.28); border-radius: 3px;
  background: transparent; color: rgba(246,242,233,.8);
  font-size: 11px; letter-spacing: .04em; cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.copy-btn:hover { border-color: var(--gold-400); color: var(--gold-400); }
.code-pane pre {
  min-height: 320px; height: 100%; margin: 0;
  padding: 20px 22px 24px; overflow: auto;
  background: var(--navy-900); color: #e9e2d2;
  font-family: var(--font-mono); font-size: 12.5px; line-height: 1.8; tab-size: 4;
}
.code-pane code { font-family: inherit; white-space: pre; }
.figure-pane {
  display: flex; flex-direction: column; min-width: 0;
  margin: 0; padding: 20px 22px 18px;
}
.figure-frame {
  position: relative; display: grid; place-items: center; flex: 1;
  min-height: 320px; overflow: hidden;
  background: var(--paper); border: 1px dashed var(--line-strong);
}
.figure-frame img {
  position: absolute; inset: 0; z-index: 2;
  width: 100%; height: 100%; object-fit: contain; background: var(--paper);
}
.figure-frame img.is-missing { display: none; }
.figure-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 24px; text-align: center;
}
.figure-placeholder__mark {
  display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 4px;
  border: 1px solid var(--line-strong); border-radius: 50%;
  color: var(--gold-500); font-family: var(--font-serif); font-size: 17px;
}
.figure-placeholder strong { color: var(--navy-700); font-family: var(--font-serif); font-size: 15px; font-weight: 600; }
.figure-placeholder code { color: var(--ink-500); font-family: var(--font-mono); font-size: 11px; word-break: break-all; }
.figure-placeholder small { color: var(--ink-500); font-size: 11px; }
.figure-pane figcaption { padding-top: 12px; color: var(--ink-500); font-size: 12px; letter-spacing: .03em; text-align: center; }

/* 案例内的知识点与学习心得 */
.case__notes {
  display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr);
  gap: 32px; padding: 22px 28px 26px;
  background: #f9f6ef; border-top: 1px solid var(--line);
}
.note-title {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 10px; color: var(--navy-800);
  font-family: var(--font-serif); font-size: 14px; font-weight: 600; letter-spacing: .04em;
}
.note-title::before { content: ""; width: 14px; height: 2px; background: var(--gold-500); }
.note-list { margin: 0; padding-left: 17px; color: var(--ink-700); font-size: 13px; line-height: 1.9; }
.note-list li { margin-bottom: 5px; }
.note-list li::marker { color: var(--gold-500); }
.note-text { color: var(--ink-700); font-size: 13px; line-height: 1.95; }
.case__tip { padding: 12px 28px 16px; border-top: 1px solid var(--line); color: var(--ink-500); font-size: 12px; }
.case__tip strong { color: var(--gold-500); font-weight: 700; }

/* 11. 返回首页 / 章节翻页 */
.back-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 28px;
  padding: 34px 40px; background: var(--navy-800);
  border-radius: var(--radius); color: var(--ivory-100);
}
.back-panel h2 { color: var(--ivory-50); font-size: 24px; }
.back-panel p:last-child { margin-top: 6px; color: rgba(246,242,233,.65); font-size: 13px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 24px; border-radius: 4px;
  font-size: 13px; font-weight: 600; letter-spacing: .06em;
  text-decoration: none; white-space: nowrap;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.btn--solid { background: var(--gold-500); border: 1px solid var(--gold-500); color: #fff; }
.btn--solid:hover { background: var(--gold-400); border-color: var(--gold-400); }
.chapter-pager { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 18px; }
.chapter-pager a {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border: 1px solid var(--line); border-radius: 4px;
  background: var(--ivory-100); color: var(--navy-700);
  font-size: 12px; text-decoration: none;
  transition: border-color .2s ease, color .2s ease;
}
.chapter-pager a:hover { border-color: var(--gold-400); color: var(--gold-500); }
.chapter-pager__placeholder { flex: 1; }

/* 12. 页脚 */
.site-footer { margin-top: 12px; padding: 26px 0 34px; border-top: 1px solid var(--line); color: var(--ink-500); font-size: 12px; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.footer-inner a { color: var(--navy-700); text-decoration: none; }
.footer-inner a:hover { color: var(--gold-500); }

/* 13. 响应式适配 */
@media (max-width: 1100px) {
  .chapter-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .notice { grid-template-columns: 1fr; gap: 20px; }
}
@media (max-width: 860px) {
  .container { width: min(var(--container), calc(100% - 40px)); }
  .nav-inner { height: 68px; }
  .nav__burger { display: grid; place-items: center; }
  .nav {
    position: absolute; left: 0; right: 0; top: 68px;
    display: none; flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px 20px 18px; background: var(--ivory-50);
    border-bottom: 1px solid var(--line); box-shadow: var(--shadow-md);
  }
  .nav.is-open { display: flex; }
  .nav__link { width: 100%; justify-content: space-between; padding: 12px 2px; border-bottom: 1px solid var(--line); }
  .nav__link::after { display: none; }
  .nav__dropdown { width: 100%; }
  .nav__menu {
    position: static; width: 100%; margin: 6px 0 10px; padding: 4px;
    opacity: 1; visibility: visible; transform: none; box-shadow: none; display: none;
  }
  .nav__dropdown:hover .nav__menu, .nav__dropdown:focus-within .nav__menu { display: block; }
  .hero { padding: 68px 0 62px; }
  .section { padding: 56px 0; }
  .case__body { grid-template-columns: 1fr; }
  .code-pane { border-right: 0; border-bottom: 1px solid var(--line); }
  .code-pane pre, .figure-frame { min-height: 260px; }
  .page-head { padding: 34px 0 40px; }
  .knowledge-panel, .case__notes { grid-template-columns: 1fr; gap: 20px; }
  .knowledge-panel__aside {
    padding-top: 20px; padding-left: 0;
    border-top: 1px solid var(--line); border-left: 0;
  }
}
@media (max-width: 640px) {
  .chapter-grid, .notice__list { grid-template-columns: 1fr; }
  .section__head { align-items: flex-start; flex-direction: column; gap: 8px; }
  .case__head { gap: 14px; padding: 20px; }
  .case__index { flex-basis: 52px; padding-right: 12px; }
  .case__index strong { font-size: 21px; }
  .case__notes { padding: 20px; }
  .knowledge-panel { padding: 24px 20px; }
  .back-panel { flex-direction: column; align-items: flex-start; padding: 28px 24px; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  .chapter-pager { flex-wrap: wrap; }
}

/* 14. 打印友好 */
@media print {
  .site-header, .copy-btn, .chapter-pager { display: none; }
  body { background: #fff; }
  .case { break-inside: avoid; }
}
