/*
  IDBox · Caja de Datos (Nix Business) — ESTILOS
  Pareja de idbox_nix_v1.html (archivo canónico, LEY #2: se edita, no se regenera).
  Extraído del monolito en block-02. Contenido idéntico, solo cambió de archivo.
  Paleta y tipografía: webapp_nix.md §1b.
*/

/* ===== ESTILOS GLOBALES & VARIABLES ===== */
:root {
  --void: #030305;
  --void-2: #0a0c10;
  --card: #0e0e13;
  --snow: #f5f5f8;
  --snow-dim: rgba(245, 245, 248, 0.75);
  --ash: #8a8a96;
  --ash-dim: #44444e;
  --line-2: rgba(255, 255, 255, 0.08);
  --nix-cyan: #00f0ff;
  --nix-glow: rgba(0, 240, 255, 0.6);
  --accent-green: #00ff88;
  --grad: linear-gradient(120deg, var(--nix-cyan), #c9b8ff, var(--accent-green));
  --sans: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  background: var(--void);
  color: var(--snow);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px 20px calc(20px + env(safe-area-inset-bottom));
  overflow-x: hidden;
}

/* CÁMARA TRASERA & OVERLAY STARK VISOR */
#cameraFeed {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  display: none;
  pointer-events: none;
}

#visorOverlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 3, 5, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 0;
  display: none;
  pointer-events: none;
}

/* CANVAS DE VUELO LIBRE DE NIX EN ACTO 2 */
#flyCanvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  pointer-events: none;
}

.stage {
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 1;
  min-height: 580px;
  display: flex;
  flex-direction: column;
}

/* ===== ACTO 0: ARRANQUE ===== */
#s0 {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: var(--void);
  cursor: pointer;
  overflow: hidden;
}

#dust {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 1;
}

#arr {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 24px;
  transition: opacity 0.35s;
}

#markWrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: floatY 6.5s ease-in-out infinite;
}

#halo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 205%;
  height: 220%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.34), rgba(214, 240, 255, 0.10) 48%, transparent 76%);
  filter: blur(22px);
  animation: haloBreathe 4.8s ease-in-out infinite;
  pointer-events: none;
}

#idboxMark {
  position: relative;
  width: 4.2cm;
  max-width: 62vw;
  line-height: 0;
  animation: cardBreathe 4.8s ease-in-out infinite;
}

#idboxMark svg {
  width: 100%;
  height: auto;
  display: block;
}

#idboxMark svg rect:not(.cls-1) {
  fill: #0a0a0f;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 5;
}

#idboxMark svg .cls-1 {
  fill: rgba(255, 255, 255, 0.95);
}

@keyframes haloBreathe {
  0%, 100% { opacity: 0.55; transform: translate(-50%, -50%) scale(1); }
  50% { opacity: 0.85; transform: translate(-50%, -50%) scale(1.06); }
}

@keyframes cardBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.014); }
}

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

#brandLine {
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--ash);
}

#brandLine b {
  font-weight: 600;
  color: var(--snow);
}

.cta-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.s0-cta {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 100px;
  color: var(--snow);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 12px 28px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.25s, background 0.25s, transform 0.2s;
  animation: ctaPulse 2.8s ease-in-out infinite;
  will-change: transform;
}

.s0-cta:hover {
  border-color: rgba(0, 240, 255, 0.4);
  background: rgba(0, 240, 255, 0.08);
}

@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
  50% { box-shadow: 0 0 0 6px rgba(0, 240, 255, 0.06); }
}

/* ===== ACTO 1: ESCANEO BIOMÉTRICO HUD ===== */
#s1 {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: var(--void);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
  background-image: 
    radial-gradient(circle at 50% 45%, rgba(0, 240, 255, 0.16) 0%, transparent 65%),
    linear-gradient(rgba(0, 240, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.04) 1px, transparent 1px);
  background-size: 100% 100%, 24px 24px, 24px 24px;
  background-position: center center;
}

.hud-frame {
  width: 220px;
  height: 220px;
  position: relative;
  border: 1px solid rgba(0, 240, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 5, 10, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 35px rgba(0, 240, 255, 0.15);
}

.hud-frame::before, .hud-frame::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border-color: var(--nix-cyan);
  border-style: solid;
}

