/**
 * Header fade gradient — full-size overlay inside #masthead > .menu-container.
 *
 * Nested in .menu-container (not a direct #masthead child) so Uncode's
 * .menu-transparent > * { background: transparent } rules do not wipe it.
 * .menu-container is position:fixed when sticky, so #masthead height is 0 —
 * sizing against .menu-container is required.
 *
 * Fill is background-color + mask so the color can transition with skin.
 */

#masthead {
	--uncode-child-mh-fade: var(--uncode-child-mh-fade-light);
}

#masthead.style-dark:not(.style-light-override) {
	--uncode-child-mh-fade: var(--uncode-child-mh-fade-dark);
}

#masthead.style-dark-override {
	--uncode-child-mh-fade: var(--uncode-child-mh-fade-dark);
}

#masthead.style-light-override {
	--uncode-child-mh-fade: var(--uncode-child-mh-fade-light);
}

/* Keep Uncode sticky fixed; only clear solid fill so the fade shows. */
#masthead .menu-container {
	background-image: none !important;
	background-color: transparent !important;
}

.uncode-child-mh-fade {
	position: absolute;
	z-index: 0;
	margin: 0;
	inset: 0;
	/* !important: beat Uncode transparent-menu child overrides if any cascade. */
	background: var(--uncode-child-mh-fade) !important;
	background-color: var(--uncode-child-mh-fade) !important;
	padding: 0;
	width: 130%;
	height: 100%;
	pointer-events: none;
	-webkit-mask-image: linear-gradient(
		to bottom,
		hsl(0, 32%, 35%) 0%,
		hsla(0, 0%, 0%, 0.987) 8.1%,
		hsla(0, 0%, 0%, 0.951) 15.5%,
		hsla(0, 0%, 0%, 0.896) 22.5%,
		hsla(0, 0%, 0%, 0.825) 29%,
		hsla(0, 0%, 0%, 0.741) 35.3%,
		hsla(0, 0%, 0%, 0.648) 41.2%,
		hsla(0, 0%, 0%, 0.55) 47.1%,
		hsla(0, 0%, 0%, 0.45) 52.9%,
		hsla(0, 0%, 0%, 0.352) 58.8%,
		hsla(0, 0%, 0%, 0.259) 64.7%,
		hsla(0, 0%, 0%, 0.175) 71%,
		hsla(0, 0%, 0%, 0.104) 77.5%,
		hsla(0, 0%, 0%, 0.049) 84.5%,
		hsla(0, 0%, 0%, 0.013) 91.9%,
		hsla(0, 0%, 0%, 0) 100%
	);
	mask-image: linear-gradient(
		to bottom,
		hsl(0, 32%, 35%) 0%,
		hsla(0, 0%, 0%, 0.987) 8.1%,
		hsla(0, 0%, 0%, 0.951) 15.5%,
		hsla(0, 0%, 0%, 0.896) 22.5%,
		hsla(0, 0%, 0%, 0.825) 29%,
		hsla(0, 0%, 0%, 0.741) 35.3%,
		hsla(0, 0%, 0%, 0.648) 41.2%,
		hsla(0, 0%, 0%, 0.55) 47.1%,
		hsla(0, 0%, 0%, 0.45) 52.9%,
		hsla(0, 0%, 0%, 0.352) 58.8%,
		hsla(0, 0%, 0%, 0.259) 64.7%,
		hsla(0, 0%, 0%, 0.175) 71%,
		hsla(0, 0%, 0%, 0.104) 77.5%,
		hsla(0, 0%, 0%, 0.049) 84.5%,
		hsla(0, 0%, 0%, 0.013) 91.9%,
		hsla(0, 0%, 0%, 0) 100%
	);

	-webkit-mask-size: 100% 100%;
	mask-size: 100% 100%;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	transition:
		background-color 320ms ease-in-out,
		background 320ms ease-in-out;
}

/* Menu content above the fade layer. */
#masthead .menu-container > .row-menu,
#masthead .menu-container > .row {
	position: relative;
	z-index: 1;
}

/* Scrub mode: GSAP drives --uncode-child-mh-fade; kill CSS class/transition fights. */
body.has-scroll-color-scrub #masthead,
body.has-scroll-color-scrub #masthead.style-dark,
body.has-scroll-color-scrub #masthead.style-dark:not(.style-light-override),
body.has-scroll-color-scrub #masthead.style-dark-override,
body.has-scroll-color-scrub #masthead.style-light-override {
	--uncode-child-mh-fade: var(--uncode-child-scs-fade, var(--uncode-child-mh-fade-light));
}

body.has-scroll-color-scrub .uncode-child-mh-fade {
	transition: none;
}

@media (prefers-reduced-motion: reduce) {
	.uncode-child-mh-fade {
		transition: none;
	}
}
