/*
 * Copyright (c) 2026 四川森普力科技有限公司
 * 联系人：姚工  Tel: 159-2808-9752 / 177-8067-0842
 * Email: mylanview@126.com
 * Web: www.sploptics.com
 *
 * 柯勒照明知识页：交互设计器与补充内容样式
 */

/* 每三段插入的定制联系行 */
.article-card p.kh-contact {
  margin: 4px 0 18px;
  padding: 8px 14px;
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--text-secondary);
  background: var(--primary-bg);
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  text-align: left;
}
.article-card p.kh-contact a {
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* 分步光路说明 */
.kh-steps { counter-reset: khstep; list-style: none; margin-left: 0 !important; padding: 0; }
.kh-steps li {
  position: relative;
  padding: 10px 14px 10px 46px;
  margin-bottom: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.kh-steps li::before {
  counter-increment: khstep;
  content: counter(khstep);
  position: absolute; left: 12px; top: 11px;
  width: 24px; height: 24px; line-height: 24px;
  text-align: center; font-size: 0.8rem; font-weight: 800;
  color: #fff; background: var(--primary); border-radius: 50%;
}
.kh-tag { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 0.78rem; font-weight: 700; margin-left: 4px; }
.kh-tag-gold { background: rgba(201, 138, 0, 0.15); color: #9a6a00; }
.kh-tag-green { background: rgba(21, 128, 61, 0.13); color: #15803d; }

/* ---------- 交互设计器 ---------- */
.kh-tool {
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: min(1180px, calc(100vw - 32px));
  padding: 32px 32px 36px;
}
.kh-lead {
  font-size: 0.94rem; line-height: 1.8; color: var(--text-secondary); margin-bottom: 16px;
}
.kh-inputs {
  display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 10px;
}
.kh-inputs fieldset {
  min-width: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 14px 10px; background: var(--bg-white);
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
}
.kh-inputs legend { font-size: 0.82rem; font-weight: 700; color: var(--primary); padding: 0 4px; }
.kh-inputs label { font-size: 0.86rem; color: var(--text-secondary); white-space: nowrap; }
.kh-inputs input[type="number"] {
  width: 68px; padding: 3px 6px; margin: 0 2px;
  border: 1px solid var(--border-dark); border-radius: 4px; font-size: 0.88rem; background: #fff; color: var(--text);
}
.kh-inputs select {
  padding: 3px 6px; border: 1px solid var(--border-dark); border-radius: 4px; font-size: 0.86rem; background: #fff; color: var(--text);
  max-width: 260px;
}
.kh-btn {
  display: inline-block; padding: 5px 12px; font-size: 0.84rem; font-weight: 600;
  color: var(--primary-dark); background: #fff; border: 1px solid var(--primary-light);
  border-radius: var(--radius-sm); cursor: pointer; transition: background var(--transition);
}
.kh-btn:hover { background: var(--primary-bg); }
.kh-btn-primary { color: #fff; background: var(--primary); border-color: var(--primary); }
.kh-btn-primary:hover, a.kh-btn-primary:hover { color: #fff; background: var(--primary-dark); }
a.kh-btn:hover { color: var(--primary-dark); }
a.kh-btn-primary:hover { color: #fff; }

/* 跳转按钮右侧来回弹动的三个提示箭头（依次错开，形成向左的波浪） */
.kh-nudge { display: inline-flex; align-items: center; gap: 2px; margin-left: 6px; }
.kh-nudge i {
  font-style: normal; font-size: 1.7rem; font-weight: 900; line-height: 1;
  color: var(--primary); animation: khNudge 1s ease-in-out infinite;
}
.kh-nudge i:nth-child(2) { animation-delay: 0.15s; opacity: 0.75; }
.kh-nudge i:nth-child(3) { animation-delay: 0.3s; opacity: 0.5; }
@keyframes khNudge {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-10px); }
}
@media (prefers-reduced-motion: reduce) { .kh-nudge i { animation: none; } }
.kh-btns { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

.kh-msgs { margin: 6px 0 10px; }
.kh-msg { font-size: 0.85rem; line-height: 1.6; padding: 6px 12px; border-radius: var(--radius-sm); margin-bottom: 6px; }
.kh-warn { background: rgba(245, 158, 11, 0.13); border-left: 3px solid var(--accent); color: #7a4b00; }
.kh-err { background: rgba(220, 38, 38, 0.1); border-left: 3px solid #dc2626; color: #8b1a1a; }

.kh-turret-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0; }
.kh-turret-label { font-size: 0.88rem; font-weight: 700; color: var(--text); }
.kh-turret { display: flex; flex-wrap: wrap; gap: 6px; }
.kh-obj {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  font-size: 0.84rem; border: 1px solid var(--border-dark); border-radius: 20px; background: #fff; color: var(--text); cursor: pointer;
}
.kh-obj i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 1px solid #777; }
.kh-obj.active { border-color: var(--primary); background: var(--primary); color: #fff; font-weight: 700; }

.kh-toolbar { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; font-size: 0.86rem; color: var(--text-secondary); margin: 6px 0 10px; }
.kh-toolbar label { white-space: nowrap; cursor: pointer; }

.kh-stage { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: #f7f9fc; }
.kh-stage svg { display: block; width: 100%; height: auto; }
.kh-info {
  margin-top: 8px; padding: 10px 14px; font-size: 0.88rem; line-height: 1.7; color: var(--text-secondary);
  background: var(--bg-white); border: 1px dashed var(--border-dark); border-radius: var(--radius-sm); min-height: 46px;
}
.kh-info b { color: var(--text); }
.kh-info-p { display: block; margin-top: 2px; color: var(--primary-dark); font-weight: 600; }

/* SVG 内部样式 */
.kh-svg text, #khSvg text, #khInset text { paint-order: stroke; stroke: #f7f9fc; stroke-width: 3px; stroke-linejoin: round; }
.kh-bg { fill: #f7f9fc; }
.kh-t { font-size: 13px; font-weight: 700; fill: #22324d; }
.kh-ts { font-size: 11.5px; fill: #4a5d78; }
.kh-tick { font-size: 10px; fill: #7486a0; }
.kh-gold-t { fill: #9a6a00; }
.kh-green-t { fill: #15803d; }
.kh-axis { fill: none; stroke: #8a9ab0; stroke-width: 1; stroke-dasharray: 8 4 2 4; }
.kh-ruler line { stroke: #9aa9bd; stroke-width: 1; }
.kh-lens { fill: rgba(120, 170, 230, 0.28); stroke: #2b5b9a; stroke-width: 1.4; }
.kh-lens-img { fill: rgba(142, 68, 173, 0.12); stroke: #7d3c98; }
.kh-objlens { fill: rgba(120, 170, 230, 0.35); stroke: #2b5b9a; stroke-width: 1; }
.kh-stop { stroke-width: 4; stroke-linecap: butt; }
.kh-gold-s { stroke: #c98a00; }
.kh-green-s { stroke: #15803d; }
.kh-conj { stroke-width: 1.2; stroke-dasharray: 3 3; opacity: 0.75; }
.kh-gold { stroke: #c98a00; }
.kh-green { stroke: #15803d; }
.kh-cube { fill: rgba(120, 170, 230, 0.12); stroke: #2b5b9a; stroke-width: 1.2; }
.kh-split { stroke: #2b5b9a; stroke-width: 2.4; }
.kh-cam { fill: #3b4658; }
.kh-sensor { stroke: #15803d; stroke-width: 3; }
.kh-reflector { fill: none; stroke: #8a95a5; stroke-width: 3; }
.kh-bulb { fill: rgba(255, 236, 170, 0.45); stroke: #b8860b; stroke-width: 1.2; }
.kh-coil { fill: none; stroke: #e07b00; stroke-width: 1.8; }
.kh-board { fill: #2f5d3a; }
.kh-chip { fill: #ffe066; stroke: #b8860b; stroke-width: 0.8; }
.kh-barrel { fill: rgba(200, 206, 216, 0.55); stroke: #59677c; stroke-width: 1.2; }
.kh-turret-plate { fill: #9aa7b8; stroke: #59677c; stroke-width: 1; }
.kh-sample { fill: #b9bec7; stroke: #6c7686; stroke-width: 0.8; }
.kh-stagebar { fill: #4b5566; }
.kh-hit { fill: transparent; stroke: none; }
.kh-el { cursor: pointer; }
.kh-el:hover .kh-lens, .kh-el.kh-sel .kh-lens { stroke: #e4572e; stroke-width: 2.2; }
.kh-el.kh-sel .kh-stop { stroke-width: 6; }
.kh-el.kh-sel .kh-cube, .kh-el.kh-sel .kh-barrel, .kh-el.kh-sel .kh-sample { stroke: #e4572e; stroke-width: 2; }
.kh-neighbor { cursor: pointer; opacity: 0.55; }
.kh-neighbor:hover { opacity: 0.9; }
.kh-ray { fill: none; stroke-width: 1.1; opacity: 0.7; }
.kh-imgray { fill: none; stroke: #8e44ad; stroke-width: 0.9; opacity: 0.45; stroke-dasharray: 4 3; }
.kh-flow { stroke-dasharray: 7 5; animation: khFlow 0.9s linear infinite; }
.kh-imgray.kh-flow { stroke-dasharray: 4 4; }
@keyframes khFlow { to { stroke-dashoffset: -12; } }
@media (prefers-reduced-motion: reduce) { .kh-flow { animation: none; } }

/* 调节区 */
.kh-play { display: grid; grid-template-columns: minmax(300px, 360px) 1fr; gap: 20px; margin-top: 18px; }
.kh-sliders h3 { margin-top: 0 !important; }
.kh-slider { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 0 10px; margin-bottom: 6px; }
.kh-slider label { grid-row: 1; grid-column: 1; font-size: 0.86rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.kh-slider output { grid-row: 1; grid-column: 2; font-size: 0.78rem; color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; }
.kh-slider input[type="range"] { grid-row: 2; grid-column: 1 / -1; width: 100%; margin: 2px 0 0; accent-color: var(--primary); }
.kh-slider.gold label { color: #9a6a00; }
.kh-slider.green label { color: #15803d; }
.kh-sub { font-size: 0.95rem !important; margin: 16px 0 8px !important; }

.kh-checks { list-style: none; margin: 8px 0 0 !important; padding: 0; }
.kh-checks li { font-size: 0.84rem !important; line-height: 1.5 !important; margin-bottom: 5px !important; padding: 5px 8px; border-radius: 4px; }
.kh-checks li.ok { background: rgba(16, 185, 129, 0.1); }
.kh-checks li.bad { background: rgba(220, 38, 38, 0.07); }
.kh-checks li em { display: block; font-style: normal; color: var(--text-muted); font-size: 0.8rem; margin-left: 22px; }
.kh-ck { display: inline-block; width: 20px; font-weight: 800; }
.kh-checks li.ok .kh-ck { color: #059669; }
.kh-checks li.bad .kh-ck { color: #dc2626; }
.kh-checks li.kh-score { font-weight: 700; color: var(--primary-dark); background: none; }

.kh-right { min-width: 0; }
.kh-views { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; align-content: start; }
.kh-view { margin: 0; background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; }
.kh-view svg { display: block; width: 100%; height: auto; border-radius: 4px; }
.kh-view figcaption { font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; line-height: 1.5; }
.kh-view figcaption b { color: var(--text); }
.kh-vbg-light { fill: #f7f9fc; }
.kh-vt { font-size: 11px; fill: #dfe7f2; }
.kh-warn-t { fill: #ffb547; }
.kh-inray { stroke-width: 0.9; opacity: 0.6; }
.kh-bracket line { stroke: #15803d; stroke-width: 1.2; }

.kh-readouts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin: 18px 0 8px; }
.kh-card { background: var(--bg-white); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; }
.kh-card-k { font-size: 0.76rem; color: var(--text-muted); }
.kh-card-v { font-size: 1.05rem; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums; }
.kh-card-n { font-size: 0.74rem; color: var(--text-secondary); line-height: 1.4; }

.kh-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.kh-table-wrap table { min-width: 720px; font-size: 0.84rem !important; }
.kh-table-wrap td, .kh-table-wrap th { padding: 7px 10px !important; }
.kh-table-wrap tr.kh-cur td { background: var(--primary-bg); font-weight: 700; }
.kh-table-wrap tr.kh-total td { font-weight: 700; color: var(--text); }
.kh-note { font-size: 0.8rem; line-height: 1.7; color: var(--text-muted); margin-top: 10px; }

@media (max-width: 900px) {
  .kh-play { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .kh-tool { padding: 22px 14px 26px; }
  .kh-inputs fieldset { width: 100%; min-width: 0; }
  .kh-inputs label, .kh-slider label, .kh-toolbar label { white-space: normal; }
  .kh-play > * { min-width: 0; }
  .kh-slider { grid-template-columns: 1fr; }
  .kh-slider output { grid-row: 3; grid-column: 1; text-align: left; }
  /* 光路图在手机上保持可读宽度，可横向滑动查看 */
  .kh-stage { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .kh-stage svg { min-width: 760px; }
}
