/* Quodara 融资资料站 —— 全局样式。
   规范见 docs/frontend.md：只用系统字体，不加载任何外部资源，
   全站只有 body 一个滚动区（唯一例外是 .toc，已白名单）。 */

:root {
  --c-bg: #f6f7f9;
  --c-surface: #ffffff;
  --c-surface-2: #f0f3f7;
  --c-ink: #14202e;
  --c-ink-2: #405061;
  --c-muted: #6b7a8c;
  --c-line: #e2e7ee;
  --c-accent: #12507f;
  --c-accent-hover: #0d3f66;
  --c-accent-soft: #e8f0f7;
  --c-ok: #17734f;
  --c-ok-soft: #e6f4ee;
  --c-wait: #8a5a12;
  --c-wait-soft: #fbf1e0;
  --c-talk: #4b4f9a;
  --c-talk-soft: #ecedf8;
  --c-danger: #a4342c;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --fs-hero: 2.25rem;

  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-pill: 999px;

  --topbar-h: 56px;
  --page-max: 1120px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--c-bg);
  color: var(--c-ink-2);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: 1.75;
}

body.body--center {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s5);
}

h1, h2, h3 { color: var(--c-ink); line-height: 1.35; margin: 0; }
p { margin: 0; }
img, video { max-width: 100%; height: auto; display: block; }

a { color: var(--c-accent); text-decoration: none; }
a:hover { color: var(--c-accent-hover); text-decoration: underline; }
:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }

/* ------------------------------------------------------------------ 顶栏 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  background: var(--c-ink);
  color: #fff;
}

.topbar__inner {
  max-width: var(--page-max);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--s5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s4);
}

.brand { display: flex; align-items: center; gap: var(--s3); color: #fff; }
.brand:hover { text-decoration: none; }

.brand__mark {
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  background: var(--c-accent);
  display: grid;
  place-items: center;
  font-weight: 700;
}

.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text strong { font-size: var(--fs-base); }
.brand__text em { font-style: normal; font-size: var(--fs-xs); color: #b8c4d2; }

.topnav { display: flex; flex-wrap: wrap; gap: var(--s2); }

.topnav__link {
  color: #cdd8e4;
  font-size: var(--fs-sm);
  padding: var(--s1) var(--s3);
  border-radius: var(--r-sm);
}

.topnav__link:hover { background: rgba(255, 255, 255, 0.1); color: #fff; text-decoration: none; }
.topnav__link.is-active { background: var(--c-accent); color: #fff; }

/* ------------------------------------------------------------------ 骨架 */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s6) var(--s5) var(--s8);
  display: flex;
  flex-direction: column;
  gap: var(--s6);
}

.footer { border-top: 1px solid var(--c-line); background: var(--c-surface); }

.footer__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--s5);
  color: var(--c-muted);
  font-size: var(--fs-sm);
}

.footer__line { color: var(--c-ink-2); }
.footer__note { margin-top: var(--s1); }

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: var(--s5);
}

.section-title { font-size: var(--fs-lg); margin-bottom: var(--s3); }
.subsection-title { font-size: var(--fs-md); margin: var(--s6) 0 var(--s3); }
.section-lead { color: var(--c-muted); margin-bottom: var(--s4); max-width: 76ch; }

/* ------------------------------------------------------------------ 首页 */
.hero { padding: var(--s5) 0 0; }
.hero__eyebrow { color: var(--c-accent); font-size: var(--fs-sm); letter-spacing: 0.04em; }
.hero__title { font-size: var(--fs-hero); margin: var(--s3) 0; max-width: 22ch; }
.hero__body { max-width: 68ch; color: var(--c-ink-2); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); }

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s4);
}

.fact {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: var(--s4);
}

.fact__value { font-size: var(--fs-xl); font-weight: 700; color: var(--c-ink); line-height: 1.2; }
.fact__label { color: var(--c-ink-2); margin-top: var(--s1); }
.fact__hint { color: var(--c-muted); font-size: var(--fs-sm); margin-top: var(--s1); }

.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); }
.pillar { border-left: 3px solid var(--c-accent); padding-left: var(--s4); }
.pillar__title { font-size: var(--fs-md); margin-bottom: var(--s2); }
.pillar__text { color: var(--c-ink-2); }

