/* ───────────────── v8 · dirección gráfica + movimiento ─────────────────
   Se carga después de styles.css y sólo sobreescribe lo que cambia.      */

:root {
  --mono: var(--font); /* sin tipografía tipo terminal en todo el sitio */
  /* paleta de flownexai.com (tokens reales del sitio, 2026-10-16) */
  --line: #e0e0e0;
  --loss: #e40014;        /* red-600 del sitio */
  --loss-text: #b8000f;   /* 6,2:1 sobre blanco */
  --loss-soft: #fef2f2;   /* red-50 */
  --loss-soft-2: #ffe2e2; /* red-100 */
  /* el ámbar deja de existir: todo lo que era "pérdida" usa el rojo */
  --amber: var(--loss);
  --amber-text: var(--loss-text);
  --amber-soft: var(--loss-soft);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);
  --ease-in-out: cubic-bezier(0.83, 0, 0.17, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}
body {
  font-variant-numeric: tabular-nums;
}
/* las etiquetas que antes eran mono: ahora Plus Jakarta 600, sin tracking */
.mono,
.case-head .id,
.case-row .k,
.media .tag,
.stat .src,
.week .when,
.client-body .who,
.pill,
.step .when,
.src {
  letter-spacing: 0;
  text-transform: none;
  font-weight: 600;
}
.case-row .k {
  font-size: 12px;
}
.case-row.on[data-tone="loss"] .v {
  font-family: var(--display);
  letter-spacing: -0.01em;
}

/* lenis */
html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-smooth [data-lenis-prevent] {
  overscroll-behavior: contain;
}

/* ───────────────── hero v8 ───────────────── */
.hero-v8 {
  position: relative;
  overflow: clip;
  padding-top: clamp(40px, 5vw, 72px);
}
.hero-v8 .wrap {
  position: relative;
  z-index: 2;
}

/* campo de color plano: un disco de superficie teal que entra por la esquina,
   sin desenfoque ni degradado; la retícula de marca encima */
.hero-v8 .field {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.hero-v8 .blob {
  position: absolute;
  border-radius: 50%;
  will-change: transform;
}
.hero-v8 .b1 {
  width: 64vw;
  height: 64vw;
  max-width: 880px;
  max-height: 880px;
  right: -14vw;
  top: -30vw;
  background: var(--teal-soft);
  animation: drift-a 28s var(--ease-in-out) infinite alternate;
}
.hero-v8 .b2 {
  width: 22vw;
  height: 22vw;
  max-width: 300px;
  max-height: 300px;
  right: 30vw;
  top: 16vw;
  background: var(--violet-soft);
  animation: drift-b 32s var(--ease-in-out) infinite alternate;
}
@keyframes drift-a {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(-3vw, 3vw, 0);
  }
}
@keyframes drift-b {
  from {
    transform: translate3d(0, 0, 0);
  }
  to {
    transform: translate3d(4vw, -3vw, 0);
  }
}
.hero-v8 .grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(42, 50, 50, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(42, 50, 50, 0.07) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 60% 55% at 72% 28%, #000 20%, transparent 72%);
  -webkit-mask-image: radial-gradient(ellipse 60% 55% at 72% 28%, #000 20%, transparent 72%);
}

/* la cifra: los dígitos son ventanas al video de la faena.
   El DOM sólo da la medida; un canvas dibuja los dígitos y recorta el video
   con su forma exacta (sin caja, sobre cualquier fondo). */
.hero-v8 .days .n {
  position: relative;
  display: inline-block;
  vertical-align: baseline;
}
.hero-v8 .days .n .n-video {
  position: absolute;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}
.hero-v8 .days .n .n-ink {
  display: block;
  line-height: 0.88;
  padding: 0 0.03em;
  white-space: nowrap;
  color: var(--ink);
}
html.js .hero-v8 .days .n .n-ink {
  color: transparent;
}
.hero-v8 .days .n .n-canvas {
  position: absolute;
  inset: -0.06em 0;
  width: 100%;
  height: calc(100% + 0.12em);
  pointer-events: none;
}
.hero-v8 .days .pre {
  color: var(--ink);
}
.hero-v8 .days .post {
  color: var(--ink);
}
.hero-v8 .days .unit {
  color: var(--teal-text);
}
/* sin JS o el último día del mes: una sola línea en tinta */
.hero-v8 .days.is-static .n {
  display: none;
}

/* H1 por líneas, con máscara para la entrada */
.hero-v8 h1 {
  margin-top: clamp(28px, 3vw, 40px);
}
.hero-v8 h1 .line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.06em;
  margin-bottom: -0.06em;
}
.hero-v8 h1 .line > span {
  display: block;
}
html.js .hero-v8 h1 .line > span {
  transform: translateY(110%);
}
@media (prefers-reduced-motion: reduce) {
  html.js .hero-v8 h1 .line > span {
    transform: none;
  }
}

