/* =========================================================
   AMERICAN SECURITY — CAJA FUERTE WIREFRAME 3D
   Bloque autocontenido para widget HTML de Elementor
========================================================= */

#as-wire-safe {
  --bg1: #03152f;
  --bg2: #062b58;
  --line: #42c8ff;
  --gold: #ffc84e;

  position: relative;
  width: 100%;
  height: 620vh;
  isolation: isolate;
  font-family: Arial, Helvetica, sans-serif;
}

#as-wire-safe * {
  box-sizing: border-box;
}

#as-wire-safe .as-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  min-height: 650px;
  overflow: hidden;
  display: flex;
  align-items: center;
  color: white;
  background:
    radial-gradient(circle at 76% 45%, rgba(0,157,255,.22), transparent 28%),
    radial-gradient(circle at 70% 60%, rgba(0,71,170,.24), transparent 38%),
    linear-gradient(135deg, #03152f, #062b58 52%, #020d20);
}

#as-wire-safe .as-grid {
  width: min(1280px, 92%);
  margin: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 60px;
}

/* TEXTO */

#as-wire-safe .as-copy {
  position: relative;
  z-index: 20;
}

#as-wire-safe .as-kicker {
  color: #75d8ff;
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 20px;
}

#as-wire-safe .as-kicker::before {
  content: "";
  display: inline-block;
  width: 38px;
  height: 2px;
  margin-right: 12px;
  vertical-align: middle;
  background: var(--gold);
}

#as-wire-safe h2 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(43px, 5vw, 78px);
  line-height: .98;
  letter-spacing: -.045em;
}

#as-wire-safe h2 span {
  color: #59cfff;
  text-shadow: 0 0 25px rgba(66,200,255,.32);
}

#as-wire-safe .as-description {
  max-width: 580px;
  margin-top: 26px;
  color: rgba(255,255,255,.75);
  font-size: clamp(17px, 1.4vw, 21px);
  line-height: 1.65;
}

#as-wire-safe .as-head-stack {
  display: grid;
  width: 100%;
}

#as-wire-safe .as-story-head {
  grid-area: 1 / 1;
  width: 100%;
  align-self: start;
}

#as-wire-safe .as-story-head-door {
  opacity: 0;
  visibility: hidden;
  transform: translateY(14px);
  transition: opacity .35s ease, transform .35s ease, visibility .35s ease;
  pointer-events: none;
}

#as-wire-safe .as-story-head-safe {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity .35s ease, transform .35s ease, visibility .35s ease;
}

#as-wire-safe.is-door-story .as-story-head-safe {
  opacity: 0;
  visibility: hidden;
  transform: translateY(-14px);
  pointer-events: none;
}

#as-wire-safe.is-door-story .as-story-head-door {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

#as-wire-safe .as-stage-copy {
  position: relative;
  min-height: 90px;
  margin-top: 30px;
}

#as-wire-safe .as-message {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  transform: translateY(18px);
  transition: .4s ease;
}

#as-wire-safe .as-message.active {
  opacity: 1;
  transform: translateY(0);
}

#as-wire-safe .as-message strong {
  display: block;
  margin-bottom: 8px;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 13px;
}

#as-wire-safe .as-message span {
  color: rgba(255,255,255,.92);
  font-size: 18px;
}

#as-wire-safe .as-cta {
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  margin-top: 22px;
  padding: 0 25px;
  border: 1px solid rgba(66,200,255,.45);
  border-radius: 12px;
  background: rgba(16,104,170,.13);
  color: white;
  text-decoration: none;
  font-weight: 700;
}

/* ESCENA */

#as-wire-safe .as-scene {
  position: relative;
  height: 610px;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1200px;
  perspective-origin: 50% 45%;
}

#as-wire-safe .safe3d,
#as-wire-safe .security-door3d {
  transition: opacity .34s ease;
}

#as-wire-safe .as-orbit {
  position: absolute;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  border: 1px solid rgba(66,200,255,.10);
  box-shadow:
    0 0 60px rgba(30,155,255,.05),
    inset 0 0 60px rgba(30,155,255,.03);
  transform: rotateX(70deg);
}

#as-wire-safe .as-orbit::before,
#as-wire-safe .as-orbit::after {
  content: "";
  position: absolute;
  inset: 50%;
  transform: translate(-50%,-50%);
  border-radius: 50%;
  border: 1px dashed rgba(66,200,255,.12);
}

#as-wire-safe .as-orbit::before {
  width: 360px;
  height: 360px;
}

