/* Shared slider+zoom widget for FFHQ-2048 demos.
   Used by the static HF Space (index.html) and by the local preview. */

.cmp-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}
@media (min-width: 1100px) {
  .cmp-grid { grid-template-columns: 1fr 1fr; }
}

.cmp-block {
  border: 1px solid #d0d7de;
  border-radius: 12px;
  padding: 12px;
  background: #f6f8fa;
  box-shadow: 0 1px 0 rgba(31,35,40,.04);
}
.cmp-title {
  font-weight: 600;
  margin: 0 0 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cmp-title code {
  background: rgba(175,184,193,.2);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: .9em;
}
.cmp-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85em;
  flex-wrap: wrap;
}
.cmp-btn {
  background: #ffffff;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
  font-size: .95em;
  line-height: 1;
  user-select: none;
}
.cmp-btn:hover  { background: #eaeef2; }
.cmp-btn:active { background: #d8dee4; }
.cmp-zoom-label {
  font-variant-numeric: tabular-nums;
  font-size: .8em;
  color: #57606a;
  min-width: 44px;
  text-align: right;
  padding: 0 4px;
}
.cmp-hint {
  color: #57606a;
  font-size: .75em;
  margin-left: 4px;
}
.cmp-viewport {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
  width: 100%;
  aspect-ratio: 1 / 1;
  touch-action: none;
  cursor: ew-resize;
}
.cmp-viewport.is-zoomed   { cursor: grab; }
.cmp-viewport.is-panning  { cursor: grabbing; }
.cmp-error {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
  background: rgba(160, 30, 30, 0.85);
  font-size: .9em;
  text-align: center;
  padding: 16px;
  z-index: 5;
}
.cmp-error.is-visible { display: flex; }
.cmp-error button {
  background: #fff; color: #1f2328; border: 0; border-radius: 6px;
  padding: 4px 10px; cursor: pointer; font-size: .9em;
}
.cmp-stage {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  will-change: transform;
}
.cmp-stage img-comparison-slider {
  width: 100%;
  height: 100%;
  display: block;
  --divider-color: #6f42c1;
  --divider-width: 3px;
  --default-handle-color: #6f42c1;
  --default-handle-opacity: 1;
}
.cmp-stage img-comparison-slider img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cmp-labels {
  display: flex;
  justify-content: space-between;
  font-size: .78em;
  color: #57606a;
  margin-top: 6px;
}
