@property --font-color { syntax: '<color>'; inherits: true; initial-value: black; }
@property --font-color-inactive { syntax: '<color>'; inherits: true; initial-value: gray; }
@property --shade-size { syntax: '<percentage>'; inherits: false; initial-value: 100%; }
@property --wipe { syntax: '<length-percentage>'; inherits: false; initial-value: -100%; }
@supports (animation-timeline: view()) and (timeline-scope: none) {
	.layout:has(.video-highlight, .image-highlight) {
		--header-height: calc(2 * var(--nav-padding) + 1.5rem);
		--page-font-color: var(--font-color);
		--page-font-color-inactive: var(--font-color-inactive);
		timeline-scope: --hero;
	}
	:is(.video-highlight, .image-highlight) {
		view-timeline: --hero block;
		margin-top: calc(-1 * var(--header-height));
	}
	.layout:has(.video-highlight, .image-highlight) .header {
		background-color: transparent;
	}
	.layout:has(.video-highlight, .image-highlight) .header::before {
		content: '';
		position: absolute;
		inset: 0;
		z-index: -1;
		background-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0));
		background-size: 100% var(--shade-size);
		background-repeat: no-repeat;
		animation-name: header-bg-leave-hero;
	}
	.layout:has(.video-highlight, .image-highlight) .header::before,
	.layout:has(.video-highlight, .image-highlight) :is(.header > div, .header svg, .header a) {
		animation-timing-function: linear;
		animation-fill-mode: both;
		animation-timeline: --hero;
		animation-range: cover calc(100% - var(--header-height)) cover calc(100% - var(--header-height) + var(--space-block));
	}
	.layout:has(.video-highlight, .image-highlight) .header > div { animation-name: header-text-leave-hero; }
	.layout:has(.video-highlight, .image-highlight) .header svg { animation-name: logo-leave-hero; }
	.layout:has(.video-highlight, .image-highlight) .header a { animation-name: link-leave-hero; }
	.layout:has(.next-project) .header::before,
	.layout:has(.next-project) :is(.header > div, .header svg, .header a) {
		animation-fill-mode: both, forwards;
		animation-timeline: --hero, scroll(root);
		animation-range:
			cover calc(100% - var(--header-height)) cover calc(100% - var(--header-height) + var(--space-block)),
			calc(100% - var(--header-height) - var(--space-block)) 100%;
	}
	.layout:has(.next-project) .header::before {
		animation-name: header-bg-leave-hero, header-bg-over-next;
		background-image:
			linear-gradient(to bottom, var(--bg-color) var(--wipe), transparent calc(var(--wipe) + 2.5rem)),
			linear-gradient(to bottom, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0));
		background-size: 100% 100%, 100% var(--shade-size);
	}
	.layout:has(.next-project) .header > div { animation-name: header-text-leave-hero, header-text-over-next; }
	.layout:has(.next-project) .header svg { animation-name: logo-leave-hero, logo-leave-hero; animation-direction: normal, reverse; }
	.layout:has(.next-project) .header a { animation-name: link-leave-hero, link-leave-hero; animation-direction: normal, reverse; }
}
@keyframes header-bg-leave-hero {
	0% {
		background-color: transparent;
		--shade-size: 100%;
	}
	100% {
		background-color: var(--bg-color);
		--shade-size: 0%;
	}
}
@keyframes header-text-leave-hero {
	0%, 50% {
		--font-color: rgba(242, 242, 242, 1);
		--font-color-inactive: rgba(242, 242, 242, 0.7);
		text-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
	}
	60%, 100% {
		--font-color: var(--page-font-color);
		--font-color-inactive: var(--page-font-color-inactive);
		text-shadow: 0 0 12px rgba(0, 0, 0, 0);
	}
}
@keyframes header-bg-over-next {
	0% {
		background-color: transparent;
		--shade-size: 0%;
		--wipe: 100%;
	}
	100% {
		background-color: transparent;
		--shade-size: 0%;
		--wipe: -2.5rem;
	}
}
@keyframes header-text-over-next {
	0%, 40% {
		--font-color: var(--page-font-color);
		--font-color-inactive: var(--page-font-color-inactive);
		text-shadow: 0 0 12px rgba(0, 0, 0, 0);
	}
	50%, 100% {
		--font-color: rgba(242, 242, 242, 1);
		--font-color-inactive: rgba(242, 242, 242, 0.7);
		text-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
	}
}
@keyframes link-leave-hero {
	0%, 50% { color: rgba(242, 242, 242, 1); }
	60%, 100% { color: var(--page-font-color); }
}
@keyframes logo-leave-hero {
	0%, 50% { filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0.35)); }
	60%, 100% { filter: drop-shadow(0 0 6px rgba(0, 0, 0, 0)); }
}
.project-page {
	--caption-h: 3rem;
	--caption-top: calc(100dvh - (1.5rem + 1rem + var(--footer-bottom)) + 1.5rem - var(--space-block) - var(--caption-h));
	--caption-fade:
		calc(100% - (var(--caption-top) + var(--caption-h) / 2 + 0.65 * (var(--next-bleed) + var(--space-block))))
		calc(100% - (var(--caption-top) + var(--caption-h) / 2) / 2);
}
@supports (animation-timeline: view()) and (timeline-scope: none) {
	.project-page {
		--credits-hold: 0rem;
		position: relative;
	}
	.next-project-rail {
		display: block;
		position: absolute;
		grid-column: 1;
		grid-row: 3;
		inset: calc(-1 * (var(--credits-hold) + var(--caption-h))) 0 calc(1rem + var(--footer-bottom) + var(--space-block)) 0;
		z-index: 1;
		pointer-events: none;
	}
	.next-project-caption {
		position: sticky;
		top: var(--caption-top);
		height: var(--caption-h);
		width: fit-content;
		display: flex;
		flex-direction: column;
		justify-content: flex-end;
		pointer-events: auto;
	}
	.next-project-caption,
	.next-project-caption a {
		animation: caption-over-next linear both;
		animation-timeline: scroll(root);
		animation-range: var(--caption-fade);
	}
	@media screen and (max-width: 1024px) {
		.project-page {
			grid-template-rows: auto calc(var(--space-block) + var(--caption-h)) auto;
		}
		.next-project-caption {
			margin: 0 0 0 var(--side-margin);
		}
	}
	@media screen and (min-width: 1025px) {
		.project-page {
			--credits-hold: 20rem;
			grid-template-rows: var(--credits-hold) auto auto;
		}
		.project-main {
			grid-row: 2;
			align-self: end;
			position: sticky;
			bottom: calc(1rem + var(--footer-bottom) + var(--space-block));
		}
		.next-project-caption {
			margin-left: auto;
		}
		.project-page > .next-project {
			grid-row: 3;
		}
	}
}
@keyframes caption-over-next {
	0% { color: var(--font-color); text-shadow: 0 0 12px rgba(0, 0, 0, 0); }
	25% { color: color-mix(in srgb, rgba(242, 242, 242, 1) 15%, var(--font-color)); text-shadow: 0 0 12px rgba(0, 0, 0, 0.05); }
	59% { color: color-mix(in srgb, rgba(242, 242, 242, 1) 20%, var(--font-color)); text-shadow: 0 0 12px rgba(0, 0, 0, 0.07); }
	81% { color: color-mix(in srgb, rgba(242, 242, 242, 1) 40%, var(--font-color)); text-shadow: 0 0 12px rgba(0, 0, 0, 0.14); }
	100% { color: rgba(242, 242, 242, 1); text-shadow: 0 0 12px rgba(0, 0, 0, 0.35); }
}
.layout:has(.next-project) {
	--next-bleed: var(--space-section);
}
@property --feather {
	syntax: '<percentage>';
	inherits: false;
	initial-value: 0%;
}
@supports (animation-timeline: view()) and (timeline-scope: none) {
	.next-project {
		display: block;
		height: calc(var(--full-height) + var(--space-block) + var(--next-bleed));
		margin-top: calc(-1 * var(--next-bleed));
	}
	html:has(.next-project) {
		animation: overscroll-end linear forwards;
		animation-timeline: scroll(root);
		animation-range: calc(100% - 100px) 100%;
	}
	.layout:has(.next-project) .content {
		padding-bottom: 0;
	}
	.layout:has(.next-project) footer {
		position: relative;
		margin-top: calc(-1 * (1.5rem + 1rem + var(--footer-bottom)) - 0.25rem);
		--font-color: rgba(242, 242, 242, 1);
		--font-color-inactive: rgba(242, 242, 242, 0.7);
		color: var(--font-color);
		text-shadow: 0 0 12px rgba(0, 0, 0, 0.35);
	}
	.next-project-picture > img {
		--hint: calc(var(--next-bleed) + var(--space-block));
		margin-top: calc(0.65 * var(--hint));
		height: calc(100% - 0.3 * var(--hint));
		-webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 calc(0.35 * var(--hint)));
		mask-image: linear-gradient(to bottom, transparent 0, #000 calc(0.35 * var(--hint)));
	}
	.next-project-picture {
		--hint-zone: calc(var(--next-bleed) + var(--space-block));
		-webkit-mask-image: linear-gradient(to bottom, transparent 0, transparent calc(var(--hint-zone) * 0.35), rgba(0, 0, 0, 0.04) calc(var(--hint-zone) * 0.65), rgba(0, 0, 0, 0.15) var(--hint-zone), rgba(0, 0, 0, 0.2) calc(var(--hint-zone) + var(--feather) * 0.3), rgba(0, 0, 0, 0.4) calc(var(--hint-zone) + var(--feather) * 0.6), #000 calc(var(--hint-zone) + var(--feather)));
		mask-image: linear-gradient(to bottom, transparent 0, transparent calc(var(--hint-zone) * 0.35), rgba(0, 0, 0, 0.04) calc(var(--hint-zone) * 0.65), rgba(0, 0, 0, 0.15) var(--hint-zone), rgba(0, 0, 0, 0.2) calc(var(--hint-zone) + var(--feather) * 0.3), rgba(0, 0, 0, 0.4) calc(var(--hint-zone) + var(--feather) * 0.6), #000 calc(var(--hint-zone) + var(--feather)));
		animation: next-feather linear both, next-settle linear both;
		animation-timeline: view(), view();
		animation-range: cover 0% contain 100%;
	}
	@media (prefers-reduced-motion: reduce) {
		.next-project-picture {
			animation: next-feather linear both;
			animation-timeline: view();
			animation-range: cover 0% contain 100%;
		}
	}
}
@keyframes overscroll-end {
	from, to { background-color: var(--overscroll-end, black); }
}
@keyframes next-feather {
	from { --feather: 100%; }
	to { --feather: 0%; }
}
@keyframes next-settle {
	from { transform: scale(1.15); }
	to { transform: none; }
}
