/* PamArt v7 — CSS completo e leggibile */

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  margin: 0;
  background: #111;
}

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  overflow-x: hidden;
  color: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Sfondo generale */
  background-color: #111;
  background-image: url("assets/sfondo-pamart.jpg");
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  background-attachment: fixed;
}

/* Cabina */
.stage {
  position: relative;
  width: min(92vw, 540px);
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: #222;
  box-shadow: 0 18px 70px rgba(0,0,0,.75);
  user-select: none;
}

.stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Zone cliccabili */
.hot {
  position: absolute;
  z-index: 10;
  border: 2px solid #fff;
  border-radius: 5px;
  background: rgba(255,255,255,.04);
  cursor: pointer;
}

.hot:disabled {
  opacity: 0;
  pointer-events: none;
}

.coin {
  left: 65.7%;
  top: 78.1%;
  width: 4.5%;
  height: 9.2%;
}

.slot {
  left: 24.3%;
  top: 78%;
  width: 18.2%;
  height: 3.1%;
}

.pulse {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  50% { box-shadow: 0 0 0 7px rgba(255,255,255,.32); }
}

/* Uscita ritratto */
.outlet {
  position: absolute;
  z-index: 8;
  left: 14%;
  top: 62%;
  width: 39%;
  height: 37%;
  overflow: hidden;
  pointer-events: none;
}

.paper {
  position: absolute;
  left: 16%;
  top: -112%;
  width: 68%;
  aspect-ratio: 2 / 3;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.73);
  pointer-events: auto;
  cursor: zoom-in;
}

.paper img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes print {
  0%   { top: -112%; }
  20%  { top: -88%; }
  45%  { top: -55%; }
  72%  { top: -22%; }
  100% { top: 3%; }
}

.paper.fade {
  animation: fadepaper .7s ease forwards !important;
}

@keyframes fadepaper {
  to {
    opacity: 0;
    transform: translateY(18px) scale(.96);
  }
}

/* Messaggio */
.msg {
  position: absolute;
  z-index: 15;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  padding: 8px 13px;
  border-radius: 18px;
  background: rgba(0,0,0,.73);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  pointer-events: none;
}

/* Zoom ritratto */
.viewer {
  position: absolute;
  z-index: 30;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0,0,0,.93);
}

.viewer.open {
  display: flex;
}

.viewer img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  animation: zoom .45s ease;
}

@keyframes zoom {
  from { opacity: 0; transform: scale(.35); }
  to   { opacity: 1; transform: scale(1); }
}

.round {
  position: absolute;
  top: 12px;
  z-index: 32;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff;
  color: #111;
  font-size: 24px;
  text-decoration: none;
  cursor: pointer;
}

.download { left: 12px; }
.close    { right: 12px; }

.restart {
  position: absolute;
  z-index: 16;
  right: 10px;
  bottom: 10px;
  width: 40px;
  height: 40px;
  display: none;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 20px;
  cursor: pointer;
}

/* Cartello PamArt */
.studio-badge {
  position: fixed;
  z-index: 40;
  right: max(16px, 3vw);
  bottom: max(16px, 3vh);
  width: clamp(90px, 12vw, 165px);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(0 8px 16px rgba(0,0,0,.67));
  transition: transform .2s ease;
}

.studio-badge:hover {
  transform: scale(1.04);
}

.studio-badge img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

/* Modale contatti */
.contact-modal {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 70px 20px 25px;
  background: rgba(0,0,0,.82);
}

.contact-modal.open {
  display: flex;
}

.contact-close {
  position: fixed;
  z-index: 70;
  right: 18px;
  top: 18px;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 27px;
  cursor: pointer;
}

/* Biglietto 3D */
.card {
  width: min(78vw, 390px);
  aspect-ratio: 663 / 999;
  perspective: 1300px;
  cursor: pointer;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .75s cubic-bezier(.2,.75,.25,1);
}

.card.flipped .card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #eee;
  box-shadow: 0 18px 70px #000;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.flip-hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  padding: 6px 10px;
  border-radius: 14px;
  background: rgba(0,0,0,.73);
  color: #fff;
  font-size: 11px;
  white-space: nowrap;
}

/* Aree cliccabili sul retro */
.contact-link {
  position: absolute;
  z-index: 5;
  left: 12%;
  width: 76%;
  border-radius: 8px;
}

.contact-link:hover {
  outline: 2px solid rgba(34,34,34,.53);
  background: rgba(255,255,255,.13);
}

.phone     { top: 22%; height: 10%; }
.instagram { top: 34%; height: 9%; }
.facebook  { top: 43%; height: 9%; }
.email     { top: 55%; height: 13%; }

@media (max-width: 700px) {
  .stage {
    width: min(96vw, 540px);
  }

  .studio-badge {
    width: 88px;
  }
}

@media (orientation: portrait) {
  body {
    background-size: auto 100vh;
  }
}
