/* Shop-Übersicht, Kategorien, Suche – und Grundlagen für die Produktseite. Mobile-first. */

.shop__header {
	margin-bottom: var(--space-4);
}

/* Kategorie-Chips: mobil horizontal scrollbar */
.shop__cats {
	margin-bottom: var(--space-5);
}

.chip-list--scroll {
	position: relative;
	flex-wrap: nowrap;
	margin-inline: calc(-1 * var(--gutter));
	padding: var(--space-1) var(--gutter) var(--space-2);
	overflow-x: auto;
	scrollbar-width: thin;
}

.chip-list--scroll > li {
	flex: none;
}

/* Aufteilung: Filterleiste nur ab Desktop sichtbar */
.shop__layout {
	display: grid;
	gap: var(--space-6);
}

.shop__sidebar {
	display: none;
}

.shop__main {
	min-width: 0;
}

/* Werkzeugleiste: Anzahl, Filter, Sortierung */
.shop__toolbar {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-areas:
		"count count"
		"filter order";
	align-items: center;
	gap: var(--space-3);
	margin-bottom: var(--space-4);
}

.shop__count {
	grid-area: count;
	font-weight: var(--fw-semibold);
	color: var(--color-text-muted);
}

.shop__filter-btn {
	grid-area: filter;
	padding-inline: var(--space-4);
}

.shop__filter-count {
	display: inline-grid;
	place-items: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: var(--radius-pill);
	background: var(--color-brand);
	color: var(--color-text-inverse);
	font-size: var(--fs-xs);
}

.shop__ordering {
	grid-area: order;
	display: flex;
	gap: var(--space-2);
}

.shop__select {
	min-width: 0;
	padding-right: var(--space-6);
	appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
	background-size: 6px 6px;
	background-repeat: no-repeat;
}

.has-js .shop__ordering-submit {
	display: none;
}

.shop__active {
	margin-bottom: var(--space-4);
}

/* Produktraster */
.product-grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: var(--space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

.product-grid > li {
	display: flex;
}

/* Kompakte Karte im 2er-Raster (Smartphone): Warenkorb als Icon-Button neben dem Preis */
@media (max-width: 767px) {
	.product-grid .product-card__media {
		padding: var(--space-2);
	}

	.product-grid .product-card__body {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		align-content: start;
		gap: var(--space-2);
		padding: var(--space-3);
	}

	.product-grid .product-card__body > :not(.product-card__price, .product-card__action) {
		grid-column: 1 / -1;
	}

	.product-grid .product-card__title {
		font-size: var(--fs-sm);
	}

	.product-grid .availability {
		font-size: var(--fs-xs);
	}

	.product-grid .product-card__price {
		align-self: end;
		margin-top: 0;
		font-size: var(--fs-md);
	}

	.product-grid .product-card__price del {
		display: block;
		margin: 0;
	}

	.product-grid .product-card__action {
		align-self: end;
	}

	.product-grid .product-card__action .btn {
		width: var(--tap);
		min-height: var(--tap);
		padding: 0;
	}

	.product-grid .product-card__action [data-label],
	.product-grid .product-card__action .btn--secondary {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
	}

	/* „Details ansehen“ ohne Icon: als Pfeil-Link über die ganze Karte statt Button */
	.product-grid .product-card__action:has(.btn--secondary) {
		display: none;
	}

	.product-grid .product-card__body {
		grid-auto-rows: auto;
	}
}

/* Kein Ergebnis */
.shop__empty {
	display: grid;
	gap: var(--space-4);
	justify-items: start;
	padding: var(--space-6) var(--space-5);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-surface);
}

.shop__empty-title {
	font-size: var(--fs-h3);
	color: var(--color-anthracite);
}

.shop__empty-help {
	color: var(--color-text-muted);
}

/* Filter (Seitenleiste und Dialog) */
.filters {
	display: grid;
	gap: var(--space-5);
}

.offcanvas__body .filters {
	padding: var(--space-4);
}

.filters__title {
	margin-bottom: var(--space-2);
	font-family: var(--font-body);
	font-size: var(--fs-xs);
	font-weight: var(--fw-bold);
	letter-spacing: var(--tracking-caps);
	text-transform: uppercase;
	color: var(--color-text-muted);
}

.filters__list {
	display: grid;
	gap: 2px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.filters__option {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	min-height: var(--tap);
	padding: var(--space-1) var(--space-3);
	border-radius: var(--radius-sm);
	color: var(--color-text);
	text-decoration: none;
}

.filters__option:hover {
	background: var(--color-surface-sunken);
	color: var(--color-brand);
}

.filters__option[aria-current] {
	background: var(--color-anthracite);
	color: var(--color-text-inverse);
	font-weight: var(--fw-semibold);
}

.filters__option .icon {
	width: 18px;
	height: 18px;
}

.filters__option--back {
	color: var(--color-text-muted);
}

.filters__count {
	margin-left: auto;
	font-size: var(--fs-xs);
	color: inherit;
	opacity: 0.75;
}

/* Filter-Dialog von rechts */
.offcanvas--right {
	inset: 0 0 0 auto;
	transform: translateX(100%);
}

.offcanvas--right[open] {
	transform: none;
}

@starting-style {
	.offcanvas--right[open] {
		transform: translateX(100%);
	}
}

/* Tablet */
@media (min-width: 768px) {
	.shop__toolbar {
		grid-template-columns: minmax(0, 1fr) auto auto;
		grid-template-areas: "count filter order";
	}

	.product-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
		gap: var(--space-4);
	}
}

