/* ============ Escenas de dispositivos ============ */
.scene-wrap {
  position: absolute;
  inset: 0;
}
/* El canvas 3D es más grande que su caja para que nada se corte contra un borde */
.scene-wrap canvas.gl {
  position: absolute;
  inset: -12% -8%;
  width: 116%;
  height: 124%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 600ms ease;
}
.scene-wrap.is-gl canvas.gl {
  opacity: 1;
}
.scene-wrap.is-gl .flat,
.gl-pending .scene-wrap:not(.is-ready) .flat {
  visibility: hidden;
}

/* Aro de carga mientras llega el 3D */
.scene-loader {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  pointer-events: none;
}
.gl-pending .scene-wrap:not(.is-ready) .scene-loader {
  display: grid;
}
.scene-loader svg {
  width: 3rem;
  height: 3rem;
  animation: spin 1s linear infinite;
}
.scene-loader__track {
  fill: none;
  stroke: rgba(184, 224, 216, 0.2);
  stroke-width: 6;
}
.scene-loader__arc {
  fill: none;
  stroke: var(--blue-lit);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 70 260;
}
.slide--light .scene-loader__track {
  stroke: rgba(31, 111, 128, 0.15);
}
.slide--light .scene-loader__arc {
  stroke: var(--blue);
}
@keyframes spin {
  to {
    transform: rotate(1turn);
  }
}

/* ============ Dispositivos planos (sin WebGL) ============ */
.flat {
  position: absolute;
  inset: 4% 0 6%;
  display: grid;
  place-items: center;
}
.flat__laptop {
  position: relative;
  width: min(86%, 46rem);
  filter: drop-shadow(0 2.2rem 2.4rem rgba(0, 12, 16, 0.45));
}
/* Tapa: aluminio fino, bisel negro delgado y muesca de cámara */
.flat__screen {
  position: relative;
  aspect-ratio: 16 / 10;
  padding: 0.55rem 0.55rem 0.7rem;
  border-radius: 0.95rem 0.95rem 0.35rem 0.35rem;
  background: #0c0d10;
  box-shadow: 0 0 0 2px #b9bec6, 0 0 0 3px #7d838c;
}
.flat__screen::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 0.55rem;
  left: 50%;
  width: 11%;
  height: 0.8rem;
  transform: translateX(-50%);
  border-radius: 0 0 0.45rem 0.45rem;
  background: #0c0d10;
}
.flat__screen img,
.flat__pscreen img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top left;
  border-radius: 0.3rem;
  background: #fff;
}
/* Base: aluminio con la hendidura para abrir la tapa */
.flat__base {
  position: relative;
  height: 0.85rem;
  margin-inline: -8%;
  border-radius: 0.2rem 0.2rem 1.1rem 1.1rem;
  background: linear-gradient(#e4e7eb 0%, #c9ced5 45%, #8e959e 100%);
}
.flat__base::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 16%;
  height: 0.38rem;
  transform: translateX(-50%);
  border-radius: 0 0 0.5rem 0.5rem;
  background: linear-gradient(#a7adb5, #c4c9d0);
}
/* iPhone: marco de titanio, bisel negro fino, isla dinámica y botones */
.flat__phone {
  position: absolute;
  right: 3%;
  bottom: 0;
  width: min(23%, 10.5rem);
  aspect-ratio: 390 / 844;
  padding: 0.3rem;
  border-radius: 1.75rem;
  background: #0c0d10;
  box-shadow:
    0 0 0 2px #c9c4bb,
    0 0 0 3.5px #8f8a82,
    0 1.8rem 2.4rem -0.8rem rgba(0, 12, 16, 0.55);
}
.flat__phone::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0.75rem;
  left: 50%;
  width: 30%;
  height: 0.62rem;
  transform: translateX(-50%);
  border-radius: 1rem;
  background: #000;
}
.flat__phone::after {
  content: "";
  position: absolute;
  top: 22%;
  right: -4.5px;
  width: 2.5px;
  height: 14%;
  border-radius: 0 2px 2px 0;
  background: #8f8a82;
}
.flat__pscreen {
  height: 100%;
  border-radius: 1.45rem;
  overflow: hidden;
  background: #fff;
}
.flat__pscreen img {
  border-radius: 0;
}
@media (prefers-reduced-motion: reduce) {
  .scene-loader svg {
    animation-duration: 2.5s;
  }
}
