.materials-listing {
	overflow: hidden;
	padding: 51px 0 70px;
	background: #dedee0;
}

.materials-listing__container {
	padding-inline: 16px;
}

.materials-section + .materials-section {
	margin-top: 59px;
}

.materials-family + .materials-family {
	margin-top: 82px;
}

.materials-family,
.materials-section,
.materials-panel {
	min-width: 0;
}

.materials-family__title {
	margin: 0 0 42px;
	font-size: 36px;
	font-weight: 400;
	line-height: 1.15;
	text-align: center;
}

.materials-family__title::after {
	display: block;
	width: 48px;
	height: 2px;
	margin: 12px auto 0;
	background: var(--brand-green);
	content: "";
}

.materials-section__title {
	margin: 0 0 24px;
	font-size: 30px;
	font-weight: 400;
	line-height: 1.18;
	text-align: center;
}

.materials-section__title::after {
	display: block;
	width: 48px;
	height: 2px;
	margin: 10px auto 0;
	background: var(--brand-green);
	content: "";
}

.materials-section--filtered .materials-section__title {
	margin-bottom: 16px;
}

.materials-section--filtered .materials-section__title::after {
	display: none;
}

.materials-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 12px 16px;
}

.material-swatch {
	display: block;
	width: 100%;
	aspect-ratio: 1.625 / 1;
	overflow: hidden;
	background: #c5c5c7;
}

.material-swatch img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 200ms ease;
}

.material-swatch--empty {
	background: linear-gradient(135deg, #b9b9bb, #e3e3e4);
}

.materials-tabs {
	display: flex;
	gap: 14px;
	margin: -12px -16px 16px;
	padding-inline: 16px;
	overflow-x: auto;
	scrollbar-width: none;
}

.materials-tabs::-webkit-scrollbar {
	display: none;
}

.materials-tabs__button {
	min-width: 112px;
	height: 36px;
	flex: 0 0 auto;
	padding: 5px 18px;
	border: 1px solid var(--gray-600);
	background: transparent;
	font-size: 14px;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
}

.materials-tabs__button--active,
.materials-tabs__button:hover,
.materials-tabs__button:focus-visible {
	border-color: var(--gray-900);
	color: var(--gray-white);
	background: var(--gray-900);
}

.materials-panel[hidden] {
	display: none;
}

.materials-listing__empty {
	margin: 0;
	text-align: center;
}

.materials-listing--frames {
	padding-top: 65px;
}

.materials-listing--frames .materials-section__title {
	font-size: clamp(30px, 9vw, 40px);
}

body.lightbox-open {
	overflow: hidden;
}

.material-lightbox {
	--lightbox-max-height: calc(100vh - 130px);
	position: fixed;
	z-index: 100000;
	inset: 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	align-items: center;
	padding: 56px 0 20px;
	background: rgba(0, 0, 0, 0.9);
}

@supports (height: 100dvh) {
	.material-lightbox {
		--lightbox-max-height: calc(100dvh - 130px);
	}
}

.material-lightbox[hidden] {
	display: none;
}

.material-lightbox__figure {
	position: relative;
	display: flex;
	min-width: 0;
	max-height: calc(100vh - 76px);
	max-height: calc(100dvh - 76px);
	align-items: center;
	flex-direction: column;
	justify-content: center;
	margin: 0;
}

.material-lightbox__image {
	width: auto;
	height: auto;
	max-width: 100%;
	max-height: var(--lightbox-max-height);
	object-fit: contain;
	transition: opacity 150ms ease;
}

/*
 * Landscape images share one width: as wide as a 3:2 frame that fits the screen.
 * The ratio values are set by page-materials.js after the image has loaded;
 * object-fit: cover trims the top and bottom of images narrower than the frame.
 */
.material-lightbox__image--landscape {
	width: min(100%, calc(var(--lightbox-max-height) * var(--lightbox-width-ratio)), var(--lightbox-max-width));
	max-width: none;
	max-height: none;
	aspect-ratio: var(--lightbox-ratio);
	object-fit: cover;
	object-position: center;
}

.material-lightbox.is-loading .material-lightbox__image {
	opacity: 0;
}

.material-lightbox.is-loading .material-lightbox__figure::before {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 36px;
	height: 36px;
	margin: -18px 0 0 -18px;
	border: 2px solid rgba(255, 255, 255, 0.25);
	border-top-color: var(--gray-white);
	border-radius: 50%;
	animation: material-lightbox-spin 800ms linear infinite;
	content: "";
}

@keyframes material-lightbox-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.material-lightbox.is-loading .material-lightbox__figure::before {
		animation-duration: 2400ms;
	}
}

