/* Home hero slider. Animations use transform/opacity only. */
.home-hero {
	--hh-teal: #57b3b7;
	--hh-teal-hover: #469ea2;
	--hh-btn: var(--at-btn, #377d81); /* buttons only; the headline highlight keeps --hh-teal */
	--hh-btn-hover: var(--at-btn-hover, #2f6c6f);
	--hh-dot: #61c7cb;
	--hh-dot-idle: #d6d6d6;
	--hh-ink: #020202;
	--hh-body: #252525;
	--hh-muted: #666;
	--hh-surface: #fefefe;
	--hh-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	padding: 24px clamp(16px, 4vw, 240px) 0;
	font-family: "Kalameh", Tahoma, sans-serif;
}

.home-hero__inner {
	max-width: 1440px;
	margin-inline: auto;
}

.home-hero__viewport {
	position: relative;
	container-type: inline-size;
	overflow: hidden;
	background: var(--hh-surface);
	border-radius: clamp(24px, 3.333vw, 48px);
	touch-action: pan-y;
}

.home-hero__slide {
	--u: calc(100cqw / 1440);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.6s var(--hh-ease), visibility 0s linear 0.6s;
}

.home-hero__slide.is-active {
	z-index: 1;
	opacity: 1;
	visibility: visible;
	transition: opacity 0.6s var(--hh-ease), visibility 0s;
}

/* ---------- Text ---------- */
.home-hero__title {
	margin: 0;
	color: var(--hh-ink);
	font-size: max(22px, calc(32 * var(--u)));
	font-weight: 600;
	line-height: 1.94;
}

.home-hero__title-line {
	display: block;
}

.home-hero__hl {
	color: var(--hh-teal);
}

.home-hero__text {
	margin: calc(10 * var(--u)) 0 0;
	color: var(--hh-body);
	font-size: max(15px, calc(24 * var(--u)));
	font-weight: 400;
	line-height: 1.73;
}

.home-hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 16px max(24px, calc(30 * var(--u)));
	margin-top: max(24px, calc(38 * var(--u)));
	padding-inline-start: 8px; /* room for the icon that overhangs the button edge */
}

/* ---------- Buttons ---------- */
.hh-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	min-height: max(40px, calc(48 * var(--u)));
	padding-block: 6px;
	padding-inline: max(28px, calc(33 * var(--u))) max(20px, calc(24 * var(--u)));
	border: 1.5px solid var(--hh-btn);
	border-radius: 999px;
	font-size: max(14px, calc(16 * var(--u)));
	font-weight: 400;
	line-height: 1.5;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.hh-btn--primary {
	background: var(--hh-btn);
	color: #fff;
}

.hh-btn--secondary {
	background: transparent;
	color: var(--hh-btn);
}

.hh-btn__icon {
	position: absolute;
	inset-inline-start: -8px;
	top: 50%;
	display: grid;
	place-items: center;
	width: max(28px, calc(32 * var(--u)));
	height: max(28px, calc(32 * var(--u)));
	margin-top: calc(max(28px, calc(32 * var(--u))) / -2);
	border-radius: 50%;
	overflow: hidden;
}

.hh-btn--primary .hh-btn__icon {
	background: #fff;
	box-shadow: 0 0 0 1px rgba(87, 179, 183, 0.25);
}

.hh-btn--secondary .hh-btn__icon {
	background: var(--hh-btn);
}

.hh-btn__icon img {
	display: block;
	width: 100%;
	height: 100%;
	transition: transform 0.3s var(--hh-ease);
}

.hh-btn:hover,
.hh-btn:focus-visible {
	box-shadow: 0 10px 24px -8px rgba(70, 158, 162, 0.55);
}

.hh-btn--primary:hover,
.hh-btn--primary:focus-visible {
	background: var(--hh-btn-hover);
	border-color: var(--hh-btn-hover);
}

.hh-btn--secondary:hover,
.hh-btn--secondary:focus-visible {
	background: rgba(87, 179, 183, 0.1);
	border-color: var(--hh-btn-hover);
	color: var(--hh-btn-hover);
}

.hh-btn:hover .hh-btn__icon img,
.hh-btn:focus-visible .hh-btn__icon img {
	transform: translateX(-4px);
}

.hh-btn:active .hh-btn__icon img {
	transform: translateX(-6px);
}

.hh-btn:focus-visible {
	outline: 2px solid var(--hh-ink);
	outline-offset: 3px;
}

/* ---------- Software: "+100 projects" ---------- */
.home-hero__projects {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 32px;
}

.home-hero__projects-logos {
	width: max(110px, calc(142 * var(--u)));
	height: auto;
}

.home-hero__projects-count {
	color: var(--hh-ink);
	font-size: max(18px, calc(24 * var(--u)));
	font-weight: 700;
}

.home-hero__projects-label {
	color: var(--hh-muted);
	font-size: max(14px, calc(18 * var(--u)));
}

/* ---------- Art + floating cards ---------- */
.home-hero__art {
	position: relative;
	container-type: inline-size;
}

.home-hero__art-img {
	display: block;
	width: 100%;
	height: auto;
	/* The exported art is a rectangular crop; fade its inner edge into the card. */
	-webkit-mask-image: linear-gradient(to left, transparent 0, #000 16%);
	mask-image: linear-gradient(to left, transparent 0, #000 16%);
}

.hh-card {
	--au: calc(100cqw / var(--art-w));
	position: absolute;
	top: calc(var(--cy) / 720 * 100%);
	left: calc(var(--cx, 0) / var(--art-w) * 100%);
	z-index: 2;
	max-width: calc(100% - 16px);
	animation: hh-float 5s ease-in-out infinite;
	animation-delay: calc(var(--d, 0) * -2.5s);
}

.hh-card--end {
	left: auto;
	right: calc(var(--cr) / var(--art-w) * 100%);
}

.hh-card__box {
	display: flex;
	align-items: center;
	gap: max(8px, calc(11 * var(--au)));
	min-height: max(48px, calc(60 * var(--au)));
	padding: max(8px, calc(10 * var(--au))) max(12px, calc(19 * var(--au))) max(8px, calc(10 * var(--au))) max(12px, calc(17 * var(--au)));
	background: #fff;
	border-radius: max(8px, calc(8 * var(--au)));
	box-shadow: 0 4px 20px rgba(17, 51, 56, 0.08), 0 1px 2px rgba(17, 51, 56, 0.06);
	transition: transform 0.35s var(--hh-ease);
}

.hh-card:hover .hh-card__box {
	transform: translateY(-4px) scale(1.02);
}

.hh-card__icon {
	flex: none;
	width: max(22px, calc(28 * var(--au)));
	height: auto;
}

.hh-card__body {
	display: flex;
	flex-direction: column;
	gap: max(2px, calc(6 * var(--au)));
	min-width: 0;
}

.hh-card__title {
	color: var(--hh-body);
	font-size: max(12px, calc(14 * var(--au)));
	font-weight: 600;
	line-height: 1.2;
}

.hh-card__text {
	color: var(--hh-muted);
	font-size: max(11px, calc(12 * var(--au)));
	line-height: 1.3;
}

/* ---------- Decorations (stage coordinates) ---------- */
.home-hero__deco {
	position: absolute;
	left: calc(var(--x) * var(--u));
	top: calc(var(--y) * var(--u));
	width: calc(var(--w) * var(--u));
	height: auto;
	pointer-events: none;
}

.home-hero__deco--drift {
	animation: hh-drift 6s ease-in-out infinite;
}

.home-hero__deco--twinkle {
	animation: hh-twinkle 3.2s ease-in-out infinite;
}

/* ---------- Pagination ---------- */
/* Pagination row: prev arrow (right in RTL), dots, next arrow (left). min-height reserves the 40px arrows' room
   before JS reveals them, so nothing shifts; the dots stay where they were (row centre = 16 + 20px from the top). */
.home-hero__nav {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 20px;
	min-height: 40px;
	padding-top: 16px;
}

.home-hero__dots {
	display: flex;
	justify-content: center;
	gap: 0; /* r17: was 4px; the dots' hit areas now abut (24px pitch) */
}

/* r17 (WCAG 2.5.8): the button itself is the transparent hit area, >= 24px wide (8px dot + 2 x 8px) and 40px tall
   (= the nav row's min-height, so the row stays 40px); the visible dot is drawn by ::before at its old size and colour. */
.home-hero__dot {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 40px;
	padding: 0 8px;
	border: 0;
	border-radius: 999px;
	background: none;
	cursor: pointer;
}

.home-hero__dot::before {
	content: "";
	display: block;
	width: 8px;
	height: 8px;
	border-radius: 999px;
	background: var(--hh-dot-idle);
}

.home-hero__dot:hover::before {
	background: #bdbdbd;
}

.home-hero__dot.is-active {
	cursor: default;
}

.home-hero__dot.is-active::before {
	width: 56px;
	background: var(--hh-dot);
}

.home-hero__dot:focus-visible {
	outline: none;
}

.home-hero__dot:focus-visible::before {
	outline: 2px solid var(--hh-ink);
	outline-offset: 3px;
}

/* ---------- Entrance stagger (only once JS is ready, so no-JS still shows content) ---------- */
.home-hero__inner.is-ready [data-hh-anim],
.home-hero__inner.is-ready .home-hero__art-img {
	transition: opacity 0.6s var(--hh-ease), transform 0.7s var(--hh-ease);
}

.home-hero__inner.is-ready .home-hero__slide:not(.is-active) [data-hh-anim] {
	opacity: 0;
	transform: translateY(18px);
	transition-delay: 0s;
}

.home-hero__inner.is-ready .home-hero__slide:not(.is-active) .home-hero__art-img {
	opacity: 0;
	transform: translateX(-24px) scale(0.98);
}

.home-hero__inner.is-ready .home-hero__slide.is-active [data-hh-anim] {
	transition-delay: calc(0.15s + var(--i, 0) * 0.1s);
}

.home-hero__inner.is-ready .home-hero__slide.is-active .home-hero__art-img {
	transition-delay: 0.1s;
}

.home-hero__inner.is-ready .home-hero__slide:not(.is-active) .hh-card__box {
	opacity: 0;
	transform: translateY(10px);
}

.home-hero__inner.is-ready .hh-card__box {
	transition: opacity 0.5s var(--hh-ease) 0.45s, transform 0.5s var(--hh-ease) 0.45s;
}

.home-hero__inner.is-ready .hh-card:hover .hh-card__box {
	transition-delay: 0s;
}

@keyframes hh-float {
	0%,
	100% {
		transform: translateY(0);
	}

	50% {
		transform: translateY(-6px);
	}
}

@keyframes hh-drift {
	0%,
	100% {
		transform: translate(0, 0);
	}

	50% {
		transform: translate(-6px, -4px);
	}
}

@keyframes hh-twinkle {
	0%,
	100% {
		opacity: 1;
		transform: scale(1) rotate(0deg);
	}

	50% {
		opacity: 0.55;
		transform: scale(0.85) rotate(12deg);
	}
}

/* ---------- Desktop stage (>= 992px): proportional 1440x720 layout ---------- */
@media (min-width: 992px) {
	.home-hero__viewport {
		aspect-ratio: 2 / 1;
	}

	.home-hero__slide {
		position: absolute;
		inset: 0;
	}

	.home-hero__content {
		position: absolute;
		top: 0;
		bottom: 0;
		right: calc(64 * var(--u));
		z-index: 1;
		display: flex;
		flex-direction: column;
		justify-content: center;
		width: calc(700 * var(--u));
	}

	.home-hero__art {
		position: absolute;
		top: 0;
		left: 0;
		width: calc(var(--art-w) * var(--u));
	}

	.home-hero__slide--software .home-hero__projects {
		position: absolute;
		right: 0;
		top: calc(619 * var(--u));
		margin: 0;
	}
}

/* ---------- Tablet / mobile: stacked ---------- */
@media (max-width: 991.98px) {
	.home-hero {
		padding-top: 16px;
	}

	.home-hero__viewport {
		display: grid;
		padding: 32px clamp(16px, 4vw, 40px) 24px;
	}

	.home-hero__slide {
		grid-area: 1 / 1;
		display: flex;
		flex-direction: column;
		gap: 24px;
	}

	.home-hero__title {
		font-size: clamp(20px, 3.4vw, 26px);
		line-height: 1.7;
	}

	.home-hero__text {
		font-size: clamp(15px, 2.2vw, 18px);
	}

	.home-hero__art {
		width: 100%;
		max-width: 520px;
		margin-inline: auto;
	}

	.home-hero__deco {
		display: none;
	}

	.home-hero__art-img {
		-webkit-mask-image: linear-gradient(to right, transparent 0, #000 10%, #000 90%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 6%, #000 94%, transparent 100%);
		mask-image: linear-gradient(to right, transparent 0, #000 10%, #000 90%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 6%, #000 94%, transparent 100%);
		-webkit-mask-composite: source-in;
		mask-composite: intersect;
	}

	.home-hero__nav {
		padding-top: 4px;
	}
}

@media (max-width: 479.98px) {
	.home-hero__title-line {
		display: inline;
	}

	.home-hero__title-line + .home-hero__title-line::before {
		content: " ";
	}

	.home-hero__actions {
		gap: 14px 20px;
	}

	.hh-btn {
		white-space: normal;
	}
}

/* ---------- First screen (no scroll): the whole hero (stage, CTAs, dots, arrows) fits below the header ----------
   --hh-avail = viewport height minus the header (113px desktop / 73px below 992px, incl. its 1px border) and the
   admin bar when shown. 100vh is the fallback; 100svh (small viewport, mobile URL bar shown) where supported, so
   it also fits on first load. The section becomes min-height: --hh-avail and centres its content; nothing is
   given a fixed height, so content can never be clipped (it just grows past the fold if it cannot fit).
   Desktop: the stage is a 2:1 box scaled by container units, so capping .home-hero__inner's width by the
   available height scales the whole slide proportionally. Tablet: the stacked art is capped by height instead.
   Phones (< 600px wide) and short viewports (< 600px tall) keep the previous auto height. Slide height is
   unaffected by slide changes (stage is aspect-ratio / grid-stacked as before). */
.home-hero {
	--hh-header: calc(113px + var(--wp-admin--admin-bar--height, 0px));
	--hh-avail: calc(100vh - var(--hh-header));
}

@supports (height: 100svh) {
	.home-hero {
		--hh-avail: calc(100svh - var(--hh-header));
	}
}

@media (max-width: 991.98px) {
	.home-hero {
		--hh-header: calc(73px + var(--wp-admin--admin-bar--height, 0px));
	}
}

@media (min-width: 600px) and (min-height: 600px) {
	.home-hero {
		box-sizing: border-box;
		display: flex;
		flex-direction: column;
		justify-content: center;
		min-height: var(--hh-avail);
		padding-bottom: 16px;
	}

	.home-hero__inner {
		width: 100%;
	}
}

/* Stage height = width / 2; reserve the section's 24px top + 16px bottom padding and the 56px pagination row. */
@media (min-width: 992px) and (min-height: 600px) {
	.home-hero__inner {
		max-width: min(1440px, calc((var(--hh-avail) - 96px) * 2));
	}
}

/* Art is at most 720/670 as tall as it is wide; 0.45 x --hh-avail keeps the stacked slide inside the first screen. */
@media (min-width: 600px) and (max-width: 991.98px) and (min-height: 600px) {
	.home-hero__art {
		max-width: min(520px, calc(var(--hh-avail) * 0.45));
	}
}

@media (prefers-reduced-motion: reduce) {
	.home-hero *,
	.home-hero *::before,
	.home-hero *::after {
		animation: none !important;
		transition-duration: 0.01ms !important;
		transition-delay: 0s !important;
	}
}
