/* ==========================================================================
   Bloom. — Welcome Screen (Preloader)
   Loaded before main.css so it paints on the very first frame.
   Self-contained: no dependency on variables.css.
   ========================================================================== */

html.is-loading,
html.is-loading body {
  overflow: hidden;
}

.preloader {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  color: #1A2420;
  background:
    radial-gradient(120% 85% at 50% 30%, #FBEFE8 0%, rgba(251, 239, 232, 0) 60%),
    #FAF7F2;
  clip-path: inset(0 0 0 0);

  /* Failsafe: if the JS never runs (CDN blocked, script error, etc.)
     the welcome screen still steps aside after 12s. JS cancels this
     by adding .is-controlled and takes over the timing itself. */
  animation: preloader-failsafe 0.6s ease 12s forwards;
}

.preloader.is-controlled {
  animation: none;
}

@keyframes preloader-failsafe {
  to {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }
}

.preloader__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* --- Logo mark: drawn stroke by stroke as frames load --- */
.preloader__mark {
  width: clamp(72px, 9vw, 96px);
  height: auto;
  overflow: visible;
}

.preloader__mark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.6s ease;
}

.preloader.is-complete .preloader__mark path {
  stroke: #C8746A;
}

/* --- Wordmark --- */
.preloader__wordmark {
  margin: 1.5rem 0 0;
  font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
  font-weight: 600;
  font-size: clamp(2.25rem, 4.5vw, 3rem);
  line-height: 1;
  letter-spacing: -0.01em;
  animation: preloader-word 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.15s both;
}

.preloader__tagline {
  margin: 0.6rem 0 0;
  font-family: 'Playfair Display', Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  color: #6C635D;
  animation: preloader-word 1.4s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
}

@keyframes preloader-word {
  from {
    opacity: 0;
    transform: translateY(10px);
    letter-spacing: 0.06em;
  }
}

/* --- Progress: hairline + counter --- */
.preloader__meta {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-top: 2.5rem;
  transition: opacity 0.4s ease;
}

.preloader.is-complete .preloader__meta {
  opacity: 0;
}

.preloader__bar {
  position: relative;
  width: 120px;
  height: 1px;
  background: rgba(26, 36, 32, 0.14);
  overflow: hidden;
}

.preloader__bar-fill {
  position: absolute;
  inset: 0;
  background: #1A2420;
  transform-origin: left center;
  transform: scaleX(0);
}

.preloader__count {
  min-width: 2.2em;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  color: #6C635D;
  text-align: right;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .preloader__wordmark,
  .preloader__tagline {
    animation: none;
  }
}