/* Desktop: Filterleiste links */
@media (min-width: 1024px) {
	.shop__layout {
		grid-template-columns: 240px minmax(0, 1fr);
		gap: var(--space-7);
	}

	.shop__sidebar {
		display: block;
	}

	/* Kategorien stehen am Desktop in der Filterleiste */
	.shop__cats {
		display: none;
	}

	.shop__toolbar {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas: "count order";
	}

	.shop__filter-btn {
		display: none;
	}
}

@media (min-width: 1360px) {
	.product-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* ---------- Produktseite ---------- */

.product-page {
	padding-top: var(--space-4);
}

.product-page__crumbs {
	margin-bottom: var(--space-3);
}

.product-page__top {
	display: grid;
	gap: var(--space-5);
}

/* Galerie */
.gallery {
	min-width: 0;
}

.gallery__track {
	display: flex;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	overscroll-behavior-x: contain;
	scrollbar-width: none;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-lg);
	background: var(--color-surface);
}

.gallery__track::-webkit-scrollbar {
	display: none;
}

.gallery__track:focus-visible {
	outline-offset: 2px;
}

.gallery__slide {
	flex: 0 0 100%;
	aspect-ratio: 1;
	margin: 0;
	padding: var(--space-5);
	scroll-snap-align: center;
}

.gallery__zoom {
	display: block;
	height: 100%;
	border-radius: var(--radius-sm);
	cursor: zoom-in;
}

.gallery__slide img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.gallery__thumbs {
	display: flex;
	gap: var(--space-2);
	margin: var(--space-3) 0 0;
	padding: 0;
	list-style: none;
	overflow-x: auto;
}

.gallery__thumb {
	display: block;
	width: 64px;
	height: 64px;
	padding: var(--space-1);
	border: 2px solid var(--color-border);
	border-radius: var(--radius-sm);
	background: var(--color-surface);
}

.gallery__thumb[aria-current] {
	border-color: var(--color-brand);
}

.gallery__thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

/* Kaufbereich */
.buy-box {
	display: grid;
	gap: var(--space-4);
	align-content: start;
	min-width: 0;
}

.buy-box__brand {
	font-size: var(--fs-sm);
	font-weight: var(--fw-bold);
	letter-spacing: var(--tracking-caps);
	text-transform: uppercase;
}

.buy-box__brand a {
	color: var(--color-text-muted);
	text-decoration: none;
}

.buy-box__brand a:hover {
	color: var(--color-brand);
	text-decoration: underline;
}

.buy-box__title {
	margin-top: calc(-1 * var(--space-2));
	font-size: clamp(2rem, 1.6rem + 1.4vw, 2.75rem);
	color: var(--color-anthracite);
	overflow-wrap: anywhere;
}

.buy-box__sku {
	font-size: var(--fs-sm);
	color: var(--color-text-muted);
}

.buy-box__sku-value {
	margin-left: var(--space-1);
	font-weight: var(--fw-bold);
	font-variant-numeric: tabular-nums;
	color: var(--color-anthracite);
	user-select: all;
}

.buy-box__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: var(--space-1) var(--space-3);
}

.buy-box__price .price {
	font-size: var(--fs-h3);
	font-weight: var(--fw-bold);
	line-height: 1.1;
	font-variant-numeric: tabular-nums;
}

.buy-box__price del {
	margin-right: var(--space-2);
	font-size: var(--fs-md);
	font-weight: var(--fw-regular);
	color: var(--color-text-muted);
}

.buy-box__price ins {
	color: var(--color-brand);
	text-decoration: none;
}

.badge--inline {
	position: static;
	align-self: center;
}

.buy-box__tax {
	flex-basis: 100%;
	font-size: var(--fs-sm);
	color: var(--color-text-muted);
}

/* Verfügbarkeit, groß */
.stock-box {
	display: grid;
	grid-template-columns: 28px minmax(0, 1fr);
	gap: var(--space-3);
	align-items: start;
	padding: var(--space-3) var(--space-4);
	border-radius: var(--radius-md);
}

.stock-box .icon {
	width: 28px;
	height: 28px;
}

.stock-box--pickup {
	background: var(--color-success-bg);
	color: var(--color-success);
}

.stock-box--order {
	background: var(--color-warning-bg);
	color: var(--color-warning);
}

