/* =====================================================================
   Pysol SpA — hoja de estilos compartida (todas las páginas)
   ---------------------------------------------------------------------
   Complementa a Tailwind con los componentes de marca que le dan un
   sello propio (menú desplegable, marquee, marcos de imagen, grano,
   numeración editorial) y las animaciones de los menús.

   Sistema de color:
     · navy  → base corporativa
     · solar → acento CELESTE = línea SAP  (como la nube del logo)
     · flux  → acento TEAL    = línea Software (frío, digital)
   ===================================================================== */

/* ------------------------------------------------------------------ */
/* Pesos de fuente auxiliares                                          */
/* ------------------------------------------------------------------ */
.font-800 { font-weight: 800; }
.font-700 { font-weight: 700; }
.font-600 { font-weight: 600; }

/* ------------------------------------------------------------------ */
/* Etiqueta técnica (eyebrow) en monoespaciada — sello de ingeniería   */
/* ------------------------------------------------------------------ */
.eyebrow {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 500;
}

/* Número de sección tipo índice (01 / 02 …) */
.section-index {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-weight: 600;
  letter-spacing: 0.05em;
}

/* ------------------------------------------------------------------ */
/* Textura de grano muy sutil (evita el look plano de plantilla)       */
/* ------------------------------------------------------------------ */
.grain::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Rejilla técnica tipo blueprint para fondos oscuros */
.hero-grid {
  background-image:
    linear-gradient(to right,  rgba(255,255,255,0.55) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.55) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 85% 75% at 25% 15%, #000 35%, transparent 100%);
          mask-image: radial-gradient(ellipse 85% 75% at 25% 15%, #000 35%, transparent 100%);
}

/* π gigante de marca como marca de agua decorativa */
.pi-watermark {
  font-family: 'Sora', sans-serif;
  font-weight: 800;
  line-height: 1;
  user-select: none;
  pointer-events: none;
}

/* ------------------------------------------------------------------ */
/* Marcos de imagen de stock — con degradado de respaldo mientras      */
/* cargan (lazy) o si fallan (onerror añade .img-failed)               */
/* ------------------------------------------------------------------ */
[data-img] {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #122a4d 0%, #0b1f3a 60%, #07162b 100%);
}
[data-img] img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease, opacity 0.6s ease;
}
[data-img].img-failed img { display: none; }
/* Zoom sutil al pasar el mouse por una tarjeta con imagen */
.group:hover [data-img] img { transform: scale(1.05); }

/* Velo de color sobre las imágenes para integrarlas a la marca */
.img-veil::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7,22,43,0) 30%, rgba(7,22,43,0.72) 100%);
}
.img-veil-solar::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(56,189,248,0.28) 0%, rgba(11,31,58,0.55) 55%, rgba(7,22,43,0.85) 100%);
}
.img-veil-flux::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(160deg, rgba(20,184,166,0.28) 0%, rgba(11,31,58,0.55) 55%, rgba(7,22,43,0.85) 100%);
}

/* ------------------------------------------------------------------ */
/* Header: transparente arriba, sólido al hacer scroll                 */
/* ------------------------------------------------------------------ */
[data-nav] { transition: background-color 0.3s ease, box-shadow 0.3s ease, backdrop-filter 0.3s ease; }
[data-nav].nav-solid {
  background-color: rgba(7, 22, 43, 0.92);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  box-shadow: 0 8px 30px rgba(7, 22, 43, 0.35);
}

/* ------------------------------------------------------------------ */
/* NAV — enlaces con subrayado animado                                 */
/* ------------------------------------------------------------------ */
.nav-link {
  position: relative;
  padding-block: 0.25rem;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 2px;
  background: #38bdf8;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.28s ease;
}
.nav-link:hover::after,
.nav-link[aria-current="page"]::after { transform: scaleX(1); }

/* ------------------------------------------------------------------ */
/* MENÚ DESPLEGABLE "Servicios" (los menús pequeños que se abren)       */
/* Animación: fade + slide + escala desde el borde superior            */
/* ------------------------------------------------------------------ */
.dropdown-panel {
  position: absolute;
  top: calc(100% + 0.6rem);
  left: 50%;
  transform: translateX(-50%) translateY(-8px) scale(0.97);
  transform-origin: top center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, transform 0.26s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.22s;
}
.dropdown[data-open="true"] .dropdown-panel {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0) scale(1);
}
/* Flecha del caret que rota al abrir */
.dropdown[data-open="true"] .caret { transform: rotate(180deg); }
.caret { transition: transform 0.26s ease; }

/* Ítems del dropdown con entrada escalonada */
.dropdown-item {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
}
.dropdown[data-open="true"] .dropdown-item { opacity: 1; transform: none; }
.dropdown[data-open="true"] .dropdown-item:nth-child(1) { transition-delay: 0.05s; }
.dropdown[data-open="true"] .dropdown-item:nth-child(2) { transition-delay: 0.11s; }

