/* 首页首屏：批注、窗口、平台入口、事实条 */
.hero {
  --wrap: var(--hero-width);
  min-height: calc(100vh - var(--nav-h) - 96px);
  min-height: calc(100svh - var(--nav-h) - 96px);
  display: grid;
  align-content: center;
  gap: 30px;
  padding-block: 30px 22px;
  overflow-x: clip;
}
.hero-grid { display: grid; grid-template-columns: 44fr 56fr; gap: 48px; align-items: center; }
.lead { max-width: 548px; }
.kicker {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px 10px;
  min-height: 32px;
  padding: 4px 15px 4px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-panel);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-card);
}
.kicker .dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-round);
  background: var(--success);
  color: var(--text);
}
.kicker .dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  background: var(--success);
  color: var(--text);
  opacity: 0;
  animation: dot-breathe 1.6s ease-out .2s 2;
}
.kicker .sep { color: var(--text-muted); }
@keyframes dot-breathe {
  from { transform: scale(.4); opacity: .45; }
  to { transform: scale(1.7); opacity: 0; }
}
.hero h1 { margin: 24px 0 0; }
.hero .ln { display: block; animation: title-rise .7s var(--ease-out) both; }
.hero .ln-2 { animation-delay: .14s; }
@keyframes title-rise {
  from { opacity: 0; transform: translateY(.42em); }
  to { opacity: 1; transform: none; }
}
.hl { position: relative; z-index: 0; white-space: nowrap; }
.hl::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: .46em -.1em .02em;
  border-radius: var(--radius-mark);
  background: var(--mark);
  color: var(--text);
  transform-origin: left center;
  animation: mark-sweep .45s var(--ease-out) .7s both;
}
.code .hl::before { inset: .28em -.18em .08em; animation-duration: .5s; }
.hl--1::before { animation-delay: 1s; }
.hl--2::before { animation-delay: 1.12s; }
.hl--3::before { animation-delay: 1.24s; }
.hl--4::before { animation-delay: 1.36s; }
@keyframes mark-sweep {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.desc { margin: 24px 0 0; max-width: 31em; font-size: 16.5px; line-height: 1.78; color: var(--text-muted); }
.desc strong { color: var(--text); font-weight: 700; }
.plat-caption { margin: 30px 0 10px; font: 12px/1.6 var(--font-mono); letter-spacing: .04em; color: var(--text-muted); }
.platforms { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.platforms a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 36px;
  padding-inline: 11px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-hair);
  transition: border-color .18s,color .18s;
}
.platforms a svg { width: 15px; height: 15px; flex: none; }
.platforms a:hover { border-color: var(--accent); color: var(--accent); }