.placeholder {
  background: var(--c-surface-2);
  border: 1px dashed var(--c-line);
  border-radius: var(--r-md);
  padding: var(--s5);
  color: var(--c-muted);
}

.placeholder--sm { padding: var(--s4); font-size: var(--fs-sm); text-align: center; }

.demo__video { width: 100%; border-radius: var(--r-md); border: 1px solid var(--c-line); background: #000; }
.demo__steps { margin: var(--s4) 0; padding-left: var(--s5); color: var(--c-ink-2); }
.demo__steps li { margin-bottom: var(--s2); }

/* ------------------------------------------------------------------ 时间线 */
.timeline { list-style: none; margin: var(--s4) 0 0; padding: 0 0 0 var(--s5); border-left: 2px solid var(--c-line); }
.timeline__item { position: relative; padding: 0 0 var(--s5) var(--s2); }
.timeline__item:last-child { padding-bottom: 0; }

.timeline__dot {
  position: absolute;
  left: calc(var(--s5) * -1 - 5px);
  top: 8px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--c-accent);
  border: 2px solid var(--c-surface);
}

.timeline__item--pivot .timeline__dot { background: var(--c-wait); }
.timeline__item--plan .timeline__dot { background: var(--c-surface); border-color: var(--c-muted); }
.timeline__date { font-size: var(--fs-sm); color: var(--c-muted); }
.timeline__title { font-size: var(--fs-md); margin: var(--s1) 0; }
.timeline__text { color: var(--c-ink-2); }
.timeline--plan { border-left-style: dashed; }

/* ------------------------------------------------------------------ 案例 */
.case-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--s4); }
.case { border: 1px solid var(--c-line); border-radius: var(--r-md); padding: var(--s4); background: var(--c-surface); }
.case-grid--full { gap: var(--s5); }
.case-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.case__tag { font-size: var(--fs-xs); color: var(--c-accent); background: var(--c-accent-soft); padding: 2px var(--s2); border-radius: var(--r-pill); display: inline-block; }
.case__title { font-size: var(--fs-md); margin: var(--s3) 0 var(--s2); }
.case__summary { color: var(--c-ink-2); }
.case__media { width: 100%; border-radius: var(--r-md); border: 1px solid var(--c-line); margin: var(--s3) 0; }

.toc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s2); list-style: none; margin: 0; padding: 0; }
.toc-grid a { display: block; padding: var(--s2) var(--s3); border-radius: var(--r-sm); color: var(--c-ink-2); }
.toc-grid a:hover { background: var(--c-accent-soft); color: var(--c-accent); text-decoration: none; }
.toc-grid__no { display: inline-block; min-width: 2.5em; color: var(--c-muted); }

/* ------------------------------------------------------------------ BP 两栏 */
.bp-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--s6); align-items: start; }

.toc-col { position: sticky; top: calc(var(--topbar-h) + var(--s4)); }

.toc { /* layout-check: allow —— 目录是全站唯一允许自带滚动条的容器 */
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: calc(100vh - var(--topbar-h) - var(--s8));
  max-height: calc(100dvh - var(--topbar-h) - var(--s8));
  overflow-y: auto;
  padding-right: var(--s2);
}

.toc__chapter { color: var(--c-ink); font-size: var(--fs-sm); font-weight: 600; padding: var(--s2) var(--s2); border-radius: var(--r-sm); }
.toc__section { color: var(--c-muted); font-size: var(--fs-sm); padding: 2px var(--s2) 2px var(--s4); border-radius: var(--r-sm); }
.toc__chapter:hover, .toc__section:hover { background: var(--c-accent-soft); color: var(--c-accent); text-decoration: none; }
.toc__section.is-active, .toc__chapter.is-active { background: var(--c-accent-soft); color: var(--c-accent); }

.toc-mobile { display: none; }

.bp-col { display: flex; flex-direction: column; gap: var(--s6); min-width: 0; }

.bp-head { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); padding: var(--s6) var(--s5); }
.bp-head__eyebrow { color: var(--c-muted); font-size: var(--fs-sm); }
.bp-head__title { font-size: var(--fs-xl); margin: var(--s2) 0; }
.bp-head__meta { color: var(--c-ink-2); }
.bp-head__note { color: var(--c-wait); font-size: var(--fs-sm); margin-top: var(--s3); }

