/**
 * Hero Slider widget.
 *
 * Motion thesis: a warehouse roller door. On each change the incoming photo
 * is revealed from the bottom up over the outgoing one (which dims as it is
 * covered), then the text rises in behind it. Slide tabs name each slide and
 * show the time left before the next one. Content is visible by default:
 * the animations only run when the script marks a slide as entering.
 */

.dw-hero {
	--dw-hero-height: min(84svh, 820px);
	--dw-hero-shade: 20, 25, 32; /* Overlay base (charcoal), as RGB. */
	position: relative;
	overflow: hidden;
	background: var(--dw-color-secondary-dark);
}

.dw-hero__swiper {
	height: var(--dw-hero-height);
	min-height: 520px;
}

/* Before Swiper initialises (or without JS), show only the first slide. */
.dw-hero__swiper:not(.swiper-initialized) .swiper-slide:not(:first-child) {
	display: none;
}

.dw-hero__slide {
	position: relative;
	display: flex;
	align-items: flex-end;
	height: 100%;
	overflow: hidden;
}

.dw-hero__bg {
	position: absolute;
	inset: 0;
	background: var(--dw-color-secondary-dark);
}

.dw-hero .dw-hero__img,
.dw-hero .dw-hero__video {
	/* Doubled class: beats Elementor's ".elementor img { height: auto }". */
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Slow zoom on the active slide. */
.dw-hero--zoom .dw-hero__img {
	transform: scale(1.02);
	transition: transform 9s linear, opacity 1.1s var(--dw-ease-in-out);
}

.dw-hero--zoom .swiper-slide-active .dw-hero__img,
.dw-hero--zoom .dw-hero__swiper:not(.swiper-initialized) .swiper-slide:first-child .dw-hero__img {
	transform: scale(1.1);
}

/*
 * Overlay: a light veil over the whole photo (the "Overlay Color" control),
 * plus shade only where the text and controls sit, so the photo stays
 * readable as a photo. Text areas stay well above 4.5:1.
 */
.dw-hero__overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(var(--dw-hero-shade), 0.3);
}

.dw-hero-gradient-yes .dw-hero__overlay {
	background-image:
		linear-gradient(90deg, rgba(var(--dw-hero-shade), 0.88) 0%, rgba(var(--dw-hero-shade), 0.66) 38%, rgba(var(--dw-hero-shade), 0.12) 78%, rgba(var(--dw-hero-shade), 0) 100%),
		linear-gradient(0deg, rgba(var(--dw-hero-shade), 0.72) 0%, rgba(var(--dw-hero-shade), 0) 38%);
}

[dir="rtl"] .dw-hero-gradient-yes .dw-hero__overlay {
	background-image:
		linear-gradient(-90deg, rgba(var(--dw-hero-shade), 0.88) 0%, rgba(var(--dw-hero-shade), 0.66) 38%, rgba(var(--dw-hero-shade), 0.12) 78%, rgba(var(--dw-hero-shade), 0) 100%),
		linear-gradient(0deg, rgba(var(--dw-hero-shade), 0.72) 0%, rgba(var(--dw-hero-shade), 0) 38%);
}

/* Centered slides: shade evenly instead of from the side. */
.dw-hero-gradient-yes .dw-hero__slide--center .dw-hero__overlay {
	background-image: radial-gradient(ellipse at 50% 60%, rgba(var(--dw-hero-shade), 0.78) 0%, rgba(var(--dw-hero-shade), 0.35) 75%);
}

.dw-hero__inner {
	position: relative;
	z-index: 2;
	display: flex;
	width: 100%;
	/* Bottom space keeps the text clear of the tabs and arrows. */
	padding-block: var(--dw-space-8) calc(var(--dw-space-8) + 5.5rem);
}

.dw-hero__slide--center .dw-hero__inner {
	justify-content: center;
	text-align: center;
}

.dw-hero__slide--end .dw-hero__inner {
	justify-content: flex-end;
	text-align: end;
}

.dw-hero__content {
	max-width: 820px;
}

/* ------------------------------------------------------------- Type */

