/* ==========================================================================
   Before/After Compare Component
   - Desktop (>=900px): side-by-side, both panes always visible
   - Mobile (<900px): toggle buttons swap a single visible pane
   Relies on design tokens defined in :root by another stylesheet:
   --bg, --surface, --surface-2, --text, --muted, --accent, --border,
   --border-bright, --radius
   ========================================================================== */

.cmp {
  width: 100%;
  max-width: 100%;
}

/* --------------------------------------------------------------------
   Toggle (mobile only) — segmented control
   -------------------------------------------------------------------- */

.cmp__toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  max-width: 100%;
}

.cmp__btn {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 20px;
  font-weight: 600;
  font-size: .85rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .18s ease, color .18s ease;
  white-space: nowrap;
}

.cmp__btn.is-active {
  background: var(--accent);
  color: #041014;
}

.cmp__btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------
   Panes
   -------------------------------------------------------------------- */

.cmp__panes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  width: 100%;
}

.cmp__pane {
  min-width: 0;
}

/* --------------------------------------------------------------------
   Frame (image container)
   -------------------------------------------------------------------- */

.cmp__frame {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
  line-height: 0;
  transition: border-color .18s ease;
}

.cmp__frame:hover {
  border-color: var(--border-bright);
}

.cmp__frame img {
  display: block;
  width: 100%;
  height: auto;
}

/* Label tag pinned to the top-left of each frame */

.cmp__tag {
  position: absolute;
  top: 12px;
  left: 12px;
  text-transform: uppercase;
  font-size: .68rem;
  letter-spacing: .14em;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}

.cmp__tag--before {
  background: rgba(255, 255, 255, .82);
  color: #0a0a0a;
}

.cmp__tag--after {
  background: var(--accent);
  color: #041014;
}

/* --------------------------------------------------------------------
   Caption
   -------------------------------------------------------------------- */

.cmp__cap {
  margin-top: 14px;
  font-size: .9rem;
  color: var(--muted);
  max-width: 52ch;
}

.cmp__cap strong {
  color: var(--text);
  font-weight: 600;
}

/* --------------------------------------------------------------------
   Mobile (<900px): toggle drives single-pane visibility
   -------------------------------------------------------------------- */

@media (max-width: 899px) {
  .cmp__pane {
    display: none;
  }

  .cmp__pane.is-active {
    display: block;
  }
}

/* --------------------------------------------------------------------
   Desktop (>=900px): side-by-side, toggle hidden, both panes forced visible
   -------------------------------------------------------------------- */

@media (min-width: 900px) {
  .cmp__toggle {
    display: none;
  }

  .cmp__panes {
    grid-template-columns: 1fr 1fr;
    gap: 20px;
  }

  /* Critical: desktop must never hide a pane, regardless of is-active */
  .cmp__pane,
  .cmp__pane.is-active {
    display: block;
  }
}

/* --------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .cmp__btn,
  .cmp__frame {
    transition: none;
  }
}
