/* ==========================================================================
   开源拾遗 · 项目详情页 / 404 页面
   在 style.css（设计系统）与 projects.css（分类色 / 卡片）之后加载。
   仅使用 style.css 已定义的变量，保持纸张底色、衬线标题与圆角卡片的视觉。
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. 页面骨架
   -------------------------------------------------------------------------- */

.detail-main {
  padding-top: clamp(18px, 2.6vw, 30px);
}

.page-detail .site-header,
.page-404 .site-header {
  /* 详情页内容较深，吸顶头部保持和首页一致即可 */
  z-index: 90;
}

/* 面包屑 */
.breadcrumb {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--ink-3);
}
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.breadcrumb li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.breadcrumb li + li::before {
  content: "/";
  color: var(--line-strong);
  font-family: var(--mono);
}
.breadcrumb a {
  color: var(--ink-3);
  border-bottom: 1px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.breadcrumb a:hover {
  color: var(--rust);
  border-color: var(--rust);
}
.breadcrumb [aria-current="page"] {
  max-width: 22em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-2);
}

/* --------------------------------------------------------------------------
   2. 项目头部（Hero）
   -------------------------------------------------------------------------- */

.detail-hero {
  position: relative;
  margin-top: clamp(16px, 2.4vw, 26px);
  padding: clamp(26px, 4.2vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--tint-a, var(--paper-3)) 72%, var(--paper-2)),
      color-mix(in srgb, var(--tint-b, var(--paper-3)) 46%, var(--paper-2))
    );
  overflow: hidden;
}
.detail-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .16) 0 1px, transparent 1px 14px);
  opacity: .55;
  pointer-events: none;
}
.detail-hero::after {
  content: "";
  position: absolute;
  top: -140px;
  right: -90px;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .5), transparent 64%);
  pointer-events: none;
}
[data-theme="dark"] .detail-hero {
  background:
    linear-gradient(
      135deg,
      color-mix(in srgb, var(--tint-a, var(--paper-3)) 26%, var(--paper-2)),
      color-mix(in srgb, var(--tint-b, var(--paper-3)) 16%, var(--paper-2))
    );
}
[data-theme="dark"] .detail-hero::before { opacity: .22; }
[data-theme="dark"] .detail-hero::after { opacity: .18; }

.detail-hero-inner {
  position: relative;
  z-index: 1;
  min-width: 0;
}
.detail-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .03em;
  color: var(--ink-3);
}
.detail-kicker .project-cat {
  font-family: var(--sans);
  font-weight: 600;
}
.detail-kicker .detail-id {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper-2) 55%, transparent);
  font-size: 10.5px;
}
.detail-featured {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--rust);
  color: #fff8ee;
  font-family: var(--sans);
  font-size: 10.5px;
  letter-spacing: .08em;
}

.detail-title {
  margin-top: 14px;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 58px);
  font-weight: 700;
  line-height: 1.16;
  letter-spacing: .01em;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.detail-sub {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.detail-lead {
  margin-top: 18px;
  max-width: 44em;
  font-family: var(--serif);
  font-size: clamp(16px, 1.7vw, 19px);
  line-height: 2;
  color: var(--ink-2);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  margin: 24px 0 0;
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
  font-size: 12.5px;
  letter-spacing: .02em;
  color: var(--ink-2);
}
.detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.detail-meta .meta-label { color: var(--ink-3); }
.detail-meta .icon-star {
  width: 14px;
  height: 14px;
  color: var(--ochre);
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 26px;
}
.detail-dates {
  margin-top: 22px;
  font-size: 11.5px;
  letter-spacing: .06em;
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   3. 正文布局 + 侧栏
   -------------------------------------------------------------------------- */

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: clamp(24px, 3.4vw, 44px);
  align-items: start;
  margin-top: clamp(26px, 3.6vw, 42px);
  padding-bottom: clamp(42px, 5vw, 66px);
}
.detail-body { min-width: 0; }
.detail-aside {
  position: sticky;
  top: 104px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.detail-toc,
.aside-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--paper-2) 74%, transparent);
  padding: 18px 20px;
}
.toc-title,
.aside-title {
  margin-bottom: 12px;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.detail-toc ol {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: toc-item;
}
.detail-toc li { counter-increment: toc-item; min-width: 0; }
.detail-toc a {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-2);
  transition: color .2s var(--ease);
}
.detail-toc a::before {
  content: counter(toc-item, decimal-leading-zero);
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-3);
}
.detail-toc a:hover { color: var(--rust); }

