/* =========================================================
   MOTION
   ========================================================= */

/* ---------------------------------------------------------
   1) HERO ZOOM-OUT — CSS scroll-driven
   --------------------------------------------------------- */
@keyframes scrollProgress {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* ---------------------------------------------------------
   2) CURSOR PERSONALIZADO — solo desktop con ratón
   --------------------------------------------------------- */
@media (hover: hover) and (min-width: 1025px) {
  * { cursor: none !important; }

  .cursor {
    position: fixed;
    top: 0; left: 0;
    width: 9px;
    height: 9px;
    background: var(--dark);
    border-radius: 50%;
    pointer-events: none;
    z-index: 99999;
    transform: translate(-50%, -50%);
    will-change: left, top;
    transition: opacity 0.3s ease, transform 0.15s ease;
  }

  .cursor.hidden { opacity: 0; }

  /* Crece al pasar sobre enlaces e imágenes */
  .cursor.hover {
    transform: translate(-50%, -50%) scale(2.2);
    background: transparent;
    border: 1px solid var(--dark);
  }

  /* Fondo oscuro (footer, hero) — cursor cambia a crema */
  .cursor.light {
    background: var(--bg);
  }
  .cursor.light.hover {
    background: transparent;
    border-color: var(--bg);
  }
}

/* ---------------------------------------------------------
   3) HOVER ZOOM — todas las imágenes, solo desktop
   --------------------------------------------------------- */
@media (hover: hover) and (min-width: 1025px) {

  /* Imagen apaisada full-width */
  .single-img img {
    clip-path: inset(0);
    transition: transform 0.6s ease-out;
  }
  .single-img img:hover {
    transform: scale(1.008);
  }

  /* Dípticos — mismo sistema que .single-img */
  .diptych .img-wrap img,
  .diptych-asym .img-wrap img {
    clip-path: inset(0);
    transition: transform 4s ease-out;
  }
  .diptych .img-wrap img:hover,
  .diptych-asym .img-wrap img:hover {
    transform: scale(1.008);
  }

  /* Grid 3 — overflow:hidden en .img-wrap contiene el zoom */
  .grid-3 .img-wrap img {
    transition: transform 0.6s ease-out;
  }
  .grid-3 .img-wrap:hover img {
    transform: scale(1.008);
  }
}

/* ---------------------------------------------------------
   6) GRAIN TEXTURE
   --------------------------------------------------------- */
.grain {
  position: fixed;
  top: -100px; left: -100px;
  width: calc(100% + 200px);
  height: calc(100% + 200px);
  pointer-events: none;
  z-index: 99998;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/></filter><rect width='200' height='200' filter='url(%23n)'/></svg>");
  animation: grainShift 0.5s steps(2) infinite;
}

@keyframes grainShift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-30px, -20px); }
  50%  { transform: translate(20px, -30px); }
  75%  { transform: translate(-20px, 25px); }
}

/* ---------------------------------------------------------
   7) INTRO SCREEN
   --------------------------------------------------------- */
.intro {
  position: fixed;
  inset: 0;
  background: var(--dark);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: introFade 0.9s ease-in 2.2s forwards;
}

.intro-logo {
  font-family: var(--font-body);
  font-size: var(--fs-3);
  font-weight: var(--fw-light);
  letter-spacing: var(--ls-tight);
  color: var(--bg);
  opacity: 0;
  animation: introLogoIn 1.4s ease-out 0.5s forwards;
}

.intro-logo .dot { color: var(--accent); }

@keyframes introLogoIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes introFade {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* ---------------------------------------------------------
   3) INDICADOR DE PROGRESO
   --------------------------------------------------------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  height: 1px;
  background: var(--accent);
  transform-origin: left center;
  transform: scaleX(0);
  z-index: 1000;
  pointer-events: none;
}

@supports not (animation-timeline: scroll()) {
  .scroll-progress { display: none; }
}

/* ---------------------------------------------------------
   4) SCROLL-SNAP — Móvil
   --------------------------------------------------------- */
@media (max-width: 768px) {
  html { scroll-snap-type: y proximity; }
  .hero, .work-section, #about {
    scroll-snap-align: start;
    scroll-snap-stop: normal;
  }
}

/* ---------------------------------------------------------
   5) REDUCED MOTION — Accesibilidad
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }  /* grain estático, sin movimiento */
  .hero img {
    animation: none !important;
    scale: none !important;
  }
  .diptych .img-wrap img,
  .diptych-asym .img-wrap img,
  .grid-3 .img-wrap img {
    transition: none !important;
    scale: none !important;
  }
  .scroll-progress { display: none; }
  html { scroll-snap-type: none !important; }
}