.hud-frame::before { top: -2px; left: -2px; border-width: 2px 0 0 2px; }
.hud-frame::after { bottom: -2px; right: -2px; border-width: 0 2px 2px 0; }

.avatar-target {
  width: 180px;
  height: 180px;
  border-radius: 12px;
  background: var(--void-2);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.avatar-target img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(60%) contrast(115%);
}

.laser-sweep {
  position: absolute;
  width: 100%;
  height: 3px;
  background: var(--nix-cyan);
  box-shadow: 0 0 15px var(--nix-cyan), 0 0 25px var(--accent-green);
  top: 0;
  animation: sweep 1.8s ease-in-out infinite alternate;
}

@keyframes sweep {
  0% { top: 0%; }
  100% { top: 98%; }
}

.telemetry-text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ash);
  margin-top: 25px;
  letter-spacing: 1px;
  text-align: center;
  line-height: 1.6;
}

.access-granted {
  position: absolute;
  background: var(--accent-green);
  color: #000;
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 11px;
  letter-spacing: 2px;
  padding: 8px 16px;
  border-radius: 4px;
  display: none;
  box-shadow: 0 0 25px var(--accent-green);
  animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* ===== ACTO 2: LA CAJA DE DATOS ===== */
#caja {
  opacity: 0;
  transition: opacity 0.5s;
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

#caja.show {
  opacity: 1;
}

/* NIX EN CASA (PALABRA NIX RESPIRANDO SIN CIRCUNFERENCIA) */
.nix-btn-container {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 25;
}

.nix-home-btn {
  background: transparent;
  border: none;
  padding: 4px 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  outline: none;
}

.nix-word {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  color: #ffffff;
  letter-spacing: 0.8px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  /* mismo ADN que el orbe del arranque: núcleo blanco, halo cian */
  text-shadow: 0 0 8px rgba(255, 255, 255, 0.35), 0 0 18px rgba(0, 240, 255, 0.45);
  transition: opacity 0.25s ease, text-shadow 0.3s ease, font-size 0.3s ease, letter-spacing 0.3s ease;
}

.nix-word::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ffffff;
  flex: none;
  transition: opacity 0.2s ease;
  animation: nixOrbBreathe 3.6s ease-in-out infinite;
}

@keyframes nixOrbBreathe {
  0%, 100% {
    opacity: 0.88;
    box-shadow: 0 0 7px 1px rgba(0, 240, 255, 0.75), 0 0 16px 3px rgba(0, 240, 255, 0.38);
  }
  50% {
    opacity: 1;
    box-shadow: 0 0 11px 2px rgba(0, 240, 255, 1), 0 0 24px 5px rgba(0, 240, 255, 0.58);
  }
}

/* Solo MIENTRAS Nix viaja: su casa no queda vacía — queda la palabra,
   dos puntos más grande y con luz. El ojo vuelve y encuentra la marca. */
.nix-word.out-of-home {
  opacity: 1;
  font-size: 16px;
  letter-spacing: 1.4px;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.55), 0 0 24px rgba(0, 240, 255, 0.5);
}

.nix-word.out-of-home::before {
  opacity: 0;
  animation: none;
  box-shadow: none;
}

.nix-menu {
  position: absolute;
  top: 32px;
  right: 0;
  background: rgba(10, 12, 18, 0.95);
  border: 1px solid var(--nix-cyan);
  border-radius: 14px;
  width: 210px;
  padding: 6px;
  display: none;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 15px rgba(0, 240, 255, 0.15);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 30;
}

.nix-menu.active {
  display: flex;
}

.nix-item {
  background: rgba(255, 255, 255, 0.03);
  border: none;
  color: var(--snow);
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 11px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.nix-item:hover {
  background: rgba(0, 240, 255, 0.15);
}

.greet {
  font-size: 13px;
  color: var(--ash);
  margin-bottom: 16px;
  padding-right: 80px;
}

.owner {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  flex: none;
  position: relative;
  background: var(--void-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 500;
  color: var(--snow);
  box-shadow: 0 0 20px 2px rgba(255, 255, 255, 0.13), 0 6px 18px rgba(0, 0, 0, 0.55);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.avatar::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
  pointer-events: none;
}

.owner h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--snow);
}

