/* =========================================
   ARTNEST TREASURES — INTRO LOADER
   Burnt Orange screen with the brand name; the dotting tool lays
   its dots as the page loads (driven by js/loader.js), then the
   last dot opens into a circle that reveals the home page.
   ========================================= */

.site-loader {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;

  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);

  background-color: var(--color-brand-burnt-orange);
  color: var(--color-brand-warm-ivory);
  text-align: center;
}

html.is-loading .site-loader {
  display: flex;
}

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

/* Hold the page's own intro animations until the loader has gone */
html.is-loading :is(.brand__dot--draw, .brand__tool, .wire-line, .wire-guide, .wire-spoke, .wire-node) {
  animation-play-state: paused;
}

/* 1 — Logo mark, medium, on top */
.loader__mark {
  display: block;
  width: clamp(190px, 21vw, 290px);
  height: auto;
  aspect-ratio: 1880 / 165;
  margin-bottom: clamp(var(--space-6), 5vh, var(--space-8));
  overflow: visible;
  fill: var(--color-brand-warm-ivory);

  animation: loader-rise 900ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* 2 — Brand name, large and airy */
.loader__name {
  margin: 0;

  font-family: var(--font-display);
  font-size: var(--font-size-loader);
  font-weight: var(--font-weight-display);
  line-height: 0.95;
  letter-spacing: 0.14em;
  /* optical correction: tracking adds space after the last letter */
  margin-right: -0.14em;
  text-transform: uppercase;
  text-wrap: balance;

  animation: loader-rise 1000ms cubic-bezier(0.22, 1, 0.36, 1) 120ms both;
}

/* 3 — Byline, small, between fine hairlines */
.loader__by {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: clamp(var(--space-5), 3.5vh, var(--space-6)) 0 0;

  font-family: var(--font-body);
  font-size: clamp(0.6875rem, 0.9vw, 0.8125rem);
  font-weight: var(--font-weight-medium);
  line-height: 1;
  letter-spacing: 0.42em;
  text-transform: uppercase;

  animation: loader-rise 1000ms cubic-bezier(0.22, 1, 0.36, 1) 260ms both;
}

.loader__by::before,
.loader__by::after {
  content: "";
  width: clamp(28px, 4vw, 56px);
  height: 1px;
  background-color: currentColor;
  opacity: 0.6;
}

/* letter-spacing trails the last letter; balance it optically */
.loader__by::after {
  margin-left: -0.42em;
}

.loader__dot--green {
  fill: var(--color-brand-forest-green);
}

.loader__tool-ring {
  fill: none;
  stroke: var(--color-brand-warm-ivory);
  stroke-width: 18;
}

/* Dots after the first two appear as the tool reaches them */
.loader__dot--draw {
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  transition: transform 420ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.loader__dot--draw.is-on {
  transform: scale(1);
}

/* Quiet progress counter at the foot of the screen */
.loader__count {
  position: absolute;
  left: 50%;
  bottom: clamp(var(--space-5), 5vh, var(--space-7));
  margin: 0;
  transform: translateX(-50%);

  font-family: var(--font-body);
  font-size: var(--font-size-micro);
  font-weight: var(--font-weight-medium);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3em;
  opacity: 0.7;

  animation: loader-fade 900ms ease 400ms both;
}

@keyframes loader-fade {
  from { opacity: 0; }
  to   { opacity: 0.7; }
}

@keyframes loader-rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* Reduced motion: no travel or pop; the loader simply fades away */
.site-loader.is-fading {
  opacity: 0;
  transition: opacity 400ms ease;
}

@media (prefers-reduced-motion: reduce) {
  .loader__name,
  .loader__by,
  .loader__mark,
  .loader__count {
    animation: none;
  }

  .loader__dot--draw {
    transition: none;
  }
}
