/* =========================================================
   Muralla 360 — Acceso
   ---------------------------------------------------------
   El "360" no es un adorno: es la promesa del portal. Por eso
   el elemento protagonista es un anillo que gira de verdad, con
   los módulos orbitando alrededor del logo. Todo lo demás se
   mantiene quieto para que ese giro sea lo único que se mueva.

   La paleta sale del logo (azules #1B4F8A / #2970A8 / #78B8DB)
   llevada a un rango amplio: del abismo al destello.
   ========================================================= */

:root {
  --abismo:   #040D1A;
  --profundo: #0A2240;
  --muralla:  #1B4F8A;
  --medio:    #2970A8;
  --claro:    #78B8DB;
  --luz:      #A8D4EC;
  --destello: #E8F4FC;

  --alerta:   #E8705E;

  --display: "Sora", -apple-system, BlinkMacSystemFont, sans-serif;
  --ui:      "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;

  --curva: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--abismo);
  color: var(--destello);
  font-family: var(--ui);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.portal {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
}

/* =========================================================
   Escena 360
   ========================================================= */

.escena {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(130% 100% at 30% 20%, #10395F 0%, transparent 58%),
    radial-gradient(90% 80% at 75% 85%, #0C2A4A 0%, transparent 60%),
    linear-gradient(165deg, var(--profundo) 0%, var(--abismo) 70%);
}

/* Video opcional: se atenúa para que la escena siga legible encima */
.escena-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: .34;
  filter: saturate(.75) contrast(1.05);
}
.escena-velo {
  position: absolute; inset: 0;
  background:
    radial-gradient(70% 60% at 50% 50%, rgba(4,13,26,.18) 0%, rgba(4,13,26,.86) 100%),
    linear-gradient(165deg, rgba(10,34,64,.62), rgba(4,13,26,.9));
}

/* Campo de puntos con profundidad, dibujado en canvas */
.campo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: .72;
}

/* Línea de horizonte: da suelo a la escena */
.horizonte {
  position: absolute;
  left: -20%; right: -20%; bottom: -34%;
  height: 72%;
  background-image:
    linear-gradient(rgba(120,184,219,.11) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120,184,219,.11) 1px, transparent 1px);
  background-size: 58px 58px;
  transform: perspective(620px) rotateX(70deg);
  transform-origin: bottom center;
  mask-image: linear-gradient(to top, #000 4%, transparent 72%);
  -webkit-mask-image: linear-gradient(to top, #000 4%, transparent 72%);
}

/* Resplandor que respira detrás del anillo */
.pulso {
  position: absolute;
  width: 640px; height: 640px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle,
    rgba(41,112,168,.40) 0%,
    rgba(27,79,138,.16) 42%,
    transparent 68%);
  filter: blur(18px);
  animation: respirar 11s ease-in-out infinite;
}

@keyframes respirar {
  0%, 100% { opacity: .62; transform: translate(-50%,-50%) scale(1); }
  50%      { opacity: 1;   transform: translate(-50%,-50%) scale(1.13); }
}

/* ---------------- El anillo ---------------- */

.orbita {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  perspective: 1500px;
  perspective-origin: 50% 46%;
}

.anillo {
  /* Radio y tamaño de panel como variables: así el anillo se encoge en
     pantallas pequeñas sin tocar el transform, que lo controla la
     animación de giro. */
  --radio: 298px;
  --panel-w: 232px;
  --panel-h: 128px;

  position: relative;
  width: var(--panel-w);
  height: var(--panel-h);
  transform-style: preserve-3d;
  /* Inclinado para que se vea como un anillo y no como una línea */
  transform: rotateX(-20deg) rotateY(0deg);
  animation: girar 38s linear infinite;
}

@keyframes girar {
  from { transform: rotateX(-20deg) rotateY(0deg); }
  to   { transform: rotateX(-20deg) rotateY(360deg); }
}

/* Ocho paneles repartidos a 45°, empujados hacia afuera en Z */
.panel {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: rotateY(calc(var(--i) * 45deg)) translateZ(var(--radio));
}

/* Cada panel lleva dos caras idénticas, la trasera girada 180°. Así el
   anillo se ve entero mientras gira y el texto nunca sale en espejo. */
.cara {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  padding: 18px 20px;

  background: linear-gradient(150deg,
    rgba(120,184,219,.14) 0%,
    rgba(27,79,138,.20) 100%);
  border: 1px solid rgba(168,212,236,.26);
  border-radius: 13px;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow:
    0 0 0 1px rgba(4,13,26,.3),
    0 20px 48px rgba(4,13,26,.5),
    inset 0 1px 0 rgba(232,244,252,.14);

  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.cara-dorso {
  transform: rotateY(180deg);
  /* Un punto más tenue: el fondo del anillo debe quedar por detrás */
  opacity: .82;
}

.panel-n {
  font-family: var(--display);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--destello);
}
.panel-s {
  font-size: 11.5px;
  font-weight: 500;
  color: rgba(168,212,236,.78);
  line-height: 1.35;
}

