/* ═══════════════════════════════════════════════════════════════════
   INTERACTIVE LAMP ENTRANCE & CINEMATIC SPLASH — مديرية الأمن العام
   1. Precision Responsive Top-Ceiling Hanging Lamp
   2. Seamless Transition to Saudi National Emblem (Swords & Palm)
   3. Transition to Ministry of Interior Emblem
   4. Transition to Public Security Emblem
   5. Smooth Entry to Homepage
   ═══════════════════════════════════════════════════════════════════ */

body.lamp-active {
  overflow: hidden !important;
  user-select: none;
}

.lamp-entrance-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999999;
  background: #02040b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  opacity: 1;
  cursor: pointer;
  transition: opacity 0.85s cubic-bezier(0.4, 0, 0.2, 1), transform 0.85s cubic-bezier(0.4, 0, 0.2, 1), filter 0.85s ease;
  perspective: 1000px;
}

.lamp-entrance-overlay.fade-out {
  opacity: 0;
  transform: scale(1.08);
  filter: blur(8px);
  pointer-events: none;
}

/* ── Dark Ambient Room Background ── */
.lamp-ambient-darkness {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 15%, #080f24 0%, #030611 65%, #010207 100%);
  pointer-events: none;
  z-index: 1;
  transition: opacity 0.6s ease;
}

.lamp-ambient-darkness::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(201, 162, 39, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(201, 162, 39, 0.025) 1px, transparent 1px);
  background-size: 45px 45px;
  pointer-events: none;
}

/* ── Room Illumination Glow (Activated when lamp is lit) ── */
.lamp-room-light {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: radial-gradient(circle at 50% 180px, rgba(255, 230, 150, 0.88) 0%, rgba(243, 175, 40, 0.55) 25%, rgba(18, 32, 75, 0.85) 60%, rgba(4, 8, 22, 0.98) 95%);
  pointer-events: none;
  z-index: 2;
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.lamp-entrance-overlay.is-lit .lamp-room-light {
  opacity: 1;
  animation: roomLightBreath 4s infinite alternate ease-in-out;
}

@keyframes roomLightBreath {
  0% { opacity: 0.92; transform: scale(1); }
  100% { opacity: 1; transform: scale(1.03); }
}

/* ── Radial Flash Burst on Ignition ── */
.lamp-radial-burst {
  position: absolute;
  top: 140px;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.1);
  width: 900px;
  height: 900px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.95) 0%, rgba(255, 215, 90, 0.7) 30%, rgba(201, 162, 39, 0.3) 60%, transparent 75%);
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.lamp-entrance-overlay.is-lit .lamp-radial-burst {
  animation: lightBurstFlash 0.75s cubic-bezier(0.1, 0.9, 0.2, 1) forwards;
}

@keyframes lightBurstFlash {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
  35% { transform: translate(-50%, -50%) scale(1.4); opacity: 0.9; }
  100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0; }
}

/* ── Fullscreen Stage Container (Responsive to all viewports) ── */
.lamp-stage {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 10;
}

/* Sleek ceiling architectural trim line spanning across viewport top */
.lamp-stage::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2.5px;
  background: linear-gradient(90deg, 
    transparent 0%, 
    rgba(201, 162, 39, 0.2) 15%, 
    rgba(255, 215, 0, 0.75) 50%, 
    rgba(201, 162, 39, 0.2) 85%, 
    transparent 100%
  );
  box-shadow: 0 1px 12px rgba(201, 162, 39, 0.5), 0 0 20px rgba(255, 215, 0, 0.3);
  z-index: 28;
  pointer-events: none;
}

/* ── Hanging Lamp Fixture & Cable (Strictly pinned to top edge: 0) ── */
.lamp-fixture-wrap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  z-index: 30;
  pointer-events: auto;
  transform-origin: 50% 0;
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1), transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  animation: gentleSway 7s infinite ease-in-out;
}

@keyframes gentleSway {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(0.45deg); }
  75% { transform: rotate(-0.45deg); }
}

/* Lift and dissolve lamp fixture when cinematic begins */
.lamp-entrance-overlay.step-cinematic-start .lamp-fixture-wrap {
  opacity: 0;
  transform: translateY(-90px) scale(0.9);
  pointer-events: none;
}

