/* ===========================================================
   整改前后照片对比 · 样式
   ----------------------------------------------------------
   · 卷帘对比（clip-path 分割，拖动/键盘都可控）
   · 多组明细切换（一条考核记录可能含多个扣分项的现场图）
   · 灯箱查看原图
   =========================================================== */

.beforeafter {
  --ba-pos: 50%;
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  max-height: 460px;
  border-radius: 14px;
  overflow: hidden;
  background: #0d1512;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
  border: 1px solid var(--line);
}
.beforeafter img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  -webkit-user-drag: none;
}
/* 上层（整改后）按分割线裁剪，露出右侧 */
.beforeafter .ba-after {
  clip-path: inset(0 0 0 var(--ba-pos));
}

.ba-divider {
  position: absolute; top: 0; bottom: 0;
  left: var(--ba-pos);
  width: 2px;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .18), 0 0 14px rgba(0, 0, 0, .45);
  pointer-events: none;
  z-index: 2;
}
.ba-handle {
  position: absolute; top: 50%; left: var(--ba-pos);
  width: 40px; height: 40px; margin: -20px 0 0 -20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .32);
  display: grid; place-items: center;
  color: var(--c-primary-600);
  z-index: 3;
  pointer-events: none;
}
.ba-handle svg { width: 18px; height: 18px; }

.ba-tag {
  position: absolute; top: 10px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  backdrop-filter: blur(6px);
  pointer-events: none;
  z-index: 2;
}
.ba-tag.before { left: 10px; background: rgba(224, 82, 82, .92); color: #fff; }
.ba-tag.after { right: 10px; background: rgba(43, 160, 95, .92); color: #fff; }

.ba-meta {
  position: absolute; left: 10px; bottom: 10px; right: 10px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 8px;
  font-size: 10.5px; color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 4px rgba(0, 0, 0, .8);
  pointer-events: none;
  z-index: 2;
}
.ba-meta b { color: #fff; font-weight: 600; }

/* 空态占位 */
.ba-empty {
  position: absolute; inset: 0;
  display: grid; place-content: center; justify-items: center; gap: 6px;
  background: repeating-linear-gradient(45deg, #f5f8f7, #f5f8f7 10px, #eef3f1 10px, #eef3f1 20px);
  color: var(--ink-4); font-size: 12px; text-align: center;
}
.ba-empty svg { width: 26px; height: 26px; opacity: .5; }

/* 组切换条 */
.ba-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.ba-thumb {
  position: relative;
  width: 74px; height: 56px;
  border-radius: 8px; overflow: hidden;
  border: 2px solid transparent;
  background: var(--surface-2);
  padding: 0; cursor: pointer;
  transition: .16s;
  flex: 0 0 auto;
}
.ba-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ba-thumb:hover { border-color: var(--c-primary-300); }
.ba-thumb.on { border-color: var(--c-primary); box-shadow: 0 0 0 3px var(--c-primary-100); }
.ba-thumb .n {
  position: absolute; left: 3px; top: 3px;
  min-width: 14px; height: 14px; padding: 0 3px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .62); color: #fff;
  font-size: 9px; line-height: 14px; text-align: center;
  font-family: var(--mono);
}
.ba-thumb .pair {
  position: absolute; right: 3px; bottom: 3px;
  display: flex; gap: 2px;
}
.ba-thumb .pair i {
  width: 5px; height: 5px; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .7);
}
.ba-thumb .pair i.b { background: var(--c-danger); }
.ba-thumb .pair i.a { background: var(--c-ok); }

/* 对比 / 并排 切换 */
.ba-modes { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.ba-modes button {
  height: 24px; padding: 0 9px; border: 0; border-radius: 6px;
  background: transparent; color: var(--ink-3); font-size: 11.5px;
}
.ba-modes button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: var(--shadow-sm); }

/* 并排模式 */
.ba-side { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ba-side figure {
  position: relative; margin: 0;
  aspect-ratio: 4 / 3; border-radius: 12px; overflow: hidden;
  background: #0d1512; cursor: zoom-in;
}
.ba-side figure img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ba-side figcaption {
  position: absolute; left: 8px; top: 8px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; color: #fff;
  background: rgba(0, 0, 0, .55);
}

/* 灯箱 */
.lightbox {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(6, 14, 11, .93);
  display: grid; place-items: center;
  padding: 32px;
  color: #fff;                    /* 图标用 currentColor，必须显式给浅色 */
  animation: lbIn .18s ease-out;
}
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
.lightbox img {
  max-width: 92vw; max-height: 86vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8);
}
.lightbox .lb-bar {
  position: absolute; left: 0; right: 0; bottom: 20px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  color: rgba(255, 255, 255, .88); font-size: 12px;
}
.lightbox .lb-close {
  position: absolute; right: 20px; top: 20px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .1); color: #fff;
  display: grid; place-items: center;
}
.lightbox .lb-close:hover { background: rgba(255, 255, 255, .22); }
.lightbox .lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .1); color: #fff;
  display: grid; place-items: center;
}
.lightbox .lb-nav:hover { background: rgba(255, 255, 255, .22); }
.lightbox .lb-nav.prev { left: 18px; }
.lightbox .lb-nav.next { right: 18px; }

/* 归档统计条 */
.photo-stat {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 10px;
  border-radius: 10px; background: var(--c-primary-50);
  border: 1px solid var(--c-primary-100);
  font-size: 11.5px; color: var(--c-primary-600);
}
.photo-stat b { font-family: var(--mono); }
.photo-stat .sep { color: var(--c-primary-300); }

@media (max-width: 720px) {
  .beforeafter { aspect-ratio: 1 / 1; max-height: 62vh; }
  .ba-thumb { width: 62px; height: 48px; }
}