#as-wire-safe .as-orbit::after {
  width: 230px;
  height: 230px;
}

/* CAJA 3D */

#as-wire-safe .safe3d {
  --w: 300px;
  --h: 350px;
  --d: 170px;

  position: relative;
  width: var(--w);
  height: var(--h);
  transform-style: preserve-3d;
  transform:
    rotateX(-10deg)
    rotateY(-25deg)
    translateY(0);
  will-change: transform;
}

#as-wire-safe .safe-face {
  position: absolute;
  background: rgba(3,24,49,.07);
  border: 2px solid var(--line);
  box-shadow:
    inset 0 0 22px rgba(66,200,255,.06),
    0 0 11px rgba(66,200,255,.25);
  backface-visibility: visible;
}

#as-wire-safe .face-front {
  width: var(--w);
  height: var(--h);
  transform: translateZ(calc(var(--d) / 2));
}

#as-wire-safe .face-back {
  width: var(--w);
  height: var(--h);
  transform:
    rotateY(180deg)
    translateZ(calc(var(--d) / 2));
}

#as-wire-safe .face-right {
  width: var(--d);
  height: var(--h);
  left: calc((var(--w) - var(--d)) / 2);
  transform:
    rotateY(90deg)
    translateZ(calc(var(--w) / 2));
}

#as-wire-safe .face-left {
  width: var(--d);
  height: var(--h);
  left: calc((var(--w) - var(--d)) / 2);
  transform:
    rotateY(-90deg)
    translateZ(calc(var(--w) / 2));
}

#as-wire-safe .face-top {
  width: var(--w);
  height: var(--d);
  top: calc((var(--h) - var(--d)) / 2);
  transform:
    rotateX(90deg)
    translateZ(calc(var(--h) / 2));
}

#as-wire-safe .face-bottom {
  width: var(--w);
  height: var(--d);
  top: calc((var(--h) - var(--d)) / 2);
  transform:
    rotateX(-90deg)
    translateZ(calc(var(--h) / 2));
}

/* LÍNEAS TÉCNICAS */

#as-wire-safe .tech-line {
  position: absolute;
  pointer-events: none;
}

#as-wire-safe .line-v1,
#as-wire-safe .line-v2 {
  top: 15px;
  bottom: 15px;
  width: 1px;
  background: rgba(66,200,255,.20);
}

#as-wire-safe .line-v1 {
  left: 25%;
}

#as-wire-safe .line-v2 {
  right: 25%;
}

#as-wire-safe .line-h1,
#as-wire-safe .line-h2 {
  left: 15px;
  right: 15px;
  height: 1px;
  background: rgba(66,200,255,.18);
}

#as-wire-safe .line-h1 {
  top: 33%;
}

#as-wire-safe .line-h2 {
  bottom: 33%;
}

/* INTERIOR */

#as-wire-safe .safe-inner {
  position: absolute;
  left: 24px;
  top: 25px;
  width: 252px;
  height: 300px;
  transform: translateZ(87px);
  border: 1px solid rgba(66,200,255,.45);
  background: rgba(66,200,255,.02);
  overflow: hidden;
}

#as-wire-safe .shelf {
  position: absolute;
  left: 14px;
  right: 14px;
  height: 1px;
  background: var(--line);
  box-shadow: 0 0 8px rgba(66,200,255,.5);
}

#as-wire-safe .shelf.one {
  top: 100px;
}

#as-wire-safe .shelf.two {
  top: 200px;
}

/* PUERTA */

#as-wire-safe .safe-door {
  position: absolute;
  left: 18px;
  top: 19px;
  width: 264px;
  height: 312px;
  transform-origin: left center;
  transform-style: preserve-3d;
  transform:
    translateZ(89px)
    rotateY(0deg);
  border: 2px solid #75dcff;
  background: rgba(6,47,86,.08);
  box-shadow:
    inset 0 0 28px rgba(66,200,255,.07),
    0 0 15px rgba(66,200,255,.35);
}

#as-wire-safe .safe-door::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(66,200,255,.35);
}

#as-wire-safe .hinge {
  position: absolute;
  left: -7px;
  width: 11px;
  height: 43px;
  border: 1px solid #52ceff;
  border-radius: 5px;
  background: rgba(66,200,255,.08);
}

#as-wire-safe .hinge.h1 {
  top: 55px;
}

#as-wire-safe .hinge.h2 {
  bottom: 55px;
}

/* CERRADURA */