.owner p {
  font-size: 13px;
  color: var(--snow-dim);
  font-weight: 400;
  margin-top: 3px;
  letter-spacing: 0.3px;
}

/* Nix Row Conversacional */
.nixrow {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.nixdot {
  min-width: 20px;
  height: 20px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ffffff, var(--nix-cyan) 75%);
  color: var(--void);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  box-shadow: 0 0 12px var(--nix-glow);
}

.nixrow p {
  font-size: 14px;
  line-height: 1.5;
  color: #d6d6de;
}

.caret {
  color: var(--nix-cyan);
}

/* 4 Tarjetas en Retícula */
.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 11px;
  margin-bottom: 18px;
}

.tile {
  background: rgba(12, 13, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--line-2);
  border-radius: 15px;
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
  font-family: inherit;
  font-size: 14px;
  color: #e8e8f0;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s, border-color 0.25s, box-shadow 0.25s;
  opacity: 0;
  transform: translateY(8px);
}

.tile.in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.4s, transform 0.4s, border-color 0.25s, box-shadow 0.25s;
}

.tile:hover {
  border-color: rgba(0, 240, 255, 0.4);
}

.tile:active {
  transform: scale(0.97);
}

.tile svg {
  width: 22px;
  height: 22px;
  color: var(--nix-cyan);
}

.access-granted-card {
  border-color: var(--accent-green) !important;
  box-shadow: 0 0 25px rgba(0, 255, 136, 0.6), inset 0 0 15px rgba(0, 255, 136, 0.25) !important;
  transform: scale(1.02) !important;
}

/* LÍNEA DE TERMINAL CON LOGS EN BLANCO PURO */
.terminal-line {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--snow);
  text-align: left;
  padding: 8px 0;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  min-height: 30px;
}

#termText {
  letter-spacing: 0.5px;
  color: var(--snow);
}

.cursor {
  display: inline-block;
  width: 7px;
  height: 14px;
  background-color: var(--nix-cyan);
  vertical-align: middle;
  margin-left: 4px;
  animation: blink 0.8s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* BOTÓN CTA PRO "VER TARJETAS" (DESCANSO VISUAL MONOCROMÁTICO APPLE) */
.cta-cards-btn {
  width: 100%;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px 20px;
  color: var(--snow);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: all 0.3s ease;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  margin-bottom: 18px;
}

.cta-cards-btn:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.06);
}

.cta-cards-btn:active {
  transform: scale(0.98);
}

.cta-cards-btn svg {
  width: 18px;
  height: 18px;
  color: var(--ash);
  transition: color 0.3s ease;
}

.cta-cards-btn:hover svg {
  color: var(--snow);
}

/* Formulario Handshake Inline */
.lead {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.45s ease;
}

.lead.open {
  max-height: 240px;
}

.lead-inner {
  padding-top: 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
}

.lead input {
  font-family: inherit;
  font-size: 14px;
  color: var(--snow);
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 13px 14px;
}

.lead input::placeholder {
  color: var(--ash-dim);
}

.lead input:focus {
  outline: none;
  border-color: var(--nix-cyan);
}

.lead .send {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--void);
  background: var(--grad);
  border: none;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
}

.lead .send:active {
  transform: scale(0.985);
}

.lead-ok {
  font-size: 13px;
  color: transparent;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  display: none;
  text-align: center;
  padding: 8px;
}

.foot {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.replay {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 12px;
  color: var(--ash-dim);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

.replay:hover {
  color: var(--ash);
}

.replay svg {
  width: 13px;
  height: 13px;
}

.brand {
  font-size: 11px;
  color: var(--ash-dim);
}

.brand b {
  font-weight: 500;
  color: #6b6b75;
}

#toast {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: 20px;
  max-width: 338px;
  margin: 0 auto;
  background: #15151d;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 12px 15px;
  font-size: 13px;
  color: #e8e8f0;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.3s;
  pointer-events: none;
  text-align: center;
  z-index: 9;
}

#toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  #s0, #s1 { display: none; }
  #caja { opacity: 1; }
  .tile { opacity: 1; transform: none; }
  .caret { display: none; }
}
