/* ==========================================================================
   KrgoOS · Home de una sola pantalla (V2.27.1B)

   Prefijo `kh-` propio. Convive con `kw-` (el resto del sitio comercial) sin
   heredar de el: el Home dejo de ser una landing con secciones y pasó a ser
   una experiencia unica de 100svh, asi que casi nada de `kw-` le sirve.

   Regla dura: en escritorio NO hay scroll. La clase `.kh-lock` la pone y la
   quita el componente al montar y desmontar — nunca vive suelta en el CSS
   global, porque el resto de la SPA si necesita scroll.
   ========================================================================== */

html.kh-lock,
body.kh-lock {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.kh {
  --kh-ink: #f6f8fc;
  --kh-soft: #ccd6e6;
  --kh-mute: #9db0c8;
  --kh-amber: #ffae42;
  --kh-amber-hi: #ffc478;
  --kh-void: #04070d;
  --kh-mono: ui-monospace, SFMono-Regular, Menlo, "Cascadia Mono", "Roboto Mono", monospace;

  position: relative;
  min-height: 100svh;
  background: var(--kh-void);
  color: var(--kh-ink);
  font-family: var(--kw-font);
  overflow: hidden;
  isolation: isolate;
}

/* --------------------------------------------------------------------------
   Media: la pelicula es el fondo real, no un adorno detras de un velo negro
   -------------------------------------------------------------------------- */

.kh__media { position: absolute; inset: 0; z-index: 0; overflow: hidden; }

.kh__poster,
.kh__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 48%;
}

/* El poster vive DEBAJO del video: si el video no carga, no queda negro. */
.kh__poster { background-size: cover; background-position: 50% 48%; z-index: 0; }
.kh__video { z-index: 1; }

/* Velo en dos tiempos: un lavado general suave para que el texto tenga suelo,
   y refuerzos localizados arriba y abajo donde de verdad hay tipografia. La
   logistica se sigue viendo. */
.kh__scrim {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    /* suelo tipografico: una elipse suave bajo el copy, no un rectangulo negro */
    radial-gradient(46% 27% at 50% 27%, rgba(4, 7, 13, .70) 0%, rgba(4, 7, 13, .34) 60%, rgba(4, 7, 13, 0) 100%),
    linear-gradient(180deg, rgba(4, 7, 13, .72) 0%, rgba(4, 7, 13, .16) 26%,
                            rgba(4, 7, 13, .06) 52%, rgba(4, 7, 13, .70) 82%, rgba(4, 7, 13, .93) 100%),
    radial-gradient(132% 92% at 50% 44%, rgba(4, 7, 13, .06) 0%, rgba(4, 7, 13, .54) 100%);
}

/* --------------------------------------------------------------------------
   Cabecera
   -------------------------------------------------------------------------- */

.kh__hd {
  position: absolute;
  z-index: 6;
  inset: 0 0 auto 0;
  height: 78px;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 clamp(20px, 4vw, 60px);
}

.kh__logo { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; color: inherit; }
.kh__mark {
  width: 11px; height: 11px;
  background: var(--kh-amber);
  box-shadow: 0 0 22px 4px rgba(255, 174, 66, .45);
}
.kh__wordmark { font-size: 18px; font-weight: 640; letter-spacing: -.02em; }
.kh__wordmark b { color: var(--kh-amber); font-weight: 640; }

.kh__entrar {
  display: inline-flex; align-items: center;
  min-height: 44px;
  padding: 0 20px;
  border: 1px solid rgba(255, 255, 255, .26);
  color: var(--kh-ink);
  font-size: 13.5px;
  text-decoration: none;
  background: rgba(8, 13, 24, .32);
  backdrop-filter: blur(8px);
  transition: border-color .3s ease, background .3s ease;
}
.kh__entrar:hover { border-color: rgba(255, 174, 66, .8); background: rgba(255, 174, 66, .10); }

/* --------------------------------------------------------------------------
   Copy central
   -------------------------------------------------------------------------- */

.kh__centro {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: clamp(150px, 22vh, 230px);
  transform: translateX(-50%);
  width: min(820px, calc(100vw - 96px));
  text-align: center;
}

.kh-copy {
  transition:
    opacity var(--kh-t, .3s) cubic-bezier(.22, .61, .36, 1),
    transform var(--kh-t, .3s) cubic-bezier(.22, .61, .36, 1),
    filter var(--kh-t, .3s) cubic-bezier(.22, .61, .36, 1);
}
.kh-copy.is-out { --kh-t: .2s; opacity: 0; transform: translateY(-10px); filter: blur(6px); }
.kh-copy.is-in  { --kh-t: .3s; opacity: 1; transform: none; filter: none; }

