/*
 * KNEAD. — splash choreography + gated hero intro.
 *
 * Pairs with assets/js/features/knead-splash.js. Two coupled jobs:
 *
 *   1. The splash's full five-phase choreography. knead-experience.js already
 *      builds the overlay (wordmark, Enter, Skip, scroll lock, audio on Enter);
 *      this file supplies the timeline that was missing — the wordmark clip
 *      reveal, the 120px determinate progress bar, the glowing blue top bar and
 *      dot, the three static corner labels, and the button pulse.
 *
 *   2. The hero intro. The heading used to animate at page-parse time, so on a
 *      first visit it played behind the splash and was over before the visitor
 *      clicked Enter. It now runs when the splash is dismissed, or immediately
 *      when no splash shows.
 *
 * SAFETY. Every rule here is scoped to a class the script adds (.is-splash,
 * .is-split, .is-hero-in) or to .knead-hero itself — no bare global class
 * selectors. With JavaScript off — or if this feature's script fails to load —
 * none of it applies: the loader keeps the plain, always-usable styling from
 * style.css and the hero is simply visible. No state in this file can leave text
 * permanently hidden, and nothing here moves anything in flow, so there is no
 * layout shift.
 *
 * DELIBERATE DEVIATIONS from the source composition, all for legibility and all
 * flagged for a design-owner confirm rather than assumed:
 *   · Skip is 10px/700 in #777777, restored from style.css (1.54:1 -> 4.34:1).
 *   · The corner labels are #777777 (1.32:1 -> 4.34:1) so their copy can be read.
 *   · Skip sits at bottom:62px, one line clear of the label it used to sit on.
 *   · The loader wordmark's full stop inherits white instead of style.css's blue,
 *     because the blue mark is now the injected .knead-splash__dot — two blue
 *     dots would be wrong. This one is a change to another file's element and is
 *     the deviation most worth a second opinion.
 *   · The eyebrow is set to 10px/0.5em tracking here, where the brand treatment
 *     in style.css is 11px/700/0.3em. Kept as-is for fidelity to the source
 *     composition, but it is a deviation and it is flagged, not settled.
 *
 * CONTRAST STILL OUTSTANDING, and deliberately not changed here because both are
 * inherited brand values used across the whole site, not regressions from this
 * module — changing either is a palette decision, and doing it in the splash
 * alone would just make the splash inconsistent with every other page:
 *   · .knead-eyebrow #1B4FBF on #0D0D0D = 2.70:1 (style.css:42, site-wide).
 *   · .knead-loader__tag #777777 = 4.34:1 (style.css:353).
 * The same 4.34:1 ceiling applies to Skip and the corner labels above: #777777 is
 * the brand gray and it lands just under the 4.5:1 that WCAG 1.4.3 wants at these
 * sizes. Closing that last gap needs a slightly lighter gray in the palette or a
 * larger type size — a design-owner call, so it is reported, not guessed at.
 *
 * Splash timeline (0ms = the moment the overlay is built, matching the React
 * source's component mount):
 *      0ms   the three corner labels are already there (they are static)
 *    100ms   wordmark clip reveal (0.9s) and progress bar fill (1.2s) start
 *    300ms   glowing blue top bar fades in (0.4s)
 *    400ms   eyebrow fades in (0.8s)
 *    800ms   Skip appears
 *    900ms   tagline fades up (0.6s)
 *   1000ms   the glowing blue dot fades in (0.3s)
 *   1400ms   the progress bar is replaced by "Enter the Drop", which fades in
 *            and then pulses from +1s
 *   on Enter / Skip / Escape: the overlay scales to 1.04 and fades out (0.6s,
 *            which is what knead-experience.js's 700ms node removal allows)
 *
 * Hero timeline (0ms = the overlay having finished leaving, or page load with no
 * splash. The script waits for the overlay to actually be gone rather than
 * starting on the click, so the sequence is not played underneath it):
 *  +0.05s   letters begin sliding up from below their clip, 70ms apart (0.75s)
 *  +0.10s   eyebrow fades in (0.6s)
 *  +0.55s   tagline fades up (0.6s)
 *  +0.70s   buttons fade up (0.6s)
 *  +1.20s   scroll indicator fades in (0.6s), then pulses; its line draws
 *           continuously
 */

/* ==========================================================================
   1 · SPLASH
   ========================================================================== */

/* ---------- the plain screen ---------- */
/* inc/intro.php prints the furniture below in the page. When the screen is
   plain (knead-experience.js fell back to it because this file's script never
   arrived, or the script's own catch did), the furniture has no place on it:
   unstyled, the corner labels would sit in the middle beside the wordmark. */
