/**
 * Webreen Slider & Marquee - front-end styles.
 *
 * The layout does not depend on the Swiper stylesheet: the minimum required
 * `.swiper` rules are included below, so the markup stays readable even when
 * the library fails to load.
 *
 * @package Webreen\HeroSlider
 */

/* ------------------------------------------------------------------ *
 * Defaults
 * ------------------------------------------------------------------ */

/*
 * The custom properties live on a shared selector so the standalone
 * `[webreen_logo_marquee]` band can use the exact same values without
 * inheriting the slider's typography.
 */
.webreen-slider,
.webreen-marquee-standalone {
	--webreen-primary: #16a34a;
	--webreen-hero-height: 600px;
	--webreen-hero-height-mobile: 480px;
	--webreen-slide-overlay: 0.7;
	--webreen-logo-count: 5;
	--webreen-logo-count-mobile: 3;
	--webreen-logo-gap: 35px;
	--webreen-logo-height: 65px;
	--webreen-logo-background: #fff;
	--webreen-marquee-duration: 30s;
	--webreen-overlay: var(--webreen-slide-overlay);
	--webreen-gutter: clamp(20px, 5vw, 8%);
	--webreen-content-width: 900px;
}

.webreen-slider {
	position: relative;
	width: 100%;
	box-sizing: border-box;
	color: #fff;
	font-family: inherit;
	line-height: 1.5;
}

.webreen-slider *,
.webreen-slider *::before,
.webreen-slider *::after,
.webreen-marquee-standalone *,
.webreen-marquee-standalone *::before,
.webreen-marquee-standalone *::after {
	box-sizing: inherit;
}

/* Standalone band: keeps the layout identical to the one inside the slider. */
.webreen-marquee-standalone {
	display: block;
	position: relative;
	width: 100%;
	box-sizing: border-box;
	font-family: inherit;
	line-height: 1.5;
}

/* ------------------------------------------------------------------ *
 * Hero
 * ------------------------------------------------------------------ */

.webreen-hero {
	position: relative;
	width: 100%;
	overflow: hidden;
	background-color: #062b1b;
}

.webreen-hero__slide {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: var(--webreen-hero-height);
	padding: 0 var(--webreen-gutter);
	overflow: hidden;
	isolation: isolate;
}

/* No JS / no library: slides stack and stay readable. */
.webreen-slider:not(.webreen-slider--js) .webreen-hero__slide + .webreen-hero__slide {
	border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.webreen-hero__media {
	position: absolute;
	inset: 0;
	z-index: -2;
	display: block;
	overflow: hidden;
}

.webreen-hero__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center;
}

.webreen-hero__overlay {
	position: absolute;
	inset: 0;
	z-index: -1;
	background-color: #062b1b;
	opacity: var(--webreen-overlay);
}

.webreen-hero__content {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: var(--webreen-content-width);
	text-align: center;
}

.webreen-hero__slide--left .webreen-hero__content {
	margin-right: auto;
	text-align: left;
}

.webreen-hero__slide--right .webreen-hero__content {
	margin-left: auto;
	text-align: right;
}

.webreen-badge {
	display: inline-block;
	margin: 0 0 18px;
	padding: 6px 16px;
	border: 1px solid currentColor;
	border-radius: 999px;
	background-color: rgba(255, 255, 255, 0.18);
	background-color: color-mix(in srgb, var(--webreen-primary) 22%, transparent);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.webreen-title {
	margin: 0 0 16px;
	color: #fff;
	font-size: clamp(26px, 4.2vw, 46px);
	font-weight: 800;
	line-height: 1.22;
	text-shadow: 0 2px 24px rgba(0, 0, 0, 0.35);
}

.webreen-desc {
	margin: 0 0 28px;
	color: #e6edf3;
	font-size: clamp(15px, 1.5vw, 18px);
	line-height: 1.65;
}

.webreen-desc > :last-child {
	margin-bottom: 0;
}

.webreen-btn {
	display: inline-block;
	padding: 13px 32px;
	border: 0;
	border-radius: 6px;
	background-color: var(--webreen-primary);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: none;
	transition: filter 0.25s ease, transform 0.25s ease;
}

.webreen-btn:hover,
.webreen-btn:focus-visible {
	filter: brightness(1.12);
	transform: translateY(-2px);
}

.webreen-btn:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 3px;
}

/* ------------------------------------------------------------------ *
 * Entrance animations (only when the library is active)
 * ------------------------------------------------------------------ */

