/* Mi Argentina — PNG mockup, print overlays, 3D flip, plantilla fija dorso */

.shirt-scene {
  width: var(--shirt-max);
  perspective: 1200px;
  perspective-origin: 50% 45%;
  overflow: hidden;
}

.shirt-flip {
  /* Frente — Sol al pecho derecho en pantalla (= corazón de quien usa) */
  --sun-front-left: 62%;
  --sun-front-top: 29%;
  --sun-front-width: 11%;

  /* Dorso — valores base; applyShirtLayout() los sobrescribe desde SHIRT_LAYOUT */
  --sun-back-left: 50%;
  --sun-back-top: 22%;
  --sun-back-width: 11.5%;

  --map-back-left: 50%;
  --map-back-top: 45%;
  --map-back-width: 16.8%;

  --phrase-left: 50%;
  --phrase-top: 70%;

  /* Iconos — ancho base uniforme (10–12%) */
  --selected-icon-width: 10%;

  position: relative;
  width: 100%;
  aspect-ratio: 822 / 964;
  transform-style: preserve-3d;
  transition: transform var(--flip-duration) cubic-bezier(0.4, 0.05, 0.2, 1);
  will-change: transform;
}

.shirt-flip.is-back {
  transform: rotateY(180deg);
}

.shirt-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  overflow: hidden;
}

.shirt-face--front {
  transform: rotateY(0deg);
}

.shirt-face--back {
  transform: rotateY(180deg);
}

/* Photoreal PNG shirt — no CSS silhouette, no clip-path, no mask */
.shirt-mockup {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
  filter: drop-shadow(0 14px 28px var(--shadow));
  position: relative;
  z-index: 0;
}

.shirt-symbol {
  position: absolute;
  display: block;
  height: auto;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transition: opacity 0.35s ease;
}

.shirt-sun.is-hidden,
.shirt-phrase.is-hidden {
  opacity: 0;
}

/* Sol frente — pecho izquierdo de quien usa (derecha en pantalla) */
.shirt-sun--front {
  left: var(--sun-front-left);
  top: var(--sun-front-top);
  width: var(--sun-front-width);
  z-index: 2;
  transform: translate(-50%, -50%);
  aspect-ratio: 1;
}

/* Sol Mayo dorso — centrado arriba; tamaño vía SHIRT_LAYOUT */
.shirt-sun--back {
  left: var(--sun-back-left);
  top: var(--sun-back-top);
  width: var(--sun-back-width);
  z-index: 1;
  transform: translate(-50%, -50%);
  aspect-ratio: 1;
}

/* Mapa — centrado; solo mapa.png; tamaño vía SHIRT_LAYOUT */
.shirt-map {
  left: var(--map-back-left);
  top: var(--map-back-top);
  width: var(--map-back-width);
  z-index: 2;
  transform: translate(-50%, -50%);
}

/* Frase — posición desde SHIRT_LAYOUT.phrase */
.shirt-phrase {
  position: absolute;
  left: var(--phrase-left);
  top: var(--phrase-top);
  z-index: 4;
  margin: 0;
  width: 72%;
  transform: translate(-50%, -50%);
  text-align: center;
  font-family: "Ink Free", "Segoe Print", "Bradley Hand", "Apple Chancery", cursive;
  font-size: clamp(0.72rem, 3.6vw, 1.05rem);
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: 0.01em;
  color: var(--celeste);
  pointer-events: none;
  user-select: none;
  text-wrap: balance;
  transition: opacity 0.35s ease;
}

/* —— Dorso: 10 slots plantilla fija (mismo box que sol/mapa = .shirt-face) —— */
.selected-icons-layer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  z-index: 3;
}

.slot {
  position: absolute;
  left: var(--slot-x, 50%);
  top: var(--slot-y, 50%);
  width: var(--selected-icon-width);
  aspect-ratio: 1;
  z-index: 3;
  transform:
    translate(-50%, -50%)
    scale(var(--slot-scale, 1))
    rotate(var(--slot-rot, 0deg));
  transform-origin: center center;
  pointer-events: none;
  overflow: visible;
  box-sizing: border-box;
}

/* Fallbacks = SHIRT_LAYOUT (JS sobrescribe --slot-x/--slot-y al montar) */
.slot[data-slot="left-1"]  { --slot-x: 37.5%; --slot-y: 27%;   --slot-scale: 1;    --slot-rot: -2deg; }
.slot[data-slot="left-2"]  { --slot-x: 36.5%; --slot-y: 35.5%; --slot-scale: 0.98; --slot-rot: 2deg; }
.slot[data-slot="left-3"]  { --slot-x: 36%;   --slot-y: 44%;   --slot-scale: 1.02; --slot-rot: -2deg; }
.slot[data-slot="left-4"]  { --slot-x: 36.5%; --slot-y: 52.5%; --slot-scale: 0.98; --slot-rot: 2deg; }
.slot[data-slot="left-5"]  { --slot-x: 37.5%; --slot-y: 61%;   --slot-scale: 1;    --slot-rot: -2deg; }
.slot[data-slot="right-1"] { --slot-x: 62.5%; --slot-y: 27%;   --slot-scale: 1;    --slot-rot: 2deg; }
.slot[data-slot="right-2"] { --slot-x: 63.5%; --slot-y: 35.5%; --slot-scale: 0.98; --slot-rot: -2deg; }
.slot[data-slot="right-3"] { --slot-x: 64%;   --slot-y: 44%;   --slot-scale: 1.02; --slot-rot: 2deg; }
.slot[data-slot="right-4"] { --slot-x: 63.5%; --slot-y: 52.5%; --slot-scale: 0.98; --slot-rot: -2deg; }
.slot[data-slot="right-5"] { --slot-x: 62.5%; --slot-y: 61%;   --slot-scale: 1;    --slot-rot: 2deg; }

.slot img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  transform: scale(var(--icon-scale, 1));
  transform-origin: center center;
}

/* Debug layout (DEBUG_LAYOUT = true en js/layout.js) */
.layout-debug {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

.layout-debug__area {
  position: absolute;
  border: 1px dashed rgba(255, 0, 80, 0.85);
  box-sizing: border-box;
}

.layout-debug__center,
.layout-debug__slot {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: Outfit, system-ui, sans-serif;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  color: #fff;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.9);
  pointer-events: none;
}

.layout-debug__center {
  padding: 2px 4px;
  border-radius: 2px;
}

.layout-debug__slot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(200, 30, 30, 0.9);
}

@media (max-width: 480px) {
  .shirt-flip {
    --sun-front-left: 62%;
    --sun-front-top: 29%;
    --sun-front-width: 11%;
  }

  .shirt-phrase {
    font-size: clamp(0.68rem, 3.4vw, 0.95rem);
    width: 74%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shirt-symbol,
  .shirt-phrase {
    transition: none;
  }

  .shirt-flip {
    transition: opacity 0.2s ease;
    transform: none !important;
  }

  .shirt-flip.is-back .shirt-face--front {
    opacity: 0;
    visibility: hidden;
  }

  .shirt-flip:not(.is-back) .shirt-face--back {
    opacity: 0;
    visibility: hidden;
  }

  .shirt-face--back {
    transform: none;
  }

  .shirt-flip.is-back .shirt-face--back {
    z-index: 2;
  }

  .shirt-flip:not(.is-back) .shirt-face--front {
    z-index: 2;
  }
}
