/* 彩色色块示意卡 */
.features { padding-top: 32px; padding-bottom: 112px; }
.features__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.features__grid > * { min-width: 0; }
.card {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-card);
  transition: transform var(--ease-lift), box-shadow var(--ease-lift);
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); }
.card__stage { position: relative; height: 320px; overflow: hidden; border-radius: var(--r-block); }
.card__stage--leaf { background: var(--leaf); color: var(--text); }
.card__stage--pink { background: var(--pink); color: var(--text); }
.card__stage--butter { background: var(--butter); color: var(--text); }
.card__stage--mist { background: var(--mist); color: var(--text); }
.card__body { padding: 28px 30px 30px; }
.card__eyebrow { margin: 0; font-family: var(--font-mono); font-size: 12.5px; font-weight: var(--weight-bold); letter-spacing: .14em; color: var(--accent-dark); }
.card__title { margin: 10px 0 0; font-size: var(--h3-size); font-weight: var(--weight-display); line-height: 1.3; letter-spacing: -.015em; }
.card__text { margin: 12px 0 0; font-size: 15.5px; line-height: 1.8; color: var(--text-muted); }
.card__more { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; color: var(--accent-dark); font-size: 15px; font-weight: var(--weight-semibold); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.card__more:hover { color: var(--accent); }
.win { position: absolute; overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-win); background: var(--bg-panel); color: var(--text); box-shadow: var(--shadow-win); }
.win--back { top: 30px; left: 34px; width: 300px; }
.win--front { top: 78px; right: 36px; width: 340px; }
.win__bar { display: flex; align-items: center; gap: 6px; height: 34px; padding-inline: 14px; border-bottom: 1px solid var(--border); }
.win__dot { width: 8px; height: 8px; flex-shrink: 0; border-radius: var(--r-round); }
.win__dot--r { background: var(--error); color: var(--text); }
.win__dot--y { background: var(--warn); color: var(--text); }
.win__dot--g { background: var(--success); color: var(--text); }
.win__title { margin-left: 8px; font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--text-muted); }
.win__body { padding: 14px 16px 6px; }
.win__code { margin: 0; padding: 14px 16px 16px; border: 0; border-radius: 0; background: var(--bg-panel); color: var(--text-muted); font-family: var(--font-mono); font-size: var(--text-xs); line-height: 1.85; white-space: pre; }
.win__code b { color: var(--text); font-weight: var(--weight-semibold); }
.win__code i { color: var(--accent-dark); font-style: normal; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 4px; border-radius: var(--r-sm); background: var(--bg-panel-2); color: var(--text-muted); }
.seg span { padding-block: 7px; border-radius: var(--r-segment); text-align: center; font-size: 13px; font-weight: var(--weight-semibold); }
.seg .is-on { background: var(--bg-panel); color: var(--text); box-shadow: var(--shadow-seg); }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 11px; font-size: 13px; color: var(--text); }
.opt + .opt, .seg + .opt { border-top: 1px solid var(--border); }
.seg + .opt { margin-top: 12px; }
.sw { position: relative; flex-shrink: 0; width: 34px; height: 20px; border-radius: var(--r-pill); background: var(--border); color: var(--text); }
.sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: var(--r-round); background: var(--bg-panel); color: var(--text); box-shadow: var(--shadow-seg); }
.sw.is-on { background: var(--accent); color: var(--on-accent); }
.sw.is-on::after { left: 16px; }
.field { min-width: 0; padding: 3px 10px; border: 1px solid var(--border); border-radius: var(--r-xs); background: var(--bg); color: var(--text); font-family: var(--font-mono); font-size: var(--text-xs); overflow-wrap: anywhere; }

