/* Kit de efectos para demos AllinWeb — sin dependencias.
   Todo estado oculto vive bajo html.fx-listo: sin JavaScript (o con
   movimiento reducido) el contenido se ve completo y quieto. */

:root {
  --fx-cierre: cubic-bezier(.7, 0, .1, 1);      /* arranque lento, cierre firme */
  --fx-salida: cubic-bezier(.16, 1, .3, 1);     /* frena suave */
  --fx-resorte: cubic-bezier(.3, 1.6, .4, 1);   /* rebote corto */
  --fx-puerta: #1d2a3a;                         /* color de las puertas */
  --fx-acento: #d43c3c;                         /* línea del pulso y nodos */
}

/* ───────── 1. Puertas: dos paneles que se abren sobre la portada ───────── */
[data-fx~="puertas"] { position: relative; overflow: hidden; }
.fx-puerta {
  position: absolute; top: 0; bottom: 0; width: 50.5%; z-index: 5;
  background: var(--fx-puerta); pointer-events: none; display: none;
}
.fx-puerta--izq { left: 0; border-right: 1px solid rgb(0 0 0 / .25); }
.fx-puerta--der { right: 0; }
.fx-listo .fx-puerta { display: block; transition: transform 1.4s var(--fx-cierre) .15s; }
.fx-listo .fx-abierta > .fx-puerta--izq { transform: translateX(-101%); }
.fx-listo .fx-abierta > .fx-puerta--der { transform: translateX(101%); }
.fx-listo [data-fx~="puertas"] [data-fx-foto] {
  transform: scale(1.12); transition: transform 2.2s var(--fx-salida) .15s;
}
.fx-listo [data-fx~="puertas"].fx-abierta [data-fx-foto] { transform: none; }
.fx-listo [data-fx~="puertas"] [data-fx-apoyo] {
  opacity: 0; transform: translateY(16px);
  transition: opacity 1s var(--fx-cierre), transform 1s var(--fx-cierre);
  transition-delay: calc(1.1s + var(--fx-i, 0) * .1s);
}
.fx-listo [data-fx~="puertas"].fx-abierta [data-fx-apoyo] { opacity: 1; transform: none; }

/* ───────── 2. Líneas: el texto sube desde detrás de una máscara ───────── */
.fx-w {
  display: inline-block; overflow: hidden; vertical-align: top;
  /* Aire para que la máscara no corte las descendentes ni las cursivas. */
  padding: 0 .08em .14em; margin: 0 -.08em -.14em;
}
.fx-wi { display: inline-block; }
.fx-listo [data-fx~="lineas"] .fx-wi {
  transform: translateY(125%);
  transition: transform 1.2s var(--fx-cierre);
  transition-delay: calc(var(--fx-retraso, 0s) + var(--fx-l, 0) * .09s);
}
.fx-listo [data-fx~="lineas"].fx-visto .fx-wi { transform: none; }
.fx-hecho .fx-w { overflow: visible; }

/* ───────── 3. Revelar: la foto aparece con un recorte que se abre ───────── */
.fx-listo [data-fx~="revelar"] {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.3s var(--fx-cierre);
  transition-delay: var(--fx-retraso, 0s);
}
.fx-listo [data-fx~="revelar"][data-fx-desde="arriba"]    { clip-path: inset(0 0 100% 0); }
.fx-listo [data-fx~="revelar"][data-fx-desde="izquierda"] { clip-path: inset(0 100% 0 0); }
.fx-listo [data-fx~="revelar"][data-fx-desde="derecha"]   { clip-path: inset(0 0 0 100%); }
.fx-listo [data-fx~="revelar"][data-fx-desde="suave"]     { clip-path: inset(12% 0 0 0); }
.fx-listo [data-fx~="revelar"].fx-visto { clip-path: inset(0 0 0 0); }

/* ───────── 4. Condensar: letras de humo que toman peso (fuente variable) ───────── */
.fx-palabra { display: inline-block; white-space: nowrap; }
.fx-c { display: inline-block; text-align: center; }
.fx-listo [data-fx~="condensar"] .fx-c {
  font-weight: 200; filter: blur(12px); opacity: .35;
  transition: font-weight var(--fx-dur, 1.8s) var(--fx-salida),
              filter var(--fx-dur, 1.8s) var(--fx-salida),
              opacity var(--fx-dur, 1.8s) var(--fx-salida);
  transition-delay: calc(var(--fx-retraso, 0s) + var(--fx-r, 0) * 1s);
}
.fx-listo [data-fx~="condensar"].fx-visto .fx-c {
  font-weight: var(--fx-peso, 800); filter: blur(0); opacity: 1;
}

/* ───────── 5. Palabras: el párrafo se va «encendiendo» con el scroll ───────── */
.fx-listo [data-fx~="palabras"] .fx-p { opacity: calc(.22 + .78 * var(--fx-o, 0)); }

