/*
 * Home slider. One design unit (--u) is one pixel of the slider design:
 * a 1170x800 design at 480px and wider, a 480x450 design below. See
 * includes/class-slider.php for where the numbers come from.
 */

/* Its own stacking context: the slides' z-indexes stay inside, so page
   content that reaches up over the slider (the Home truck) stays on top. */
.kls-slider {
	container-type: inline-size;
	position: relative;
	isolation: isolate;
	width: 100%;
}

.kls-frame {
	--u: min(1px, 100cqw / 1170);
	--grid-w: 1170;
	position: relative;
	height: calc(800 * var(--u));
	overflow: hidden;
	background: #000;
}

@container (max-width: 479.98px) {
	.kls-frame {
		--u: calc(100cqw / 480);
		--grid-w: 480;
		height: calc(450 * var(--u));
	}
}

/* Slides: stacked. The incoming slide fades in on top of the previous one,
   which stays visible underneath (.is-prev) until the fade is done. */
.kls-slide {
	position: absolute;
	inset: 0;
	visibility: hidden;
}

.kls-slide.is-prev {
	z-index: 1;
	visibility: visible;
}

.kls-slide.is-active {
	z-index: 2;
	visibility: visible;
}

.kls-bg-wrap {
	position: absolute;
	inset: 0;
	overflow: hidden;
}

.kls-bg {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: 50% 50%;
}

/* Background entrance: from transparent, 102% and 4px blur in 1s (ease-in),
   plus a slow linear zoom to 105% over 5s that starts at 0.3s. */
.kls-slide.is-active .kls-bg-wrap {
	animation: kls-bg-in 1s cubic-bezier(0.55, 0.085, 0.68, 0.53) both;
}

.kls-slide.is-active .kls-bg {
	animation: kls-bg-zoom 5s linear 0.3s both;
}

@keyframes kls-bg-in {
	from { opacity: 0; transform: scale(1.02); filter: blur(4px); }
	to { opacity: 1; transform: none; filter: none; }
}

@keyframes kls-bg-zoom {
	from { transform: scale(1); }
	to { transform: scale(1.05); }
}

/* One black pixel per 3x3 tile, like the original dotted overlay. */
.kls-overlay {
	position: absolute;
	inset: 0;
	background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAYAAABWKLW/AAAAEElEQVR42mNgYGD4z0AQAAAjBAEAAa8irQAAAABJRU5ErkJggg==");
}

/* Layer area: the design grid, centred once the viewport is wider than it. */
.kls-grid {
	position: absolute;
	top: 0;
	bottom: 0;
	left: max(0px, (100cqw - 1170px) / 2);
	width: calc(var(--grid-w) * var(--u));
}

.kls-layer {
	position: absolute;
	left: calc(var(--x) * var(--u));
	top: calc(var(--y) * var(--u));
	white-space: nowrap;
}

.kls-layer.is-centred {
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
}

.kls-title {
	--x: var(--tx, 0);
	--y: var(--ty);
	--fs: var(--tfs);
	--lh: var(--tlh);
}

.kls-sub {
	--x: var(--sx, 0);
	--y: var(--sy);
	--fs: var(--sfs);
	--lh: var(--slh);
}

/* The two buttons sit under the subtitle: its top, its line, its padding and a gap. */
.kls-btns {
	--x: var(--sx, 0);
	--y: calc(var(--sy) + var(--slh) + 70);
	gap: calc(16 * var(--u));
}

@container (max-width: 479.98px) {
	.kls-layer {
		left: 0;
		right: 0;
		display: flex;
		justify-content: center;
	}

	.kls-title {
		--y: var(--ty-sm);
		--fs: var(--tfs-sm);
		--lh: var(--tlh-sm);
	}

	.kls-sub {
		--y: var(--sy-sm);
		--fs: var(--sfs-sm);
		--lh: var(--slh-sm);
	}

	.kls-btns {
		--y: calc(var(--sy-sm) + var(--slh-sm) + 70);
	}

	/* Two buttons do not fit a phone; its bottom bar already calls and chats. */
	.kls-btn:not(.kls-btn--main) {
		display: none;
	}
}

