/* ============================================================
   Movimiento tipo revista — GESG (2-dic-2026)
   Va después de tema-seraj.css. Todo el movimiento vive dentro de
   prefers-reduced-motion: no-preference, y lo que depende del JS
   solo se esconde con html.revista (que pone revista.js).
   ============================================================ */

/* ---------- Sección de la frase (se ve bien aun sin movimiento) ---------- */
.revista-frase {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 112vh; display: grid; place-content: center; text-align: center;
  padding: 140px 24px;
  background:
    linear-gradient(180deg, #142036 0%, rgba(20,32,54,0) 14%, rgba(20,32,54,0) 74%, #CBD3DD 100%),
    #142036 url("../images/estilo/textura-noche.jpg") repeat;
  background-size: auto, 512px;
}
.revista-frase .frase {
  position: relative; z-index: 2; margin: 0 auto; max-width: 13ch;
  font-family: "Fraunces", Georgia, serif; font-weight: 400;
  font-size: clamp(2.5rem, 6.2vw, 5.6rem); line-height: 1.04; letter-spacing: -.015em;
  color: #F4F3F0;
}
.revista-frase .frase-pie {
  position: relative; z-index: 2; margin: 30px auto 0; max-width: 42ch;
  color: rgba(244,243,240,.76); font-size: 1.08rem; line-height: 1.6;
}
.revista-frase .frase-pie a { color: #F4F3F0; text-underline-offset: 4px; }
.frase-fotos { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.frase-fotos img {
  position: absolute; height: auto; border-radius: 2px;
  width: clamp(110px, 12vw, 200px);
  box-shadow: 0 14px 28px rgba(0,0,0,.38);
  will-change: transform;
}
/* acomodo: alrededor del texto, nunca encima */
.frase-fotos .f1 { top: 9%;  left: 7%;  width: clamp(169px, 19vw, 310px); }
.frase-fotos .f2 { top: 5%;  left: 58%; width: clamp(156px, 16vw, 270px); }
.frase-fotos .f3 { top: 27%; left: 84%; width: clamp(117px, 12vw, 202px); }
.frase-fotos .f4 { top: 66%; left: 77%; width: clamp(169px, 19vw, 310px); }
.frase-fotos .f5 { top: 82%; left: 44%; width: clamp(143px, 15vw, 243px); }
.frase-fotos .f6 { top: 70%; left: 6%;  width: clamp(156px, 16vw, 270px); }
.frase-fotos .f7 { top: 38%; left: 1%;  width: clamp(104px, 11vw, 176px); }
.frase-fotos .f8 { top: 12%; left: 32%; width: clamp(104px, 9vw, 162px); }

@media (max-width: 900px) {
  .revista-frase { min-height: 100svh; padding: 120px 20px; }
  .frase-fotos img { width: 96px !important; }
  .frase-fotos .f1 { top: 6%; left: 4%; }
  .frase-fotos .f2 { top: 9%; left: 64%; }
  .frase-fotos .f4 { top: 78%; left: 66%; }
  .frase-fotos .f6 { top: 82%; left: 6%; }
  .frase-fotos .f3, .frase-fotos .f5, .frase-fotos .f7, .frase-fotos .f8 { display: none; }
}

@media (prefers-reduced-motion: no-preference) {

  /* ---------- Cambio de página: se desvanece como hoja que pasa ---------- */
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: salePagina .42s cubic-bezier(.4,0,.2,1) both; }
  ::view-transition-new(root) { animation: entraPagina .62s cubic-bezier(.2,.6,.2,1) both; }
  @keyframes salePagina { to { opacity: 0; } }
  @keyframes entraPagina { from { opacity: 0; } }

  /* ---------- Portada: la imagen se enfoca al llegar y se aleja al bajar ---------- */
  @keyframes enfoque { from { scale: 1.1; } to { scale: 1; } }
  @keyframes veloSale { from { opacity: 1; } }
  body:not(.pagina):not(.admin-body) .escenario {
    will-change: transform;
    animation: enfoque 2.4s cubic-bezier(.2,.6,.2,1) backwards, acercamiento 28s ease-in-out 2.4s infinite alternate;
  }
  /* El desenfoque, sin desenfocar en vivo: una copia ya desenfocada y oscurecida de la
     misma foto (revista.js la pone) que aparece y desaparece. Se ve igual; solo cuesta opacidad. */
  .velo { position: absolute; inset: 0; z-index: 3; pointer-events: none; background-color: rgba(14,22,38,.55);
    opacity: calc(var(--avance, 0) * .8); will-change: opacity;
    animation: veloSale 2s cubic-bezier(.3,.1,.2,1) backwards; }
  body.intro-active .velo { animation-play-state: paused !important; }
  /* polvo: ya no se repinta el fondo; se mueve una capa */
  body:not(.pagina):not(.admin-body) .escenario::after { display: none !important; }
  .polvo { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; opacity: .55;
    -webkit-mask-image: linear-gradient(118deg, transparent 20%, #000 34%, #000 46%, transparent 58%);
            mask-image: linear-gradient(118deg, transparent 20%, #000 34%, #000 46%, transparent 58%); }
  .polvo i { position: absolute; left: -10%; right: -10%; top: 0; height: calc(100% + 640px); will-change: transform;
    background-image:
      radial-gradient(1.6px 1.6px at 12% 22%, rgba(255,236,210,.9), transparent),
      radial-gradient(1.2px 1.2px at 22% 48%, rgba(255,236,210,.8), transparent),
      radial-gradient(2px 2px at 31% 30%, rgba(255,236,210,.7), transparent),
      radial-gradient(1.3px 1.3px at 38% 62%, rgba(255,236,210,.8), transparent),
      radial-gradient(1.8px 1.8px at 18% 70%, rgba(255,236,210,.6), transparent),
      radial-gradient(1.1px 1.1px at 27% 12%, rgba(255,236,210,.9), transparent),
      radial-gradient(1.5px 1.5px at 44% 40%, rgba(255,236,210,.6), transparent),
      radial-gradient(1.2px 1.2px at 8% 52%, rgba(255,236,210,.7), transparent);
    background-size: 640px 640px; animation: polvoSube 40s linear infinite; }
  @keyframes polvoSube { from { transform: translate3d(0,0,0); } to { transform: translate3d(140px,-640px,0); } }
  /* mientras se ve la intro del logotipo, la entrada espera en su primer cuadro */
  body.intro-active .escenario,
  body.intro-active .portada-intro p,
  body.intro-active .portada-intro .acciones-portada { animation-play-state: paused !important; }
  .portada-intro {
    will-change: transform, opacity;
    translate: 0 calc(var(--avance, 0) * -80px);
    opacity: calc(1 - var(--avance, 0) * 1.3);
  }
  @keyframes subeSuave { from { opacity: 0; translate: 0 26px; } }
  .portada-intro p, .marco-heroe .entrada-texto { animation: subeSuave 1.1s cubic-bezier(.2,.7,.1,1) 1.05s backwards; }
  .portada-intro .acciones-portada, .marco-heroe .boton, .marco-heroe .filete { animation: subeSuave 1.1s cubic-bezier(.2,.7,.1,1) 1.3s backwards; }

  /* ---------- Encabezados interiores: misma entrada, con capa de foto propia ---------- */
  .heroe { isolation: isolate; }
  .heroe::after {
    content: ""; position: absolute; inset: 0; z-index: 0;
    background: inherit; background-size: cover;
    scale: calc(1 + var(--avance, 0) * .07); will-change: transform;
    animation: enfoque 2.4s cubic-bezier(.2,.6,.2,1) backwards;
  }
  .heroe::before { z-index: 1 !important; }
  .heroe > * { z-index: 2 !important; }
  .heroe > .velo { position: absolute; z-index: 1 !important; scale: calc(1 + var(--avance, 0) * .07); }
  .marco-heroe {
    will-change: transform, opacity;
    translate: 0 calc(var(--avance, 0) * -70px);
    opacity: calc(1 - var(--avance, 0) * 1.25);
  }

  /* ---------- Títulos: palabra por palabra ---------- */
  html.revista .portada-intro h1:not(.partido),
  html.revista .marco-heroe h1:not(.partido) { opacity: 0; }
  .partido .pal { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .12em; margin-bottom: -.12em; }
  .partido .pal-i {
    display: inline-block; translate: 0 112%;
    transition: translate 1.15s cubic-bezier(.2,.7,.1,1);
    transition-delay: calc(var(--i, 0) * 60ms + var(--retraso, 0ms));
  }
  .portada-intro h1, .marco-heroe h1 { --retraso: 420ms; }
  .partido.dicho .pal-i { translate: 0 0; }

  /* ---------- Fotos: se descubren como telón ---------- */
  html.revista .telon {
    clip-path: inset(0 0 100% 0);
    transition: clip-path 1.35s cubic-bezier(.65,0,.2,1), translate 1.35s cubic-bezier(.2,.7,.1,1);
    transition-delay: calc(var(--i, 0) * 130ms);
  }
  html.revista .telon img { scale: 1.16; transition: scale 1.9s cubic-bezier(.2,.7,.1,1); transition-delay: inherit; }
  html.revista .fotos-despacho .telon, html.revista .galeria .telon { translate: 60px 0; }
  html.revista .telon.visto { clip-path: inset(0); translate: 0 0; }
  html.revista .telon.visto img { scale: 1; }

  /* ---------- Bloques que suben ---------- */
  html.revista .sube {
    opacity: 0; translate: 0 50px;
    transition: opacity 1s ease, translate 1.25s cubic-bezier(.2,.7,.1,1);
  }
  html.revista .sube.visto { opacity: 1; translate: 0 0; }

  /* ---------- Frase: los objetos salen del centro, se acomodan y flotan ---------- */
  .frase-fotos img { translate: 0 var(--py, 0px); }
  html.revista .frase-fotos img {
    opacity: 0; transform: translate(var(--dx, 0px), var(--dy, 0px)) scale(.45);
    transition: opacity 1.1s ease, transform 1.7s cubic-bezier(.2,.7,.1,1);
    transition-delay: calc(var(--i, 0) * 95ms + 250ms);
  }
  html.revista .revista-frase.visto .frase-fotos img { opacity: 1; transform: none; }
  @keyframes mecer { from { rotate: -1.4deg; } to { rotate: 1.4deg; } }
  .frase-fotos img { animation: mecer 7s ease-in-out infinite alternate; }
  .frase-fotos img:nth-child(2n) { animation-duration: 9s; animation-direction: alternate-reverse; }
  .frase-fotos img:nth-child(3n) { animation-duration: 11s; }
}

/* ---------- Rendimiento: lo que está fuera de pantalla no se dibuja ---------- */
.bloque-portada, .seccion, .pie, .areas-pie, .legales { content-visibility: auto; contain-intrinsic-size: auto 900px; }