/* ───────── 6. Horizontal: la sección se queda fija y avanza de lado ───────── */
[data-fx~="horizontal"] [data-fx-pista] {
  display: flex; gap: var(--fx-hueco, 4vw);
  overflow-x: auto; scroll-snap-type: x mandatory; padding-inline: 6vw;
}
[data-fx~="horizontal"] [data-fx-pista] > * { flex: none; scroll-snap-align: center; }
.fx-fijo { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; }
.fx-horizontal-activo .fx-fijo { display: flex; flex-direction: column; justify-content: center; }
.fx-horizontal-activo [data-fx-pista] {
  overflow: visible; scroll-snap-type: none; width: max-content; will-change: transform;
}

/* ───────── 7. Parallax: la foto se desliza dentro de su marco ───────── */
.fx-marco { overflow: hidden; }
.fx-listo [data-fx~="parallax"] { transform: translateY(var(--fx-y, 0%)) scale(1.1); will-change: transform; }

/* ───────── 8. Trazo: las líneas de un SVG se dibujan solas ───────── */
.fx-listo [data-fx~="trazo"] .fx-t {
  stroke-dasharray: 1; stroke-dashoffset: calc(1 - var(--fx-p, 0));
}
.fx-listo [data-fx~="trazo"]:not([data-fx-modo="scroll"]) .fx-t {
  transition: stroke-dashoffset var(--fx-dur, 1.1s) cubic-bezier(.65, 0, .35, 1);
  transition-delay: calc(var(--fx-i, 0) * .12s);
}
.fx-listo [data-fx~="trazo"].fx-visto:not([data-fx-modo="scroll"]) .fx-t { --fx-p: 1; }
.fx-listo [data-fx~="trazo"] [data-fx-nodo] {
  transform-box: fill-box; transform-origin: center;
  transform: scale(0); transition: transform .35s var(--fx-resorte);
}
.fx-listo [data-fx~="trazo"] [data-fx-nodo].fx-activo { transform: none; }
.fx-listo [data-fx~="trazo"] [data-fx-rotulo] {
  opacity: 0; transform: translateX(-12px);
  transition: opacity .4s, transform .4s var(--fx-salida);
}
.fx-listo [data-fx~="trazo"] [data-fx-rotulo].fx-activo { opacity: 1; transform: none; }

/* ───────── 9. Descifrar: el texto se arma entre caracteres al azar ───────── */
[data-fx~="descifrar"] { font-variant-numeric: tabular-nums; }

