.le-inventory {
	/* Light by default; the dark switch swaps these. */
	--inv-background: var(--le-white);
	--inv-text: var(--le-black);
	--inv-line: var(--le-black);
	--inv-rule: rgb(0 0 0 / 0.25);
	--inv-box: rgb(0 0 0 / 0.14);
	--inv-fill: var(--le-100);
	--inv-muted: var(--le-500);
	--inv-frame: var(--le-200);
	--inv-skeleton: #f0f1f1; /* A loading card… */
	--inv-shine: #f8f9f9; /* …and the light sweeping across it. */

	padding: 9rem 0 5rem;
	color: var(--inv-text);
	background: var(--inv-background);
}

/*
 * Switching light / dark: every colour changes in the same instant (left to their own transitions, some parts
 * faded, some snapped, at different speeds, and the section flashed). Where the browser can, the switch is a
 * cross-fade of the whole section as one picture (a view transition, see equipment-inventory.js).
 */
.le-inventory.is-switching-theme,
.le-inventory.is-switching-theme * {
	transition: none !important;
}

.le-inventory.is-switching-theme {
	view-transition-name: le-inventory;
}

::view-transition-group(le-inventory),
::view-transition-old(le-inventory),
::view-transition-new(le-inventory) {
	animation-duration: 0.35s;
	animation-timing-function: ease;
}

/* The rest of the page doesn't change: no cross-fade for it. */
::view-transition-old(root),
::view-transition-new(root) {
	animation: none;
}

.le-inventory--dark {
	--inv-background: var(--le-black);
	--inv-text: var(--le-white);
	--inv-line: var(--le-white);
	--inv-rule: rgb(255 255 255 / 0.25);
	--inv-box: rgb(255 255 255 / 0.3);
	--inv-fill: var(--le-800);
	--inv-muted: var(--le-400);
	--inv-frame: var(--le-600);
	--inv-skeleton: var(--le-800);
	--inv-shine: #2e3031;
}

.le-inventory__icon {
	flex-shrink: 0;
	overflow: visible;
}

/* Header -------------------------------------------------------------------- */

.le-inventory__header {
	align-items: start;
	margin-bottom: 3.75rem;
}

.le-inventory__title {
	grid-column: 1 / span 8;
	color: inherit;
}

.le-inventory__themes {
	display: flex;
	grid-column: 9 / -1;
	justify-self: end;
}

.le-inventory .le-inventory__theme {
	display: grid;
	place-items: center;
	width: 1.875rem;
	height: 1.5rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	color: var(--inv-text);
	background: var(--inv-fill);
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
}

.le-inventory .le-inventory__theme[aria-pressed="true"] {
	color: var(--le-black);
	background: var(--le-blue);
}

.le-inventory__icon--light {
	width: 0.875rem;
	height: 0.875rem;
}

.le-inventory__icon--dark {
	width: 0.625rem;
	height: 0.625rem;
}

/* Sidebar on the left three columns, the cards across the rest. */
/*
 * A deliberate exception to the page grid (the user's call): the sidebar is a fixed width,
 * the mockup's 353px, and the cards take whatever is left.
 */
.le-inventory__body {
	--inv-sidebar: 22.0625rem;
	--inv-sticky-top: 5.5rem; /* Below the 4rem sticky navbar, plus breathing room. */

	grid-template-columns: var(--inv-sidebar) minmax(0, 1fr);
	column-gap: 1.5rem;
	align-items: start;
}

/*
 * The sidebar stays in view while the cards scroll. If it grows taller than the window
 * (several accordions open), it scrolls on its own (the script lets the wheel through then).
 * The small inline padding, cancelled by margin, keeps focus outlines from being clipped.
 */
.le-inventory__sidebar {
	position: sticky;
	top: var(--inv-sticky-top);
	display: flex;
	flex-direction: column;
	grid-column: 1;
	gap: 1.125rem;
	max-height: calc(100svh - var(--inv-sticky-top) - 1.5rem);
	margin: 0 -0.25rem;
	padding: 0 0.25rem 0.25rem;
	overflow-y: auto;
	overscroll-behavior: contain;
	scrollbar-width: thin;
}

