/* Layout: Bike grid */

.bike-grid__header {
	text-align: center;
}

/*
 * Filter over the cards (bike-grid.js). It ships `hidden` and the script shows
 * it; the second rule is what keeps that working, display: flex would win over
 * the browser's own [hidden].
 */
.bike-grid__filter {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--space-2xs);
	margin-bottom: var(--space-l);
}

.bike-grid__filter[hidden] {
	display: none;
}

/* A .button--ghost, one step down from the 54px of the buttons that act. */
.bike-grid__filter-button {
	min-height: 44px;
	padding-inline: 1.1em;
	font-size: var(--text-base);
}

/* Filled, so the pressed one differs in more than a shade; the tokens flip on dark grounds. */
.bike-grid__filter-button[aria-pressed="true"] {
	border-color: var(--color-accent);
	background-color: var(--color-accent);
	color: var(--color-accent-contrast);
}

.bike-grid__filter-button[aria-pressed="true"]:hover,
.bike-grid__filter-button[aria-pressed="true"]:focus-visible {
	border-color: var(--color-accent-hover);
	background-color: var(--color-accent-hover);
	color: var(--color-accent-contrast);
}

/* No text straight on the pattern: the others stay white, like the cards there. */
.section--bg-pattern .bike-grid__filter-button:not([aria-pressed="true"]) {
	background-color: var(--color-bg);
}

.section--bg-pattern .bike-grid__filter-button:not([aria-pressed="true"]):hover,
.section--bg-pattern .bike-grid__filter-button:not([aria-pressed="true"]):focus-visible {
	background-color: var(--color-surface-light);
}

.bike-grid__list {
	display: grid;
	gap: var(--space-l);
	margin: 0;
	padding: 0;
	list-style: none;
	grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr));
}

/*
 * auto-fit stretches whatever is there across the full container, so one or two
 * cards turn into banners. Cap the track width instead of the list — capping
 * the list does nothing, it already sits inside .container.
 *
 * One or two cards is what the filter leaves of a shop with a few models per
 * type, and bike-grid.js keeps data-count on what is visible.
 */
.bike-grid__list[data-count="1"],
.bike-grid__list[data-count="2"] {
	grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 30rem));
	justify-content: center;
}

/*
 * Styleguide: product cards are Nebelblau (the bike photos are cut-outs).
 * The muted text darkens with the card; the selector out-specifies the
 * light-card reset in base.css, which would set the default grey back.
 */
.bike-card {
	display: flex;
	height: 100%;
	flex-direction: column;
	padding: clamp(var(--space-m), 1rem + 2vw, var(--space-l));
	background: var(--color-surface-strong);
	border-radius: var(--radius-l);
}

.bike-grid__list .bike-card {
	--color-muted: var(--color-muted-on-mist);
}

/* On the pattern's grey the cards stay white, like every card on a pattern. */
.section--bg-pattern .bike-grid__list .bike-card {
	--color-muted: var(--color-muted-light);

	background: var(--color-bg);
}

.bike-card__title {
	margin-bottom: 0;
	font-size: var(--text-xl);
}

.bike-card__subtitle {
	margin-bottom: var(--space-m);
	font-size: var(--text-sm);
	font-weight: 700;
}

/*
 * One box shape for every card, the whole bike fitted into it — never
 * cropped. 16:10 sits between the photos' own ratios (1.5 to 1.78), so the
 * bikes line up at the same height whatever the upload's proportions.
 */
.bike-card__media {
	aspect-ratio: 16 / 10;
	/* Without it the box grows to an image's own ratio (the 3:2 Tourenvelo ran 12px taller). */
	min-height: 0;
	margin-bottom: var(--space-m);
}

.bike-card__image {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Price headline: "ab 29 CHF pro Tag" on one baseline. */
.bike-card__price {
	display: flex;
	align-items: baseline;
	justify-content: center;
	gap: 0.3em;
	margin-bottom: var(--space-3xs);
	flex-wrap: wrap;
}

.bike-card__price-prefix,
.bike-card__price-unit {
	font-size: var(--text-sm);
	font-weight: 600;
}

.bike-card__price-value {
	font-size: var(--text-xl);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.bike-card__price-note,
.bike-card__min {
	margin-bottom: var(--space-3xs);
	font-size: var(--text-sm);
	font-weight: 600;
	text-align: center;
}

.bike-card__min {
	margin-bottom: var(--space-l);
}

.bike-card__text {
	margin-bottom: var(--space-m);
}

/* Collapsible detail lists — native <details>, so they work without JS. */
.bike-card__details {
	border-top: 1px solid var(--color-text);
}

.bike-card__details:last-of-type {
	border-bottom: 1px solid var(--color-text);
}

.bike-card__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-s);
	padding-block: var(--space-2xs);
	cursor: pointer;
	font-size: var(--text-sm);
	font-weight: 700;
	list-style: none;
}

.bike-card__summary::-webkit-details-marker {
	display: none;
}

/* Chevron, rotated when open. */
.bike-card__icon {
	flex: 0 0 auto;
	width: 0.7em;
	height: 0.7em;
	border-right: 2px solid currentcolor;
	border-bottom: 2px solid currentcolor;
	transform: translateY(-0.2em) rotate(45deg);
	transition: transform var(--transition);
}

.bike-card__details[open] .bike-card__icon {
	transform: translateY(0.1em) rotate(-135deg);
}

.bike-card__panel {
	padding-bottom: var(--space-m);
	font-size: var(--text-sm);
}

.bike-card__pairs {
	display: grid;
	gap: 0.15em;
	margin: 0;
}

.bike-card__pair {
	display: grid;
	grid-template-columns: minmax(7rem, 40%) 1fr;
	gap: var(--space-2xs);
}

.bike-card__pair dt {
	color: var(--color-muted);
}

.bike-card__pair dd {
	margin: 0;
}

.bike-card__lines {
	margin: 0;
	padding-left: 1.1em;
}

.bike-card__lines li + li {
	margin-top: 0.15em;
}

/* Pushes the button to the bottom so cards of different length line up. */
.bike-card__action {
	margin: auto 0 0;
	padding-top: var(--space-l);
	text-align: center;
}
