:root {
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Intro */

.js .header,
.js .title__accent,
.js .title__main,
.js .hero__text,
.js .hero__actions .btn,
.js .hero__bars,
.js .hero__icon,
.js .blob {
  opacity: 0;
}

.is-ready .header {
  animation: rise 0.9s var(--ease-out) both;
}

.is-ready .hero .title__accent {
  animation: rise 1s var(--ease-out) 0.15s both;
}

.is-ready .hero .title__main {
  animation: rise 1s var(--ease-out) 0.28s both;
}

.is-ready .hero__text {
  animation: rise 1s var(--ease-out) 0.42s both;
}

.is-ready .hero__actions .btn {
  animation: rise 0.9s var(--ease-out) 0.56s both;
}

.is-ready .hero__actions .btn + .btn {
  animation-delay: 0.64s;
}

.is-ready .blob {
  animation: blob-in 1.6s ease-out both, breathe 8s ease-in-out 1.6s infinite;
}

.is-ready .blob--right {
  animation-delay: 0.2s, 2s;
}

.is-ready .hero__bars {
  transform-origin: 50% 100%;
  animation: bars-in 1.2s var(--ease-out) 0.2s both;
}

.is-ready .hero__bars--right {
  animation-delay: 0.32s;
}

.hero__icon {
  transition: translate 0.6s var(--ease-out);
}

.is-ready .hero__icon {
  animation: pop 0.9s var(--ease-spring) var(--d, 0.4s) both, float var(--f, 6s) ease-in-out calc(var(--d, 0.4s) + 0.9s) infinite;
}

.hero__icon:nth-of-type(3) { --d: 0.45s; --f: 6.4s; }
.hero__icon:nth-of-type(4) { --d: 0.6s; --f: 7.2s; }
.hero__icon:nth-of-type(5) { --d: 0.52s; --f: 5.6s; }
.hero__icon:nth-of-type(6) { --d: 0.5s; --f: 6.8s; }
.hero__icon:nth-of-type(7) { --d: 0.66s; --f: 5.9s; }
.hero__icon:nth-of-type(8) { --d: 0.58s; --f: 7.6s; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(28px);
    filter: blur(6px);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes blob-in {
  from { opacity: 0; scale: 0.6; }
  to { opacity: 0.5; scale: 1; }
}

@keyframes breathe {
  0%, 100% { opacity: 0.5; scale: 1; }
  50% { opacity: 0.38; scale: 1.12; }
}

@keyframes bars-in {
  from { opacity: 0; transform: translateY(60px) scaleY(0.4); }
  to { opacity: 1; transform: none; }
}

@keyframes pop {
  from { opacity: 0; scale: 0.4; rotate: -14deg; }
  to { opacity: 1; scale: 1; rotate: 0deg; }
}

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(2deg); }
}

/* Scroll reveal */

.js .reveal {
  opacity: 0;
  translate: 0 40px;
  transition: opacity 0.9s var(--ease-out) var(--d, 0s), translate 0.9s var(--ease-out) var(--d, 0s);
}

.js .reveal.is-in {
  opacity: 1;
  translate: 0 0;
}

.js .reveal--zoom {
  scale: 0.94;
  transition: opacity 0.9s var(--ease-out) var(--d, 0s), translate 0.9s var(--ease-out) var(--d, 0s), scale 0.9s var(--ease-out) var(--d, 0s);
}

.js .reveal--zoom.is-in {
  scale: 1;
}

.js .reveal--left {
  translate: -60px 0;
}

.js .reveal--right {
  translate: 60px 0;
}

/* Buttons */

.btn {
  position: relative;
  overflow: hidden;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.3s var(--ease-spring), box-shadow 0.3s;
}

.btn--primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
  translate: -120% 0;
  transition: translate 0.7s var(--ease-out);
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn--primary:hover {
  box-shadow: 0 12px 28px -10px rgba(255, 105, 0, 0.7);
}

.btn--primary:hover::after {
  translate: 120% 0;
}

.btn:active {
  transform: translateY(0) scale(0.97);
}