/* 标签页：面板仅由 hidden 控制，未运行脚本也可保留首个面板。 */
.tabs { min-width: 0; }
.tabs__list, [role="tablist"] {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-block);
  background: var(--bg-panel-2);
  color: var(--text);
}
[role="tab"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 20px;
  border: 1px solid var(--transparent);
  border-radius: var(--r-pill);
  background: var(--transparent);
  color: var(--text-muted);
  font-weight: var(--weight-semibold);
}
[role="tab"]:hover { background: var(--bg-panel); color: var(--text); }
[role="tab"][aria-selected="true"] { border-color: var(--border); background: var(--bg-panel); color: var(--accent-dark); box-shadow: var(--shadow-seg); }
[role="tabpanel"] { min-width: 0; }
[role="tabpanel"]:focus { outline-offset: 5px; }

/* 目录必须直接放在覆盖全部章节的父容器中。 */
.toc {
  position: sticky;
  top: 16px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-block);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-card);
}
.toc--flow { position: static; }
.toc a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border-radius: var(--r-pill); color: var(--text-muted); text-decoration: none; font-size: var(--text-sm); }
.toc a:hover, .toc a[aria-current="location"] { background: var(--bg-panel-2); color: var(--accent-dark); }

/* 折叠项使用浏览器原生 details，不依赖脚本。 */
.faq-item { min-width: 0; border: 1px solid var(--border); border-radius: var(--r-block); background: var(--bg-panel); color: var(--text); }
.faq-item + .faq-item { margin-top: 12px; }
.faq-item summary { position: relative; padding: 22px 58px 22px 24px; cursor: pointer; list-style: none; font-weight: var(--weight-semibold); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; position: absolute; right: 24px; top: 20px; color: var(--accent-dark); font-family: var(--font-mono); font-size: 22px; }
.faq-item[open] summary::after { content: "−"; }
.faq-item__answer { padding: 0 24px 24px; color: var(--text-muted); line-height: 1.8; }
.faq-item__answer > :last-child { margin-bottom: 0; }
.term-card, .client-card, .post-card {
  min-width: 0;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-panel);
  color: var(--text);
  box-shadow: var(--shadow-card);
}
.term-card__key { display: block; margin-bottom: 12px; font-family: var(--font-mono); font-size: var(--text-sm); color: var(--accent-dark); overflow-wrap: anywhere; }
.term-card h3, .client-card h3, .post-card h3 { font-size: 22px; margin-bottom: 12px; }
.term-card p, .client-card p, .post-card p { color: var(--text-muted); }
.client-card__head { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.client-card__head h3 { flex: 1; min-width: 160px; margin: 0; }
.client-card__meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin: 16px 0; color: var(--text-muted); font-size: var(--text-sm); }
.client-card__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.client-card--primary { border-color: var(--accent); box-shadow: var(--shadow-card), var(--ring); }
[data-version]:empty { display: none; }
.post-card { display: flex; flex-direction: column; align-items: flex-start; transition: transform var(--ease-lift), box-shadow var(--ease-lift); }
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); }
.post-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 18px; color: var(--text-muted); font-size: 13px; }
.post-card h3 a { color: var(--text); text-decoration: none; }
.post-card h3 a:hover { color: var(--accent-dark); }
.post-card .text-link { margin-top: auto; }
.badge, .tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--bg-panel-2);
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}
.badge--primary { border-color: var(--accent-dark); background: var(--accent-dark); color: var(--on-accent); }
.badge--recommended { border-color: var(--accent); background: var(--bg-panel); color: var(--accent-dark); }
.badge--archived { border-style: dashed; background: var(--bg-panel-2); color: var(--text-muted); }
.callout {
  margin: 28px 0;
  padding: 24px 28px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--r-win);
  background: var(--bg-panel-2);
  color: var(--text);
}
.callout__title { display: block; margin-bottom: 8px; font-weight: var(--weight-bold); }
.callout > :last-child { margin-bottom: 0; }
.callout--warning { border-left-color: var(--warn); }
.callout--error { border-left-color: var(--error); }
.table-scroll { max-width: 100%; min-width: 0; overflow-x: auto; overscroll-behavior-x: contain; border: 1px solid var(--border); border-radius: var(--r-win); }
.data-table { width: 100%; border-collapse: collapse; background: var(--bg-panel); color: var(--text); font-size: var(--text-sm); }
.data-table th, .data-table td, .prose table th, .prose table td, .article-body table th, .article-body table td {
  min-width: 7em;
  padding: 14px 18px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  overflow-wrap: normal;
  word-break: normal;
}
.data-table th, .prose table th, .article-body table th { background: var(--bg-panel-2); color: var(--text); font-weight: var(--weight-semibold); }
.data-table tr:last-child td { border-bottom: 0; }
.prose table, .article-body table {
  display: block;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-collapse: collapse;
  background: var(--bg-panel);
  color: var(--text);
}
.prose table code, .article-body table code, .data-table code { overflow-wrap: anywhere; word-break: normal; }

