/* =========================================================
   SBIS — style.css
   Tokens y estructura general
   ========================================================= */

:root {
  --bg-color: #050d1a;
  --bg-color-alt: #080f20;
  --text-primary: #e2eaf5;
  --text-secondary: #8ba3c7;
  --text-faint: #4a6080;
  --accent-color: #3da9fc;

  --border-color: rgba(61, 169, 252, 0.12);
  --border-color-strong: rgba(61, 169, 252, 0.25);
  --font-main: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --stage-padding: 15vh 6%;
  --header-height: 72px;
}

* { box-sizing: border-box; }

/* Canvas de partículas fijo como fondo global */
#plexo-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  display: block;
}

/* Seguridad: el texto nunca debe desbordar su contenedor */
img, svg { max-width: 100%; }
h1, h2, h3, p, blockquote, li, small { overflow-wrap: break-word; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  overflow-x: hidden;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-weight: 400;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

html {
  background: var(--bg-color);
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }

/* =========================================================
   HEADER
   ========================================================= */

.main-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6%;
  z-index: 100;
  background: rgba(5, 13, 26, 0.75);
  backdrop-filter: blur(14px);
  border-bottom: 0.5px solid var(--border-color);
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 3px;
}

.logo-symbol {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 13px;
  color: var(--text-secondary);
}

.main-nav a { transition: color 0.2s ease; }
.main-nav a:hover { color: var(--text-primary); }

.btn-pill {
  border: 0.5px solid rgba(0, 242, 255, 0.4);
  color: var(--accent-color) !important;
  padding: 8px 20px;
  border-radius: 20px;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.btn-pill:hover {
  background: rgba(0, 242, 255, 0.08);
  border-color: var(--accent-color);
}

/* Variante "Mi panel" — relleno sutil para distinguirlo de Contactar */
.btn-pill--panel {
  background: rgba(61, 169, 252, 0.08);
  color: var(--accent-color) !important;
}
.btn-pill--panel:hover {
  background: rgba(61, 169, 252, 0.16);
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}
.nav-toggle span {
  width: 20px; height: 1.5px;
  background: var(--text-primary);
}

/* =========================================================
   HERO / INTRO SEQUENCE
   ========================================================= */

.hero {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: calc(var(--header-height) + 4vh) 6% 4vh;
}

.intro-sequence {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: none;
}

.intro-step {
  position: absolute;
  width: 100%;
  text-align: center;
  padding: 0 20px;
  opacity: 0;
  color: var(--text-primary);
  z-index: 10; /* Aseguramos que el texto de la intro esté por encima */
}

.text-question {
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  font-weight: 300;
  color: var(--text-primary);
  margin: 0;
}

.text-fullname {
  font-size: clamp(1rem, 3.4vw, 2.4rem);
  white-space: nowrap;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.02em;
}

.text-fullname .mark,
.hero-fullname .mark {
  color: var(--accent-color);
  font-weight: 600;
}

/* Fotograma 1: pantalla limpia (0s - 0.5s), sin texto, es el estado de reposo
   antes de que "step-question" empiece a aparecer. */
.step-question { animation: seqQuestion 1.6s ease-in-out 0.4s forwards; }
.step-fullname { animation: seqFullname 1.4s ease-in-out 2.0s forwards; }
.step-sbis     { animation: seqSbis 1.4s ease-out 3.4s forwards; }

@keyframes seqQuestion {
  0%   { opacity: 0; transform: scale(0.98); }
  21.43% { opacity: 1; transform: scale(1); }
  78.57% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.02); }
}

@keyframes seqFullname {
  0%   { opacity: 0; transform: scale(1.05); }
  20%  { opacity: 1; transform: scale(1); }
  75%  { opacity: 1; transform: scale(0.98); }
  100% { opacity: 0; transform: scale(0.92); }
}

@keyframes seqSbis {
  0%   { opacity: 0; transform: scale(0.94); }
  25%  { opacity: 1; transform: scale(1); }
  75%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.03); }
}

