/* ============================================================
   PRELOADER
   Visible from the very first paint (it is the first element in
   <body> and this stylesheet is render-blocking), so the page
   behind it is never seen before it. js/ui/preloader.js fades it
   out via .is-hidden once the first catalogue view is ready, then
   removes it from the DOM. Visitors with JavaScript disabled get
   a <noscript> rule in index.html that hides it instead.
   ============================================================ */

/* While the loader is up, lock the page underneath so nothing scrolls or
   shifts as the catalogue is populated. */
body.is-loading {
  overflow: hidden;
}

/* Full-screen overlay on top of everything else on the page.
   z-index 9999 is deliberately above every other layer (toasts, modals,
   chat panel) so nothing can accidentally render above the loader. */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(120% 140% at 15% 0%, var(--maroon-700), var(--maroon-950) 70%);
  opacity: 1;
  visibility: visible;
  /* visibility in the transition list so it flips to `hidden` only AFTER
     the opacity fade finishes — otherwise it would pop away instantly. */
  transition: opacity .5s ease, visibility .5s ease;
}

/* Faded-out state — still in the DOM but invisible and click-through. */
.preloader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  /* "backwards" only applies the start state, so GSAP can still animate
     opacity/transform on this element afterwards (used by the exit). */
  animation: preloaderIn .45s ease backwards;
}

@keyframes preloaderIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

.preloader-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: var(--shadow-pop);
}

.preloader-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cream);
}

/* Thin track behind the loading bar. */
.preloader-bar {
  width: 140px;
  height: 3px;
  border-radius: 3px;
  background: rgba(249, 241, 228, .2);
  overflow: hidden;
}

/* Gold fill inside the track. Width / position is animated by JS during load. */
.preloader-bar-fill {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: 3px;
  background: var(--gold);
}

/* Page-width helper — shared site-wide container used by many sections.
   Lives here presumably because this stylesheet is loaded first, so the
   class is defined before any component that relies on it. */
.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 32px;
}

@media (max-width:640px) {
  .wrap {
    padding: 0 20px;
  }
}

/* Paused / reduced motion: no loading screen at all - the page's own placeholders show instead. */
/* Explicit user setting (Pause animations) — hide the preloader entirely and
   release the scroll lock. The skeletons take over as the loading state. */
html.a11y-no-motion .preloader {
  display: none !important;
}

html.a11y-no-motion body.is-loading {
  overflow: visible;
}

/* OS-level reduced-motion preference — same treatment as the explicit setting. */
@media (prefers-reduced-motion: reduce) {
  .preloader {
    display: none !important;
  }

  body.is-loading {
    overflow: visible;
  }
}