/*
 * Nullifier Collection Scenes — the page.
 *
 * Each scene is three layers: a background, the garment, and the words.
 * Positions are percentages of the scene, so the same numbers work at any
 * width. The same markup and this same stylesheet draw the previews in the
 * admin, so what the preview shows is what the page shows.
 *
 * DESKTOP OR PHONE
 *
 * Decided by the width of the scene itself (a container query), not the
 * window. That is what lets the admin show a phone preview next to a desktop
 * one on the same screen. .is-d and .is-m force one or the other.
 */

.nfsc {
	--nfsc-white: var(--nf-white, #fff);
	--nfsc-muted: var(--nf-muted, #9a9a9a);
	--nfsc-line: var(--nf-line, #2a2a2a);
	--nfsc-blue: var(--nf-blue, #0000fe);
	--nfsc-ease: var(--nf-ease, cubic-bezier(0.2, 0.7, 0.2, 1));
	color: var(--nfsc-white);
	font-family: "Outfit", system-ui, sans-serif;
}

/* Full width, whatever column the page puts it in. */
/*
 * Full width. The page template pads <main> in from the edges; on this page
 * nothing else lives in <main>, so the padding goes and the scenes run edge
 * to edge — no 100vw, which on Windows counts the scrollbar and overflows.
 * The margins answer WordPress's constrained layout, which centres every
 * child with margin: auto !important.
 */
html body.nfsc-on .wp-site-blocks > main {
	padding-left: 0 !important;
	padding-right: 0 !important;
}

.nfsc.nfsc--page {
	width: auto;
	max-width: none !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
	margin-top: 0;
}

body.nfsc-on {
	overflow-x: clip;
}

/*
 * The scenes bring their own heading, so the page template's automatic
 * title steps aside, and so does the padding it sat in. Inline spacing
 * from the block template needs !important to answer.
 */
main:has(.nfsc--page) .wp-block-post-title {
	display: none;
}

main:has(.nfsc--page) > .wp-block-group {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

main:has(.nfsc--page) .entry-content {
	margin-top: 0 !important;
}

/*
 * Flush under the site header: no gap between it and the first scene.
 * The theme gives every page but the home page a top margin on <main>
 * (body:not(.home) .wp-site-blocks > main, !important), so this has to
 * outrank that selector, not just match it.
 */
html body.nfsc-on .wp-site-blocks > main,
main:has(.nfsc--page) {
	margin-top: 0 !important;
	padding-top: 0 !important;
}

/* --- A scene ------------------------------------------------------------- */

.nfsc__scenes {
	display: grid;
	gap: clamp(1rem, 2.5vw, 2rem);
}

.nfsc-scene {
	container-type: inline-size;
	position: relative;
}

.nfsc-scene__stage {
	/* Desktop numbers by default. */
	--x: var(--dx, 70%);
	--y: var(--dy, 50%);
	--s: var(--ds, 80%);
	--ar: 16 / 9;
	--arn: 1.7778;
	--focus: 50%;
	--focusn: 0.5;
	position: relative;
	aspect-ratio: var(--ar);
	overflow: hidden;
	background: #050505;
	isolation: isolate;
}

/*
 * Never taller than the screen under the header, so the collection's name
 * and button are in view the moment a scene is — including the first one,
 * before any scrolling. On a wide, short screen the picture is cropped a
 * little top and bottom instead. The width is stated so the height limit
 * crops the picture rather than narrowing the scene.
 */
.nfsc-scene:not(.is-d):not(.is-m) .nfsc-scene__stage {
	width: 100%;
	max-height: calc(100svh - var(--nf-header-h, 72px) - var(--wp-admin--admin-bar--height, 0px) - 4px);
	min-height: 22rem;
}

.nfsc-scene__bg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: var(--focus) 50%;
	display: block;
	z-index: 0;
}

/* Darken where the words sit, so white type always reads. */
.nfsc-scene__stage::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 3;
	pointer-events: none;
	background:
		linear-gradient(to bottom, rgba(5, 5, 5, 0.6) 0%, rgba(5, 5, 5, 0.2) 18%, transparent 34%),
		linear-gradient(to top, rgba(5, 5, 5, 0.78) 0%, rgba(5, 5, 5, 0.35) 28%, transparent 52%),
		linear-gradient(to right, rgba(5, 5, 5, 0.45) 0%, transparent 42%);
}

/* --- Atmosphere ---------------------------------------------------------- */

.nfsc-scene__fx {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
}

/*
 * Mist: two soft banks drifting in opposite directions at different speeds,
 * so it never visibly loops. Behind the garment, never over it.
 */
.nfsc-fx--mist::before,
.nfsc-fx--mist::after {
	content: "";
	position: absolute;
	left: -25%;
	right: -25%;
	bottom: -8%;
	height: 60%;
	background:
		radial-gradient(ellipse 38% 55% at 28% 72%, rgba(170, 186, 235, 0.26), transparent 70%),
		radial-gradient(ellipse 30% 45% at 64% 80%, rgba(150, 168, 225, 0.2), transparent 70%),
		radial-gradient(ellipse 26% 40% at 88% 66%, rgba(185, 195, 235, 0.14), transparent 70%);
	filter: blur(18px);
	animation: nfsc-drift 42s ease-in-out infinite alternate;
	animation-play-state: paused;
}

.nfsc-fx--mist::after {
	bottom: 4%;
	height: 45%;
	opacity: 0.7;
	animation-duration: 31s;
	animation-direction: alternate-reverse;
}

@keyframes nfsc-drift {
	from {
		transform: translate3d(-6%, 0, 0);
	}
	to {
		transform: translate3d(6%, -2%, 0);
	}
}

/*
 * Radio glow: warms up once as the scene arrives, then hums. Its position is
 * a spot on the background picture, so on a phone — where the picture is
 * cropped at the sides — it is moved to where that spot now is.
 */
.nfsc-fx--dial .nfsc-scene__glow {
	--w: min(1, calc(var(--arn) / var(--iar, 1.7778)));
	position: absolute;
	left: calc((var(--gx, 25) / 100 - (1 - var(--w)) * var(--focusn)) / var(--w) * 100%);
	top: calc(var(--gy, 50) * 1%);
	width: calc(24% / var(--w));
	aspect-ratio: 1;
	transform: translate(-50%, -50%);
	background: radial-gradient(circle, rgba(255, 176, 80, 0.5) 0%, rgba(255, 140, 40, 0.16) 34%, transparent 68%);
	mix-blend-mode: screen;
	opacity: 0;
	transition: opacity 1.8s var(--nfsc-ease);
}

.nfsc-scene.is-in .nfsc-fx--dial .nfsc-scene__glow {
	opacity: 1;
	animation: nfsc-hum 5s ease-in-out 1.8s infinite alternate;
}

@keyframes nfsc-hum {
	from {
		opacity: 1;
	}
	to {
		opacity: 0.7;
	}
}

.nfsc-scene.is-in .nfsc-fx--mist::before,
.nfsc-scene.is-in .nfsc-fx--mist::after {
	animation-play-state: running;
}

/* --- The garment --------------------------------------------------------- */

.nfsc-scene__piece {
	position: absolute;
	left: var(--x);
	top: var(--y);
	height: var(--s);
	z-index: 2;
	transform: translate(-50%, -50%);
}

/*
 * Swaying (1.2.0). scenes.js sets --nfsc-sway (an angle) and --nfsc-pivot
 * (how far above the garment it hangs from: the top of the scene when it is
 * on a wire, its own shoulders when it is not), and eases it back to rest.
 */
.nfsc-scene__piece[data-sway] {
	transform: translate(-50%, -50%) rotate(var(--nfsc-sway, 0deg));
	transform-origin: 50% var(--nfsc-pivot, 0px);
	will-change: transform;
}

.nfsc-scene__piece img {
	display: block;
	height: 100%;
	width: auto;
	max-width: none;
	filter: drop-shadow(0 calc(var(--sh, 50) * 0.28cqi) calc(var(--sh, 50) * 0.5cqi) rgba(0, 0, 0, calc(var(--sh, 50) / 100 * 0.9)));
}

/* A fine wire from the top of the garment to the top of the scene. */
.nfsc-scene__wire {
	position: absolute;
	left: 50%;
	bottom: calc(100% - 1px);
	width: 1px;
	height: 300cqi;
	background: linear-gradient(to top, rgba(210, 215, 225, 0.55), rgba(210, 215, 225, 0.12));
}

/* --- Words on the wall --------------------------------------------------- */

.nfsc .nfsc-scene__note {
	position: absolute;
	left: calc(var(--nx, 5) * 1%);
	top: calc(var(--ny, 20) * 1%);
	z-index: 2;
	margin: 0;
	font-size: clamp(0.5rem, 0.95cqi, 0.72rem);
	line-height: 2.1;
	letter-spacing: 0.38em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.5);
}

.nfsc .nfsc-scene__note::after {
	content: "";
	display: block;
	width: 1.1em;
	height: 1px;
	margin-top: 0.6em;
	background: currentColor;
}

/* --- The label and heading over the top of the picture ----------------- */

.nfsc-scene__top {
	position: absolute;
	left: 3.6cqi;
	top: 3.4cqi;
	z-index: 4;
	max-width: 52%;
	pointer-events: none;
}

.nfsc .nfsc-scene__label {
	margin: 0 0 0.7em;
	font-size: clamp(0.62rem, 0.8cqi, 0.75rem);
	font-weight: 500;
	letter-spacing: 0.32em;
	line-height: 1.3;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.72);
}

.nfsc .nfsc-scene__heading {
	margin: 0;
	font-size: clamp(1.5rem, 3.6cqi, 3.5rem);
	font-weight: 700;
	line-height: 1.02;
	letter-spacing: -0.02em;
	color: var(--nfsc-white);
}

/* Nothing typed, nothing drawn. */
.nfsc .nfsc-scene__label:empty,
.nfsc .nfsc-scene__heading:empty,
.nfsc .nfsc-scene__meta:empty {
	display: none;
}

/* --- The words ----------------------------------------------------------- */

.nfsc-scene__copy {
	position: absolute;
	left: 3.6cqi;
	bottom: 4.6cqi;
	z-index: 4;
	max-width: 46%;
}

.nfsc .nfsc-scene__title {
	margin: 0;
	font-size: clamp(1.35rem, 3.6cqi, 3.25rem);
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.015em;
	color: var(--nfsc-white);
}

.nfsc .nfsc-scene__tagline {
	margin: 0.35em 0 0;
	font-size: clamp(0.85rem, 1.35cqi, 1.125rem);
	line-height: 1.4;
	color: rgba(255, 255, 255, 0.86);
}

.nfsc .nfsc-scene__meta {
	margin: 0.6em 0 0;
	font-size: clamp(0.66rem, 0.9cqi, 0.78rem);
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--nfsc-muted);
}

