/* ==========================================================================
   layout.css — 页面骨架：顶栏、章节导航、Hero、分节、页脚、响应式
   ========================================================================== */

/* ------------------------------ 顶栏 ------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(10, 12, 17, .82);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--line);
}

.site-header__bar {
  display: flex;
  align-items: center;
  gap: var(--s4);
  height: var(--header-h);
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  color: var(--ink);
  font-weight: 620;
  font-size: .95rem;
  letter-spacing: -.01em;
}
.brand:hover { text-decoration: none; }
.brand svg { width: 22px; height: 22px; flex-shrink: 0; }
.brand__meta {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--ink-3);
  padding-left: 10px;
  margin-left: 2px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

.site-header__spacer { flex: 1; }

.header-links {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-shrink: 0;
}
.header-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-full);
  color: var(--ink-2);
  font-size: .8rem;
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.header-links a:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--surface);
  text-decoration: none;
}
.header-links svg { width: 15px; height: 15px; }

/* 阅读进度条：1px 横向，属现代手法，不是卡片彩条 */
.read-progress {
  position: absolute;
  left: 0; bottom: -1px;
  height: 2px;
  width: 0;
  background: var(--brand);
  opacity: .85;
  transition: width .1s linear;
}

/* ------------------------------ 章节导航条 ------------------------------ */

.chapter-nav {
  position: sticky;
  top: var(--header-h);
  z-index: 55;
  background: rgba(10, 12, 17, .78);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.chapter-nav__track {
  display: flex;
  gap: var(--s1);
  max-width: var(--page);
  margin: 0 auto;
  padding: 8px var(--gutter);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.chapter-nav__track::-webkit-scrollbar { display: none; }

.chapter-nav a {
  flex-shrink: 0;
  padding: 6px 13px;
  border-radius: var(--r-full);
  font-size: .82rem;
  color: var(--ink-3);
  white-space: nowrap;
  border: 1px solid transparent;
  transition: color .22s var(--ease), background .22s var(--ease), border-color .22s var(--ease);
}
.chapter-nav a:hover { color: var(--ink-2); background: var(--surface); text-decoration: none; }
.chapter-nav a[aria-current="true"] {
  color: var(--brand-ink);
  background: var(--brand-tint);
  border-color: var(--brand-line);
}
.chapter-nav__idx {
  font-family: var(--font-mono);
  font-size: .7rem;
  opacity: .7;
  margin-right: 5px;
}

/* ------------------------------ 容器与分节 ------------------------------ */

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: clamp(60px, 8vw, 104px) 0;
  scroll-margin-top: calc(var(--header-h) + 48px);
}
.section--tight { padding-top: clamp(28px, 4vw, 48px); }
.section--alt { background: var(--bg-elev); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.section__head { max-width: 780px; margin-bottom: clamp(28px, 4vw, 48px); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--s4);
  padding: 5px 12px 5px 8px;
  border-radius: var(--r-full);
  background: var(--surface);
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .04em;
  color: var(--ink-2);
  text-transform: uppercase;
}
.eyebrow__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand);
  flex-shrink: 0;
}
.eyebrow--teal  .eyebrow__dot { background: var(--teal); }
.eyebrow--amber .eyebrow__dot { background: var(--amber); }
.eyebrow--danger .eyebrow__dot { background: var(--danger); }

.section__head .h2 { margin-bottom: var(--s4); }
.section__head .lede { max-width: 700px; }

/* ------------------------------ Hero ------------------------------ */

.hero {
  position: relative;
  padding: clamp(56px, 9vw, 112px) 0 clamp(40px, 6vw, 72px);
  overflow: hidden;
}
/* 一处极克制的品牌蓝径向光，不做满屏渐变 */
.hero::before {
  content: "";
  position: absolute;
  top: -280px; left: 50%;
  width: 900px; height: 560px;
  margin-left: -450px;
  background: radial-gradient(closest-side, rgba(77, 107, 254, .17), transparent 72%);
  pointer-events: none;
}

.hero__inner { position: relative; }

.hero__title { margin-bottom: var(--s5); }
.hero__title em {
  font-style: normal;
  color: var(--brand-ink);
}

.hero__lede { max-width: 680px; margin-bottom: var(--s7); }

.hero__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s3);
  margin-bottom: var(--s6);
}

.stat {
  padding: var(--s5) var(--s5) var(--s4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.stat:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.stat__value {
  font-family: var(--font-mono);
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  font-weight: 650;
  letter-spacing: -.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat__value .unit { font-size: .5em; color: var(--ink-3); margin-left: 4px; letter-spacing: 0; }
.stat__label { margin-top: 10px; font-size: .82rem; color: var(--ink-3); line-height: 1.5; }
.stat--brand .stat__value { color: var(--brand-ink); }
.stat--teal  .stat__value { color: var(--teal-ink); }
.stat--amber .stat__value { color: var(--amber-ink); }

.hero__note {
  display: inline-flex;
  align-items: flex-start;
  gap: 10px;
  padding: var(--s3) var(--s4);
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--line);
  max-width: 720px;
  color: var(--ink-2);
  font-size: .875rem;
}
.hero__note svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: 3px; color: var(--amber); }

/* ------------------------------ 布局网格 ------------------------------ */

.grid { display: grid; gap: var(--s5); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid--split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s6); }

@media (max-width: 860px) {
  .grid--split { grid-template-columns: minmax(0, 1fr); }
}

/* ------------------------------ 页脚 ------------------------------ */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--bg-elev);
  padding: clamp(48px, 6vw, 72px) 0 var(--s8);
}
.footer-links { display: grid; gap: var(--s3); margin-bottom: var(--s6); }
.footer-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  font-size: .9rem;
}
.footer-links a:hover { color: var(--ink); }
.footer-links svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--ink-3); }

.footer-meta {
  padding-top: var(--s5);
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4) var(--s6);
  align-items: center;
  justify-content: space-between;
  color: var(--ink-3);
  font-size: .8rem;
}
.footer-meta__links { display: flex; gap: var(--s5); flex-wrap: wrap; }

/* ------------------------------ 响应式 ------------------------------ */

@media (max-width: 720px) {
  body { font-size: 16px; }
  :root { --header-h: 56px; }
  .brand__meta { display: none; }
  .header-links a span { display: none; }
  .header-links a { padding: 7px 9px; }
  .hero__stats { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .stat { padding: var(--s4); }
}

@media (max-width: 420px) {
  :root { --gutter: 16px; }
}