.kh-copy__kicker {
  margin: 0 0 14px;
  font-family: var(--kh-mono);
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--kh-amber);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 18px rgba(3, 6, 12, .95);
}

.kh-copy__title {
  margin: 0;
  font-size: clamp(1.5rem, 2.6vw, 2.35rem);
  line-height: 1.12;
  letter-spacing: -.032em;
  font-weight: 600;
  text-wrap: balance;
  color: var(--kh-ink);
  text-shadow: 0 2px 30px rgba(3, 6, 12, .85), 0 1px 3px rgba(3, 6, 12, .5);
}

.kh-copy__lead {
  margin: 16px auto 0;
  max-width: 56ch;
  font-size: clamp(.88rem, 1vw, .975rem);
  line-height: 1.58;
  color: var(--kh-soft);
  text-wrap: pretty;
  text-shadow: 0 1px 22px rgba(3, 6, 12, .9), 0 1px 2px rgba(3, 6, 12, .6);
}

/* Espejo accesible del copy: los lectores de pantalla anuncian el cambio sin
   depender de la animacion visual. */
.kh-live {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Animacion logistica — storytelling secundario
   -------------------------------------------------------------------------- */

.kh__net {
  position: absolute;
  z-index: 3;
  left: 0; right: 0;
  bottom: 168px;
  height: 214px;
  pointer-events: none;
  color: rgba(255, 205, 140, .95);
  filter: drop-shadow(0 2px 7px rgba(2, 5, 11, .9));
}

.kh-net__lineas { position: absolute; inset: 0; width: 100%; height: 100%; }
.kh-net__leg {
  fill: none;
  stroke: rgba(255, 195, 120, .58);
  stroke-width: 1;
  stroke-dasharray: 3 7;
  transition: stroke .5s ease;
}

.kh-net__nodo {
  position: absolute;
  top: 46%;
  width: 9px; height: 9px;
  margin: -4.5px 0 0 -4.5px;
  border: 1px solid rgba(255, 190, 110, .75);
  background: rgba(4, 7, 13, .9);
  transition: border-color .5s ease, background .5s ease, box-shadow .5s ease;
}
.kh-net__nodo--origen  { left: 16.6%; }
.kh-net__nodo--destino { left: 83.4%; }

.kh-net__nodo--hub {
  left: 50%;
  width: 13px; height: 13px;
  margin: -6.5px 0 0 -6.5px;
  border-color: rgba(255, 174, 66, .85);
}
.kh-net__nodo--hub i,
.kh-net__nodo--hub u {
  position: absolute;
  inset: -11px;
  border: 1px solid rgba(255, 174, 66, .5);
  border-radius: 50%;
  opacity: 0;
  animation: kh-pulso 12s cubic-bezier(.22, .61, .36, 1) infinite;
}
.kh-net__nodo--hub u { animation-delay: .45s; }

@keyframes kh-pulso {
  0%, 34%   { transform: scale(.5); opacity: 0; }
  40%       { transform: scale(1); opacity: .85; }
  52%, 100% { transform: scale(2.1); opacity: 0; }
}

.kh-net__local {
  position: absolute;
  color: rgba(214, 228, 244, .55);
  transition: color .5s ease;
}
.kh-net__local--a { left: 68%; top: 68%; color: rgba(214, 228, 244, .58); }
.kh-net__local--b { left: 90.5%; top: 70%; }

/* El truco de escala: el contenedor mide el 100 % del ancho, asi que un
   translateX en porcentaje recorre exactamente ese porcentaje del viewport.
   El vehiculo va dentro, con tamano fijo en px — no se deforma nunca. */
.kh-veh {
  position: absolute;
  left: 0; top: 0;
  width: 100%; height: 100%;
  will-change: transform;
}
.kh-veh__slot { position: absolute; left: -38px; top: 46%; margin-top: -30px; display: block; }
.kh-veh__svg { display: block; }

.kh-veh--main  { animation: kh-main 12s cubic-bezier(.35, 0, .3, 1) infinite; }
.kh-veh--out1  { animation: kh-out1 12s cubic-bezier(.35, 0, .3, 1) infinite; }
.kh-veh--out2  { animation: kh-out2 12s cubic-bezier(.35, 0, .3, 1) infinite; }
.kh-veh--out3  { animation: kh-out3 12s cubic-bezier(.35, 0, .3, 1) infinite; }

.kh-veh--main .kh-veh__slot { animation: kh-fade-main 12s linear infinite; }
.kh-veh--out1 .kh-veh__slot { animation: kh-fade-out 12s linear infinite; }
.kh-veh--out2 .kh-veh__slot { animation: kh-fade-out 12s linear infinite; animation-delay: .5s; }
.kh-veh--out3 .kh-veh__slot { animation: kh-fade-out 12s linear infinite; animation-delay: 1s; }

@keyframes kh-main {
  0%        { transform: translateX(14%); }
  34%, 100% { transform: translateX(49%); }
}
@keyframes kh-fade-main {
  0%   { opacity: 0; }
  6%   { opacity: 1; }
  32%  { opacity: 1; }
  36%, 100% { opacity: 0; }
}

@keyframes kh-out1 {
  0%, 38%  { transform: translateX(50%) translateY(0); }
  92%, 100% { transform: translateX(82%) translateY(0); }
}
@keyframes kh-out2 {
  0%, 40%  { transform: translateX(50%) translateY(0); }
  94%, 100% { transform: translateX(66.5%) translateY(58px); }
}
@keyframes kh-out3 {
  0%, 42%  { transform: translateX(50%) translateY(0); }
  96%, 100% { transform: translateX(89.5%) translateY(62px); }
}
@keyframes kh-fade-out {
  0%, 40%   { opacity: 0; }
  46%       { opacity: .95; }
  86%       { opacity: .95; }
  94%, 100% { opacity: 0; }
}

/* Sincronizacion: la puerta activa ilumina su tramo de la cadena. */
.kh[data-activa="proveedor"]   .kh-net__nodo--origen,
.kh[data-activa="plataforma"]  .kh-net__nodo--hub,
.kh[data-activa="distribuidor"] .kh-net__nodo--destino {
  border-color: var(--kh-amber-hi);
  background: rgba(255, 174, 66, .9);
  box-shadow: 0 0 26px 6px rgba(255, 174, 66, .34);
}
.kh[data-activa="proveedor"]   .kh-net__leg--in,
.kh[data-activa="distribuidor"] .kh-net__leg--out {
  stroke: rgba(255, 196, 120, .78);
}
.kh[data-activa="distribuidor"] .kh-net__local { color: rgba(255, 200, 130, .88); }
.kh[data-activa="proveedor"] .kh-net__nodo--origen,
.kh[data-activa="distribuidor"] .kh-net__nodo--destino { width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; }

/* --------------------------------------------------------------------------
   Control de pausa
   -------------------------------------------------------------------------- */

/* El control vive en la cabecera: discreto, siempre accesible, y nunca se
   cruza con la cadena logistica ni con el riel. */
.kh__pausa {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .2);
  background: rgba(8, 13, 24, .5);
  backdrop-filter: blur(10px);
  color: var(--kh-ink);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  transition: border-color .3s ease, background .3s ease;
}
.kh__pausa:hover { border-color: rgba(255, 174, 66, .75); }
.kh__pausa-glifo { color: var(--kh-amber); font-size: 11px; }

