/*
 * The quote dialog ("Pyydä tarjous", inc/quote-modal.php + assets/quote-modal.js): a white panel in the middle of the
 * window over a navy veil, the Leadoo form in it. Square corners, no shadow (the site's buttons and cards); Oxygen and
 * the colours of the site (navy #1b2a57, accent #01a6e6). Up to 720px wide; on phones the panel is a full-height sheet.
 * The <dialog> element itself covers the window (transparent) so that a click outside the panel is a click on it.
 * Sizes come from the tokens of blocks.css (--ab-gutter, --ab-flow, --ab-tap); the fallbacks are the phone values.
 */

.ab-quote-modal {
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: var(--ab-gutter, 20px);
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--body, #1b2a57);
	font-family: inherit;
	overflow: auto;
	overscroll-behavior: contain;
}

.ab-quote-modal[open] {
	display: grid;
	place-items: center;
}

.ab-quote-modal::backdrop {
	background: rgba(20, 35, 80, 0.72);
}

/* the page behind does not scroll (and does not jump when the scroll bar goes) */
html.ab-quote-modal-open {
	overflow: hidden;
	scrollbar-gutter: stable;
}

.ab-quote-modal__panel {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 720px;
	max-height: calc(100vh - 2 * var(--ab-gutter, 20px));
	max-height: calc(100dvh - 2 * var(--ab-gutter, 20px));
	padding: calc(var(--ab-tap, 44px) + 16px) 48px 40px;
	overflow: auto;
	overscroll-behavior: contain;
	background: #fff;
}

.ab-quote-modal__close {
	position: absolute;
	top: 8px;
	right: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: var(--ab-tap, 44px);
	height: var(--ab-tap, 44px);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: none;
	color: var(--ab-navy, #1b2a57);
	cursor: pointer;
}

.ab-quote-modal__close:hover {
	color: var(--ab-accent-hover, #0194cd);
}

.ab-quote-modal__close:focus-visible,
.ab-quote-modal__btn:focus-visible,
.ab-quote-modal__alt a:focus-visible,
.ab-quote-trigger:focus-visible {
	outline: 2px solid var(--ab-accent, #01a6e6);
	outline-offset: 2px;
}

.ab-quote-modal__title {
	margin: 0;
	color: var(--ab-heading, #1b2a57);
	font-family: inherit;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.2;
	overflow-wrap: break-word;
}

/* the note (loading, error, consent) takes the place of the form (Leadoo's form may bring a margin of its own on top) */
.ab-quote-modal__body {
	margin-top: var(--ab-flow, 16px);
}

.ab-quote-modal__msg {
	display: none;
	margin: 0 0 var(--ab-flow, 16px);
	font-size: 17px;
	line-height: 1.5;
}

.ab-quote-modal__body[data-state="loading"] [data-ab-msg="loading"],
.ab-quote-modal__body[data-state="error"] [data-ab-msg="error"],
.ab-quote-modal__body[data-state="consent"] [data-ab-msg="consent"] {
	display: block;
}

.ab-quote-modal__body[data-state="ready"] .ab-quote-modal__note,
.ab-quote-modal__body[data-state="idle"] .ab-quote-modal__note {
	display: none;
}

.ab-quote-modal__alt {
	margin: 0;
	font-size: 15px;
	line-height: 1.5;
}

.ab-quote-modal__alt a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ab-quote-modal__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: var(--ab-tap, 44px);
	margin: 0;
	padding: 10px 24px;
	border: 0;
	border-radius: 0;
	background: var(--ab-navy, #1b2a57);
	color: #fff;
	font-family: inherit;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.2;
	cursor: pointer;
}

.ab-quote-modal__btn:hover {
	background: #0f1e4b;
}

.ab-quote-modal__form iframe {
	max-width: 100%;
}

@media (prefers-reduced-motion: no-preference) {
	.ab-quote-modal[open] .ab-quote-modal__panel {
		animation: ab-quote-in 0.18s ease-out;
	}

	.ab-quote-modal[open]::backdrop {
		animation: ab-quote-fade 0.18s ease-out;
	}
}

@keyframes ab-quote-in {
	from {
		opacity: 0;
		transform: translateY(12px);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes ab-quote-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

/* phones: the panel is the whole screen */
@media (max-width: 768px) {
	.ab-quote-modal {
		padding: 0;
	}

	.ab-quote-modal[open] {
		place-items: stretch;
	}

	.ab-quote-modal__panel {
		max-width: none;
		height: 100vh;
		height: 100dvh;
		max-height: none;
		padding: calc(var(--ab-tap, 44px) + 12px) var(--ab-gutter, 20px) 32px;
	}

	.ab-quote-modal__title {
		font-size: 24px;
	}
}

/* the quote button on a card of a product list (avalon/product-list with quoteButton): the site's own button, as on
   the product cards (blocks.css .ab-product__buy); the selectors are as specific as WooCommerce's "a.button" rules */
.ab-plist .ab-plist__buy {
	margin-top: 12px;
}

.ab-plist--listing .ab-plist__buy {
	margin-top: 4px;
	padding: 0 20px 20px;
}

.ab-plist .ab-plist__buy a.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: var(--ab-tap, 44px);
	margin: 0;
	padding: 10px 24px;
	border: 0;
	border-radius: 0;
	background: var(--ab-navy, #1b2a57);
	color: #fff;
	font-family: inherit;
	font-size: 16px;
	font-weight: 400;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
}

.ab-plist .ab-plist__buy a.button:hover,
.ab-plist .ab-plist__buy a.button:focus-visible {
	background: #0f1e4b;
	color: #fff;
}

@media (min-width: 769px) and (max-width: 1024px) {
	.ab-plist--listing .ab-plist__buy {
		padding-inline: 16px;
	}
}

/* phones: the list is rows (a picture of 96px and the text beside it): the button goes under the text */
@media (max-width: 768px) {
	.ab-plist .ab-plist__item > .ab-plist__buy,
	.ab-plist--listing .ab-plist__buy {
		grid-column: 2;
		grid-row: 4;
		align-self: start;
		margin-top: 8px;
		padding: 0;
	}
}
