/* ==========================================================================
   Making Strides or Standstill? 35 Years of HIV in Kenya
   Pre-loader, adapted from The Shot: GLP-1. The green is this piece's red.
   Copyright Willow Health Media 2026
   ========================================================================== */

:root {
  --wh-black:      #06add0;   /* the piece's own ground, so the handoff has no seam */
  --wh-ink:        #0c0e11;
  --wh-ink-dim:    #0f2c35;
  --wh-ink-faint:  #163a44;
  --wh-green:      #6e0b0e;   /* ribbon red, the prevalence line's colour */
  --wh-green-dim:  #8a3a3c;
  --wh-ease:       cubic-bezier(0.22, 1, 0.36, 1);
}

/* Lock scroll while the pre-loader owns the screen.
   Removed by JS on handoff, so the page still scrolls if JS fails. */
html.wh-preload-active,
html.wh-preload-active body {
  overflow: hidden;
  height: 100%;
}

.wh-preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 5vw;
  background: var(--wh-black);
  color: var(--wh-ink);
  font-family: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  text-align: center;
  opacity: 1;
  transition: opacity 900ms var(--wh-ease);
  -webkit-font-smoothing: antialiased;
}

.wh-preloader[data-state="done"] {
  opacity: 0;
  pointer-events: none;
}

/* --------------------------------------------------------------- the ring */

.wh-ring {
  position: relative;
  width: clamp(150px, 42vw, 230px);
  aspect-ratio: 1;
  margin-bottom: clamp(22px, 4vh, 38px);
}

.wh-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  overflow: visible;
}

.wh-ring__track {
  fill: none;
  stroke: rgba(12, 14, 17, .14);
  stroke-width: 2;
}

.wh-ring__arc {
  fill: none;
  stroke: var(--wh-green);
  stroke-width: 2;
  stroke-linecap: round;
  /* dasharray and dashoffset are driven from JS */
}

.wh-ring__readout {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.wh-ring__pct {
  font-size: clamp(30px, 8vw, 46px);
  font-weight: 300;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.wh-ring__pct-unit {
  font-size: 0.5em;
  margin-left: 2px;
  color: var(--wh-ink-dim);
}

.wh-ring__label {
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--wh-ink-faint);
  transition: color 600ms var(--wh-ease);
  max-width: 82%;
  line-height: 1.45;
  text-wrap: balance;
}

.wh-preloader[data-phase="reveal"] .wh-ring__label,
.wh-preloader[data-phase="ready"] .wh-ring__label {
  color: var(--wh-green);
}

/* ------------------------------------------------------------ the counter */

.wh-count {
  font-size: clamp(34px, 11vw, 74px);
  font-weight: 200;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 0;
}

/* The digits settle into words once loading completes, so the final value
   can never be confused with a frame of the count. */
.wh-count [data-wh-count] {
  display: inline-block;
  transition: opacity 240ms var(--wh-ease);
}
.wh-count [data-wh-count].is-swapping { opacity: 0; }

.wh-preloader.is-settled .wh-count { letter-spacing: -0.02em; }

.wh-count__unit {
  display: block;
  margin-top: 10px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--wh-ink-dim);
}

/* ---------------------------------------------------- the revealed claim */

.wh-claim {
  max-width: 34ch;
  margin: clamp(24px, 5vh, 44px) auto 0;
  font-size: clamp(15px, 4vw, 19px);
  line-height: 1.5;
  color: var(--wh-ink);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 900ms var(--wh-ease), transform 900ms var(--wh-ease);
}

.wh-source {
  max-width: 40ch;
  margin: 14px auto 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--wh-ink-faint);
  opacity: 0;
  transition: opacity 900ms var(--wh-ease) 150ms;
}

.wh-preloader[data-phase="reveal"] .wh-claim,
.wh-preloader[data-phase="ready"] .wh-claim { opacity: 1; transform: none; }
.wh-preloader[data-phase="reveal"] .wh-source,
.wh-preloader[data-phase="ready"] .wh-source { opacity: 1; }

/* ---------------------------------------------------------- scroll prompt */

.wh-scroll {
  position: absolute;
  left: 50%;
  bottom: clamp(26px, 5vh, 52px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 10px 16px;
  background: none;
  border: 0;
  color: var(--wh-ink);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 700ms var(--wh-ease), visibility 0s linear 700ms;
}

.wh-preloader[data-phase="ready"] .wh-scroll {
  opacity: 1;
  visibility: visible;
  transition: opacity 700ms var(--wh-ease), visibility 0s;
}

.wh-scroll:focus-visible {
  outline: 1px solid var(--wh-green);
  outline-offset: 4px;
}

.wh-scroll__arrow {
  width: 1px;
  height: 26px;
  background: linear-gradient(to bottom, var(--wh-green), transparent);
  animation: wh-drift 2.1s var(--wh-ease) infinite;
}

@keyframes wh-drift {
  0%   { transform: scaleY(0); transform-origin: top; opacity: 0; }
  35%  { transform: scaleY(1); transform-origin: top; opacity: 1; }
  70%  { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
  100% { transform: scaleY(0); transform-origin: bottom; opacity: 0; }
}

/* ---------------------------------------------------------------- credit */

/* Sits bottom left rather than bottom right. On tall narrow phones the
   centred scroll prompt runs into a bottom right mark, and the mark is
   meant to be present from the first frame, not fighting for space. */
.wh-credit {
  position: absolute;
  left: clamp(14px, 4vw, 28px);
  bottom: clamp(14px, 3vh, 24px);
  margin: 0;
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--wh-ink);
  opacity: 0.4;
}

/* ------------------------------------------------------------ small print */

.wh-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------- reduced motion / a11y */

@media (prefers-reduced-motion: reduce) {
  .wh-preloader,
  .wh-claim,
  .wh-source,
  .wh-scroll,
  .wh-ring__label { transition-duration: 1ms !important; }
  .wh-claim { transform: none; }
  .wh-scroll__arrow { animation: none; opacity: 1; transform: scaleY(1); }
}

/* If JavaScript never runs, the pre-loader must not trap the reader. */
.wh-no-js .wh-preloader { display: none; }

/* white on blue (Stanley's call, 16 Nov 2026): the loader's words are white,
   and the label that was red is yellow. The ring itself stays red. */
:root {
  --wh-ink: #fff;
  --wh-ink-dim: rgba(255, 255, 255, .94);
  --wh-ink-faint: rgba(255, 255, 255, .86);
}
.wh-preloader[data-phase="reveal"] .wh-ring__label,
.wh-preloader[data-phase="ready"] .wh-ring__label { color: #fbe056; }
