/**
 * Motion and interaction layer.
 * Content remains visible and functional without this stylesheet or JavaScript.
 */

/* User motion control */
.motion-toggle {
	display: inline-flex;
	align-items: center;
	gap: var(--space-2);
	padding: 0.55rem 0.8rem;
	margin-top: var(--space-5);
	background: transparent;
	color: var(--color-muted);
	font-size: 0.75rem;
	font-weight: 700;
	border: 0.0625rem solid var(--color-border);
	border-radius: var(--radius-pill);
	cursor: pointer;
	transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
	visibility: hidden;
}

.has-motion .motion-toggle {
	visibility: visible;
}

.motion-toggle:hover {
	background: var(--color-surface-soft);
	color: var(--color-text);
	border-color: rgba(7, 92, 246, 0.5);
}

.motion-toggle[aria-pressed="true"] {
	color: var(--color-text);
	border-color: var(--color-accent);
}

.motion-toggle:disabled {
	cursor: not-allowed;
	opacity: 0.72;
}

.motion-toggle__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.1875rem;
	width: 1rem;
	height: 1rem;
	color: var(--color-accent);
	border: 0.0625rem solid currentColor;
	border-radius: 50%;
}

.motion-toggle__icon span {
	width: 0.09375rem;
	height: 0.4rem;
	background: currentColor;
	border-radius: var(--radius-pill);
}

