/* ==========================================================================
   Preloader — spinner → logo fade → diagonal wipe (45°, JS-driven)
   مرجع الحركة: docs/mobile-design-reference.md
   clip-path يُحدَّث من shared.js — requestAnimationFrame
   ========================================================================== */
.smi-preloader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 99999;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: all;
  /* لا خلفية هنا — الستارة فقط، وإلا يختفي الـ wipe المائل */
  background: transparent;
}

.smi-preloader.smi-wipe {
  pointer-events: none;
}

.smi-preloader-curtain {
  position: absolute;
  top: calc(-1 * env(safe-area-inset-top, 0px));
  right: calc(-1 * env(safe-area-inset-right, 0px));
  bottom: calc(-1 * env(safe-area-inset-bottom, 0px));
  left: calc(-1 * env(safe-area-inset-left, 0px));
  background: var(--c1);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
  will-change: clip-path;
}

.smi-preloader-stage {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 120px;
  height: 120px;
}

.smi-preloader-spin {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-top-color: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  animation: preloaderSpin 0.85s linear infinite;
  pointer-events: none;
}

.smi-preloader-logo {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 120px;
  height: auto;
  filter: brightness(0) invert(1);
  opacity: 1;
  transition: opacity 0.28s ease-in-out;
}

.smi-preloader.smi-logo-out .smi-preloader-stage {
  opacity: 0;
  transition: opacity 0.28s ease-in-out;
}

.smi-preloader.smi-logo-out .smi-preloader-spin {
  animation: none;
}

@keyframes preloaderSpin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .smi-preloader-spin {
    animation: none;
    border-top-color: rgba(255, 255, 255, 0.5);
  }
}

@media (max-width: 767px) {
  .smi-preloader-stage {
    width: clamp(64px, 18vw, 96px);
    height: clamp(64px, 18vw, 96px);
  }

  .smi-preloader-logo {
    max-width: 100%;
  }
}
