* {
	box-sizing: border-box;
}

body {
	display: grid;
	place-items: center;
	min-height: 100vh;
	margin: 0;
	padding: 1.5rem;
	background: #f4f4f6;
	font-family: system-ui, sans-serif;
	color: #1c1c22;
}

.gallery {
	width: min(40rem, 100%);
	padding: 2rem;
	border-radius: 1.5rem;
	background: #ffffff;
	box-shadow: 0 10px 30px -15px rgb(0 0 0 / 0.25);
}

.gallery-title {
	margin: 0 0 1.25rem;
	font-size: 1.75rem;
}

/* overflow: hidden crops the track, so only one slide shows through. */
.slider-window {
	overflow: hidden;
	border-radius: 1rem;
}

/* JavaScript moves the whole track sideways; transition animates it. */
.slider-track {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
	transition: transform 0.4s ease;
}

@media (prefers-reduced-motion: reduce) {
	.slider-track {
		transition: none;
	}
}

.slide {
	flex: 0 0 100%;
}

.slide figure {
	position: relative;
	margin: 0;
}

/* Scale the photo to the slide, and crop rather than squash it. */
.slide img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

/* A dark fade behind the caption keeps white text readable on any photo. */
.slide figcaption {
	position: absolute;
	inset: auto 0 0;
	padding: 2.5rem 1rem 0.875rem;
	background: linear-gradient(transparent, rgb(0 0 0 / 0.7));
	color: #ffffff;
}

.photo-credit {
	display: block;
	font-size: 0.75rem;
	opacity: 0.85;
}

.slider-controls {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 1rem;
}

.slider-count {
	margin: 0;
	font-variant-numeric: tabular-nums;
	color: #6b6b76;
}

.slider-button {
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	border: 2px solid #1c1c22;
	border-radius: 999px;
	background: #ffffff;
	font: inherit;
	font-size: 1.25rem;
	cursor: pointer;
}

.slider-button:hover {
	background: #1c1c22;
	color: #ffffff;
}

.slider-button:focus-visible {
	outline: 3px solid #2563eb;
	outline-offset: 3px;
}

.slider-dots {
	display: flex;
	justify-content: center;
	gap: 0.5rem;
	margin-top: 0.75rem;
}

/* The dot is small, but its padding makes it easy to tap. */
.dot {
	width: 1.75rem;
	height: 1.75rem;
	padding: 0.5rem;
	border: 0;
	border-radius: 999px;
	background: #d4d4da content-box;
	cursor: pointer;
}

/* The attribute screen readers use also styles the current dot. */
.dot[aria-current="true"] {
	background-color: #1c1c22;
}

.dot:focus-visible {
	outline: 3px solid #2563eb;
	outline-offset: 0;
}