#as-wire-safe .lock-ring {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 112px;
  height: 112px;
  transform: translate(-50%,-50%);
  border: 2px solid var(--line);
  border-radius: 50%;
}

#as-wire-safe .lock-ring::before,
#as-wire-safe .lock-ring::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 82px;
  height: 2px;
  background: #6ad8ff;
  transform: translate(-50%,-50%);
}

#as-wire-safe .lock-ring::after {
  transform: translate(-50%,-50%) rotate(90deg);
}

#as-wire-safe .lock-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  transform: translate(-50%,-50%);
}

/* JOYAS */

#as-wire-safe .treasures {
  position: absolute;
  inset: 0;
  opacity: 0;
  transform: translateY(24px) scale(.8);
  transition:
    opacity .45s ease,
    transform .55s cubic-bezier(.2,.8,.2,1);
}

#as-wire-safe .treasures.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

#as-wire-safe .diamond {
  position: absolute;
  width: 48px;
  height: 48px;
  border: 2px solid var(--gold);
  transform: rotate(45deg);
  box-shadow: 0 0 10px rgba(255,200,78,.65);
}

#as-wire-safe .diamond.d1 {
  left: 38px;
  top: 31px;
}

#as-wire-safe .diamond.d2 {
  left: 145px;
  top: 136px;
  transform: rotate(45deg) scale(.68);
}

#as-wire-safe .necklace {
  position: absolute;
  left: 135px;
  top: 35px;
  width: 70px;
  height: 78px;
  border: 2px solid var(--gold);
  border-top-color: transparent;
  border-radius: 50%;
  transform: rotate(-8deg);
}

/* PUERTA DE ALTA SEGURIDAD 3D */

#as-wire-safe .security-door3d {
  --dw: 280px;
  --dh: 420px;
  --fd: 70px;
  --leaf-w: 238px;
  --leaf-h: 378px;
  --leaf-d: 34px;

  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--dw);
  height: var(--dh);
  margin-left: calc(var(--dw) / -2);
  margin-top: calc(var(--dh) / -2);
  transform-style: preserve-3d;
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

/* Marco frontal y trasero: dos rectángulos separados en profundidad */
#as-wire-safe .door-frame-front,
#as-wire-safe .door-frame-back {
  position: absolute;
  inset: 0;
  border: 3px solid var(--line);
  box-shadow:
    0 0 14px rgba(66,200,255,.28),
    inset 0 0 18px rgba(66,200,255,.05);
  background: rgba(3,24,49,.025);
  pointer-events: none;
}

#as-wire-safe .door-frame-front {
  transform: translateZ(calc(var(--fd) / 2));
}

#as-wire-safe .door-frame-back {
  transform: translateZ(calc(var(--fd) / -2));
}

/* Profundidad real del marco */
#as-wire-safe .door-frame-side {
  position: absolute;
  background: rgba(3,24,49,.04);
  border: 1px solid rgba(66,200,255,.68);
  box-shadow: inset 0 0 12px rgba(66,200,255,.04);
}

#as-wire-safe .dfs-left,
#as-wire-safe .dfs-right {
  top: 0;
  width: var(--fd);
  height: 100%;
}

#as-wire-safe .dfs-left {
  left: calc(var(--fd) / -2);
  transform: rotateY(90deg);
}

#as-wire-safe .dfs-right {
  right: calc(var(--fd) / -2);
  transform: rotateY(90deg);
}

#as-wire-safe .dfs-top,
#as-wire-safe .dfs-bottom {
  left: 0;
  width: 100%;
  height: var(--fd);
}

#as-wire-safe .dfs-top {
  top: calc(var(--fd) / -2);
  transform: rotateX(90deg);
}

#as-wire-safe .dfs-bottom {
  bottom: calc(var(--fd) / -2);
  transform: rotateX(90deg);
}

/* Líneas interiores del marco para reforzar el wireframe */
#as-wire-safe .door-frame-front::before,
#as-wire-safe .door-frame-back::before {
  content: "";
  position: absolute;
  inset: 13px;
  border: 1px solid rgba(66,200,255,.26);
}

/* Hoja completa como prisma 3D */
#as-wire-safe .security-door-leaf {
  position: absolute;
  left: 21px;
  top: 21px;
  width: var(--leaf-w);
  height: var(--leaf-h);
  transform-origin: left center;
  transform-style: preserve-3d;
  transform: translateZ(calc(var(--fd) / 2 + 3px)) rotateY(0deg);
  will-change: transform;
}

