/*
 * VoertuigWP · the one stylesheet for visitors.
 *
 * It follows the theme: font and colour are inherited, one accent colour falls back to the primary
 * colour of theme.json and else to the text colour. Every selector has one class of the plugin: it
 * wins over the element rules of a theme (h1, ul, main *), and a theme overrides it with one class of
 * its own, without !important (D-0087).
 */

.voertuigwp-page,
.voertuigwp-list,
.voertuigwp-vehicle {
	--voertuigwp-accent: var(--wp--preset--color--primary, currentColor);
	--voertuigwp-gap: 1.5rem;
	--voertuigwp-radius: 4px;
	--voertuigwp-muted: color-mix(in srgb, currentColor 65%, transparent);
	--voertuigwp-line: color-mix(in srgb, currentColor 15%, transparent);
	--voertuigwp-surface: color-mix(in srgb, currentColor 5%, transparent);
}

/* Some themes give every element in main a measure; the detail sets its own widths. */
.voertuigwp-list,
.voertuigwp-list :where(div, ul, li, p, h2, a, nav),
.voertuigwp-vehicle,
.voertuigwp-vehicle :where(div, section, ul, ol, li, dl, dt, dd, p, h1, h2, h3, a) {
	max-width: none;
}

/* The page in a classic theme. */
.voertuigwp-page {
	box-sizing: border-box;
	width: 100%;
	max-width: 1200px;
	margin-inline: auto;
	padding-inline: 1rem;
}

/* The detail: gallery, below it the summary on a phone; beside it from a tablet on. */
.voertuigwp-vehicle {
	display: grid;
	gap: var(--voertuigwp-gap);
	grid-template-columns: minmax(0, 1fr);
}

/* Two columns only with something on both sides (D-0092); :where() keeps one class to override. */
@media (min-width: 782px) {
	.voertuigwp-vehicle--split {
		grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
		align-items: start;
	}

	:where(.voertuigwp-vehicle--split) > .voertuigwp-vehicle__gallery {
		grid-column: 1;
		grid-row: 1;
	}

	:where(.voertuigwp-vehicle--split) > .voertuigwp-vehicle__aside {
		grid-column: 2;
		grid-row: 1 / span 2;
		position: sticky;
		top: calc(var(--wp-admin--admin-bar--height, 0px) + 1rem);
	}

	:where(.voertuigwp-vehicle--split) > .voertuigwp-vehicle__body {
		grid-column: 1;
	}
}

.voertuigwp-vehicle__aside > * + *,
.voertuigwp-vehicle__body > * + * {
	margin-top: calc(var(--voertuigwp-gap) * 1.5);
}

.voertuigwp-vehicle h2 {
	margin: 0 0 0.75rem;
	font-size: 1.5em;
	line-height: 1.25;
}

.voertuigwp-vehicle h3 {
	margin: 1.5rem 0 0.5rem;
	font-size: 1.1em;
	line-height: 1.3;
}

/* The gallery: a strip to swipe, one photo at a time. */
.voertuigwp-gallery__strip {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	margin: 0;
	padding: 0;
	list-style: none;
	border-radius: var(--voertuigwp-radius);
	background: var(--voertuigwp-surface);
}

.voertuigwp-gallery__slide {
	flex: 0 0 100%;
	scroll-snap-align: start;
	aspect-ratio: 4 / 3;
	margin: 0;
	padding: 0;
}

.voertuigwp-gallery__photo {
	display: block;
	width: 100%;
	max-width: none;
	height: 100%;
	object-fit: contain;
}

.voertuigwp-gallery__thumbs {
	display: flex;
	gap: 0.5rem;
	overflow-x: auto;
	scrollbar-width: thin;
	margin: 0.5rem 0 0;
	padding: 0 0 0.25rem;
	list-style: none;
}

.voertuigwp-gallery__thumbs li {
	flex: 0 0 auto;
	margin: 0;
	padding: 0;
}

.voertuigwp-gallery__thumbs a {
	display: block;
	border-radius: var(--voertuigwp-radius);
	outline-offset: 2px;
}

.voertuigwp-gallery__thumbs img {
	display: block;
	width: 96px;
	max-width: none;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--voertuigwp-radius);
}

.voertuigwp-gallery--empty {
	display: grid;
	place-items: center;
	aspect-ratio: 4 / 3;
	border-radius: var(--voertuigwp-radius);
	background: var(--voertuigwp-surface);
	color: var(--voertuigwp-muted);
}

.voertuigwp-gallery--empty p {
	margin: 0;
}

/* With the script: the controls, and full screen as the same strip with a class. */
.voertuigwp-gallery__controls {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin-top: 0.5rem;
}

.voertuigwp-gallery__controls[hidden] {
	display: none;
}

