/*
 * Skovbørnene motion enhancements
 * Progressive layer: loaded after main.css and activated by enhancements.js.
 */

:root {
	--motion-soft: cubic-bezier(.22, 1, .36, 1);
	--motion-spring: cubic-bezier(.2, .85, .28, 1.25);
}

/* A quiet page-progress cue reinforces the long-form story without taking space. */
.page-progress {
	position: fixed;
	top: 0;
	right: 0;
	left: 0;
	z-index: 10001;
	height: 3px;
	pointer-events: none;
	transform: scaleX(var(--page-progress, 0));
	transform-origin: left center;
	background: linear-gradient(90deg, var(--gold), #ffe299 40%, var(--sage-300) 72%, var(--forest-700));
	box-shadow: 0 1px 8px rgba(242, 184, 75, .24);
	will-change: transform;
}

/* Soft, section-local light. The element is injected and is never part of layout. */
.enhanced-section {
	position: relative;
	isolation: isolate;
}

/* A restrained scroll veil blends each section into the next surface. */
.section-bridge {
	position: absolute;
	right: 0;
	bottom: -1px;
	left: 0;
	z-index: 12;
	display: block;
	height: clamp(46px, 5.2vw, 82px);
	overflow: hidden;
	opacity: .25;
	pointer-events: none;
	transform: translateY(18px);
	transition: opacity .8s ease, transform 1.15s var(--motion-soft);
}

.section-bridge::before {
	position: absolute;
	top: 42%;
	right: -8%;
	bottom: -64%;
	left: -8%;
	border-radius: 50% 50% 0 0 / 100% 100% 0 0;
	background: var(--bridge-next, var(--cream));
	content: "";
}

.enhanced-section:nth-of-type(even) > .section-bridge::before {
	right: -2%;
	left: -14%;
}

.section-bridge::after {
	position: absolute;
	bottom: 10px;
	left: 50%;
	width: min(120px, 24vw);
	height: 3px;
	border-radius: 999px;
	background: linear-gradient(90deg, transparent, rgba(242, 184, 75, .9), transparent);
	content: "";
	opacity: 0;
	transform: translateX(-50%) scaleX(.2);
	transition: opacity .65s ease .12s, transform 1s var(--motion-soft) .12s;
}

.enhanced-section.is-section-active > .section-bridge {
	opacity: 1;
	transform: translateY(0);
}

.enhanced-section.is-section-active > .section-bridge::after {
	opacity: .7;
	transform: translateX(-50%) scaleX(1);
}

.section-ambient {
	position: absolute;
	top: clamp(24px, 8vw, 110px);
	left: var(--ambient-left, 4%);
	z-index: -1;
	width: clamp(220px, 30vw, 480px);
	aspect-ratio: 1;
	border-radius: 50%;
	background: radial-gradient(circle, rgba(242, 184, 75, .13), rgba(198, 224, 209, .08) 48%, transparent 72%);
	filter: blur(8px);
	opacity: 0;
	pointer-events: none;
	transform: translate3d(0, 28px, 0) scale(.88);
	transition: opacity 1.2s ease, transform 1.8s var(--motion-soft);
}

.enhanced-section:nth-of-type(even) .section-ambient {
	--ambient-left: 67%;
}

.enhanced-section.is-section-active .section-ambient {
	opacity: .75;
	transform: translate3d(0, var(--ambient-y, 0px), 0) scale(1);
}

/* A small hand-drawn-feeling signature line, revealed with its section. */
.enhance-heading {
	position: relative;
}

.enhance-heading::after {
	position: absolute;
	bottom: -.2em;
	left: 0;
	width: 62px;
	height: 4px;
	border-radius: 999px;
	background: linear-gradient(90deg, var(--gold), rgba(242, 184, 75, .22));
	content: "";
	opacity: 0;
	transform: scaleX(.08) rotate(-1.5deg);
	transform-origin: left center;
	transition: opacity .55s ease .18s, transform .9s var(--motion-soft) .18s;
}

.section-heading .enhance-heading::after {
	left: 50%;
	transform: translateX(-50%) scaleX(.08) rotate(-1.5deg);
	transform-origin: center;
}

.is-section-active .enhance-heading::after {
	opacity: 1;
	transform: scaleX(1) rotate(-1.5deg);
}

.is-section-active .section-heading .enhance-heading::after {
	transform: translateX(-50%) scaleX(1) rotate(-1.5deg);
}

/* Hero decorations follow the pointer by only a few pixels and keep their slow float. */
.motion-ok .hero-orbit {
	animation-name: enhanced-float-decoration;
	animation-duration: 6.4s;
	animation-timing-function: ease-in-out;
}

@keyframes enhanced-float-decoration {
	0%, 100% {
		transform: translate3d(var(--orbit-x, 0px), var(--orbit-y, 0px), 0) rotate(-2deg);
	}
	50% {
		transform: translate3d(var(--orbit-x, 0px), calc(var(--orbit-y, 0px) - 11px), 0) rotate(7deg);
	}
}

/* Images gain depth inside their existing, stable frames. */
.motion-ok .enhance-parallax-media {
	transform: translate3d(0, var(--media-parallax, 0px), 0) scale(1.045);
	transition: transform .16s linear;
	will-change: transform;
}

.motion-ok .about-photo {
	overflow: hidden;
}

/* The day rhythm is painted progressively; completed steps gently settle in. */
.motion-ok .day-steps::before {
	background: linear-gradient(
		to bottom,
		var(--gold) 0,
		var(--forest-700) var(--day-progress, 0%),
		rgba(10, 74, 58, .13) var(--day-progress, 0%),
		rgba(10, 74, 58, .13) 100%
	);
}

.motion-ok .day-steps li > span {
	transition: color .45s ease, background-color .45s ease, box-shadow .55s var(--motion-soft), transform .55s var(--motion-spring);
}

.motion-ok .day-steps li.is-passed > span {
	box-shadow: 0 0 0 5px rgba(242, 184, 75, .18), 0 8px 22px rgba(7, 61, 49, .15);
	transform: translateX(-1px) scale(1.055);
}

/* Existing process SVG becomes scroll-linked; step dots echo the travelled path. */
.motion-ok .process-line path {
	transition: none;
}

.motion-ok .process-steps span {
	transition: color .42s ease, background-color .42s ease, box-shadow .48s ease, transform .55s var(--motion-spring);
}

.motion-ok .process-steps li.is-passed span {
	background: var(--forest-800);
	box-shadow: 0 0 0 3px var(--gold), 0 10px 28px rgba(7, 61, 49, .17);
	color: var(--white);
	transform: scale(1.07);
}

/* Pointer-only card depth. Variables are updated in one animation frame. */
@media (hover: hover) and (pointer: fine) {
	.motion-ok .enhance-tilt.is-visible,
	.motion-ok .enhance-tilt:not([data-reveal]) {
		transform: perspective(900px) translate3d(0, var(--card-lift, 0px), 0) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
		transform-style: preserve-3d;
		transition: transform .48s var(--motion-soft), box-shadow .35s ease;
		will-change: transform;
	}

	.motion-ok .enhance-tilt.is-pointer-over {
		--card-lift: -5px;
		box-shadow: 0 24px 58px rgba(7, 61, 49, .15);
		transition-duration: .12s, .35s;
	}

	.motion-ok .experience-card:hover img {
		transform: scale(1.035);
	}

	.motion-ok .experience-card img {
		transition: transform .75s var(--motion-soft);
	}
}

/* Magnetic movement is deliberately capped in JS, so CTAs stay calm and readable. */
.motion-ok .button.enhance-magnetic {
	--button-lift: 0px;
	--button-scale: 1;
	transform: translate3d(var(--magnetic-x, 0px), calc(var(--magnetic-y, 0px) + var(--button-lift)), 0) scale(var(--button-scale));
	transition: transform .38s var(--motion-soft), background-color .24s ease, color .24s ease, border-color .24s ease, box-shadow .24s ease;
	will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
	.motion-ok .button.enhance-magnetic:hover {
		--button-lift: -2px;
	}
}

.motion-ok .button.enhance-magnetic.is-pressing {
	--button-lift: 1px;
	--button-scale: .975;
	transition-duration: .11s;
}

.motion-ok .text-link > span[aria-hidden="true"] {
	transition: transform .42s var(--motion-soft);
}

.motion-ok .text-link:hover > span[aria-hidden="true"] {
	transform: translateX(5px);
}

/* A slow contact-section drift gives the closing CTA a little more depth. */
.motion-ok .contact-section::before {
	transform: translate3d(var(--contact-x, 0px), var(--contact-y, 0px), 0);
}

.motion-ok .contact-section::after {
	transform: translate3d(var(--contact-x-reverse, 0px), var(--contact-y-reverse, 0px), 0);
}

@media (max-width: 760px) {
	.page-progress {
		height: 2px;
	}

	.section-ambient {
		width: 220px;
		filter: blur(14px);
	}

	.enhance-heading::after {
		width: 48px;
		height: 3px;
	}

	.motion-ok .enhance-parallax-media {
		transform: translate3d(0, var(--media-parallax, 0px), 0) scale(1.03);
	}
}

@media (prefers-reduced-motion: reduce) {
	.page-progress,
	.section-ambient,
	.section-bridge {
		display: none;
	}

	.enhance-heading::after {
		opacity: 1;
		transform: scaleX(1) rotate(-1.5deg);
		transition: none;
	}

	.section-heading .enhance-heading::after,
	.is-section-active .section-heading .enhance-heading::after {
		transform: translateX(-50%) scaleX(1) rotate(-1.5deg);
	}

	.enhance-parallax-media,
	.enhance-tilt,
	.button.enhance-magnetic,
	.contact-section::before,
	.contact-section::after {
		transform: none !important;
		transition: none !important;
	}

	.process-line path {
		stroke-dashoffset: 0 !important;
		transition: none !important;
	}

	.day-steps::before {
		background: linear-gradient(var(--gold), var(--forest-700)) !important;
	}
}
