/* ============================================================
   blafili lab — Grav theme "lab" ("Reference Light")
   Warm-white reference-library style: docs skeleton + editorial warmth
   Tokens are the single source of truth.
   ============================================================ */

:root {
  --bg: #FAF9F7;
  --surface: #FFFFFF;
  --ink: #1F2328;
  --muted: #5C636A;
  --faint: #8A9099;
  --line: #E8E4DC;
  --line-soft: #F0EDE6;

  --accent: #2B4ACB;
  --accent-ink: #1F37A5;
  --accent-tint: #EEF1FD;
  --accent-line: #D6DEFB;

  --ok: #178A50;
  --ok-tint: #E7F4EC;
  --warn: #9A6700;
  --warn-tint: #FBF1D8;
  --off: #6B7280;
  --off-tint: #EFF1F3;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(31, 35, 40, .04), 0 4px 16px rgba(31, 35, 40, .05);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 70ch;
  --damp: cubic-bezier(.22, 1, .36, 1); /* 全站统一阻尼缓动 */
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 84px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16.5px/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-tint); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

/* ---------------- Header ---------------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250, 249, 247, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 19px; letter-spacing: -.02em; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo .logo-img {
  height: 21px; width: auto; display: block;
  filter: brightness(0); /* 官方字标为白色 PNG，页面上转黑使用 */
}
.logo .lab {
  background: var(--accent); color: #fff; font-size: 12px; font-weight: 700;
  padding: 2px 8px; border-radius: 999px; letter-spacing: .04em; text-transform: uppercase;
}
.main-nav { display: flex; gap: 4px; margin-left: 8px; }
.main-nav a {
  color: var(--muted); font-size: 14.5px; font-weight: 500;
  padding: 8px 11px; border-radius: 8px;
}
.main-nav a:hover { color: var(--ink); background: var(--line-soft); text-decoration: none; }
.main-nav a.active, .main-nav a[aria-current="page"] { color: var(--accent-ink); background: var(--accent-tint); }

.header-search { margin-left: auto; position: relative; width: 260px; }
.header-search input {
  width: 100%; height: 38px; padding: 0 40px 0 36px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); font: 500 14px var(--sans); color: var(--ink);
}
.header-search input::placeholder { color: var(--faint); }
.header-search .icon { position: absolute; left: 11px; top: 50%; translate: 0 -50%; color: var(--faint); }
.header-search kbd {
  position: absolute; right: 8px; top: 50%; translate: 0 -50%;
  font: 600 11px var(--mono); color: var(--faint);
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; background: var(--bg);
}
.menu-btn { display: none; margin-left: auto; }

/* ---------------- Hero (homepage) ---------------- */
.hero { padding: 64px 0 40px; text-align: center; }
.hero h1 {
  font-size: clamp(30px, 4.4vw, 44px); line-height: 1.15;
  letter-spacing: -.025em; font-weight: 800; margin: 0 0 14px;
}
.hero .sub { max-width: 640px; margin: 0 auto; color: var(--muted); font-size: 17.5px; }
.hero-search { position: relative; max-width: 620px; margin: 28px auto 0; }
.hero-search input {
  width: 100%; height: 56px; padding: 0 16px 0 48px;
  font: 500 16.5px var(--sans); color: var(--ink);
  border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--surface); box-shadow: var(--shadow);
}
.hero-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint); }
.hero-search .icon { position: absolute; left: 16px; top: 50%; translate: 0 -50%; color: var(--faint); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.chip {
  font-size: 13px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--line); background: var(--surface);
  padding: 5px 12px; border-radius: 999px; cursor: pointer;
}
.chip:hover { color: var(--accent-ink); border-color: var(--accent-line); background: var(--accent-tint); text-decoration: none; }

