/* =============================================================
 * Page Transition Overlay — CSS chính thức theo spec của
 * Animation Library (dist/index.umd.js).
 * Tham khảo: docs/LIBRARY_USAGE.md, docs/INTEGRATION_GUIDE.md,
 *           docs/BUILD_SUMMARY.md
 * ============================================================= */

/* Fullscreen overlay chứa SVG. scale(1.5) là BẮT BUỘC để 2 stroke
 * phủ kín viewport khi animateLeave mở rộng strokeWidth tới 700. */
.page__transition {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(1.5);
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 99999;

  /* Màu stroke — override qua CSS variable nếu muốn */
  --transition-stroke-1: #7c3aed; /* Purple (mặc định của library) */
  --transition-stroke-2: #06b6d4; /* Cyan   (mặc định của library) */
}

.page__transition-svg {
  width: 100%;
  height: 100%;
}

/* Fallback ban đầu: stroke bị ẩn hoàn toàn.
 * Khi JS gọi initializePaths() sẽ ghi đè giá trị dựa trên path length. */
.page__transition path {
  stroke-dashoffset: 99999;
  stroke-dasharray: 99999;
}

/* ================= Fallback spinner khi thư viện chưa load =========
 * Chỉ kích hoạt khi router bật .active (ví dụ GSAP chưa kịp tải xong).
 * =================================================================== */
.spa-loading-fallback {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.9);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 99998;
  pointer-events: none;
}

.spa-loading-fallback.active {
  display: flex;
  pointer-events: auto;
}

.spa-loading-fallback .spa-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(124, 58, 237, 0.2);
  border-top-color: #7c3aed;
  border-radius: 50%;
  animation: spa-spin 0.9s linear infinite;
}

@keyframes spa-spin {
  to {
    transform: rotate(360deg);
  }
}
