/* 文档页样式，放在 home.css 之后加载。 */
[hidden] { display: none !important; }

/* ---------- 页头 ---------- */
.doc-hero { position: relative; overflow: hidden; padding: 64px 0; background: var(--surface); border-bottom: 1px solid var(--line); }
.doc-hero::before {
  content: ""; position: absolute; right: -60px; top: -70px; width: 420px; height: 288px;
  background: url("/brand/dd-symbol-blue.svg") center / contain no-repeat; opacity: .05; pointer-events: none;
}
.doc-hero-grid { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 64px; align-items: center; }
.doc-hero h1 { margin-top: 12px; font-size: clamp(32px, 4vw, 42px); line-height: 1.2; letter-spacing: -.02em; }
.doc-lead { margin-top: 16px; max-width: 560px; color: var(--muted); font-size: 17px; line-height: 1.75; }
.doc-hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.doc-conn { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 8px 24px -16px rgba(15, 28, 55, .22); }
.doc-conn-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.doc-conn-head img { width: 26px; height: auto; }
.doc-conn-head h2 { font-size: 15px; }
.doc-conn dl { margin: 0; padding: 4px 20px 8px; }
.doc-conn dl div { padding: 12px 0; }
.doc-conn dl div + div { border-top: 1px solid var(--line); }
.doc-conn dt { color: var(--muted); font-size: 13px; }
.doc-conn dd { display: flex; align-items: center; gap: 12px; margin: 4px 0 0; min-width: 0; }
.doc-conn code { flex: 1; min-width: 0; color: var(--ink); font-size: 13.5px; overflow-wrap: anywhere; }

/* ---------- 布局 ---------- */
.doc-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 64px; padding: 48px 0 88px; }
.doc-side { position: sticky; top: 88px; align-self: start; }
.doc-side h2 { padding: 0 12px; color: var(--faint); font-size: 13px; font-weight: 600; }
.doc-side nav { display: grid; gap: 2px; margin-top: 10px; }
.doc-side a { padding: 7px 12px; border-radius: 6px; color: var(--muted); font-size: 14px; line-height: 1.5; transition: color .15s, background .15s; }
.doc-side a:hover { color: var(--ink); background: var(--surface); }
.doc-side a.active { color: var(--blue-dark); background: var(--soft); font-weight: 600; }

/* ---------- 正文 ---------- */
.doc-main { min-width: 0; max-width: 820px; }
.doc-section + .doc-section { margin-top: 56px; padding-top: 48px; border-top: 1px solid var(--line); }
.doc-main h2 { font-size: 24px; line-height: 1.35; }
.doc-main h3 { margin-top: 32px; font-size: 17px; line-height: 1.4; }
.doc-main p, .doc-main li { font-size: 15px; line-height: 1.8; }
.doc-main h2 + p, .doc-main h3 + p { margin-top: 10px; }
.doc-main a:not(.btn) { color: var(--blue-dark); font-weight: 500; }
.doc-main a:not(.btn):hover { text-decoration: underline; }
.doc-main :not(pre) > code { padding: 2px 6px; border-radius: 5px; background: #eef1f6; color: var(--ink); font-size: .88em; overflow-wrap: anywhere; }
.doc-main .doc-after { margin-top: 16px; }
.doc-main .doc-hint { margin-top: 12px; color: var(--muted); font-size: 14px; }

.doc-steps { list-style: none; margin: 20px 0 0; padding: 0; }
.doc-steps li { position: relative; padding: 0 0 22px 34px; }
.doc-steps li:last-child { padding-bottom: 0; }
.doc-steps li::before { content: ""; position: absolute; left: 0; top: 5px; width: 16px; height: 16px; border: 4px solid var(--blue); border-radius: 50%; background: var(--white); }
.doc-steps li:not(:last-child)::after { content: ""; position: absolute; left: 7px; top: 25px; bottom: -1px; width: 2px; background: var(--line-strong); }
.doc-steps b { display: block; color: var(--ink); font-size: 15px; font-weight: 600; }
.doc-steps span { display: block; margin-top: 2px; }

.doc-main .console { margin-top: 24px; }
.doc-main .console pre { min-height: 0; }
.doc-main .console-note p { color: var(--on-dark); font-size: 13px; line-height: 1.7; }
.doc-main .console-note code { background: rgba(255, 255, 255, .1); color: #d7def0; }
.doc-main .console-note a { color: #9cc0ff; }

.doc-table-wrap { margin-top: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.doc-table { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.65; }
.doc-table th { padding: 11px 18px; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; text-align: left; white-space: nowrap; }
.doc-table td { padding: 13px 18px; border-bottom: 1px solid var(--line); color: var(--text); vertical-align: top; }
.doc-table tbody tr:last-child td { border-bottom: 0; }
.doc-table td:first-child { color: var(--ink); font-weight: 600; white-space: nowrap; }
.doc-main .doc-table code { padding: 0; background: none; color: var(--ink); font-size: 13.5px; }
.doc-table code + code { display: block; margin-top: 4px; }
.doc-table .copy-cell { width: 1%; text-align: right; }
.doc-table .copy, .doc-conn .copy { flex: none; white-space: nowrap; }

.doc-terms { margin: 16px 0 0; }
.doc-terms div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.doc-terms div:first-child { border-top: 1px solid var(--line); }
.doc-terms dt { color: var(--ink); font-size: 15px; font-weight: 600; line-height: 1.8; }
.doc-terms dd { margin: 0; font-size: 15px; line-height: 1.8; }

.doc-note { margin-top: 20px; padding: 14px 18px; border: 1px solid #d3e3ff; border-radius: var(--radius); background: #f3f7ff; color: var(--text); font-size: 14px; line-height: 1.75; }
.doc-note b { color: var(--ink); font-weight: 600; }

.doc-formula { margin-top: 16px; padding: 16px 20px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 15px; font-weight: 600; }

.doc-foot { padding: 0 0 28px; }
.doc-foot .footer-bottom { margin-top: 0; }
.doc-foot .footer-bottom a { color: var(--muted); margin-left: 20px; }
.doc-foot .footer-bottom a:hover { color: var(--ink); }

/* ---------- 响应式 ---------- */
@media (max-width: 1040px) {
  .doc-hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .doc-conn { max-width: 560px; }
}
@media (max-width: 860px) {
  html { scroll-padding-top: 132px; }
  .doc-layout { display: block; padding-top: 0; }
  .doc-side { top: 64px; z-index: 20; margin: 0 -24px 36px; padding: 10px 24px; background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--line); }
  .doc-side h2 { display: none; }
  .doc-side nav { display: flex; gap: 6px; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .doc-side nav::-webkit-scrollbar { display: none; }
  .doc-side a { flex: none; padding: 5px 12px; font-size: 13px; }
}
@media (max-width: 680px) {
  .doc-hero { padding: 40px 0; }
  .doc-side { margin: 0 -16px 32px; padding: 10px 16px; }
  .doc-hero-actions .btn { flex: 1; }
  .doc-table thead { display: none; }
  .doc-table, .doc-table tbody, .doc-table tr, .doc-table td { display: block; width: 100%; }
  .doc-table tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .doc-table tbody tr:last-child { border-bottom: 0; }
  .doc-table td { padding: 2px 0; border-bottom: 0; }
  .doc-table td:first-child { white-space: normal; }
  .doc-table .copy-cell { width: auto; margin-top: 6px; text-align: left; }
  .doc-terms div { grid-template-columns: 1fr; gap: 0; }
}