/* ---------------- Núcleo ---------------- */

.nucleo {
  position: absolute;
  width: 190px; height: 190px;
  display: grid;
  place-items: center;
  z-index: 3;
  /* Elevado sobre el plano del anillo: el logo manda, y los paneles
     giran por debajo sin taparlo. */
  transform: translateY(-62px);
}

.nucleo-marca {
  width: 104px;
  height: auto;
  filter: drop-shadow(0 6px 26px rgba(4,13,26,.75));
  animation: entrarNucleo 1.3s var(--curva) both;
}

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

.nucleo-aro {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  transform: rotate(-90deg);
}
.aro-base {
  fill: none;
  stroke: rgba(168,212,236,.16);
  stroke-width: 1.5;
}
.aro-trazo {
  fill: none;
  stroke: var(--claro);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-dasharray: 145 433;
  animation: barrer 5.5s linear infinite;
  filter: drop-shadow(0 0 7px rgba(120,184,219,.75));
}
@keyframes barrer {
  from { stroke-dashoffset: 0; }
  to   { stroke-dashoffset: -578; }
}

/* =========================================================
   Acceso
   ========================================================= */

.acceso {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 34px;
  padding: 52px 56px;
  background:
    linear-gradient(200deg, rgba(10,34,64,.52) 0%, rgba(4,13,26,.9) 100%);
  border-left: 1px solid rgba(168,212,236,.12);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
}

.marca {
  display: flex;
  align-items: center;
  gap: 14px;
  animation: subir .9s var(--curva) both;
}
.marca-logo { width: 52px; height: auto; }
.marca-texto { display: flex; flex-direction: column; gap: 1px; }
.marca-grupo {
  font-size: 11.5px;
  font-weight: 500;
  color: rgba(168,212,236,.66);
}
.marca-nombre {
  margin: 0;
  font-family: var(--display);
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.05;
}
/* El 360 recibe el único tratamiento tipográfico especial de la página */
.trescientos {
  background: linear-gradient(100deg, var(--claro) 0%, var(--destello) 55%, var(--claro) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
}

@keyframes subir {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tarjeta {
  animation: subir .9s var(--curva) .12s both;
}

.bienvenida {
  margin: 0 0 30px;
  font-size: 16px;
  line-height: 1.62;
  color: rgba(232,244,252,.84);
  max-width: 34ch;
}

/* ---------------- Campo ---------------- */

.campo-clave {
  position: relative;
  margin-bottom: 18px;
}

.campo-clave input {
  width: 100%;
  height: 58px;
  padding: 23px 48px 9px 17px;
  font-family: var(--ui);
  font-size: 15.5px;
  font-weight: 500;
  color: var(--destello);
  background: rgba(10,34,64,.5);
  border: 1px solid rgba(168,212,236,.2);
  border-radius: 13px;
  outline: none;
  transition: border-color .3s var(--curva), background .3s var(--curva);
}

.campo-clave input:hover { border-color: rgba(168,212,236,.34); }

.campo-clave input:focus {
  border-color: var(--claro);
  background: rgba(10,34,64,.75);
}

.campo-clave label {
  position: absolute;
  left: 17px;
  top: 19px;
  font-size: 15.5px;
  font-weight: 500;
  color: rgba(168,212,236,.62);
  pointer-events: none;
  transform-origin: left top;
  transition: transform .3s var(--curva), color .3s var(--curva);
}

.campo-clave input:focus + label,
.campo-clave input:not(:placeholder-shown) + label {
  transform: translateY(-12px) scale(.74);
  color: var(--claro);
}

/* Halo de foco: sustituye al típico box-shadow plano */
.campo-halo {
  position: absolute;
  inset: -2px;
  border-radius: 15px;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(120deg,
    rgba(120,184,219,.5), rgba(41,112,168,.14), rgba(120,184,219,.5));
  filter: blur(7px);
  transition: opacity .35s var(--curva);
  z-index: -1;
}
.campo-clave input:focus ~ .campo-halo { opacity: 1; }

.ojo {
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: none;
  border-radius: 9px;
  color: rgba(168,212,236,.6);
  cursor: pointer;
  transition: color .2s, background .2s;
}
.ojo:hover { color: var(--destello); background: rgba(168,212,236,.1); }
.ojo:focus-visible { outline: 2px solid var(--claro); outline-offset: 2px; }

/* ---------------- Botón ---------------- */

.entrar {
  position: relative;
  width: 100%;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  overflow: hidden;
  font-family: var(--ui);
  font-size: 15.5px;
  font-weight: 700;
  color: var(--abismo);
  background: linear-gradient(118deg, var(--luz) 0%, var(--destello) 48%, var(--claro) 100%);
  border: none;
  border-radius: 13px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(41,112,168,.34);
  transition: transform .22s var(--curva), box-shadow .3s var(--curva);
}

.entrar:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(41,112,168,.46);
}
.entrar:active { transform: translateY(0) scale(.99); }
.entrar:focus-visible { outline: 2px solid var(--destello); outline-offset: 3px; }

.entrar-barrido {
  position: absolute;
  top: 0; left: -65%;
  width: 42%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.72), transparent);
  transform: skewX(-20deg);
  transition: left .62s var(--curva);
}
.entrar:hover .entrar-barrido { left: 125%; }