/* ---------------- Section cards (homepage) ---------------- */
.section-title { font-size: 13px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 44px 0 16px; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.section-card {
  display: flex; flex-direction: column; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s;
}
.section-card:hover { border-color: var(--accent-line); transform: translateY(-2px); text-decoration: none; }
.section-card .icon-tile {
  width: 38px; height: 38px; border-radius: 9px; background: var(--accent-tint); color: var(--accent);
  display: grid; place-items: center; margin-bottom: 4px;
}
.section-card h3 { margin: 0; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
.section-card p { margin: 0; font-size: 14px; color: var(--muted); line-height: 1.55; flex: 1; }
.section-card .meta { font: 500 12px var(--mono); color: var(--faint); border-top: 1px solid var(--line-soft); padding-top: 10px; }

/* ---------------- Latest additions ---------------- */
.latest { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.latest-row {
  display: grid; grid-template-columns: 110px 1fr auto auto; gap: 14px; align-items: center;
  padding: 13px 18px; border-bottom: 1px solid var(--line-soft); color: var(--ink);
}
.latest-row:last-child { border-bottom: none; }
.latest-row:hover { background: var(--accent-tint); text-decoration: none; }
.type-tag {
  font: 600 11px var(--sans); letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-ink); background: var(--accent-tint);
  padding: 3px 9px; border-radius: 999px; text-align: center; white-space: nowrap;
}
.latest-row .t { font-weight: 600; font-size: 14.5px; }
.latest-row .d { color: var(--faint); font: 500 12.5px var(--mono); white-space: nowrap; }

/* ---------------- Badges ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font: 600 12px var(--sans); padding: 3px 10px; border-radius: 999px; white-space: nowrap; }
.badge svg { flex: none; }
.badge.ok { color: var(--ok); background: var(--ok-tint); }
.badge.warn { color: var(--warn); background: var(--warn-tint); }
.badge.off { color: var(--off); background: var(--off-tint); }
.badge.acc { color: var(--accent-ink); background: var(--accent-tint); }

/* ---------------- Breadcrumb / page meta ---------------- */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--faint); padding: 26px 0 4px; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--line); }
.page-head h1 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.2; letter-spacing: -.02em; font-weight: 800; margin: 6px 0 12px; }
.meta-row { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; color: var(--muted); font-size: 13.5px; }
.meta-row .dot { color: var(--line); }

/* ---------------- Article layout (content + TOC) ---------------- */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: 48px; padding: 8px 0 64px; }
.article { max-width: var(--measure); }
.article h2 { font-size: 22px; font-weight: 750; letter-spacing: -.015em; margin: 40px 0 12px; scroll-margin-top: 84px; }
.article h3 { font-size: 17px; font-weight: 700; margin: 28px 0 8px; scroll-margin-top: 84px; }
.article p { margin: 0 0 16px; }
.article ul, .article ol { margin: 0 0 16px; padding-left: 24px; }
.article li { margin-bottom: 6px; }
.article figure { margin: 20px 0; }

/* Quick answer box */
.quick-answer {
  background: var(--accent-tint); border: 1px solid var(--accent-line); border-left: 3px solid var(--accent);
  border-radius: var(--radius); padding: 16px 18px; margin: 22px 0 8px;
}
.quick-answer .label {
  display: inline-block; font: 700 11px var(--sans); letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent-ink); margin-bottom: 6px;
}
.quick-answer p { margin: 0; font-size: 15.5px; }

/* Callout */
.callout { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: var(--radius); padding: 14px 18px; margin: 20px 0; }
.callout.ok { border-left-color: var(--ok); }
.callout .label { font: 700 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--warn); display: block; margin-bottom: 6px; }
.callout.ok .label { color: var(--ok); }
.callout p { margin: 0; font-size: 14.5px; color: var(--muted); }

