/*
 * "Vill du lägga till?" (lbb/cart-suggestions) som tavlorna Sajt-Varukorg
 * och Sajt-Lada. Varukorgen: rubriken 20/500, kort 10 px isär med kant
 * (hörn 14, 12/14 px utfyllnad): bild 44 px på mist (en tjänst: ikonen på
 * tint), namnet, "Till Garo Entity Home" 13 px dämpat, priset 14 px och
 * "Lägg till" som sekundärknapp (38 px). Det framlyfta kortet är mörkt med
 * turkost ljus (hörn 16, 16 px utfyllnad): ikonen på en platta 40 px,
 * namnet 500, "+1 990 kr, till Zaptec Go 2. Delar på husets el." och en
 * turkos knapp med djup text. Smalare än 480 px (lådan och mobilen):
 * kompakt, bild 32 px, namnet 15 px, "+149 kr, till Zaptec Go 2" och
 * knappen 34 px. Laddas bara med blocket.
 */
.lbb-suggestions {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20); /* Tavlan: 10 px. */
	container-type: inline-size;
}

.lbb-suggestions[hidden],
.lbb-suggestions__item[hidden],
.lbb-suggestions__form[hidden],
.lbb-suggestions__pick[hidden],
.lbb-suggestions [hidden] {
	display: none;
}

/* Rubriken: 16 px till det första kortet (10 + 6). */
.lbb-suggestions__title {
	margin: 0 0 var(--wp--preset--spacing--10);
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--large);
	font-weight: var(--wp--custom--text--title--weight);
	line-height: var(--wp--custom--text--h-3--line-height);
	letter-spacing: var(--wp--custom--text--h-3--letter-spacing);
}

.lbb-suggestions__list {
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
	margin: 0;
	padding: 0;
	list-style: none;
}

.lbb-suggestions__form {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--wp--preset--spacing--25); /* Tavlan: 14 px. */
	margin: 0;
	padding: var(--wp--preset--spacing--25) var(--wp--preset--spacing--25); /* Tavlan: 12/14 px. */
	border-radius: var(--wp--custom--radius--panel);
	box-shadow: inset 0 0 0 1px var(--wp--preset--color--border);
}

.lbb-suggestions__media {
	display: flex;
	flex: none;
}

/* Väljaren slår WooCommerces .woocommerce-page img (height: auto). */
.lbb-suggestions .lbb-suggestions__image,
.lbb-suggestions__icon {
	width: 2.75rem;
	height: 2.75rem;
	border-radius: var(--wp--custom--radius--control);
}

.lbb-suggestions .lbb-suggestions__image {
	aspect-ratio: 1;
	background: var(--wp--preset--color--base-alt);
	object-fit: contain;
}

/* En tjänst: begreppsikonen (duotone, 22 px) i teal på tint. */
.lbb-suggestions__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--wp--preset--color--base-alt);
	color: var(--wp--preset--color--contrast);
}

.lbb-suggestions__icon::before {
	content: "";
	width: 1.375rem;
	height: 1.375rem;
	background-color: currentcolor;
	mask: var(--lbb-suggestions-icon) center / contain no-repeat;
}

.lbb-suggestions__icon[data-icon="leaf"] { --lbb-suggestions-icon: url("../../icons/hero/leaf.svg"); }
.lbb-suggestions__icon[data-icon="wrench"] { --lbb-suggestions-icon: url("../../icons/hero/wrench.svg"); }
.lbb-suggestions__icon[data-icon="percent"] { --lbb-suggestions-icon: url("../../icons/hero/percent.svg"); }
.lbb-suggestions__icon[data-icon="calendar-check"] { --lbb-suggestions-icon: url("../../icons/hero/calendar-check.svg"); }
.lbb-suggestions__icon[data-icon="shield-check"] { --lbb-suggestions-icon: url("../../icons/hero/shield-check.svg"); }
.lbb-suggestions__icon[data-icon="truck"] { --lbb-suggestions-icon: url("../../icons/hero/truck.svg"); }
.lbb-suggestions__icon[data-icon="charging-station"] { --lbb-suggestions-icon: url("../../icons/hero/charging-station.svg"); }
.lbb-suggestions__icon[data-icon="lightning"] { --lbb-suggestions-icon: url("../../icons/hero/lightning.svg"); }
.lbb-suggestions__icon[data-icon="house"] { --lbb-suggestions-icon: url("../../icons/hero/house.svg"); }
.lbb-suggestions__icon[data-icon="briefcase"] { --lbb-suggestions-icon: url("../../icons/hero/briefcase.svg"); }

.lbb-suggestions__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: var(--wp--preset--spacing--10); /* 2 px mellan namnet och raden under (ägaren 12 okt). */
	min-width: 0;
	line-height: var(--wp--custom--text--title--line-height);
}

