/* =============================================================
   Plutto Landing — Custom CSS
   Brand Guide 2026 · Primary #5563E6
   ============================================================= */

/* ----------------------------------------------------------
   1. Animaciones scroll (data-animate)
   ---------------------------------------------------------- */

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.animate-fade-in {
  animation: fadeInUp 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* Delay en cascada para grids */
[data-animate]:nth-child(2) { animation-delay: 0.08s; }
[data-animate]:nth-child(3) { animation-delay: 0.16s; }
[data-animate]:nth-child(4) { animation-delay: 0.24s; }
[data-animate]:nth-child(5) { animation-delay: 0.32s; }

/* ----------------------------------------------------------
   2. Mega-menú dropdowns (hover puro — CSS fallback)
   ---------------------------------------------------------- */

/* Asegurar que los dropdowns se muestren sobre el resto */
nav .group:hover > div,
nav .group:focus-within > div {
  opacity: 1 !important;
  visibility: visible !important;
}

/* ----------------------------------------------------------
   3. Tabs de módulos (section módulos)
   ---------------------------------------------------------- */

.tab-btn[aria-selected="true"] {
  background-color: #5563E6;
  color: #ffffff;
  border-color: transparent;
}

.tab-btn[aria-selected="false"] {
  background-color: #ffffff;
  color: #4b5563;
}

/* ----------------------------------------------------------
   4. Scroll suave nativo (refuerzo para Safari)
   ---------------------------------------------------------- */

html {
  scroll-behavior: smooth;
}

/* ----------------------------------------------------------
   5. Safe area bottom (iPhone notch para sticky CTA)
   ---------------------------------------------------------- */

.safe-area-bottom {
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
}

/* ----------------------------------------------------------
   6. Logo bar — scroll animado (si se usa marquee)
   ---------------------------------------------------------- */

@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.animate-marquee {
  animation: marquee 28s linear infinite;
}

.animate-marquee:hover {
  animation-play-state: paused;
}

/* ----------------------------------------------------------
   7. Details/Summary — quitar flechas nativas del browser
   ---------------------------------------------------------- */

details > summary {
  list-style: none;
}
details > summary::-webkit-details-marker {
  display: none;
}

/* ----------------------------------------------------------
   8. Focus visible — accesibilidad WCAG 2.1 AA
   ---------------------------------------------------------- */

:focus-visible {
  outline: 2px solid #5563E6;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ----------------------------------------------------------
   9. Selección de texto con color de marca
   ---------------------------------------------------------- */

::selection {
  background-color: #D3CFF9;
  color: #14144F;
}

/* ----------------------------------------------------------
   10. Animaciones premium — blur-in, scale-in (ziphq, nuvo)
   ---------------------------------------------------------- */

@keyframes blurIn {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.animate-blur-in {
  animation: blurIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.animate-scale-in {
  animation: scaleIn 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* ----------------------------------------------------------
   11. Tipografía premium — letter-spacing negativo (nuvo, zip)
   ---------------------------------------------------------- */

h1, h2 {
  letter-spacing: -0.03em;
}

h3 {
  letter-spacing: -0.02em;
}

/* Counter numbers */
.counter-number {
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ----------------------------------------------------------
   12. Hover "dim siblings" — Audiencias (nuvo.com)
   ---------------------------------------------------------- */

.dim-siblings > * {
  transition: opacity 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.dim-siblings:hover > *:not(:hover) {
  opacity: 0.45;
}

/* ----------------------------------------------------------
   13. Glow decorativo radial (ziphq.com)
   ---------------------------------------------------------- */

.glow-plutto {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(85, 99, 230, 0.25) 0%, rgba(85, 99, 230, 0) 100%);
  filter: blur(60px);
  pointer-events: none;
}

.glow-cyan {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(186, 232, 242, 0.3) 0%, rgba(186, 232, 242, 0) 100%);
  filter: blur(60px);
  pointer-events: none;
}

/* ----------------------------------------------------------
   14. Métricas — strip horizontal con dividers (nuvo, zip)
   ---------------------------------------------------------- */

.metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  position: relative;
}

@media (max-width: 767px) {
  .metrics-strip {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Dividers verticales entre métricas */
.metric-item {
  position: relative;
  text-align: center;
  padding: 2rem 1rem;
}

.metric-item:not(:last-child)::after {
  content: '';
  position: absolute;
  right: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(85, 99, 230, 0.2), transparent);
}

@media (max-width: 767px) {
  .metric-item:nth-child(2)::after {
    display: none;
  }
}

/* ----------------------------------------------------------
   15. Stagger delays mejorados (cascada más visual)
   ---------------------------------------------------------- */

[data-delay="1"] { animation-delay: 0.1s; }
[data-delay="2"] { animation-delay: 0.2s; }
[data-delay="3"] { animation-delay: 0.3s; }
[data-delay="4"] { animation-delay: 0.4s; }
[data-delay="5"] { animation-delay: 0.5s; }

/* ----------------------------------------------------------
   16. Card lift — hover con elevación sutil
   ---------------------------------------------------------- */

.card-lift {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.card-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px -8px rgba(85, 99, 230, 0.15);
}

/* ----------------------------------------------------------
   17. Timeline — línea conectora animada
   ---------------------------------------------------------- */

@keyframes timelineDraw {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.timeline-line {
  transform-origin: left center;
  animation: timelineDraw 1.2s cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: 0.3s;
  transform: scaleX(0);
}

/* ----------------------------------------------------------
   18. Hero animated glows (ruixen-ui style)
   ---------------------------------------------------------- */

@keyframes heroGlowLeft {
  from {
    opacity: 0;
    transform: scale(0.8) translateX(-100px);
  }
  to {
    opacity: 0.3;
    transform: scale(1) translateX(0);
  }
}

@keyframes heroGlowRight {
  from {
    opacity: 0;
    transform: scale(0.8) translateX(100px);
  }
  to {
    opacity: 0.2;
    transform: scale(1) translateX(0);
  }
}

.hero-glow-left {
  animation: heroGlowLeft 1.5s ease-out forwards;
}

.hero-glow-right {
  animation: heroGlowRight 1.5s 0.3s ease-out forwards;
  opacity: 0;
}

/* ----------------------------------------------------------
   19. Testimonios — columnas con scroll vertical infinito
   ---------------------------------------------------------- */

@keyframes scrollUp {
  from { transform: translateY(0); }
  to   { transform: translateY(-50%); }
}

.testimonial-column {
  animation: scrollUp 15s linear infinite;
}

.testimonial-column-slow {
  animation: scrollUp 19s linear infinite;
}

.testimonial-column-mid {
  animation: scrollUp 17s linear infinite;
}

.testimonial-column:hover,
.testimonial-column-slow:hover,
.testimonial-column-mid:hover {
  animation-play-state: paused;
}

.testimonial-mask {
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

/* ----------------------------------------------------------
   20. Clases utilitarias documentadas (docs/marca.md §16)
   Definidas aquí para que no queden como clases muertas.
   ---------------------------------------------------------- */

/* Alias de .card-lift (nombre histórico usado en algunas páginas/plantillas) */
.card-hover {
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              box-shadow 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px -8px rgba(85, 99, 230, 0.15);
}

/* Fondos mesh: gradientes radiales sutiles sobre el color base de la sección.
   Combinar con bg-plutto-50 (light) o bg-plutto-900 (dark). */
.bg-mesh-light {
  background-image:
    radial-gradient(at 18% 22%, rgba(85, 99, 230, 0.06) 0px, transparent 50%),
    radial-gradient(at 82% 8%, rgba(186, 232, 242, 0.10) 0px, transparent 50%),
    radial-gradient(at 78% 96%, rgba(211, 207, 249, 0.12) 0px, transparent 55%);
}
.bg-mesh-dark {
  background-image:
    radial-gradient(at 15% 20%, rgba(85, 99, 230, 0.22) 0px, transparent 55%),
    radial-gradient(at 85% 28%, rgba(47, 58, 134, 0.28) 0px, transparent 50%),
    radial-gradient(at 50% 100%, rgba(12, 12, 46, 0.40) 0px, transparent 55%);
}

/* Textura de grano sutil. El contenedor debe ser position:relative. */
.grain {
  position: relative;
}
.grain::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Link con subrayado que crece en hover */
.link-grow {
  position: relative;
}
.link-grow::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 100%;
  height: 1.5px;
  background-color: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}
.link-grow:hover::after {
  transform: scaleX(1);
}

/* Slide-in laterales */
@keyframes slideLeft {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(28px); }
  to   { opacity: 1; transform: translateX(0); }
}
.animate-slide-left  { animation: slideLeft  0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; }
.animate-slide-right { animation: slideRight 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards; }

/* ----------------------------------------------------------
   21. Reduced motion preferences
   ---------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  /* Forzar visibilidad: main.js pone opacity-0 a [data-animate] y revela vía
     animación; sin esto el contenido quedaría invisible al desactivar motion. */
  [data-animate] {
    opacity: 1 !important;
  }
  .animate-fade-in,
  .animate-blur-in,
  .animate-scale-in,
  .animate-slide-left,
  .animate-slide-right {
    animation: none !important;
    opacity: 1 !important;
    filter: none !important;
    transform: none !important;
  }
  .animate-marquee {
    animation: none !important;
  }
  .card-lift:hover,
  .card-hover:hover {
    transform: none;
  }
  .timeline-line {
    animation: none;
    transform: scaleX(1);
  }
  .hero-glow-left,
  .hero-glow-right {
    animation: none;
    opacity: 0.2;
    transform: none;
  }
  .testimonial-column,
  .testimonial-column-slow,
  .testimonial-column-mid {
    animation: none;
  }
}