/* Flush Ceiling Mount Canopy (Attached firmly to top: 0 with zero gap) */
.lamp-ceiling-mount {
  width: 150px;
  height: 14px;
  background: linear-gradient(180deg, #252e46 0%, #111728 65%, #080c16 100%);
  border-bottom: 2.5px solid #d4af37;
  border-left: 1px solid rgba(212, 175, 55, 0.4);
  border-right: 1px solid rgba(212, 175, 55, 0.4);
  border-top: none;
  border-radius: 0 0 14px 14px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.95), 0 0 16px rgba(212, 175, 55, 0.35);
  position: relative;
  top: 0;
  margin-top: 0;
  flex-shrink: 0;
}

/* Top ceiling bracket line */
.lamp-ceiling-mount::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 190px;
  height: 3px;
  background: linear-gradient(90deg, transparent 0%, rgba(201, 162, 39, 0.6) 20%, #ffeaa7 50%, rgba(201, 162, 39, 0.6) 80%, transparent 100%);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.6);
}

/* Ornamental center socket collar */
.lamp-ceiling-mount::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 5px;
  background: linear-gradient(180deg, #ffd700 0%, #c9a227 100%);
  border-radius: 2px;
  box-shadow: 0 0 8px rgba(201, 162, 39, 0.5);
}

.lamp-main-cable {
  width: 4px;
  height: clamp(30px, 5vh, 55px);
  background: linear-gradient(90deg, #161a29 0%, #353e57 50%, #121520 100%);
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.9);
  flex-shrink: 0;
}

.lamp-bulb-unit {
  position: relative;
  width: 240px;
  height: 260px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lamp-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.85));
  overflow: visible;
}

/* Off State Filament */
.lamp-filament {
  stroke: #483d2a;
  transition: stroke 0.25s ease, filter 0.25s ease;
}

/* Flickering State */
.lamp-entrance-overlay.is-turning-on .lamp-filament {
  animation: filamentFlicker 0.4s steps(2, start) infinite;
}

@keyframes filamentFlicker {
  0% { stroke: #fff6d0; filter: drop-shadow(0 0 12px #ffda79); }
  25% { stroke: #684a1e; filter: none; }
  50% { stroke: #ffffff; filter: drop-shadow(0 0 20px #ffb830); }
  75% { stroke: #8f6526; filter: none; }
  100% { stroke: #fff0aa; filter: drop-shadow(0 0 15px #ffd32a); }
}

/* Lit State Filament */
.lamp-entrance-overlay.is-lit .lamp-filament {
  stroke: #ffffff !important;
  stroke-width: 3.2px;
  filter: drop-shadow(0 0 8px #ffffff) drop-shadow(0 0 18px #ffb830) drop-shadow(0 0 35px #ff793f);
}

.lamp-bulb-fill {
  opacity: 0;
  transition: opacity 0.35s ease;
}

.lamp-entrance-overlay.is-lit .lamp-bulb-fill {
  opacity: 0.95;
  filter: drop-shadow(0 0 35px rgba(255, 200, 60, 0.9)) drop-shadow(0 0 70px rgba(243, 156, 18, 0.6));
}

.lamp-glass-envelope {
  transition: stroke 0.35s ease, filter 0.35s ease;
}

.lamp-entrance-overlay.is-lit .lamp-glass-envelope {
  stroke: rgba(255, 240, 180, 0.85);
  filter: drop-shadow(0 0 25px rgba(255, 215, 0, 0.8));
}

/* ── Interactive Pull Chain / Cord (Locked inside SVG coordinate space) ── */
.lamp-pull-cord-group,
.lamp-pull-cord-wrap {
  cursor: grab;
  touch-action: none;
  outline: none;
}

.lamp-pull-cord-group:active,
.lamp-pull-cord-group.is-dragging,
.lamp-pull-cord-wrap:active,
.lamp-pull-cord-wrap.is-dragging {
  cursor: grabbing;
}

.lamp-chain-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.7));
}

.lamp-bead {
  transition: filter 0.2s ease;
}

.lamp-pull-knob {
  cursor: grab;
  transition: filter 0.2s ease;
}

.lamp-pull-cord-group:hover .lamp-pull-knob,
.lamp-pull-cord-group.is-dragging .lamp-pull-knob,
.lamp-pull-cord-wrap:hover .lamp-pull-knob,
.lamp-pull-cord-wrap.is-dragging .lamp-pull-knob {
  filter: drop-shadow(0 0 14px rgba(241, 196, 15, 0.95)) drop-shadow(0 0 24px rgba(255, 215, 0, 0.6));
}



/* ═══════════════════════════════════════════════════════════════════
   CINEMATIC STAGES: SAUDI EMBLEM, MOI EMBLEM, AMN EMBLEM
   (Always dead-center on every screen)
   ═══════════════════════════════════════════════════════════════════ */

/* ── Dynamic Golden Background Glow behind emblems ── */
.splash-bg-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(750px, 90vw);
  height: min(750px, 90vw);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.28) 0%, rgba(201, 162, 39, 0.06) 55%, transparent 75%);
  pointer-events: none;
  animation: pulseBgGlow 3.5s infinite ease-in-out;
}
@keyframes pulseBgGlow {
  0%, 100% { transform: translate(-50%, -50%) scale(0.92); opacity: 0.5; }
  50% { transform: translate(-50%, -50%) scale(1.25); opacity: 0.95; }
}

