/* =============================================================================
   COMPONENT: PRELOADER
   "The press is running": the nameplate gets inked left to right while a
   thin rule fills underneath, then the sheet lifts off like a page being
   pulled from the press. One CSS variable (--p, 0 to 1) drives everything,
   and every moving part is a transform or a clip on a small element.
   Shown once per browser session, skipped for reduced motion and without JS.
   Behaviour: js/components/preloader.js
   ============================================================================= */
.preloader {
  --p: 0;
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px var(--gutter);
  background-color: var(--c-cream);
  background-image: radial-gradient(rgb(22 19 15 / 0.09) 1.2px, transparent 1.4px);
  background-size: 14px 14px;
  border-bottom: var(--b) solid var(--c-ink);
  transition: translate 800ms cubic-bezier(0.76, 0, 0.24, 1);
}

/* Lift-off: the whole sheet slides up and away (compositor-only). */
.preloader.is-done { translate: 0 calc(-100% - 12px); pointer-events: none; }

/* Never shown without JS, on repeat visits, or with reduced motion. */
html:not(.js) .preloader,
html.no-preload .preloader { display: none; }

.preloader__inner {
  width: max-content;   /* the rule and foot line match the nameplate */
  max-width: 100%;
  text-align: center;
  animation: press-in 600ms var(--e-out) both;
  transition: opacity 300ms ease, translate 500ms var(--e-out);
}

.preloader.is-done .preloader__inner { opacity: 0; translate: 0 -28px; }

@keyframes press-in {
  from { opacity: 0; translate: 0 14px; }
}

/* "EXTRA! EXTRA!" between double rules */
.preloader__kicker {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font: 700 var(--t-xs)/1.2 var(--f-label);
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.preloader__kicker::before,
.preloader__kicker::after {
  content: "";
  flex: 0 1 72px;
  border-top: 4px double var(--c-ink);
}

/* Nameplate: a faint ghost, with the inked copy clipped on top. */
.preloader__name {
  position: relative;
  display: inline-block;
  margin-top: 14px;
  font: 700 clamp(2.6rem, 11vw, 5.4rem)/1.1 var(--f-nameplate);
  white-space: nowrap;
}

.preloader__ghost { color: rgb(22 19 15 / 0.13); }

.preloader__ink {
  position: absolute;
  inset: 0;
  color: var(--c-ink);
  clip-path: inset(-10% calc((1 - var(--p)) * 100%) -10% 0);
}

/* The roller: a red ink line riding the edge of the fill. */
.preloader__roller {
  position: absolute;
  inset: -8% 0;
  translate: calc(var(--p) * 100%) 0;
  pointer-events: none;
}

.preloader__roller::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1.5px;
  width: 3px;
  background: var(--c-red);
  border-radius: 2px;
  transition: opacity 250ms;
}

.preloader.is-full .preloader__roller::before { opacity: 0; }

/* Thin progress rule */
.preloader__rule {
  height: 3px;
  margin-top: 10px;
  background: rgb(22 19 15 / 0.12);
  overflow: hidden;
}

.preloader__rule span {
  display: block;
  height: 100%;
  background: var(--c-ink);
  transform: scaleX(var(--p));
  transform-origin: left;
}

.preloader__foot {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-top: 12px;
  text-align: left;
}

.preloader__line {
  font: 700 var(--t-sm)/1.35 var(--f-accent);
  color: var(--c-ink-soft);
}

.preloader__count {
  flex: none;
  min-width: 3.2ch;
  font: 400 clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem)/1 var(--f-display);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.preloader__count small { font-size: 0.5em; margin-left: 2px; }

@media (max-width: 480px) {
  .preloader__kicker { letter-spacing: 0.16em; }
  .preloader__kicker::before,
  .preloader__kicker::after { flex-basis: 32px; }
  .preloader__line { font-size: var(--t-xs); }
}