.stock-box__title {
	font-size: var(--fs-md);
	font-weight: var(--fw-bold);
	line-height: var(--lh-tight);
}

.stock-box__text {
	margin-top: 2px;
	font-size: var(--fs-sm);
	color: var(--color-text);
}

/* Formular */
.buy-box__form {
	display: flex;
	flex-wrap: wrap;
	gap: var(--space-3);
}

.buy-box__submit {
	flex: 1 1 11rem;
	min-height: 52px;
	padding-inline: var(--space-4);
	font-size: var(--fs-md);
	white-space: nowrap;
}

.buy-box__form .qty-field {
	height: 52px;
}

.buy-box__form .qty-field__btn {
	width: var(--tap);
}

.buy-box__form .qty-field__input {
	width: 3rem;
}

/* Mobil: Produktname nicht doppelt in den Brotkrümeln (steht direkt darunter als Überschrift) */
@media (max-width: 767px) {
	.product-page .breadcrumb__item:last-child {
		display: none;
	}
}

.buy-box__call {
	display: grid;
	gap: var(--space-3);
	justify-items: start;
	padding: var(--space-4);
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
}

/* Lieferung & Abholung */
.pickup-note {
	display: grid;
	gap: var(--space-4);
	padding: var(--space-4);
	border: 1px solid var(--color-border);
	border-left: 4px solid var(--color-brand);
	border-radius: var(--radius-md);
	background: var(--color-surface);
	font-size: var(--fs-sm);
}

.pickup-note__title {
	display: flex;
	align-items: center;
	gap: var(--space-2);
	font-size: var(--fs-base);
	font-weight: var(--fw-bold);
}

.pickup-note__title .icon {
	width: 20px;
	height: 20px;
	color: var(--color-brand);
}

.pickup-note__row {
	display: grid;
	gap: var(--space-1);
}

.pickup-note__help {
	color: var(--color-text-muted);
}

.pickup-note__help a {
	display: inline-flex;
	align-items: center;
	min-height: var(--tap);
	margin-block: calc((var(--tap) - 1.5em) / -2);
	font-weight: var(--fw-bold);
}

/* Beschreibung und technische Daten */
.product-details {
	display: grid;
	gap: var(--space-6);
	margin-top: var(--space-7);
}

.product-details__title {
	margin-bottom: var(--space-4);
	font-size: var(--fs-h3);
	color: var(--color-anthracite);
}

.specs {
	margin: 0;
	border: 1px solid var(--color-border);
	border-radius: var(--radius-md);
	background: var(--color-surface);
	overflow: hidden;
}

.specs__row {
	display: grid;
	grid-template-columns: minmax(7rem, 40%) minmax(0, 1fr);
	gap: var(--space-4);
	padding: var(--space-3) var(--space-4);
}

.specs__row:nth-child(even) {
	background: var(--color-bg);
}

.specs dt {
	font-weight: var(--fw-semibold);
	color: var(--color-text-muted);
}

.specs dd {
	margin: 0;
	font-variant-numeric: tabular-nums;
	overflow-wrap: anywhere;
}

.related {
	padding-top: var(--space-7);
}

/* Sticky-Leiste mobil */
.buy-bar {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: var(--z-header);
	padding-bottom: env(safe-area-inset-bottom);
	border-top: 1px solid var(--color-border);
	background: var(--color-surface);
	box-shadow: var(--shadow-md);
}

.buy-bar[hidden] {
	display: none;
}

.buy-bar__inner {
	display: flex;
	align-items: center;
	gap: var(--space-3);
	padding-block: var(--space-2);
}

.buy-bar__info {
	flex: 1;
	min-width: 0;
}

.buy-bar__name {
	overflow: hidden;
	font-size: var(--fs-sm);
	color: var(--color-text-muted);
	white-space: nowrap;
	text-overflow: ellipsis;
}

.buy-bar__price {
	font-weight: var(--fw-bold);
}

.buy-bar__price del {
	display: none;
}

.buy-bar__price ins {
	color: var(--color-brand);
	text-decoration: none;
}

/* Footer nicht von der Leiste verdecken lassen */
body:has(.buy-bar:not([hidden])) .site-footer {
	padding-bottom: 72px;
}

/* Toast über der Leiste */
body:has(.buy-bar:not([hidden])) .toast {
	bottom: calc(80px + env(safe-area-inset-bottom));
}

@media (min-width: 768px) {
	.product-details:not(.product-details--single) {
		grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
		gap: var(--space-7);
	}

	.product-details--single {
		max-width: 48rem;
	}
}

@media (min-width: 1024px) {
	.product-page__top {
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
		gap: var(--space-8);
		align-items: start;
	}

	.gallery {
		position: sticky;
		top: var(--space-5);
	}

	.buy-bar {
		display: none;
	}

	body:has(.buy-bar:not([hidden])) .site-footer {
		padding-bottom: 0;
	}
}
