/* ======================================================================
 * Ruh Eljamal — Luxury Brand Preloader
 * Animated gold ring + concentric pulses + shimmer overlay on the brand
 * logo. Designed to feel premium and on-brand (deep zinc + #D4AF37 gold
 * + burgundy #6B1F2A accent matching the logo).
 * ====================================================================== */

#rj-preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(212, 175, 55, 0.08) 0%, rgba(10, 10, 10, 0) 60%),
    linear-gradient(180deg, #0a0a0a 0%, #18181b 50%, #0a0a0a 100%);
  /* Cover screen until JS removes it. Block interaction underneath. */
  opacity: 1;
  visibility: visible;
  transition: opacity 0.7s cubic-bezier(0.65, 0, 0.35, 1),
              visibility 0s linear 0.7s;
  overflow: hidden;
  /* Prevent FOUC by also hiding scrollbars while active */
}

#rj-preloader.rj-preloader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Subtle animated gold dust particles in the background */
#rj-preloader::before,
#rj-preloader::after {
  content: "";
  position: absolute;
  inset: -20%;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(212, 175, 55, 0.6), transparent 50%),
    radial-gradient(1px 1px at 70% 60%, rgba(245, 230, 173, 0.5), transparent 50%),
    radial-gradient(1.5px 1.5px at 40% 80%, rgba(212, 175, 55, 0.45), transparent 50%),
    radial-gradient(1px 1px at 85% 20%, rgba(245, 230, 173, 0.55), transparent 50%),
    radial-gradient(1.5px 1.5px at 10% 70%, rgba(212, 175, 55, 0.5), transparent 50%),
    radial-gradient(1px 1px at 60% 15%, rgba(245, 230, 173, 0.45), transparent 50%);
  background-size: 100% 100%;
  animation: rj-float-dust 14s linear infinite;
  pointer-events: none;
  opacity: 0.6;
}

#rj-preloader::after {
  animation-duration: 22s;
  animation-direction: reverse;
  opacity: 0.35;
}

@keyframes rj-float-dust {
  0%   { transform: translate3d(0, 0, 0); }
  50%  { transform: translate3d(-3%, -2%, 0); }
  100% { transform: translate3d(0, 0, 0); }
}

/* Stage that holds the rings + the logo image */
.rj-loader-stage {
  position: relative;
  width: 220px;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (max-width: 480px) {
  .rj-loader-stage { width: 180px; height: 180px; }
}

/* Three concentric pulse rings emanating outward */
.rj-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(212, 175, 55, 0.35);
  box-shadow: 0 0 30px rgba(212, 175, 55, 0.15) inset,
              0 0 30px rgba(212, 175, 55, 0.08);
  animation: rj-pulse 2.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
  pointer-events: none;
}

.rj-pulse.rj-pulse-2 { animation-delay: 0.65s; }
.rj-pulse.rj-pulse-3 { animation-delay: 1.3s;  }

@keyframes rj-pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.55);
    border-color: rgba(212, 175, 55, 0.55);
  }
  70% {
    opacity: 0.15;
    transform: scale(1.15);
    border-color: rgba(212, 175, 55, 0.2);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
    border-color: rgba(212, 175, 55, 0);
  }
}

/* Rotating golden arc ring on top of the logo */
.rj-spinner-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: #d4af37;
  border-right-color: rgba(212, 175, 55, 0.4);
  box-shadow: 0 0 18px rgba(212, 175, 55, 0.35);
  animation: rj-spin 1.6s linear infinite;
  pointer-events: none;
}

.rj-spinner-ring.rj-spinner-ring-inner {
  inset: 6px;
  border-top-color: rgba(245, 230, 173, 0.85);
  border-right-color: transparent;
  border-left-color: rgba(212, 175, 55, 0.25);
  animation-duration: 2.2s;
  animation-direction: reverse;
}

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

/* Logo wrapper — circular crop with a soft gold glow */
.rj-logo-wrap {
  position: relative;
  width: 78%;
  height: 78%;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 45%, #f8f5ec 0%, #efe9d6 75%, #d4c79a 100%);
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.45),
    0 0 25px rgba(212, 175, 55, 0.3),
    0 12px 40px rgba(0, 0, 0, 0.55),
    inset 0 0 18px rgba(107, 31, 42, 0.06);
  overflow: hidden;
  animation: rj-logo-breathe 3.2s ease-in-out infinite;
}

.rj-logo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  /* Subtle saturation pop to keep the gold vivid on dark background */
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.15));
}

@keyframes rj-logo-breathe {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 0 1px rgba(212, 175, 55, 0.45),
      0 0 25px rgba(212, 175, 55, 0.3),
      0 12px 40px rgba(0, 0, 0, 0.55),
      inset 0 0 18px rgba(107, 31, 42, 0.06);
  }
  50% {
    transform: scale(1.04);
    box-shadow:
      0 0 0 1px rgba(212, 175, 55, 0.65),
      0 0 45px rgba(212, 175, 55, 0.55),
      0 18px 50px rgba(0, 0, 0, 0.6),
      inset 0 0 22px rgba(107, 31, 42, 0.08);
  }
}