/* Namnet 15/500, som knappens text (ägaren 12 okt: 16 px kändes stort i
   det låga kortet). */
.lbb-suggestions__name {
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--custom--text--title--size);
	line-height: var(--wp--custom--text--title--line-height);
	font-weight: var(--wp--custom--text--title--weight);
}

/* Texten under namnet: vanligt kort "Till Garo Entity Home" (priset står
   vid knappen). */
.lbb-suggestions__line {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--x-small);
	line-height: var(--wp--custom--text--caption--line-height);
}

.lbb-suggestions__line-price,
.lbb-suggestions__line-target,
.lbb-suggestions__line-note {
	display: none;
}

/* Valet när flera laddboxar saknar tillvalet står i raden under namnet:
   "Till Laddbox Bas ⌄" med namnet i teal, understruket, och en liten pil
   (ägaren 13 okt). Den riktiga listrutan ligger genomskinlig ovanpå namnet,
   16 px så att iOS inte zoomar, och tar emot klick, tryck och tangentbord.
   I det framlyfta kortet blir det ", till Laddbox Bas ⌄" efter priset. */
.lbb-suggestions__line:has(.lbb-suggestions__select:not([hidden])) {
	display: block;
}

.lbb-suggestions__select {
	display: inline;
}

.lbb-suggestions__select[hidden] {
	display: none;
}

.lbb-suggestions__form--featured .lbb-suggestions__select-lead {
	text-transform: lowercase;
}

.lbb-suggestions__form--featured .lbb-suggestions__select-lead::before {
	content: ", ";
}

.lbb-suggestions__select-box {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: var(--wp--preset--spacing--10);
	border-radius: 2px;
	color: var(--wp--preset--color--contrast);
	white-space: nowrap;
}

.lbb-suggestions__form--featured .lbb-suggestions__select-box {
	color: var(--wp--preset--color--primary-bright);
}

.lbb-suggestions__select-value {
	text-decoration: underline;
	text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
	text-underline-offset: 0.2em;
}

.lbb-suggestions__select-box:hover .lbb-suggestions__select-value {
	text-decoration-color: currentColor;
}

.lbb-suggestions__select-caret {
	flex: none;
	width: 0.75rem;
	height: 0.75rem;
}

/* Klassen före slår base.css regler för listrutor på WooCommerce-sidor. */
.lbb-suggestions .lbb-suggestions__select-box select {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	opacity: 0;
	font-size: var(--wp--preset--font-size--medium);
	cursor: pointer;
}

.lbb-suggestions__select-box:has(select:focus-visible) {
	outline: 2px solid var(--lbb-focus-color, var(--wp--preset--color--contrast));
	outline-offset: 2px;
}

.lbb-suggestions__action {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--25);
}

.lbb-suggestions__price {
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--small);
	line-height: var(--wp--custom--text--small--line-height);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* "Lägg till": sekundärknapp, 38 px, 15/500, hörn 8, mist utan kant. */
.lbb-suggestions__button {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	min-height: var(--wp--custom--control--height--sm);
	padding: 0 var(--wp--custom--control--padding-x--sm);
	border: 0;
	border-radius: var(--wp--custom--radius--control-sm);
	background: var(--wp--preset--color--base-alt);
	color: var(--wp--preset--color--contrast);
	font: inherit;
	font-size: var(--wp--custom--control--font-size--sm);
	font-weight: var(--wp--custom--text--title--weight);
	line-height: 1;
	text-box: trim-both cap alphabetic;
	cursor: pointer;
	transition: background-color var(--lbb-transition);
}

.lbb-suggestions__button:hover {
	background: var(--wp--preset--color--base-alt-hover);
}

.lbb-suggestions__button:disabled {
	opacity: 0.4;
	cursor: wait;
}

.lbb-suggestions__error {
	flex-basis: 100%;
	margin: 0;
	color: var(--wp--preset--color--error);
	font-size: var(--wp--preset--font-size--small);
	line-height: var(--wp--custom--text--small--line-height);
}

/* Det framlyfta kortet (lbb-core, "Lyft fram"; högst ett): ytetemat
   Framlyft i base.css (djup teal med turkost ljus, vit text, vit fokusring). */
.lbb-suggestions__form--featured {
	padding: var(--wp--preset--spacing--30);
	border-radius: var(--wp--custom--card--radius);
	background: var(--lbb-surface);
	box-shadow: none;
	color: var(--lbb-surface-text);
}

.lbb-suggestions__form--featured .lbb-suggestions__icon,
.lbb-suggestions .lbb-suggestions__form--featured .lbb-suggestions__image {
	width: 2.5rem;
	height: 2.5rem;
	border-radius: 0.75rem; /* Tavlan: 12 px. */
}

.lbb-suggestions__form--featured .lbb-suggestions__icon {
	background: var(--lbb-surface-tile);
	color: var(--lbb-surface-accent);
}