/* ───────── 10. Cursor propio con estados ───────── */
.fx-cursor {
  position: fixed; left: 0; top: 0; z-index: 9999; pointer-events: none;
  width: 40px; height: 40px; margin: -20px 0 0 -20px; border-radius: 50%;
  display: grid; place-items: center;
  backdrop-filter: invert(1) hue-rotate(180deg);
  -webkit-backdrop-filter: invert(1) hue-rotate(180deg);
  transform: translate3d(var(--fx-x, -100px), var(--fx-y, -100px), 0) scale(var(--fx-s, 0));
  transition: --fx-s .5s var(--fx-salida), background-color .3s;
}
@property --fx-s { syntax: "<number>"; inherits: false; initial-value: 0; }
.fx-cursor[data-estado="punto"]  { --fx-s: .25; }
.fx-cursor[data-estado="enlace"] { --fx-s: 1; }
.fx-cursor[data-estado="ver"] {
  --fx-s: 2.2; backdrop-filter: none; -webkit-backdrop-filter: none;
  background: var(--fx-cursor-fondo, #fff);
}
.fx-cursor span {
  font: 600 5.5px/1 system-ui, sans-serif; letter-spacing: .08em; text-transform: uppercase;
  color: var(--fx-cursor-texto, #111); opacity: 0; transition: opacity .3s;
}
.fx-cursor[data-estado="ver"] span { opacity: 1; }
.fx-con-cursor, .fx-con-cursor a, .fx-con-cursor button { cursor: none; }
.fx-con-cursor input, .fx-con-cursor textarea, .fx-con-cursor select { cursor: auto; }

/* ───────── 11. Tono: la cabecera cambia de color según la sección de abajo ───────── */
[data-fx~="tono"] { transition: color .7s ease-in-out; }
[data-fx~="tono"][data-tono-actual="oscuro"] { color: #fff; }

/* ───────── 12. Escena: sección fija con pasos, opcionalmente abierta con un corte ───────── */
.fx-listo [data-fx~="escena"][data-fx-apertura="corte"] .fx-fijo { clip-path: var(--fx-corte); }
.fx-listo [data-fx~="escena"] [data-fx-paso] {
  opacity: 0; transform: translateY(18px); pointer-events: none;
  transition: opacity .5s, transform .7s var(--fx-salida);
}
.fx-listo [data-fx~="escena"] [data-fx-paso].fx-activo { opacity: 1; transform: none; pointer-events: auto; }

/* ───────── 13. Expandir: la miniatura crece hasta llenar la pantalla ───────── */
[data-fx~="expandir"] { cursor: zoom-in; }
.fx-capa {
  position: fixed; inset: 0; z-index: 9000; overflow: auto; overscroll-behavior: contain;
  background: var(--fx-capa-fondo, #0e1116); color: #fff;
}
.fx-capa-foto { position: fixed; inset: 0; overflow: hidden; }
.fx-capa-foto img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fx-capa-velo { position: fixed; inset: 0; background: rgb(0 0 0 / .45); opacity: 0; transition: opacity .7s; }
.fx-capa-texto {
  position: relative; min-height: 100%; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 12vh 6vw 8vh; opacity: 0; transform: translateY(20px);
  transition: opacity .7s .35s, transform .9s var(--fx-salida) .35s;
}
.fx-capa-pie { font-size: clamp(1.3rem, 2.6vw, 2.2rem); line-height: 1.2; max-width: 26ch; margin: 0; text-wrap: balance; }
.fx-capa-cerrar {
  position: fixed; top: 20px; right: 20px; z-index: 2; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgb(255 255 255 / .5); background: rgb(0 0 0 / .35); color: #fff;
  font: 400 22px/1 system-ui, sans-serif; cursor: pointer; opacity: 0; transition: opacity .5s .5s;
}
.fx-capa.fx-abierta .fx-capa-velo,
.fx-capa.fx-abierta .fx-capa-cerrar { opacity: 1; }
.fx-capa.fx-abierta .fx-capa-texto { opacity: 1; transform: none; }

/* ───────── 14. Pulso: línea viva tipo sismógrafo (canvas) ───────── */
canvas[data-fx~="pulso"] { display: block; width: 100%; height: 120px; }

/* ───────── 16. Gota: lente con forma de gota de agua que sigue al mouse ───────── */
[data-fx~="gota"] { position: relative; }
.fx-gota {
  position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none;
  width: var(--fx-gota, 150px); height: var(--fx-gota, 150px);
  margin: calc(var(--fx-gota, 150px) / -2) 0 0 calc(var(--fx-gota, 150px) / -2);
  border-radius: 50%; background-repeat: no-repeat;
  transform: translate3d(var(--fx-x, 0), var(--fx-y, 0), 0) scale(var(--fx-s, 0));
  transition: --fx-s .55s var(--fx-resorte);
  /* Brillo arriba a la izquierda, sombra abajo a la derecha: volumen de gota. */
  box-shadow:
    inset 0 0 0 1px rgb(255 255 255 / .3),
    inset 10px 14px 22px -8px rgb(255 255 255 / .55),
    inset -14px -18px 26px -6px rgb(0 0 0 / .5),
    0 16px 30px -12px rgb(0 0 0 / .6);
  animation: fx-gota-forma 5s ease-in-out infinite;
}
.fx-gota::after {
  content: ""; position: absolute; left: 18%; top: 12%; width: 28%; height: 15%;
  border-radius: 50%; transform: rotate(-28deg); filter: blur(1px);
  background: radial-gradient(closest-side, rgb(255 255 255 / .85), transparent);
}
.fx-gota.fx-activa { --fx-s: 1; }
@keyframes fx-gota-forma {
  0%, 100% { border-radius: 50%; }
  33% { border-radius: 47% 53% 52% 48% / 53% 47% 53% 47%; }
  66% { border-radius: 53% 47% 48% 52% / 47% 53% 47% 53%; }
}

/* ───────── 17. Onda: la foto ondula como agua al pasar el mouse (lo maneja efectos.js) ───────── */
[data-fx~="onda"] { overflow: hidden; }

/* ───────── 15. Detalles solo con CSS ───────── */
/* Subrayado que se recoge al pasar el mouse y vuelve a entrar */
.fx-subrayado {
  display: inline-block; padding-bottom: .25em; text-decoration: none; color: inherit;
  background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat;
  transition: background-size .5s var(--fx-cierre);
}
.fx-subrayado:hover { background-size: 0% 1px; background-position: right bottom; }
/* Foto que crece apenas al pasar el mouse por su tarjeta */
.fx-zoom { overflow: hidden; }
.fx-zoom > * { transition: transform 1.2s var(--fx-cierre); }
.fx-zoom:hover > *, a:hover .fx-zoom > * { transform: scale(1.03); }
/* Fila de lista que se corre con un rebote */
.fx-fila { transition: transform .6s var(--fx-resorte); }
.fx-fila:hover { transform: translateX(14px); }
/* Menú móvil que baja como persiana: alterna la clase .fx-abierta */
.fx-persiana { clip-path: inset(0 0 100% 0); transition: clip-path .7s var(--fx-cierre); }
.fx-persiana.fx-abierta { clip-path: inset(0 0 0 0); }

@media (prefers-reduced-motion: reduce) {
  .fx-zoom > *, .fx-fila, .fx-subrayado, .fx-persiana { transition: none; }
  .fx-fila:hover, .fx-zoom:hover > * { transform: none; }
}