.material-lightbox__caption {
	min-height: 24px;
	margin-top: 12px;
	color: var(--gray-white);
	font-size: 14px;
	text-align: center;
}

.material-lightbox__close,
.material-lightbox__previous,
.material-lightbox__next {
	display: grid;
	width: 44px;
	height: 44px;
	place-items: center;
	padding: 0;
	border: 0;
	color: var(--gray-white);
	background: rgba(0, 0, 0, 0.45);
	font-size: 40px;
	font-weight: 300;
	line-height: 1;
	cursor: pointer;
}

.material-lightbox__previous[hidden],
.material-lightbox__next[hidden] {
	display: none;
}

.material-lightbox__close:hover,
.material-lightbox__close:focus-visible,
.material-lightbox__previous:hover,
.material-lightbox__previous:focus-visible,
.material-lightbox__next:hover,
.material-lightbox__next:focus-visible {
	color: var(--brand-green);
	outline: 2px solid currentColor;
}

.material-lightbox__close {
	position: absolute;
	top: 8px;
	right: 8px;
	font-size: 34px;
}

/* On phones the arrows overlay the image so it can use the full width. */
.material-lightbox__previous,
.material-lightbox__next {
	position: absolute;
	z-index: 1;
	top: 50%;
	transform: translateY(-50%);
}

.material-lightbox__previous {
	left: 0;
}

.material-lightbox__next {
	right: 0;
}

@media (hover: hover) {
	.material-swatch:hover img {
		transform: scale(1.025);
	}
}

@media (min-width: 768px) {
	.material-lightbox {
		grid-template-columns: 64px minmax(0, 1fr) 64px;
		padding: 64px 24px 24px;
	}

	.material-lightbox__close {
		top: 18px;
		right: 24px;
	}

	.material-lightbox__previous,
	.material-lightbox__next {
		position: static;
		transform: none;
	}

	.material-lightbox__previous {
		grid-column: 1;
	}

	.material-lightbox__figure {
		grid-column: 2;
	}

	.material-lightbox__next {
		grid-column: 3;
	}

	.materials-listing {
		padding: 67px 0 103px;
	}

	.materials-listing--frames {
		padding-top: 67px;
	}

	.materials-listing__container {
		padding-inline: 20px;
	}

	.materials-section + .materials-section {
		margin-top: 63px;
	}

	.materials-family + .materials-family {
		margin-top: 100px;
	}

	.materials-family__title {
		margin-bottom: 54px;
		font-size: 42px;
	}

	.materials-section__title {
		margin-bottom: 24px;
		font-size: 36px;
	}

	.materials-listing--frames .materials-section__title {
		font-size: 40px;
	}

	.materials-section__title::after {
		margin-top: 14px;
	}

	.materials-grid {
		grid-template-columns: repeat(6, minmax(0, 1fr));
		gap: 24px;
		justify-content: start;
	}

	.materials-listing--frames .materials-grid {
		grid-template-columns: repeat(4, minmax(0, 216px));
		justify-content: center;
	}

	.materials-listing--fillings .materials-grid--compact {
		grid-template-columns: repeat(var(--material-count), minmax(0, calc((100% - 120px) / 6)));
		justify-content: center;
	}

	.materials-tabs {
		justify-content: center;
		gap: 24px;
		margin: 0 0 24px;
		padding: 0;
		overflow: visible;
	}

	.materials-tabs__button {
		min-width: 112px;
	}
}

@media (min-width: 1440px) {
	.materials-listing__container {
		max-width: 1392px;
		padding-inline: 0;
	}
}