.aside-links {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.aside-links a {
  font-size: 13px;
  color: var(--ink-2);
  transition: color .2s var(--ease);
}
.aside-links a:hover { color: var(--rust); }
.aside-note {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.75;
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   4. 内容分区卡片
   -------------------------------------------------------------------------- */

.detail-sec {
  margin-bottom: clamp(16px, 2.2vw, 22px);
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
  min-width: 0;
}
.detail-sec:last-child { margin-bottom: 0; }

.detail-sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.detail-sec-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .14em;
  color: var(--rust);
}
.detail-sec-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(20px, 2.2vw, 25px);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: .03em;
}
.detail-sec-note {
  margin-left: auto;
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--ink-3);
  text-align: right;
}
.detail-sec-body { min-width: 0; }

/* 字段网格 */
.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 28px;
  margin: 0;
}
.fact {
  min-width: 0;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}
.fact--wide { grid-column: 1 / -1; }
.fact dt {
  margin-bottom: 6px;
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.fact dd {
  margin: 0;
  font-size: 14px;
  line-height: 1.8;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.fact-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.9;
  color: var(--ink-2);
}
.fact-sub {
  font-size: 12px;
  font-weight: 400;
  color: var(--ink-3);
}

/* 缺失字段 / 待核实 */
.is-missing {
  display: inline-block;
  padding: 1px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 5px;
  font-size: .92em;
  color: var(--ink-3);
  line-height: 1.6;
  white-space: nowrap;
}
.is-pending {
  border-color: color-mix(in srgb, var(--ochre) 55%, transparent);
  color: color-mix(in srgb, var(--ochre) 74%, var(--ink));
}

/* 标签 / 语言 / 许可证 */
.pill-row {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  vertical-align: middle;
}
.pill {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper-3) 38%, transparent);
  font-size: 11.5px;
  color: var(--ink-2);
}
.pill--type {
  border-color: color-mix(in srgb, var(--rust) 30%, transparent);
  background: var(--rust-soft);
  color: var(--rust-ink);
}
.inline-lang {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 12px;
  white-space: nowrap;
}
.lang-dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lang, var(--ink-3));
}
.license-pill {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid color-mix(in srgb, var(--teal) 34%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--teal) 10%, transparent);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .02em;
  color: var(--teal);
  vertical-align: middle;
}
.inline-code {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: color-mix(in srgb, var(--paper-3) 56%, transparent);
  font-family: var(--mono);
  font-size: .9em;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.inline-link {
  border-bottom: 1px solid var(--line-strong);
  overflow-wrap: anywhere;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.inline-link:hover {
  color: var(--rust);
  border-color: var(--rust);
}

/* --------------------------------------------------------------------------
   5. 获取方式
   -------------------------------------------------------------------------- */

.sec-intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 18px;
  font-size: 13px;
  color: var(--ink-3);
}
.access-card {
  margin-top: 14px;
  padding: clamp(16px, 2.4vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--paper-3) 32%, transparent);
  min-width: 0;
}
.sec-intro + .access-card { margin-top: 0; }
.access-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.access-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .03em;
}
.access-label .icon {
  width: 16px;
  height: 16px;
  color: var(--rust);
}
.access-badge {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--ink-3);
}
.access-link {
  margin: 0 0 10px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.8;
  color: var(--ink-2);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.access-link a {
  color: var(--rust-ink);
  border-bottom: 1px solid color-mix(in srgb, var(--rust) 30%, transparent);
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.access-link a:hover { color: var(--rust); border-color: var(--rust); }
.access-link .icon {
  display: inline-block;
  width: 13px;
  height: 13px;
  vertical-align: -2px;
}
.access-link--mono a { font-size: 12px; }
.access-note {
  margin: 12px 0 0;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--ink-3);
}
.access-note--warn {
  padding-left: 12px;
  border-left: 2px solid var(--ochre);
  color: var(--ink-2);
}
.access-missing {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.85;
  color: var(--ink-2);
}
.access-btn { margin-top: 14px; }

/* 代码片段 */
.code-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}
.code-path-label {
  padding: 1px 7px;
  border-radius: 4px;
  background: var(--rust-soft);
  color: var(--rust-ink);
  font-family: var(--sans);
  font-size: 10px;
  letter-spacing: .1em;
}
.code-path code {
  font-family: var(--mono);
  color: var(--ink-2);
  overflow-wrap: anywhere;
}
.code-figure { margin: 0; min-width: 0; }
.code-cap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: #2b2219;
  color: #d8cbb8;
  font-family: var(--mono);
  font-size: 11.5px;
}
.code-cap-label {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.code-scroll {
  max-width: 100%;
  overflow-x: auto;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: #221b14;
  -webkit-overflow-scrolling: touch;
}
.code-scroll:focus-visible {
  outline: 2px solid var(--rust);
  outline-offset: 2px;
}
.code-block {
  width: max-content;
  min-width: 100%;
  margin: 0;
  padding: 16px 0;
  background: transparent;
  color: #f3ead9;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  tab-size: 4;
}
.code-block code {
  display: block;
  counter-reset: code-line;
}
.code-line {
  display: inline;
  white-space: pre;
  counter-increment: code-line;
}
.code-line::before {
  content: counter(code-line);
  display: inline-block;
  width: 3.4em;
  padding-right: 1.2em;
  text-align: right;
  color: #8d8172;
  -webkit-user-select: none;
  user-select: none;
}

/* 复制按钮：默认隐藏（无 JS 时不可用），加 .js 后显示 */
.copy-btn {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper-2) 70%, transparent);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--ink-2);
  white-space: nowrap;
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
}
html.js .copy-btn { display: inline-flex; }
.copy-btn:hover {
  color: var(--rust);
  border-color: var(--rust);
}
.copy-btn .icon { width: 13px; height: 13px; }
.copy-btn.is-done {
  color: var(--sage);
  border-color: color-mix(in srgb, var(--sage) 60%, transparent);
}
.code-cap .copy-btn {
  border-color: rgba(255, 255, 255, .24);
  background: rgba(255, 255, 255, .08);
  color: #eadfcd;
}
.code-cap .copy-btn:hover {
  background: rgba(255, 255, 255, .18);
  border-color: rgba(255, 255, 255, .46);
  color: #fff8ee;
}
.code-cap .copy-btn.is-done {
  color: #cfe3b8;
  border-color: rgba(170, 205, 130, .55);
}

