/*
 * nutriscrolls/home-intro (HomeIntroBlock). Dark stage in both themes: colours come from the neutral, primary and teal
 * primitives (the Dark mode values of the semantic presets), never from the semantic presets themselves.
 *
 * Default: five stacked sections (no script, prefers-reduced-motion: reduce). html.ns-intro-motion (inline script in
 * the block markup) switches to one stage of viewport height with the steps on top of each other; blocks/view/home-intro.js
 * pins it and scrubs the steps with GSAP ScrollTrigger (wrapper class is-pinned once it runs).
 */
.ns-home-intro {
	--i-bg: var(--wp--preset--color--neutral-950);
	--i-surface: var(--wp--preset--color--neutral-900);
	--i-line: var(--wp--preset--color--neutral-700);
	--i-line-strong: var(--wp--preset--color--neutral-500);
	--i-ink: var(--wp--preset--color--neutral-50);
	--i-muted: var(--wp--preset--color--neutral-300);
	--i-accent: var(--wp--preset--color--teal-300);
	--i-fill: var(--wp--preset--color--primary-400);
	--i-fill-high: var(--wp--preset--color--teal-400);
	--i-track: var(--wp--preset--color--neutral-800);
	--i-link: var(--wp--preset--color--primary-300);
	--i-action: var(--wp--preset--color--primary-400);
	--i-on-action: var(--wp--preset--color--neutral-950);
	--i-gutter: clamp(20px, 4.5vw, 64px);
	position: relative;
	color-scheme: dark;
	background: var(--i-bg);
	color: var(--i-ink);
	overflow: clip;
	margin-block: 0;
}

.ns-home-intro a {
	color: var(--i-link);
}

.ns-home-intro a:focus-visible {
	outline: 2px solid var(--i-link);
	outline-offset: 3px;
}

.ns-intro__pin {
	width: 100%;
	background: var(--i-bg);
}

.ns-intro__stage {
	position: relative;
	width: min(var(--wp--style--global--wide-size, 1312px), 100% - 2 * var(--i-gutter));
	margin-inline: auto;
}

.ns-intro__skip {
	position: absolute;
	z-index: 3;
	top: 20px;
	right: 0;
	font-size: var(--wp--preset--font-size--label-small);
	font-weight: 600;
	line-height: 24px;
	text-decoration: none;
	color: var(--i-muted) !important;
}

.ns-intro__skip:hover {
	color: var(--i-ink) !important;
	text-decoration: underline;
}

/* Steps */
.ns-intro__scene {
	display: grid;
	grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
	align-items: center;
	gap: clamp(32px, 5vw, 80px);
	padding-block: clamp(64px, 9vw, 112px);
	border-top: 1px solid var(--i-line);
}

.ns-intro__scene--statement {
	position: relative;
	grid-template-columns: minmax(0, 1fr);
	min-height: min(860px, 88svh);
	border-top: 0;
}

.ns-intro__copy {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 20px;
	min-width: 0;
}

.ns-intro__copy > * {
	margin: 0;
}

.ns-intro__statement {
	font-size: clamp(52px, min(7.8vw, 13.5svh), 112px);
	font-weight: 700;
	line-height: 0.94;
	letter-spacing: -0.04em;
	max-width: 9.5em;
}

.ns-intro__line {
	display: block;
	overflow: hidden;
	padding-bottom: 0.1em;
	margin-bottom: -0.1em;
}

.ns-intro__line > span {
	display: block;
}

.ns-intro__h1 {
	margin-top: 16px !important;
	color: var(--i-ink);
	font-size: clamp(18px, 1.5vw, 21px);
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: 0;
}

.ns-intro__lead,
.ns-intro__body {
	max-width: 34rem;
	color: var(--i-muted);
	font-size: clamp(16px, 1.35vw, 19px);
	line-height: 1.6;
}

.ns-intro__cue {
	margin-top: 8px !important;
	color: var(--i-ink) !important;
	font-size: var(--wp--preset--font-size--label-small);
	font-weight: 600;
	text-decoration: none;
}

.ns-intro__cue:hover {
	text-decoration: underline;
}

.ns-intro__eyebrow {
	color: var(--i-accent);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.09em;
	line-height: 16px;
	text-transform: uppercase;
}

.ns-intro__title {
	color: var(--i-ink);
	font-size: clamp(32px, min(3.9vw, 7svh), 56px);
	font-weight: 700;
	line-height: 1.07;
	letter-spacing: -0.035em;
	max-width: 11em;
}

.ns-intro__visual {
	min-width: 0;
}

.ns-intro__visual-caption {
	margin: 0 0 24px;
	color: var(--i-muted);
	font-size: 15px;
	font-weight: 600;
	line-height: 24px;
}