#as-wire-safe .door-leaf-face {
  position: absolute;
  border: 2px solid #75dcff;
  background: rgba(6,47,86,.055);
  box-shadow:
    inset 0 0 22px rgba(66,200,255,.05),
    0 0 13px rgba(66,200,255,.24);
  backface-visibility: visible;
}

#as-wire-safe .door-leaf-front,
#as-wire-safe .door-leaf-back {
  width: var(--leaf-w);
  height: var(--leaf-h);
}

#as-wire-safe .door-leaf-front {
  transform: translateZ(calc(var(--leaf-d) / 2));
}

#as-wire-safe .door-leaf-back {
  transform: rotateY(180deg) translateZ(calc(var(--leaf-d) / 2));
}

#as-wire-safe .door-leaf-right,
#as-wire-safe .door-leaf-left {
  width: var(--leaf-d);
  height: var(--leaf-h);
  left: calc((var(--leaf-w) - var(--leaf-d)) / 2);
}

#as-wire-safe .door-leaf-right {
  transform: rotateY(90deg) translateZ(calc(var(--leaf-w) / 2));
}

#as-wire-safe .door-leaf-left {
  transform: rotateY(-90deg) translateZ(calc(var(--leaf-w) / 2));
}

#as-wire-safe .door-leaf-top,
#as-wire-safe .door-leaf-bottom {
  width: var(--leaf-w);
  height: var(--leaf-d);
  top: calc((var(--leaf-h) - var(--leaf-d)) / 2);
}

#as-wire-safe .door-leaf-top {
  transform: rotateX(90deg) translateZ(calc(var(--leaf-h) / 2));
}

#as-wire-safe .door-leaf-bottom {
  transform: rotateX(-90deg) translateZ(calc(var(--leaf-h) / 2));
}

/* Panel técnico frontal */
#as-wire-safe .door-panel-line {
  position: absolute;
  pointer-events: none;
  background: rgba(66,200,255,.18);
}

#as-wire-safe .dpl-v1,
#as-wire-safe .dpl-v2 {
  top: 16px;
  bottom: 16px;
  width: 1px;
}

#as-wire-safe .dpl-v1 { left: 30%; }
#as-wire-safe .dpl-v2 { right: 30%; }

#as-wire-safe .dpl-h1,
#as-wire-safe .dpl-h2 {
  left: 16px;
  right: 16px;
  height: 1px;
}

#as-wire-safe .dpl-h1 { top: 33%; }
#as-wire-safe .dpl-h2 { bottom: 33%; }

/* Cerradura / llave */
#as-wire-safe .security-lock {
  position: absolute;
  right: 34px;
  top: 50%;
  width: 58px;
  height: 58px;
  transform: translateY(-50%) translateZ(calc(var(--leaf-d) / 2 + 2px));
  border: 2px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 0 11px rgba(66,200,255,.30);
  transform-style: preserve-3d;
}

#as-wire-safe .security-lock-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 13px;
  height: 13px;
  transform: translate(-50%,-50%);
  border: 2px solid var(--gold);
  border-radius: 50%;
}

#as-wire-safe .security-key {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 55px;
  height: 5px;
  transform-origin: 4px 50%;
  transform: translate(0,-50%) rotate(0deg);
  border-radius: 4px;
  background: var(--gold);
  box-shadow: 0 0 8px rgba(255,200,78,.55);
  will-change: transform;
}

#as-wire-safe .security-key::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  width: 24px;
  height: 24px;
  transform: translateY(-50%);
  border: 4px solid var(--gold);
  border-radius: 50%;
}

#as-wire-safe .security-key::after {
  content: "";
  position: absolute;
  right: -6px;
  top: -6px;
  width: 12px;
  height: 16px;
  border-right: 4px solid var(--gold);
  border-bottom: 4px solid var(--gold);
}

/* Cerrojos visibles sobre el canto derecho */
#as-wire-safe .security-bolt {
  position: absolute;
  right: -29px;
  width: 44px;
  height: 9px;
  border: 1px solid #75dcff;
  background: rgba(66,200,255,.17);
  box-shadow: 0 0 7px rgba(66,200,255,.28);
  transform: translateX(0);
  will-change: transform;
}

#as-wire-safe .security-bolt.b1 { top: 62px; }
#as-wire-safe .security-bolt.b2 { top: 124px; }
#as-wire-safe .security-bolt.b3 { top: 186px; }
#as-wire-safe .security-bolt.b4 { top: 248px; }
#as-wire-safe .security-bolt.b5 { top: 310px; }