.webreen-slider--js .webreen-hero__slide .webreen-badge,
.webreen-slider--js .webreen-hero__slide .webreen-title,
.webreen-slider--js .webreen-hero__slide .webreen-desc,
.webreen-slider--js .webreen-hero__slide .webreen-btn {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.webreen-slider--js .webreen-hero__slide .webreen-badge {
	transition-delay: 0.05s;
}

.webreen-slider--js .webreen-hero__slide .webreen-title {
	transition-delay: 0.12s;
}

.webreen-slider--js .webreen-hero__slide .webreen-desc {
	transition-delay: 0.2s;
}

.webreen-slider--js .webreen-hero__slide .webreen-btn {
	transition-delay: 0.28s;
}

.webreen-slider--js .swiper-slide-active .webreen-badge,
.webreen-slider--js .swiper-slide-active .webreen-title,
.webreen-slider--js .swiper-slide-active .webreen-desc,
.webreen-slider--js .swiper-slide-active .webreen-btn {
	opacity: 1;
	transform: translateY(0);
}

/* ------------------------------------------------------------------ *
 * Minimal Swiper layout
 * ------------------------------------------------------------------ */

.webreen-slider--js .webreen-hero {
	height: var(--webreen-hero-height);
}

.webreen-slider--js .webreen-hero__slides {
	display: flex;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
	transition-timing-function: linear !important;
}

.webreen-slider--js .webreen-hero__slide {
	flex: 0 0 100%;
	width: 100%;
	min-height: 100%;
	height: 100%;
}

.webreen-slider--js .webreen-hero__slide--lazy .webreen-hero__image {
	/* Swiper adds `.swiper-slide-lazy` for deferred slides. */
	transition: none;
}

/* ------------------------------------------------------------------ *
 * Navigation
 * ------------------------------------------------------------------ */

.webreen-hero__nav {
	position: absolute;
	top: 50%;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: rgba(0, 0, 0, 0.35);
	color: #fff;
	cursor: pointer;
	transform: translateY(-50%);
	transition: background-color 0.25s ease, opacity 0.25s ease;
}

.webreen-hero__nav--prev {
	left: clamp(8px, 2vw, 28px);
}

.webreen-hero__nav--next {
	right: clamp(8px, 2vw, 28px);
}

.webreen-hero__nav:hover {
	background-color: var(--webreen-primary);
}

.webreen-hero__nav:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

.webreen-hero__nav.swiper-button-disabled {
	opacity: 0;
	pointer-events: none;
}

.webreen-hero__nav-icon {
	display: block;
	pointer-events: none;
}

.webreen-hero__pagination {
	position: absolute;
	bottom: 22px;
	left: 0;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
}

.webreen-hero__pagination .swiper-pagination-bullet {
	display: block;
	width: 10px;
	height: 10px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background-color: #fff;
	opacity: 0.45;
	cursor: pointer;
	transition: width 0.3s ease, opacity 0.3s ease, background-color 0.3s ease;
}

.webreen-hero__pagination .swiper-pagination-bullet-active {
	width: 26px;
	border-radius: 999px;
	background-color: var(--webreen-primary);
	opacity: 1;
}

/* ------------------------------------------------------------------ *
 * Logo marquee (pure CSS animation)
 * ------------------------------------------------------------------ */

.webreen-marquee {
	overflow: hidden;
	padding: 30px 0;
	border-bottom: 1px solid rgba(2, 44, 27, 0.08);
	background-color: var(--webreen-logo-background);
}

.webreen-marquee__track {
	display: flex;
	width: max-content;
	will-change: transform;
	animation: webreen-marquee-scroll var(--webreen-marquee-duration) linear infinite;
}

.webreen-marquee--reverse .webreen-marquee__track {
	animation-direction: reverse;
}

/* A single logo is not worth animating, so the track stays still. */
.webreen-marquee--static .webreen-marquee__track {
	animation: none;
	justify-content: center;
	width: 100%;
}

.webreen-marquee--static .webreen-marquee__list[aria-hidden="true"] {
	display: none;
}

.webreen-marquee--pausable:hover .webreen-marquee__track,
.webreen-marquee--pausable:focus-within .webreen-marquee__track {
	animation-play-state: paused;
}

.webreen-marquee__list {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	margin: 0;
	padding: 0;
	list-style: none;
}

.webreen-marquee__cell {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0 calc(var(--webreen-logo-gap) / 2);
	width: calc(100cqw / var(--webreen-logo-count));
}

.webreen-marquee {
	container-type: inline-size;
}

.webreen-marquee__item {
	display: flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}

.webreen-marquee__image {
	display: block;
	width: auto;
	height: auto;
	max-height: var(--webreen-logo-height);
	max-width: calc(100% - 10px);
	object-fit: contain;
	filter: none;
	transition: transform 0.3s ease, filter 0.3s ease;
}

.webreen-marquee--grayscale .webreen-marquee__image {
	filter: grayscale(1);
	opacity: 0.75;
}

.webreen-marquee--grayscale .webreen-marquee__item:hover .webreen-marquee__image,
.webreen-marquee--grayscale .webreen-marquee__item:focus-visible .webreen-marquee__image {
	filter: none;
	opacity: 1;
	transform: scale(1.06);
}

@keyframes webreen-marquee-scroll {
	from {
		transform: translateX(0);
	}

	to {
		transform: translateX(-50%);
	}
}

/* ------------------------------------------------------------------ *
 * Empty state
 * ------------------------------------------------------------------ */

.webreen-slider-empty {
	margin: 0;
	padding: 16px 20px;
	border-left: 4px solid var(--webreen-primary);
	background-color: #f1f5f9;
}

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

@media (max-width: 782px) {
	.webreen-slider--js .webreen-hero {
		height: var(--webreen-hero-height-mobile);
	}

	.webreen-hero__slide {
		min-height: var(--webreen-hero-height-mobile);
		justify-content: center;
		text-align: center;
	}

	.webreen-hero__slide--left .webreen-hero__content,
	.webreen-hero__slide--right .webreen-hero__content {
		margin: 0;
		text-align: center;
	}

	.webreen-hero__nav {
		display: none;
	}

	.webreen-marquee {
		padding: 20px 0;
	}

	.webreen-marquee__cell {
		width: calc(100cqw / var(--webreen-logo-count-mobile));
	}
}

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

@media (prefers-reduced-motion: reduce) {
	.webreen-marquee__track {
		animation: none;
	}

	.webreen-slider--js .webreen-hero__slide .webreen-badge,
	.webreen-slider--js .webreen-hero__slide .webreen-title,
	.webreen-slider--js .webreen-hero__slide .webreen-desc,
	.webreen-slider--js .webreen-hero__slide .webreen-btn {
		opacity: 1;
		transform: none;
		transition: none;
	}

	.webreen-btn:hover,
	.webreen-btn:focus-visible,
	.webreen-marquee__image {
		transition: none;
	}
}
