/* 工位 6 视觉层「工程图纸」（tizixiazai.org，M3 11-16）。只改样式，不改文字和链接。
   主色 海松绿 #2c6e4f；辅助 赭橙 #c2410c · 钴蓝 #1d4ed8 · 芥黄 #b8860b · 樱红 #be123c。浅色底深色字，不做暗色。 */

/* ---------- 1 色板：覆盖原站变量；深色主题同样落回浅色（站群不做暗色），主题切换按钮隐藏 ---------- */
:root, [data-theme=dark], [data-theme=light] {
  color-scheme: light;
  --paper: #f6f8f5; --panel: #ffffff; --groove: #edf2ee; --grid-minor: #e9efea; --grid-major: #dce6df;
  --ink: #17231d; --ink-2: #3c4a43; --ink-3: #56645c; --line: #d6e0d9; --line-strong: #b5c5ba; --rule: #1d5139;
  --control: #6b7a71; --hatch: #e3ebe5;
  --accent: #2c6e4f; --accent-hover: #1d5139; --accent-tint: #e3f0e8; --on-accent: #fff;
  --btn-bg: #1d5139; --btn-fg: #ffffff; --btn-bg-hover: #2c6e4f;
  --foot-bg: #eef3ef; --foot-ink: #17231d; --foot-ink-2: #3c4a43; --foot-line: #cfdcd3;
  --head-bg: #f6f8f5f0;
  --bp-orange: #c2410c; --bp-blue: #1d4ed8; --bp-mustard: #b8860b; --bp-red: #be123c;
  --shadow-2: 0 1px 2px #17231d0d, 0 14px 30px -20px #1d513940;
  --font-mast: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}
[aria-label*="主题"], [data-theme-toggle], .theme-toggle { display: none !important; }
body { background-color: var(--paper) !important;
  background-image: linear-gradient(var(--grid-minor) 1px, transparent 1px), linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px) !important;
  background-size: 24px 24px !important; }

/* ---------- 2 图纸标题栏：区块标题条 + 四角定位角 ---------- */
.sh__bar { border-bottom: 1px solid var(--line-strong) !important; background: var(--panel); padding: 8px 12px !important; }   /* 原站区块上方已有一条粗线，这里不再加，避免双线 */
.sh__bar .mono, .sh__no { color: var(--bp-orange) !important; }
.card, .rv-card, .rj-card, .pm-card { position: relative; border-radius: 2px !important; }
.card::after, .rv-card::after, .rj-card::after {
  content: ""; position: absolute; inset: -5px; pointer-events: none;
  background:
    linear-gradient(var(--accent),var(--accent)) left top/10px 2px no-repeat, linear-gradient(var(--accent),var(--accent)) left top/2px 10px no-repeat,
    linear-gradient(var(--accent),var(--accent)) right bottom/10px 2px no-repeat, linear-gradient(var(--accent),var(--accent)) right bottom/2px 10px no-repeat; }
h1 { letter-spacing: -.01em; }

/* ---------- 3 首页 hero：左文右看板 → 通栏居中刊头 + 通栏看板 + 横排工序条 ---------- */
@media (min-width: 1180px) {
  html body .hr { grid-template: "intro" "board" "toc" / minmax(0, 1fr) !important; gap: 28px !important; }
}
html body .hr-intro { text-align: center; max-width: 860px; margin: 0 auto; }
html body .hr-intro .hr-lede, html body .hr-intro .hr-lede * { text-align: left; }
html body .hr-intro .hr-lede { margin: 0 auto; max-width: 46em; border-left: 0 !important; background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--accent) !important; padding: 16px 20px !important; }
html body .hr-cta { justify-content: center; }
html body .hr-toc { border-top: 3px solid var(--rule); padding-top: 12px; }
html body .hr-toc > ol { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; border: 1px solid var(--line-strong); background: var(--panel); }
html body .hr-toc > ol > li { border-right: 1px solid var(--line); padding: 14px 14px 16px !important; border-bottom: 0 !important; }
html body .hr-toc > ol > li:last-child { border-right: 0; }
html body .hr-toc-no { color: var(--bp-orange) !important; font-weight: 700; display: block; margin-bottom: 4px; }
@media (max-width: 900px) { html body .hr-toc > ol { grid-template-columns: 1fr; } html body .hr-toc > ol > li { border-right: 0; border-bottom: 1px solid var(--line) !important; } }
.cell[aria-pressed=true] { outline: 2px solid var(--accent) !important; }
.c-val { color: var(--accent-hover) !important; font-weight: 600; }