.lbb-suggestions__form--featured .lbb-suggestions__name {
	color: var(--lbb-surface-text);
	font-weight: var(--wp--custom--text--title--weight);
}

.lbb-suggestions__form--featured .lbb-suggestions__line {
	color: var(--lbb-surface-muted);
}

.lbb-suggestions__form--featured :is(.lbb-suggestions__line-price, .lbb-suggestions__line-target:not([hidden]), .lbb-suggestions__line-note:not([hidden])) {
	display: inline;
}

.lbb-suggestions__form--featured .lbb-suggestions__target,
.lbb-suggestions__form--featured .lbb-suggestions__action .lbb-suggestions__price {
	display: none;
}

/* Knappen i det mörka kortet är vit med mörk text (ägaren 13 okt): teal
   på det mörka kortet når inte 3:1, och turkosen används sparsamt. */
.lbb-suggestions__form--featured .lbb-suggestions__button {
	background: var(--lbb-surface-button);
	color: var(--lbb-surface-button-text);
}

.lbb-suggestions__form--featured .lbb-suggestions__button:hover {
	background: var(--lbb-surface-button-hover);
}

/* Lådan utan synligt kort (alla tillval i varukorgen) visar inte ens rubriken. */
.lbb-suggestions--compact:not(:has(.lbb-suggestions__form:not([hidden]))),
.lbb-suggestions--compact:has(.lbb-suggestions__pick[hidden]):not(:has(.lbb-suggestions__form:not([hidden], .lbb-suggestions__form--pick))) {
	display: none;
}

/* Ingen bild: ingen tom ruta. */
.lbb-suggestions .lbb-suggestions__image:not([src]),
.lbb-suggestions .lbb-suggestions__image[src=""] {
	display: none;
}

/* Lådan: rubriken 15/500 och 8 px mellan rubriken och korten. */
.lbb-suggestions--compact {
	gap: var(--wp--preset--spacing--20);
}

.lbb-suggestions--compact .lbb-suggestions__title {
	margin: 0;
	font-size: var(--wp--custom--text--title--size);
	letter-spacing: var(--wp--custom--text--title--letter-spacing);
	line-height: var(--wp--custom--text--title--line-height);
}

/* Smalt (lådan 384 px, mobilen 350 px): kompakta kort som Sajt-Lada. */
@container (max-width: 30rem) {
	.lbb-suggestions__form {
		gap: var(--wp--preset--spacing--25);
		padding: var(--wp--preset--spacing--20) var(--wp--preset--spacing--25); /* Tavlan: 10/12 px. */
	}

	.lbb-suggestions__form--featured {
		padding: var(--wp--preset--spacing--25) var(--wp--preset--spacing--25) var(--wp--preset--spacing--25) var(--wp--preset--spacing--25); /* Tavlan: 12/12/12/14 px. */
		border-radius: var(--wp--custom--radius--panel);
	}

	.lbb-suggestions .lbb-suggestions__image,
	.lbb-suggestions__icon {
		width: 2rem;
		height: 2rem;
		border-radius: var(--wp--custom--radius--control-sm);
	}

	.lbb-suggestions__form--featured .lbb-suggestions__icon,
	.lbb-suggestions .lbb-suggestions__form--featured .lbb-suggestions__image {
		width: 2rem;
		height: 2rem;
		border-radius: var(--wp--custom--radius--control);
	}

	.lbb-suggestions__icon::before {
		width: 1.125rem;
		height: 1.125rem;
	}

	.lbb-suggestions__text {
		gap: var(--wp--preset--spacing--10);
	}

	.lbb-suggestions__name {
		font-size: var(--wp--custom--text--title--size);
		line-height: var(--wp--custom--text--title--line-height);
	}

	/* "+149 kr, till Zaptec Go 2": beloppet i bläck (vitt på det mörka), utan
	   upplysningen och utan priset vid knappen. */
	.lbb-suggestions__line-price,
	.lbb-suggestions__line-target:not([hidden]) {
		display: inline;
	}

	.lbb-suggestions__line-price {
		color: var(--wp--preset--color--contrast);
		white-space: nowrap;
	}

	.lbb-suggestions__form--featured .lbb-suggestions__line-price {
		color: var(--wp--preset--color--base);
	}

	.lbb-suggestions .lbb-suggestions__line-note,
	.lbb-suggestions .lbb-suggestions__form--featured .lbb-suggestions__line-note,
	.lbb-suggestions .lbb-suggestions__target,
	.lbb-suggestions .lbb-suggestions__action .lbb-suggestions__price {
		display: none;
	}

	.lbb-suggestions__button {
		min-height: 2.125rem; /* Tavlan: 34 px. */
		padding: 0 var(--wp--preset--spacing--25);
		font-size: var(--wp--preset--font-size--small);
		line-height: var(--wp--custom--text--small--line-height);
	}
}