/* TOC */
.toc-col { position: relative; }
.toc { position: sticky; top: 88px; font-size: 13.5px; }
.toc .toc-title { font: 700 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.toc a { display: block; color: var(--muted); padding: 5px 0 5px 12px; border-left: 2px solid var(--line); line-height: 1.45; }
.toc a:hover { color: var(--ink); text-decoration: none; border-left-color: var(--faint); }
.toc a.active { color: var(--accent-ink); border-left-color: var(--accent); font-weight: 600; }
.toc .toc-extra { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------------- Tables ---------------- */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); margin: 16px 0 8px; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.data th {
  text-align: left; font: 600 11.5px var(--sans); letter-spacing: .07em; text-transform: uppercase;
  color: var(--faint); background: var(--bg); padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data .num { font-family: var(--mono); font-size: 13px; }
table.data tr:hover td { background: #FDFCFA; }
.table-note { font-size: 12.5px; color: var(--faint); margin: 0 0 16px; }

/* Option rows (connect methods) */
.option { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 12px 0; }
.option .n {
  flex: none; width: 30px; height: 30px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent-ink); font: 700 14px var(--sans);
}
.option.recommended { border-color: var(--accent-line); background: #FBFCFF; }
.option h3 { margin: 0 0 4px; font-size: 15.5px; }
.option p { margin: 0; font-size: 14px; color: var(--muted); }
.option .head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Checklist */
.checklist { list-style: none; padding: 0; margin: 0 0 16px; }
.checklist li { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line-soft); font-size: 15px; }
.checklist li:last-child { border-bottom: none; }
.checklist svg { flex: none; margin-top: 4px; color: var(--ok); }

/* Steps */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 16px; }
.steps li { counter-increment: step; position: relative; padding: 0 0 18px 44px; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: 0;
  width: 28px; height: 28px; border-radius: 999px; display: grid; place-items: center;
  background: var(--accent); color: #fff; font: 700 13px var(--sans);
}
.steps li::after { content: ""; position: absolute; left: 13.5px; top: 32px; bottom: 2px; width: 1px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps strong { display: block; margin-bottom: 2px; }
.steps p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* FAQ — 卡片式手风琴（阻尼展开） */
.faq { display: grid; gap: 10px; }
.faq-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .25s var(--damp), box-shadow .25s var(--damp);
}
.faq-item:hover { border-color: var(--accent-line); }
.faq-item.open { border-color: var(--accent-line); box-shadow: var(--shadow); }
.faq-q {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 14px;
  background: none; border: none; cursor: pointer; text-align: left;
  font: 600 15px/1.5 var(--sans); color: var(--ink); padding: 14px 16px;
}
.faq-q .fx {
  flex: none; width: 26px; height: 26px; border-radius: 999px;
  display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent-ink);
  transition: transform .42s var(--damp), background .25s, color .25s;
}
.faq-item.open .fx { transform: rotate(45deg); background: var(--accent); color: #fff; }
.faq-a { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .46s var(--damp); }
.faq-item.open .faq-a { grid-template-rows: 1fr; }
.faq-a-inner { overflow: hidden; }
.faq-a p { color: var(--muted); font-size: 14.5px; margin: 0; padding: 0 46px 15px 16px; }

/* ---------------- Product CTA box ---------------- */
.product-cta {
  display: flex; gap: 18px; align-items: center;
  background: var(--surface); border: 1px solid var(--accent-line); border-radius: var(--radius);
  padding: 18px; margin: 28px 0 8px; box-shadow: var(--shadow);
}
.product-cta .thumb {
  flex: none; width: 96px; height: 96px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-tint), #E3E9FC);
  display: grid; place-items: center; color: var(--accent);
}
.product-cta .info { flex: 1; min-width: 0; }
.product-cta .eyebrow { font: 700 10.5px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--accent-ink); }
.product-cta h3 { margin: 3px 0 4px; font-size: 16.5px; }
.product-cta p { margin: 0; font-size: 13.5px; color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--accent); color: #fff; font: 600 14px var(--sans);
  padding: 10px 16px; border-radius: 9px; border: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--accent-ink); color: #fff; text-decoration: none; }
.btn.ghost { background: transparent; color: var(--accent-ink); border: 1px solid var(--accent-line); }
.btn.ghost:hover { background: var(--accent-tint); }