.knead-loader:not(.is-splash) :is(.knead-splash__topbar, .knead-splash__corner, .knead-splash__progress, .knead-splash__dot) { display: none; }

/* ---------- glowing blue top bar ---------- */
.knead-loader.is-splash .knead-splash__topbar {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: #1B4FBF;
	box-shadow: 0 0 12px #1B4FBF;
	animation: knead-splash-fade .4s ease .3s both;
}

/* ---------- eyebrow ---------- */
.knead-loader.is-splash .knead-eyebrow {
	margin: 0 0 20px;
	font-family: var(--wp--preset--font-family--body, Arial, Helvetica, sans-serif);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 5px;
	line-height: 1.4;
	text-transform: uppercase;
	color: #1B4FBF;
	animation: knead-splash-fade .8s ease .4s both;
}

/* ---------- wordmark ---------- */
.knead-loader.is-splash .knead-loader__word {
	margin: 0;
	font-family: var(--wp--preset--font-family--display, 'Arial Black', Arial, sans-serif);
	font-weight: 900;
	font-size: clamp(72px, 14vw, 160px);
	line-height: 1;
	/* Relative, not absolute. An absolute -6px against a 72–160px clamp is 2.2x
	   tighter proportionally at the small end than at the large end, which is why
	   the narrow-screen block used to have to patch it back to -.04em. -.04em is
	   -6.4px at the 160px design width — within half a pixel of the source — and
	   stays proportional all the way down, so one value now serves every width. */
	letter-spacing: -.04em;
	/* Keeps the glowing dot on the same line as the word on very narrow screens
	   instead of letting it orphan onto a line of its own. */
	white-space: nowrap;
	/* The full stop is part of the word here; the blue mark is the dot below. */
	color: #FFFFFF;
	animation: knead-splash-clip .9s cubic-bezier(.16, 1, .3, 1) .1s both;
}
.knead-loader.is-splash .knead-loader__word span { color: inherit; }

/* Glowing blue dot, injected after the wordmark. */
.knead-loader.is-splash .knead-splash__dot {
	display: inline-block;
	width: 14px;
	height: 14px;
	margin: 0 0 8px 6px;
	border-radius: 50%;
	vertical-align: middle;
	background: #1B4FBF;
	box-shadow: 0 0 16px #1B4FBF;
	animation: knead-splash-fade .3s ease 1s both;
}

/* ---------- tagline ---------- */
.knead-loader.is-splash .knead-loader__tag {
	margin: 16px 0 0;
	font-family: var(--wp--preset--font-family--body, Arial, Helvetica, sans-serif);
	font-size: 11px;
	font-style: italic;
	letter-spacing: 6px;
	line-height: 1.4;
	color: #777777;
	animation: knead-splash-fadein .6s ease .9s both;
}

/* ---------- the slot that holds the progress bar, then the button ---------- */
/* Fixed height so swapping one for the other cannot move the wordmark. */
.knead-loader.is-splash .knead-loader__actions {
	margin-top: 48px;
	min-height: 50px;
	gap: 0;
}

/* ---------- 120px determinate progress bar ---------- */
.knead-loader.is-splash .knead-splash__progress {
	display: block;
	position: relative;
	width: 120px;
	height: 1px;
	overflow: hidden;
	background: #1a1a1a;
}
.knead-loader.is-splash .knead-splash__progress i {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 0;
	background: #1B4FBF;
	box-shadow: 0 0 8px #1B4FBF;
	animation: knead-splash-bar 1.2s cubic-bezier(.4, 0, .2, 1) .1s both;
}
/* Once the button is up — and while the overlay is leaving — the bar is gone. */
.knead-loader.is-splash.is-phase-ready .knead-splash__progress,
.knead-loader.is-splash.is-exiting .knead-splash__progress { display: none; }

/* ---------- "Enter the Drop" ---------- */
.knead-loader.is-splash .knead-btn[data-enter] {
	display: none;
	background: transparent;
	border: 1px solid #1B4FBF;
	padding: 14px 48px;
	font-family: var(--wp--preset--font-family--body, Arial, Helvetica, sans-serif);
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 5px;
	text-transform: uppercase;
	color: #FFFFFF;
	transition: background .2s ease;
}
.knead-loader.is-splash.is-phase-ready .knead-btn[data-enter] {
	display: inline-block;
	position: relative;
	animation: knead-splash-fadein .5s ease both;
}
/* The pulse lives on a ring of its own so that hovering can stop it without
   restarting the button's own fade-in every time the pointer leaves. */
