/*
 * HUB Connector — Anzeigebausteine
 *
 * Grundsätze:
 *  - Keine externen Ressourcen: keine Schriften, keine Bilder, keine @import.
 *    Ein Shop, der beim Aufruf Dritt-Server anspricht, braucht dafür eine
 *    Einwilligung.
 *  - Farbneutral: Textfarben erben (currentColor), Flächen und Linien sind
 *    halbdurchsichtige Grautöne. Damit sitzen die Bausteine auf hellem wie auf
 *    dunklem Untergrund richtig, ohne zu wissen, welches Theme sie umgibt.
 *  - Schrift wird geerbt. Nur Zahlen bekommen tabular-nums, damit Preise
 *    untereinander auf der Kommastelle stehen.
 *  - Kein Querscrollen. Alles bricht um; nur die Vergleichstabelle scrollt
 *    waagerecht in ihrem eigenen Behälter — lieber schieben als quetschen.
 */

.hub-connector {
	--hub-accent: #1a5fb4;
	--hub-accent-contrast: #ffffff;
	--hub-line: rgba(128, 128, 128, 0.32);
	--hub-line-soft: rgba(128, 128, 128, 0.18);
	--hub-surface: rgba(128, 128, 128, 0.08);
	--hub-surface-strong: rgba(128, 128, 128, 0.14);
	--hub-radius: 10px;
	--hub-gap: 1rem;

	box-sizing: border-box;
	max-width: 100%;
	margin: 1.5rem 0;
	font-family: inherit;
	color: inherit;

	/*
	 * Riegel gegen Querscrollen: Was in einem Baustein doch einmal breiter
	 * gerät als der Platz — eine überlange Artikelnummer, ein Händlerlogo mit
	 * falscher Größe —, wird hier abgeschnitten, statt die ganze Seite
	 * verschiebbar zu machen. "clip" statt "hidden", weil hidden einen
	 * Scrollbereich erzeugt und die senkrechte Achse mitreißt.
	 */
	overflow-x: clip;
}

.hub-connector *,
.hub-connector *::before,
.hub-connector *::after {
	box-sizing: border-box;
}

.hub-connector img {
	max-width: 100%;
	height: auto;
}

.hub-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ------------------------------------------------------------------ Seite */

.hub-wrap {
	box-sizing: border-box;
	width: 100%;
	max-width: 1180px;
	margin: 0 auto;
	padding: 2rem 1rem 3rem;
}

.hub-main {
	display: block;
	overflow-x: clip;
}

/* --------------------------------------------------------------- Schalter */

.hub-button {
	display: inline-block;
	/*
	 * Wichtig, nicht kosmetisch: Der Hinweis für Screenreader im Link ist
	 * absolut positioniert. Ohne einen positionierten Vorfahren wäre sein
	 * Bezugsrahmen die Seite selbst — dann hängt er in der waagerecht
	 * gescrollten Vergleichstabelle rechts aus dem Dokument heraus und macht
	 * die ganze Seite verschiebbar. Mit position:relative bleibt er im Link
	 * und wird vom scrollenden Behälter mit abgeschnitten.
	 */
	position: relative;
	max-width: 100%;
	padding: 0.7em 1.2em;
	border: 1px solid transparent;
	border-radius: calc(var(--hub-radius) - 3px);
	background: var(--hub-accent);
	color: var(--hub-accent-contrast);
	font-size: 0.95em;
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	overflow-wrap: break-word;
	transition: filter 0.15s ease-in-out;
}

.hub-button:hover,
.hub-button:focus {
	filter: brightness(1.12);
	color: var(--hub-accent-contrast);
	text-decoration: none;
}

.hub-button:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.hub-button--secondary {
	background: transparent;
	border-color: var(--hub-line);
	color: inherit;
	font-weight: 500;
}

/* ---------------------------------------------------- Werbekennzeichnung */

.hub-disclosure {
	margin: 1rem 0 0;
	padding: 0.7rem 0.9rem;
	border: 1px solid var(--hub-line-soft);
	border-radius: calc(var(--hub-radius) - 3px);
	background: var(--hub-surface);
	font-size: 0.82em;
	line-height: 1.5;
	opacity: 0.95;
}