.voertuigwp-gallery__button {
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding: 0 0.5rem;
	border: 1px solid var(--voertuigwp-line);
	border-radius: var(--voertuigwp-radius);
	background: var(--wp--preset--color--base, #fff);
	color: inherit;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
}

.voertuigwp-gallery__count {
	margin-right: auto;
	font-variant-numeric: tabular-nums;
}

.voertuigwp-full {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 1rem;
	background: #000;
	color: #fff;
}

.voertuigwp-full .voertuigwp-gallery__strip {
	flex: 1;
	background: none;
}

.voertuigwp-full .voertuigwp-gallery__slide {
	aspect-ratio: auto;
}

.voertuigwp-full .voertuigwp-gallery__button {
	background: #000;
}

/* The summary. */
.voertuigwp-summary__title {
	margin: 0 0 0.75rem;
	font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
	line-height: 1.2;
	letter-spacing: normal;
	overflow-wrap: break-word;
	hyphens: auto;
}

/* An outline, no fill: the accent may be currentColor, which a fill with light text cannot follow (D-0092). */
.voertuigwp-badge {
	display: inline-block;
	padding: 0.1em 0.6em;
	border: 1px solid;
	border-radius: var(--voertuigwp-radius);
	color: var(--voertuigwp-accent);
	font-size: 0.875em;
	font-weight: 600;
	line-height: 1.5;
}

.voertuigwp-badge--sold {
	color: inherit;
	border-color: transparent;
	background: var(--voertuigwp-line);
}

.voertuigwp-price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.25rem 0.75rem;
	margin: 1rem 0;
}

.voertuigwp-price__now {
	font-size: 1.75em;
	font-weight: 700;
	line-height: 1.2;
	color: var(--voertuigwp-accent);
}

.voertuigwp-price__was,
.voertuigwp-price__vat {
	color: var(--voertuigwp-muted);
}

/* Key facts and specifications: label and value per row. */
.voertuigwp-facts,
.voertuigwp-specs__list {
	margin: 0;
	padding: 0;
}

.voertuigwp-facts {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.75rem 1rem;
}

.voertuigwp-facts dt,
.voertuigwp-specs__list dt {
	margin: 0;
	padding: 0;
	color: var(--voertuigwp-muted);
	font-weight: 400;
}

.voertuigwp-facts dt {
	font-size: 0.875em;
}

.voertuigwp-facts dd,
.voertuigwp-specs__list dd {
	margin: 0;
	padding: 0;
	font-weight: 600;
}

.voertuigwp-specs__list > div {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 1rem;
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--voertuigwp-line);
}

/* Accessories in columns. */
.voertuigwp-accessories__list {
	columns: 2 14rem;
	column-gap: var(--voertuigwp-gap);
	margin: 0;
	padding-left: 1.25em;
	list-style: disc;
}

.voertuigwp-accessories__list li {
	margin: 0 0 0.25em;
	break-inside: avoid;
}

/* The notice on a sold vehicle. */
.voertuigwp-sold {
	padding: 1rem;
	border: 1px solid var(--voertuigwp-line);
	border-radius: var(--voertuigwp-radius);
	background: var(--voertuigwp-surface);
}

.voertuigwp-sold p {
	margin: 0;
}

.voertuigwp-sold p + p {
	margin-top: 0.5rem;
}

.voertuigwp-sold a {
	color: var(--voertuigwp-accent);
	font-weight: 600;
}

/* The list: a grid that fills itself, cards of at least 260 px. */
.voertuigwp-list__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr));
	gap: var(--voertuigwp-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.voertuigwp-list__item {
	margin: 0;
	padding: 0;
}

.voertuigwp-list__empty {
	margin: 0;
	color: var(--voertuigwp-muted);
}

.voertuigwp-card {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	height: 100%;
}

.voertuigwp-card__link {
	color: inherit;
	text-decoration: none;
}

.voertuigwp-card__photo {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: var(--voertuigwp-radius);
	background: var(--voertuigwp-surface);
}

.voertuigwp-card__photo--empty {
	display: grid;
	place-items: center;
	color: var(--voertuigwp-muted);
}

.voertuigwp-card__title {
	margin: 0.75rem 0 0;
	font-size: 1.15em;
	line-height: 1.3;
}

.voertuigwp-card__link:hover .voertuigwp-card__title,
.voertuigwp-card__link:focus-visible .voertuigwp-card__title {
	text-decoration: underline;
}

.voertuigwp-card .voertuigwp-badge {
	align-self: flex-start;
}

.voertuigwp-card .voertuigwp-price {
	margin: 0;
}

.voertuigwp-card .voertuigwp-price__now {
	font-size: 1.25em;
}

.voertuigwp-card__facts {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	margin: auto 0 0;
	padding: 0;
	list-style: none;
	color: var(--voertuigwp-muted);
	font-size: 0.875em;
}

.voertuigwp-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-top: calc(var(--voertuigwp-gap) * 1.5);
}

.voertuigwp-pagination .page-numbers {
	padding: 0.25em 0.75em;
	border: 1px solid var(--voertuigwp-line);
	border-radius: var(--voertuigwp-radius);
}

.voertuigwp-pagination .current {
	background: var(--voertuigwp-accent);
	color: var(--wp--preset--color--base, #fff);
}

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