/* Simple Suite — movimiento (pedido del dueño 14/11/2026): entrada derecha→izquierda con fade, transición entre
   páginas, "spotlight" sobre las opciones y velo al abrir menús y el visor de capturas.
   Solo se animan transform y opacity (sin layout shift). Sin JS no se oculta nada: las clases que esconden las
   pone js/fx.js. prefers-reduced-motion: sin desplazamientos ni spotlight animado. */

:root { --fx-in: 700ms; --fx-ease: cubic-bezier(.16,.84,.3,1); --fx-shift: 56px; }

/* ---------- 1. Entrada al aparecer en pantalla (la clase la pone js/fx.js) ---------- */
html.js .fx-in { opacity: 0; transform: translateX(var(--fx-shift)); }
html.js .fx-in.is-in {
  opacity: 1; transform: none;
  transition: opacity var(--fx-in) ease-out, transform var(--fx-in) var(--fx-ease);
  transition-delay: var(--fx-delay, 0ms);
}
/* La aparición vieja de site.css (.reveal, de abajo hacia arriba) pasa a ser de derecha a izquierda. */
html.js .reveal { transform: translateX(var(--fx-shift)); }
/* Lo que espera su entrada está corrido a la derecha: sin esto la página gana scroll horizontal (aviso del VPS). */
html.js { overflow-x: clip; } /* en html: el clip de body (site.css) se propaga al viewport como hidden y la página sigue desplazable */

/* ---------- 2. Transición entre páginas ---------- */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 170ms ease-in both fx-out-left; }
::view-transition-new(root) { animation: 320ms var(--fx-ease) both fx-in-right; }
@keyframes fx-out-left { to { opacity: 0; transform: translateX(-24px); } }
@keyframes fx-in-right { from { opacity: 0; transform: translateX(24px); } }
@keyframes fx-fade { from { opacity: 0; } }
/* Navegadores sin View Transitions entre documentos: fade simple (la clase la pone el <head>). */
html.fx-fallback body { animation: fx-fade 220ms ease-out both; }
html.fx-leaving body { opacity: 0; transition: opacity 150ms ease-in; }

/* ---------- 3. Spotlight sobre las opciones (solo con mouse; en táctil no) ---------- */
.fx-opt { transition: opacity 280ms ease, box-shadow 280ms ease, transform 280ms var(--fx-ease); }
@media (hover: hover) and (pointer: fine) {
  .fx-group:has(> .fx-opt:hover, > .fx-opt:focus-within) > .fx-opt:not(:hover):not(:focus-within) { opacity: .35; }
  .fx-group > .fx-opt:hover, .fx-group > .fx-opt:focus-within {
    transform: translateY(-6px); box-shadow: 0 22px 44px -16px rgba(23,23,26,.45), 0 4px 10px rgba(23,23,26,.12);
    position: relative; z-index: 2;
  }
}
/* Con teclado también en táctil/híbridos: el foco ilumina su opción. */
.fx-group:has(> .fx-opt:focus-visible, > .fx-opt :focus-visible) > .fx-opt:not(:focus-within) { opacity: .35; }

/* Velo al abrir el menú móvil y el selector de idioma (no tapa el menú: queda debajo de él). */
.site-header:has(.nav.is-open)::after, .site-header:has(.lang-pick[open])::after, .site-header:has(.apps-pick[open])::after {
  content: ""; position: fixed; left: 0; right: 0; top: 56px; bottom: 0; z-index: 30;
  background: rgba(23,23,26,.38); pointer-events: none; animation: fx-fade 200ms ease-out both;
}
@media (min-width: 900px) { .site-header:has(.nav.is-open)::after { display: none; } .site-header:has(.lang-pick[open])::after, .site-header:has(.apps-pick[open])::after { top: 60px; } }
.nav.is-open, .lang-pick[open] ul, .apps-pick[open] .apps-pick-panel { animation: fx-fade 180ms ease-out both; }

/* Visor de capturas: fondo oscurecido y contenido con fade. */
dialog.lightbox[open] { animation: fx-fade 220ms ease-out both; }
dialog.lightbox[open]::backdrop { animation: fx-fade 260ms ease-out both; }
dialog.lightbox img { transition: opacity 180ms ease; }
dialog.lightbox img.fx-swap { opacity: 0; }

/* ---------- 4. Movimiento reducido ----------
   Decisión del dueño (14/11/2026): con prefers-reduced-motion el movimiento NO se apaga (Windows lo activa al
   desmarcar "Mostrar animaciones" y el dueño pidió ver las transiciones): es IDÉNTICO al normal.
   site.css (base) pone transition/animation-duration a .01ms !important en ese modo: acá se restauran. */
@media (prefers-reduced-motion: reduce) {
  html.js .fx-in.is-in { transition-duration: var(--fx-in) !important; transition-delay: var(--fx-delay, 0ms) !important; }
  html.js .reveal { transition-duration: var(--fx-in) !important; }
  html.js .reveal:not(.is-in) { opacity: 0; }
  .fx-opt { transition-duration: 280ms !important; }
  html.fx-leaving body { transition-duration: 150ms !important; }
  html.fx-fallback body { animation-duration: 220ms !important; }
  .nav.is-open, .lang-pick[open] ul, .apps-pick[open] .apps-pick-panel { animation-duration: 180ms !important; }
  dialog.lightbox[open] { animation-duration: 220ms !important; }
  dialog.lightbox[open]::backdrop { animation-duration: 260ms !important; }
  dialog.lightbox img { transition-duration: 180ms !important; }
  .site-header::after { animation-duration: 200ms !important; }
}
