/**
 * Homepage shell + loader + performance.
 * Brand: سامانه هوشمند کیان / Shkian
 */

/* Hide page until ready — painted ASAP from critical head CSS too */
html.skh-pending,
html.skh-pending body {
  overflow: hidden !important;
}

html.skh-pending #ahura-header-main-wrap,
html.skh-pending .website-footer,
html.skh-pending .shkian-home-locked,
html.skh-pending #content,
html.skh-pending .site-main,
html.skh-pending main {
  visibility: hidden !important;
  pointer-events: none !important;
}

.skh-loader {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  background: #fff;
  transition: opacity 0.38s ease, visibility 0.38s ease;
}

html.skh-ready .skh-loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.skh-loader__logo {
  width: min(180px, 56vw);
  height: auto;
  max-height: 48px;
  display: block;
  object-fit: contain;
  animation: skh-pulse 1.15s ease-in-out infinite;
}

.skh-loader__bar {
  width: min(160px, 42vw);
  height: 3px;
  border-radius: 99px;
  background: rgba(13, 148, 136, 0.16);
  overflow: hidden;
}

.skh-loader__bar > span {
  display: block;
  height: 100%;
  width: 40%;
  border-radius: inherit;
  background: #0d9488;
  animation: skh-bar 1s ease-in-out infinite;
}

@keyframes skh-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.03);
    opacity: 0.92;
  }
}

@keyframes skh-bar {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skh-loader__logo,
  .skh-loader__bar > span {
    animation: none;
  }
}

/* Smooth reveal + less jank once ready */
html.skh-ready .shkian-home-locked {
  animation: skh-fade-in 0.35s ease both;
}

@keyframes skh-fade-in {
  from {
    opacity: 0.01;
  }
  to {
    opacity: 1;
  }
}

.shkian-home-locked {
  width: 100%;
  max-width: 100%;
  contain: layout style;
}

/* Skip paint work for off-screen sections */
.shkian-home-locked .e-con.e-parent,
.shkian-home-locked .elementor-top-section {
  content-visibility: auto;
  contain-intrinsic-size: 1px 420px;
}

/* Keep above-the-fold sections always painted */
.shkian-home-locked > .e-con.e-parent:nth-child(-n + 2),
.shkian-home-locked > .elementor-section:nth-child(-n + 2) {
  content-visibility: visible;
  contain-intrinsic-size: auto;
}

/* Soften heavy carousel paint */
.shkian-home-locked .swiper-wrapper,
.shkian-home-locked .elementor-main-swiper {
  will-change: auto;
  transform: translateZ(0);
}

img[loading="lazy"] {
  background: #f3f7f6;
}