.le-inventory__results {
	grid-column: 2;
}

/* Shared small type: the mono labels throughout the sidebar. */
.le-inventory .le-inventory__search input,
.le-inventory__sort-toggle,
.le-inventory__filter-label,
.le-inventory__chip {
	font-family: var(--le-font-mono);
	font-size: 0.6969rem;
	font-weight: 500;
	line-height: 1.27;
	letter-spacing: 0.0348rem;
	text-transform: uppercase;
}

/* Search -------------------------------------------------------------------- */

.le-inventory__search {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	height: 1.5rem;
	margin: 0;
	padding-inline: 0.5rem;
	border-top: 1px solid var(--inv-line);
	border-left: 1px solid var(--inv-line);
	cursor: text;
}

.le-inventory__icon--search {
	width: 0.9375rem;
	height: 0.9375rem;
}

.le-inventory .le-inventory__search input {
	flex: 1;
	min-width: 0;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	outline: 0;
	color: inherit;
	background: none;
	box-shadow: none;
	appearance: none;
}

.le-inventory__search input::placeholder {
	color: inherit;
	opacity: 1;
}

.le-inventory__search input::-webkit-search-cancel-button {
	appearance: none;
}

.le-inventory__search:focus-within {
	background: var(--inv-fill);
}

/* Sort ---------------------------------------------------------------------- */

.le-inventory__sort {
	position: relative;
	z-index: 2;
}

.le-inventory .le-inventory__sort-toggle {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	width: 100%;
	height: 1.625rem;
	margin: 0;
	padding: 0 0.5rem 0 0.25rem;
	border: 0;
	border-radius: 0;
	color: var(--inv-text);
	background: var(--inv-fill);
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s;
}

.le-inventory .le-inventory__sort-toggle[aria-expanded="true"] {
	color: var(--inv-background);
	background: var(--inv-text);
}

.le-inventory__icon--sort {
	width: 0.9375rem;
	height: auto;
}

.le-inventory__icon--chevron {
	width: 0.5625rem;
	height: auto;
	transition: transform 0.3s var(--le-ease-out);
}

.le-inventory__sort-toggle .le-inventory__icon--chevron {
	margin-left: auto;
}

.le-inventory__sort-toggle[aria-expanded="true"] .le-inventory__icon--chevron {
	transform: scaleY(-1);
}

/* The menu drops over whatever is below it. */
.le-inventory__sort-menu {
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	border: 0;
}

.le-js .le-inventory__sort-menu {
	position: absolute;
	top: 100%;
	right: 0;
	left: 0;
	border: 1px solid var(--inv-box);
	border-top: 0;
	background: var(--inv-background);
	box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.12);
	visibility: hidden;
	opacity: 0;
	transform: translateY(-0.25rem);
	transition: opacity 0.2s, transform 0.2s var(--le-ease-out), visibility 0s 0.2s;
}

.le-js .le-inventory__sort.is-open .le-inventory__sort-menu {
	visibility: visible;
	opacity: 1;
	transform: none;
	transition-delay: 0s;
}

.le-inventory__sort-option {
	position: relative;
	display: block;
	margin: 0;
	padding: 0.1875rem 0.5rem 0.1875rem 1.875rem;
	font-family: var(--le-font-sans);
	font-size: 1rem;
	line-height: 1.375rem;
	letter-spacing: -0.01rem;
	cursor: pointer;
}

.le-inventory__sort-option input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.le-inventory__sort-option:hover,
.le-inventory__sort-option:has(input:focus-visible) {
	background: var(--inv-fill);
}

.le-inventory__sort-option:has(input:checked) {
	background: var(--inv-fill);
}

/* The tick beside the chosen order. */
.le-inventory__sort-option:has(input:checked)::before {
	position: absolute;
	top: 50%;
	left: 0.625rem;
	width: 0.625rem;
	height: 0.3125rem;
	border-bottom: 1px solid currentColor;
	border-left: 1px solid currentColor;
	transform: translateY(-75%) rotate(-45deg);
	content: "";
}