/* Step 0: floating photos */
.ns-intro__photos {
	position: absolute;
	inset: 0 0 0 auto;
	width: 50%;
	pointer-events: none;
}

.ns-intro__photo {
	position: absolute;
	left: var(--x);
	top: var(--y);
	width: min(calc(var(--s) * 1px), calc(var(--s) / 14.4 * 1vw));
	aspect-ratio: 1;
}

.ns-intro__photo-inner,
.ns-intro__food-photo {
	display: block;
	width: 100%;
	height: 100%;
	overflow: hidden;
	border-radius: 50%;
	background: #fff;
}

.ns-intro__photo img,
.ns-intro__food-photo img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ns-intro__photo--1 { --x: 38%; --y: 13%; --s: 230; }
.ns-intro__photo--2 { --x: 75%; --y: 42%; --s: 120; }
.ns-intro__photo--3 { --x: 31%; --y: 48%; --s: 150; }
.ns-intro__photo--4 { --x: 62%; --y: 62%; --s: 180; }
.ns-intro__photo--5 { --x: 16%; --y: 21%; --s: 96; }
.ns-intro__photo--6 { --x: 55%; --y: 84%; --s: 90; }
.ns-intro__photo--7 { --x: 79%; --y: 15%; --s: 100; }
.ns-intro__photo--8 { --x: 12%; --y: 70%; --s: 120; }
.ns-intro__photo--9 { --x: 85%; --y: 77%; --s: 80; }
.ns-intro__photo--10 { --x: 36%; --y: 79%; --s: 70; }
.ns-intro__photo--11 { --x: 58%; --y: 4%; --s: 56; }
.ns-intro__photo--12 { --x: 2%; --y: 46%; --s: 64; }
.ns-intro__photo--13 { --x: 88%; --y: 58%; --s: 56; }
.ns-intro__photo:nth-child(n + 14) { display: none; }

/* Step 1: one food */
.ns-intro__scene--one-food .ns-intro__visual {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	gap: clamp(24px, 4vw, 56px);
}

.ns-intro__food {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
	margin: 0;
}

.ns-intro__food-photo {
	width: min(100%, 420px, 52svh);
	height: auto;
	aspect-ratio: 1;
}

.ns-intro__food-caption {
	color: var(--i-muted);
	font-size: 15px;
	font-weight: 600;
	line-height: 24px;
	text-align: center;
}

.ns-intro__food-caption a {
	color: var(--i-ink) !important;
}

