/* ============================================================
   wire-demo.css — 文章内嵌「可交互接线原理图」
   作用范围：只作用于 .wd-demo 内部，全部类名 wd- 前缀，零全局副作用。
   使用：news.content 里出现 data-wire-demo 时，news_detail.php 才引入本文件。
   设计令牌沿用 wz.css 的 --a / --ink / --body / --line；本文件不改任何全局变量。
   ============================================================ */

.wd-demo{
  --wd-pos:#d22b1f;        /* 24V 正极线 */
  --wd-ret:#1f5f8b;        /* 0V 回路线 */
  --wd-live:#f5a623;       /* 通电高亮 */
  --wd-off:#8a939b;        /* 未通电元件 */
  --wd-ink:#0f2230;
  --wd-line:#d7dde2;
  --wd-panel:#f6f8f9;

  margin:44px 0;
  border:1px solid var(--wd-line);
  border-radius:14px;
  overflow:hidden;
  background:#fff;
  font-family:var(--sans,"Helvetica Neue",Helvetica,Arial,sans-serif);
  color:var(--wd-ink);
}

/* ---------- 顶部条：标题 + 三个控制按钮 ---------- */
.wd-head{
  display:flex; flex-wrap:wrap; gap:16px; align-items:center; justify-content:space-between;
  padding:18px 22px; background:var(--wd-ink); color:#fff;
}
.wd-head h3{ margin:0; font-size:19px; line-height:1.3; font-weight:600; color:#fff; letter-spacing:-.01em; }
.wd-head p{ margin:4px 0 0; font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:#8fa6b5; }
.wd-controls{ display:flex; flex-wrap:wrap; gap:8px; }
.wd-btn{
  appearance:none; -webkit-appearance:none; cursor:pointer;
  font:inherit; font-size:13px; font-weight:600; line-height:1;
  padding:11px 16px; border-radius:6px;
  border:1px solid rgba(255,255,255,.28); background:transparent; color:#fff;
  transition:background .18s ease, color .18s ease, border-color .18s ease;
}
.wd-btn:hover{ background:rgba(255,255,255,.14); }
.wd-btn:focus-visible{ outline:2px solid #7fd4f5; outline-offset:2px; }
.wd-btn.is-active{ background:#fff; color:var(--wd-ink); border-color:#fff; }
.wd-btn--play{ background:var(--wd-pos); border-color:var(--wd-pos); }
.wd-btn--play:hover{ background:#b3241a; border-color:#b3241a; }
.wd-btn[disabled]{ opacity:.45; cursor:not-allowed; }

/* ---------- 状态条：当前发生了什么 ---------- */
.wd-status{
  display:flex; gap:18px; align-items:center;
  padding:18px 22px; border-bottom:1px solid var(--wd-line);
  background:#fff;
}
.wd-chip{
  flex:0 0 auto; display:flex; align-items:center; gap:10px;
  padding:12px 16px; border-radius:8px; background:var(--wd-panel);
  border:1px solid var(--wd-line);
  font-size:12px; font-weight:700; letter-spacing:.09em; text-transform:uppercase; white-space:nowrap;
  transition:background .25s ease, border-color .25s ease, color .25s ease;
}
.wd-chip i{ width:12px; height:12px; border-radius:50%; background:var(--wd-off); transition:background .25s ease, box-shadow .25s ease; }
.wd-demo.is-on .wd-chip{ background:#fff6e6; border-color:#f0c780; color:#8a5200; }
.wd-demo.is-on .wd-chip i{ background:var(--wd-live); box-shadow:0 0 0 4px rgba(245,166,35,.25); }
.wd-say b{ display:block; font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--wd-pos); margin-bottom:5px; }
.wd-say strong{ display:block; font-size:19px; line-height:1.3; font-weight:600; color:var(--wd-ink); }
.wd-say span{ display:block; margin-top:4px; font-size:14px; line-height:1.5; color:var(--body,#626262); }

/* ---------- 主体：左图 + 右步骤 ---------- */
.wd-body{ display:grid; grid-template-columns:minmax(0,1fr) 288px; }
.wd-stage{ padding:20px 22px 24px; min-width:0; }
.wd-legend{ display:flex; flex-wrap:wrap; gap:18px; margin-bottom:10px; font-size:12.5px; color:var(--body,#626262); }
.wd-legend span{ display:inline-flex; align-items:center; gap:7px; }
.wd-legend i{ width:20px; height:3px; border-radius:2px; background:var(--wd-pos); }
.wd-legend i.ret{ background:var(--wd-ret); }
.wd-legend i.live{ background:var(--wd-live); }
.wd-svg{ display:block; width:100%; height:auto; }
.wd-scroll{ position:relative; }
.wd-scroll:focus-visible{ outline:2px solid var(--a,#0E6E93); outline-offset:3px; }
/* 窄屏才出现的「可横向滑动」提示；能完整显示时由 JS 隐藏 */
.wd-hint{ display:none; margin:2px 0 0; font-size:12.5px; color:var(--muted,#979797); }
.wd-demo.is-pannable .wd-hint{ display:block; }

/* ---------- 右侧四步 ---------- */
.wd-steps{ margin:0; padding:20px 22px; list-style:none; border-left:1px solid var(--wd-line); background:var(--wd-panel); }
.wd-steps li{ display:flex; gap:13px; padding:14px 0; border-bottom:1px solid var(--wd-line); opacity:.45; transition:opacity .25s ease; }
.wd-steps li:last-child{ border-bottom:0; }
.wd-steps li b{
  flex:0 0 28px; height:28px; border-radius:50%; background:#dfe5e9; color:#6b7880;
  display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:700;
  transition:background .25s ease, color .25s ease;
}
.wd-steps li strong{ display:block; font-size:14.5px; line-height:1.35; font-weight:600; color:var(--wd-ink); }
.wd-steps li span{ display:block; margin-top:3px; font-size:13px; line-height:1.45; color:var(--body,#626262); }
.wd-steps li.is-done{ opacity:1; }
.wd-steps li.is-done b{ background:#cfe0ea; color:#134b6b; }
.wd-steps li.is-now{ opacity:1; }
.wd-steps li.is-now b{ background:var(--wd-pos); color:#fff; }

/* ---------- 图内 SVG 样式 ---------- */
.wd-svg text{ font-family:var(--sans,"Helvetica Neue",Helvetica,Arial,sans-serif); fill:var(--wd-ink); }
.wd-box{ fill:var(--wd-panel); stroke:var(--wd-line); stroke-width:1.5; }
.wd-boxlabel{ font-size:12px; font-weight:700; letter-spacing:.1em; fill:#7b8792; }
.wd-term{ fill:#fff; stroke:var(--wd-ink); stroke-width:2.5; }
.wd-termlabel{ font-size:14px; font-weight:700; }
.wd-note{ font-size:12px; fill:#7b8792; }
.wd-supply-v{ font-size:30px; font-weight:700; }
.wd-supply-t{ font-size:11px; font-weight:700; letter-spacing:.1em; fill:#7b8792; }

/* 导线：底层常驻 */
.wd-wire{ fill:none; stroke-width:3; stroke-linecap:round; stroke-linejoin:round; }
.wd-wire.pos{ stroke:var(--wd-pos); }
.wd-wire.ret{ stroke:var(--wd-ret); }
.wd-dot{ fill:var(--wd-pos); }
.wd-dot.ret{ fill:var(--wd-ret); }

/* 通电高亮：跑马灯虚线，默认不可见 */
.wd-flow{
  fill:none; stroke:var(--wd-live); stroke-width:6; stroke-linecap:round; stroke-linejoin:round;
  stroke-dasharray:15 13; opacity:0;
  transition:opacity .3s ease;
}
.wd-flow.is-live{ opacity:1; animation:wd-march .7s linear infinite; }
@keyframes wd-march{ to{ stroke-dashoffset:-28; } }

/* 触点刀 */
.wd-arm{ stroke:var(--wd-ink); stroke-width:7; stroke-linecap:round; transition:stroke .25s ease; }
.wd-demo.is-on .wd-arm{ stroke:var(--wd-pos); }

/* 按钮帽 + 推杆 */
.wd-cap{ fill:#c8342a; stroke:#96261e; stroke-width:2; transition:fill .25s ease, filter .25s ease; }
.wd-demo.is-on .wd-cap{ fill:#ff6a55; filter:drop-shadow(0 0 10px rgba(255,120,90,.85)); }
.wd-stem{ fill:none; stroke:#6c7a84; stroke-width:5; stroke-linecap:round; }
.wd-caphint{ font-size:11px; font-weight:700; letter-spacing:.1em; fill:#7b8792; }

/* 开口间隙提示 */
.wd-gap{ transition:opacity .25s ease; }
.wd-gap line{ stroke:var(--wd-pos); stroke-width:2.5; stroke-dasharray:5 5; }
.wd-gap text{ font-size:12px; font-weight:700; fill:var(--wd-pos); letter-spacing:.06em; }
.wd-demo.is-on .wd-gap{ opacity:0; }

/* 负载 / LED 元件 */
.wd-dev rect{ fill:#fff; stroke:var(--wd-line); stroke-width:1.5; transition:stroke .25s ease; }
.wd-dev .wd-sym{ fill:#eef1f3; stroke:var(--wd-off); stroke-width:2.5; transition:fill .25s ease, stroke .25s ease; }
.wd-dev .wd-symmark{ fill:none; stroke:var(--wd-off); stroke-width:2.5; stroke-linecap:round; transition:stroke .25s ease; }
.wd-dev .wd-devname{ font-size:13.5px; font-weight:700; }
.wd-dev .wd-devstate{ font-size:12px; font-weight:700; fill:var(--wd-off); letter-spacing:.08em; transition:fill .25s ease; }
.wd-dev.is-lit rect{ stroke:var(--wd-live); }
.wd-dev.is-lit .wd-sym{ fill:#ffd98a; stroke:#d99312; }
.wd-dev.is-lit .wd-symmark{ stroke:#8a5200; }
.wd-dev.is-lit .wd-devstate{ fill:#b87400; }

/* 屏幕阅读器播报 */
.wd-live{ margin:0; padding:14px 22px; border-top:1px solid var(--wd-line); background:var(--wd-panel); font-size:13.5px; line-height:1.5; color:var(--body,#626262); }
.wd-cap-note{ margin:0; padding:14px 22px; border-top:1px solid var(--wd-line); font-size:13px; line-height:1.55; color:var(--body,#626262); }
.wd-cap-note b{ color:var(--wd-ink); }

/* ---------- 响应式 ---------- */
@media (max-width:900px){
  .wd-body{ grid-template-columns:1fr; }
  .wd-steps{ border-left:0; border-top:1px solid var(--wd-line); }
  .wd-steps li{ padding:12px 0; }
}
@media (max-width:640px){
  .wd-head{ padding:16px; }
  .wd-head h3{ font-size:17px; }
  .wd-controls{ width:100%; }
  .wd-btn{ flex:1 1 auto; text-align:center; padding:11px 10px; font-size:12.5px; }
  .wd-status{ flex-direction:column; align-items:flex-start; gap:12px; padding:16px; }
  .wd-stage{ padding:16px; }
  .wd-say strong{ font-size:17px; }
  /* 窄屏图纸允许横向查看，避免文字被压到看不清 */
  .wd-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; scroll-behavior:smooth; }
  .wd-scroll .wd-svg{ width:660px; max-width:none; }
  .wd-live,.wd-cap-note{ padding:14px 16px; }
}

/* ---------- 尊重「减少动态效果」 ---------- */
@media (prefers-reduced-motion:reduce){
  .wd-flow.is-live{ animation:none; }
  .wd-demo *{ transition-duration:.01ms !important; }
}