#as-wire-safe .security-handle {
  position: absolute;
  right: 29px;
  top: calc(50% + 64px);
  width: 48px;
  height: 13px;
  transform: translateZ(calc(var(--leaf-d) / 2 + 2px));
  border: 2px solid #75dcff;
  border-radius: 10px;
  box-shadow: 0 0 7px rgba(66,200,255,.22);
}

/* Indicador técnico de profundidad */
#as-wire-safe .door-depth-line {
  position: absolute;
  left: 50%;
  bottom: -48px;
  width: 180px;
  height: 1px;
  transform: translateX(-50%);
  background: rgba(66,200,255,.34);
}

#as-wire-safe .door-depth-line::before,
#as-wire-safe .door-depth-line::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 1px;
  height: 11px;
  background: rgba(66,200,255,.52);
}

#as-wire-safe .door-depth-line::before { left: 0; }
#as-wire-safe .door-depth-line::after { right: 0; }

/* INDICADOR */

#as-wire-safe .as-progress {
  position: absolute;
  right: 32px;
  top: 50%;
  z-index: 40;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 13px;
}

#as-wire-safe .as-dot {
  width: 7px;
  height: 7px;
  border-radius: 10px;
  background: rgba(255,255,255,.23);
  transition: .3s ease;
}

#as-wire-safe .as-dot.active {
  height: 34px;
  background: var(--gold);
}

/* RESPONSIVE */

@media(max-width:900px) {

  #as-wire-safe {
    height: 620vh;
  }

  #as-wire-safe .as-sticky {
    min-height: 100svh;
    align-items: flex-start;
    padding-top: 42px;
  }

  #as-wire-safe .as-grid {
    width: 90%;
    grid-template-columns: 1fr;
    gap: 5px;
  }

  #as-wire-safe h2 {
    font-size: clamp(38px,10vw,54px);
  }

  #as-wire-safe .as-description {
    margin-top: 15px;
    font-size: 15px;
    line-height: 1.5;
  }

  #as-wire-safe .as-stage-copy {
    min-height: 63px;
    margin-top: 16px;
  }

  #as-wire-safe .as-message span {
    font-size: 14px;
  }

  #as-wire-safe .as-cta {
    min-height: 44px;
    margin-top: 10px;
  }

  /* AQUÍ ESTÁ EL AJUSTE */
  #as-wire-safe .as-scene {
    height: 355px;
    margin-top: 20px;
    transform: scale(.70);
    transform-origin: top center;
  }

  #as-wire-safe .as-progress {
    right: 12px;
  }
}

/* =========================================================
   INTEGRACIÓN CON EL HEADER FIJO DEL SITIO
   Mantiene la historia 3D completamente visible debajo del menú.
========================================================= */
#as-wire-safe .as-sticky {
  top: var(--header-h, 0px);
  height: calc(100vh - var(--header-h, 0px));
  height: calc(100svh - var(--header-h, 0px));
  min-height: 0;
}

/* Cambios de texto más limpios: evita textos fantasma al detener el scroll. */
#as-wire-safe .as-story-head-safe,
#as-wire-safe .as-story-head-door {
  transition: opacity .20s ease, transform .20s ease, visibility 0s linear .20s;
}
#as-wire-safe .as-story-head-safe,
#as-wire-safe.is-door-story .as-story-head-door {
  transition-delay: 0s;
}
#as-wire-safe .as-message {
  visibility: hidden;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}
#as-wire-safe .as-message.active {
  visibility: visible;
  transition-delay: 0s;
}

@media(max-width:900px) {
  #as-wire-safe .as-sticky {
    min-height: 0;
    padding-top: 22px;
  }
}

@media(max-width:900px) and (max-height:740px) {
  #as-wire-safe .as-sticky {
    padding-top: 12px;
  }
  #as-wire-safe h2 {
    font-size: clamp(32px, 8.6vw, 45px);
  }
  #as-wire-safe .as-description {
    margin-top: 10px;
    font-size: 14px;
  }
  #as-wire-safe .as-stage-copy {
    margin-top: 10px;
  }
  #as-wire-safe .as-scene {
    height: 325px;
    margin-top: 8px;
    transform: scale(.58);
  }
}

/* Una sola capa de texto visible a la vez para evitar duplicados durante scroll rápido. */
#as-wire-safe .as-story-head-safe,
#as-wire-safe .as-story-head-door {
  transition: opacity .16s ease, transform .16s ease;
}
#as-wire-safe .as-message {
  transition: opacity .16s ease, transform .16s ease;
}