.kls-box {
	display: inline-block;
	padding: calc(20 * var(--u));
	border-radius: 5px;
	background: #fff;
	font-family: exo, sans-serif;
	font-size: calc(var(--fs) * var(--u));
	line-height: calc(var(--lh) * var(--u));
	letter-spacing: 0;
}

.kls-title .kls-box {
	color: #00aeef;
	font-weight: 700;
}

/* h1 on the first slide, h2 on the others (h3 before 0.4.0): all look the same. */
.kls-title :is(h1, h2, h3) {
	margin: 0;
	padding: 0;
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
	text-transform: none;
}

.kls-sub .kls-box {
	color: rgba(0, 0, 0, 0.9);
	font-weight: 400;
}

.kls-btns {
	display: flex;
}

.kls-btn {
	display: inline-block;
	padding: max(10px, calc(16 * var(--u))) max(16px, calc(28 * var(--u)));
	border: 2px solid #fff;
	border-radius: 5px;
	background: #fff;
	color: var(--kz-accent, #00aeef);
	font-family: exo, sans-serif;
	font-size: max(14px, calc(22 * var(--u)));
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.kls-btn--main {
	border-color: var(--kz-accent, #00aeef);
	background: var(--kz-accent, #00aeef);
	color: #fff;
}

.kls-btn:is(:hover, :focus-visible) {
	border-color: #0a2240;
	background: #0a2240;
	color: #fff;
}

/* Entrance: the title is revealed through a moving mask (mask from -100%,
   content from +175%), the subline slides in from -175% of its width. */
.kls-mask {
	display: inline-block;
	overflow: hidden;
}

.kls-slide.is-active .kls-title .kls-mask {
	animation: kls-from-left-full 1.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.6s both;
}

.kls-slide.is-active .kls-title .kls-box {
	animation: kls-from-right-far 1.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.6s both;
}

.kls-slide.is-active .kls-sub .kls-box {
	animation: kls-from-left-far 1.5s cubic-bezier(0.165, 0.84, 0.44, 1) 0.9s both;
}

.kls-slide.is-active .kls-btns {
	animation: kls-fade-in 0.8s ease 1.6s both;
}

@keyframes kls-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* Leaving: layers fade out quickly before the next slide fades in. */
.kls-slide.is-leaving .kls-layer {
	opacity: 0;
	transition: opacity 0.2s ease;
}

@keyframes kls-from-left-full {
	from { transform: translateX(-100%); }
	to { transform: none; }
}

@keyframes kls-from-right-far {
	from { transform: translateX(175%); }
	to { transform: none; }
}

@keyframes kls-from-left-far {
	from { transform: translateX(-175%); }
	to { transform: none; }
}

/* Bullets: 16px rings, 5px apart, 20px above the bottom edge. */
.kls-bullets {
	position: absolute;
	z-index: 2;
	bottom: 20px;
	left: 50%;
	display: flex;
	gap: 8px; /* 24px from dot to dot, so the 24px tap areas do not overlap (was 5px) */
	transform: translateX(-50%);
}

/* The dot is 16px; a transparent 4px border makes the tap area 24px (the
   minimum for fingers); the -4px margin keeps that border out of the layout. */
.kls-bullet {
	position: relative;
	overflow: hidden;
	box-sizing: content-box;
	width: 16px;
	height: 16px;
	margin: -4px;
	padding: 0;
	border: 4px solid transparent;
	background-clip: padding-box;
	border-radius: 50%;
	background: transparent;
	box-shadow: inset 0 0 0 2px #fff;
	cursor: pointer;
	transition: background 0.3s ease;
}

.kls-bullet:hover {
	background: rgba(0, 0, 0, 0.21);
}

.kls-bullet::after {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 0;
	background: #fff;
	box-shadow: 0 0 1px #fff;
	transition: height 0.3s ease;
}

.kls-bullet.is-active::after {
	height: 100%;
}

.kls-bullet:focus-visible {
	outline: 2px solid #00aeef;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.kls-slide.is-leaving .kls-layer {
		transition: none;
	}

	.kls-slide.is-active .kls-bg-wrap,
	.kls-slide.is-active .kls-bg,
	.kls-slide.is-active .kls-title .kls-mask,
	.kls-slide.is-active .kls-title .kls-box,
	.kls-slide.is-active .kls-sub .kls-box,
	.kls-slide.is-active .kls-btns {
		animation: none;
	}
}