.dw-hero .dw-hero__eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 0.875rem;
	margin-block-end: var(--dw-space-5);
	color: rgba(255, 255, 255, 0.86);
	font-size: var(--dw-fs-xs);
	font-weight: 600;
	letter-spacing: 0.18em;
}

/* A short call-to-action rule leads the label in. */
.dw-hero__eyebrow::before {
	content: "";
	flex: 0 0 auto;
	width: 28px;
	height: 2px;
	background: var(--dw-color-cta);
}

.dw-hero__slide--center .dw-hero__eyebrow::after {
	content: "";
	flex: 0 0 auto;
	width: 28px;
	height: 2px;
	background: var(--dw-color-cta);
}

.dw-hero__heading {
	margin-block-end: var(--dw-space-5);
	color: var(--dw-color-white);
	font-size: clamp(2.375rem, 1.2rem + 3.6vw, 4.5rem);
	font-weight: 800;
	font-stretch: 110%;
	line-height: 1.02;
	letter-spacing: -0.03em;
	text-wrap: balance;
}

.dw-hero__heading mark {
	background: none;
	color: var(--dw-color-accent);
}

.dw-hero__text {
	max-width: 34rem;
	margin-block-end: var(--dw-space-6);
	color: rgba(255, 255, 255, 0.84);
	font-size: var(--dw-fs-md);
	line-height: 1.6;
}

.dw-hero__slide--center .dw-hero__text {
	margin-inline: auto;
}

.dw-hero__slide--end .dw-hero__text {
	margin-inline-start: auto;
}

.dw-hero__buttons {
	display: flex;
	flex-wrap: wrap;
	gap: var(--dw-space-3);
}

.dw-hero__slide--center .dw-hero__buttons {
	justify-content: center;
}

.dw-hero__slide--end .dw-hero__buttons {
	justify-content: flex-end;
}

/* ----------------------------------------------------------- Motion */

/*
 * Roller door. Swiper's fade is neutralised; the slides stack instead:
 * the entering slide on top (revealed bottom-up), the leaving one under it.
 */
.dw-hero--door .swiper-slide {
	opacity: 1 !important;
	z-index: 0;
}

.dw-hero--door .swiper-initialized .swiper-slide:not(.swiper-slide-active):not(.is-leaving) {
	visibility: hidden;
}

.dw-hero--door .swiper-slide.is-leaving {
	z-index: 1;
}

.dw-hero--door .swiper-slide-active {
	z-index: 2;
}

.dw-hero--door .swiper-slide-active.is-entering .dw-hero__bg {
	animation: dw-hero-door 1.1s var(--dw-ease-in-out) both;
}

/* The covered photo dims as the door comes up over it. */
.dw-hero--door .dw-hero__img {
	transition: opacity 1.1s var(--dw-ease-in-out);
}

.dw-hero--door.dw-hero--zoom .dw-hero__img {
	transition: transform 9s linear, opacity 1.1s var(--dw-ease-in-out);
}

.dw-hero--door .is-leaving .dw-hero__img {
	opacity: 0.45;
}

.dw-hero--door .is-leaving .dw-hero__content {
	opacity: 0;
	transition: opacity 0.25s var(--dw-ease-out);
}

@keyframes dw-hero-door {
	from {
		clip-path: inset(100% 0 0 0);
	}

	to {
		clip-path: inset(0 0 0 0);
	}
}

/* Text arrives after the door: label, headline (rising out of a mask), copy, actions. */
.dw-hero__slide.is-entering .dw-hero__content > * {
	animation: dw-hero-rise 0.8s var(--dw-ease-out) backwards;
	animation-delay: calc(var(--dw-hero-lead, 0s) + var(--dw-hero-step, 0s));
}

.dw-hero__slide.is-entering .dw-hero__heading {
	--dw-hero-step: 0.08s;
	animation-name: dw-hero-headline;
	animation-duration: 1s;
}

.dw-hero__slide.is-entering .dw-hero__text {
	--dw-hero-step: 0.22s;
}

.dw-hero__slide.is-entering .dw-hero__buttons {
	--dw-hero-step: 0.32s;
}

@keyframes dw-hero-rise {
	from {
		opacity: 0;
		transform: translateY(14px);
	}
}

