/* v3.3 公开算法说明：深色封面 + 纸面技术文档 */

body.public-doc {
  margin: 0; background: #fbfcfe; color: #16202e;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  font-size: calc(14px * 1.3); line-height: 1.75; -webkit-font-smoothing: antialiased;
}
.public-doc a { color: inherit; text-decoration: none; }
.public-doc h1, .public-doc h2, .public-doc h3, .public-doc p { margin: 0; }

/* top bar */
.pub-top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 28px;
  background: rgba(7, 13, 24, .94);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(128, 174, 255, .16);
}
.pub-brand { display: flex; align-items: center; gap: 10px; color: #f2f7ff; font-weight: 650; }
.pub-mark {
  width: 28px; height: 28px; border-radius: 5px; flex: none;
  display: grid; place-items: center;
  background: #fff; color: #070d18;
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  font-size: calc(9px * 1.3); font-weight: 700; letter-spacing: .02em;
  box-shadow: inset 0 -2px 0 #38bdf8;
}
.pub-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.pub-brand-text strong { font-size: calc(13px * 1.3); font-weight: 650; color: #f2f7ff; }
.pub-brand-text small { margin-top: 2px; font-family: "JetBrains Mono", Consolas, monospace; font-size: calc(8.5px * 1.3); font-weight: 400; letter-spacing: .1em; color: #93a5bf; }
.pub-tag { font-family: "JetBrains Mono", Consolas, monospace; font-size: calc(9.5px * 1.3); letter-spacing: .08em; color: #7f92ad; }
.pub-top a {
  margin-left: auto; padding: 5px 10px;
  border: 1px solid rgba(128, 174, 255, .26); border-radius: 4px;
  font-family: "JetBrains Mono", Consolas, monospace; font-size: calc(9.5px * 1.3); letter-spacing: .06em; color: #cfe3f8;
}
.pub-top a:hover { border-color: rgba(128, 174, 255, .5); color: #fff; }

.pub-wrap { width: min(1080px, calc(100% - 48px)); margin: 0 auto 64px; }

/* cover hero */
.pub-hero {
  position: relative; overflow: hidden;
  margin: 30px 0 12px; padding: 34px 36px 30px;
  background:
    radial-gradient(90% 130% at 88% -10%, rgba(56, 189, 248, .16) 0%, rgba(7, 13, 24, 0) 58%),
    linear-gradient(135deg, #070d18 0%, #0a1424 60%, #0b1a2e 100%);
  border: 1px solid rgba(128, 174, 255, .18); border-radius: 10px;
  color: #e9effa;
}
.pub-hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(128, 174, 255, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(128, 174, 255, .07) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, .85), transparent 80%);
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, .85), transparent 80%);
}
.pub-hero::after {
  content: ""; position: absolute; left: 36px; right: 36px; bottom: 0; height: 2px;
  background: linear-gradient(90deg, #38bdf8, rgba(56, 189, 248, 0) 64%);
  opacity: .8;
}
.pub-hero > * { position: relative; z-index: 1; }
.pub-kicker {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: "JetBrains Mono", Consolas, monospace;
  font-size: calc(9.5px * 1.3); font-weight: 500; letter-spacing: .2em; text-transform: uppercase; color: #38bdf8;
}
.pub-kicker::before { content: ""; width: 20px; height: 1px; background: currentColor; }
.pub-hero h1 { margin: 16px 0 12px; font-size: clamp(36.4px, 4.42vw, 49.4px); line-height: 1.2; letter-spacing: -.035em; font-weight: 680; color: #f4f8ff; }
.pub-hero p { max-width: 820px; color: #a9b9d0; font-size: calc(13.5px * 1.3); line-height: 1.9; }
.pub-meta { display: flex; flex-wrap: wrap; gap: 7px 20px; margin-top: 20px; font-family: "JetBrains Mono", Consolas, monospace; font-size: calc(9.5px * 1.3); letter-spacing: .02em; color: #8ea1bb; }
.pub-meta span { display: inline-flex; align-items: center; gap: 7px; }
.pub-meta span::before { content: ""; width: 3px; height: 3px; border-radius: 50%; background: #38bdf8; }

/* TOC */
.pub-toc {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 26px;
  margin: 18px 0 8px; padding: 16px 20px;
  background: #fff; border: 1px solid #e4eaf3; border-top: 2px solid #0a1220; border-radius: 6px;
}
.pub-toc a {
  display: block; padding: 7px 0; font-size: calc(11.5px * 1.3); color: #38465c;
  border-bottom: 1px solid #eef2f8;
}
.pub-toc a:hover { color: #1f4fd8; }
.pub-toc a::before { content: ""; display: inline-block; width: 10px; height: 1px; margin-right: 7px; vertical-align: middle; background: #c3cfdf; }
.pub-toc a:hover::before { background: #1f4fd8; }

/* sections */
.pub-section {
  margin: 0; padding: 46px 0;
  background: transparent; border: 0; border-top: 1px solid #eef2f8;
  border-radius: 0; box-shadow: none;
}
.pub-section h2 { margin: 0 0 14px; font-size: calc(25px * 1.3); line-height: 1.35; letter-spacing: -.03em; font-weight: 680; color: #0a1220; }
.pub-section h3 { margin: 26px 0 8px; font-size: calc(14px * 1.3); font-weight: 650; color: #0a1220; }
.pub-section p, .pub-section li { color: #38465c; font-size: calc(12.5px * 1.3); line-height: 1.95; }
.pub-section ul { margin: 8px 0 0; padding-left: 20px; list-style: disc; }
.pub-section ol { margin: 8px 0 0; padding-left: 20px; list-style: decimal; }
.pub-section li { margin-top: 5px; }
.pub-section li::marker { color: #93a5bf; font-size: .9em; }
.pub-section b, .pub-note b { color: #0a1220; }
.pub-sub { margin: 0 0 14px; color: #5f7086; font-size: calc(12px * 1.3); }
.pub-summary { border-top: 0; padding-top: 34px; }
.pub-summary h2 { color: #0a1220; }

.pub-note {
  margin: 14px 0; padding: 13px 15px;
  background: #f7f9fd; border: 1px solid #e4eaf3; border-left: 2px solid #1f4fd8; border-radius: 4px;
  font-size: calc(12px * 1.3); line-height: 1.9; color: #38465c;
}
.pub-note b { color: #0a1220; }
.pub-warn { border-left-color: #a85a05; background: #fff8eb; border-color: #f2dfb8; }
.pub-formula {
  margin: 14px 0; padding: 13px 15px;
  background: #f7f9fd; border: 1px solid #e4eaf3; border-left: 2px solid #0e93b0; border-radius: 4px;
  font-family: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  font-size: calc(11px * 1.3); line-height: 2.05; color: #223350;
  overflow-x: auto;
}
.pub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 36px; }
.pub-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.pub-stat { padding: 12px 14px; border: 1px solid #e4eaf3; border-top: 2px solid #0a1220; border-radius: 4px; background: #fff; }
.pub-stat b { display: block; font-family: "JetBrains Mono", Consolas, monospace; font-size: calc(21px * 1.3); line-height: 1.25; font-weight: 600; letter-spacing: -.02em; color: #0a1220; }
.pub-stat span { font-size: calc(10.5px * 1.3); color: #5f7086; }

.pub-table { width: 100%; border-collapse: collapse; font-size: calc(11.5px * 1.3); }
.pub-table th, .pub-table td { padding: 9px 10px; border-bottom: 1px solid #eef2f8; text-align: left; vertical-align: top; }
.pub-table th { background: #f7f9fd; color: #5f7086; font-size: calc(9.5px * 1.3); font-weight: 600; letter-spacing: .04em; white-space: nowrap; border-bottom: 1px solid #e4eaf3; }
.pub-table td { color: #38465c; }
.pub-table td.num, .pub-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-family: "JetBrains Mono", Consolas, monospace; }
.pub-table td.center, .pub-table th.center { text-align: center; }
.pub-table tr.total td { background: #f7f9fd; font-weight: 600; border-top: 1px solid #e4eaf3; color: #0a1220; }
.pub-table-wrap { overflow: auto; border: 1px solid #e4eaf3; border-radius: 4px; background: #fff; }
.pub-badge { display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: calc(10px * 1.3); line-height: 1.7; font-weight: 600; }
.pub-green { color: #0f766e; background: #effaf6; }
.pub-red { color: #a8261b; background: #fdf2f0; }
.pub-gray { color: #38465c; background: #f1f5f9; }
.pub-blue { color: #1f4fd8; background: #eef3ff; }

.pub-faq { display: flex; flex-direction: column; gap: 8px; }
.pub-faq h3 { margin: 20px 0 4px; font-family: "JetBrains Mono", Consolas, monospace; font-size: calc(9.5px * 1.3); letter-spacing: .1em; color: #1f4fd8; }
.pub-faq details { border: 1px solid #e4eaf3; border-radius: 4px; background: #fff; padding: 11px 13px; }
.pub-faq details[open] { background: #fbfcff; border-color: #d7e2f2; }
.pub-faq summary { cursor: pointer; font-size: calc(12px * 1.3); font-weight: 600; color: #0a1220; list-style: none; }
.pub-faq summary::-webkit-details-marker { display: none; }
.pub-faq summary::before { content: "＋ "; color: #1f4fd8; font-weight: 600; }
.pub-faq details[open] summary::before { content: "－ "; }
.pub-faq details p { margin: 8px 0 0; font-size: calc(11.5px * 1.3); line-height: 1.9; color: #38465c; }
.pub-faq details b { color: #0a1220; }
.pub-footer { margin-top: 30px; padding-top: 18px; border-top: 1px solid #e4eaf3; color: #6f7f95; font-size: calc(10.5px * 1.3); line-height: 1.9; }
.pub-footer div + div { margin-top: 4px; }

@media (max-width: 900px) {
  .pub-top { height: 56px; padding: 0 16px; }
  .pub-tag { display: none; }
  .pub-wrap { width: calc(100% - 32px); }
  .pub-hero { margin-top: 18px; padding: 24px 20px 22px; }
  .pub-hero::after { left: 20px; right: 20px; }
  .pub-toc, .pub-grid, .pub-grid-3 { grid-template-columns: 1fr; }
  .pub-toc { gap: 0; padding: 12px 14px; }
  .pub-section { padding: 32px 0; }
  .pub-section h2 { font-size: calc(21px * 1.3); }
}
@media print {
  .pub-top { display: none; }
  body.public-doc { background: #fff; }
  .pub-wrap { width: 100%; margin: 0; }
  .pub-hero {
    background: #fff !important; color: #0a1220; border: 0; border-bottom: 2px solid #0a1220;
    border-radius: 0; padding: 0 0 14px; margin: 0 0 12px;
  }
  .pub-hero::before, .pub-hero::after { display: none; }
  .pub-hero h1 { color: #0a1220; font-size: calc(22px * 1.3); }
  .pub-hero p { color: #38465c; }
  .pub-kicker { color: #1f4fd8; }
  .pub-meta { color: #5f7086; }
  .pub-toc { break-inside: avoid; }
  .pub-section { break-inside: auto; }
  .pub-note, .pub-stat, .pub-table-wrap { break-inside: avoid; }
}