/* ── STAGE 1: SAUDI NATIONAL EMBLEM (Crossed Swords & Date Palm) ── */
.saudi-emblem-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, 92vw);
  height: min(420px, 70vh);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.65s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 15;
}

.saudi-emblem-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 25px rgba(201, 162, 39, 0.45));
}

.cinematic-sword.sword-left {
  transform-origin: 400px 480px;
  opacity: 0;
  transform: translate(-300px, 150px) rotate(-35deg) scale(1.5);
  transition: transform 1.0s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.7s ease;
}
.step-sword-1 .cinematic-sword.sword-left {
  opacity: 1;
  transform: translate(0, 0) rotate(0deg) scale(1);
}

.cinematic-sword.sword-right {
  transform-origin: 400px 480px;
  opacity: 0;
  transform: translate(300px, 150px) rotate(35deg) scale(1.5);
  transition: transform 1.0s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.7s ease;
}
.step-sword-2 .cinematic-sword.sword-right {
  opacity: 1;
  transform: translate(0, 0) rotate(0deg) scale(1);
}

.clash-spark {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, #ffffff 0%, rgba(255, 235, 170, 0.95) 30%, rgba(201, 162, 39, 0) 70%);
  top: 65%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}
.step-spark .clash-spark {
  transform: translate(-50%, -50%) scale(1.9);
  opacity: 1;
}

.cinematic-palm {
  transform-origin: 400px 240px;
  opacity: 0;
  transform: translateY(-100px) scale(0.3);
  transition: transform 1.0s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.8s ease;
}
.step-palm .cinematic-palm {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.step-glow .saudi-emblem-svg {
  animation: emblemPulse 1.1s infinite alternate ease-in-out;
}
@keyframes emblemPulse {
  0% { filter: drop-shadow(0 0 20px rgba(201, 162, 39, 0.35)); }
  100% { filter: drop-shadow(0 0 50px rgba(255, 240, 180, 0.95)) drop-shadow(0 0 80px rgba(201, 162, 39, 0.65)); }
}

/* Hide stage 1 when moving to stage 2 */
.step-moi .saudi-emblem-wrapper,
.step-amn .saudi-emblem-wrapper {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.65) translateY(-20px);
  filter: blur(8px);
  pointer-events: none;
}

/* ── STAGE 2: MINISTRY OF INTERIOR (MOI) EMBLEM ── */
.moi-emblem-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.7) translateY(20px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  transition: all 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 16;
}
.step-moi .moi-emblem-wrapper {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.moi-emblem-halo {
  position: absolute;
  width: 240px;
  height: 240px;
  top: 10px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 39, 0.45) 0%, rgba(201, 162, 39, 0.1) 60%, transparent 80%);
  animation: haloPulse 2.8s infinite ease-in-out;
}
@keyframes haloPulse {
  0%, 100% { transform: scale(0.95); opacity: 0.6; }
  50% { transform: scale(1.2); opacity: 1; }
}

.moi-emblem-img {
  position: relative;
  z-index: 2;
  width: clamp(120px, 20vw, 170px);
  height: clamp(120px, 20vw, 170px);
  object-fit: contain;
  filter: drop-shadow(0 10px 25px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 25px rgba(201, 162, 39, 0.45));
}

.moi-brand-typography {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  position: relative;
  z-index: 2;
}

