* {
	box-sizing: border-box;
}

body {
	display: grid;
	/* minmax(0, 1fr) stops the long row of cards from widening the page. */
	grid-template-columns: minmax(0, 1fr);
	place-items: center;
	min-height: 100vh;
	margin: 0;
	padding: 1.5rem;
	background: #f4f4f6;
	font-family: system-ui, sans-serif;
	color: #1c1c22;
}

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

.shelf-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 1.25rem;
}

.shelf-title {
	margin: 0;
	font-size: 1.5rem;
}

.shelf-controls {
	display: flex;
	gap: 0.5rem;
}

.control {
	min-width: 2.75rem;
	height: 2.75rem;
	padding: 0 0.75rem;
	border: 2px solid #1c1c22;
	border-radius: 999px;
	background: #ffffff;
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.control-wide {
	min-width: 5.5rem;
}

.control:hover {
	background: #1c1c22;
	color: #ffffff;
}

.control:focus-visible,
.carousel:focus-visible {
	outline: 3px solid #2563eb;
	outline-offset: 3px;
}

/* A row of cards that scrolls sideways and snaps to the start of a card. */
.carousel {
	display: flex;
	gap: 1rem;
	margin: 0;
	padding: 0;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	list-style: none;
	border-radius: 1rem;
}

@media (prefers-reduced-motion: reduce) {
	.carousel {
		scroll-behavior: auto;
	}
}

/* Each card is a fixed share of the row, so two or three show at once. */
.card {
	flex: 0 0 min(14rem, 80%);
	padding: 1.5rem;
	border-radius: 1rem;
	scroll-snap-align: start;
}

.card-mango {
	background: #fef3c7;
}

.card-pineapple {
	background: #fef9c3;
}

.card-watermelon {
	background: #fce7f3;
}

.card-orange {
	background: #ffedd5;
}

.card-banana {
	background: #fefce8;
}

.card-pawpaw {
	background: #dcfce7;
}

.card-emoji {
	font-size: 2.5rem;
}

.card-title {
	margin: 0.75rem 0 0.25rem;
	font-size: 1.125rem;
}

.card-text {
	margin: 0;
	line-height: 1.5;
	color: #4b4b55;
}