.stage { position: relative; isolation: isolate; padding: 0 12px 12px 0; }
.workbook {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-window);
}
.workbook::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: -1;
  transform: translate(12px,12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-sheet);
}
.wb-chrome {
  height: 30px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-inline: 14px;
  border-bottom: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg-panel-2);
  color: var(--text-muted);
}
.wb-chrome i {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: var(--radius-round);
  border: 1px solid var(--border-strong);
  background: var(--bg-panel);
  color: var(--text);
}
.wb-path { margin-left: auto; font: 10.5px/1.5 var(--font-mono); }
.wb-head { display: flex; align-items: center; gap: 10px; padding: 20px 24px 2px; }
.wb-title { margin: 0; font: 900 21px/1.6 var(--font-display); letter-spacing: -.015em; }
.wb-title .dim { color: var(--text-muted); font-weight: 700; }
.wb-star { width: 18px; height: 18px; flex: none; fill: var(--star); }
.wb-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 18px 14px; padding: 16px 24px 0; }
.mod-label { margin: 0 0 7px; font-size: 12.5px; font-weight: 700; letter-spacing: .01em; color: var(--label); }
.mod-card {
  position: relative;
  min-height: 150px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-hair);
}
.code {
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg-panel);
  color: var(--text-muted);
  font: 10.5px/1.85 var(--font-mono);
  white-space: pre;
  overflow-x: auto;
}
.code .k { color: var(--text); font-weight: 600; }
.field-label { display: block; margin-bottom: 5px; font-size: 11px; font-weight: 600; color: var(--text-muted); }
.url-input {
  display: flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: 10.5px/1.45 var(--font-mono);
}
.url-input code { min-width: 0; }
.url-input .caret {
  display: inline-block;
  width: 1px;
  height: 14px;
  margin-left: 1px;
  vertical-align: text-bottom;
  background: var(--text);
  color: var(--on-accent);
}
.sub-row { display: flex; align-items: stretch; gap: 8px; margin-top: 8px; }
.name-input {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 6px;
  min-height: 28px;
  padding-inline: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: 10.5px/1.4 var(--font-mono);
}
.name-input span { font-family: var(--font-body); color: var(--text-muted); }
.mini-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding-inline: 15px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 12px;
  font-weight: 700;
  box-shadow: var(--shadow-btn);
}
.sub-hint, .unit-note { margin: 9px 0 0; font-size: 10.5px; color: var(--text-muted); }
.unit-note { margin-top: 6px; }
.pointer {
  position: absolute;
  inset: 80px 26px auto auto;
  width: 16px;
  height: 20px;
  transform-origin: 2px 2px;
  filter: var(--shadow-pointer);
  pointer-events: none;
  animation: pointer-shuttle 8s ease-in-out infinite;
}
.pointer path { fill: var(--bg-panel); stroke: var(--text); stroke-width: 1.3; stroke-linejoin: round; }
@keyframes pointer-shuttle {
  0%,12%,90%,100% { transform: translate(-92px,-46px); }
  42%,47%,53%,60% { transform: translate(0,0) scale(1); }
  50% { transform: translate(0,0) scale(.86); }
}
.files { margin: 0; padding: 0; list-style: none; }
.file { display: grid; grid-template-columns: 16px minmax(0,1fr) 12px; align-items: center; gap: 9px; padding: 7px 2px; }
.file + .file { border-top: 1px solid var(--border); }
.file svg { width: 16px; height: 16px; color: var(--text-muted); }
.fname { display: block; font: 600 11.5px/1.35 var(--font-mono); }
.fmeta { display: block; font-size: 10.5px; line-height: 1.4; color: var(--text-muted); }
.radio { width: 12px; height: 12px; border-radius: var(--radius-round); border: 1.5px solid var(--border-strong); }
.file.is-current .radio {
  border-color: var(--text);
  background: radial-gradient(circle,var(--text) 0 2.5px,var(--clear) 3px);
  color: var(--text);
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 2px 0 9px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
}
.switch {
  position: relative;
  flex: none;
  width: 30px;
  height: 18px;
  border-radius: var(--radius-pill);
  background: var(--success);
  color: var(--text);
}
.switch::after {
  content: "";
  position: absolute;
  inset: 2px 2px auto auto;
  width: 14px;
  height: 14px;
  border-radius: var(--radius-round);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-hair);
}
.wb-related { padding: 22px 24px 24px; }
.rel-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.rel {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow-hair);
  transition: border-color .18s,box-shadow .18s;
}
.rel:hover { color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-card); }
.rel-icon {
  flex: none;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--bg-panel-2);
  color: var(--text);
}
.rel-icon svg { width: 17px; height: 17px; }
.rel-name { display: block; font-size: 13px; font-weight: 700; line-height: 1.3; }
.rel-path {
  display: block;
  font: 10.5px/1.5 var(--font-mono);
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}
.facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font: 12.5px/1.6 var(--font-mono);
  color: var(--text-muted);
}
.fact { display: inline-flex; align-items: center; gap: 8px; padding-inline: 22px; }
.fact:first-child { padding-left: 0; }
.fact + .fact { border-left: 1px solid var(--border); }
.fact b { color: var(--text); font-weight: 600; }
.fact::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pip);
  background: var(--border-strong);
  color: var(--text);
}

