/* ==========================================================================
   OLA · Una nueva etapa está por comenzar
   Estados de la secuencia (clases en <body>, aplicadas por js/main.js):
   is-discover → is-converge → is-reveal → is-name → is-headline → is-sub → is-ready
   Sin JavaScript (sin .js en <html>) todo se muestra en su estado final.
   ========================================================================== */

:root {
  /* Paleta tomada del logotipo (turquesa → azul real, letras azul marino)
     y del sitio anterior (verde petróleo #014235, azul petróleo #00576f). */
  --bg-0: #02111a;
  --bg-1: #04212e;
  --ink: #eef6f8;
  --ink-soft: rgba(238, 246, 248, 0.76);
  --teal: #1fc8b4;
  --aqua: #7fe3d6;
  --blue: #3d8be8;

  --logo-h: clamp(150px, min(38svh, 62vw), 300px);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);

  --font: "Segoe UI Variable Display", "Segoe UI Variable Text", "SF Pro Display",
    -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* Pantallas muy bajas (teléfono en horizontal): se permite desplazar en lugar de recortar. */
@media (max-height: 460px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }
}

/* ---------- Fondo ambiental ---------- */

.backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 55% at 50% 40%, rgba(0, 87, 111, 0.5), transparent 70%),
    radial-gradient(ellipse 120% 70% at 50% 115%, rgba(1, 66, 53, 0.6), transparent 62%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
}

.aurora {
  position: absolute;
  width: 90vmax;
  height: 90vmax;
  border-radius: 50%;
  will-change: transform;
}

.aurora--cool {
  top: -45vmax;
  left: -30vmax;
  background: radial-gradient(circle, rgba(31, 200, 180, 0.13), transparent 62%);
}

.aurora--warm {
  right: -40vmax;
  bottom: -50vmax;
  background: radial-gradient(circle, rgba(61, 139, 232, 0.12), transparent 60%);
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 85% 75% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

.grain {
  position: absolute;
  inset: 0;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.field {
  position: fixed;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Escena ---------- */

.stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100svh;
  padding: max(24px, env(safe-area-inset-top)) 16px max(48px, env(safe-area-inset-bottom));
  text-align: center;
}

.emblem {
  position: relative;
  display: grid;
  place-items: center;
  margin-bottom: clamp(22px, 4.5svh, 44px);
}

.geometry {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--logo-h) * 2.2);
  height: calc(var(--logo-h) * 2.2);
  transform: translate(-50%, -50%);
  overflow: visible;
  pointer-events: none;
  transition: opacity 2.4s var(--ease-out);
}

.geo,
.geo-ticks,
.geo-core {
  transform-box: fill-box;
  transform-origin: center;
}

.geo {
  fill: none;
  stroke-linecap: round;
}

.geo-axis {
  stroke: url(#axis-fade);
  stroke-width: 1;
}

.geo-ring {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transform: rotate(-90deg);
}

.geo-ring--inner {
  stroke: rgba(127, 227, 214, 0.45);
  stroke-width: 1.1;
}

.geo-ring--outer {
  stroke: rgba(238, 246, 248, 0.14);
  stroke-width: 0.9;
}

.geo-arc {
  stroke-width: 1.4;
}

.geo-arc--a {
  stroke: rgba(31, 200, 180, 0.8);
  stroke-dasharray: 0.12 0.88;
}

.geo-arc--b {
  stroke: rgba(61, 139, 232, 0.6);
  stroke-dasharray: 0.06 0.44;
}

.geo-ticks line {
  stroke: rgba(238, 246, 248, 0.26);
  stroke-width: 0.9;
  stroke-linecap: round;
}

.geo-core {
  fill: #ffffff;
  filter: drop-shadow(0 0 4px rgba(127, 227, 214, 0.9));
}

.halo {
  position: absolute;
  top: 50%;
  left: 50%;
  width: calc(var(--logo-h) * 2.6);
  height: calc(var(--logo-h) * 2.6);
  margin: calc(var(--logo-h) * -1.3) 0 0 calc(var(--logo-h) * -1.3);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(31, 200, 180, 0.2) 0%, rgba(61, 139, 232, 0.12) 34%, transparent 64%);
  pointer-events: none;
}

.mark {
  position: relative;
  line-height: 0;
  filter: blur(0) brightness(1) drop-shadow(0 0 26px rgba(31, 200, 180, 0.28));
}