@keyframes dw-hero-headline {
	from {
		opacity: 0;
		transform: translateY(0.45em);
		clip-path: inset(0 0 100% 0);
	}

	60% {
		opacity: 1;
	}

	to {
		clip-path: inset(0 0 0 0);
	}
}

/* --------------------------------------------------------- Controls */

.dw-hero__controls {
	position: absolute;
	inset-inline: 0;
	bottom: var(--dw-space-6);
	z-index: 3;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--dw-space-6);
	pointer-events: none;
}

.dw-hero__controls > * {
	pointer-events: auto;
}

/* Slide tabs: topic label under a progress track. */
.dw-hero__tabs {
	display: grid;
	flex: 1 1 auto;
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	gap: var(--dw-space-5);
	max-width: 760px;
}

.dw-hero__tab {
	--dw-progress: 0;
	position: relative;
	min-height: 44px;
	padding: var(--dw-space-4) 0 0;
	border: 0;
	background: none;
	color: rgba(255, 255, 255, 0.6);
	font-family: var(--dw-font-heading);
	font-size: var(--dw-fs-xs);
	font-weight: 600;
	line-height: 1.35;
	text-align: start;
	transition: color 0.2s var(--dw-ease-out);
}

.dw-hero__tab:hover,
.dw-hero__tab[aria-current="true"] {
	color: var(--dw-color-white);
}

.dw-hero__tab:focus-visible {
	outline: 2px solid var(--dw-color-accent);
	outline-offset: 4px;
}

.dw-hero__tab-track {
	position: absolute;
	inset-inline: 0;
	top: 0;
	height: 2px;
	overflow: hidden;
	background: rgba(255, 255, 255, 0.24);
	transition: background-color 0.2s var(--dw-ease-out);
}

.dw-hero__tab:hover .dw-hero__tab-track {
	background: rgba(255, 255, 255, 0.45);
}

.dw-hero__tab-fill {
	position: absolute;
	inset: 0;
	background: var(--dw-color-white);
	transform: scaleX(var(--dw-progress));
	transform-origin: left center;
}

[dir="rtl"] .dw-hero__tab-fill {
	transform-origin: right center;
}

/* No autoplay: the current tab is simply marked. */
.dw-hero.is-static .dw-hero__tab[aria-current="true"] .dw-hero__tab-fill {
	transform: none;
}

.dw-hero__tab-label {
	display: block;
}

.dw-hero__buttons-nav {
	display: flex;
	flex: 0 0 auto;
	gap: var(--dw-space-2);
	margin-inline-start: auto;
}

.dw-hero__arrow {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	border: 1px solid rgba(255, 255, 255, 0.4);
	border-radius: 50%;
	background: transparent;
	color: var(--dw-color-white);
	transition:
		background-color 0.2s var(--dw-ease-out),
		border-color 0.2s var(--dw-ease-out),
		color 0.2s var(--dw-ease-out),
		transform var(--dw-duration-fast) var(--dw-ease-out);
}

.dw-hero__arrow:hover {
	border-color: var(--dw-color-white);
	background: var(--dw-color-white);
	color: var(--dw-color-secondary);
}

.dw-hero__arrow:active {
	transform: scale(0.94);
	transition-duration: 0.08s;
}

.dw-hero__arrow:focus-visible {
	outline: 2px solid var(--dw-color-accent);
	outline-offset: 3px;
}

[dir="rtl"] .dw-hero__prev .dw-icon,
[dir="rtl"] .dw-hero__next .dw-icon {
	transform: scaleX(-1);
}

.dw-hero__pause .dw-icon--play,
.dw-hero__pause.is-paused .dw-icon--pause {
	display: none;
}

.dw-hero__pause.is-paused .dw-icon--play {
	display: block;
}

/* ----------------------------------------------------------- Mobile */