.entrar-texto, .entrar-flecha {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  transition: transform .28s var(--curva), opacity .2s;
}
.entrar:hover .entrar-flecha { transform: translateX(4px); }

.entrar-girando {
  position: absolute;
  width: 20px; height: 20px;
  border: 2.5px solid rgba(4,13,26,.3);
  border-top-color: var(--abismo);
  border-radius: 50%;
  opacity: 0;
  animation: rodar .7s linear infinite;
}
@keyframes rodar { to { transform: rotate(360deg); } }

.entrar.cargando { pointer-events: none; }
.entrar.cargando .entrar-texto,
.entrar.cargando .entrar-flecha { opacity: 0; transform: scale(.9); }
.entrar.cargando .entrar-girando { opacity: 1; }

/* ---------------- Alerta ---------------- */

.alerta {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  padding: 12px 15px;
  font-size: 13.5px;
  font-weight: 500;
  color: #FFD9D3;
  background: rgba(232,112,94,.14);
  border-left: 2px solid var(--alerta);
  border-radius: 0 9px 9px 0;
  animation: sacudir .45s var(--curva);
}

@keyframes sacudir {
  0%, 100% { transform: translateX(0); }
  22%      { transform: translateX(-6px); }
  55%      { transform: translateX(5px); }
  80%      { transform: translateX(-2px); }
}

.nota {
  margin: 24px 0 0;
  font-size: 12px;
  color: rgba(168,212,236,.5);
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1080px) {
  .portal { grid-template-columns: 1fr; }
  .escena { min-height: 46vh; order: -1; }
  .acceso {
    border-left: none;
    border-top: 1px solid rgba(168,212,236,.12);
    padding: 40px 32px 52px;
  }
  .anillo {
    --radio: 206px; --panel-w: 164px; --panel-h: 100px;
    transform: rotateX(-23deg);
  }
  @keyframes girar {
    from { transform: rotateX(-23deg) rotateY(0deg); }
    to   { transform: rotateX(-23deg) rotateY(360deg); }
  }
  .nucleo { transform: translateY(-46px) scale(.82); }
  .panel-n { font-size: 16px; }
  .panel-s { font-size: 10.5px; }
  .pulso { width: 460px; height: 460px; }
}

@media (max-width: 640px) {
  body { overflow-y: auto; }
  .escena { min-height: 38vh; }
  .orbita { perspective: 1150px; }
  /* El anillo mide 298px de radio: en una pantalla de 390px hay que
     encogerlo bastante para que quepa entero, con aire alrededor. */
  .anillo {
    --radio: 132px; --panel-w: 108px; --panel-h: 70px;
    transform: rotateX(-28deg);
  }
  @keyframes girar {
    from { transform: rotateX(-28deg) rotateY(0deg); }
    to   { transform: rotateX(-28deg) rotateY(360deg); }
  }
  .nucleo { transform: translateY(-26px) scale(.6); }
  .cara { padding: 9px 11px; gap: 2px; border-radius: 9px; }
  .panel-n { font-size: 12.5px; }
  .panel-s { font-size: 8.5px; }
  .pulso { width: 300px; height: 300px; }
  .horizonte { display: none; }
  .acceso { padding: 30px 22px 44px; gap: 24px; }
  .marca-nombre { font-size: 23px; }
  .marca-logo { width: 44px; }
  .bienvenida { font-size: 15px; margin-bottom: 24px; }
}

@media (max-width: 430px) {
  .anillo { --radio: 112px; --panel-w: 94px; --panel-h: 62px; }
  .escena { min-height: 34vh; }
}

/* Quien prefiere menos movimiento ve la misma escena, quieta */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .anillo { transform: rotateX(-20deg) rotateY(-18deg) !important; }
  .pulso { opacity: .8; }
  .aro-trazo { stroke-dashoffset: -120; }
}