.bp-chapter { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); padding: var(--s5); scroll-margin-top: calc(var(--topbar-h) + var(--s4)); }
.bp-chapter__title { font-size: var(--fs-lg); display: flex; gap: var(--s3); align-items: baseline; }
.bp-chapter__no { color: var(--c-accent); font-size: var(--fs-base); }
.bp-chapter__summary { color: var(--c-muted); margin: var(--s3) 0 0; max-width: 76ch; }

.bp-section { margin-top: var(--s6); scroll-margin-top: calc(var(--topbar-h) + var(--s4)); }
.bp-section__title { font-size: var(--fs-md); margin-bottom: var(--s3); }
.bp-section__no { color: var(--c-accent); margin-right: var(--s2); }

.prose { max-width: 76ch; margin-bottom: var(--s3); }
.prose-list { max-width: 76ch; margin: 0 0 var(--s3); padding-left: var(--s5); }
.prose-list li { margin-bottom: var(--s2); }
.prose-list--tight li { margin-bottom: var(--s1); font-size: var(--fs-sm); color: var(--c-muted); }

.callout {
  background: var(--c-accent-soft);
  border-left: 3px solid var(--c-accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--s4);
  margin: 0 0 var(--s4);
  max-width: 76ch;
}

.callout__title { font-weight: 700; color: var(--c-ink); margin-bottom: var(--s1); }
.callout__text { color: var(--c-ink-2); }

.bp-cta { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); padding: var(--s5); display: flex; flex-direction: column; align-items: flex-start; gap: var(--s3); }
.bp-cta .btn + .btn { margin-left: var(--s2); }

/* ------------------------------------------------------------------ 表格 */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--s4);
  font-size: var(--fs-base);
  line-height: 1.6;
}

.data-table th {
  text-align: left;
  background: var(--c-surface-2);
  color: var(--c-ink);
  font-weight: 600;
  padding: var(--s3);
  border-bottom: 2px solid var(--c-line);
}

.data-table td { padding: var(--s3); border-bottom: 1px solid var(--c-line); vertical-align: top; color: var(--c-ink-2); }
.data-table tr:last-child td { border-bottom: none; }
.data-table td:first-child { color: var(--c-ink); font-weight: 600; }

.pending {
  display: inline-block;
  background: var(--c-wait-soft);
  color: var(--c-wait);
  font-size: var(--fs-xs);
  padding: 0 var(--s2);
  border-radius: var(--r-pill);
  line-height: 22px;
}

/* ------------------------------------------------------------------ 尽调问答 */
.page-head { padding-top: var(--s4); }
.page-head__title { font-size: var(--fs-xl); }
.page-head__lead { color: var(--c-ink-2); max-width: 76ch; margin-top: var(--s3); }
.page-head__stats { margin-top: var(--s3); display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; color: var(--c-muted); font-size: var(--fs-sm); }

.qa-chapter { scroll-margin-top: calc(var(--topbar-h) + var(--s4)); }
.qa-chapter__no { color: var(--c-accent); font-size: var(--fs-base); margin-right: var(--s3); }
.qa-list { list-style: none; margin: 0; padding: 0; }
.qa-item { border-top: 1px solid var(--c-line); padding: var(--s4) 0; }
.qa-item:first-child { border-top: none; padding-top: 0; }
.qa-item__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.qa-item__no { color: var(--c-muted); font-family: var(--font-mono); font-size: var(--fs-sm); min-width: 3.2em; }
.qa-item__q { color: var(--c-ink); font-weight: 600; flex: 1 1 260px; min-width: 0; }
.qa-item__level { color: var(--c-muted); font-size: var(--fs-xs); font-family: var(--font-mono); }
.qa-item__a { color: var(--c-ink-2); margin-top: var(--s2); max-width: 76ch; }
.qa-item__ref { margin-top: var(--s1); font-size: var(--fs-sm); }

.badge {
  display: inline-block;
  font-size: var(--fs-xs);
  line-height: 22px;
  padding: 0 var(--s3);
  border-radius: var(--r-pill);
  white-space: nowrap;
}