.ns-intro__callouts,
.ns-intro__bars,
.ns-intro__ranks,
.ns-intro__sources {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ns-intro__callouts {
	display: grid;
	gap: clamp(12px, 2.4svh, 24px);
}

.ns-intro__callout {
	display: grid;
	grid-template-columns: 10px auto;
	column-gap: 14px;
}

.ns-intro__callout::before {
	content: "";
	grid-row: 1 / 3;
	width: 10px;
	height: 10px;
	margin-top: 13px;
	border-radius: 50%;
	background: var(--i-accent);
}

.ns-intro__callout-value {
	font-size: clamp(24px, 2.2vw, 32px);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

.ns-intro__callout-label {
	color: var(--i-muted);
	font-size: 15px;
	font-weight: 500;
	line-height: 22px;
}

/* Step 2: Daily Value bars */
.ns-intro__bars {
	display: grid;
	gap: clamp(16px, 3svh, 32px);
}

.ns-intro__bar {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 10px 16px;
	font-size: clamp(16px, 1.4vw, 20px);
	font-weight: 600;
	line-height: 1.4;
}

.ns-intro__bar-value {
	color: var(--i-muted);
}

.ns-intro__bar-track {
	grid-column: 1 / -1;
	display: block;
	height: 12px;
	border-radius: 999px;
	background: var(--i-track);
	overflow: hidden;
}

.ns-intro__bar-fill {
	display: block;
	width: var(--ns-w);
	height: 100%;
	border-radius: 999px;
	background: var(--i-fill);
	transform-origin: left center;
}

.ns-intro__bar.is-first .ns-intro__bar-fill {
	background: var(--i-fill-high);
}

/* Step 3: #1 foods */
.ns-intro__ranks {
	display: grid;
	gap: clamp(8px, 1.6svh, 16px);
}

.ns-intro__rank-link {
	display: grid;
	grid-template-columns: 56px minmax(0, 1fr) auto;
	align-items: center;
	gap: 20px;
	padding: 12px 20px 12px 14px;
	border: 1px solid var(--i-line);
	border-radius: 8px;
	background: var(--i-surface);
	color: var(--i-ink) !important;
	text-decoration: none;
	transition: border-color 0.15s ease;
}

.ns-intro__rank-link:hover {
	border-color: var(--i-line-strong);
}

.ns-intro__rank.is-featured .ns-intro__rank-link {
	border: 2px solid var(--i-accent);
	padding: 11px 19px 11px 13px;
}

.ns-intro__rank-photo {
	display: block;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #fff;
	object-fit: cover;
}

.ns-intro__rank-text,
.ns-intro__rank-amount {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ns-intro__rank-amount {
	align-items: flex-end;
	text-align: right;
}

.ns-intro__rank-label {
	color: var(--i-muted);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 16px;
	text-transform: uppercase;
}

.ns-intro__rank.is-featured .ns-intro__rank-label {
	color: var(--i-accent);
}

.ns-intro__rank-food {
	font-size: clamp(17px, 1.4vw, 20px);
	font-weight: 600;
	line-height: 1.4;
}

.ns-intro__rank-value {
	font-size: clamp(19px, 1.7vw, 24px);
	font-weight: 600;
	line-height: 1.2;
}

.ns-intro__rank-serving {
	color: var(--i-muted);
	font-size: 13px;
	line-height: 18px;
}

/* Step 4: counts, sources, ways in */
.ns-intro__stats {
	display: grid;
	gap: clamp(16px, 3svh, 32px);
	margin: 0;
}

.ns-intro__stat {
	display: flex;
	flex-direction: column-reverse;
	gap: 4px;
}

.ns-intro__stat-value {
	margin: 0;
	font-size: clamp(48px, min(6.1vw, 10svh), 88px);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.035em;
}

.ns-intro__stat-label {
	color: var(--i-muted);
	font-size: 17px;
	font-weight: 500;
	line-height: 24px;
}

.ns-intro__sources {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: clamp(24px, 4svh, 40px);
}

.ns-intro__source {
	padding: 7px 16px;
	border: 1px solid var(--i-line-strong);
	border-radius: 999px;
	font-size: 15px;
	font-weight: 600;
	line-height: 24px;
}

.ns-intro__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 32px;
	margin-top: 16px;
}

.ns-intro__button {
	display: inline-flex;
	align-items: center;
	min-height: 52px;
	padding: 0 28px;
	border-radius: var(--wp--custom--radius--md, 4px);
	background: var(--i-action);
	color: var(--i-on-action) !important;
	font-size: 17px;
	font-weight: 600;
	text-decoration: none;
}

.ns-intro__button:hover {
	background: var(--wp--preset--color--primary-300);
}

.ns-intro__link {
	font-size: 17px;
	font-weight: 600;
	text-decoration: none;
}

.ns-intro__link:hover {
	text-decoration: underline;
}

.ns-intro__progress {
	display: none;
}

/* Pinned stage (html.ns-intro-motion, set before first paint unless prefers-reduced-motion) */
.ns-intro-motion .ns-intro__stage {
	height: calc(100svh - var(--ns-intro-top, 72px));
	min-height: 520px;
}

.ns-intro-motion .ns-intro__scene {
	position: absolute;
	inset: 0;
	min-height: 0;
	padding-block: 64px 96px;
	border-top: 0;
}

.ns-intro-motion .ns-intro__scene:not([data-scene="0"]) {
	visibility: hidden;
}

.ns-intro-motion .ns-intro__progress {
	position: absolute;
	z-index: 2;
	left: 0;
	bottom: 32px;
	display: flex;
	gap: 16px;
}

.ns-intro__progress-step {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 104px;
}

.ns-intro__progress-label {
	color: var(--i-muted);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 16px;
}

.ns-intro__progress-track {
	display: block;
	height: 3px;
	border-radius: 2px;
	background: var(--i-line);
	overflow: hidden;
}

.ns-intro__progress-fill {
	display: block;
	height: 100%;
	background: var(--i-accent);
	transform: scaleX(0);
	transform-origin: left center;
}

.ns-intro__end {
	display: block;
	height: 0;
}

/* Phone and small tablet */
@media (max-width: 781px) {
	.ns-intro__scene {
		grid-template-columns: minmax(0, 1fr);
		align-content: center;
		gap: 24px;
		padding-block: 56px;
	}

	.ns-intro__scene--statement {
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		min-height: min(800px, 92svh);
		padding-top: 64px;
	}

	/* The photos take the room above the copy; sizes follow that box (container query units). */
	.ns-intro__photos {
		position: relative;
		inset: auto;
		flex: none;
		width: 100%;
		height: min(46svh, 360px);
		margin-bottom: 8px;
		container-type: size;
	}

	/* Pinned stage: the scene has a fixed height, so the photos take whatever is left above the copy. */
	.ns-intro-motion .ns-intro__photos {
		flex: 1 1 auto;
		height: auto;
		min-height: 150px;
		max-height: 380px;
	}

	.ns-intro__photo {
		width: min(calc(var(--s) / 3.9 * 1cqw), calc(var(--s) / 3.6 * 1cqh));
	}

	.ns-intro__photo--1 { --x: 51%; --y: 4%; --s: 150; }
	.ns-intro__photo--2 { --x: 77%; --y: 50%; --s: 80; }
	.ns-intro__photo--3 { --x: 37%; --y: 44%; --s: 100; }
	.ns-intro__photo--4 { --x: 62%; --y: 68%; --s: 110; }
	.ns-intro__photo--5 { --x: 27%; --y: 18%; --s: 64; }
	.ns-intro__photo--6 { --x: 86%; --y: 85%; --s: 44; }
	.ns-intro__photo--7 { --x: 82%; --y: 18%; --s: 60; }
	.ns-intro__photo--8 { --x: 14%; --y: 58%; --s: 76; }
	.ns-intro__photo--9 { --x: 4%; --y: 33%; --s: 50; }
	.ns-intro__photo:nth-child(n + 10) { display: none; }

	.ns-intro__statement {
		font-size: clamp(44px, min(15vw, 8.5svh), 72px);
	}

	.ns-intro__h1 {
		margin-top: 4px !important;
	}

	.ns-intro__copy {
		gap: 12px;
	}

	.ns-intro__scene--one-food .ns-intro__visual {
		display: contents;
	}

	.ns-intro__scene--one-food .ns-intro__food {
		order: -1;
	}

	.ns-intro__food-photo {
		width: min(46vw, 24svh);
	}

	.ns-intro__food-caption {
		font-size: 13px;
		line-height: 18px;
	}

	.ns-intro__callouts {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px 16px;
	}

	.ns-intro__callout {
		grid-template-columns: minmax(0, 1fr);
	}

	.ns-intro__callout::before {
		display: none;
	}

	.ns-intro__callout-label {
		font-size: 13px;
		line-height: 18px;
	}

	.ns-intro__bars {
		gap: 14px;
	}

	.ns-intro__bar {
		font-size: 15px;
		gap: 6px 12px;
	}

	.ns-intro__bar-track {
		height: 10px;
	}

	.ns-intro__visual-caption {
		margin-bottom: 14px;
		font-size: 13px;
		line-height: 18px;
	}

	.ns-intro__rank-link {
		grid-template-columns: 40px minmax(0, 1fr) auto;
		gap: 12px;
		padding: 10px 12px;
	}

	.ns-intro__rank.is-featured .ns-intro__rank-link {
		padding: 9px 11px;
	}

	.ns-intro__rank-photo {
		width: 40px;
		height: 40px;
	}

	.ns-intro__rank-label {
		font-size: 11px;
		line-height: 14px;
	}

	.ns-intro__rank-serving {
		display: none;
	}

	.ns-intro__stats {
		grid-template-columns: repeat(3, auto);
		justify-content: start;
		gap: 12px 24px;
	}

	.ns-intro__stat-value {
		font-size: clamp(24px, 7.4vw, 34px);
		letter-spacing: -0.03em;
	}

	.ns-intro__stat-label {
		font-size: 13px;
		line-height: 18px;
	}

	.ns-intro__sources {
		gap: 8px;
		margin-top: 20px;
	}

	.ns-intro__source {
		padding: 4px 12px;
		font-size: 13px;
		line-height: 20px;
	}

	.ns-intro__actions {
		width: 100%;
	}

	.ns-intro__button {
		justify-content: center;
		width: 100%;
	}

	.ns-intro-motion .ns-intro__scene {
		padding-block: 56px 64px;
	}

	.ns-intro-motion .ns-intro__scene--statement {
		display: flex;
		padding-top: 64px;
	}

	.ns-intro-motion .ns-intro__progress {
		left: 0;
		right: 0;
		bottom: 24px;
		gap: 8px;
	}

	.ns-intro__progress-step {
		flex: 1;
		width: auto;
	}

	.ns-intro__progress-label {
		display: none;
	}
}

/* Short phones: fewer rows so each step fits the stage */
@media (max-width: 781px) and (max-height: 740px) {
	.ns-intro-motion .ns-intro__rank:nth-child(n + 5),
	.ns-intro-motion .ns-intro__bar:nth-child(n + 5),
	.ns-intro-motion .ns-intro__callout:nth-child(n + 5) {
		display: none;
	}

	.ns-intro-motion .ns-intro__body,
	.ns-intro-motion .ns-intro__lead {
		font-size: 15px;
		line-height: 1.5;
	}

	.ns-intro-motion .ns-intro__cue,
	.ns-intro-motion .ns-intro__scene--one-food .ns-intro__body,
	.ns-intro-motion .ns-intro__food-caption {
		display: none;
	}

	.ns-intro-motion .ns-intro__food-photo {
		width: min(40vw, 20svh);
	}
}