.moi-brand-sub {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  font-weight: 700;
  color: #ffd700;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.moi-brand-main {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: clamp(1.8rem, 4.5vw, 2.2rem);
  font-weight: 900;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 0 20px rgba(201, 162, 39, 0.6), 0 4px 10px rgba(0, 0, 0, 0.8);
}

/* Hide stage 2 when moving to stage 3 */
.step-amn .moi-emblem-wrapper {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.65) translateY(-20px);
  filter: blur(8px);
  pointer-events: none;
}

/* ── STAGE 3: PUBLIC SECURITY (AMN) EMBLEM & TITLES ── */
.amn-emblem-wrapper {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.75) translateY(30px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  opacity: 0;
  transition: all 0.85s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
  z-index: 17;
}
.step-amn .amn-emblem-wrapper {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.amn-emblem-halo {
  position: absolute;
  width: 260px;
  height: 260px;
  top: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245, 215, 127, 0.45) 0%, rgba(201, 162, 39, 0.15) 55%, transparent 75%);
  transition: all 0.8s ease;
  animation: haloPulse 2.5s infinite ease-in-out;
}

.amn-emblem-img {
  position: relative;
  z-index: 2;
  width: clamp(130px, 22vw, 180px);
  height: clamp(130px, 22vw, 180px);
  object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 30px rgba(201, 162, 39, 0.5));
  transition: filter 0.8s ease, transform 0.8s ease;
}

.step-amn-glow .amn-emblem-img {
  filter: drop-shadow(0 0 35px rgba(255, 240, 180, 1)) drop-shadow(0 0 65px rgba(201, 162, 39, 0.85)) drop-shadow(0 15px 40px rgba(0, 0, 0, 0.85));
  transform: scale(1.05);
}

.amn-brand-typography {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  z-index: 2;
}

.amn-brand-main {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  font-size: clamp(2rem, 5vw, 2.6rem);
  font-weight: 900;
  color: #ffffff;
  margin: 0;
  text-shadow: 0 0 25px rgba(240, 203, 82, 0.75), 0 4px 15px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.5px;
  transition: all 0.8s ease;
}

.step-amn-glow .amn-brand-main {
  animation: intenseGoldGlow 1.2s infinite alternate ease-in-out;
}

@keyframes intenseGoldGlow {
  0% {
    text-shadow: 0 0 20px rgba(201, 162, 39, 0.4), 0 0 40px rgba(201, 162, 39, 0.2);
  }
  100% {
    filter: drop-shadow(0 0 28px rgba(255, 255, 255, 1)) drop-shadow(0 0 55px rgba(255, 235, 150, 1)) drop-shadow(0 0 90px rgba(201, 162, 39, 0.9));
  }
}

.amn-brand-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(13, 24, 64, 0.7);
  border: 1px solid rgba(201, 162, 39, 0.35);
  padding: 6px 20px;
  border-radius: 30px;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.8s ease;
}

.step-amn-glow .amn-brand-pill {
  border-color: rgba(245, 215, 127, 0.8);
  box-shadow: 0 0 25px rgba(201, 162, 39, 0.5), 0 8px 30px rgba(0, 0, 0, 0.6);
}

.amn-brand-badge {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  color: #ffffff;
  font-weight: 800;
  font-size: clamp(0.85rem, 2vw, 0.95rem);
  padding-left: 10px;
  border-left: 1px solid rgba(201, 162, 39, 0.35);
}

.amn-brand-sub {
  font-family: 'Tajawal', 'Cairo', sans-serif;
  color: #c9a227;
  font-weight: 700;
  font-size: clamp(0.8rem, 1.8vw, 0.88rem);
}

/* ── Mobile & Screen Responsiveness ── */
@media (max-width: 768px) {
  .lamp-ceiling-mount {
    width: 120px;
    height: 11px;
  }
  .lamp-ceiling-mount::before {
    width: 150px;
  }
  .lamp-main-cable {
    height: 28px;
  }
  .lamp-bulb-unit {
    transform: scale(0.9);
    transform-origin: top center;
  }
}

@media (max-height: 600px) {
  .lamp-main-cable {
    height: 18px;
  }
  .lamp-bulb-unit {
    transform: scale(0.8);
    transform-origin: top center;
  }
  .saudi-emblem-wrapper,
  .moi-emblem-wrapper,
  .amn-emblem-wrapper {
    transform: translate(-50%, -50%) scale(0.75);
  }
}