/* Diagonal shimmer that sweeps across the logo every few seconds */
.rj-logo-wrap::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 60%;
  height: 200%;
  background: linear-gradient(
    115deg,
    transparent 0%,
    rgba(255, 255, 255, 0) 35%,
    rgba(255, 255, 255, 0.55) 50%,
    rgba(255, 255, 255, 0) 65%,
    transparent 100%
  );
  transform: rotate(8deg);
  animation: rj-shimmer 3.6s ease-in-out infinite;
  pointer-events: none;
  mix-blend-mode: screen;
}

@keyframes rj-shimmer {
  0%   { left: -60%; opacity: 0; }
  20%  { opacity: 1; }
  60%  { left: 120%; opacity: 0.9; }
  100% { left: 120%; opacity: 0; }
}

/* Brand name + tagline below the logo */
.rj-loader-text {
  margin-top: 36px;
  text-align: center;
  user-select: none;
}

.rj-loader-brand {
  font-family: 'Cormorant Garamond', 'Noto Serif', serif;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  background: linear-gradient(90deg, #d4af37 0%, #f5e6ad 50%, #d4af37 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: rj-shine-text 3s linear infinite;
}

.rj-loader-tagline {
  margin-top: 10px;
  font-family: 'Tajawal', 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(214, 211, 209, 0.55);
}

@keyframes rj-shine-text {
  0%   { background-position: 200% center; }
  100% { background-position: -200% center; }
}

/* Slim progress bar */
.rj-loader-bar {
  position: relative;
  margin-top: 24px;
  width: 180px;
  height: 2px;
  background: rgba(212, 175, 55, 0.12);
  border-radius: 999px;
  overflow: hidden;
}

.rj-loader-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg,
    rgba(212, 175, 55, 0) 0%,
    #d4af37 50%,
    rgba(212, 175, 55, 0) 100%);
  animation: rj-bar-slide 1.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes rj-bar-slide {
  0%   { left: -40%; }
  100% { left: 100%; }
}

/* Lock body scroll while the loader is visible */
html.rj-loading, body.rj-loading {
  overflow: hidden !important;
}

/* Reduced motion support — keep things calm but still on-brand */
@media (prefers-reduced-motion: reduce) {
  .rj-pulse,
  .rj-spinner-ring,
  .rj-logo-wrap,
  .rj-logo-wrap::after,
  .rj-loader-brand,
  .rj-loader-bar::before,
  #rj-preloader::before,
  #rj-preloader::after {
    animation: none !important;
  }
  .rj-logo-wrap { transform: none; }
}

/* ----------------------------------------------------------------------
 * Header logo (used in storeHeader + mobile sidebar + gender page).
 * Visible, on-brand circular medallion next to the brand wordmark.
 * -------------------------------------------------------------------- */
.rj-brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #f8f5ec 0%, #efe9d6 75%, #d4c79a 100%);
  padding: 3px;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.55),
    0 4px 14px rgba(0, 0, 0, 0.45),
    0 0 18px rgba(212, 175, 55, 0.18);
  flex-shrink: 0;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.4s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.rj-brand-logo img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
  display: block;
}

.rj-brand-logo:hover {
  transform: scale(1.06) rotate(-3deg);
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.85),
    0 6px 20px rgba(0, 0, 0, 0.55),
    0 0 28px rgba(212, 175, 55, 0.35);
}

@media (min-width: 768px) {
  .rj-brand-logo { width: 52px; height: 52px; }
}

/* Larger hero logo for the gender-selection landing page */
.rj-brand-logo-hero {
  width: 110px;
  height: 110px;
  margin: 0 auto 14px auto;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #f8f5ec 0%, #efe9d6 75%, #d4c79a 100%);
  padding: 4px;
  box-shadow:
    0 0 0 1px rgba(212, 175, 55, 0.7),
    0 10px 30px rgba(0, 0, 0, 0.55),
    0 0 35px rgba(212, 175, 55, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: rj-logo-breathe 3.6s ease-in-out infinite;
}

.rj-brand-logo-hero img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: contain;
  display: block;
}

@media (min-width: 768px) {
  .rj-brand-logo-hero { width: 140px; height: 140px; }
}

/* Sidebar logo (mobile drawer) — slightly smaller, no hover */
.rj-brand-logo-sm {
  width: 38px;
  height: 38px;
}

/* ----------------------------------------------------------------------
 * Male theme override: when html[data-gender="male"] is set, swap the
 * cream/gold medallion background to pure black so the logo blends with
 * the site's black background (header, body, sidebar). The gold ring,
 * shadow and hover glow are preserved for brand consistency.
 *
 * We use multiple background properties (background, background-color,
 * background-image) to make absolutely sure the cream radial-gradient
 * from the base .rj-brand-logo rule cannot leak through, regardless of
 * CSS load order or rule specificity nuances.
 * -------------------------------------------------------------------- */
html[data-gender="male"] .rj-brand-logo,
html[data-gender="male"] .rj-brand-logo.rj-brand-logo-sm {
  background: #0a0a0a !important;
  background-color: #0a0a0a !important;
  background-image: none !important;
}
html[data-gender="male"] .rj-brand-logo-hero {
  background: #0a0a0a !important;
  background-color: #0a0a0a !important;
  background-image: none !important;
}
/* Inside the medallion the <img> sits with object-fit:contain — when the
 * gold logo PNG is transparent any letterboxing should also be black so
 * nothing cream peeks through behind the artwork. */
html[data-gender="male"] .rj-brand-logo img,
html[data-gender="male"] .rj-brand-logo-hero img {
  background: #0a0a0a !important;
  background-color: #0a0a0a !important;
}

