/* Panorama module styles.
 *
 * Loaded on every page (it is ~3 KB) while the *code* stays lazily imported —
 * that split keeps the stylesheet simple without shipping the engine to
 * projects that have not bought the module.
 *
 * Everything is scoped under .ff-pano so it cannot leak into the viewer or the
 * editor. Colours reuse the viewer's custom properties where they exist, so a
 * project's brand colour flows through automatically. */

.ff-pano {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(1200px, 92vw);
  max-width: 100%;
}

/* The stage is a fixed-aspect box: the canvas has no intrinsic size, so
 * without this it would collapse to zero height. 16:9 on desktop, taller on
 * phones where a wide letterbox is unusable. */
.ff-pano-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 240px;
  background: #0b0d10;
  border-radius: 10px;
  overflow: hidden;
}

@media (max-width: 640px) {
  .ff-pano-stage {
    aspect-ratio: 4 / 3;
  }
}

.ff-pano-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  /* Stop the browser from panning/zooming the page during a drag — without
   * this, vertical drags scroll the page on touch instead of tilting. */
  touch-action: none;
  /* A drag that starts on the canvas must not select surrounding text. */
  user-select: none;
  -webkit-user-select: none;
  outline: none;
  /* Fade in once the first frame is up, so the visitor never sees a flash of
   * empty black canvas. */
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ff-pano.is-ready .ff-pano-canvas {
  opacity: 1;
}

.ff-pano-canvas.is-grabbing {
  cursor: grabbing;
}

.ff-pano-canvas:focus-visible {
  outline: 2px solid var(--ff-accent, #2563eb);
  outline-offset: -2px;
}

/* Fullscreen toggle, top-left of the stage. Same glass treatment as the
   viewer's .ff-scene-toggle and the modal's close button, so the three read as
   one control set. */
.ff-pano-fs {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.55);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: background 150ms ease;
}

.ff-pano-fs:hover,
.ff-pano-fs:focus-visible {
  background: var(--ff-brand, #2563eb);
}

.ff-pano-fs svg {
  width: 20px;
  height: 20px;
  display: block;
}

/* Loading / error text, centred over the stage. */
.ff-pano-status {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  text-align: center;
  color: #d8dde5;
  font-size: 14px;
  pointer-events: none;
}

.ff-pano-status[hidden] {
  display: none;
}

/* Progress hint shown between first paint (placeholder up, already draggable)
   and the full-resolution image arriving. Hidden before first paint — the
   status text covers that — and removed once .is-loaded lands. */
.ff-pano-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.ff-pano.is-ready:not(.is-loaded) .ff-pano-progress {
  opacity: 1;
}

.ff-pano-progress::after {
  content: '';
  position: absolute;
  inset: 0;
  width: 40%;
  background: var(--ff-accent, #2563eb);
  animation: ff-pano-progress-slide 1.1s ease-in-out infinite;
}

@keyframes ff-pano-progress-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

@media (prefers-reduced-motion: reduce) {
  .ff-pano-progress::after {
    animation: none;
    width: 100%;
    opacity: 0.5;
  }
}

/* ---- Variant picker ---------------------------------------------------- */

.ff-pano-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
  /* Long configurator lists scroll rather than pushing the canvas off-screen. */
  max-height: 30vh;
  overflow-y: auto;
}

.ff-pano-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background-color 0.3s ease;
}

/* Flashed when the visitor clicks the corresponding surface in the panorama.
 * This is what makes "the mask is also the hit region" discoverable. */
.ff-pano-group.is-highlighted {
  background: color-mix(in srgb, var(--ff-accent, #2563eb) 16%, transparent);
}

.ff-pano-group-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  opacity: 0.65;
}

.ff-pano-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ff-pano-swatch {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 5px 10px 5px 5px;
  border: 1.5px solid rgba(127, 137, 150, 0.35);
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.ff-pano-swatch:hover {
  border-color: var(--ff-accent, #2563eb);
}

.ff-pano-swatch:focus-visible {
  outline: 2px solid var(--ff-accent, #2563eb);
  outline-offset: 2px;
}

.ff-pano-swatch.is-active {
  border-color: var(--ff-accent, #2563eb);
  background: color-mix(in srgb, var(--ff-accent, #2563eb) 12%, transparent);
}

/* The colour chip is decorative: every swatch also carries its text label, so
 * options are never distinguished by colour alone. */
.ff-pano-chip {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  flex: none;
  background-color: #8b93a1;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.ff-pano-swatch-label {
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .ff-pano-canvas,
  .ff-pano-group {
    transition: none;
  }
}
