/*
 * Animación de entrada: la G se dibuja (arco cálido, arco frío y su sombra), la barra
 * entra deslizándose desde la derecha, el logo sube y aparece "GONTHIA PERU · INNOVACION".
 * Después todo se desvanece y queda la app. Dura 2,85 s y es puro CSS: si el JavaScript
 * no carga, igual termina sola y no tapa nada. splash.js decide si se muestra (una vez
 * por sesión) y la salta con un toque.
 */

#intro {
  display: none;
}

html[data-intro='si'] #intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: #141833;
  font-family:
    system-ui,
    -apple-system,
    'Segoe UI',
    Roboto,
    sans-serif;
  animation: intro-sale 0.45s ease-in 2.4s forwards;
}

@media (prefers-color-scheme: dark) {
  html[data-intro='si'] #intro {
    background: #0d1026;
    color: #eef0fa;
  }
  /* La sombra azul marino de la G se pierde contra el fondo oscuro: se aclara un poco */
  #i-sombra stop:nth-child(1) {
    stop-color: #2d3a8f;
  }
  #i-sombra stop:nth-child(2) {
    stop-color: #24477a;
  }
}

#intro .intro-centro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

#intro svg {
  width: min(42vw, 190px);
  height: auto;
  overflow: visible;
  animation: intro-sube 0.6s cubic-bezier(0.3, 0.9, 0.3, 1) 1.35s both;
}

/* Los arcos se dibujan con el trazo: el largo es la medida del arco en el viewBox */
#intro .arco-calido {
  stroke-dasharray: 360;
  stroke-dashoffset: 360;
  animation: intro-traza 0.65s cubic-bezier(0.35, 0.55, 0.3, 1) 0.1s forwards;
}

#intro .arco-frio {
  stroke-dasharray: 205;
  stroke-dashoffset: 205;
  animation: intro-traza 0.45s cubic-bezier(0.2, 0.6, 0.35, 1) 0.72s forwards;
}

#intro .punta-calida,
#intro .punta-fria {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
}

#intro .punta-calida {
  animation: intro-punta 0.3s ease-out 0.05s forwards;
}

#intro .punta-fria {
  animation: intro-punta 0.3s cubic-bezier(0.3, 1.6, 0.5, 1) 1.1s forwards;
}

#intro .sombra {
  opacity: 0;
  animation: intro-aparece 0.4s ease-out 0.55s forwards;
}

#intro .barra {
  opacity: 0;
  transform: translateX(150px);
  animation: intro-desliza 0.6s cubic-bezier(0.2, 1.35, 0.4, 1) 1s forwards;
}

#intro .intro-marca {
  display: flex;
  align-items: baseline;
  gap: 0.55em;
  font-size: clamp(1.4rem, 6vw, 2.1rem);
  letter-spacing: 0.04em;
  clip-path: inset(0 100% 0 0);
  animation: intro-revela 0.55s cubic-bezier(0.5, 0, 0.2, 1) 1.5s forwards;
}

#intro .intro-marca b {
  font-weight: 800;
}

#intro .intro-marca span {
  font-weight: 200;
}

#intro .intro-lema {
  font-size: clamp(0.7rem, 2.6vw, 0.85rem);
  font-weight: 700;
  letter-spacing: 0.1em;
  opacity: 0;
  animation: intro-lema 0.6s ease-out 1.75s forwards;
}

/* La línea con el degradado del logo, debajo de todo */
#intro .intro-linea {
  width: min(60vw, 260px);
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(
    90deg,
    #fddc55,
    #ee8a3c 25%,
    #d4504a 40%,
    #173a55 60%,
    #3ae6a3 85%,
    #3d5ce9
  );
  transform: scaleX(0);
  animation: intro-linea 0.7s cubic-bezier(0.6, 0, 0.2, 1) 1.6s forwards;
}

/* Un toque la salta */
html[data-intro='si'] #intro.saltar {
  animation: intro-sale 0.25s ease-in forwards;
}

@keyframes intro-traza {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes intro-punta {
  to {
    transform: scale(1);
  }
}

@keyframes intro-aparece {
  to {
    opacity: 1;
  }
}

@keyframes intro-desliza {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes intro-sube {
  from {
    transform: translateY(28px) scale(1.12);
  }
  to {
    transform: translateY(0) scale(1);
  }
}

@keyframes intro-revela {
  to {
    clip-path: inset(0 0 0 0);
  }
}

@keyframes intro-lema {
  from {
    opacity: 0;
    letter-spacing: 0.1em;
  }
  to {
    opacity: 1;
    letter-spacing: 0.42em;
  }
}

@keyframes intro-linea {
  to {
    transform: scaleX(1);
  }
}

@keyframes intro-sale {
  to {
    opacity: 0;
    transform: scale(1.04);
    visibility: hidden;
  }
}

/* Con "reducir movimiento": el logo completo, quieto, y un fundido corto */
@media (prefers-reduced-motion: reduce) {
  html[data-intro='si'] #intro {
    animation: intro-sale 0.3s ease-in 0.9s forwards;
  }
  #intro *,
  #intro svg {
    animation: none !important;
  }
  #intro .arco-calido,
  #intro .arco-frio {
    stroke-dashoffset: 0;
  }
  #intro .punta-calida,
  #intro .punta-fria,
  #intro .barra {
    transform: none;
  }
  #intro .sombra,
  #intro .barra,
  #intro .intro-lema {
    opacity: 1;
  }
  #intro .intro-marca {
    clip-path: none;
  }
  #intro .intro-lema {
    letter-spacing: 0.42em;
  }
  #intro .intro-linea {
    transform: none;
  }
}