/* --------------------------------------------------------------------------
   Riel de acceso: UNA superficie, no tres tarjetas
   -------------------------------------------------------------------------- */

.kh__rail {
  position: absolute;
  z-index: 6;
  left: 0; right: 0; bottom: 0;
  display: flex;
  height: 168px;
  background: linear-gradient(180deg, rgba(8, 13, 24, .18), rgba(5, 9, 18, .62));
  backdrop-filter: blur(12px) saturate(.88);
  border-top: 1px solid rgba(255, 255, 255, .16);
}

.kh-seg {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  padding: 28px clamp(20px, 2.6vw, 40px) 0;
  text-decoration: none;
  color: inherit;
  transition: flex-grow .5s cubic-bezier(.22, .61, .36, 1),
              opacity .4s ease,
              background .4s ease,
              transform .5s cubic-bezier(.22, .61, .36, 1);
  transform-origin: 50% 100%;
}
.kh-seg + .kh-seg::before {
  content: "";
  position: absolute;
  left: 0; top: 26px; bottom: 26px;
  width: 1px;
  background: rgba(255, 255, 255, .12);
}

.kh-seg__label {
  display: block;
  font-family: var(--kh-mono);
  font-size: 11px;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--kh-mute);
  transition: color .4s ease;
}

.kh-seg__copy { display: block; margin-top: 12px; }
.kh-seg__title {
  display: block;
  font-size: clamp(.95rem, 1.15vw, 1.08rem);
  line-height: 1.36;
  letter-spacing: -.012em;
  font-weight: 560;
  color: var(--kh-soft);
  transition: color .4s ease;
}
.kh-seg__lead { display: none; }

.kh-seg__go {
  position: absolute;
  left: clamp(20px, 2.6vw, 40px);
  bottom: 26px;
  width: 0;
  height: 1px;
  background: var(--kh-amber);
  transition: width .5s cubic-bezier(.22, .61, .36, 1);
}

