/* [noctshop_showcase] — product scroller. Styles: reel, mosaic, marquee, combo (reel + ticker). */

/*
 * Reds follow the site's Blocksy colours (also defined in notify.css):
 *   --ns-red       palette colour 5 = link hover colour; fills, borders, glows
 *   --ns-red-text  link colour; red text and focus rings (palette 5 is too dark to read on black)
 */
:root {
	--ns-red: var(--theme-palette-color-5, #a50000);
	--ns-red-text: var(--theme-link-initial-color, #d17575);
}

.nsc,
.nsc-ticker {
	--nsc-fg: #f5f5f5;
	--nsc-muted: #8d8d8d;
	--nsc-ease: cubic-bezier(.2, .7, .2, 1);
	position: relative;
	color: var(--nsc-fg);
}

/* Full-bleed sections break out of the page's content width. */
.entry-content .nsc--reel,
.entry-content .nsc--marquee,
.entry-content .nsc-ticker {
	width: 100vw;
	max-width: 100vw;
	margin-inline: calc(50% - 50vw);
}
/*
 * No overflow rule on <html> here: Blocksy's body{overflow-x:hidden} already clips the 100vw
 * bleed. Setting overflow on <html> stops that propagating to the viewport, makes <body> its
 * own scroll container, and breaks position:sticky (the reel would scroll away unpinned).
 */

.nsc-title {
	margin: 0 0 clamp(1rem, 3vh, 2rem);
	padding-inline: 16px;
	text-align: center;
	font-family: 'Asal Viral', var(--theme-font-family); /* loaded by the "Noctshop Custom Fonts" snippet */
	font-size: clamp(1.65625rem, 4.4167vw, 3.3125rem); /* 53px max; min and vw scaled by the same 53/48 */
	font-weight: 400; /* the font has one weight; anything heavier gets faux-bolded */
	letter-spacing: .25em;
	text-transform: uppercase;
	color: var(--nsc-fg);
}

/* ---------- Card ---------- */

.nsc .nsc-card {
	display: block;
	margin: 0;
	padding: 0;
	min-height: 0;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: inherit;
	font: inherit;
	text-align: center;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.nsc .nsc-card:focus-visible {
	outline: 2px solid var(--ns-red-text);
	outline-offset: 6px;
	border-radius: 14px;
}

.nsc-card__img {
	position: relative;
	display: block;
	overflow: hidden;
	border-radius: 14px;
	background: #111;
	box-shadow: 0 0 0 1px rgba(255, 255, 255, .08);
	transition: box-shadow .4s var(--nsc-ease);
}
.nsc-card__img img {
	display: block;
	width: 100%;
	aspect-ratio: 1;
	object-fit: cover;
	transition: transform .7s var(--nsc-ease);
}
.nsc-card__img::after {
	content: "Notify me \2192";
	position: absolute;
	right: 12px;
	bottom: 12px;
	padding: .45em .9em;
	border-radius: 999px;
	background: var(--ns-red);
	color: #fff;
	font-size: .75rem;
	font-weight: 700;
	letter-spacing: .12em;
	text-transform: uppercase;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity .3s, transform .3s var(--nsc-ease);
}
.nsc-card__name {
	display: block;
	margin-top: .9rem;
	font-size: .85rem;
	font-weight: 600;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--nsc-muted);
	transition: color .3s;
}

@media (hover: hover) {
	.nsc-card:hover .nsc-card__img {
		box-shadow: 0 0 0 1px var(--ns-red), 0 24px 60px -18px color-mix(in srgb, var(--ns-red) 65%, transparent);
	}
	.nsc-card:hover .nsc-card__img img {
		transform: scale(1.06);
	}
	.nsc-card:hover .nsc-card__img::after {
		opacity: 1;
		transform: none;
	}
	.nsc-card:hover .nsc-card__name {
		color: var(--nsc-fg);
	}
}

/* ---------- Reel: pinned stage, vertical scroll slides the track sideways ---------- */

.nsc--reel {
	--cw: clamp(240px, 28vw, 400px);
}
/* --nsh-offset: space covered by the fixed header (noctshop-header mu-plugin). */
.nsc-reel__stage {
	position: sticky;
	top: var(--nsh-offset, 0px);
	display: flex;
	flex-direction: column;
	justify-content: center;
	height: calc(100vh - var(--nsh-offset, 0px));
	height: calc(100svh - var(--nsh-offset, 0px));
	overflow: hidden;
}
.nsc-reel__track {
	display: flex;
	gap: clamp(20px, 4vw, 56px);
	padding-inline: calc(50% - var(--cw) / 2);
	will-change: transform;
}
.nsc--reel .nsc-card {
	flex: none;
	width: var(--cw);
	/* --d: signed distance from the stage centre (-1…1), --ad: its absolute value; set by showcase.js */
	transform: perspective(1200px) rotateY(calc(var(--d, 0) * -22deg)) scale(calc(1 - var(--ad, 0) * .18));
	opacity: calc(1 - var(--ad, 0) * .55);
	filter: grayscale(calc(var(--ad, 0) * 100%));
}
.nsc-reel__progress {
	position: relative;
	width: min(320px, 60vw);
	height: 2px;
	margin: clamp(1.5rem, 5vh, 3rem) auto 0;
	background: rgba(255, 255, 255, .15);
}
.nsc-reel__progress span {
	position: absolute;
	inset: 0;
	background: var(--ns-red);
	box-shadow: 0 0 12px var(--ns-red);
	transform: scaleX(var(--p, 0));
	transform-origin: left;
}
.nsc-reel__count {
	position: absolute;
	right: 0;
	top: 10px;
	font-size: .75rem;
	letter-spacing: .2em;
	color: var(--nsc-muted);
	font-variant-numeric: tabular-nums;
}

/* Phones: no pinning, a native swipe row with snap points instead. */
@media (max-width: 767px) {
	.nsc--reel {
		--cw: 72vw;
		height: auto !important;
		padding-block: 2rem;
	}
	.nsc-reel__stage {
		position: static;
		height: auto;
	}
	.nsc-reel__track {
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		padding-block: 8px;
	}
	.nsc-reel__track::-webkit-scrollbar {
		display: none;
	}
	.nsc--reel .nsc-card {
		scroll-snap-align: center;
		transform: none;
		opacity: 1;
		filter: none;
	}
	.nsc-reel__progress {
		display: none;
	}
}

/* ---------- Mosaic: staggered columns with parallax and a blur reveal ---------- */

.nsc--mosaic {
	/* Room below for the columns' parallax drift (showcase.js caps it at ~70px). */
	padding-block: 26px clamp(3rem, 10vh, 6rem); /* top: + the 24px block spacing under the slider = 50px to the title */
	overflow: clip;
	isolation: isolate;
}
.nsc--mosaic .nsc-title {
	margin-top: -.39em; /* half-leading + the font's space above the capitals, so the 50px gap ends at the letters */
}
/* Cursor glow: only while a mouse is over the grid (showcase.js toggles .is-glowing). */
.nsc--mosaic::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), color-mix(in srgb, var(--ns-red) 55%, transparent), transparent 70%);
	opacity: 0;
	pointer-events: none;
	transition: opacity .5s;
}
.nsc--mosaic.is-glowing::before {
	opacity: 1;
}
.nsc-mosaic__grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: clamp(16px, 2vw, 28px);
	align-items: start;
	max-width: 1160px;
	margin-inline: auto;
}
.nsc-mosaic__col {
	display: flex;
	flex-direction: column;
	gap: clamp(16px, 2.5vw, 32px);
	will-change: transform;
}
.nsc-mosaic__col:nth-child(even) {
	margin-top: clamp(40px, 8vw, 110px);
}
/* Cycle crops so the columns don't line up: tall, square, portrait. */
.nsc--mosaic .nsc-card:nth-child(3n + 1) img {
	aspect-ratio: 4 / 5;
}
.nsc--mosaic .nsc-card:nth-child(3n + 2) img {
	aspect-ratio: 1;
}
.nsc--mosaic .nsc-card:nth-child(3n) img {
	aspect-ratio: 3 / 4;
}
.nsc--mosaic .nsc-card__img img {
	height: auto;
}
/*
 * Reveal both ways: a card rises out of the blur as it enters at the bottom of the screen and
 * blurs away upwards as it leaves at the top (and the reverse when scrolling back up).
 * showcase.js sets data-pos="below" | "in" | "above". The card's children move, not the card,
 * so the box the IntersectionObserver measures stays put (otherwise the 56px offset would delay
 * the reveal of cards waiting below).
 */
