/* ============================================================
   AvestaTech — homepage sections
   The hero desktop and its macOS window, the Dock, the project
   cards, the process steps and the testimonial notifications.
   Only shipped on the front page.
   ============================================================ */

/* ---------- Hero: the desktop ---------- */

/* Hero fills the first viewport so the window + dock land without scrolling. */
.avesta-hero {
	position: relative;
	z-index: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding-inline: clamp(1.25rem, 4vw, 2.5rem);
	padding-top: calc(var(--wp--preset--spacing--50) - 20px) !important;
}

/* The desktop wallpaper. An in-flow layer (not fixed): it reaches up behind
   the floating header pill (--avesta-header-zone) so header + hero share one
   desktop, then scrolls away with the hero and fades into the page base.
   Homepage only — it is rendered by the hero pattern. */
.avesta-wallpaper {
	position: absolute;
	inset: calc(-1 * var(--avesta-header-zone)) 0 0;
	z-index: -1;
	pointer-events: none;
	background: url("../img/macos-tahoe-26-5120x2880-22675.jpg") center 20% / cover no-repeat;
	-webkit-mask-image: linear-gradient(180deg, #000 74%, transparent 99%);
	mask-image: linear-gradient(180deg, #000 74%, transparent 99%);
	transform: translate3d(0, var(--bg-shift, 0px), 0);
}

html[data-theme="dark"] .avesta-wallpaper {
	background-image: url("../img/macos-tahoe-26-5120x2880-22674.jpg");
}

/* Staggered load-in for hero copy */
@keyframes avesta-rise {
	from {
		opacity: 0;
		translate: 0 26px;
	}
}

html.js .avesta-hero-copy > * {
	animation: avesta-rise 700ms var(--avesta-ease) backwards;
}

html.js .avesta-hero-copy > :nth-child(1) { animation-delay: 60ms; }
html.js .avesta-hero-copy > :nth-child(2) { animation-delay: 160ms; }
html.js .avesta-hero-copy > :nth-child(3) { animation-delay: 260ms; }
html.js .avesta-hero-copy > :nth-child(4) { animation-delay: 360ms; }

/* macOS-style window. Cursor stays "default" here — real windows only show
   a drag cursor on the title bar (.avesta-window-bar). */
.avesta-hero-window {
	margin: 0;
	position: relative;
	padding: 3rem 1.4rem 1.4rem;
	rotate: -1.6deg;
	cursor: default;
	animation: avesta-float 8s ease-in-out infinite;
}

html.js .avesta-hero-window {
	animation: avesta-rise 800ms var(--avesta-ease) 300ms backwards,
		avesta-float 8s ease-in-out 1.1s infinite;
}

/* interactions.js takes over the window transform (drag + tilt + float);
   the CSS float keyframes must let go or the two fight over `transform`. */
html.js .avesta-hero-window.avesta-window--js {
	animation: avesta-rise 800ms var(--avesta-ease) 300ms backwards;
	will-change: transform;
}

.avesta-hero-window:hover {
	rotate: 0deg;
}

.avesta-window-bar {
	position: absolute;
	inset-block-start: 0;
	left: 0;
	right: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	/* The whole title-bar strip is the drag handle, like a real window;
	   the lights keep sitting at the physical left. */
	direction: ltr;
	padding: 1.05rem 1.4rem 0.6rem;
	cursor: grab;
}

.avesta-window-bar.is-dragging {
	cursor: grabbing;
}

.avesta-window-bar i {
	position: relative;
	inline-size: 12px;
	block-size: 12px;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
	cursor: pointer;
}

.avesta-window-bar i:nth-child(1) { background: #FF5F57; }
.avesta-window-bar i:nth-child(2) { background: #FEBC2E; }
.avesta-window-bar i:nth-child(3) { background: #28C840; }

/* On hover, real traffic-light buttons reveal their ×, −, + glyphs */
.avesta-window-bar i::after {
	content: "";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 9px;
	line-height: 1;
	font-weight: 700;
	color: rgba(0, 0, 0, 0.45);
	opacity: 0;
	transition: opacity 150ms ease;
}

.avesta-window-bar i:nth-child(1)::after { content: "\00d7"; }
.avesta-window-bar i:nth-child(2)::after { content: "\2212"; }
.avesta-window-bar i:nth-child(3)::after { content: "+"; }

.avesta-window-bar:hover i::after {
	opacity: 1;
}

/* The whole hero framed as one macOS window — real content, not a mock */
.avesta-hero-frame {
	max-inline-size: 84rem;
	margin-inline: auto;
	padding: 4.75rem 3rem 3.5rem;
	rotate: 0deg;
	display: grid;
	gap: var(--wp--preset--spacing--60);
	text-align: center;
	/* The Dock lives inside — icons need room to pop up on hover. */
	overflow: visible;
}

.avesta-hero-frame .avesta-hero-copy {
	display: grid;
	justify-items: center;
	gap: 1.5rem;
	max-inline-size: 52rem;
	margin-inline: auto;
}

.avesta-hero-frame .avesta-hero-copy p,
.avesta-hero-frame .avesta-display {
	margin: 0;
}

.avesta-hero-frame .avesta-display {
	font-size: clamp(2.75rem, 2.1rem + 3.2vw, 5.25rem) !important;
	text-wrap: balance;
}

.avesta-hero-frame .wp-block-buttons {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.85rem;
	margin-block-start: 1rem;
}

.avesta-hero-frame .wp-block-buttons .wp-block-button__link {
	padding: 0.6rem 1.35rem;
	font-size: 0.9rem;
}

/* ---------- Tech stack: an actual macOS Dock ---------- */

.avesta-dock {
	position: relative;
	display: flex;
	justify-content: center;
}

.avesta-dock-shadow {
	position: absolute;
	inset-block-end: -0.6rem;
	inset-inline: 10%;
	block-size: 1.4rem;
	border-radius: 50%;
	background: radial-gradient(closest-side, rgba(25, 28, 39, 0.22), transparent 75%);
	z-index: -1;
}

.avesta-dock-bar {
	position: relative;
	isolation: isolate;
	inline-size: 100%;
	max-inline-size: 48rem;
	padding: 1rem 1.1rem;
	border-radius: 2rem;
	background: transparent;
	box-shadow: var(--avesta-btn-shadow);
	transition: box-shadow 400ms var(--avesta-bounce), translate 400ms var(--avesta-bounce);
	/* Real Dock icons pop out above the shelf when magnified — don't clip. */
	overflow: visible;
}

/* Same three-layer liquid-glass recipe as the hero buttons: refraction,
   cursor-tracked specular, edge shine. --mx/--my are set by interactions.js. */
.avesta-dock-bar::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -3;
	border-radius: inherit;
	-webkit-backdrop-filter: blur(32px) saturate(220%);
	backdrop-filter: blur(32px) saturate(220%);
	filter: url(#avesta-liquid-glass);
}

.avesta-dock-bar::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -2;
	border-radius: inherit;
	background:
		radial-gradient(160% 130% at var(--mx, 50%) var(--my, -20%), var(--avesta-dock-specular, rgba(255, 255, 255, 0.4)), transparent 55%),
		var(--avesta-btn-tint-ghost);
	box-shadow:
		inset 2px 2px 1px 0 var(--avesta-btn-shine-hi),
		inset -1px -1px 1px 1px var(--avesta-btn-shine-lo);
	transition: background 250ms ease;
}

html[data-theme="dark"] .avesta-dock-bar::after {
	background:
		radial-gradient(160% 130% at var(--mx, 50%) var(--my, -20%), rgba(255, 255, 255, 0.08), transparent 55%),
		var(--avesta-btn-tint-ghost);
}

.avesta-dock:hover .avesta-dock-bar {
	box-shadow: var(--avesta-btn-shadow-hover);
}

.avesta-dock-row {
	position: relative;
	z-index: 2;
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: center;
	gap: 0.85rem;
}

.avesta-dock-icon {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	inline-size: 3.4rem;
	block-size: 3.4rem;
	border-radius: 24%;
	background: linear-gradient(165deg,
		color-mix(in srgb, var(--dock-color) 88%, white),
		var(--dock-color) 55%,
		color-mix(in srgb, var(--dock-color) 82%, black));
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.55),
		inset 0 -8px 10px -6px rgba(0, 0, 0, 0.28),
		0 6px 14px -6px color-mix(in srgb, var(--dock-color) 70%, transparent);
	color: #fff;
	cursor: default;
	transform-origin: bottom center;
	transition: translate 140ms var(--avesta-ease), scale 140ms var(--avesta-ease), box-shadow 140ms var(--avesta-ease);
}

/* CSS-only fallback hover — only for pointers that can actually hover
   (mouse/trackpad). Coarse/touch pointers (mobile) get sticky `:hover` on
   tap otherwise, which reads as a stray pop animation, not an interaction. */
@media (hover: hover) and (pointer: fine) {
	.avesta-dock-icon:hover {
		translate: 0 -0.85rem;
		scale: 1.3;
		z-index: 2;
		box-shadow:
			inset 0 1px 0 rgba(255, 255, 255, 0.65),
			inset 0 -8px 10px -6px rgba(0, 0, 0, 0.28),
			0 16px 26px -8px color-mix(in srgb, var(--dock-color) 65%, transparent);
	}

	html[data-theme="dark"] .avesta-dock-icon:hover {
		box-shadow:
			inset 0 1px 0 rgba(255, 255, 255, 0.25),
			inset 0 -8px 10px -6px rgba(0, 0, 0, 0.4),
			0 16px 26px -8px color-mix(in srgb, var(--dock-color) 65%, transparent);
	}
}

/* interactions.js drives real fisheye magnification: neighbors scale by
   cursor distance. It owns `transform`, so the CSS hover pop steps aside. */
.avesta-dock--js .avesta-dock-icon {
	transition: box-shadow 220ms var(--avesta-ease);
	will-change: transform;
}

.avesta-dock--js .avesta-dock-icon:hover {
	translate: none;
	scale: none;
}

.avesta-dock-icon:hover {
	z-index: 3;
}

.avesta-dock-icon svg {
	inline-size: 1.65rem;
	block-size: 1.65rem;
	fill: currentColor;
}

/* macOS-style label above the hovered icon */
.avesta-dock-tip {
	position: absolute;
	inset-block-end: calc(100% + 0.7rem);
	left: 50%;
	translate: -50% 6px;
	padding: 0.3rem 0.75rem;
	border-radius: 0.7rem;
	background: var(--avesta-glass-bg-strong);
	-webkit-backdrop-filter: blur(18px) saturate(180%);
	backdrop-filter: blur(18px) saturate(180%);
	border: 1px solid var(--avesta-glass-border);
	box-shadow: 0 0 0 1px var(--avesta-glass-ring), 0 8px 18px -10px rgba(25, 28, 39, 0.35);
	color: var(--wp--preset--color--contrast);
	font-size: 0.75rem;
	font-weight: 700;
	white-space: nowrap;
	direction: ltr;
	opacity: 0;
	pointer-events: none;
	/* Undo the parent icon's magnification so the label stays label-sized. */
	scale: calc(1 / var(--icon-scale, 1));
	transform-origin: bottom center;
	transition: opacity 160ms ease, translate 220ms var(--avesta-bounce);
}

.avesta-dock-icon:hover .avesta-dock-tip {
	opacity: 1;
	translate: -50% 0;
}

/* ---------- Process: glass steps + animated connectors ---------- */

.avesta-process-track {
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.avesta-step {
	flex: 1 1 0;
	min-inline-size: 0;
	padding: 2rem 1.5rem 1.75rem;
	block-size: 100%;
	rotate: var(--tilt, 0deg);
	text-align: center;
}

.avesta-step:hover {
	rotate: 0deg;
	box-shadow:
		0 0 0 1px var(--avesta-glass-ring),
		var(--avesta-shadow-hover),
		inset 0 1px 0 var(--avesta-glass-top);
}

.avesta-step-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin-block-end: 1.1rem;
	color: var(--wp--preset--color--primary);
	filter: drop-shadow(0 4px 10px color-mix(in srgb, var(--wp--preset--color--primary) 35%, transparent));
}

.avesta-step-icon svg {
	inline-size: 2.75rem;
	block-size: 2.75rem;
}

/* Connector arrow between steps — points toward reading direction (RTL,
   so mirrored) and draws itself in once when scrolled into view. Static
   after that — no looping motion, per the "no continuous decorative
   animation" rule. */
.avesta-process-arrow {
	flex: 0 0 auto;
	align-self: center;
	inline-size: 3rem;
	block-size: 2.75rem;
	color: var(--wp--preset--color--primary);
	opacity: 0.8;
}

.avesta-process-arrow svg {
	inline-size: 100%;
	block-size: 100%;
	transform: rotate(-45deg);
}

/* Default: fully visible, static — no-JS/crawlers see the complete arrow.
   Only when JS + scroll agree (html.js, below) does it hide and fade in. */
html.js .avesta-process-arrow-path {
	opacity: 0;
	transform: scale(0.6);
	transform-origin: center;
}

html.js .avesta-process-arrow.is-visible .avesta-process-arrow-path {
	animation: avesta-process-draw 420ms var(--avesta-ease) 120ms forwards;
}

@keyframes avesta-process-draw {
	to {
		opacity: 1;
		transform: scale(1);
	}
}

@media (max-width: 55rem) {
	.avesta-process-track {
		flex-direction: column;
		padding-inline: 1.25rem;
	}

	.avesta-step {
		flex: none;
		inline-size: 100%;
		block-size: auto;
	}

	.avesta-process-arrow {
		inline-size: 2.75rem;
		block-size: 3rem;
		align-self: center;
		margin-block: -0.5rem;
	}

	.avesta-process-arrow svg {
		transform: scaleX(-1) scaleY(-1) rotate(90deg);
	}
}

/* ---------- Testimonials: macOS Notification Center ---------- */

.avesta-testimonials {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 3rem;
}

.avesta-testimonials-copy {
	flex: 1 1 22rem;
	display: grid;
	gap: 1rem;
}

.avesta-testimonials-copy h2,
.avesta-testimonials-copy p {
	margin: 0;
}

.avesta-notif-stack {
	flex: 1 1 24rem;
	max-inline-size: 27rem;
	margin-inline: auto;
	display: grid;
	gap: 1rem;
}

.avesta-notif {
	display: flex;
	align-items: flex-start;
	gap: 0.9rem;
	padding: 0.95rem 1.1rem;
	border-radius: 1.35rem;
	rotate: var(--tilt, 0deg);
}

.avesta-notif:nth-child(1) { --tilt: -0.6deg; }
.avesta-notif:nth-child(2) { --tilt: 0.5deg; }
.avesta-notif:nth-child(3) { --tilt: -0.4deg; }

.avesta-notif:hover {
	rotate: 0deg;
	translate: 0 -2px;
}

.avesta-notif-icon {
	flex: 0 0 auto;
	display: grid;
	place-items: center;
	inline-size: 2.4rem;
	block-size: 2.4rem;
	border-radius: 0.75rem;
	background: linear-gradient(160deg,
		color-mix(in srgb, var(--wp--preset--color--primary) 80%, white),
		var(--wp--preset--color--primary));
	color: #fff;
	font-weight: 900;
	font-size: 1.05rem;
	box-shadow:
		inset 0 1px 0 rgba(255, 255, 255, 0.5),
		0 6px 12px -6px color-mix(in srgb, var(--wp--preset--color--primary) 70%, transparent);
}

html[data-theme="dark"] .avesta-notif-icon {
	color: var(--wp--preset--color--on-primary);
}

.avesta-notif-body {
	display: grid;
	gap: 0.2rem;
	min-inline-size: 0;
}

.avesta-notif-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.75rem;
	font-size: 0.85rem;
}

.avesta-notif-head strong {
	font-weight: 800;
}

.avesta-notif-head time {
	flex-shrink: 0;
	color: var(--wp--preset--color--muted);
	font-size: 0.72rem;
}

.avesta-notif-body p {
	margin: 0;
	font-size: 0.92rem;
	line-height: 1.7;
	color: var(--wp--preset--color--muted);
}

/* ---------- Float: the hero window's idle drift ---------- */

@keyframes avesta-float {
	50% {
		transform: translateY(-12px);
	}
}

/* ---------- Responsive ---------- */

@media (max-height: 760px) {
	.avesta-hero h1.avesta-display {
		font-size: clamp(1.8rem, 3.6vw, 2.6rem) !important;
	}

	.avesta-hero-frame {
		padding-block: 2.75rem 1.75rem;
	}
}

@media (max-width: 781px) {
	.avesta-hero-frame {
		rotate: 0deg;
		padding: 3.25rem 1.25rem 1.5rem;
	}

	.avesta-notif-stack {
		max-inline-size: 100%;
	}
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
	html.js .avesta-hero-copy > *,
	html.js .avesta-hero-window,
	.avesta-hero-window {
		animation: none;
	}

	.avesta-project-card:hover .wp-block-post-featured-image img {
		transform: none;
	}
}