/* Filters ------------------------------------------------------------------- */

.le-inventory__filters {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

.le-inventory__engaged {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.5rem;
}

.le-inventory__filter-label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0;
	padding-left: 0.25rem;
}

.le-inventory__icon--filter {
	width: 0.875rem;
	height: 0.875rem;
}

.le-inventory__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4375rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.le-inventory__chip {
	display: inline-flex;
	align-items: center;
	gap: 0.4375rem;
	padding: 0.25rem 0.375rem;
	color: var(--le-black);
	text-decoration: none;
	background: var(--le-blue);
	transition: opacity 0.2s;
}

.le-inventory__chip:hover,
.le-inventory__chip:focus-visible {
	color: var(--le-black);
	opacity: 0.75;
}

.le-inventory .le-inventory__chip--clear {
	color: var(--inv-text);
	background: var(--inv-fill);
}

.le-inventory__icon--close {
	width: 0.5rem;
	height: 0.5rem;
}

/* Accordions: one per service, its categories inside. */
.le-inventory__groups {
	display: flex;
	flex-direction: column;
	gap: 0.875rem;
}

.le-inventory__group-head {
	padding-bottom: 0.75rem;
}

/* The rule under a service sits on whatever closes it: the head when it has no categories, else the
   panel, which carries it down as it opens and back up as it closes. */
.le-inventory__group:not(:has(.le-inventory__group-panel)) .le-inventory__group-head {
	border-bottom: 1px solid var(--inv-rule);
}

/* The name and everything to its right, chevron included, is one button that opens the accordion.
   It reaches up and down into the row's spacing so it is easy to hit. */
.le-inventory .le-inventory__group-toggle {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	min-width: 0;
	margin: -0.4375rem 0;
	padding: 0.4375rem 0.5rem 0.4375rem 0;
	border: 0;
	border-radius: 0;
	font: inherit;
	letter-spacing: inherit;
	color: inherit;
	text-align: left;
	text-transform: none;
	background: none;
	cursor: pointer;
}

.le-inventory .le-inventory__group-toggle:focus-visible {
	outline: 1px solid var(--inv-line);
	outline-offset: -1px;
}

.le-inventory__group.is-open .le-inventory__group-toggle .le-inventory__icon--chevron {
	transform: scaleY(-1);
}

.le-inventory__group-panel {
	display: grid;
	grid-template-rows: 1fr;
	border-bottom: 1px solid var(--inv-rule);
	transition: grid-template-rows 0.5s var(--le-ease-out), border-color 0.3s;
}

.le-js .le-inventory__group:not(.is-open) .le-inventory__group-panel {
	grid-template-rows: 0fr;
}

/* The inner wrapper is what collapses, so the list's padding folds away with it. */
.le-inventory__group-inner {
	min-height: 0;
	overflow: hidden;
}

.le-inventory__categories {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	margin: 0;
	padding: 0.125rem 0 0.75rem;
	list-style: none;
}

.le-js .le-inventory__group:not(.is-open) .le-inventory__group-inner {
	visibility: hidden;
	transition: visibility 0s 0.5s;
}

/* A filter row: the checkbox (the only thing that ticks the filter) and the name. */
.le-inventory__row {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	margin: 0;
	font-family: var(--le-font-sans);
	font-size: 1rem;
	line-height: 1.375rem;
	letter-spacing: -0.01rem;
}

.le-inventory__row--service {
	font-size: 1.1875rem;
	font-weight: 600;
	line-height: 1.3125rem;
	letter-spacing: -0.0119rem;
}

.le-inventory__name {
	text-box: trim-both cap alphabetic;
}

.le-inventory .le-inventory__box {
	flex-shrink: 0;
	width: 1rem;
	height: 1rem;
	margin: 0;
	padding: 0;
	border: 1px solid var(--inv-box);
	border-radius: 0;
	background: transparent center / 100% no-repeat;
	box-shadow: none;
	cursor: pointer;
	appearance: none;
}