/* --------------------------------------------------------------------------
   6. 安装与运行
   -------------------------------------------------------------------------- */

.install-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  gap: clamp(16px, 2.4vw, 28px);
  min-width: 0;
}
.install-item { min-width: 0; }
.cmd-label {
  font-size: 10.5px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.cmd-label--block { margin-bottom: 10px; }
.req-list {
  margin: 0;
  padding-left: 1.15em;
  font-size: 13.5px;
  line-height: 1.9;
  color: var(--ink-2);
}
.req-list li { margin-bottom: 4px; overflow-wrap: anywhere; }
.cmd-item + .cmd-item { margin-top: 14px; }
.cmd-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.cmd-block {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--paper-3) 52%, transparent);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
[data-theme="dark"] .cmd-block {
  background: #191510;
  border-color: rgba(241, 233, 219, .16);
}

/* --------------------------------------------------------------------------
   7. 运行验证状态
   -------------------------------------------------------------------------- */

.status-panel {
  margin-bottom: 20px;
  padding: clamp(16px, 2.4vw, 22px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--paper-3) 30%, transparent);
  min-width: 0;
}
.status-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
}
.status-badge {
  --state: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid color-mix(in srgb, var(--state) 42%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--state) 12%, transparent);
  color: var(--state);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: .03em;
  white-space: nowrap;
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
/* 与 projects.css 中首页卡片徽章复用同一批 .status-* 类名，
   这里加 .status-badge 前缀提高优先级，避免颜色被首页卡片规则覆盖。 */
.status-badge.status-not-tested {
  --state: var(--ink-3);
  color: var(--state);
  border-color: color-mix(in srgb, var(--state) 42%, transparent);
}
.status-badge.status-install-tested {
  --state: var(--ochre);
  color: var(--state);
  border-color: color-mix(in srgb, var(--state) 42%, transparent);
}
.status-badge.status-smoke-tested {
  --state: var(--teal);
  color: var(--state);
  border-color: color-mix(in srgb, var(--state) 42%, transparent);
}
.status-badge.status-experiment-verified {
  --state: var(--sage);
  color: var(--state);
  border-color: color-mix(in srgb, var(--state) 42%, transparent);
}
.status-desc {
  flex: 1 1 240px;
  min-width: 0;
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-2);
}
.status-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.status-step {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding-top: 12px;
  border-top: 2px solid var(--line);
}
.status-step.is-reached {
  border-top-color: color-mix(in srgb, var(--sage) 62%, var(--line));
}
.status-step.is-current { border-top-color: var(--rust); }
.status-step-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper-2);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
}
.status-step.is-reached .status-step-mark {
  border-color: color-mix(in srgb, var(--sage) 55%, transparent);
  background: color-mix(in srgb, var(--sage) 12%, var(--paper-2));
  color: var(--sage);
}
.status-step.is-current .status-step-mark {
  border-color: var(--rust);
  background: var(--rust);
  color: #fff8ee;
}
.status-step-label {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-3);
}
.status-step.is-reached .status-step-label { color: var(--ink-2); }
.status-step.is-current .status-step-label {
  font-weight: 600;
  color: var(--ink);
}
.status-rule {
  margin: 16px 0 0;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--ink-3);
}

