/* DeviceReplica — interactive product-photo mock. Paired with device-replica.js.
   The stage is authored at the photo's natural pixels and uniformly scaled to
   its container, so the photo, the perspective-warped LCD, and the button
   hotspots all stay registered at any width. */

.bs-replica { position: relative; width: 100%; }

.bs-replica-scaler {
  position: relative;
  width: 100%;
  height: var(--bs-replica-h, auto);
}

.bs-replica-stage {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  user-select: none;
}

.bs-replica-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  -webkit-user-drag: none;
}

/* The live LCD: SVG-native sized, then warped onto the photo's screen quad by
   an inline matrix3d transform (set in JS). The chassis SVG carries its own
   opaque LCD background + segment styles, so it masks the baked-in photo. */
.bs-replica-screen {
  position: absolute;
  top: 0;
  left: 0;
  backface-visibility: hidden;
}
.bs-replica-screen svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Transparent, pressable hotspots over the two physical buttons. */
.bs-replica-btn {
  position: absolute;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 14px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 90ms ease-out, box-shadow 90ms ease-out;
}
.bs-replica-btn:focus-visible {
  outline: 3px solid rgba(99, 102, 241, 0.9);
  outline-offset: 3px;
}
/* Subtle press feedback — the real buttons depress into the shell. */
.bs-replica-btn.is-pressed {
  transform: translateY(1px) scale(0.97);
  box-shadow: inset 0 0 0 9999px rgba(0, 0, 0, 0.18);
}

/* Ripple on button press (click feedback). Lives inside the hotspot, so it is
   in stage space (not warped) and reads as a clean circular pulse. */
.bs-replica-btn { overflow: hidden; }
.bs-replica-ripple {
  position: absolute;
  left: 50%; top: 50%;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  pointer-events: none;
  animation: bs-replica-ripple 0.5s ease-out forwards;
}
@keyframes bs-replica-ripple {
  from { transform: translate(-50%, -50%) scale(1); opacity: 0.6; }
  to   { transform: translate(-50%, -50%) scale(16); opacity: 0; }
}

/* Component highlight box — sits inside the warped screen, so it tracks the
   LCD perspective. Border/shadow are in SVG units (the screen is 780 wide),
   so they read thin-but-visible once warped and scaled down. */
.bs-replica-hl {
  position: absolute;
  box-sizing: border-box;
  border: 10px solid rgba(193, 110, 79, 0.95);
  border-radius: 18px;
  box-shadow: 0 0 0 8px rgba(193, 110, 79, 0.22), 0 0 60px 10px rgba(193, 110, 79, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, left 350ms ease, top 350ms ease,
              width 350ms ease, height 350ms ease;
}
.bs-replica-hl.is-on { opacity: 1; animation: bs-replica-hl-pulse 1.6s ease-in-out infinite; }
@keyframes bs-replica-hl-pulse {
  0%, 100% { box-shadow: 0 0 0 8px rgba(193, 110, 79, 0.20), 0 0 55px 8px rgba(193, 110, 79, 0.40); }
  50%      { box-shadow: 0 0 0 14px rgba(193, 110, 79, 0.10), 0 0 75px 16px rgba(193, 110, 79, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .bs-replica-hl.is-on { animation: none; }
  .bs-replica-ripple { animation-duration: 0.01ms; }
}

/* "Press here" pulsing ring over a button hotspot, shown by pointButton()
   during the button-instruction steps. Sits on the stage (not inside the
   overflow-hidden hotspot) so the ring can extend past the button, and is
   non-interactive so the button underneath stays pressable. Matches the
   terracotta highlight look. */
.bs-replica-point {
  position: absolute;
  box-sizing: border-box;
  border-radius: 999px;
  border: 6px solid rgba(193, 110, 79, 0.95);
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}
.bs-replica-point.is-on {
  opacity: 1;
  animation: bs-replica-point-pulse 1.4s ease-in-out infinite;
}
@keyframes bs-replica-point-pulse {
  0%, 100% { transform: scale(0.94); box-shadow: 0 0 0 4px rgba(193, 110, 79, 0.20), 0 0 30px 4px rgba(193, 110, 79, 0.40); }
  50%      { transform: scale(1.06); box-shadow: 0 0 0 10px rgba(193, 110, 79, 0.10), 0 0 48px 12px rgba(193, 110, 79, 0.55); }
}
@media (prefers-reduced-motion: reduce) {
  .bs-replica-point.is-on { animation: none; box-shadow: 0 0 0 6px rgba(193, 110, 79, 0.20); }
}

/* Debug overlay (showGuides) — quad + hotspot outlines for alignment tuning. */
.bs-replica-guides {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}