/* 仅博客文章页使用的固定引导。 */
.dl-fab {
  position: fixed;
  right: max(var(--gutter), env(safe-area-inset-right));
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: calc(100% - var(--gutter) * 2);
  min-height: 56px;
  padding: 12px 20px;
  border: 1px solid var(--accent-dark);
  border-radius: var(--r-pill);
  background: var(--accent-dark);
  color: var(--on-accent);
  box-shadow: var(--shadow-bar);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}
.dl-fab svg { width: 22px; height: 22px; }
.dl-fab:hover { background: var(--text); color: var(--on-accent); }
.has-dl-fab { padding-bottom: 100px; }
.article-download {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 48px;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r-card);
  background: var(--bg-panel-2);
  color: var(--text);
}
.article-download__body { flex: 1; min-width: min(240px, 100%); }
.article-download h2 { margin: 0 0 10px; font-size: var(--h3-size); }
.article-download p { margin: 0; color: var(--text-muted); }

/* 设计演示页 */
.swatches { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.swatch { min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-win); background: var(--bg-panel); color: var(--text); font-size: var(--text-sm); }
.swatch__paint { display: block; height: 72px; margin-bottom: 12px; border: 1px solid var(--border); border-radius: var(--r-xs); }
.swatch__paint--bg { background: var(--bg); color: var(--text); }
.swatch__paint--panel { background: var(--bg-panel); color: var(--text); }
.swatch__paint--panel2 { background: var(--bg-panel-2); color: var(--text); }
.swatch__paint--border { background: var(--border); color: var(--text); }
.swatch__paint--grid { background: var(--grid); color: var(--text); }
.swatch__paint--accent { background: var(--accent); color: var(--text); }
.swatch__paint--dark { background: var(--accent-dark); color: var(--on-accent); }
.swatch__paint--text { background: var(--text); color: var(--on-accent); }
.swatch__paint--muted { background: var(--text-muted); color: var(--on-accent); }
.swatch__paint--success { background: var(--success); color: var(--text); }
.swatch__paint--warn { background: var(--warn); color: var(--text); }
.swatch__paint--error { background: var(--error); color: var(--text); }
.swatch__paint--leaf { background: var(--leaf); color: var(--text); }
.swatch__paint--pink { background: var(--pink); color: var(--text); }
.swatch__paint--butter { background: var(--butter); color: var(--text); }
.swatch__paint--mist { background: var(--mist); color: var(--text); }
.preview-type-display { font-size: var(--h1-size); font-family: var(--font-display); font-weight: var(--weight-display); line-height: 1.2; }
.preview-type-section { font-size: var(--h2-size); font-family: var(--font-display); font-weight: var(--weight-display); }
.preview-type-card { font-size: var(--h3-size); font-family: var(--font-display); font-weight: var(--weight-display); }
.preview-divider { margin-top: 24px; }

@media (max-width: 980px) {
  .features__grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .win--back { display: none; }
  .win--front { left: 16px; right: 16px; width: auto; }
  .card__body { padding: 24px 16px; }
  .swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .term-card, .client-card, .post-card { padding: 24px; }
  .callout { padding: 20px; }
  .article-download { padding: 24px; }
  .toc { position: static; }
  .dl-fab { min-height: 48px; padding: 10px 16px; }
  [role="tab"] { padding-inline: 14px; }
}