/* 信笺与页签 */
.letter { --wrap: var(--hero-width); padding-block: 30px 96px; }
.letter-grid { display: grid; grid-template-columns: 4fr 7fr; gap: 64px; align-items: start; }
.letter-side { position: sticky; top: 24px; }
.letter h2 { margin: 0; font-size: 32px; }
.tab-rail, .feat-tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab-rail { border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.feat-tabs { flex-direction: column; gap: 0; margin-top: 26px; }
:is(.tab-rail,.feat-tabs)[role="tablist"] [role="tab"] {
  position: relative;
  min-height: 44px;
  border: 0;
  background: var(--clear);
  color: var(--text-muted);
  font: 600 15px/1.4 var(--font-body);
  cursor: pointer;
}
.tab-rail [role="tab"] { padding: 8px 12px; }
.feat-tabs [role="tab"] { padding: 9px 0 9px 16px; text-align: left; }
:is(.tab-rail,.feat-tabs) [role="tab"]:is(:hover,[aria-selected="true"]) { color: var(--text); }
:is(.tab-rail,.feat-tabs) [aria-selected="true"]::before {
  content: "";
  position: absolute;
  border-radius: var(--radius-mark);
  background: var(--accent);
  color: var(--on-accent);
}
.tab-rail [aria-selected="true"]::before { inset: auto 8px -1px; height: 3px; }
.feat-tabs [aria-selected="true"]::before { inset: 8px auto 8px 0; width: 3px; }
[role="tabpanel"] { min-width: 0; }
.feat-panel p { margin: 0; max-width: 40em; font-size: 17px; line-height: 1.9; }
.feat-panel a { font-weight: 600; }
.yaml-card {
  margin-top: 26px;
  max-width: 560px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-card);
}
.yc-head { padding: 9px 14px; border-bottom: 1px solid var(--border); font: 11.5px/1.6 var(--font-mono); color: var(--text-muted); }
.yaml-card .code { padding: 12px 14px; font-size: 12.5px; line-height: 1.8; }

/* 阅读与下载组件 */
.toc-tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin-block: 20px 28px;
  padding: 8px 14px;
  border-block: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}
.toc-tabs a { display: inline-flex; align-items: center; min-height: 44px; }
.toc-tabs.is-sticky { position: sticky; z-index: 5; top: 0; }
.toc-tabs.is-static { position: static; }
.faq-item {
  margin-block: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-hair);
}
.faq-item summary {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  list-style: none;
  padding: 12px 16px;
  font-weight: 700;
  cursor: pointer;
}
.faq-item summary::after { content: "+"; color: var(--text-muted); font: 1rem var(--font-mono); }
.faq-item[open] summary::after { content: "−"; }
.faq-answer { padding: 12px 16px 16px; border-top: 1px solid var(--border); }
.faq-answer > :last-child { margin-bottom: 0; }
.term-card { border-top: 3px solid var(--border-strong); }
.term-card h3 code { font-size: .9em; }
.post-card { display: grid; align-content: start; gap: 10px; }
.post-card :is(h3,p) { margin: 0; }
.post-card time { color: var(--text-muted); font: .8125rem/1.5 var(--font-mono); }
.client-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 12px; }
.client-head > div { min-width: 0; }
.client-logo { width: 52px; height: 52px; flex-shrink: 0; }
.client-actions, .badge-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.badge, .tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg-panel-2);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.badge::before { content: ""; flex: none; width: 6px; height: 6px; border-radius: var(--radius-round); background: var(--border-strong); color: var(--text); }
.badge-first::before { background: var(--success); color: var(--text); }
.badge-recommended::before { background: var(--warn); color: var(--text); }
.badge-archived::before { background: var(--error); color: var(--text); }
[data-rev]:empty { display: none; }
.callout {
  margin: 1.25em 0;
  padding: 14px 18px;
  border-inline-start: 3px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-panel-2);
  color: var(--text);
}
.callout > :last-child { margin-bottom: 0; }
.article-download { margin-block: 32px; }
.dl-fab {
  position: fixed;
  z-index: 15;
  inset: auto max(16px,env(safe-area-inset-right)) max(16px,env(safe-area-inset-bottom)) auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  max-width: calc(100% - 40px);
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--accent);
  font-weight: 700;
  box-shadow: var(--shadow-sheet);
}
.dl-fab svg { width: 18px; height: 18px; }
.dl-fab:hover { color: var(--accent-dark); border-color: var(--accent); }
.has-dl-fab .site-foot { padding-bottom: calc(82px + env(safe-area-inset-bottom)); }