.btn img {
  transition: transform 0.3s var(--ease-spring);
}

.btn--icon-right:hover img {
  transform: translateX(4px) rotate(-12deg);
}

.btn--icon-left:hover img {
  transform: rotate(-10deg) scale(1.1);
}

.nav a {
  position: relative;
}

.nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 2px;
  border-radius: 2px;
  background: var(--grad);
  scale: 0 1;
  transition: scale 0.35s var(--ease-out);
}

.nav a:hover::after {
  scale: 1 1;
}

/* Cards */

.card {
  transition: transform 0.6s var(--ease-out);
  will-change: transform;
}

.card:hover {
  transform: translateY(-8px) scale(1.02);
}

.card:active {
  transform: translateY(-2px) scale(0.99);
}

.card.is-tilting {
  transition: transform 0.15s ease-out;
}

.card__img {
  transition: filter 0.6s var(--ease-out);
}

.card:hover .card__img {
  filter: saturate(1.1) brightness(1.03);
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 40px;
  background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, 0.22) 50%, transparent 65%) no-repeat;
  background-size: 250% 100%;
  background-position: 130% 0;
  pointer-events: none;
}

.card:hover::after {
  background-position: -30% 0;
  transition: background-position 1.1s var(--ease-out);
}

/* Services */

.service {
  transition: transform 0.4s var(--ease-out), box-shadow 0.4s var(--ease-out);
}

.service:hover {
  transform: translateY(-8px);
  box-shadow: var(--card-shadow), 0 30px 60px -30px rgba(255, 105, 0, 0.45);
}

.service__icon {
  transition: transform 0.6s var(--ease-spring);
}

.service:hover .service__icon {
  transform: rotate(-12deg) scale(1.08);
}

/* About */

.about__art img {
  transition: transform 0.2s linear;
}

/* Contact */

.contact__piece {
  animation: drift 7s ease-in-out infinite;
}

.contact__piece:nth-of-type(1),
.contact__piece:nth-of-type(2) {
  animation: none;
}

.contact__piece:nth-of-type(4) {
  animation-duration: 8.5s;
  animation-delay: -2s;
}

.contact__piece:nth-of-type(5) {
  animation-duration: 6.2s;
  animation-delay: -4s;
}

@keyframes drift {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(0, -12px) rotate(3deg); }
}

/* Footer */

.footer__contacts img {
  transition: transform 0.4s var(--ease-spring);
}

.footer__contacts a:hover img {
  transform: scale(1.2) rotate(-10deg);
}

/* Modal */

.modal__shots img {
  animation: shot-in 0.7s var(--ease-out) both;
}

.modal__shots img:nth-child(2) { animation-delay: 0.06s; }
.modal__shots img:nth-child(3) { animation-delay: 0.12s; }
.modal__shots img:nth-child(4) { animation-delay: 0.18s; }
.modal__shots img:nth-child(5) { animation-delay: 0.24s; }

.modal__icon {
  animation: pop 0.7s var(--ease-spring) 0.1s both;
}

.modal__close {
  transition: transform 0.4s var(--ease-spring);
}

.modal__close:hover {
  transform: rotate(90deg) scale(1.08);
}

.modal__next {
  transition: background-color 0.2s, transform 0.3s var(--ease-spring);
}

.modal__next:hover {
  transform: scale(1.08);
}

.modal.is-closing .modal__backdrop {
  animation: fade 0.2s ease reverse both;
}

.modal.is-closing .modal__dialog {
  animation: pop-out 0.2s ease both;
}

@keyframes shot-in {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: none; }
}

@keyframes pop-out {
  to { opacity: 0; transform: translateY(12px) scale(0.98); }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  .js .header,
  .js .title__accent,
  .js .title__main,
  .js .hero__text,
  .js .hero__actions .btn,
  .js .hero__bars,
  .js .hero__icon,
  .js .reveal {
    opacity: 1;
    translate: none;
    scale: none;
  }

  .js .blob {
    opacity: 0.5;
  }
}
