/* ==========================================================================
   ROYAL MANSION — INTRO & SVG CROWN PORTAL TRANSITION (MASTERISE HOMES STYLE)
   Cách dùng: Nhúng file CSS này vào thẻ <head> của website Royal Mansion:
   <link rel="stylesheet" href="rm-intro-transition.css">
   ========================================================================== */

/* 1. Lớp phủ màn hình chờ Intro */
.rm-intro-screen {
  position: fixed;
  inset: 0;
  z-index: 1000000;
  pointer-events: auto;
  cursor: pointer;
  overflow: hidden;
}
.rm-intro-screen.is-zooming {
  pointer-events: none;
}
.rm-intro-screen.is-done {
  display: none !important;
}

/* 2. Nền xanh trầm chuẩn Artboard gốc (#142f1d) — Sẽ bị đục lỗ Vương Miện khi chuyển cảnh */
.rm-intro-backdrop {
  position: absolute;
  inset: 0;
  background: #142f1d;
  will-change: mask-image, -webkit-mask-image, opacity;
}

/* 3. Cụm Logo trung tâm (Hỗ trợ cả SVG Vector nét vẽ lẫn thẻ <video>) */
.rm-intro-center {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(68vw, 290px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 2;
  will-change: transform, opacity;
}

/* Nếu dùng thẻ <video id="rm-intro-video"> toàn màn hình hoặc khung trung tâm */
.rm-intro-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Nếu dùng SVG Vector gốc từ file thiết kế RM_LOGO.ai */
.rm-intro-svg {
  width: 100%;
  height: auto;
  overflow: visible;
  filter: none;
}
.rm-svg-crown {
  transform-origin: 308px 480px;
  animation: rmCrownReveal 1s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}
.rm-svg-monogram path {
  stroke-dasharray: 460;
  stroke-dashoffset: 460;
  fill-opacity: 0;
  stroke-width: 0.9;
  stroke-opacity: 0.85;
  animation: rmMonogramDraw 1.55s cubic-bezier(0.22, 1, 0.36, 1) 0.12s forwards;
}
.rm-svg-wordmark {
  animation: rmWordmarkReveal 1.05s cubic-bezier(0.22, 1, 0.36, 1) 0.42s both;
}

/* Thanh tiến trình mảnh phía dưới Logo */
.rm-intro-progress {
  width: 120px;
  height: 2px;
  background: rgba(204, 160, 99, 0.18);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 18px;
}
.rm-intro-progress span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #907345, #cca063, #f3dba1);
  transform-origin: left;
  transform: scaleX(0);
  animation: rmProgressFill 1.75s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Keyframes vẽ Logo Vector */
@keyframes rmCrownReveal {
  0%   { opacity: 0; transform: translateY(12px) scale(0.78); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes rmMonogramDraw {
  0%   { stroke-dashoffset: 460; fill-opacity: 0; stroke-opacity: 0.85; }
  65%  { stroke-dashoffset: 0;   fill-opacity: 0.3; stroke-opacity: 0.6; }
  100% { stroke-dashoffset: 0;   fill-opacity: 1; stroke-opacity: 0; }
}
@keyframes rmWordmarkReveal {
  0%   { opacity: 0; transform: translateY(-12px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes rmProgressFill {
  0%   { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}

/* ==========================================================================
   4. HIỆU ỨNG HERO REEL & PHÓNG VÀO WEB KHI CỔNG VƯƠNG MIỆN MỞ RA
   ========================================================================== */
.hero-image[data-hero-reel] {
  overflow: hidden;
  background: #001810;
}
.hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.35s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
.hero-slide.is-active {
  opacity: 1;
  z-index: 1;
}
.hero-slide img,
.hero-slide video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 45%;
  transform: scale(1.07);
  transition: transform 6.5s cubic-bezier(0.22, 1, 0.36, 1);
  animation: none !important;
}
.hero-slide.is-active img,
.hero-slide.is-active video {
  transform: scale(1);
}

/* Khi cửa sổ Vương Miện bung mở, phần Hero bên dưới hơi thu phóng mượt vào */
body.is-portal-opening .hero-image,
body.is-portal-opening [data-portal-target] {
  animation: rmHeroPortalZoom 1.65s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
body.is-portal-opening .hero-copy > * {
  animation: rmHeroCopySlideUp 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}
body.is-portal-opening .hero-copy > *:nth-child(1) { animation-delay: 0.18s; }
body.is-portal-opening .hero-copy > *:nth-child(2) { animation-delay: 0.34s; }
body.is-portal-opening .hero-copy > *:nth-child(3) { animation-delay: 0.48s; }

@keyframes rmHeroPortalZoom {
  0%   { transform: scale(1.14); filter: brightness(1.18); }
  100% { transform: scale(1);    filter: brightness(1); }
}
@keyframes rmHeroCopySlideUp {
  0%   { opacity: 0; transform: translateY(38px); }
  100% { opacity: 1; transform: translateY(0); }
}

/* Tia sáng chạy dọc ở nút cuộn khám phá (Masterise style) */
.scroll-cue i {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.2) !important;
}
.scroll-cue i::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 200, 56, 0) 0%, #ffc838 50%, rgba(255, 200, 56, 0) 100%);
  animation: rmScrollLine 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}
@keyframes rmScrollLine {
  0%   { transform: translateY(-100%); }
  100% { transform: translateY(100%); }
}
