/* Movimento da homepage (previa de 1 Dez 2026, pedido do Miguel: "motion ao fazer scroll ... efeito uau premium").
   Tudo o que este ficheiro faz desliga-se tirando o link dele de inicio.html.
   Regras: so transform (transform, translate, rotate, scale) e opacity; nada escondido em repouso;
   sem movimento com prefers-reduced-motion; hover so com rato. */

/* ---------- 1. Hero de Natal: as 4 capas assentam ao carregar ---------- */
@media (prefers-reduced-motion: no-preference) {
  .natal-hero-capas img {
    animation: mv-assenta 900ms cubic-bezier(0.23, 1, 0.32, 1) backwards;
  }
  /* Partida de cada capa: mais junta ao monte e menos rodada. O fim e o repouso do hero.css. */
  .natal-hero-capas .madeira { --mv-de: translate(20%, 5%) rotate(-4deg) scale(.96); }
  .natal-hero-capas .casamento { --mv-de: translate(-20%, 5%) rotate(3deg) scale(.96); animation-delay: 60ms; }
  .natal-hero-capas .paris { --mv-de: translate(9%, 2%) rotate(-1.5deg) scale(.97); animation-delay: 120ms; }
  .natal-hero-capas .natal-capa { --mv-de: translate(-9%, 2%) rotate(2deg) scale(.97); animation-delay: 180ms; }
}
@keyframes mv-assenta { from { transform: var(--mv-de); } }

/* ---------- 2. Hero de Natal: as capas abrem em leque com o scroll ---------- */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .natal-hero-capas img {
      animation-name: mv-assenta, mv-leque;
      animation-duration: 900ms, 1ms;
      animation-timing-function: cubic-bezier(0.23, 1, 0.32, 1), linear;
      animation-fill-mode: backwards, both;
      animation-timeline: auto, scroll(root block);
      animation-range: normal, 0px 540px;
    }
    /* O atraso de cada capa vale so para o assentar; no scroll e sempre 0s. */
    /* As de tras afastam-se e ficam para tras; as da frente sobem e crescem um pouco: profundidade. */
    .natal-hero-capas .madeira { --mv-para: -15% 4%; --mv-roda: -5deg; --mv-escala: .985; animation-delay: 0s, 0s; }
    .natal-hero-capas .casamento { --mv-para: 15% 4%; --mv-roda: 5deg; --mv-escala: .985; animation-delay: 60ms, 0s; }
    .natal-hero-capas .paris { --mv-para: -7% -7%; --mv-roda: -2.5deg; --mv-escala: 1.045; animation-delay: 120ms, 0s; }
    .natal-hero-capas .natal-capa { --mv-para: 8% -5%; --mv-roda: 3deg; --mv-escala: 1.045; animation-delay: 180ms, 0s; }
    .natal-hero-capas::before {
      animation: mv-sombra 1ms linear both;
      animation-timeline: scroll(root block);
      animation-range: 0px 540px;
    }
  }
}
@keyframes mv-leque { to { translate: var(--mv-para); rotate: var(--mv-roda); scale: var(--mv-escala); } }
@keyframes mv-sombra { to { scale: 1.16 1; opacity: .7; } }

/* ---------- 3. Fotografias que chegam ao lugar com o scroll ---------- */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .workshop > img,
    .films video {
      animation: mv-chega 1ms linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 36%;
    }
    .films video:last-child { animation-name: mv-chega-fundo; }
    .range-feature img {
      animation: mv-aproxima 1ms linear both;
      animation-timeline: view();
      animation-range: entry 0% cover 55%;
    }
  }
}
@keyframes mv-chega { from { transform: translateY(18px) scale(.96); } to { transform: none; } }
@keyframes mv-chega-fundo { from { transform: translateY(40px) scale(.96); } to { transform: none; } }
@keyframes mv-aproxima { from { transform: scale(1.07); } to { transform: none; } }

/* ---------- 4. Titulos das seccoes: subida curta, uma vez (classes postas por motion.js) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .mv-espera { opacity: .4; translate: 0 14px; }
  .mv-entra { transition: opacity 560ms cubic-bezier(0.23, 1, 0.32, 1), translate 560ms cubic-bezier(0.23, 1, 0.32, 1); }
}
@media print {
  .mv-espera { opacity: 1; translate: none; }
}

/* ---------- 5. Temas: a capa levanta ao passar o rato ---------- */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .theme .book {
    transition: translate 240ms cubic-bezier(0.23, 1, 0.32, 1), rotate 240ms cubic-bezier(0.23, 1, 0.32, 1), scale 240ms cubic-bezier(0.23, 1, 0.32, 1);
  }
  .theme:is(:hover, :focus-visible) .book { translate: 0 -5px; rotate: -1.2deg; scale: 1.035; }
  .theme .arrow { transition: translate 200ms cubic-bezier(0.23, 1, 0.32, 1); }
  .theme:is(:hover, :focus-visible) .arrow { translate: 4px 0; }
}