/* Sticky header state */
.site-header {
	box-shadow: 0 0 0 rgba(16, 18, 22, 0);
	transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.site-header.is-scrolled {
	background: rgba(255, 255, 255, 0.99);
	border-bottom-color: rgba(23, 25, 29, 0.2);
	box-shadow: 0 0.5rem 1.75rem rgba(16, 18, 22, 0.08);
}

/* CTA feedback */
.button {
	box-shadow: 0 0 0 rgba(7, 92, 246, 0);
	transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

@media (hover: hover) and (pointer: fine) {
	.button:hover {
		box-shadow: 0 0.75rem 2rem rgba(7, 92, 246, 0.18);
		transform: translateY(-0.125rem);
	}

	.button:active {
		box-shadow: 0 0.25rem 0.75rem rgba(7, 92, 246, 0.12);
		transform: translateY(0) scale(0.98);
	}
}

/* Hero cards */
.hero-card {
	transition: border-color 220ms ease, box-shadow 220ms ease, transform 220ms ease;
}

@media (min-width: 48rem) and (prefers-reduced-motion: no-preference) {
	.hero-card-float {
		will-change: transform;
	}

	.hero-card-float--statement {
		animation: hero-float-a 10s ease-in-out infinite;
	}

	.hero-card-float--services {
		animation: hero-float-b 11.5s ease-in-out -2.4s infinite;
	}

	.hero-card-float--process {
		animation: hero-float-c 9s ease-in-out -4.1s infinite;
	}
}

@media (min-width: 64rem) and (hover: hover) and (pointer: fine) {
	.hero-card:hover {
		border-color: rgba(7, 92, 246, 0.62);
		box-shadow: 0 1.25rem 3.75rem rgba(7, 92, 246, 0.2);
		transform: translateY(-0.25rem) rotate(1deg);
	}

	.hero-card--services:hover {
		transform: translateY(-0.25rem) rotate(-1deg);
	}
}

@keyframes hero-float-a {
	0%,
	100% {
		transform: translate3d(0, 0, 0);
	}
	50% {
		transform: translate3d(0, -0.3125rem, 0);
	}
}

@keyframes hero-float-b {
	0%,
	100% {
		transform: translate3d(0, 0, 0);
	}
	50% {
		transform: translate3d(0, 0.25rem, 0);
	}
}

@keyframes hero-float-c {
	0%,
	100% {
		transform: translate3d(0, 0, 0);
	}
	50% {
		transform: translate3d(0, -0.25rem, 0);
	}
}

/* Interactive cards */
.project-card,
.service-card,
.contact-card {
	transition: background-color 220ms ease, border-color 220ms ease, box-shadow 220ms ease, color 220ms ease, transform 220ms ease;
}

.text-link span,
.service-card__link span,
.contact-card__arrow,
.service-card__number {
	transition: border-color var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.project-card:focus-within,
.service-card:focus-within,
.contact-card:focus-visible {
	border-color: var(--color-accent);
	box-shadow: 0 1rem 2.75rem rgba(7, 92, 246, 0.16);
}

.project-card:focus-within .text-link span,
.service-card:focus-within .service-card__link span,
.contact-card:focus-visible .contact-card__arrow {
	transform: translateX(0.25rem);
}

@media (hover: hover) and (pointer: fine) {
	.project-card:hover,
	.service-card:hover,
	.contact-card:hover {
		border-color: rgba(7, 92, 246, 0.68);
		box-shadow: 0 1.25rem 3rem rgba(7, 92, 246, 0.16);
		transform: translateY(-0.25rem);
	}

	.project-card:hover .text-link span,
	.service-card:hover .service-card__link span,
	.contact-card:hover .contact-card__arrow {
		transform: translateX(0.25rem);
	}

	.service-card:hover .service-card__number {
		color: var(--color-accent);
		border-color: rgba(7, 92, 246, 0.58);
		transform: scale(1.03);
	}

	.service-card--featured:hover .service-card__number {
		color: #fff;
		border-color: rgba(255, 255, 255, 0.72);
		box-shadow: 0 0 1.25rem rgba(255, 255, 255, 0.2);
	}
}

/* Progressive scroll reveal */
[data-motion-reveal] {
	opacity: 0;
	transform: translateY(0.875rem);
	transition: opacity 520ms ease, transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

[data-motion-reveal].is-revealed {
	opacity: 1;
	transform: translateY(0);
}

.projects__grid > [data-motion-reveal]:nth-child(2),
.services__grid > [data-motion-reveal]:nth-child(2),
.process__list > [data-motion-reveal]:nth-child(2),
.contact__grid > [data-motion-reveal]:nth-child(2),
.hero-visual > [data-motion-reveal]:nth-child(2) {
	transition-delay: 70ms;
}

.projects__grid > [data-motion-reveal]:nth-child(3),
.services__grid > [data-motion-reveal]:nth-child(3),
.process__list > [data-motion-reveal]:nth-child(3),
.contact__grid > [data-motion-reveal]:nth-child(3),
.hero-visual > [data-motion-reveal]:nth-child(3) {
	transition-delay: 140ms;
}

.services__grid > [data-motion-reveal]:nth-child(4),
.process__list > [data-motion-reveal]:nth-child(4),
.hero-visual > [data-motion-reveal]:nth-child(4) {
	transition-delay: 210ms;
}

.services__grid > [data-motion-reveal]:nth-child(5) {
	transition-delay: 280ms;
}

/* One fixed canvas; it never participates in layout or input. */
.cursor-trail-canvas {
	position: fixed;
	inset: 0;
	z-index: 9998;
	display: block;
	width: 100vw;
	height: 100vh;
	pointer-events: none;
}

@media (min-width: 48rem) {
	[data-motion-reveal] {
		transform: translateY(1.25rem);
	}

	[data-motion-reveal].is-revealed {
		transform: translateY(0);
	}
}

/* Manual and system-level reduced motion keep every element visible. */
.reduce-motion [data-motion-reveal],
.reduce-motion [data-motion-reveal].is-revealed {
	opacity: 1;
	transform: none;
	transition: none;
}

.reduce-motion .hero-card-float {
	animation: none;
	transform: none;
	will-change: auto;
}

.reduce-motion .hero-card:hover,
.reduce-motion .project-card:hover,
.reduce-motion .service-card:hover,
.reduce-motion .contact-card:hover,
.reduce-motion .button:hover,
.reduce-motion .button:active,
.reduce-motion .text-link span,
.reduce-motion .service-card__link span,
.reduce-motion .contact-card__arrow,
.reduce-motion .service-card__number {
	transform: none;
}

.reduce-motion .cursor-trail-canvas {
	display: none;
}

@media (prefers-reduced-motion: reduce) {
	[data-motion-reveal],
	[data-motion-reveal].is-revealed {
		opacity: 1;
		transform: none;
		transition: none;
	}

	.hero-card-float {
		animation: none;
		transform: none;
		will-change: auto;
	}

	.hero-card:hover,
	.project-card:hover,
	.service-card:hover,
	.contact-card:hover,
	.button:hover,
	.button:active,
	.text-link span,
	.service-card__link span,
	.contact-card__arrow,
	.service-card__number {
		transform: none;
	}

	.cursor-trail-canvas {
		display: none;
	}
}
