/*
 * KPC Optimering – buy box blocks, sticky mobile bar, empty cart and 404 helpers.
 * The campaign bar and the benefit bar have their few rules inline in the head (they sit above the fold site-wide).
 * Calm by design: hairlines, air, the site's own buttons. No boxes, no shadows.
 */

.kpco-lead,
.kpco-facts,
.kpco-helper,
.kpco-sticky {
	--kpco-line: rgba(0, 0, 0, 0.12);
	--kpco-primary: var(--fs-color-primary, #265359);
}

/* "Pris på förfrågan" carries the same weight as a price. */
.price .kpco-price-request {
	font-family: var(--bold-font-family, inherit);
}

/* Offer and showroom buttons ----------------------------------------------------------------------------------- */

.kpco-lead {
	clear: both;
	margin: 0.5rem 0 0;
}

.kpco-lead--quiet {
	margin-top: 1.5rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--kpco-line);
}

.kpco-lead .kpco-lead__intro {
	margin: 0 0 0.9rem;
}

.kpco-lead--quiet .kpco-lead__intro {
	font-size: 0.9rem;
}

.kpco-lead .kpco-lead__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.kpco-lead .kpco-lead__actions .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin: 0;
	text-align: center;
}

.kpco-lead .kpco-lead__phone {
	margin: 0.25rem 0 0;
	font-size: 0.9rem;
	line-height: 1.4;
}

/*
 * The number sits on its own line with the sentence, so the padding gives a 44 px target without stretching text.
 * Underlined: the theme's links have no underline, and with the inherited colour nothing else marks it as a link.
 */
.kpco-lead .kpco-lead__phone a {
	display: inline-block;
	padding: 0.75rem 0;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.2em;
	white-space: nowrap;
}

.kpco-lead__hours {
	display: block;
	margin-top: -0.4rem;
	font-size: 0.8rem;
}

@media (max-width: 549px) {
	.kpco-lead .kpco-lead__actions .button {
		flex: 1 1 100%;
	}
}

/* Fact list ------------------------------------------------------------------------------------------------------ */

.kpco-facts {
	clear: both;
	margin: 1.5rem 0 0;
	padding: 0;
	border-top: 1px solid var(--kpco-line);
	list-style: none;
}

.kpco-facts .kpco-facts__row {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	margin: 0;
	padding: 0.8rem 0;
	border-bottom: 1px solid var(--kpco-line);
	font-size: 0.9rem;
	line-height: 1.45;
}

.kpco-facts .kpco-facts__row:last-child {
	border-bottom: 0;
}

.kpco-facts .kpco-icon {
	flex: none;
	width: 20px;
	height: 20px;
	margin-top: 0.05em;
	color: var(--kpco-primary);
}

/* The padding makes the link as tall as its row (44 px); the negative margin keeps the row's height unchanged. */
.kpco-facts a {
	display: inline-block;
	margin: -0.75rem 0;
	padding: 0.75rem 0;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

.kpco-lead a:focus-visible,
.kpco-facts a:focus-visible,
.kpco-helper a:focus-visible,
.kpco-sticky a:focus-visible,
.kpco-sticky button:focus-visible {
	outline: 2px solid var(--kpco-primary);
	outline-offset: 2px;
}

/* Sticky mobile bar ---------------------------------------------------------------------------------------------- */

/*
 * z-index 100: above page content, below the theme's cookie notice (999), the sticky header (1001), lightboxes
 * (1042+) and the filter panel, so the bar never covers a consent banner or an overlay.
 */
.kpco-sticky {
	position: fixed;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	box-sizing: border-box;
	padding: 0.625rem 1rem calc(0.625rem + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--kpco-line);
	background: #fff;
	color: #1c1c1c;
	visibility: hidden;
	transform: translateY(100%);
	transition: transform 0.2s ease, visibility 0s linear 0.2s;
}

.kpco-sticky.is-visible {
	visibility: visible;
	transform: none;
	transition: transform 0.2s ease, visibility 0s;
}

.kpco-sticky .button {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	margin: 0;
	white-space: nowrap;
}

.kpco-sticky--lead .button {
	flex: 1 1 0;
}

.kpco-sticky__info {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-width: 0;
	line-height: 1.3;
}

.kpco-sticky__name {
	overflow: hidden;
	font-size: 0.85rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.kpco-sticky__price {
	overflow: hidden;
	font-family: var(--bold-font-family, inherit);
	font-size: 0.95rem;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.kpco-sticky__price:empty {
	display: none;
}

/* Room for the bar so the last lines of the footer stay reachable. The script sets the measured height. */
@media (max-width: 849px) {
	body.kpco-sticky-on {
		padding-bottom: var(--kpco-sticky-height, calc(4.25rem + env(safe-area-inset-bottom, 0px)));
	}
}

@media (min-width: 850px) {
	.kpco-sticky {
		display: none;
	}
}

@media print {
	.kpco-sticky {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.kpco-sticky,
	.kpco-sticky.is-visible {
		transition: none;
	}
}

/* Empty cart and 404 --------------------------------------------------------------------------------------------- */

.kpco-helper {
	margin: 2rem auto 3rem;
	padding-top: 1.75rem;
	border-top: 1px solid var(--kpco-line);
}

.kpco-helper--cart {
	margin: 1.5rem 0 2rem;
	padding-top: 0;
	border-top: 0;
}

.kpco-helper .kpco-helper__title {
	margin: 0 0 0.9rem;
	font-family: var(--bold-font-family, inherit);
}

.kpco-helper .kpco-helper__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	margin: 0 0 1.25rem;
	padding: 0;
	list-style: none;
}

.kpco-helper--cart .kpco-helper__links {
	justify-content: center;
}

.kpco-helper .kpco-helper__links li {
	margin: 0;
}

.kpco-helper .kpco-helper__links .button {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin: 0;
}

.kpco-helper__search {
	max-width: 32rem;
	margin: 0 0 1.75rem;
}

.kpco-helper .kpco-helper__phone {
	margin: 0;
}

/* Links inside a sentence: underlined so they do not rely on colour alone, padded to a 44 px target. */
.kpco-helper .kpco-helper__phone a {
	display: inline-block;
	padding: 0.6rem 0;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}
