/* 拼豆图纸频道：生成器 / 图库 / 详情页的公共样式（tpb-* 与 pd-*） */

/* ---------- 生成器（沿用桃子工具的上传/结果组件） ---------- */
.tpb-workspace { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 16px; }
.tpb-source { flex: 0 0 220px; }
.tpb-source img { width: 100%; border-radius: var(--radius-md); border: 1px solid var(--slate-200); background: #fff; }
.tpb-options { flex: 1 1 420px; min-width: 280px; }
.tpb-row { margin-bottom: 14px; }
.tpb-row-label { font-size: 13px; color: var(--slate-600); margin-bottom: 6px; font-weight: 600; }
.tpb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.tpb-chip { padding: 6px 14px; border: 1px solid var(--slate-300); border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; transition: all .15s; }
.tpb-chip:hover { border-color: var(--accent); }
.tpb-chip.active { border-color: var(--accent); background: var(--accent-light); color: var(--accent-dark); font-weight: 600; }
.tpb-chip em { font-style: normal; font-size: 11px; opacity: .65; margin-left: 4px; }
.tpb-input { width: 90px; padding: 5px 8px; border: 1px solid #d2d2d2; border-radius: 4px; font-size: 13px; }
.tpb-select { padding: 5px 8px; border: 1px solid #d2d2d2; border-radius: 4px; font-size: 13px; background: #fff; }
.tpb-range { width: 180px; vertical-align: middle; }
.tpb-hint { font-size: 12px; color: var(--slate-500); margin-top: 4px; }
.tpb-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.tpb-result { margin-top: 20px; }
.tpb-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin: 12px 0; }
.tpb-stat { background: #f7f8fa; border-radius: var(--radius-md); padding: 10px 12px; }
.tpb-stat b { display: block; font-size: 18px; color: var(--navy-800); }
.tpb-stat span { font-size: 12px; color: var(--slate-500); }
.tpb-imgs { display: flex; gap: 16px; flex-wrap: wrap; margin: 14px 0; }
.tpb-img-card { flex: 1 1 320px; min-width: 260px; }
.tpb-img-card .tpb-img-title { font-size: 13px; font-weight: 600; color: var(--slate-600); margin-bottom: 6px; display: flex; justify-content: space-between; align-items: center; }
.tpb-img-card img { width: 100%; max-height: 420px; object-fit: contain; background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-md); cursor: zoom-in; }
.tpb-warn { background: #fff8e6; border: 1px solid #f5d58a; border-radius: var(--radius-md); padding: 10px 14px; margin: 12px 0; font-size: 13px; color: #8a6d1a; }
.tpb-warn ul { margin: 6px 0 0 18px; padding: 0; }
.tpb-bom { max-height: 260px; overflow: auto; border: 1px solid var(--slate-200); border-radius: var(--radius-md); margin-top: 8px; }
.tpb-bom table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tpb-bom th { position: sticky; top: 0; background: #f7f8fa; text-align: left; padding: 7px 10px; font-weight: 600; color: var(--slate-600); }
.tpb-bom td { padding: 6px 10px; border-top: 1px solid #f0f0f0; }
.tpb-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 3px; border: 1px solid rgba(0,0,0,.12); vertical-align: middle; margin-right: 6px; }
@media (max-width: 640px) {
  .tpb-source { flex-basis: 100%; max-width: 220px; }
  .tpb-img-card img { max-height: 300px; }
}

/* ---------- 栏目公共 ---------- */
/* 不再套 1180px 内层窄栏：内容跟着站点 .container 走，避免整页“内缩” */
.pd-page { max-width: none; margin: 0; }
.pd-page h1 { font-size: 28px; line-height: 1.3; margin: 0 0 10px; color: var(--navy-900); letter-spacing: -.01em; }
.pd-head { margin-bottom: 22px; }
.pd-head p { margin: 0; color: var(--text-secondary); font-size: 15px; line-height: 1.8; }
.pd-section { margin-top: 40px; }
.pd-section h2 { font-size: 20px; margin: 0 0 14px; color: var(--navy-800); }
.pd-section-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 14px; }
.pd-section-head h2 { margin: 0; }
.pd-section-head a { font-size: 13.5px; color: var(--accent-dark); }
.pd-empty { padding: 28px; background: var(--card); border: 1px dashed var(--slate-300); border-radius: var(--radius-md); color: var(--text-secondary); font-size: 14px; }
.pd-more { margin-top: 16px; font-size: 14px; color: var(--text-secondary); }
.pd-more a { color: var(--accent-dark); }

/* 首页 hero：纸感底 + 豆点纹，和生成器同一套视觉语言 */
.pd-hero {
  position: relative;
  padding: 44px 40px 40px;
  border-radius: var(--radius-lg);
  border: 1px solid #e6ddcc;
  background-color: #f6f1e7;
  background-image: radial-gradient(circle at 1px 1px, rgba(23,21,15,.10) 1px, transparent 0);
  background-size: 20px 20px;
  overflow: hidden;
}
.pd-hero::after {
  content: "";
  position: absolute; right: -60px; top: -60px; width: 280px; height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(217,22,94,.16), rgba(217,22,94,0) 68%);
  pointer-events: none;
}
.pd-hero-kicker {
  display: inline-block; margin-bottom: 12px; padding: 3px 10px;
  border: 1px solid rgba(23,21,15,.35); border-radius: 2px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px; letter-spacing: .14em; color: #5d5749;
}
.pd-hero h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.18; margin: 0 0 14px; color: #17150f; letter-spacing: -.02em; }
.pd-hero p { margin: 0; max-width: 720px; color: #4a453a; font-size: 15.5px; line-height: 1.85; }
.pd-hero-meta { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 22px; font-size: 13px; color: #5d5749; }
.pd-hero-meta b { color: #17150f; font-size: 16px; margin-right: 4px; }

/* 三张入口卡片：一眼看出点哪个 */
.pd-cta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.pd-cta-card {
  position: relative; display: flex; flex-direction: column; gap: 6px;
  padding: 22px 22px 20px; min-height: 168px;
  background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-md);
  text-decoration: none; color: inherit; overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.pd-cta-card::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--slate-300);
  transition: background-color .16s ease;
}
.pd-cta-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 12px 28px rgba(23,21,15,.10); }
.pd-cta-card:hover::before { background: var(--accent); }
.pd-cta-no {
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px; letter-spacing: .16em; color: var(--text-light);
}
.pd-cta-card strong { font-size: 19px; color: var(--navy-900); line-height: 1.3; }
.pd-cta-card p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--text-secondary); }
.pd-cta-go { margin-top: auto; padding-top: 12px; font-size: 13px; font-weight: 600; color: var(--accent-dark); }
.pd-cta-card:hover .pd-cta-go { color: var(--accent); }
.pd-cta-card.is-primary { background: #17150f; border-color: #17150f; }
.pd-cta-card.is-primary::before { background: var(--accent); }
.pd-cta-card.is-primary strong { color: #fdfaf3; }
.pd-cta-card.is-primary p { color: #cfc8b8; }
.pd-cta-card.is-primary .pd-cta-no { color: #8b8474; }
.pd-cta-card.is-primary .pd-cta-go { color: #f7c7da; }
.pd-cta-card.is-primary:hover { box-shadow: 0 14px 30px rgba(23,21,15,.24); }

/* 分类 */
.pd-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.pd-cat { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-md); text-decoration: none; transition: border-color .15s, transform .15s, box-shadow .15s; }
.pd-cat:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(23,21,15,.07); }
.pd-cat-name { font-size: 16px; font-weight: 600; color: var(--navy-800); }
.pd-cat-desc { font-size: 12.5px; color: var(--text-light); line-height: 1.6; }

/* 筛选 */
.pd-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 22px; }
.pd-chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--slate-200); background: var(--card); color: var(--text-secondary); font-size: 13px; text-decoration: none; }
.pd-chip:hover { border-color: var(--accent); color: var(--accent-dark); }
.pd-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 图纸卡片 */
.pd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.pd-card { display: block; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-md); overflow: hidden; text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.pd-card:hover { border-color: var(--accent); box-shadow: 0 12px 26px rgba(23,21,15,.09); transform: translateY(-2px); }
.pd-card-img { aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center; padding: 12px; background: #f6f1e7; }
.pd-card-img img { max-width: 100%; max-height: 100%; object-fit: contain; image-rendering: pixelated; }
.pd-card-body { padding: 12px 14px 14px; }
.pd-card-body h3 { margin: 0 0 5px; font-size: 15px; font-weight: 600; color: var(--navy-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pd-card-body p { margin: 0; font-size: 12.5px; color: var(--text-light); }

/* 详情 */
.pd-detail h1 { margin-bottom: 8px; }
.pd-detail-desc { margin: 0 0 18px; color: var(--text-secondary); font-size: 14.5px; line-height: 1.75; }
.pd-detail-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 18px; }
.pd-detail-stats div { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-md); padding: 12px 14px; }
.pd-detail-stats b { display: block; font-size: 17px; color: var(--navy-800); }
.pd-detail-stats span { font-size: 12px; color: var(--text-light); }
.pd-detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.pd-detail-imgs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pd-detail-imgs figure { margin: 0; background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius-md); padding: 12px; }
.pd-detail-imgs figcaption { font-size: 13px; font-weight: 600; color: var(--slate-600); margin-bottom: 8px; }
.pd-detail-imgs img { width: 100%; max-height: 520px; object-fit: contain; background: #fff; border-radius: var(--radius-sm); }
.pd-bom { overflow: auto; max-height: 440px; border: 1px solid var(--card-border); border-radius: var(--radius-md); background: var(--card); }
.pd-bom table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pd-bom th { position: sticky; top: 0; background: #f7f8fa; text-align: left; padding: 8px 12px; font-weight: 600; color: var(--slate-600); }
.pd-bom td { padding: 6px 12px; border-top: 1px solid #f0f1f3; }
.pd-swatch { display: inline-block; width: 16px; height: 16px; border-radius: 3px; border: 1px solid rgba(0,0,0,.12); vertical-align: middle; margin-right: 6px; }
/* 版权声明：归属 + 署名（CC BY 类许可要求作者和原始链接可查） */
.pd-copy-card {
  display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-start;
  padding: 22px 24px; background: #fbf9f4; border: 1px solid #e6ddcc; border-radius: var(--radius-md);
}
.pd-copy-main { flex: 1 1 420px; min-width: 0; }
.pd-copy-main h3 { margin: 0 0 8px; font-size: 15px; color: var(--navy-800); }
.pd-copy-main p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.85; color: var(--text-secondary); }
.pd-copy-main p:last-child { margin-bottom: 0; }
/* CC BY 等许可要求署名可见，不能只藏在弹窗里 */
.pd-copy-credit {
  padding: 8px 12px; background: #f6f1e6; border-left: 3px solid #c9962f;
  border-radius: 0 4px 4px 0; font-size: 12.5px !important; color: #6b5a3a !important;
}
.pd-copy-credit a { color: var(--accent-dark); text-decoration: underline; }
.pd-copy-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding-top: 4px; }
.pd-copy-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border: 1px solid var(--slate-300); border-radius: 6px; background: #fff;
  font-size: 13px; color: var(--text-secondary); text-decoration: none; cursor: pointer;
  transition: border-color .15s, color .15s;
}
.pd-copy-btn:hover { border-color: var(--accent); color: var(--accent-dark); }
.pd-copy-btn.is-solid { background: var(--accent); border-color: var(--accent); color: #fff; }
.pd-copy-btn.is-solid:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }

/* 素材出处弹层：文本用 textContent 填，URL 用 createElement 建链接，不拼 HTML */
.pd-modal { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(23,21,15,.55); }
.pd-modal[hidden] { display: none; }
.pd-modal-box { width: min(560px, 100%); max-height: 82vh; overflow: auto; background: #fbf9f4; border: 1px solid #17150f; border-radius: 4px; box-shadow: 8px 8px 0 rgba(23,21,15,.85); padding: 24px; }
.pd-modal-box h3 { margin: 0 0 4px; font-size: 17px; color: var(--navy-900); }
.pd-modal-sub { margin: 0 0 16px; font-size: 12.5px; color: var(--text-light); }
.pd-modal-list { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 8px 14px; margin: 0 0 14px; font-size: 13.5px; line-height: 1.7; }
.pd-modal-list dt { color: var(--text-light); }
.pd-modal-list dd { margin: 0; color: var(--text-secondary); word-break: break-word; user-select: text; }
.pd-modal-text p { margin: 0 0 10px; font-size: 13.5px; line-height: 1.85; color: var(--text-secondary); }
.pd-modal-text a { color: var(--accent-dark); }
.pd-modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: 16px; }

/* 功能介绍 / 使用说明：放在工具下方，给搜索和首次使用的人看 */
.pd-guide { margin-top: 44px; padding-top: 30px; border-top: 1px solid var(--card-border); }
.pd-guide h2 { font-size: 20px; margin: 0 0 12px; color: var(--navy-800); }
.pd-guide h2 + h2 { margin-top: 30px; }
.pd-guide h3 { font-size: 15.5px; margin: 18px 0 8px; color: var(--navy-800); }
.pd-guide p { margin: 0 0 10px; font-size: 14px; line-height: 1.85; color: var(--text-secondary); max-width: 860px; }
.pd-guide ul, .pd-guide ol { margin: 0 0 12px; padding-left: 22px; max-width: 860px; }
.pd-guide ul { list-style: disc; }
.pd-guide ol { list-style: decimal; }
.pd-guide li { margin-bottom: 7px; font-size: 14px; line-height: 1.8; color: var(--text-secondary); }
.pd-guide b { color: var(--navy-800); }