.table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.data-table, .prose table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-panel);
  color: var(--text);
}
.prose table:not(.table-wrap table) {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  min-width: 0;
  overscroll-behavior-inline: contain;
}
:is(.data-table,.prose table) :is(th,td) {
  min-width: 7em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: normal;
  word-break: normal;
}
:is(.data-table,.prose table) :is(th,td) code { overflow-wrap: anywhere; }
:is(.data-table,.prose table) th { background: var(--bg-panel-2); color: var(--text); }
:is(.data-table,.prose table) tbody tr:last-child td { border-bottom: 0; }

/* 设计预览专用 */
.preview-section { padding-block: 38px; border-top: 1px solid var(--border); }
.preview-section:last-child { padding-bottom: var(--section-space); }
.preview-buttons { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(132px,100%),1fr));
  gap: 12px;
  padding: 0;
  list-style: none;
}
.swatch-grid li {
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
}
.swatch-grid li::before {
  content: "";
  display: block;
  height: 42px;
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--sample);
  color: var(--text);
}
.sample-bg { --sample: var(--bg); }
.sample-panel { --sample: var(--bg-panel); }
.sample-panel-2 { --sample: var(--bg-panel-2); }
.sample-border { --sample: var(--border); }
.sample-border-strong { --sample: var(--border-strong); }
.sample-accent { --sample: var(--accent); }
.sample-accent-dark { --sample: var(--accent-dark); }
.sample-text { --sample: var(--text); }
.sample-muted { --sample: var(--text-muted); }
.sample-faint { --sample: var(--text-faint); }
.sample-star { --sample: var(--star); }
.sample-success { --sample: var(--success); }
.sample-warn { --sample: var(--warn); }
.sample-error { --sample: var(--error); }
.sample-label { --sample: var(--label); }
.sample-mark { --sample: var(--mark); }
.sample-on-accent { --sample: var(--on-accent); }
.sample-clear { --sample: var(--clear); }
.sample-veil { --sample: var(--veil); }
.svg-bank { position: absolute; inline-size: 0; block-size: 0; pointer-events: none; }
.preview-h1 { font: 900 clamp(34px,3.4vw,48px)/1.15 var(--font-display); letter-spacing: -.02em; }

@media (max-width: 1180px) {
  .hero { min-height: 0; }
  .hero-grid { grid-template-columns: minmax(0,1fr); gap: 52px; }
  .lead { max-width: 640px; }
}
@media (max-width: 768px) {
  .hero h1, .preview-h1 { font-size: 28px; }
  .wb-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .rel-grid, .letter-grid { grid-template-columns: minmax(0,1fr); }
  .letter-grid { gap: 28px; }
  .letter-side, .toc-tabs.is-sticky { position: static; }
  .letter h2 { font-size: 26px; }
}
@media (max-width: 520px) {
  .wb-grid { grid-template-columns: minmax(0,1fr); }
  .wb-grid, .wb-head, .wb-related { padding-inline: 14px; }
  .fact { padding: 4px 14px 4px 0; }
  .fact + .fact { border-left: 0; }
  .platforms { justify-content: center; }
}