@media (max-width: 767px) {
	.dw-hero__arrow:not(.dw-hero__pause) {
		display: none;
	}

	.dw-hero__buttons .dw-btn {
		flex: 1 1 100%;
	}

	/* Text spans the width here: shade from the bottom instead of the side. */
	.dw-hero-gradient-yes .dw-hero__overlay,
	[dir="rtl"] .dw-hero-gradient-yes .dw-hero__overlay {
		background-image: linear-gradient(0deg, rgba(var(--dw-hero-shade), 0.9) 0%, rgba(var(--dw-hero-shade), 0.62) 55%, rgba(var(--dw-hero-shade), 0.35) 100%);
	}

	/* The slider height becomes a minimum so stacked buttons never run into
	   the tabs / pause control, which get their own space below the content. */
	.dw-hero__swiper {
		height: auto;
		min-height: min(var(--dw-hero-height), 600px);
	}

	.dw-hero__swiper .swiper-wrapper,
	.dw-hero__slide {
		height: auto;
		min-height: inherit;
	}

	.dw-hero__inner {
		padding-block: var(--dw-space-8) calc(var(--dw-space-6) + 64px);
	}

	.dw-hero__eyebrow {
		margin-block-end: var(--dw-space-4);
	}

	/* Tabs become progress bars; labels stay for screen readers. */
	.dw-hero__tabs {
		gap: var(--dw-space-2);
		align-self: center;
	}

	.dw-hero__tab {
		min-height: 44px;
		padding: 0;
	}

	.dw-hero__tab-track {
		top: 50%;
		height: 3px;
		border-radius: 3px;
	}

	.dw-hero__tab-label {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		clip-path: inset(50%);
		white-space: nowrap;
	}
}

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

@media (prefers-reduced-motion: reduce) {
	.dw-hero--zoom .dw-hero__img {
		transition: none;
		transform: none !important;
	}

	.dw-hero__slide.is-entering .dw-hero__content > *,
	.dw-hero--door .swiper-slide-active.is-entering .dw-hero__bg {
		animation: none;
	}
}

/*
 * Floating header (Transparent layout) on the front page: the hero runs up
 * behind the header, so it gets taller, its text clears the header, and a
 * soft shade along the top keeps the white menu readable on bright photos.
 */
.home.dw-header-layout-2 .dw-hero {
	--dw-hero-height: min(94svh, 900px);
}

.home.dw-header-layout-2 .dw-hero__inner {
	padding-block-start: calc(var(--dw-space-8) + 88px);
}

.home.dw-header-layout-2 .dw-hero__overlay::after {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 200px;
	background: linear-gradient(180deg, rgba(var(--dw-hero-shade), 0.6) 0%, rgba(var(--dw-hero-shade), 0) 100%);
	pointer-events: none;
}

@media (max-width: 1099px) {
	.home.dw-header-layout-2 .dw-hero__inner {
		padding-block-start: calc(var(--dw-space-7) + 72px);
	}
}

/*
 * Short laptop screens (e.g. 1280×650 at 100% zoom): size the headline and
 * the space around it by the screen's height as well as its width, so the
 * whole first screen (headline, buttons, slide tabs) fits without zooming out.
 */
.dw-hero__heading {
	font-size: min(clamp(2.375rem, 1.2rem + 3.6vw, 4.5rem), 8.4svh);
}

.dw-hero__inner {
	padding-block: clamp(2rem, 7svh, 4rem) calc(5rem + clamp(1rem, 4svh, 2.5rem));
}

.home.dw-header-layout-2 .dw-hero__inner {
	padding-block-start: calc(80px + clamp(1.25rem, 5svh, 4rem));
}

.dw-hero__text {
	margin-block-end: clamp(1.25rem, 4svh, 2rem);
}

.dw-hero .dw-hero__eyebrow {
	margin-block-end: clamp(0.75rem, 2.5svh, 1.5rem);
}

/* Never shorter than its content on very short screens. */
.dw-hero__swiper {
	min-height: 0;
}

.dw-hero__swiper,
.dw-hero__swiper .swiper-wrapper {
	height: max(var(--dw-hero-height), 520px);
}

@media (max-width: 767px) {
	.dw-hero__heading {
		font-size: clamp(2.125rem, 1.5rem + 3vw, 2.75rem);
	}

	.dw-hero__swiper,
	.dw-hero__swiper .swiper-wrapper {
		height: auto;
	}

	.home.dw-header-layout-2 .dw-hero__inner {
		padding-block-start: calc(72px + var(--dw-space-6));
	}
}