/* ---------- 4 推荐前 6 / 榜单行：横排行 → 零件卡网格 ---------- */
html body ol.rk { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; list-style: none; padding: 0; }
html body .rk-head { display: none !important; }
html body .rk-row { display: grid !important; grid-template-columns: 40px minmax(0, 1fr) !important; grid-template-areas: "logo id" "data data" "go go" !important;
  background: var(--panel); border: 1px solid var(--line-strong) !important; padding: 34px 16px 16px !important; position: relative; }
html body .rk-row .rk-no { position: absolute; top: 0; left: 0; background: var(--rule); color: #fff !important; font: 700 13px/1 var(--font-mono); padding: 6px 10px; }
html body .rk-row:first-child .rk-no { background: var(--bp-orange); }
html body .rk-row .rk-logo { grid-area: logo; }
html body .rk-row .rk-id { grid-area: id; }
html body .rk-row .rk-data { grid-area: data; display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px 12px; border-top: 1px dashed var(--line-strong); padding-top: 10px; margin: 0; }
html body .rk-row .rk-d { display: block !important; }
html body .rk-row .rk-d dt { font-size: 12px; color: var(--ink-3); }
html body .rk-row .rk-d.rk-l { grid-column: 1 / -1; }
html body .rk-row .rk-go { grid-area: go; position: static !important; opacity: 1 !important; display: inline-flex; justify-content: center; border: 1px solid var(--accent); color: var(--accent-hover) !important; padding: 8px; margin-top: 4px; font-weight: 600; }
html body .rk-price b { color: var(--accent-hover); }
@media (max-width: 1000px) { html body ol.rk { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { html body ol.rk { grid-template-columns: 1fr; } }

/* ---------- 5 教程 / 测评文章页：右侧目录 → 左侧目录；步骤做成工序卡 ---------- */
@media (min-width: 1080px) {
  html body .rj-tv { grid-template-columns: 250px minmax(0, 1fr) !important; }
  html body .rj-tv > .rj-tv__aside { grid-column: 1; grid-row: 1 / span 20; }
  html body .rj-tv > :not(.rj-tv__aside) { grid-column: 2; }
  html body .rv-grid { grid-template-columns: 250px minmax(0, 1fr) !important; }
  html body .rv-grid > .rv-aside { grid-column: 1; grid-row: 1 / span 20; }
  html body .rv-grid > :not(.rv-aside) { grid-column: 2; }
}
html body .rj-steps > li, html body .rj-step { background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent); padding: 14px 16px !important; margin-bottom: 14px; }
html body .rj-steps__break { display: none; }

/* ---------- 6 栏目列表页：单列文章流 → 两列卡片 ---------- */
@media (min-width: 760px) {
  html body .zl-list { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; border-top: 0 !important; }
  html body .zl-list > li { background: var(--panel); border: 1px solid var(--line-strong) !important; padding: 14px 16px !important; margin: 0 !important; }
}
html body .zl-list > li { border-top: 3px solid var(--accent) !important; }

/* ---------- 7 按钮与链接 ---------- */
.btn, a.btn, button.btn { border-radius: 2px !important; }
a { text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.tag { border-color: var(--line-strong) !important; }

/* ---------- 8 联系页表单（tz_contact.py，M3 11-16） ---------- */
.contact { max-width: 42em; }
.contact-form { margin: 1.25em 0 1.5em; padding: 20px 22px; background: #fff; border: 1px solid var(--line-strong); border-top: 3px solid var(--accent); border-radius: 2px; }
.contact-form p { margin: 0 0 14px; }
.contact-form label { display: block; margin-bottom: 6px; font-weight: 600; color: var(--ink); font-size: 15px; }
.contact-form input[type=text], .contact-form input[type=email], .contact-form textarea { box-sizing: border-box; width: 100%; min-height: 44px; padding: 10px 12px; font: inherit; color: var(--ink); background: #fbfdfb; border: 1px solid var(--line-strong); border-radius: 2px; }
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.contact-form__btn { min-height: 44px; padding: 0 28px; font: inherit; font-weight: 700; color: var(--on-accent); background: var(--accent); border: 0; border-radius: 2px; cursor: pointer; }
.contact-form__btn:hover { background: var(--accent-hover); }

/* ---------- 9 不横滑（M3 11-17：第 26 条之外的横滑闸门 390/768/1024/1366） ---------- */
/* 代码块：长命令、长日志在窄屏换行，不出横向滚动条 */
pre.astro-code, pre.astro-code > code, .prose pre, .prose pre > code { white-space: pre-wrap !important; overflow-wrap: anywhere; word-break: break-all; overflow-x: visible !important; }
/* 正文表格（含 tz_rank22 重算的对比表）：不超出内容宽度，长单元格换行 */
.prose table, main table { max-width: 100%; table-layout: fixed; }
.prose table th, .prose table td, main table th, main table td { overflow-wrap: anywhere; word-break: break-word; }


/* Visual repair 2026-11-18: preserve content and the blueprint theme. */
/* Missing logos must not leave text in the old icon track. */
html body .rj-cv__id:has(> div:only-child),
html body .rj-cv__alts > li:has(> div:only-child) {
  grid-template-columns: minmax(0, 1fr);
}
html body .rj-cv__id > div,
html body .rj-cv__alts > li > div { min-width: 0; }
html body .rj-tv__dl:not(:has(> .rj-logo)) {
  grid-template-columns: minmax(0, 1fr) auto;
}
html body .rj-tv__dl > div { min-width: 0; }
/* Fixed-width columns require wrapping headers on desktop too. */
html body .prose th,
html body .pt-table th { white-space: normal; overflow-wrap: anywhere; }
@media (min-width: 1080px) {
  /* One content row: spanning 20 rows created 19 empty row gaps. */
  html body .rj-tv > .rj-tv__aside,
  html body .rv-grid > .rv-aside { grid-row: 1; }
  html body .rj-tv > .rj-tv__main,
  html body .rv-grid > .rv-main { grid-column: 2; grid-row: 1; }
}
@media (max-width: 767px) {
  html body .rj-tv__dl:not(:has(> .rj-logo)) {
    grid-template-columns: minmax(0, 1fr);
  }
  html body .rj-tv__dl > .btn { grid-column: 1 / -1; }
  /* Keep all values and repeat existing column labels for each record. */
  html body table[data-visual-records],
  html body table[data-visual-records] > tbody,
  html body table[data-visual-records] > caption { display: block; width: 100%; }
  html body table[data-visual-records] { overflow: visible; }
  html body table[data-visual-records] > thead {
    position: absolute; width: 1px; height: 1px;
    clip-path: inset(50%); overflow: hidden;
  }
  html body table[data-visual-records] > tbody > tr {
    display: block; border-bottom: 1px solid var(--line-strong); padding: 10px 0;
  }
  html body table[data-visual-records] > tbody > tr > :is(td, th) {
    display: grid; grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
    align-items: baseline; gap: 4px 12px; width: auto;
    padding: 6px 0; text-align: left; border: 0;
    white-space: normal; overflow-wrap: anywhere;
  }
  html body table[data-visual-records] [data-visual-label]::before {
    content: attr(data-visual-label); color: var(--ink-3); font-size: 13px;
    grid-column: 1; grid-row: 1 / span 8;
  }
  html body table[data-visual-records] [data-visual-label] > * { grid-column: 2; }
  html body table[data-visual-records] > tbody > tr > th[colspan] {
    display: block; padding: 8px 0;
  }
  html body table[data-visual-records] .ph-price {
    display: inline-flex; flex-wrap: nowrap; gap: 2px; white-space: nowrap;
  }
  html body table[data-visual-records] .ph-price :is(.v, .y, .u) {
    white-space: nowrap; overflow-wrap: normal; word-break: normal;
  }
}

/* Wrap literal filesystem paths in tutorial prose. */
html body .rj-tv__main .prose { overflow-wrap: anywhere; }

/* Match Astro-scoped card specificity after logo removal. */
html body .rj-cv__alts > li.rj-card:not(:has(> .rj-logo)) { grid-template-columns: minmax(0, 1fr); }
