/* CW Compare — split-image slider. */

.cw-compare {
  position: relative;
  display: block;
  width: 100%;
  margin: clamp(32px, 4vw, 56px) 0;
  overflow: hidden;
  background: var(--hair);
  user-select: none;
  --pos: 50%;
}

/* Both images stack at full container width. The "A" (left) image sits on top
 * and is clipped from the right based on --pos; B is fully visible underneath. */
.cw-compare__b {
  display: block;
  width: 100%;
  height: auto;
}
.cw-compare__a {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: inset(0 calc(100% - var(--pos)) 0 0);
  -webkit-clip-path: inset(0 calc(100% - var(--pos)) 0 0);
}

/* Vertical handle line. */
.cw-compare__handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--pos);
  width: 0;
  pointer-events: none;
  z-index: 3;
}
.cw-compare__handle-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
  transform: translateX(-50%);
}
.cw-compare__handle-grab {
  position: absolute;
  top: 50%;
  left: 0;
  transform: translate(-50%, -50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.08);
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0;
  font-weight: 600;
  pointer-events: none;
}
.cw-compare__handle-grab svg { display: block; }

/* Native range input — invisible. We don't use it for pointer input (the
 * figure's custom drag handler covers that); the range stays purely for
 * keyboard a11y (Tab to focus, arrow keys to move). */
.cw-compare__range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  z-index: 4;
  opacity: 0;
  pointer-events: none;  /* let .cw-compare own the pointer interaction */
}
.cw-compare__range:focus-visible { pointer-events: auto; outline: 2px solid var(--brass); }
.cw-compare__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 100%;
  background: transparent;
}
.cw-compare__range::-moz-range-thumb {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
}

/* Labels — bottom left + bottom right. */
.cw-compare__labels {
  position: absolute;
  inset: auto 0 0 0;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  padding: clamp(12px, 1.6vw, 20px);
  gap: 12px;
  z-index: 2;
}
.cw-compare__label {
  background: rgba(15, 15, 14, 0.55);
  backdrop-filter: blur(6px);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  color: #fff;
  max-width: 45%;
  pointer-events: auto;
}
.cw-compare__label-name {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.3;
}
.cw-compare__label-detail {
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.3;
}
.cw-compare--labels-never .cw-compare__labels { display: none; }

/* Fullscreen toggle button (top-right of figure). */
.cw-compare__fs {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 15, 14, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  backdrop-filter: blur(6px);
  transition: background 0.2s, transform 0.2s;
}
.cw-compare__fs:hover { background: rgba(15, 15, 14, 0.78); transform: scale(1.05); }
.cw-compare__fs svg { display: block; }

/* ─── Fullscreen overlay ─── */
.cw-compare-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(15, 15, 14, 0.97);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 3vw, 60px);
  animation: cwco-fade 0.18s ease;
  font-family: var(--sans);
}
@keyframes cwco-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
body.cw-compare-overlay--open { overflow: hidden; }

.cw-compare-overlay .cw-compare {
  margin: 0;
  background: transparent;
  max-width: min(100%, calc(100vw - 60px));
  max-height: 78vh;
  width: auto;
}
.cw-compare-overlay .cw-compare__b,
.cw-compare-overlay .cw-compare__a {
  max-height: 78vh;
  width: auto;
  height: auto;
}
.cw-compare-overlay .cw-compare__b {
  max-width: min(100%, calc(100vw - 60px));
  display: block;
}
.cw-compare-overlay .cw-compare__a {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.cw-compare-overlay .cw-compare__fs { display: none; }
.cw-compare-overlay .cw-compare__labels { display: none; } /* replaced by detailed panel below */

/* Close button. */
.cw-compare-overlay__close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #f0efea;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, transform 0.2s;
  z-index: 1;
}
.cw-compare-overlay__close:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: scale(1.08);
}

/* EXIF detail panel — two columns, one per side. */
.cw-compare-overlay__panels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: clamp(20px, 3vw, 60px);
  align-items: start;
  margin-top: clamp(20px, 3vw, 36px);
  width: min(100%, 1100px);
  color: #f0efea;
}
.cw-compare-overlay__panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(240, 239, 234, 0.72);
  line-height: 1.4;
}
.cw-compare-overlay__panel--right { text-align: right; }
.cw-compare-overlay__panel-name {
  font-family: var(--serif);
  font-size: clamp(18px, 1.6vw, 22px);
  letter-spacing: -0.01em;
  text-transform: none;
  color: #f0efea;
  font-weight: 380;
  margin-bottom: 6px;
}
.cw-compare-overlay__panel-name em {
  font-family: var(--serif-italic);
  font-style: italic;
  font-weight: 400;
}
.cw-compare-overlay__panel-camera { color: rgba(240, 239, 234, 0.95); }
.cw-compare-overlay__divider {
  width: 1px;
  background: rgba(240, 239, 234, 0.2);
  align-self: stretch;
  min-height: 80px;
}
.cw-compare-overlay__panel-shop {
  color: #d9bf86;
  text-decoration: none;
  border-bottom: 1px solid rgba(217, 191, 134, 0.45);
  padding-bottom: 1px;
  display: inline-block;
  transition: color 0.2s, border-color 0.2s;
}
.cw-compare-overlay__panel-shop:hover { color: #f0efea; border-bottom-color: #f0efea; }

@media (max-width: 720px) {
  .cw-compare-overlay__panels {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .cw-compare-overlay__panel--right { text-align: left; }
  .cw-compare-overlay__divider { display: none; }
}

/* Editor placeholder mode — when the inner figure has no images yet, do not
 * inherit the dark background from .cw-compare. */
.editor-styles-wrapper .cw-compare:has(.components-placeholder) {
  background: transparent;
  overflow: visible;
}

@media (max-width: 560px) {
  .cw-compare__handle-grab { width: 36px; height: 36px; }
  .cw-compare__label-name { font-size: 10px; }
  .cw-compare__label-detail { display: none; }
}