.logo {
  display: block;
  width: auto;
  height: var(--logo-h);
  max-width: min(84vw, 560px);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

/* El archivo del logotipo es cuadrado con esquinas blancas: se recorta al borde exterior
   del anillo (medido sobre el original; está ligeramente descentrado). js/main.js lee esta
   misma elipse para las partículas y el destello. */
.logo--seal {
  clip-path: ellipse(49.12% 48.6% at 49.84% 49.64%);
}

.sheen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* ---------- Tipografía ---------- */

.org-name {
  max-width: 40em;
  margin: 0 -0.26em 0 0; /* compensa el espaciado final de la última letra */
  font-size: clamp(0.72rem, 0.56rem + 0.85vw, 1.05rem);
  font-weight: 500;
  line-height: 1.75;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--ink);
}

.word {
  display: inline-block;
}

.rule {
  width: 56px;
  height: 1px;
  margin: clamp(16px, 3.2svh, 30px) auto;
  background: linear-gradient(90deg, transparent, var(--teal), transparent);
}

.headline {
  margin: 0;
  font-size: clamp(2rem, 1.15rem + 4.2vw, 3.9rem);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff 20%, #b5e6e4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subline {
  margin: 0.75em 0 0;
  font-size: clamp(0.95rem, 0.84rem + 0.45vw, 1.2rem);
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-wrap: balance;
  color: var(--ink-soft);
}

/* ---------- Indicador de actividad ---------- */

.indicator {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-top: clamp(22px, 4.5svh, 44px);
}

.indicator__dot {
  position: relative;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 10px rgba(31, 200, 180, 0.8);
}

.indicator__dot::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(31, 200, 180, 0.6);
  border-radius: 50%;
  opacity: 0;
}

.indicator__track {
  position: relative;
  width: 128px;
  height: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(238, 246, 248, 0.12);
}

.indicator__glow {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(31, 200, 180, 0.9), #ffffff, transparent);
  transform: translateX(80%);
}

/* ==========================================================================
   Estados iniciales (solo con JavaScript activo)
   ========================================================================== */

.js .geo-axis { opacity: 0; transform: scaleX(0); }
.js .geo-ticks { opacity: 0; }
.js .geo-arc { opacity: 0; }
.js .geo-core { opacity: 0; transform: scale(0.2); }
.js .halo { opacity: 0; transform: scale(0.6); }
.js .mark { opacity: 0; transform: scale(0.94); filter: blur(14px) brightness(1.6) drop-shadow(0 0 0 rgba(31, 200, 180, 0)); }
.js .word { opacity: 0; transform: translateY(0.7em); filter: blur(6px); }
.js .rule { opacity: 0; transform: scaleX(0); }
.js .headline,
.js .subline { opacity: 0; transform: translateY(14px); filter: blur(8px); }
.js .indicator { opacity: 0; }

/* Transiciones */
.geo-axis { transition: transform 1.8s var(--ease-out), opacity 1.6s var(--ease-out); }
.geo-ring { transition: stroke-dashoffset 2.4s var(--ease-in-out), opacity 2s var(--ease-out); }
.geo-ring--outer { transition-delay: 0.35s; }
.geo-ticks { transition: opacity 1.8s var(--ease-out) 0.6s; }
.geo-arc { transition: opacity 1.4s var(--ease-out) 0.4s; }
.geo-core { transition: opacity 0.9s var(--ease-out), transform 1.4s var(--ease-out); }
.halo { transition: opacity 1.8s var(--ease-out), transform 2.4s var(--ease-out); }
.mark { transition: opacity 1.3s var(--ease-out), transform 2.2s var(--ease-out), filter 1.8s var(--ease-out); }
.word {
  transition:
    opacity 1s var(--ease-out) calc(var(--i) * 120ms),
    transform 1.2s var(--ease-out) calc(var(--i) * 120ms),
    filter 1s var(--ease-out) calc(var(--i) * 120ms);
}
.rule { transition: opacity 1s var(--ease-out), transform 1.4s var(--ease-out); }
.headline,
.subline { transition: opacity 1.2s var(--ease-out), transform 1.4s var(--ease-out), filter 1.2s var(--ease-out); }
.indicator { transition: opacity 1.4s var(--ease-out); }