.le-inventory .le-inventory__box:checked {
	background-color: var(--le-blue);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.74 8.43l3.2 3.05 7.32-6.95' fill='none' stroke='black' stroke-width='.82' stroke-linejoin='round'/%3E%3C/svg%3E");
}

.le-inventory .le-inventory__box:focus-visible {
	outline: 1px solid var(--inv-line);
	outline-offset: 2px;
}

/* Cards --------------------------------------------------------------------- */

.le-inventory__list {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1.125rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.le-inventory .le-equipment-card__frame {
	border-color: var(--inv-frame);
}

.le-inventory .le-equipment-card__badge {
	color: var(--inv-text);
	background: var(--inv-fill);
}

.le-inventory .le-equipment-card__details {
	color: var(--inv-muted);
}

/* Loading: while a change's cards bring in their photos, each shows as a skeleton, a light sweeping across it. */
.le-inventory__results.is-loading .le-equipment-card__frame,
.le-inventory__results.is-loading .le-equipment-card__name,
.le-inventory__results.is-loading .le-equipment-card__details {
	background: linear-gradient(100deg, var(--inv-skeleton) 40%, var(--inv-shine) 50%, var(--inv-skeleton) 60%) 100% 0 / 300% 100%;
	animation: le-inventory-shimmer 1.2s linear infinite;
}

.le-inventory__results.is-loading .le-equipment-card__frame {
	border-color: transparent;
}

.le-inventory__results.is-loading .le-equipment-card__frame > * {
	visibility: hidden;
}

.le-inventory__results.is-loading .le-equipment-card__name,
.le-inventory__results.is-loading .le-equipment-card__details {
	width: fit-content;
	color: transparent;
}

@keyframes le-inventory-shimmer {
	to {
		background-position-x: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.le-inventory__results.is-loading .le-equipment-card__frame,
	.le-inventory__results.is-loading .le-equipment-card__name,
	.le-inventory__results.is-loading .le-equipment-card__details {
		background: var(--inv-skeleton);
		animation: none;
	}
}

.le-inventory__empty {
	margin: 0;
	padding-top: 1rem;
}

.le-inventory__empty a {
	margin-left: 0.5rem;
	color: inherit;
}

.le-inventory .le-pager {
	margin-top: 4.75rem;
}

.le-inventory--dark .le-pager__link {
	color: var(--le-white);
	background: var(--le-800);
}

.le-inventory--dark .le-pager__link img {
	filter: invert(1);
}

.le-inventory--dark a.le-pager__link:hover,
.le-inventory--dark a.le-pager__link:focus-visible {
	color: var(--le-white);
	background: var(--le-600);
}

.le-inventory--dark .le-pager__link.is-current {
	color: var(--le-black);
	background: var(--le-blue);
}

/* Narrower screens: the sidebar sits above the cards. */
@media (max-width: 1023px) {
	.le-inventory__body {
		grid-template-columns: minmax(0, 1fr);
	}

	.le-inventory__sidebar,
	.le-inventory__results {
		grid-column: 1;
	}

	.le-inventory__sidebar {
		position: static;
		max-height: none;
		overflow: visible;
	}

	.le-inventory__results {
		padding: 3rem 0 0;
	}

	.le-inventory__list {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 880px) {
	.le-inventory {
		padding: 3rem 0 3rem;
	}

	.le-inventory__header {
		margin-bottom: 2.25rem;
	}

	.le-inventory__title {
		grid-column: 1 / span 10;
	}

	.le-inventory__themes {
		grid-column: 11 / -1;
	}

	/* Easier to hit with a thumb. */
	.le-inventory__search,
	.le-inventory .le-inventory__sort-toggle {
		height: 2.25rem;
	}

	.le-inventory__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		row-gap: 2rem;
	}

	.le-inventory .le-pager {
		margin-top: 3rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.le-inventory__group-panel,
	.le-inventory__sort-menu,
	.le-inventory__icon--chevron {
		transition-duration: 0.01s !important;
	}
}

/* Cards off the current page, and chips or messages not in use, stay hidden whatever their display. */
.le-inventory [hidden] {
	display: none;
}