.text-sbis {
  font-family: var(--font-main);
  font-weight: 800;
  font-size: clamp(2.4rem, 9vw, 5rem);
  letter-spacing: 4px;
  color: var(--text-primary);
  margin: 0;
  background: linear-gradient(135deg, var(--text-primary), var(--accent-color));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-sbis-tagline {
  font-size: clamp(0.95rem, 2.2vw, 1.2rem);
  font-weight: 400;
  color: var(--text-secondary);
  margin: 14px 0 0;
}

/* Estado final del hero */
.hero-final {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 640px;
  opacity: 0;
  transform: translateY(20px);
}

.hero-final.is-visible {
  animation: seqFinal 0.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes seqFinal {
  to { opacity: 1; transform: translateY(0); }
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent-color);
  margin: 0 0 18px;
}

.hero-title {
  font-size: clamp(1.7rem, 4.4vw, 2.7rem);
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
}

.hero-subtitle {
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: var(--text-secondary);
  max-width: 480px;
  margin: 18px 0 0;
}

.btn-outline {
  margin-top: 28px;
  border: 0.5px solid rgba(0, 242, 255, 0.5);
  color: var(--accent-color);
  background: none;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 11px 26px;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.btn-outline:hover {
  background: rgba(0, 242, 255, 0.08);
  border-color: var(--accent-color);
}

.btn-outline-secondary {
  margin-top: 14px;
  opacity: 0.72;
  font-size: 12px;
  padding: 9px 22px;
}
.btn-outline-secondary:hover { opacity: 1; }

.hero-fullname {
  font-family: var(--font-main);
  font-weight: 600;
  font-size: clamp(1.05rem, 4vw, 1.9rem);
  letter-spacing: clamp(1px, 0.18vw, 3px);
  color: var(--text-primary);
  white-space: nowrap;
  margin-top: 56px;
}

/* =========================================================
   VISUAL EFFECTS: SPOTLIGHT & ANIMATIONS
   ========================================================= */

.spotlight {
  position: fixed;
  inset: 0;
  z-index: 0; /* Por encima del fondo, debajo del contenido */
  pointer-events: none;
  background: radial-gradient(
    800px circle at var(--x, 50%) var(--y, 50%),
    rgba(14, 165, 233, 0.15) 0%,
    rgba(139, 92, 246, 0.08) 30%,
    transparent 70%
  );
  transition: opacity 0.5s ease;
}

/* Base de revelado para animaciones de scroll */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1), transform 1s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Delays escalonados para las tarjetas */
.cards-grid .reveal:nth-child(2) { transition-delay: 0.1s; }
.cards-grid .reveal:nth-child(3) { transition-delay: 0.2s; }

.steps-row .reveal:nth-child(2) { transition-delay: 0.1s; }
.steps-row .reveal:nth-child(3) { transition-delay: 0.2s; }
.steps-row .reveal:nth-child(4) { transition-delay: 0.3s; }

/* Optimizaciones para Móvil / Touch */
@media (max-width: 768px) {
  .spotlight {
    background: radial-gradient(
      450px circle at var(--x, 50%) var(--y, 50%),
      rgba(14, 165, 233, 0.15) 0%,
      transparent 70%
    );
  }

  .reveal {
    transform: translateY(20px); /* Menor distancia para que se sienta más rápido en móvil */
    transition-duration: 0.8s;
  }

  /* En móvil, eliminamos delays largos para que el usuario no vea espacios vacíos al bajar rápido */
  .cards-grid .reveal,
  .steps-row .reveal {
    transition-delay: 0s !important;
  }
}

.scroll-cue {
  position: absolute;
  bottom: 6vh;
  left: 50%;
  transform: translateX(-50%);
}
.scroll-cue span {
  display: block;
  width: 1px;
  height: 34px;
  background: linear-gradient(var(--accent-color), transparent);
  animation: scrollPulse 1.8s ease-in-out infinite;
}
@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* =========================================================
   STAGES (secciones generales)
   ========================================================= */

.stage {
  padding: var(--stage-padding);
  max-width: 1080px;
  margin: 0 auto;
}
.stage-alt { background: rgba(8, 15, 32, 0.65); backdrop-filter: blur(4px); max-width: 100%; }
.stage-alt > * { max-width: 1080px; margin-left: auto; margin-right: auto; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--accent-color);
  margin: 0 0 12px;
}

.stage-title {
  font-size: clamp(1.5rem, 3.2vw, 2.1rem);
  font-weight: 500;
  margin: 0 0 40px;
}

.lede {
  font-size: clamp(1rem, 2vw, 1.15rem);
  color: var(--text-primary);
  max-width: 680px;
  line-height: 1.8;
}
.lede-secondary { color: var(--text-secondary); margin-top: 18px; }
.services-lede { margin-top: -22px; margin-bottom: 40px; max-width: 620px; }

/* Tarjetas de servicios */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  align-items: start;
}

.card {
  border: 0.5px solid var(--border-color);
  border-radius: 12px;
  background: rgba(8, 20, 40, 0.72);
  backdrop-filter: blur(12px);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
}
.card:hover,
.card.is-open {
  border-color: var(--accent-color);
  box-shadow: 0 10px 15px -3px rgba(14, 165, 233, 0.1);
}
.card:hover { transform: translateY(-3px); }

.card-trigger {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  padding: 28px 24px;
  cursor: pointer;
}
.card-trigger:focus-visible { outline: 2px solid var(--accent-color); outline-offset: -2px; }

.card-icon {
  width: 34px; height: 34px;
  border: 1px solid var(--accent-color);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-color);
}

.card h3 { font-size: 1.05rem; font-weight: 500; margin: 18px 0 10px; }
.card p { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.7; margin: 0; }

.card-tags {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 16px;
}
.card-tags li {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  border: 0.5px solid var(--border-color);
  padding: 4px 10px;
  border-radius: 12px;
}