.kh-seg.is-on {
  flex-grow: 1.5;
  background: linear-gradient(180deg, rgba(255, 174, 66, .11), rgba(255, 174, 66, 0) 66%);
  transform: scale(1.02);
}
.kh-seg.is-on .kh-seg__label { color: var(--kh-amber); }
.kh-seg.is-on .kh-seg__title { color: var(--kh-ink); }
.kh-seg.is-on .kh-seg__go { width: 54px; }
.kh-seg.is-on::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -1px;
  height: 2px;
  background: var(--kh-amber);
}

.kh a:focus-visible,
.kh button:focus-visible {
  outline: 2px solid var(--kh-amber);
  outline-offset: 3px;
}

/* En escritorio el pie no existe: el Home cabe en una pantalla. */
.kh__pie { display: none; }

/* --------------------------------------------------------------------------
   Movimiento reducido
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .kh-veh,
  .kh-veh__slot,
  .kh-net__nodo--hub i,
  .kh-net__nodo--hub u { animation: none !important; }
  .kh-veh--main .kh-veh__slot,
  .kh-veh--out1 .kh-veh__slot,
  .kh-veh--out2 .kh-veh__slot,
  .kh-veh--out3 .kh-veh__slot { opacity: .9; }
  .kh-veh--main { transform: translateX(30%); }
  .kh-veh--out1 { transform: translateX(70%); }
  .kh-veh--out2 { transform: translateX(60%) translateY(46px); }
  .kh-veh--out3 { transform: translateX(88%) translateY(56px); }
  .kh-copy,
  .kh-seg { transition: none; }
}

/* --------------------------------------------------------------------------
   Movil: aqui SI hay scroll. Nada se comprime a la fuerza.
   -------------------------------------------------------------------------- */

@media (max-width: 899px) {
  /* La media queda anclada arriba y el flujo empieza debajo: asi el copy
     puede posicionarse contra la banda de video y no contra la pagina entera,
     que en movil mide mucho mas que el viewport. */
  .kh { min-height: auto; overflow: visible; padding-top: var(--kh-banda); }
  .kh { --kh-banda: max(380px, 62svh); }

  .kh__media { height: var(--kh-banda); }
  .kh__scrim {
    background:
      linear-gradient(180deg, rgba(4, 7, 13, .74) 0%, rgba(4, 7, 13, .16) 30%,
                              rgba(4, 7, 13, .55) 74%, var(--kh-void) 100%);
  }

  .kh__hd { position: absolute; height: 60px; }

  .kh__centro {
    position: absolute;
    left: 20px; right: 20px;
    top: 0;
    transform: none;
    height: var(--kh-banda);
    width: auto;
    transform: none;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding-bottom: 26px;
  }
  .kh-copy__kicker { margin-bottom: 12px; }
  .kh-copy__title { font-size: clamp(1.5rem, 6.4vw, 2rem); }
  .kh-copy__lead { margin-left: 0; font-size: .95rem; }

  /* La cadena se simplifica: sin vehiculos animados, solo la ruta y sus nodos
     como cinta vertical junto al riel. */
  .kh__net { display: none; }

  .kh__pausa { padding: 0 12px; font-size: 11.5px; }

  .kh__rail {
    position: static;
    display: block;
    height: auto;
    backdrop-filter: none;
    background: var(--kh-void);
    border-top: 0;
    padding: 8px 0 4px;
  }

  /* En tactil no hay hover: cada puerta lleva su propio mensaje encima. */
  .kh-seg {
    display: block;
    padding: 22px 20px 22px 34px;
    border-top: 1px solid rgba(255, 255, 255, .10);
    transform: none;
  }
  .kh-seg + .kh-seg::before { display: none; }
  .kh-seg::before {
    content: "";
    position: absolute;
    left: 20px; top: 27px;
    width: 7px; height: 7px;
    border: 1px solid rgba(255, 174, 66, .6);
  }
  .kh-seg__label { font-size: 10.5px; }
  .kh-seg__title { font-size: 1.02rem; color: var(--kh-ink); }
  .kh-seg__lead {
    display: block;
    margin-top: 7px;
    font-size: .875rem;
    line-height: 1.52;
    color: var(--kh-mute);
  }
  .kh-seg__go { position: static; display: block; width: 40px; margin-top: 14px; }
  .kh-seg.is-on { flex-grow: 0; transform: none; background: none; }
  .kh-seg.is-on::after { display: none; }
  .kh-seg:active {
    background: linear-gradient(90deg, rgba(255, 174, 66, .14), rgba(255, 174, 66, 0) 62%);
  }
  .kh-seg:active::before { background: var(--kh-amber); }

  .kh__pie { display: block; }
}