/* --------------------------------------------------------------------------
   8. 许可证与引用
   -------------------------------------------------------------------------- */

.detail-subhead {
  margin: 0;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .04em;
}
.citation-box {
  margin-top: 20px;
  padding: clamp(14px, 2vw, 18px);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--paper-3) 26%, transparent);
  min-width: 0;
}
.citation-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.citation-text {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.9;
  color: var(--ink-2);
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   9. 相关项目
   -------------------------------------------------------------------------- */

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.related-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  height: 100%;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--tint-a, var(--paper-3)) 42%, var(--paper-2)),
    var(--paper-2)
  );
  overflow: hidden;
  transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.related-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.related-initial {
  position: absolute;
  right: 6px;
  bottom: -18px;
  font-family: var(--serif);
  font-size: 66px;
  font-weight: 700;
  line-height: 1;
  color: var(--tint-ink, var(--ink-3));
  opacity: .12;
  -webkit-user-select: none;
  user-select: none;
}
.related-cat {
  position: relative;
  z-index: 1;
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--tint-ink, var(--ink-3));
}
.related-name {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.related-desc {
  position: relative;
  z-index: 1;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.75;
  color: var(--ink-2);
}
.related-more {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: auto;
  padding-top: 10px;
  font-size: 11px;
  color: var(--ink-3);
}
.related-more .icon {
  width: 12px;
  height: 12px;
  transition: transform .3s var(--ease);
}
.related-card:hover .related-more { color: var(--rust); }
.related-card:hover .related-more .icon { transform: translateX(3px); }
.related-all { margin-top: 18px; }

/* --------------------------------------------------------------------------
   10. 404 页面
   -------------------------------------------------------------------------- */

.notfound-main {
  padding-block: clamp(36px, 6vw, 80px) clamp(48px, 7vw, 96px);
}
.notfound-wrap {
  display: flex;
  justify-content: center;
}
.notfound-card {
  position: relative;
  width: min(740px, 100%);
  padding: clamp(28px, 5vw, 56px) clamp(20px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--paper-2) 84%, transparent);
  box-shadow: var(--shadow-sm);
  text-align: center;
  overflow: hidden;
}
.notfound-card::before {
  content: "404";
  position: absolute;
  top: -34px;
  right: -8px;
  font-family: var(--serif);
  font-size: clamp(120px, 22vw, 190px);
  font-weight: 700;
  line-height: 1;
  color: var(--rust);
  opacity: .06;
  pointer-events: none;
}
.notfound-card > * {
  position: relative;
  z-index: 1;
}
.notfound-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--rust);
}
.notfound-title {
  margin-top: 18px;
  font-family: var(--serif);
  font-size: clamp(34px, 6vw, 58px);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: .02em;
}
.notfound-title .hl,
.notfound-title .period { color: var(--rust); }
.notfound-lead {
  margin: 20px auto 0;
  max-width: 34em;
  font-size: 14px;
  line-height: 1.95;
  color: var(--ink-2);
}
.notfound-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}
.notfound-picks {
  margin-top: 38px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.notfound-sub {
  margin-bottom: 14px;
  font-size: 11px;
  letter-spacing: .16em;
  color: var(--ink-3);
}
.notfound-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.notfound-project {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--paper-3) 28%, transparent);
  transition: border-color .25s var(--ease), background-color .25s var(--ease);
}
.notfound-project:hover {
  border-color: var(--line-strong);
  background: color-mix(in srgb, var(--paper-3) 46%, transparent);
}
.notfound-project .icon {
  flex: none;
  width: 13px;
  height: 13px;
  margin-left: auto;
  color: var(--ink-3);
}
.notfound-initial {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--tint-ink, var(--rust));
  opacity: .55;
}
.notfound-project-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.notfound-project-name {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notfound-project-cat {
  overflow: hidden;
  font-size: 10.5px;
  color: var(--ink-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notfound-note {
  margin-top: 24px;
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--ink-3);
}
.notfound-note a {
  color: var(--rust-ink);
  border-bottom: 1px solid color-mix(in srgb, var(--rust) 30%, transparent);
}

/* --------------------------------------------------------------------------
   11. 无 JS 兜底：正文始终可读，复制按钮隐藏
   -------------------------------------------------------------------------- */

html:not(.js) .theme-toggle,
html:not(.js) .menu-btn {
  display: none;
}
html:not(.js) .back-to-top {
  display: none;
}

@media (max-width: 860px) {
  html:not(.js) .header-inner {
    flex-wrap: wrap;
    height: auto;
    padding-block: 14px;
    gap: 10px;
  }
  html:not(.js) .nav {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    margin-left: 0;
    gap: 6px 16px;
  }
  html:not(.js) .nav a { font-size: 13px; }
}

/* --------------------------------------------------------------------------
   12. 响应式：平板 / 手机
   -------------------------------------------------------------------------- */

@media (max-width: 1020px) {
  .detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .detail-aside {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }
}

@media (max-width: 860px) {
  .detail-hero {
    border-radius: var(--radius);
    padding: 26px 24px 30px;
  }
  .detail-sec-note {
    margin-left: 0;
    width: 100%;
    text-align: left;
  }
  .install-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .status-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .breadcrumb { font-size: 11px; }
  .breadcrumb [aria-current="page"] { max-width: 14em; }

  .detail-hero {
    margin-top: 14px;
    padding: 22px 18px 26px;
    border-radius: var(--radius-sm);
  }
  .detail-title { font-size: clamp(30px, 9vw, 42px); }
  .detail-lead {
    margin-top: 14px;
    font-size: 15.5px;
    line-height: 1.9;
  }
  .detail-meta {
    gap: 8px 14px;
    margin-top: 20px;
    padding-top: 14px;
    font-size: 12px;
  }
  .detail-actions {
    gap: 10px;
    margin-top: 22px;
  }
  .detail-actions .btn { flex: 1 1 auto; }
  .detail-actions .link-arrow { flex: 1 1 100%; }
  .detail-dates { margin-top: 18px; }

  .detail-sec {
    padding: 18px 16px;
    border-radius: var(--radius-sm);
  }
  .detail-sec-title { font-size: 20px; }
  .fact-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .fact { padding-bottom: 12px; }
  .install-item + .install-item { margin-top: 4px; }
  .status-panel { padding: 14px; }
  .status-badge { padding: 5px 12px; font-size: 12px; }
  .status-track { gap: 8px; }
  .status-step-label { font-size: 11px; }
  .code-cap { padding: 8px 12px; }
  .code-block { font-size: 12px; }
  .related-grid { grid-template-columns: minmax(0, 1fr); }

  .notfound-title { margin-top: 14px; }
  .notfound-actions .btn { width: 100%; }
  .notfound-picks { margin-top: 30px; }
  .notfound-list { grid-template-columns: minmax(0, 1fr); }
  .notfound-note { margin-top: 20px; }
}

@media (max-width: 380px) {
  .detail-hero { padding-inline: 14px; }
  .detail-meta { gap: 6px 10px; }
  .detail-aside { grid-template-columns: minmax(0, 1fr); }
  .pill { font-size: 11px; }
}

/* --------------------------------------------------------------------------
   13. 打印 / 减少动效
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .related-card,
  .related-card:hover,
  .related-more .icon,
  .copy-btn {
    transition: none;
  }
  .related-card:hover { transform: none; }
  .related-card:hover .related-more .icon { transform: none; }
}

@media print {
  .site-header,
  .site-footer,
  .back-to-top,
  .detail-aside,
  .detail-actions,
  .copy-btn,
  .breadcrumb {
    display: none !important;
  }
  .detail-main,
  .notfound-main { padding: 0; }
  .detail-grid { display: block; padding: 0; }
  .detail-hero,
  .detail-sec,
  .notfound-card {
    border: 1px solid #ddd;
    background: #fff;
    box-shadow: none;
  }
  .detail-hero::before,
  .detail-hero::after,
  .notfound-card::before { display: none; }
  .code-scroll { overflow: visible; }
  .code-cap,
  .code-block { background: #f4f1ea; color: #222; }
  .code-line::before { color: #777; }
  .cmd-block { background: #f7f4ee; }
}
