/* Todo o movimento automático da página.
   As animações ligadas à rolagem ficam em js/animations.js. */

/* cantos de visor que aparecem sobre a foto na abertura */
.focus {
  position: absolute;
  inset: 6% 9% 16%;
  opacity: 0;
  pointer-events: none;
}
.focus i {
  position: absolute;
  width: 26px;
  height: 26px;
  border: 0 solid var(--accent);
}
.focus i:nth-child(1) {
  top: 0;
  left: 0;
  border-width: 1.5px 0 0 1.5px;
}
.focus i:nth-child(2) {
  top: 0;
  right: 0;
  border-width: 1.5px 1.5px 0 0;
}
.focus i:nth-child(3) {
  bottom: 0;
  left: 0;
  border-width: 0 0 1.5px 1.5px;
}
.focus i:nth-child(4) {
  bottom: 0;
  right: 0;
  border-width: 0 1.5px 1.5px 0;
}

/* aguardando a vez de entrar na tela (classe aplicada por js/animations.js) */
.espera {
  opacity: 0;
}

/* ---------- com movimento ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* abertura */
  .nav ul {
    animation: drop 0.7s var(--ease) backwards;
  }
  .portrait img {
    animation: rackfocus 1.5s 0.2s var(--ease) backwards;
  }
  .focus {
    animation: lock 2.1s 0.25s var(--ease) both;
  }
  .who {
    animation: rise 0.8s 1.1s var(--ease) backwards;
  }
  .intro > * {
    animation: rise 0.8s 0.7s var(--ease) backwards;
  }

  .hero .links .btn {
    animation: slide 0.7s var(--ease) backwards;
  }
  .hero .links .btn:nth-child(1) {
    animation-delay: 0.55s;
  }
  .hero .links .btn:nth-child(2) {
    animation-delay: 0.65s;
  }
  .hero .links .btn:nth-child(3) {
    animation-delay: 0.75s;
  }
  .hero .links .btn:nth-child(4) {
    animation-delay: 0.85s;
  }
  .hero .links .btn:nth-child(5) {
    animation-delay: 0.95s;
  }

  /* contínuas */
  .btn.main::after {
    content: "";
    position: absolute;
    z-index: -1;
    top: 0;
    bottom: 0;
    left: 0;
    width: 45%;
    background: linear-gradient(100deg, transparent, var(--accent-glow), transparent);
    transform: translateX(-120%);
    animation: sweep 4.5s 2s ease-in-out infinite;
  }
  .btn.main > svg:first-child {
    animation: ring 4.5s 2s ease-in-out infinite;
  }
  .track {
    animation: run 32s linear infinite;
  }
  .ticker:hover .track,
  .ticker:active .track {
    animation-play-state: paused;
  }
  .float {
    animation: breathe 2.8s ease-in-out infinite;
  }
}

/* ---------- movimento reduzido (preferência do aparelho) ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
  }
  .progress {
    display: none;
  }
  .ticker {
    -webkit-mask-image: none;
    mask-image: none;
  }
  .track {
    width: auto;
  }
  .track ul {
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 8px;
  }
  .track ul + ul {
    display: none;
  }
}

/* ---------- quadros ---------- */
@keyframes drop {
  from {
    opacity: 0;
    translate: 0 -18px;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    translate: 0 22px;
  }
}
@keyframes slide {
  from {
    opacity: 0;
    translate: -26px 0;
  }
}
@keyframes rackfocus {
  from {
    opacity: 0;
    filter: blur(18px);
    scale: 1.09;
  }
  35% {
    opacity: 1;
  }
}
@keyframes lock {
  0% {
    opacity: 0;
    scale: 1.18;
  }
  30% {
    opacity: 1;
  }
  60% {
    opacity: 1;
    scale: 1;
  }
  100% {
    opacity: 0;
    scale: 1;
  }
}
@keyframes sweep {
  0% {
    transform: translateX(-120%);
  }
  35%,
  100% {
    transform: translateX(260%);
  }
}
@keyframes ring {
  0%,
  8%,
  30%,
  100% {
    rotate: 0deg;
  }
  12% {
    rotate: -14deg;
  }
  17% {
    rotate: 12deg;
  }
  22% {
    rotate: -8deg;
  }
  26% {
    rotate: 4deg;
  }
}
@keyframes run {
  to {
    transform: translateX(-50%);
  }
}
@keyframes breathe {
  50% {
    scale: 1.05;
  }
}