/* ------------------------------------------------------------------ */
/* MENÚ MÓVIL — deslizamiento + entrada escalonada de los enlaces       */
/* ------------------------------------------------------------------ */
.mobile-menu {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}
.mobile-menu[data-open="true"] {
  max-height: 30rem;
  opacity: 1;
}
.mobile-menu li {
  opacity: 0;
  transform: translateX(-12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.mobile-menu[data-open="true"] li { opacity: 1; transform: none; }
.mobile-menu[data-open="true"] li:nth-child(1) { transition-delay: 0.08s; }
.mobile-menu[data-open="true"] li:nth-child(2) { transition-delay: 0.13s; }
.mobile-menu[data-open="true"] li:nth-child(3) { transition-delay: 0.18s; }
.mobile-menu[data-open="true"] li:nth-child(4) { transition-delay: 0.23s; }
.mobile-menu[data-open="true"] li:nth-child(5) { transition-delay: 0.28s; }
.mobile-menu[data-open="true"] li:nth-child(6) { transition-delay: 0.33s; }

/* Ícono hamburguesa → X */
.burger span {
  display: block;
  height: 2px; width: 22px;
  background: currentColor;
  border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.2s ease;
}
.burger span + span { margin-top: 5px; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ------------------------------------------------------------------ */
/* MARQUEE de tecnologías — cinta infinita (sello técnico, no plantilla)*/
/* ------------------------------------------------------------------ */
.marquee { overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee__track {
  display: inline-flex;
  gap: 3rem;
  white-space: nowrap;
  animation: marquee 26s linear infinite;
}
.marquee:hover .marquee__track { animation-play-state: paused; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ------------------------------------------------------------------ */
/* Botón con brillo de barrido al hover                                */
/* ------------------------------------------------------------------ */
.btn-shine { position: relative; overflow: hidden; }
.btn-shine::before {
  content: "";
  position: absolute; top: 0; left: -75%;
  width: 50%; height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.6s ease;
}
.btn-shine:hover::before { left: 130%; }

/* ------------------------------------------------------------------ */
/* Reveal al hacer scroll                                              */
/* ------------------------------------------------------------------ */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }
/* Escalonado opcional con data-delay */
.reveal[data-delay="1"] { transition-delay: 0.08s; }
.reveal[data-delay="2"] { transition-delay: 0.16s; }
.reveal[data-delay="3"] { transition-delay: 0.24s; }

/* ------------------------------------------------------------------ */
/* Accesibilidad / preferencias                                        */
/* ------------------------------------------------------------------ */
section[id], header[id] { scroll-margin-top: 5.5rem; }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
  border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .dropdown-item, .mobile-menu, .mobile-menu li, [data-img] img { transition: none !important; }
  .reveal { opacity: 1; transform: none; }
  .marquee__track { animation: none; }
  html { scroll-behavior: auto; }
}

/* =====================================================================
   Rediseño 2026
   ---------------------------------------------------------------------
   · Transición suave entre páginas (View Transitions entre documentos).
   · Animaciones ligadas al scroll nativas del navegador, sin JS
     (animation-timeline: view()); donde no existen, sigue el reveal JS.
   · Bento de servicios, esquema de integración, cifras y pasos.
   ===================================================================== */
@view-transition { navigation: auto; }
[data-nav] { view-transition-name: cabecera; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; }

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal, .reveal.is-visible {
      opacity: 1; transform: none; transition: none;
      animation: subir linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 70%;
    }
  }
}
@keyframes subir { from { opacity: 0; transform: translateY(26px); } to { opacity: 1; transform: none; } }

/* --- Esquema de integración del hero ------------------------------- */
.flow-node {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0.85rem;
  padding: 0.85rem; border-radius: 1rem;
  background: rgba(255,255,255,0.04); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
}
.flow-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 2.5rem; height: 2.5rem; border-radius: 0.75rem; box-shadow: inset 0 0 0 1px;
}
.flow-ico.ring-solar-500\/30 { --tw-ring-color: rgba(56,189,248,0.3); }
.flow-tag {
  font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.68rem;
  padding: 0.2rem 0.5rem; border-radius: 999px; box-shadow: inset 0 0 0 1px currentColor; opacity: 0.9;
  white-space: nowrap;
}
.flow-link { position: relative; height: 1.6rem; margin-left: 2.1rem; width: 2px; background: linear-gradient(#38bdf866, #ffffff33); }
.flow-link--flux { background: linear-gradient(#ffffff33, #14b8a666); }
.flow-link span {
  position: absolute; left: -3px; top: 0; width: 8px; height: 8px; border-radius: 50%;
  background: #38bdf8; box-shadow: 0 0 10px #38bdf8;
  animation: pulso 1.8s ease-in-out infinite;
}
.flow-link--flux span { background: #34d3c0; box-shadow: 0 0 10px #34d3c0; animation-delay: 0.9s; }
@keyframes pulso { 0% { top: -4px; opacity: 0; } 20% { opacity: 1; } 80% { opacity: 1; } 100% { top: calc(100% - 4px); opacity: 0; } }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d3c0; box-shadow: 0 0 0 0 rgba(52,211,192,0.6); animation: latido 2s infinite; }
@keyframes latido { 70% { box-shadow: 0 0 0 7px rgba(52,211,192,0); } 100% { box-shadow: 0 0 0 0 rgba(52,211,192,0); } }

/* --- Cifras --------------------------------------------------------- */
.stat { background: rgba(7,22,43,0.82); padding: 1.25rem 1.35rem; display: flex; flex-direction: column-reverse; gap: 0.3rem; }
.stat dt { font-size: 0.8rem; color: #8fa3bd; }
.stat dd { font-family: 'Sora', sans-serif; font-weight: 800; font-size: clamp(1.6rem, 3.2vw, 2.2rem); line-height: 1; color: #fff; font-variant-numeric: tabular-nums; }
.stat dd small { font-size: 0.95rem; font-weight: 600; color: #7dd3fc; }

/* --- Clientes ------------------------------------------------------- */
.marquee__track.clients { gap: 3rem; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.05rem; color: rgba(255,255,255,0.55); letter-spacing: -0.01em; }
.marquee__track.clients span { white-space: nowrap; }

/* --- Bento de servicios -------------------------------------------- */
.bento { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 768px) {
  .bento { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto auto; gap: 1.5rem; }
  .bento-sap  { grid-column: span 2; grid-row: span 2; }
}
.bento-card { position: relative; display: flex; flex-direction: column; border-radius: 1.5rem; padding: 1.75rem; overflow: hidden; transition: transform 0.25s ease, box-shadow 0.25s ease; }
a.bento-card:hover { transform: translateY(-3px); box-shadow: 0 22px 50px -20px rgba(7,22,43,0.45); }
@media (min-width: 768px) { .bento-card { padding: 2.25rem; } }
.bento-sap {
  color: #fff; min-height: 22rem;
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(56,189,248,0.22), transparent 55%),
    linear-gradient(160deg, #122a4d 0%, #0b1f3a 55%, #07162b 100%);
}
.bento-sap::after {
  content: "π"; position: absolute; right: -0.5rem; bottom: -3.5rem;
  font-family: 'Sora', sans-serif; font-weight: 800; font-size: 16rem; line-height: 1; color: rgba(255,255,255,0.04);
  pointer-events: none;
}
.bento-soft { background: #fff; box-shadow: inset 0 0 0 1px #dbe3ee; color: #0b1f3a; }
.bento-mini { background: #fff; box-shadow: inset 0 0 0 1px #dbe3ee; color: #0b1f3a; padding: 1.5rem; }
.mini-ico { display: inline-flex; align-items: center; justify-content: center; width: 2.5rem; height: 2.5rem; border-radius: 0.75rem; }
.tick { position: relative; padding-left: 1.4rem; }
.tick::before { content: ""; position: absolute; left: 0; top: 0.45em; width: 0.7rem; height: 0.4rem; border-left: 2px solid #38bdf8; border-bottom: 2px solid #38bdf8; transform: rotate(-45deg); }
.chip { border-radius: 999px; background: #eef2f7; box-shadow: inset 0 0 0 1px #dbe3ee; padding: 0.25rem 0.65rem; }
.chip-dark { border-radius: 999px; background: rgba(255,255,255,0.05); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.1); padding: 0.25rem 0.65rem; }

/* --- Pasos ---------------------------------------------------------- */
.steps { display: grid; gap: 1.25rem; grid-template-columns: 1fr; counter-reset: paso; list-style: none; padding: 0; margin: 0; }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .steps { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.steps li { position: relative; padding: 1.5rem 1.5rem 1.6rem; border-radius: 1.25rem; background: #eef2f7; }
.steps li::after { content: ""; position: absolute; left: 1.5rem; right: 1.5rem; top: 0; height: 3px; border-radius: 0 0 3px 3px; background: linear-gradient(90deg, #38bdf8, #14b8a6); }
.step-n { font-family: 'JetBrains Mono', ui-monospace, monospace; font-weight: 600; font-size: 0.8rem; color: #0284c7; }
.steps h3 { margin-top: 0.6rem; font-family: 'Sora', sans-serif; font-weight: 700; font-size: 1.15rem; color: #0b1f3a; }
.steps p { margin-top: 0.4rem; font-size: 0.92rem; color: #4a6081; line-height: 1.55; }

@media (prefers-reduced-motion: reduce) {
  .flow-link span, .live-dot { animation: none; }
  a.bento-card:hover { transform: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}
@media (max-width: 440px) {
  .flow-tag { display: none; }
  .flow-node { grid-template-columns: auto 1fr; }
}