.nfsc .nfsc-scene__button {
	display: inline-flex;
	align-items: center;
	gap: 0.85em;
	margin-top: clamp(0.9rem, 1.9cqi, 1.6rem);
	padding: 0.85em 1.25em;
	border: 1px solid rgba(255, 255, 255, 0.85);
	border-radius: 0;
	background: rgba(5, 5, 5, 0.25);
	color: var(--nfsc-white);
	font-size: clamp(0.78rem, 1.05cqi, 0.9rem);
	font-weight: 500;
	letter-spacing: 0.1em;
	line-height: 1;
	text-decoration: none;
	background-image: none;
	transition: background-color 0.2s var(--nfsc-ease), border-color 0.2s var(--nfsc-ease);
}

.nfsc .nfsc-scene__button:hover,
.nfsc .nfsc-scene__button:focus-visible {
	background-color: var(--nfsc-blue);
	border-color: var(--nfsc-blue);
	color: #fff;
}

.nfsc .nfsc-scene__button:focus-visible {
	outline: 2px solid var(--nf-blue-lit, #6b8aff);
	outline-offset: 3px;
}

.nfsc .nfsc-scene__button {
	white-space: nowrap;
}

/* In case the theme does not provide it. */
.nfsc .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.nfsc-scene__arrow {
	transition: transform 0.2s var(--nfsc-ease);
}

.nfsc-scene__button:hover .nfsc-scene__arrow {
	transform: translateX(3px);
}

/* The whole picture opens the collection too, for people who tap the garment. */
.nfsc .nfsc-scene__cover {
	position: absolute;
	inset: 0;
	z-index: 3;
	background: none !important;
}

/* --- Phone layout -------------------------------------------------------- */

/*
 * Taller crop, its own garment position, the words across the bottom.
 * Written twice — once for a narrow scene, once for the forced preview —
 * because a container query cannot be shared with a class.
 */
@container (max-width: 640px) {
	.nfsc-scene:not(.is-d) .nfsc-scene__stage {
		--x: var(--mx, 50%);
		--y: var(--my, 40%);
		--s: var(--ms, 62%);
		--ar: 3 / 4;
		--arn: 0.75;
		--focus: var(--mf, 50%);
		--focusn: var(--mfn, 0.5);
	}

	.nfsc-scene:not(.is-d) .nfsc-scene__stage::after {
		background: linear-gradient(to top, rgba(5, 5, 5, 0.88) 0%, rgba(5, 5, 5, 0.5) 30%, transparent 55%);
	}

	.nfsc-scene:not(.is-d) .nfsc-scene__copy {
		left: 6cqi;
		right: 6cqi;
		bottom: 7cqi;
		max-width: none;
	}

	.nfsc-scene:not(.is-d) .nfsc-scene__title {
		font-size: clamp(1.3rem, 8cqi, 2.1rem);
	}

	.nfsc-scene:not(.is-d) .nfsc-scene__tagline {
		font-size: clamp(0.8rem, 3.9cqi, 1rem);
	}

	.nfsc-scene:not(.is-d) .nfsc-scene__meta {
		font-size: clamp(0.6rem, 2.8cqi, 0.72rem);
	}

	.nfsc-scene:not(.is-d) .nfsc-scene__button {
		font-size: clamp(0.72rem, 3.6cqi, 0.85rem);
		margin-top: 5cqi;
	}

	.nfsc-scene:not(.is-d) .nfsc-scene__note {
		display: none;
	}

	.nfsc-scene:not(.is-d) .nfsc-scene__top {
		left: 6cqi;
		right: 6cqi;
		top: 6cqi;
		max-width: none;
	}

	.nfsc-scene:not(.is-d) .nfsc-scene__label {
		font-size: clamp(0.58rem, 2.8cqi, 0.7rem);
	}

	.nfsc-scene:not(.is-d) .nfsc-scene__heading {
		font-size: clamp(1.3rem, 7cqi, 2rem);
	}
}

.nfsc-scene.is-m .nfsc-scene__stage {
	--x: var(--mx, 50%);
	--y: var(--my, 40%);
	--s: var(--ms, 62%);
	--ar: 3 / 4;
	--arn: 0.75;
	--focus: var(--mf, 50%);
	--focusn: var(--mfn, 0.5);
}

.nfsc-scene.is-m .nfsc-scene__stage::after {
	background: linear-gradient(to top, rgba(5, 5, 5, 0.88) 0%, rgba(5, 5, 5, 0.5) 30%, transparent 55%);
}

.nfsc-scene.is-m .nfsc-scene__copy {
	left: 6cqi;
	right: 6cqi;
	bottom: 7cqi;
	max-width: none;
}

.nfsc-scene.is-m .nfsc-scene__title {
	font-size: clamp(0.9rem, 8cqi, 2.1rem);
}

.nfsc-scene.is-m .nfsc-scene__tagline {
	font-size: clamp(0.6rem, 3.9cqi, 1rem);
}

.nfsc-scene.is-m .nfsc-scene__meta {
	font-size: clamp(0.45rem, 2.8cqi, 0.72rem);
}

.nfsc-scene.is-m .nfsc-scene__button {
	font-size: clamp(0.5rem, 3.6cqi, 0.85rem);
	margin-top: 5cqi;
}

.nfsc-scene.is-m .nfsc-scene__note {
	display: none;
}

.nfsc-scene.is-m .nfsc-scene__top {
	left: 6cqi;
	right: 6cqi;
	top: 6cqi;
	max-width: none;
}

.nfsc-scene.is-m .nfsc-scene__label {
	font-size: clamp(0.35rem, 2.8cqi, 0.7rem);
}

.nfsc-scene.is-m .nfsc-scene__heading {
	font-size: clamp(0.7rem, 7cqi, 2rem);
}

.nfsc-scene.is-d .nfsc-scene__label {
	font-size: clamp(0.3rem, 0.8cqi, 0.75rem);
}

.nfsc-scene.is-d .nfsc-scene__heading {
	font-size: clamp(0.8rem, 3.6cqi, 3.5rem);
}

/* The admin's desktop preview is small; let its type shrink with it. */
.nfsc-scene.is-d .nfsc-scene__title {
	font-size: clamp(0.8rem, 3.6cqi, 3.25rem);
}

.nfsc-scene.is-d .nfsc-scene__tagline {
	font-size: clamp(0.5rem, 1.35cqi, 1.125rem);
}

.nfsc-scene.is-d .nfsc-scene__meta,
.nfsc-scene.is-d .nfsc-scene__note {
	font-size: clamp(0.35rem, 0.9cqi, 0.78rem);
}

.nfsc-scene.is-d .nfsc-scene__button {
	font-size: clamp(0.45rem, 1.05cqi, 0.9rem);
}

/* --- After the scenes ---------------------------------------------------- */

.nfsc__all {
	margin: clamp(2rem, 5vw, 3.5rem) 0 clamp(2.5rem, 6vw, 4.5rem);
	text-align: center;
}

.nfsc .nfsc__all a {
	display: inline-flex;
	gap: 0.8em;
	padding-bottom: 0.45em;
	border-bottom: 1px solid rgba(255, 255, 255, 0.7);
	color: var(--nfsc-white);
	font-size: 0.82rem;
	letter-spacing: 0.16em;
	text-decoration: none;
	background-image: none;
	transition: border-color 0.2s var(--nfsc-ease), color 0.2s var(--nfsc-ease);
}

.nfsc .nfsc__all a:hover {
	color: var(--nf-blue-lit, #6b8aff);
	border-color: var(--nf-blue-lit, #6b8aff);
}

/* --- Motion, only for people who want it --------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.nfsc-fx--mist::before,
	.nfsc-fx--mist::after,
	.nfsc-scene.is-in .nfsc-fx--dial .nfsc-scene__glow {
		animation: none;
	}

	.nfsc-fx--dial .nfsc-scene__glow {
		transition: none;
		opacity: 1;
	}
}
