/* 前后对比全屏查看器
   分割线用「两个 transform」实现：
     #cmp-clip 向左平移 (X - 窗口宽)，把裁切窗口移到 [X-宽, X]
     #cmp-before 同时向右平移 (窗口宽 - X)，抵消位移，图像本身不动
   两者都是 transform，合成器直接搬图层，拖动时既不重绘也不重新采样图片。
   → 弱显卡、软件渲染下也能跟手。
   → 两张图的尺寸/位置来自同一组变量，永远重合。 */

.cmp {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  flex-direction: column;
  background: #08080a;
  color: var(--text, #f3e9dd);
}

.cmp[hidden] {
  display: none !important;
}

.cmp__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
}

.cmp .icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #f3e9dd;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.cmp .icon-btn:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
}

.cmp__title {
  font-size: 14px;
  letter-spacing: 0.02em;
}

.cmp__count {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--text-mute, #9a9188);
}

.cmp__stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
  background: #08080a;
}

.cmp__view {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #101013;
  user-select: none;
}

.cmp__pic {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  /* 全站有 img{max-width:100%}，会把放大后的图横向压扁，这里必须解除 */
  max-width: none;
  max-height: none;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
}

/* 结果图在底层，原图放在裁切层里盖在上面，只露出左边一段 */
.cmp__after {
  z-index: 1;
}

.cmp__clip {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  will-change: transform;
}

.cmp__clip .cmp__pic {
  z-index: 1;
}

.cmp__line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.65);
  cursor: col-resize;
  pointer-events: none;
  will-change: transform;
}

.cmp__labels {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 4;
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
  pointer-events: none;
}

.cmp__labels span {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.cmp__bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 10px 18px 16px;
}

.cmp__nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cmp__zoom {
  min-width: 52px;
  text-align: center;
  font-size: 12px;
  color: var(--text-mute, #9a9188);
  font-variant-numeric: tabular-nums;
}

.cmp__hint {
  margin-left: 10px;
  font-size: 11.5px;
  color: var(--text-mute, #8b837b);
  pointer-events: none;
}

@media (max-width: 860px) {
  .cmp__hint {
    display: none;
  }
}
