/* Flat-lay outfit board. Self-contained: uses only .flatlay-* classes so the
   older mannequin and moodboard rules in editorial.css do not apply. */

.flatlay-frame {
  container-type: size;
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
}

.simple-builder .editorial-canvas {
  min-height: 0;
  margin: 12px 0 14px;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: radial-gradient(120% 90% at 40% 30%, #2f2f2c 0%, #232321 55%, #1c1c1a 100%);
  overflow: hidden;
  /* Keep the pieces' stacking inside the board so popovers such as Refine
     open above it. */
  position: relative;
  isolation: isolate;
  z-index: 0;
}

.flatlay-stage {
  height: clamp(380px, 64vh, 720px);
  padding: 28px 24px 22px;
}

.flatlay-small {
  height: 220px;
  padding: 14px;
  background: radial-gradient(120% 90% at 40% 30%, #2f2f2c 0%, #232321 55%, #1c1c1a 100%);
  border-radius: 12px;
}

.flatlay {
  position: relative;
  aspect-ratio: var(--ar);
  width: min(100cqw, calc(100cqh * var(--ar)));
}

.flatlay-empty-note {
  color: #b9b4aa;
  font-size: 14px;
  margin: 0;
}

.flatlay-piece {
  position: absolute;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  transform: rotate(var(--rot, 0deg));
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, 0.42)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.35));
  cursor: default;
}

/* The button itself ignores the pointer; only its garment-shaped tap area
   below takes taps. Keyboard focus still lands on the button. */
/* Specific enough to override the generic .simple-builder .editorial-stage
   button rule (border, padding, light text) in editorial.css. */
.simple-builder .editorial-stage button.flatlay-piece,
button.flatlay-piece {
  pointer-events: none;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.flatlay-hit {
  position: absolute;
  inset: 0;
  pointer-events: auto;
  cursor: pointer;
}

/* Selection and keyboard focus glow around the garment's own shape. */
.simple-builder .editorial-stage button.flatlay-piece:focus-visible,
.simple-builder .editorial-stage button.flatlay-piece[aria-expanded="true"] {
  outline: none;
  filter: drop-shadow(0 0 1.5px #f2eee6) drop-shadow(0 0 1.5px #f2eee6) drop-shadow(0 0 6px rgba(242, 238, 230, 0.55));
}

/* Photo positioned so its garment bounds fill the piece box; the source
   image's transparent margin extends outside and never takes clicks. */
.flatlay-photo {
  position: absolute;
  display: block;
  pointer-events: none;
}

.flatlay-tile {
  position: absolute;
  inset: 0;
  display: block;
  pointer-events: none;
}

.flatlay .photo-frame,
.flatlay picture {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  padding: 0;
  max-height: none;
}

.flatlay img.garment-photo {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
  border-radius: 0;
}

.flatlay-tile .photo-frame {
  background: #ece7de;
  border-radius: 10px;
}

.flatlay-tile .image-unavailable {
  color: #3a3833;
  font-size: 12px;
  padding: 8px;
  text-align: center;
}

.flatlay-menu {
  position: absolute;
  z-index: 40;
  left: 14px;
  bottom: 14px;
  width: min(300px, calc(100% - 28px));
  padding: 14px;
  border-radius: 14px;
  background: #f5f1ea;
  color: #1d1d1b;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  text-align: left;
}

.flatlay-menu h2 {
  margin: 0 28px 2px 0;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #1d1d1b;
}

.flatlay-menu p {
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.4;
  color: #6c6860;
}

.flatlay-menu-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.simple-builder .editorial-stage .flatlay-menu-actions button,
.flatlay-menu-actions button {
  min-height: 44px;
  padding: 0 6px;
  border: 1px solid #d8d2c6;
  border-radius: 10px;
  background: #fff;
  color: #1d1d1b;
  font-size: 13px;
}

.simple-builder .editorial-stage .flatlay-menu-actions button[data-remove-piece],
.flatlay-menu-actions button[data-remove-piece] {
  background: #1d1d1b;
  border-color: #1d1d1b;
  color: #f5f1ea;
}

.simple-builder .editorial-stage button.flatlay-menu-close,
.flatlay-menu-close {
  position: absolute;
  min-height: 0;
  padding: 0;
  border-radius: 10px;
  top: 4px;
  right: 4px;
  width: 44px;
  height: 44px;
  border: 0;
  background: none;
  color: #6c6860;
  font-size: 20px;
}

.simple-builder .editorial-stage .flatlay-menu button:focus-visible,
.flatlay-menu button:focus-visible {
  outline: 2px solid #1d1d1b;
  outline-offset: 2px;
}

@media (max-width: 700px) {
  .flatlay-stage {
    height: 430px;
    padding: 20px 14px 16px;
  }

  .flatlay-menu {
    left: 8px;
    bottom: 8px;
    width: calc(100% - 16px);
  }
}

@media (max-width: 360px) {
  .flatlay-stage {
    height: 380px;
  }
}