.knead-loader.is-splash.is-phase-ready .knead-btn[data-enter]::before {
	content: "";
	position: absolute;
	inset: -1px;
	pointer-events: none;
	animation: knead-splash-btnpulse 2s ease 1s infinite;
}
.knead-loader.is-splash .knead-btn[data-enter]:hover { background: #1B4FBF; }
.knead-loader.is-splash .knead-btn[data-enter]:hover::before { animation: none; }
.knead-loader.is-splash.is-exiting .knead-btn[data-enter] { display: none; }

/* ---------- Skip ---------- */
.knead-loader.is-splash .knead-loader__skip {
	display: none;
	position: absolute;
	right: 40px;
	/* The source design puts Skip at bottom:32px — exactly on top of the
	   "South Africa · 2026" corner label, which is painted last there and so
	   covers the button's whole hit area. The labels keep their design
	   coordinates; Skip is stacked one line above them instead, which is the
	   smallest change that leaves both legible and the button clickable. */
	bottom: 62px;
	z-index: 2;
	padding: 8px 0;
	font-family: var(--wp--preset--font-family--body, Arial, Helvetica, sans-serif);
	/* LEGIBILITY, NOT DECORATION. Skip is the only way out of a scroll-locked
	   full-screen dialog for its first 1400ms, so it has to be readable. The
	   earlier 9px/400 in #333333 measured 1.54:1 against the #0D0D0D backdrop —
	   style.css had it at 10px/700 in #777777 (4.34:1), so that was a regression
	   introduced here, not an inherited problem. These three values are restored
	   from style.css rather than invented; only the position and tracking below
	   remain this file's own. Note 4.34:1 is still short of the 4.5:1 that
	   WCAG 1.4.3 asks for at this size — closing that last gap needs either a
	   lighter gray in the palette or a larger size, which is a design-owner call,
	   so it is flagged rather than guessed at here. */
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 3px;
	text-transform: uppercase;
	color: #777777;
	transition: color .2s ease;
}
.knead-loader.is-splash.is-skip-visible .knead-loader__skip { display: block; }
/* style.css uses #fff for this hover; keeping it means the control brightens
   decisively rather than to the 5.48:1 of the old #888888. */
.knead-loader.is-splash .knead-loader__skip:hover,
.knead-loader.is-splash .knead-loader__skip:focus-visible { color: #FFFFFF; }
.knead-loader.is-splash.is-exiting .knead-loader__skip { display: none; }

/* ---------- static corner labels ---------- */
.knead-loader.is-splash .knead-splash__corner {
	position: absolute;
	margin: 0;
	font-family: var(--wp--preset--font-family--body, Arial, Helvetica, sans-serif);
	font-size: 9px;
	font-weight: 400;
	letter-spacing: 2px;
	line-height: 1.4;
	text-transform: uppercase;
	/* These carry real copy — a release name, a region, a year — so they are
	   content, not texture. At the previous #282828 they measured 1.32:1 against
	   #0D0D0D, i.e. present in the DOM but unreadable, which serves nobody. This
	   is the same #777777 this file already gives the tagline, so no new colour
	   enters the palette, and at 9px/2px tracking they still read as clearly
	   subordinate to the 11px tagline. Flagged for design confirm: if the
	   near-invisible tone was deliberate atmosphere, the copy belongs somewhere
	   readable instead. Same 4.34:1 caveat as Skip above. */
	color: #777777;
	/* Decoration in the pointer sense only: never intercept a click meant for
	   Skip, which sits directly above the bottom-right label. */
	pointer-events: none;
}
.knead-loader.is-splash .knead-splash__corner--bl { bottom: 32px; left: 40px; }
.knead-loader.is-splash .knead-splash__corner--br { right: 40px; bottom: 32px; }
.knead-loader.is-splash .knead-splash__corner--tr { top: 28px; right: 40px; letter-spacing: 3px; }

/* ---------- exit ---------- */
/* .6s, not .8s. knead-experience.js removes the overlay node on a hardcoded
   700ms timer that this file does not own, so an .8s curve was being cut off at
   ~87% — mid scale(1.04), with the documented duration never actually reached.
   .6s matches the transition style.css already used and finishes inside the
   700ms, so the animation the comment describes is the animation that plays. */
.knead-loader.is-splash.is-exiting {
	animation: knead-splash-exit .6s ease forwards;
}

/* ---------- narrow screens ---------- */
/* The design is a desktop composition. Pull the furniture in from the edges,
   and drop the bottom-right label, which has no room next to Skip on a phone. */
@media (max-width: 600px) {
	.knead-loader.is-splash .knead-splash__corner--bl { left: 20px; bottom: 20px; }
	.knead-loader.is-splash .knead-splash__corner--tr { top: 20px; right: 20px; }
	.knead-loader.is-splash .knead-splash__corner--br { display: none; }
	.knead-loader.is-splash .knead-loader__skip { right: 20px; bottom: 20px; }
	/* The wordmark's tracking used to be patched here; it is proportional in the
	   base rule now, so there is nothing left to correct. */
	.knead-loader.is-splash .knead-loader__actions { margin-top: 36px; }
}

/* ---------- splash keyframes (from the React source) ---------- */
@keyframes knead-splash-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@keyframes knead-splash-fadein {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}
@keyframes knead-splash-clip {
	from { clip-path: inset(0 100% 0 0); }
	to   { clip-path: inset(0 0 0 0); }
}
@keyframes knead-splash-bar {
	from { width: 0; }
	to   { width: 100%; }
}
@keyframes knead-splash-btnpulse {
	0%, 100% { box-shadow: 0 0 0 0 rgba(27, 79, 191, .5); }
	60%      { box-shadow: 0 0 0 10px rgba(27, 79, 191, 0); }
}
@keyframes knead-splash-exit {
	from { opacity: 1; transform: scale(1); }
	to   { opacity: 0; transform: scale(1.04); }
}
@keyframes knead-splash-pulse {
	0%, 100% { opacity: 1; }
	50%      { opacity: .6; }
}

/* ==========================================================================
   2 · HERO INTRO (gated on the splash)
   ========================================================================== */

/* The parse-time fade-up in style.css is what made the animation unwatchable:
   it ran while the splash still covered the page. Once the script has split the
   heading into letters it is replaced by the gated per-letter reveal. Until
   then — and for ever, if the script never runs — the fade-up is left alone. */
/* Everything in this section is scoped to .knead-hero / .is-split rather than
   left as a bare global class. The elements are only ever created by this
   feature's script, but the class names are generic enough that a marketer or
   another module could add one in the editor, and an unscoped rule would then
   style it — an unscoped .knead-hero__scroll, for instance, would become an
   absolutely positioned white bar. Scoping costs nothing and removes that. */
.knead-hero__title.is-split {
	display: flex;
	flex-wrap: wrap;
	/* Items size to their own content instead of stretching, so the descender
	   padding below is real clip-window height and not absorbed by the flex line. */
	align-items: flex-start;
	/* Was overflow:hidden. Each letter clips itself, so this added nothing to the
	   reveal — but it did re-clip the descender room opened up below, defeating
	   the whole fix. With line-height .85 a descender is meant to paint outside
	   the line box; this restores that. */
	overflow: visible;
	animation: none;
}
.knead-hero__title.is-split .knead-hero__letter {
	display: inline-block;
	overflow: hidden;
	/* DESCENDER ROOM. The clip window is the line box, and at line-height .85 only
	   ~0.03em of it sits below the baseline, while descending ink reaches much
	   further. Measured in-browser at the hero's own computed font (Arial Black 900,
	   96px): 2.79px of window below the baseline against ink descents of 0.08em (Q),
	   0.20em (comma / semicolon), 0.21em (parenthesis, Ç) and 0.22em (Ą) — i.e.
	   7.7px to 21px at 96px, so all of those lost their tail. At 75px the same
	   measurement reads 1.88px of window against 6.04px (Q) and 16.37px (Ą).
	   Note theme.json puts text-transform:uppercase on
	   every heading, so the lowercase descenders (g j p q y) an earlier version of
	   this comment named can never actually render here; the real casualties are
	   Q, punctuation and accented capitals. Plain "KNEAD." cleared the window by
	   2.79px, which is why nothing looked wrong: the heading is editable
	   (templateLock:"contentOnly"), so this was one retype away — "ALWAYS IN
	   KNEAD," or any accented name — from visibly sliced glyphs.
	   The padding opens the window; the negative margin keeps the heading's own
	   box exactly the height it was, so nothing below the hero moves. The
	   knead-hero-letter keyframe start moved from 110% to 130% to match — the
	   letter has a taller window to clear now, and 110% would have left the top of
	   it peeking above the clip edge before the animation ran. */
	padding-bottom: .22em;
	margin-bottom: -.22em;
}
.knead-hero__title.is-split .knead-hero__letter > span { display: inline-block; }
/* WORD GROUPING. Splitting into letters turned every letter into a flex item,
   which let a heading wrap mid-word — invisible on today's 6-character wordmark,
   certain the moment someone types two words (the theme's own patterns/story.php
   is a two-line heading). Letters now sit inside a nowrap word box, so the only
   break opportunities are between words again. */
.knead-hero__title.is-split .knead-hero__word {
	display: inline-flex;
	white-space: nowrap;
}
/* The inter-word gap travels on the preceding word rather than being its own
   flex item, so a wrapped line can never start with a stray indent. */
.knead-hero__title.is-split .knead-hero__word--space { margin-right: .28em; }
/* Retained for a browser holding a cached copy of the previous script, which
   emitted standalone space elements; without it those words would run together. */
.knead-hero__title.is-split .knead-hero__space {
	display: inline-block;
	width: .28em;
}
/* Preserves a <br> the editor may have put in the heading. */
.knead-hero__title.is-split .knead-hero__break {
	flex: 0 0 100%;
	height: 0;
}

/* The gate. .is-hero-in is added when the splash is dismissed, or at once when
   no splash shows. Everything below is an animation with a backwards fill, so a
   gate that never opens leaves the hero exactly as the page delivered it. */
.knead-hero.is-hero-in .knead-hero__letter > span {
	animation: knead-hero-letter .75s cubic-bezier(.16, 1, .3, 1) both;
}
.knead-hero.is-hero-in .knead-hero__fade {
	animation: knead-hero-fade .6s ease both;
}
.knead-hero.is-hero-in .knead-hero__rise {
	animation: knead-hero-rise .6s ease both;
}

/* ---------- scroll indicator ---------- */
/* Injected by the script, absolutely positioned: no layout shift, and nothing
   for a JS-off visitor to miss. */
.knead-hero .knead-hero__scroll {
	position: absolute;
	left: 50%;
	bottom: 40px;
	z-index: 2;
	width: 1px;
	height: 40px;
	margin-left: -.5px;
	opacity: .6;
	pointer-events: none;
}
.knead-hero .knead-hero__scroll > i {
	display: block;
	width: 1px;
	height: 100%;
	background: #FFFFFF;
}
.knead-hero.is-hero-in .knead-hero__scroll {
	animation: knead-hero-scrollin .6s ease 1.2s both, knead-splash-pulse 2s ease 1.8s infinite;
}
.knead-hero.is-hero-in .knead-hero__scroll > i {
	animation: knead-hero-scrollline 1.8s ease 1.2s infinite;
}

/* ---------- hero keyframes (from the React source) ---------- */
/* 130%, not 110%: the percentage resolves against the letter's own height, and
   the clip window is now .22em taller than that, so 110% no longer hid it. */
@keyframes knead-hero-letter {
	from { transform: translateY(130%); }
	to   { transform: translateY(0); }
}
@keyframes knead-hero-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@keyframes knead-hero-rise {
	from { opacity: 0; transform: translateY(12px); }
	to   { opacity: 1; transform: none; }
}
@keyframes knead-hero-scrollin {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@keyframes knead-hero-scrollline {
	0%   { transform: scaleY(0); transform-origin: top;    opacity: 1; }
	50%  { transform: scaleY(1); transform-origin: top;    opacity: 1; }
	51%  { transform: scaleY(1); transform-origin: bottom; opacity: 1; }
	100% { transform: scaleY(0); transform-origin: bottom; opacity: .3; }
}

/* ==========================================================================
   3 · REDUCED MOTION
   ========================================================================== */
/* The choreography is switched off; the content is not. style.css already
   collapses every animation to 0.001ms, which is not enough on its own here:
   these animations are delayed, and a collapsed animation would hold its
   backwards fill — i.e. hidden text — for the length of the delay. */
@media (prefers-reduced-motion: reduce) {
	.knead-loader.is-splash .knead-splash__topbar,
	.knead-loader.is-splash .knead-eyebrow,
	.knead-loader.is-splash .knead-loader__word,
	.knead-loader.is-splash .knead-splash__dot,
	.knead-loader.is-splash .knead-loader__tag,
	.knead-loader.is-splash.is-phase-ready .knead-btn[data-enter],
	.knead-loader.is-splash.is-phase-ready .knead-btn[data-enter]::before,
	.knead-hero.is-hero-in .knead-hero__letter > span,
	.knead-hero.is-hero-in .knead-hero__fade,
	.knead-hero.is-hero-in .knead-hero__rise {
		animation: none !important;
		opacity: 1 !important;
		transform: none !important;
		clip-path: none !important;
	}
	.knead-loader.is-splash .knead-splash__progress i {
		animation: none !important;
		width: 100%;
	}
	.knead-hero.is-hero-in .knead-hero__scroll {
		animation: none !important;
		opacity: .6;
	}
	.knead-hero.is-hero-in .knead-hero__scroll > i {
		animation: none !important;
		transform: none !important;
	}
}