.hero-v8 .hero-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
  margin-top: 32px;
}
.btn-mag {
  position: relative;
  padding: 16px 24px 16px 26px;
  font-size: 17px;
  box-shadow:
    0 18px 36px -18px rgba(108, 99, 255, 0.7),
    0 2px 6px -2px rgba(25, 184, 168, 0.35);
  background: linear-gradient(135deg, var(--teal-text) 0%, var(--violet-h) 100%);
  overflow: hidden;
}
.btn-mag::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--violet-h) 0%, var(--teal-text) 100%);
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
}
.btn-mag:hover::before {
  opacity: 1;
}
.btn-mag .btn-text,
.btn-mag svg {
  position: relative;
  z-index: 1;
}
.btn-mag svg {
  width: 18px;
  height: 18px;
  transition: transform 0.4s var(--ease-out);
}
.btn-mag:hover svg {
  transform: translateX(4px);
}
.btn-mag:active {
  transform: scaleY(0.96) scaleX(1.02);
}
.hero-more {
  font-weight: 600;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.3em;
  text-decoration-color: var(--teal);
  transition: text-decoration-color 0.25s;
}
.hero-more:hover {
  text-decoration-color: var(--ink);
}

/* banda de video + tarjeta de la brecha que emerge de ella */
.hero-v8 .band-wrap {
  position: relative;
  z-index: 1;
  margin-top: clamp(40px, 5vw, 64px);
}
.hero-v8 .band {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 6.5;
  min-height: 260px;
  max-height: 600px;
  overflow: hidden;
  background: var(--bg-2);
}
.hero-v8 .band video {
  position: absolute;
  inset: -14% 0;
  width: 100%;
  height: 128%;
  object-fit: cover;
  object-position: center 55%;
  will-change: transform;
}
.hero-case {
  position: absolute;
  right: max(24px, calc((100% - 1200px) / 2));
  top: -56px;
  width: min(340px, calc(100% - 48px));
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 18px 20px 14px;
  backdrop-filter: blur(8px);
  z-index: 3;
}
.hero-case p {
  margin: 0;
}
.hero-case .hc-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.hero-case .hc-st {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber-text);
}
.hero-case .hc-amt {
  margin-top: 10px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.02em;
  color: var(--amber-text);
  line-height: 1;
}
.hero-case .hc-meta {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-2);
}
.hero-case .hc-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* ───────────────── resto de la página: una gramática ───────────────── */
/* títulos: se destapan desde abajo (GSAP anima clip-path) */
html.js main section h2:not(.sr) {
  will-change: clip-path, transform;
}
/* puertas con inclinación 3D al pasar el cursor */
.doors {
  perspective: 1200px;
}
.door {
  transform-style: preserve-3d;
  transition:
    box-shadow 0.5s var(--ease-out),
    border-color 0.3s;
  will-change: transform;
}
.door:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--line-2);
}
/* industrias: la foto respira al pasar */
.ind .media.photo img {
  transition: transform 0.8s var(--ease-out);
}
.ind:hover .media.photo img {
  transform: scale(1.05);
}
/* 8,6 %: la cifra en el rojo del sitio, sobre la superficie, sin halo */
.stat .big {
  color: var(--loss-text);
}

/* ───────────────── móvil ───────────────── */
@media (max-width: 760px) {
  .hero-v8 .b1 {
    width: 120vw;
    height: 120vw;
    right: -60vw;
    top: -70vw;
  }
  .hero-v8 .b2 {
    width: 36vw;
    height: 36vw;
    right: -10vw;
    top: 62vw;
  }
  .hero-v8 .grid {
    display: none;
  }
  .hero-v8 .band {
    aspect-ratio: 4 / 3;
    min-height: 240px;
    max-height: 440px;
  }
  .hero-case {
    position: relative;
    top: auto;
    right: auto;
    width: auto;
    margin: -40px 16px 0;
  }
  .hero-v8 .band .vid-toggle {
    bottom: auto;
    top: 16px;
  }
  .hero-v8 .band-wrap {
    margin-top: 28px;
  }
  .btn-mag {
    width: 100%;
    justify-content: center;
  }
}
@media (hover: none) {
  .btn-mag:hover::before {
    opacity: 0;
  }
}

/* ───────────────── imágenes a color con un grado común ───────────────── */
.media.photo,
.door:hover .media.photo,
.ind:hover .media.photo {
  filter: none;
}
.media.photo::after {
  background: none;
}
.media.photo img,
.media.clip video,
.hero-v8 .band video {
  filter: url(#grade);
}
