/* ==============================================================================
   IQBAL FASHION — BESPOKE TAILOR STARTUP LOADER (PRECISION BROWN & CREAM)
   Pure White Canvas · Rich Brown Horn Button · Dark Cream Silk Thread · Precision Needle
   ============================================================================== */

:root {
  --loader-bg: #FFFFFF;
  --loader-button-brown: #55341A;
  --loader-button-rim: #3D220E;
  --loader-thread: #DFCCA8;       /* Dark cream luxury silk thread */
  --loader-thread-dark: #C9B38B;
  --loader-accent: #FF5722;
  --loader-text: #111111;
  --loader-sub: #666666;
  --curtain-bezier: cubic-bezier(0.76, 0, 0.24, 1);
}

#iqbalStartupLoader {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: all;
  background: transparent;
  overflow: hidden;
}

/* Split Curtain Panels in Pure White */
.loader-curtain {
  position: absolute;
  left: 0;
  width: 100%;
  height: 50.5%;
  background: var(--loader-bg);
  z-index: 1;
  transition: transform 0.85s var(--curtain-bezier);
  will-change: transform;
}

.loader-curtain-top {
  top: 0;
  transform-origin: top center;
  border-bottom: 1px solid #EEEEEE;
}

.loader-curtain-bottom {
  bottom: 0;
  transform-origin: bottom center;
  border-top: 1px solid #EEEEEE;
}

#iqbalStartupLoader.split .loader-curtain-top {
  transform: translateY(-100%);
}

#iqbalStartupLoader.split .loader-curtain-bottom {
  transform: translateY(100%);
}

/* Center Stage */
.loader-stage {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.35s ease, transform 0.5s var(--curtain-bezier);
}

#iqbalStartupLoader.split .loader-stage {
  opacity: 0;
  transform: scale(0.92);
}

/* Button & Needle Graphic Container */
.button-anim-container {
  width: 140px;
  height: 140px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 22px;
}

.button-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
  filter: drop-shadow(0 14px 32px rgba(45, 25, 12, 0.14));
}

/* Button Group Subtle Micro-Spin on Finish */
.button-spin-wrap {
  transform-origin: 70px 70px;
}

.button-spin-wrap.finished {
  animation: buttonSettle 0.85s cubic-bezier(0.34, 1.45, 0.64, 1) forwards;
}

@keyframes buttonSettle {
  0% {
    transform: rotate(0deg) scale(1);
  }
  45% {
    transform: rotate(180deg) scale(1.07);
  }
  100% {
    transform: rotate(360deg) scale(1);
  }
}

/* Stitched Dark Cream Thread Lines */
.stitch-path {
  stroke: var(--loader-thread);
  stroke-width: 4.2;
  stroke-linecap: round;
  fill: none;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
}

/* Precision Thread Tailoring - Looping Mode until assets load */
.loader-stage.is-looping .stitch-cross-1 {
  animation: stitchLoop1 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loader-stage.is-looping .stitch-cross-2 {
  animation: stitchLoop2 1.4s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes stitchLoop1 {
  0% {
    stroke-dashoffset: 48;
    opacity: 0.2;
  }
  28% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  80% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  92%, 100% {
    stroke-dashoffset: -48;
    opacity: 0;
  }
}

@keyframes stitchLoop2 {
  0%, 26% {
    stroke-dashoffset: 48;
    opacity: 0;
  }
  30% {
    opacity: 0.2;
  }
  56% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  80% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  92%, 100% {
    stroke-dashoffset: -48;
    opacity: 0;
  }
}

/* Finished Mode: Lock Stitches Firmly */
.loader-stage.is-finished .stitch-cross-1,
.loader-stage.is-finished .stitch-cross-2 {
  animation: none !important;
  stroke-dashoffset: 0 !important;
  opacity: 1 !important;
  transition: opacity 0.25s ease;
}

/* Brand Text Reveal */
.loader-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.loader-brand-title {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 4px;
  color: var(--loader-text);
  margin: 0;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(8px);
  animation: textFadeUp 0.6s ease 0.9s forwards;
}

.loader-brand-sub {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  color: var(--loader-accent);
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(6px);
  animation: textFadeUp 0.6s ease 1.2s forwards;
}

.loader-progress-bar-wrap {
  width: 90px;
  height: 2.5px;
  background: #EBEBEB;
  border-radius: 2px;
  margin-top: 14px;
  overflow: hidden;
  opacity: 0;
  animation: fadeIn 0.4s ease 1.3s forwards;
}

.loader-progress-bar-fill {
  height: 100%;
  width: 0%;
  background: #111111;
  transition: width 0.3s ease;
  will-change: width;
}

@keyframes textFadeUp {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}