.hub-disclosure__tag {
	display: inline-block;
	margin-right: 0.45em;
	padding: 0.1em 0.5em;
	border: 1px solid var(--hub-line);
	border-radius: 3px;
	font-size: 0.9em;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.hub-disclosure--compact {
	margin: 0 0 1rem;
}

/* ------------------------------------------------------------- Hinweise */

.hub-notice {
	padding: 1.1rem 1.2rem;
	border: 1px dashed var(--hub-line);
	border-radius: var(--hub-radius);
	background: var(--hub-surface);
}

.hub-notice__title {
	margin: 0 0 0.35rem;
	font-size: 1.05em;
	font-weight: 700;
}

.hub-notice__text,
.hub-notice__meta {
	margin: 0;
	font-size: 0.9em;
	line-height: 1.55;
}

.hub-notice__meta {
	margin-top: 0.5rem;
	opacity: 0.7;
	font-size: 0.82em;
}

.hub-empty {
	margin: 1rem 0;
	padding: 0.9rem 1rem;
	border: 1px dashed var(--hub-line);
	border-radius: var(--hub-radius);
	font-size: 0.9em;
}

/* --------------------------------------------------------------- Preise */

.hub-price {
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum" 1;
	white-space: nowrap;
}

.hub-price--none {
	opacity: 0.75;
	font-style: italic;
	white-space: normal;
}

/* ------------------------------------------------------- Preisvergleich */

.hub-offers__heading {
	margin: 0 0 0.35rem;
	font-size: 1.35em;
	line-height: 1.25;
}

.hub-offers__summary {
	margin: 0 0 0.9rem;
	font-size: 0.92em;
	opacity: 0.85;
}

.hub-offers__list {
	margin: 0;
	padding: 0;
	list-style: none;
	border: 1px solid var(--hub-line);
	border-radius: var(--hub-radius);
	overflow: hidden;
}

.hub-offer {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.6rem var(--hub-gap);
	padding: 0.9rem 1rem;
	border-top: 1px solid var(--hub-line-soft);
}

.hub-offer:first-child {
	border-top: 0;
}

.hub-offer--best {
	background: var(--hub-surface);
}

.hub-offer--unavailable {
	opacity: 0.72;
}

.hub-offer__merchant {
	display: flex;
	flex: 1 1 12rem;
	min-width: 0;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem;
}

.hub-offer__logo {
	width: auto;
	max-width: 96px;
	max-height: 32px;
	object-fit: contain;
}

.hub-offer__name {
	min-width: 0;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.hub-badge {
	display: inline-block;
	padding: 0.12em 0.5em;
	border: 1px solid var(--hub-line);
	border-radius: 999px;
	background: var(--hub-surface-strong);
	font-size: 0.72em;
	font-weight: 700;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	white-space: nowrap;
}

.hub-offer__facts {
	display: flex;
	flex: 0 1 auto;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.15rem;
	min-width: 7.5rem;
}

.hub-offer__price {
	font-size: 1.15em;
	font-weight: 700;
}

.hub-offer__availability {
	font-size: 0.8em;
	opacity: 0.8;
}

.hub-offer__availability--unavailable {
	font-style: italic;
}

.hub-offer__action {
	flex: 0 0 auto;
	margin-left: auto;
}

/* ----------------------------------------------------------- Datenblatt */

.hub-attributes__heading,
.hub-grid__heading,
.hub-compare__heading {
	margin: 0 0 0.6rem;
	font-size: 1.35em;
	line-height: 1.25;
}

.hub-table {
	width: 100%;
	max-width: 100%;
	border-collapse: collapse;
	font-size: 0.95em;
}

.hub-table th,
.hub-table td {
	padding: 0.6rem 0.8rem;
	border-bottom: 1px solid var(--hub-line-soft);
	text-align: left;
	vertical-align: top;
}

.hub-table--attributes th {
	width: 40%;
	font-weight: 600;
	overflow-wrap: anywhere;
}

.hub-table--attributes td {
	overflow-wrap: anywhere;
}

/* ------------------------------------------------------ Vergleichstabelle */

.hub-compare__hint {
	margin: 0 0 0.5rem;
	font-size: 0.8em;
	opacity: 0.7;
}

/*
 * Der scrollende Behälter ist der Kern der mobilen Lösung: Die Tabelle darf
 * breiter sein als der Bildschirm, aber nur hier drinnen — nach außen ist
 * bei 100 % Schluss, deshalb entsteht kein Querscrollen der ganzen Seite.
 */
.hub-scroller {
	max-width: 100%;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--hub-line);
	border-radius: var(--hub-radius);
}

.hub-scroller:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.hub-table--compare {
	min-width: 44rem;
	font-size: 0.9em;
}

.hub-table--compare thead th {
	border-bottom: 1px solid var(--hub-line);
	background: var(--hub-surface);
	font-weight: 700;
	white-space: nowrap;
}

.hub-table--compare tbody tr:last-child th,
.hub-table--compare tbody tr:last-child td {
	border-bottom: 0;
}

.hub-table__product {
	min-width: 14rem;
	font-weight: 600;
}

.hub-table__product a {
	color: inherit;
	overflow-wrap: anywhere;
}

.hub-table__action {
	white-space: nowrap;
}

.hub-table__none {
	font-size: 0.85em;
	font-style: italic;
	opacity: 0.75;
	white-space: normal;
}

/* --------------------------------------------------------- Produktraster */

.hub-grid {
	display: grid;
	grid-template-columns: repeat(var(--hub-columns, 3), minmax(0, 1fr));
	gap: 1.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hub-card {
	display: flex;
	min-width: 0;
	border: 1px solid var(--hub-line);
	border-radius: var(--hub-radius);
	overflow: hidden;
}

.hub-card__link {
	display: flex;
	flex-direction: column;
	width: 100%;
	min-width: 0;
	color: inherit;
	text-decoration: none;
}

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

.hub-card__media {
	display: block;
	aspect-ratio: 4 / 3;
	background: var(--hub-surface);
	overflow: hidden;
}

.hub-card__media--empty {
	aspect-ratio: 5 / 2;
}

.hub-card__media img,
.hub-card__image {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.hub-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	min-height: 8rem;
	background:
		repeating-linear-gradient(
			45deg,
			rgba(128, 128, 128, 0.10) 0,
			rgba(128, 128, 128, 0.10) 10px,
			rgba(128, 128, 128, 0.04) 10px,
			rgba(128, 128, 128, 0.04) 20px
		);
}

.hub-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 0.3rem;
	padding: 0.9rem 1rem 1.1rem;
	min-width: 0;
}

.hub-card__title {
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.hub-card__price {
	margin-top: auto;
	padding-top: 0.4rem;
	font-size: 1.1em;
	font-weight: 700;
}

.hub-card__price--none {
	font-size: 0.9em;
	font-weight: 500;
	font-style: italic;
	opacity: 0.75;
}

.hub-card__merchants {
	font-size: 0.82em;
	opacity: 0.75;
}

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

.hub-archive__header,
.hub-product__header {
	margin-bottom: 1.5rem;
}

.hub-archive__title,
.hub-product__title {
	margin: 0 0 0.3rem;
	line-height: 1.2;
	overflow-wrap: anywhere;
}

.hub-product__brand {
	margin: 0;
	font-size: 0.95em;
	opacity: 0.75;
}

.hub-product__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
	gap: 1.75rem;
	align-items: start;
}

.hub-product__media img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--hub-radius);
}

