/* ==========================================================================
   "Often purchased with" on a product page
   --------------------------------------------------------------------------
   The add-to-cart form of a product that has related products to offer:
   the product's own row, then one row per related product (image, name,
   quantity, unit price), a total, the button.
   Markup: woocommerce/single-product/add-to-cart/product-set.php.
   Enqueued by Kvaser_Product_Set, only on a page that shows the form.
   ========================================================================== */

/* page-shop.css lays the normal form out as one flex row (quantity + button). */
body.single-product div.product form.cart.kvaser-set-form {
	display: block;
}

.kvaser-set {
	margin: 0 0 var(--kv-space-4, 1rem);
}

/* "Often purchased with": set apart from the product's own row above by a
   clear gap, so it reads as a second, optional part. */
.kvaser-set-title {
	margin: 40px 0 0;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--kv-border-soft, #e5e6ea);
	font-size: var(--kv-text-md, 1.125rem);
	line-height: var(--kv-leading-snug, 1.2);
	font-weight: var(--kv-weight-regular, 500);
	color: var(--kv-heading, #1f2937);
}

/* The rows past the first few, behind "Show N more". */
.kvaser-set-more > summary {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 0;
	font-size: var(--kv-text-sm, 0.875rem);
	color: var(--kv-text, #1f2937);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
	list-style: none;
}

.kvaser-set-more > summary::-webkit-details-marker {
	display: none;
}

.kvaser-set-more > summary::after {
	content: "";
	width: 7px;
	height: 7px;
	margin-top: -4px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(45deg);
}

.kvaser-set-more > summary:hover,
.kvaser-set-more > summary:focus-visible {
	color: var(--kv-link-hover, #e4002b);
}

.kvaser-set-more > summary:focus-visible {
	outline: none;
	box-shadow: var(--kv-focus-ring, 0 0 0 3px rgb(228 0 43 / 0.28));
	border-radius: 4px;
}

/* Open: the rows are there, the link has done its job. */
.kvaser-set-more[open] > summary {
	display: none;
}

.kvaser-set-more:not([open]) {
	border-bottom: 1px solid var(--kv-border-soft, #e5e6ea);
}

/* Rows: [image] [name / article no.] [- 1 +] [price] */
.kvaser-set-head,
.kvaser-set-item {
	display: grid;
	grid-template-columns: 72px minmax(0, 1fr) auto minmax(72px, auto);
	column-gap: 12px;
	align-items: center;
}

.kvaser-set-head {
	padding: 10px 0;
	border-bottom: 1px solid var(--kv-border-soft, #e5e6ea);
	font-size: var(--kv-text-sm, 0.875rem);
	color: var(--kv-text-muted, #6c717f);
}

.kvaser-set-head-product {
	grid-column: 1 / span 2;
}

.kvaser-set-head-qty {
	text-align: center;
}

.kvaser-set-head-price,
.kvaser-set-price {
	text-align: right;
}

.kvaser-set-list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.kvaser-set-item {
	padding: 14px 0;
	border-bottom: 1px solid var(--kv-border-soft, #e5e6ea);
}

.kvaser-set-img img {
	display: block;
	width: 72px;
	height: 56px;
	object-fit: contain;
}

.kvaser-set-info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.kvaser-set-name,
.kvaser-set-name a {
	font-size: var(--kv-text-base, 1rem);
	line-height: 1.3;
	color: var(--kv-text, #1f2937);
	text-decoration: none;
	overflow-wrap: anywhere;
}

.kvaser-set-name a:hover,
.kvaser-set-name a:focus-visible {
	color: var(--kv-link-hover, #e4002b);
	text-decoration: underline;
}

.kvaser-set-artno {
	font-size: var(--kv-text-xs, 0.75rem);
	color: var(--kv-text-muted, #6c717f);
}

/* Quantity: the same dark round -/+ as the normal add-to-cart quantity. */
.kvaser-set-qty {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
}

.kvaser-set-qty .kvaser-set-step {
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--kv-gray-800, #1f2937);
	color: #fff;
	font-size: 18px;
	line-height: 30px;
	text-align: center;
	cursor: pointer;
}

.kvaser-set-qty .kvaser-set-step:hover {
	background: var(--kv-gray-700, #374151);
}

.kvaser-set-qty .kvaser-set-step:focus-visible {
	outline: none;
	box-shadow: var(--kv-focus-ring, 0 0 0 3px rgb(228 0 43 / 0.28));
}

.kvaser-set-qty .kvaser-set-step:disabled {
	background: var(--kv-gray-300, #d1d5db);
	cursor: default;
}

.kvaser-set-qty .kvaser-set-input {
	width: 40px;
	height: 32px;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	text-align: center;
	font-size: var(--kv-text-base, 1rem);
	color: var(--kv-text, #1f2937);
	-moz-appearance: textfield;
	appearance: textfield;
}

.kvaser-set-qty .kvaser-set-input::-webkit-outer-spin-button,
.kvaser-set-qty .kvaser-set-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.kvaser-set-qty .kvaser-set-input:focus-visible {
	outline: none;
	box-shadow: var(--kv-focus-ring, 0 0 0 3px rgb(228 0 43 / 0.28));
	border-radius: 4px;
}

.kvaser-set-price {
	font-size: var(--kv-text-base, 1rem);
	font-weight: var(--kv-weight-bold, 700);
	color: var(--kv-text, #1f2937);
	white-space: nowrap;
}

/* A row at quantity 0 steps back: it is not part of what gets added. */
.kvaser-set-item.is-empty .kvaser-set-price,
.kvaser-set-item.is-empty .kvaser-set-input {
	color: var(--kv-text-subtle, #9ca3af);
	font-weight: var(--kv-weight-regular, 500);
}

.kvaser-set-total {
	display: flex;
	justify-content: flex-end;
	align-items: baseline;
	gap: 16px;
	margin: 0;
	padding: 14px 0 4px;
	font-size: var(--kv-text-base, 1rem);
	color: var(--kv-text, #1f2937);
}

.kvaser-set-total-amount {
	min-width: 72px;
	text-align: right;
	font-size: var(--kv-text-lg, 1.25rem);
	font-weight: var(--kv-weight-bold, 700);
}

.kvaser-set-form .single_add_to_cart_button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

.kvaser-set-status:not(:empty) {
	margin-top: 16px;
}

/* Narrow: quantity and price drop under the name, the image spans both rows. */
@media (max-width: 480px) {
	.kvaser-set-head {
		display: none;
	}

	/* The column headings carried the top rule; without them the first row does. */
	.kvaser-set-list-main {
		border-top: 1px solid var(--kv-border-soft, #e5e6ea);
	}

	.kvaser-set-item {
		grid-template-columns: 64px minmax(0, 1fr) auto;
		row-gap: 10px;
	}

	.kvaser-set-img {
		grid-column: 1;
		grid-row: 1 / span 2;
		align-self: start;
	}

	.kvaser-set-img img {
		width: 64px;
	}

	.kvaser-set-info {
		grid-column: 2 / -1;
		grid-row: 1;
	}

	.kvaser-set-qty {
		grid-column: 2;
		grid-row: 2;
	}

	.kvaser-set-price {
		grid-column: 3;
		grid-row: 2;
	}
}

/* Full width at every size (page-shop.css narrows the normal form's button
   on small screens, where it shares a row with the quantity). */
.summary form.kvaser-set-form button.single_add_to_cart_button {
	width: 100%;
}
