/* =========================
   Fullscreen Loading Overlay
   ========================= */
#loading-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;

  /* Semi-transparent so hero/LCP can paint behind it */
  background: rgba(255, 255, 255, 0); /* tweak 0.5–0.7 to taste */
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);

  display: flex;
  align-items: center;
  justify-content: center;

  /* Smooth fade-out when you add .hidden from JS */
  opacity: 1;
  transition: opacity 0.5s ease;
  will-change: opacity;
}

/* When ready, add .hidden via JS to fade away */
#loading-screen.hidden {
  opacity: 0;
  pointer-events: none;
}

/* =========================
   Logo / Masked Reveal
   ========================= */
.logo-mask {
  position: relative;
  width: clamp(120px, 18vw, 220px);
  height: clamp(120px, 18vw, 220px);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.logo-image {
  width: 100%;
  height: auto;
  display: block;
  z-index: 1;

  /* Horizontal sweep reveal */
  mask-image: linear-gradient(to right, black 0%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black 0%, transparent 100%);
  mask-size: 200% 100%;
  -webkit-mask-size: 200% 100%;
  mask-position: 200% 0;
  -webkit-mask-position: 200% 0;

  animation: paintReveal 1s ease-in-out forwards;
}

/* Optional subtle pulse while loading (remove if not needed) */
.logo-mask::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 16px;
  box-shadow: 0 0 0 0 rgba(0,0,0,0.08);
  animation: softPulse 1.4s ease-in-out infinite;
}

/* =========================
   Keyframes
   ========================= */
@keyframes paintReveal {
  0%   { mask-position: 200% 0; -webkit-mask-position: 200% 0; }
  100% { mask-position: 0% 0;   -webkit-mask-position: 0% 0; }
}

@keyframes softPulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(0,0,0,0.08); }
  50%     { box-shadow: 0 0 0 10px rgba(0,0,0,0.0); }
}

/* =========================
   Accessibility / System prefs
   ========================= */
@media (prefers-reduced-motion: reduce) {
  .logo-image {
    animation: none;
    mask-image: none;
    -webkit-mask-image: none;
  }
  .logo-mask::after {
    animation: none;
  }
  #loading-screen {
    transition: opacity 0.001s linear;
  }
}

/* =========================
   Dark mode tweak (optional)
   ========================= */
@media (prefers-color-scheme: dark) {
  #loading-screen {
    background: rgba(15, 15, 20, 0.55);
  }
  .logo-mask::after {
    box-shadow: 0 0 0 0 rgba(255,255,255,0.06);
  }
}
