/* ============================================================
   MERCH-MOCKUP — Realistic product composite mockups + multi-angle gallery
   Loaded after app.js. Reads CSS custom properties from the
   active vibe. No frameworks, vanilla CSS only.
   ============================================================ */

/* ------------------------------------------------------------------ */
/* Gallery shell — wraps the angle slides + controls                   */
/* ------------------------------------------------------------------ */
.mockup-gallery {
  position: relative;
  width: 100%;
  border-radius: var(--radius-sm, 12px) var(--radius-sm, 12px) 0 0;
  overflow: hidden;
  /* Reserve space for dots/label below the slide */
  padding-bottom: 36px;
  background: transparent;
  outline: none; /* focus ring shown via keyboard only */
}

/* Show focus ring on keyboard nav */
.mockup-gallery:focus-visible {
  outline: 2px solid var(--accent, #2ee6d6);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Slide track                                                          */
/* ------------------------------------------------------------------ */
.mockup-gallery-track {
  position: relative;
  width: 100%;
  /* Square aspect for the slide area */
  padding-bottom: 100%;
  overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Individual slides                                                    */
/* ------------------------------------------------------------------ */
.mockup-gallery-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  /* Instant swap — no transition by default (respects prefers-reduced-motion) */
  transition: opacity 0s;
  pointer-events: none;
}

.mockup-gallery-slide.is-active {
  opacity: 1;
  pointer-events: auto;
}

@media (prefers-reduced-motion: no-preference) {
  .mockup-gallery-slide {
    transition: opacity 0.28s ease;
  }
}

/* ------------------------------------------------------------------ */
/* Mockup stage inside each slide                                       */
/* ------------------------------------------------------------------ */
.mockup-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.mockup-stage svg.mockup-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* Accessible hidden original img */
.mockup-gallery .mockup-source-img,
.mockup-stage .mockup-source-img {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ */
/* Garment depth / ambient shadow                                       */
/* ------------------------------------------------------------------ */
.mockup-garment-shadow {
  filter: drop-shadow(0 8px 24px rgba(0, 0, 0, 0.55));
}

/* ------------------------------------------------------------------ */
/* Design print area — crisp compositing                               */
/* ------------------------------------------------------------------ */
.mockup-design-img {
  border-radius: 4px;
}

/* ------------------------------------------------------------------ */
/* Prev / Next arrow buttons                                            */
/* ------------------------------------------------------------------ */
.mockup-gallery-btn {
  position: absolute;
  /* Center vertically within the square track area (not the full gallery which has 36px extra below) */
  top: calc(50% - 18px); /* 18px = half of 36px padding-bottom so we're at true track mid */
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  padding: 0;
  transition: background 0.18s, color 0.18s, transform 0.18s;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  /* Ensure min tap target per accessibility rules */
  min-width: 44px;
  min-height: 44px;
}

.mockup-gallery-btn--prev {
  left: 8px;
}

.mockup-gallery-btn--next {
  right: 8px;
}

.mockup-gallery-btn:hover,
.mockup-gallery-btn:focus-visible {
  background: rgba(0, 0, 0, 0.8);
  color: #fff;
  outline: 2px solid var(--accent, #2ee6d6);
  outline-offset: 2px;
}

.mockup-gallery-btn:active {
  transform: translateY(-50%) scale(0.92);
}

/* Hide buttons when gallery has only 1 slide (impossible but safety) */
.mockup-gallery[data-total="1"] .mockup-gallery-btn {
  display: none;
}

/* ------------------------------------------------------------------ */
/* Dot indicators                                                       */
/* ------------------------------------------------------------------ */
.mockup-gallery-dots {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
}

.mockup-gallery-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.28);
  cursor: pointer;
  padding: 0;
  transition: background 0.18s, transform 0.18s;
  /* Expand tap area via padding without growing visual dot */
  box-shadow: 0 0 0 7px transparent;
  /* For accessibility: make the hit area large enough */
  position: relative;
}

.mockup-gallery-dot::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
}

.mockup-gallery-dot.is-active {
  background: var(--accent, #2ee6d6);
  transform: scale(1.25);
}

.mockup-gallery-dot:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.55);
}

.mockup-gallery-dot:focus-visible {
  outline: 2px solid var(--accent, #2ee6d6);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------ */
/* Angle label                                                          */
/* ------------------------------------------------------------------ */
.mockup-gallery-label {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.3);
  font-family: var(--font-ui, sans-serif);
  pointer-events: none;
  user-select: none;
  line-height: 1.2;
}

/* ------------------------------------------------------------------ */
/* Hover float animation (non-reduced-motion)                           */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  .mockup-gallery-slide.is-active .mockup-stage .mockup-svg {
    animation: mockup-float 3s ease-in-out infinite;
  }

  @keyframes mockup-float {
    0%, 100% { transform: translateY(0) rotate(-0.3deg); }
    50%       { transform: translateY(-6px) rotate(0.3deg); }
  }
}

/* ------------------------------------------------------------------ */
/* Vinyl spin on hover                                                  */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  .mockup-gallery-slide.is-active .mockup-stage.mockup-vinyl:hover .mockup-vinyl-disc {
    animation: mockup-spin 4s linear infinite;
    transform-origin: 50% 50%;
    transform-box: fill-box;
  }

  @keyframes mockup-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
  }
}

/* ------------------------------------------------------------------ */
/* Sticker shimmer                                                      */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  .mockup-gallery-slide.is-active .mockup-stage.mockup-sticker:hover .mockup-sticker-sheen {
    animation: mockup-sheen 1.4s ease forwards;
  }

  @keyframes mockup-sheen {
    0%   { opacity: 0; transform: translateX(-60%); }
    40%  { opacity: 0.35; }
    100% { opacity: 0; transform: translateX(140%); }
  }
}

/* ------------------------------------------------------------------ */
/* Mobile — no overflow at 390px                                        */
/* ------------------------------------------------------------------ */
@media (max-width: 480px) {
  .mockup-gallery-btn {
    width: 36px;
    height: 36px;
    min-width: 44px; /* hit area kept via padding */
    min-height: 44px;
  }

  .mockup-gallery-btn--prev { left: 2px; }
  .mockup-gallery-btn--next { right: 2px; }

  .mockup-gallery-dot {
    width: 7px;
    height: 7px;
  }
}