.badge--ok { background: var(--c-ok-soft); color: var(--c-ok); }
.badge--wait { background: var(--c-wait-soft); color: var(--c-wait); }
.badge--talk { background: var(--c-talk-soft); color: var(--c-talk); }
.badge--accent { background: var(--c-accent-soft); color: var(--c-accent); }

/* ------------------------------------------------------------------ 控件 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 var(--s4);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: var(--fs-base);
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.btn:hover { text-decoration: none; }
.btn--primary { background: var(--c-accent); color: #fff; }
.btn--primary:hover { background: var(--c-accent-hover); color: #fff; }
.btn--ghost { background: transparent; color: var(--c-accent); border-color: var(--c-line); }
.btn--ghost:hover { background: var(--c-accent-soft); color: var(--c-accent-hover); }
.btn--sm { height: 30px; padding: 0 var(--s3); font-size: var(--fs-sm); }
.btn[disabled] { opacity: 0.6; cursor: not-allowed; }

.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); max-width: 720px; }
.form--narrow { grid-template-columns: 1fr; max-width: 360px; }
.field { display: flex; flex-direction: column; gap: var(--s1); }
.field--wide { grid-column: 1 / -1; }
.field__label { font-size: var(--fs-sm); color: var(--c-ink); }
.req { color: var(--c-danger); }

.field__input {
  width: 100%;
  max-width: 420px;
  height: 38px;
  padding: 0 var(--s3);
  border: 1px solid var(--c-line);
  border-radius: var(--r-sm);
  background: var(--c-surface);
  color: var(--c-ink);
  font-family: inherit;
  font-size: var(--fs-base);
}

.field__input:focus { border-color: var(--c-accent); outline: none; box-shadow: 0 0 0 3px var(--c-accent-soft); }

.field__input--area { height: auto; min-height: 96px; max-width: 560px; padding: var(--s3); line-height: 1.7; resize: vertical; }
.field__input--inline { max-width: 140px; }

.form__actions { grid-column: 1 / -1; display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.form-msg { font-size: var(--fs-sm); color: var(--c-muted); min-height: 1.5em; }
.form-msg.is-ok { color: var(--c-ok); }
.form-msg.is-error { color: var(--c-danger); }

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.contact-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4); margin: 0; }
.contact-list dt { font-size: var(--fs-sm); color: var(--c-muted); }
.contact-list dd { margin: var(--s1) 0 0; color: var(--c-ink); }

.auth-card { background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); padding: var(--s6); width: 100%; max-width: 400px; }
.auth-card--plain { text-align: center; }
.auth-card__title { font-size: var(--fs-lg); }
.auth-card__lead { color: var(--c-muted); margin: var(--s2) 0 var(--s5); }
.auth-card__back { margin-top: var(--s5); font-size: var(--fs-sm); }

/* ------------------------------------------------------------------ 响应式 */
@media (max-width: 1024px) {
  .bp-layout { grid-template-columns: minmax(0, 1fr); }
  .toc-col { position: static; }
  .toc--desktop { display: none; }
  .toc-mobile { display: block; background: var(--c-surface); border: 1px solid var(--c-line); border-radius: var(--r-lg); padding: var(--s4); }
  .toc-mobile summary { cursor: pointer; font-weight: 600; color: var(--c-ink); }
  .toc-mobile .toc { max-height: none; overflow: visible; margin-top: var(--s3); }
}

@media (max-width: 720px) {
  .data-table thead { display: none; }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td { display: block; width: 100%; }

  .data-table tr { border: 1px solid var(--c-line); border-radius: var(--r-md); margin-bottom: var(--s3); padding: var(--s2); }
  .data-table td { border-bottom: 1px dashed var(--c-line); padding: var(--s2); }
  .data-table tr td:last-child { border-bottom: none; }

  .data-table td::before {
    content: attr(data-label);
    display: block;
    font-size: var(--fs-xs);
    color: var(--c-muted);
    margin-bottom: 2px;
  }
}

@media (max-width: 640px) {
  .page { padding: var(--s5) var(--s4) var(--s7); gap: var(--s5); }
  .topbar__inner { padding: 0 var(--s4); }
  .brand__text em { display: none; }
  .card, .bp-chapter, .bp-head, .bp-cta { padding: var(--s4); }
  .hero__title { font-size: var(--fs-xl); }
}