.nsc--mosaic.is-ready .nsc-card > * {
	transition: opacity 1.4s var(--nsc-ease), filter 1.4s var(--nsc-ease), transform 1.4s var(--nsc-ease);
	transition-delay: inherit;
}
.nsc--mosaic.is-ready .nsc-card[data-pos="below"] > *,
.nsc--mosaic.is-ready .nsc-card[data-pos="above"] > * {
	opacity: 0;
	filter: blur(14px) grayscale(1);
}
.nsc--mosaic.is-ready .nsc-card[data-pos="below"] > * {
	transform: translateY(56px) scale(.92);
}
.nsc--mosaic.is-ready .nsc-card[data-pos="above"] > * {
	transform: translateY(-56px) scale(.92);
}

@media (max-width: 767px) {
	.nsc-mosaic__grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.nsc-mosaic__col {
		display: contents;
	}
}

/* ---------- Marquee: two endless rows, scroll speed pushes them ---------- */

.nsc--marquee {
	display: grid;
	gap: clamp(16px, 3vw, 32px);
	padding-block: clamp(2rem, 6vh, 4rem);
	overflow: hidden;
}
.nsc-marquee__row {
	overflow: hidden;
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
	mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.nsc-marquee__track {
	display: flex;
	width: max-content;
	will-change: transform;
}
.nsc--marquee .nsc-card {
	flex: none;
	width: clamp(150px, 18vw, 260px);
	/* margin, not gap, so the duplicated half is exactly 50% wide and the loop is seamless */
	margin-right: clamp(14px, 2vw, 28px);
}

/* ---------- Ticker (combo): giant outlined words ---------- */

.nsc-ticker {
	overflow: hidden;
	padding-block: clamp(1rem, 3vh, 2rem);
	border-block: 1px solid rgba(255, 255, 255, .12);
}
.nsc-ticker__track {
	display: flex;
	align-items: center;
	gap: .5em;
	width: max-content;
	font-size: clamp(2rem, 7vw, 6rem);
	font-weight: 900;
	line-height: 1;
	letter-spacing: .04em;
	text-transform: uppercase;
	white-space: nowrap;
	animation: nsc-ticker 40s linear infinite;
}
.nsc-ticker__track > span {
	padding-right: .5em;
}
.nsc-ticker__track > span:nth-child(4n + 1) {
	color: transparent;
	-webkit-text-stroke: 1px var(--nsc-fg);
}
.nsc-ticker__track > span:nth-child(4n + 3) {
	color: var(--ns-red);
}
.nsc-ticker__track > span:nth-child(2n) {
	font-size: .4em;
	color: var(--ns-red-text);
}
@keyframes nsc-ticker {
	to {
		transform: translateX(-50%);
	}
}

/* ---------- Reduced motion: everything becomes a calm grid ---------- */

@media (prefers-reduced-motion: reduce) {
	.nsc--reel {
		height: auto !important;
		padding-block: 2rem;
	}
	.nsc-reel__stage {
		position: static;
		height: auto;
	}
	.nsc-reel__track,
	.nsc-marquee__track {
		display: grid;
		grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
		gap: 24px;
		width: auto;
		max-width: 1200px;
		margin-inline: auto;
		padding-inline: 16px;
		transform: none !important;
	}
	.nsc--reel .nsc-card,
	.nsc--marquee .nsc-card {
		width: auto;
		margin: 0;
		transform: none;
		opacity: 1;
		filter: none;
	}
	.nsc-marquee__row {
		-webkit-mask-image: none;
		mask-image: none;
	}
	.nsc-marquee__row + .nsc-marquee__row,
	.nsc-marquee__track > [aria-hidden="true"],
	.nsc-reel__progress {
		display: none;
	}
	.nsc-ticker__track {
		animation: none;
	}
	.nsc-mosaic__col {
		transform: none !important;
	}
}