.hub-product__placeholder {
	min-height: 14rem;
	border-radius: var(--hub-radius);
}

.hub-product__main .hub-offers {
	margin-top: 0;
}

.hub-product__description {
	margin: 2rem 0 0;
	line-height: 1.65;
	overflow-wrap: break-word;
}

/* ------------------------------------------------------------- Schmal */

@media (max-width: 780px) {
	.hub-product__layout {
		grid-template-columns: minmax(0, 1fr);
	}

	.hub-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 540px) {
	.hub-wrap {
		padding: 1.25rem 0.9rem 2.5rem;
	}

	.hub-grid {
		grid-template-columns: minmax(0, 1fr);
	}

	/*
	 * Auf dem Telefon steht jede Angebotszeile untereinander: Händler, Preis,
	 * Schaltfläche. Die Schaltfläche über die volle Breite — sie ist das Ziel
	 * der Seite und darf nicht in eine 3-Zeichen-Spalte gedrückt werden.
	 */
	.hub-offer {
		flex-direction: column;
		align-items: stretch;
		gap: 0.5rem;
	}

	.hub-offer__merchant,
	.hub-offer__facts {
		flex: 1 1 auto;
		min-width: 0;
	}

	.hub-offer__facts {
		flex-direction: row;
		align-items: baseline;
		gap: 0.6rem;
	}

	.hub-offer__action {
		margin-left: 0;
	}

	.hub-offer__action .hub-button {
		display: block;
		width: 100%;
	}

	.hub-table--attributes th,
	.hub-table--attributes td {
		padding: 0.5rem 0.6rem;
	}
}

/* Bewegung reduzieren, wenn das System es verlangt. */
@media (prefers-reduced-motion: reduce) {
	.hub-button {
		transition: none;
	}
}
