/* ==========================================================================
   L&T HYDRAULIC INDUSTRY - LUXURY 3-SECOND INTRO LOADER
   High-end, industrial, hydraulic-themed loading screen for index.html
   ========================================================================== */

/* Prevent scroll while loader is active */
body.loader-active {
  overflow: hidden !important;
  height: 100vh !important;
}

#siteLoader {
  position: fixed;
  inset: 0;
  z-index: 99999999;
  background: radial-gradient(circle at 50% 45%, #0e2b34 0%, #06151c 55%, #02080a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.55s cubic-bezier(0.16, 1, 0.3, 1),
              filter 0.55s ease,
              visibility 0.55s ease;
}

#siteLoader.loader-hidden {
  opacity: 0;
  visibility: hidden;
  transform: scale(1.04);
  filter: blur(8px);
  pointer-events: none;
}

/* Subtle Animated Blueprint Grid Background */
#siteLoader::before {
  content: "";
  position: absolute;
  inset: -50px;
  background-image: 
    linear-gradient(rgba(99, 216, 211, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(99, 216, 211, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  animation: gridDrift 20s linear infinite;
}

@keyframes gridDrift {
  0% { transform: translate(0, 0); }
  100% { transform: translate(40px, 40px); }
}

/* Ambient Radial Glow */
.loader-ambient-glow {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(57, 183, 178, 0.18) 0%, rgba(99, 216, 211, 0.06) 45%, transparent 70%);
  pointer-events: none;
  animation: ambientBreath 3s ease-in-out infinite alternate;
}

@keyframes ambientBreath {
  0% { transform: scale(0.9); opacity: 0.6; }
  100% { transform: scale(1.15); opacity: 1; }
}

/* Top Skip Button */
.loader-skip-btn {
  position: absolute;
  top: 24px;
  right: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #8da4ad;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  z-index: 10;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.loader-skip-btn:hover {
  background: rgba(99, 216, 211, 0.12);
  border-color: rgba(99, 216, 211, 0.4);
  color: #63d8d3;
  transform: translateY(-1px);
}

/* Main Center Content Container */
.loader-center {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 20px;
  max-width: 520px;
}

/* Machine approaches from the distance and settles on the illuminated floor. */
.loader-machine-stage {
  position: relative;
  width: min(440px, 86vw);
  height: min(310px, 40svh);
  margin-bottom: 24px;
  perspective: 900px;
}
.loader-machine {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform-origin: 50% 85%;
  filter: drop-shadow(0 12px 18px rgba(0, 0, 0, .6));
  animation: loaderMachineArrive 2.4s cubic-bezier(.16, 1, .3, 1) both;
}
.loader-machine-floor {
  position: absolute;
  inset: auto 5% -10px;
  height: 90px;
  border: 1px solid rgba(99, 216, 211, .4);
  border-radius: 50%;
  background: repeating-linear-gradient(90deg, transparent 0 29px, #63d8d322 30px 31px),
              radial-gradient(ellipse, #39b7b233, transparent 70%);
  transform: rotateX(65deg);
  box-shadow: 0 0 35px #39b7b233;
}
.loader-machine-shadow {
  position: absolute;
  bottom: 0;
  left: 20%;
  width: 60%;
  height: 24px;
  border-radius: 50%;
  background: #0009;
  filter: blur(10px);
  animation: loaderShadowArrive 2.4s ease-out both;
}
.loader-machine-scan {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 8%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #a0e8e1, transparent);
  box-shadow: 0 0 18px #63d8d3;
  animation: loaderMachineScan 1.2s 1.4s ease-in-out both;
}
@keyframes loaderMachineArrive {
  0% { opacity: 0; transform: translate3d(90px, -20px, -650px) rotateY(-28deg); }
  25% { opacity: 1; }
  78% { transform: translate3d(0, -5px, 18px) rotateY(3deg); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) rotateY(0); }
}
@keyframes loaderShadowArrive {
  from { opacity: 0; transform: scale(.3); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes loaderMachineScan {
  0% { opacity: 0; top: 8%; }
  20% { opacity: .8; }
  80% { opacity: .8; }
  100% { opacity: 0; top: 90%; }
}

/* Text Hierarchy */
.loader-brand-title {
  font-size: clamp(1.4rem, 4vw, 1.85rem);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #ffffff;
  margin: 0 0 8px;
  line-height: 1.15;
  background: linear-gradient(135deg, #ffffff 40%, #63d8d3 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.loader-brand-sub {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #8da4ad;
  text-transform: uppercase;
  margin: 0 0 28px;
}

/* Progress Section */
.loader-progress-box {
  width: 320px;
  max-width: 85vw;
}

.loader-track {
  position: relative;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  margin-bottom: 12px;
}

.loader-bar {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #39b7b2 0%, #63d8d3 70%, #e5b869 100%);
  box-shadow: 0 0 16px rgba(99, 216, 211, 0.7);
  border-radius: 999px;
  transition: width 0.08s linear;
}

/* Progress Status Info Row */
.loader-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: #7d96a0;
  letter-spacing: 0.06em;
}

.loader-status-text {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #a4bcc5;
  text-transform: uppercase;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 250px;
}

.loader-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #63d8d3;
  box-shadow: 0 0 8px #63d8d3;
  animation: dotFlash 1s ease-in-out infinite alternate;
}

@keyframes dotFlash {
  0% { opacity: 0.3; transform: scale(0.8); }
  100% { opacity: 1; transform: scale(1.2); }
}

.loader-percent {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12.5px;
  font-weight: 800;
  color: #63d8d3;
  min-width: 36px;
  text-align: right;
}

/* Mobile Adjustments */
@media (max-width: 580px) {
  .loader-brand-title {
    font-size: 1.3rem;
    letter-spacing: 0.08em;
  }
  .loader-brand-sub {
    font-size: 10px;
    letter-spacing: 0.12em;
    margin-bottom: 22px;
  }
  .loader-progress-box {
    width: 270px;
  }
  .loader-skip-btn {
    top: 16px;
    right: 18px;
    padding: 6px 12px;
    font-size: 11px;
  }
}

/* Reduced Motion Override */
@media (prefers-reduced-motion: reduce) {
  #siteLoader::before,
  .loader-ambient-glow,
  .loader-machine,
  .loader-machine-shadow,
  .loader-machine-scan,
  .loader-dot {
    animation: none !important;
  }
}


@media (prefers-reduced-motion: reduce) {
  .loader-machine-scan { display: none; }
  #siteLoader { transition: none; }
}