/* 生成器 / 画板嵌进站点版式：去掉全屏高度，四边留白收窄 */
.pd-page .pbs-root.pbs-generator,
.pd-page .pbs-root.pbs-editor { min-height: 0; padding: 22px; border-radius: var(--radius-lg); }
.pd-page .pbs-root.pbs-editor { padding: 16px; }
.pd-page .pbs-layout { max-width: none; }
/* 生成器右栏跟左栏齐高，空状态在整块画布里居中，避免下沿一大片空底 */
.pd-page .pbs-generator .pbs-layout { align-items: stretch; }
.pd-page .pbs-generator .pbs-output { display: flex; flex-direction: column; }
.pd-page .pbs-generator .pbs-output .pbs-empty { flex: 1; }

@media (max-width: 980px) {
  .pd-cta { grid-template-columns: 1fr; }
  .pd-cta-card { min-height: 0; }
}
@media (max-width: 760px) {
  .pd-detail-imgs { grid-template-columns: 1fr; }
  .pd-hero { padding: 26px 20px 24px; }
  .pd-hero h1 { font-size: 26px; }
  .pd-page .pbs-root.pbs-generator { padding: 14px; }
  .pd-page .pbs-root.pbs-editor { padding: 10px; }
  .pd-modal-list { grid-template-columns: 1fr; gap: 2px 0; }
}
/* 带色号图纸：点击放大预览（滚轮缩放 + 拖动平移） */
.pd-zoom-hint { margin-left: 8px; font-weight: 400; font-size: 12px; color: var(--text-light); }
.pd-detail-imgs img.pd-zoomable { cursor: zoom-in; }
.pd-zoom { position: fixed; inset: 0; z-index: 10000; overflow: hidden; background: rgba(23,21,15,.9); touch-action: none; }
.pd-zoom[hidden] { display: none; }
.pd-zoom-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; font-size: 13px; color: #f2ede2; }
.pd-zoom-body { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); transform-origin: center center; cursor: grab; }
.pd-zoom-body.is-dragging { cursor: grabbing; }
.pd-zoom-body img { display: block; max-width: 92vw; max-height: 84vh; background: #fff; user-select: none; -webkit-user-drag: none; }