/* 2 · Descubrimiento */
.is-discover .geo-axis { opacity: 1; transform: scaleX(1); }
.is-discover .geo-ring { stroke-dashoffset: 0; }
.is-discover .geo-ticks { opacity: 0.8; }
.is-discover .geo-arc { opacity: 1; }
.is-discover .geo-core { opacity: 1; transform: scale(1); }

/* 3 · Transformación */
.is-converge .geo-core { transform: scale(2.2); }
.is-converge .geo-axis { opacity: 0.5; transform: scaleX(0.82); }

/* 4 · Revelación */
.is-reveal .geometry { opacity: 0.5; }
.is-reveal .geo-core { opacity: 0; transform: scale(5); }
.is-reveal .geo-axis { opacity: 0.35; transform: scaleX(1.05); }
.is-reveal .halo { opacity: 1; transform: scale(1); }
.is-reveal .mark { opacity: 1; transform: none; filter: blur(0) brightness(1) drop-shadow(0 0 26px rgba(31, 200, 180, 0.28)); }

/* 5 · Consolidación */
.is-name .word { opacity: 1; transform: none; filter: blur(0); }

/* 6 · Mensaje final */
.is-headline .rule { opacity: 1; transform: scaleX(1); }
.is-headline .headline { opacity: 1; transform: none; filter: blur(0); }
.is-sub .subline { opacity: 1; transform: none; filter: blur(0); }
.is-ready .indicator { opacity: 1; }

/* ==========================================================================
   Movimiento continuo (solo si el usuario no pide reducir animaciones)
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  .js .backdrop { animation: fade-in 1.4s var(--ease-out) both; }
  .aurora--cool { animation: drift-a 38s ease-in-out infinite alternate; }
  .aurora--warm { animation: drift-b 46s ease-in-out infinite alternate; }

  .geo-arc--a { animation: spin 26s linear infinite; }
  .geo-arc--b { animation: spin 40s linear infinite reverse; }
  .geo-ticks { animation: spin 140s linear infinite; }

  .is-ready .halo { animation: breathe 7s ease-in-out infinite; }
  .is-ready .indicator__glow { animation: run 2.8s var(--ease-in-out) infinite; }
  .is-ready .indicator__dot::after { animation: ping 2.8s var(--ease-out) infinite; }
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes drift-a { to { transform: translate3d(10vmax, 6vmax, 0) scale(1.08); } }
@keyframes drift-b { to { transform: translate3d(-8vmax, -5vmax, 0) scale(1.1); } }
@keyframes breathe {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.68; transform: scale(1.05); }
}
@keyframes run {
  from { transform: translateX(-110%); }
  to { transform: translateX(260%); }
}
@keyframes ping {
  0% { opacity: 0.8; transform: scale(0.4); }
  70%, 100% { opacity: 0; transform: scale(1.6); }
}

/* Movimiento reducido: solo fundidos breves, sin desplazamientos ni bucles. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.6s !important;
    transition-delay: 0s !important;
    animation: none !important;
  }

  .js .word,
  .js .headline,
  .js .subline,
  .js .mark,
  .js .halo { transform: none; }
}

/* ---------- Integración en el sitio institucional (/bienvenida) ---------- */
.skip-intro {
  position: fixed; top: 16px; right: 16px; z-index: 10;
  padding: 0.55em 1.1em; border-radius: 999px;
  font: 600 0.875rem var(--font); color: var(--ink); text-decoration: none;
  background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(255, 255, 255, 0.25);
}
.skip-intro:hover, .skip-intro:focus-visible { background: rgba(255, 255, 255, 0.18); outline: 2px solid var(--aqua); outline-offset: 2px; }
.enter {
  display: inline-flex; align-items: center; gap: 0.4em; margin-top: 1.6rem; position: relative; z-index: 3;
  padding: 0.8em 1.6em; border-radius: 999px; text-decoration: none;
  font: 600 1rem var(--font); color: #02111a; background: linear-gradient(100deg, var(--aqua), #8fc2ff);
  box-shadow: 0 10px 30px -10px rgba(127, 227, 214, 0.6);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out), opacity 1.2s var(--ease-out);
}
.enter:hover { transform: translateY(-1px); box-shadow: 0 14px 34px -10px rgba(127, 227, 214, 0.8); }
.enter:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.js .enter { opacity: 0; pointer-events: none; }
.is-ready .enter, .js.reduced .enter { opacity: 1; pointer-events: auto; }
@media (prefers-reduced-motion: reduce) { .js .enter { opacity: 1; pointer-events: auto; } }
