/*
 * Chuyển động trang chủ Greenkite (front-page.php). Chỉ chạy khi người dùng không tắt chuyển động.
 * - .gk-marquee: dải logo thương hiệu chạy vô tận (track chứa 2 bản danh sách giống nhau, dịch -50% là khớp vòng), rê chuột thì dừng;
 *   logo xám mờ, rê chuột hiện màu thật.
 * - .gk-rise: nội dung hero trồi lên khi tải trang. .gk-hero-image: ảnh hero phóng nhẹ khi tải.
 * - .gk-reveal: khối hiện dần khi cuộn tới (CSS scroll-driven, trình duyệt chưa hỗ trợ thì hiện luôn).
 */
.gk-hero-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.6s,
    visibility 0.6s;
}

.gk-hero-slide.is-active {
  opacity: 1;
  visibility: visible;
}

.gk-hero-image {
  /* Ảnh giữ tỉ lệ 16:9, căn giữa theo chiều dọc khung: khung hero desktop cao hơn 16:9, phủ kín (cover) sẽ phóng ảnh
     ~1,4 lần làm vỡ. Bốn mép mờ dần vào nền hero. */
  width: 100%;
  max-height: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: right center;
  mask-image:
    linear-gradient(90deg, transparent, var(--color-surface) 25%),
    linear-gradient(
      180deg,
      transparent,
      var(--color-surface) 15%,
      var(--color-surface) 75%,
      transparent
    );
  mask-composite: intersect;
}

.gk-marquee {
  mask-image: linear-gradient(
    90deg,
    transparent,
    var(--color-surface) 8%,
    var(--color-surface) 92%,
    transparent
  );
}

.gk-marquee-logo img {
  filter: grayscale(1);
  opacity: 0.6;
  transition:
    filter 0.3s,
    opacity 0.3s;
}

.gk-marquee-logo:hover img,
.gk-marquee-logo:focus-visible img {
  filter: none;
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .gk-marquee-track {
    animation: gk-marquee 60s linear infinite; /* thời lượng thật do kmbMarquee tính theo chiều dài */
  }

  .gk-marquee:hover .gk-marquee-track {
    animation-play-state: paused;
  }

  .gk-rise {
    animation: gk-rise 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  .gk-rise + .gk-rise {
    animation-delay: 0.15s;
  }

  .gk-hero-image {
    animation: gk-zoom 1.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  }

  @supports (animation-timeline: view()) {
    .gk-reveal {
      animation: gk-reveal linear both;
      animation-range: entry 0% entry 40%;
      animation-timeline: view();
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .gk-hero-slide {
    transition: none;
  }

  .gk-marquee-track {
    flex-wrap: wrap;
    justify-content: center;
  }

  .gk-marquee-track > [aria-hidden='true'] {
    display: none;
  }
}

@keyframes gk-marquee {
  to {
    transform: translateX(-50%);
  }
}

@keyframes gk-rise {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }
}

@keyframes gk-zoom {
  from {
    transform: scale(1.06);
  }
}

@keyframes gk-reveal {
  from {
    opacity: 0;
    transform: translateY(3rem);
  }
}
