.element-slices {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	width: 100%;
	flex: 1 1 auto;
	min-height: 0;
}

/* Header: same language as the nav (muted → full colour, hover scale, clipped corners). */
.slices-header {
	display: flex;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.5rem 1rem;
	background: var(--nav);
	color: var(--nav-text);
	clip-path: var(--corner-path-small);
}

.element-slices[data-all-visible] > .slices-header {
	display: none;
}

.slices-tab {
	position: relative;
	padding: 0.35rem 1.25rem 0.5rem;
	background: transparent;
	color: var(--nav-text-muted);
	font-size: 1rem;
	text-transform: uppercase;
	cursor: pointer;
	transition: color 0.2s ease, transform 0.15s ease;
}

.slices-tab::after {
	content: '';
	position: absolute;
	left: 1.25rem;
	right: 1.25rem;
	bottom: 0;
	height: 0.15rem;
	background: currentColor;
	opacity: 0;
	transition: opacity 0.2s ease;
}

.slices-tab[data-visible] { color: var(--nav-text); }
.slices-tab[data-visible]::after { opacity: 1; }
.slices-tab:hover { transform: scale(1.1); }
.slices-tab:focus-visible { outline: 1px solid var(--nav-text); outline-offset: 2px; }

/* Viewport: native scroll-snap gives swipe + animation for free. */
.slices-viewport {
	position: relative;
	flex: 1 1 auto;
	min-height: 0;

	/* Extend to the screen edges; content stays inset by the page padding. */
	margin-inline: calc(-1 * var(--page-padding));
	padding-inline: var(--page-padding);
	scroll-padding-inline: var(--page-padding);

	overflow-x: auto;
	overflow-y: hidden;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	touch-action: pan-x pan-y;
	container: slices / inline-size;
}

.slices-viewport::-webkit-scrollbar { display: none; }

.slices-track {
	--slice-gap: var(--page-padding); /* neighbours sit exactly at the screen edge */
	display: flex;
	gap: var(--slice-gap);
	width: 100%;
	height: 100%;
}
.slices-track::after {
	content: '';
	flex: 0 0 1px;
	margin-left: -1px;
}

.slices-slice {
	display: flex;
	flex-direction: column;
	min-width: 0;
	flex: 0 0 22rem;
	scroll-snap-align: start;
	scroll-snap-stop: always; /* no skipping the middle slice */
}

.slices-slice[data-wide] {
	flex: 1 1 0;
}

/* Two at a time. Any two adjacent slices sum to exactly 100%, so a window never shows a clipped slice. */
@container slices (max-width: 67.99rem) {
	.slices-slice { flex: 0 0 calc((100% - var(--slice-gap)) * 0.4); }
	.slices-slice[data-wide] { flex: 0 0 calc((100% - var(--slice-gap)) * 0.6); }
}

/* One at a time. */
@container slices (max-width: 39.99rem) {
	.slices-slice,
	.slices-slice[data-wide] { flex: 0 0 100%; }
}