/* ---------------- Sources & verification ---------------- */
.sources {
  border-top: 1px solid var(--line); margin-top: 36px; padding-top: 16px;
  font-size: 13px; color: var(--muted);
}
.sources .label { font: 700 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); display: block; margin-bottom: 6px; }
.sources ul { margin: 0; padding-left: 18px; }
.sources li { margin-bottom: 3px; }

/* ---------------- Trust strip (homepage) ---------------- */
.trust {
  display: flex; gap: 14px; align-items: flex-start;
  background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 16px 20px; margin-top: 36px; color: var(--muted); font-size: 14px;
}
.trust svg { flex: none; color: var(--ok); margin-top: 2px; }
.trust strong { color: var(--ink); }

/* ---------------- Footer ---------------- */
/* 预底部 CTA 横幅 */
.footer-cta { margin-top: 72px; }
.footer-cta-card {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  background: linear-gradient(135deg, #22307C, #2B4ACB 55%, #3D5BE0);
  border-radius: 18px; padding: 30px 34px; color: #fff;
  box-shadow: 0 12px 32px rgba(43, 74, 203, .28);
}
.footer-cta-card h3 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.015em; }
.footer-cta-card p { margin: 0; color: #D8DFFA; font-size: 14px; max-width: 560px; }
.btn.light { background: #fff; color: var(--accent-ink); }
.btn.light:hover { background: var(--accent-tint); }

.site-footer { border-top: 1px solid var(--line); margin-top: 56px; background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1fr 1.2fr; gap: 36px; padding: 42px 0 34px; }
.footer-grid h4 { font: 700 11px var(--sans); letter-spacing: .1em; text-transform: uppercase; color: var(--faint); margin: 0 0 6px; }
.footer-grid .col-desc { font-size: 12px; color: var(--faint); margin: 0 0 12px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: 9px; }
.footer-grid a { color: var(--muted); font-size: 14px; }
.footer-grid a:hover { color: var(--ink); }
.footer-brand p { font-size: 13.5px; color: var(--muted); max-width: 320px; margin: 12px 0 0; }
.footer-promise { list-style: none; margin: 16px 0 0; padding: 14px 0 0; border-top: 1px dashed var(--line); }
.footer-promise li {
  font-size: 13px; color: var(--muted); padding: 3px 0 3px 24px; position: relative;
}
.footer-promise li::before {
  content: "✓"; position: absolute; left: 2px; top: 3px;
  color: var(--ok); font-weight: 700; font-size: 12px;
}
.footer-popular li a { font-family: var(--mono); font-size: 12.5px; }
.footer-bottom {
  border-top: 1px solid var(--line-soft); padding: 18px 0 24px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--faint);
}
.footer-legal { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-legal a { color: var(--faint); font-size: 12.5px; }
.footer-legal a:hover { color: var(--ink); }

/* ---------------- Responsive ---------------- */
@media (max-width: 1000px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
  .article-layout { grid-template-columns: 1fr; gap: 8px; }
  .toc-col { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .header-search { width: 200px; }
  .main-nav { display: none; position: absolute; top: 64px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--line); flex-direction: column; padding: 10px 16px; gap: 2px; box-shadow: var(--shadow); }
  .main-nav.open { display: flex; }
  .menu-btn {
    display: inline-flex; align-items: center; gap: 7px; margin-left: auto;
    background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
    padding: 8px 13px; font: 600 14px var(--sans); color: var(--ink); cursor: pointer;
  }
  .header-search { margin-left: 0; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .header-inner { gap: 10px; }
  .header-search { display: none; }   /* homepage hero search remains */
  .card-grid { grid-template-columns: 1fr; }
  .hero { padding: 44px 0 28px; }
  .latest-row { grid-template-columns: 1fr auto; }
  .latest-row .type-tag { display: none; }
  .latest-row .d { grid-column: 1; }
  .product-cta { flex-direction: column; align-items: flex-start; }
  .footer-grid { grid-template-columns: 1fr; gap: 26px; }
  .footer-cta-card { flex-direction: column; align-items: flex-start; padding: 26px 24px; }
}
