/* ================================================================
   YLY INTRO SCREEN - ULTRA PERFORMANCE VIDEO OVERLAY
   ================================================================ */

#intro-screen,
.yly-video-intro-overlay {
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none !important;
  margin: 0;
  padding: 0;
  background-color: #030712 !important;
}

#intro-screen.theme-dark,
.yly-video-intro-overlay.theme-dark {
  background-color: #030712 !important;
}

#intro-screen.theme-light,
.yly-video-intro-overlay.theme-light,
body.theme-light #intro-screen,
html[data-theme="light"] #intro-screen,
html.theme-light #intro-screen {
  background-color: #ffffff !important;
}

#intro-screen.fade-out,
.yly-video-intro-overlay.fade-out {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ── Fullscreen Video (Edge-to-Edge Cover without letterbox bars) ── */
#intro-screen video,
.yly-video-intro-player {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) translateZ(0);
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover !important;
  display: block;
  opacity: 1;
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* ── زر التخطي (Skip Button) حصرياً داخل الـ Overlay ── */
#intro-screen #intro-skip,
.yly-video-intro-overlay .yly-intro-skip-btn {
  position: absolute;
  bottom: 2rem;
  right: 2rem;
  z-index: 100000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0.6rem 1.3rem;
  font-family: 'Cairo', system-ui, -apple-system, sans-serif;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 9999px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  animation: skipBtnFadeIn 0.6s ease-out 0.4s both;
}

@keyframes skipBtnFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

#intro-skip:hover,
.yly-intro-skip-btn:hover {
  background: #2563eb;
  border-color: #3b82f6;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.4);
}

.theme-light #intro-skip,
.theme-light .yly-intro-skip-btn,
body.theme-light #intro-skip,
html.theme-light #intro-skip,
html[data-theme="light"] #intro-skip {
  pointer-events: auto !important;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(37, 99, 235, 0.25);
  color: #0f172a;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.theme-light #intro-skip:hover,
.theme-light .yly-intro-skip-btn:hover,
body.theme-light #intro-skip:hover,
html.theme-light #intro-skip:hover,
html[data-theme="light"] #intro-skip:hover {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 6px 24px rgba(37, 99, 235, 0.35);
}

/* ── استجابة الهواتف والشاشات الصغيرة ── */
@media (max-width: 640px) {
  #intro-screen #intro-skip,
  .yly-video-intro-overlay .yly-intro-skip-btn {
    bottom: 1.5rem;
    right: 50%;
    transform: translateX(50%);
    padding: 0.55rem 1.4rem;
    font-size: 0.86rem;
    white-space: nowrap;
    animation: skipBtnFadeInMobile 0.6s ease-out 0.4s both;
  }

  @keyframes skipBtnFadeInMobile {
    from {
      opacity: 0;
      transform: translateX(50%) translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateX(50%) translateY(0);
    }
  }

  #intro-skip:hover,
  .yly-intro-skip-btn:hover {
    transform: translateX(50%) translateY(-2px) scale(1.03);
  }
}

/* ── ظهور ناعم للـ Navbar والمحتوى عند انتهاء الإنترو ── */
html:not(.intro-running) #main-navbar,
html:not(.intro-running) nav.navbar,
html:not(.intro-running) .navbar-floating {
  animation: introNavbarFadeIn 0.45s ease-out forwards;
}

@keyframes introNavbarFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

html:not(.intro-running) #main-content {
  animation: introMainFadeIn 0.45s ease-out forwards;
}

@keyframes introMainFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ── تقليل الحركة (prefers-reduced-motion) ── */
@media (prefers-reduced-motion: reduce) {
  #intro-screen,
  .yly-video-intro-overlay {
    display: none !important;
  }
  html.intro-running #main-navbar,
  html.intro-running #main-content {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
}