.card-more {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--accent-color);
}
.card-more-icon { transition: transform 0.25s ease; }
.card.is-open .card-more-icon { transform: rotate(45deg); }

/* Panel expandible (grid-rows trick: anima altura sin conocerla) */
.card-details-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s ease;
}
.card.is-open .card-details-wrap { grid-template-rows: 1fr; }

.card-details {
  overflow: hidden;
  padding: 0 24px;
  border-top: 0.5px solid var(--border-color);
}
.card.is-open .card-details { padding: 20px 24px 26px; }

.card-details p {
  font-size: 0.88rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0 0 14px;
}
.card-details-list {
  margin: 0 0 14px;
  padding-left: 18px;
  list-style: disc;
}
.card-details-list li {
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 6px;
}
.card-details-status { 
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent-color);
  margin-top: 18px;
  padding-top: 14px;
  border-top: 0.5px solid var(--border-color);
}
.card-demo-link {
  display: inline-block;
  margin-top: 18px;
  font-size: 11px;
  padding: 9px 16px;
}

/* Cita / Propósito */
.quote {
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  border-left: 3px solid var(--accent-color);
  padding-left: 24px;
  max-width: 640px;
  margin: 0 0 56px;
}

.steps-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}
.step-number {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-color);
}
.step h3 { font-size: 1rem; font-weight: 500; margin: 10px 0 8px; }
.step p { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.7; margin: 0; }

/* Medios */
.media-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.media-link {
  display: block;
  border: 0.5px solid var(--border-color);
  border-radius: 10px;
  padding: 20px 22px;
  transition: border-color 0.2s ease;
}
.media-link:hover { border-color: var(--accent-color); }
.media-icon {
  width: 32px; height: 32px;
  margin-bottom: 12px;
  color: var(--accent-color);
  display: flex; align-items: center;
}
.media-link span { display: block; font-size: 0.95rem; font-weight: 500; }
.media-link small { display: block; font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; }

/* Contacto / consola */
.contact-stage { text-align: left; }

.console-form {
  margin-top: 32px;
  max-width: 560px;
}
.console-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 0.5px solid var(--border-color);
  border-radius: 8px;
  padding: 16px 18px;
  background: rgba(8, 20, 40, 0.8);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
}
.console-prompt { color: var(--accent-color); font-size: 14px; }
.console-field textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: vertical;
  min-height: 70px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
}
.console-field textarea::placeholder { color: var(--text-faint); }

.console-status {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-color);
  min-height: 16px;
  margin: 14px 0 0;
}

/* Footer */
.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 28px 6%;
  border-top: 0.5px solid var(--border-color);
  font-size: 12px;
  color: var(--text-faint);
}
.footer-links { display: flex; gap: 20px; }
.footer-links a { color: var(--text-secondary); }
.footer-links a:hover { color: var(--accent-color); }

/* =========================================================
   ACCESIBILIDAD / FALLBACKS
   ========================================================= */

.no-js .intro-sequence { display: none; }
.no-js .hero-final { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .intro-sequence { display: none; }
  .hero-final { opacity: 1; transform: none; animation: none; }
  .scroll-cue span { animation: none; }
  html { scroll-behavior: auto; }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 780px) {
  .main-nav {
    position: fixed;
    top: var(--header-height);
    left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: rgba(5, 13, 26, 0.95);
    backdrop-filter: blur(14px);
    border-bottom: 0.5px solid var(--border-color);
    transform: translateY(-8px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
  }
  .main-nav a { width: 100%; padding: 16px 6%; border-top: 0.5px solid var(--border-color); }
  .main-nav.is-open {
    opacity: 1; transform: translateY(0); pointer-events: auto;
  }
  .btn-pill { border-radius: 0; text-align: left; }
  .nav-toggle { display: flex; }

  .stage { padding: 10vh 6%; }
  .quote { padding-left: 16px; }
}

/* Ajustes finos para pantallas pequeñas (móviles) */
@media (max-width: 600px) {
  .hero { padding-left: 5%; padding-right: 5%; min-height: 760px; }
  .hero-title { font-size: clamp(1.4rem, 6.4vw, 1.8rem); }
  .hero-subtitle { font-size: 0.95rem; }
  .hero-fullname { letter-spacing: 1px; margin-top: 40px; }
  .scroll-cue { display: none; }
}

.initial { color: var(--accent-color, #00f2ff) !important; }
.console-output { display: flex; flex-direction: column; gap: 10px; max-height: 260px; overflow-y: auto; margin-bottom: 14px; padding: 4px 0; }
.console-message { padding: 10px 12px; border-left: 2px solid var(--border-color-strong); background: rgba(255,255,255,0.5); font-family: var(--font-mono); font-size: 12px; line-height: 1.55; white-space: pre-wrap; color: var(--text-primary); }
.console-message.visitor { border-left-color: var(--accent-color); }
.console-message.operator { border-left-color: #ffffff; }
.console-message-label { display: block; margin-bottom: 3px; color: var(--text-faint); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; }
