/*
 * Arco Estimate: a configurator on a page.
 *
 * Colours and type come from the website (the Arco Web tokens), with
 * readable defaults where they are missing. Raw colours stand only in the
 * token block below; every rule after it uses a token.
 *
 * Text is never under 17 px. A state of a control (hover, focus, chosen)
 * that sets a colour sets all three: background, border and text. Nothing
 * is forced with a priority override.
 *
 * The layout follows the room the configurator is given (a container
 * query), not the width of the screen: in a narrow column of text it stays
 * one column on any screen.
 */

.arco-est {
	--est-ink: var(--c-text, #15181c);
	--est-muted: var(--c-muted, #41474f);
	--est-bg: var(--c-bg, #ffffff);
	--est-tile: var(--m-surface, var(--c-soft, #f3f5f7));
	--est-on-tile: var(--m-ink-s, var(--c-text, #15181c));
	--est-muted-tile: var(--m-muted-s, var(--c-muted, #41474f));
	--est-line: var(--c-line-strong, #808891);
	--est-hair: var(--c-line, #cfd4da);
	--est-accent: var(--c-primary, #0b57b0);
	--est-on-accent: var(--c-on-primary, #ffffff);
	--est-focus: var(--c-focus, #111111);
	--est-radius: var(--radius, 0.375rem);
	--est-radius-s: var(--radius-btn, 0.375rem);
	--est-top: var(--header-h, 0rem);
	--est-heat: #e8590c;
	--est-led: #f2b134;
	--est-pv: #1f3552;
	--est-pv-cell: #ffffff;
	--est-none: transparent;
	container: est / inline-size;
	color: var(--est-ink);
	font-size: 1.125rem;
	line-height: 1.5;
}

.arco-est *,
.arco-est *::before,
.arco-est *::after {
	box-sizing: border-box;
}

.arco-est__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* The line that says a demo is a demo ------------------------------------ */

.arco-est__demo {
	margin: 0 0 1.5rem;
	padding: 0.75rem 1rem;
	border: 1px solid var(--est-line);
	border-radius: var(--est-radius-s);
	background: var(--est-tile);
	color: var(--est-on-tile);
	font-size: 1.0625rem;
}

/* Layout ------------------------------------------------------------------ */

.arco-est__form {
	margin: 0;
}

.arco-est__cols {
	display: grid;
	gap: 1.75rem;
	grid-template-columns: minmax(0, 1fr);
}

.arco-est__steps {
	min-width: 0;
}

.arco-est__side {
	display: contents;
}

.arco-est__drawbox {
	order: -1;
	min-width: 0;
	padding: 0.75rem;
	border: 1px solid var(--est-hair);
	border-radius: var(--est-radius);
	background: var(--est-tile);
	color: var(--est-on-tile);
}

.arco-est__panel {
	min-width: 0;
	padding: 1.25rem;
	border: 1px solid var(--est-hair);
	border-radius: var(--est-radius);
	background: var(--est-tile);
	color: var(--est-on-tile);
}

/* In one column, a tall screen keeps the drawing in view while the questions scroll. */

@media (min-height: 46rem) {
	@container est (max-width: 55.99rem) {
		.arco-est__form .arco-est__drawbox {
			position: sticky;
			top: calc(var(--est-top) + 0.5rem);
			z-index: 4;
			/* The page's own colour around the drawing, so no question shows in the gap under the header or past its round corners. */
			box-shadow: 0 0 0 0.75rem var(--est-bg);
		}

		.arco-est__form .arco-est__draw {
			--est-draw-h: 30vh;
		}

		.arco-est__field {
			scroll-margin-top: calc(var(--est-top) + 34vh);
		}
	}
}

@container est (min-width: 56rem) {
	.arco-est__cols {
		grid-template-columns: minmax(0, 1fr) clamp(20rem, 40cqi, 33rem);
		gap: clamp(2rem, 3cqi, 3rem);
		align-items: start;
	}

	.arco-est__side {
		display: grid;
		gap: 1rem;
		position: sticky;
		top: calc(var(--est-top) + 1rem);
		max-height: calc(100vh - var(--est-top) - 2rem);
		overflow-y: auto;
		overscroll-behavior: contain;
	}

	.arco-est__drawbox {
		order: 0;
	}

	.arco-est__form .arco-est__draw {
		--est-draw-h: 38vh;
	}
}

/* The drawing --------------------------------------------------------------- */

/* Never taller than --est-draw-h: its width is capped by its shape (--est-ar comes with the drawing). */

.arco-est__draw {
	position: relative;
	width: 100%;
	max-width: calc(var(--est-draw-h, 32rem) * var(--est-ar, 1));
	margin-inline: auto;
}

.arco-est__svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
	color: var(--est-on-tile);
}

.arco-est__svg polygon,
.arco-est__svg line,
.arco-est__svg path,
.arco-est__svg circle {
	fill: var(--est-none);
	stroke: currentColor;
	stroke-width: 1.5px;
	stroke-linejoin: round;
	stroke-linecap: round;
	vector-effect: non-scaling-stroke;
}

.arco-est__svg .est-ground {
	fill: color-mix(in srgb, currentColor 6%, transparent);
}

.arco-est__svg .est-joint {
	stroke-opacity: 0.16;
	stroke-width: 1px;
}

.arco-est__svg .est-wall {
	fill: color-mix(in srgb, currentColor 13%, transparent);
}

.arco-est__svg .est-door {
	fill: color-mix(in srgb, currentColor 5%, transparent);
}

.arco-est__svg .est-roof-poly {
	fill: color-mix(in srgb, currentColor 24%, transparent);
}

.arco-est__svg .est-roof-glass {
	fill: color-mix(in srgb, currentColor 10%, transparent);
}

.arco-est__svg .est-blade,
.arco-est__svg .est-glint {
	stroke-opacity: 0.5;
	stroke-width: 1px;
}

.arco-est__svg .est-screen {
	fill: color-mix(in srgb, currentColor 36%, transparent);
}

.arco-est__svg .est-weave {
	stroke-opacity: 0.3;
	stroke-width: 1px;
}

.arco-est__svg .est-glazing {
	fill: color-mix(in srgb, currentColor 9%, transparent);
}

.arco-est__svg .est-pane {
	stroke-opacity: 0.7;
	stroke-width: 1px;
}

.arco-est__svg .est-heat {
	fill: var(--est-heat);
}

.arco-est__svg .est-led {
	stroke: var(--est-led);
	stroke-width: 3px;
	stroke-dasharray: 1 7;
}

.arco-est__svg .est-sensor circle {
	fill: var(--est-tile);
}

.arco-est__svg .est-man circle,
.arco-est__svg .est-man path {
	fill: currentColor;
	fill-opacity: 0.8;
	stroke: var(--est-none);
}

.arco-est__svg .est-dim {
	stroke-width: 1.25px;
}

.arco-est__svg .est-roofface {
	fill: color-mix(in srgb, currentColor 7%, transparent);
}

.arco-est__svg .est-ridge {
	stroke-width: 4px;
}

.arco-est__svg .est-slot {
	stroke-dasharray: 5 5;
	stroke-opacity: 0.6;
	stroke-width: 1px;
}

.arco-est__svg .est-panel {
	fill: var(--est-pv);
}

.arco-est__svg .est-cell {
	stroke: var(--est-pv-cell);
	stroke-opacity: 0.35;
	stroke-width: 1px;
}

.arco-est__svg .est-north path {
	fill: currentColor;
}

.arco-est__dim {
	position: absolute;
	transform: translate(-50%, -50%);
	padding: 0 0.35em;
	border-radius: 0.25rem;
	background: var(--est-tile);
	color: var(--est-on-tile);
	font-size: 1.0625rem;
	font-variant-numeric: tabular-nums;
	line-height: 1.35;
	white-space: nowrap;
}

/* Steps and fields ---------------------------------------------------------- */

.arco-est__step {
	margin: 0 0 2rem;
	padding: 0;
	border: 0;
	min-width: 0;
}

.arco-est__legend {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	width: 100%;
	margin: 0 0 1rem;
	padding: 0 0 0.75rem;
	border-bottom: 1px solid var(--est-hair);
	color: var(--est-ink);
	font-family: var(--f-heading, inherit);
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1.2;
}

.arco-est__num {
	display: inline-grid;
	place-items: center;
	flex: none;
	width: 2.125rem;
	height: 2.125rem;
	border: 2px solid var(--est-ink);
	border-radius: 50%;
	font-size: 1.125rem;
	font-variant-numeric: tabular-nums;
	line-height: 1;
}

.arco-est__fields {
	display: grid;
	grid-template-columns: repeat(6, minmax(0, 1fr));
	gap: 1.25rem 1rem;
}

.arco-est__field {
	grid-column: 1 / -1;
	min-width: 0;
	scroll-margin-bottom: 6rem;
}

@container est (min-width: 34rem) {
	.arco-est__field--number {
		grid-column: span 2;
	}

	.arco-est__field--toggle {
		grid-column: span 3;
	}

	.arco-est__field--wide {
		grid-column: 1 / -1;
		max-width: 32rem;
	}
}

.arco-est__label {
	display: block;
	margin: 0 0 0.5rem;
	color: var(--est-ink);
	font-size: 1.125rem;
	font-weight: 700;
}

.arco-est__help {
	margin: 0.375rem 0 0;
	color: var(--est-muted);
	font-size: 1.0625rem;
}

/* Choices: cards, pills and swatches. The radio itself is there for the
   keyboard and for screen readers; the box after it is what is seen. */

.arco-est__options {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 13.5rem), 1fr));
}

/* Four cards stand two and two, not three and one (and not four in a row down a phone's screen). */

@container est (min-width: 20rem) {
	.arco-est__options--cards.arco-est__options--n4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.arco-est__options--pills {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.arco-est__options--swatches {
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr));
}

.arco-est__option,
.arco-est__toggle {
	position: relative;
	display: block;
	margin: 0;
	font-weight: 400;
	cursor: pointer;
}

.arco-est__option input,
.arco-est__toggle input {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.arco-est__box {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	height: 100%;
	min-height: 3rem;
	padding: 0.875rem 1rem;
	border: 2px solid var(--est-line);
	border-radius: var(--est-radius-s);
	background: var(--est-bg);
	color: var(--est-ink);
	transition: border-color 0.12s ease, background-color 0.12s ease;
}

.arco-est__options--pills .arco-est__box {
	justify-content: center;
	padding: 0.5rem 1rem;
}

.arco-est__options--swatches .arco-est__box {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	column-gap: 0.75rem;
	align-items: center;
}

.arco-est__options--swatches .arco-est__hint {
	grid-column: 2;
}

.arco-est__option input:hover + .arco-est__box,
.arco-est__toggle input:hover + .arco-est__box {
	border-color: var(--est-ink);
	background: var(--est-bg);
	color: var(--est-ink);
}

.arco-est__option input:checked + .arco-est__box,
.arco-est__toggle input:checked + .arco-est__box {
	border-color: var(--est-ink);
	background: var(--est-tile);
	color: var(--est-on-tile);
	box-shadow: inset 0 0 0 1px var(--est-ink);
}

.arco-est__option input:focus-visible + .arco-est__box,
.arco-est__toggle input:focus-visible + .arco-est__box {
	border-color: var(--est-ink);
	background: var(--est-tile);
	color: var(--est-on-tile);
	outline: 3px solid var(--est-focus);
	outline-offset: 3px;
}

.arco-est__pic {
	display: block;
	height: 2.75rem;
	margin-bottom: 0.25rem;
	color: currentColor;
}

.arco-est__pic svg {
	display: block;
	height: 100%;
	width: auto;
}

.arco-est__swatch {
	grid-row: span 2;
	width: 2rem;
	height: 2rem;
	border: 2px solid var(--est-line);
	border-radius: 50%;
}

.arco-est__name {
	font-weight: 700;
	line-height: 1.3;
}

.arco-est__hint,
.arco-est__adds {
	font-size: 1.0625rem;
	line-height: 1.4;
}

.arco-est__option input:checked + .arco-est__box .arco-est__name::after {
	content: "";
	display: inline-block;
	width: 0.45em;
	height: 0.8em;
	margin-left: 0.5em;
	border: solid currentColor;
	border-width: 0 0.16em 0.16em 0;
	transform: translateY(-0.1em) rotate(45deg);
}

/* An extra: a box with a tick. */

.arco-est__toggle .arco-est__box {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	column-gap: 0.75rem;
	row-gap: 0.125rem;
	align-content: center;
}

.arco-est__tick {
	grid-row: span 3;
	align-self: start;
	position: relative;
	width: 1.5rem;
	height: 1.5rem;
	margin-top: 0.1rem;
	border: 2px solid var(--est-line);
	border-radius: 0.25rem;
	background: var(--est-bg);
}

.arco-est__toggle input:checked + .arco-est__box .arco-est__tick {
	border-color: var(--est-ink);
	background: var(--est-ink);
	color: var(--est-bg);
}

.arco-est__toggle input:checked + .arco-est__box .arco-est__tick::after {
	content: "";
	position: absolute;
	top: 0.1rem;
	left: 0.4rem;
	width: 0.4rem;
	height: 0.8rem;
	border: solid currentColor;
	border-width: 0 0.18rem 0.18rem 0;
	transform: rotate(45deg);
}

.arco-est__toggle .arco-est__name,
.arco-est__toggle .arco-est__adds,
.arco-est__toggle .arco-est__hint {
	grid-column: 2;
}

/* A size: a number field, and beside it the slider the script adds. */

.arco-est__numrow {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.arco-est__input {
	width: 100%;
	min-width: 0;
	min-height: 3rem;
	padding: 0.5rem 0.75rem;
	border: 2px solid var(--est-line);
	border-radius: var(--est-radius-s);
	background: var(--est-bg);
	color: var(--est-ink);
	font: inherit;
	font-variant-numeric: tabular-nums;
}

.arco-est__input:hover {
	border-color: var(--est-ink);
	background: var(--est-bg);
	color: var(--est-ink);
}

.arco-est__input:focus-visible {
	border-color: var(--est-ink);
	background: var(--est-bg);
	color: var(--est-ink);
	outline: 3px solid var(--est-focus);
	outline-offset: 2px;
}

.arco-est__unit {
	flex: none;
	color: var(--est-muted);
}

.arco-est__range {
	display: block;
	width: 100%;
	height: 2rem;
	margin: 0.375rem 0 0;
	accent-color: var(--est-ink);
	cursor: pointer;
}

/* Without scripts the visitor recalculates by a button; with them it is not needed. */

.arco-est__recalc {
	margin: 0 0 1.5rem;
}

.arco-est--js .arco-est__recalc {
	display: none;
}

/* The result ---------------------------------------------------------------- */

.arco-est__headline {
	margin: 0 0 0.75rem;
	font-family: var(--f-heading, inherit);
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1.25;
}

.arco-est__facts {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.5rem 1rem;
	margin: 0 0 1rem;
}

.arco-est__facts div {
	min-width: 0;
}

.arco-est__facts dt {
	color: var(--est-muted-tile);
	font-size: 1.0625rem;
}

.arco-est__facts dd {
	margin: 0;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.arco-est__split {
	display: flex;
	height: 1rem;
	margin: 0 0 0.5rem;
	overflow: hidden;
	border: 1px solid var(--est-on-tile);
	border-radius: 0.5rem;
}

.arco-est__split-part--1 {
	background: var(--est-on-tile);
}

.arco-est__split-part--2 {
	background: var(--est-none);
}

.arco-est__split-legend {
	margin: 0 0 1rem;
	padding: 0;
	list-style: none;
	font-size: 1.0625rem;
}

.arco-est__split-key {
	display: inline-block;
	width: 0.8em;
	height: 0.8em;
	margin-right: 0.5em;
	border: 1px solid var(--est-on-tile);
	border-radius: 0.2em;
}

.arco-est__split-item--1 .arco-est__split-key {
	background: var(--est-on-tile);
}

/* The foot of the panel: the estimate and the way on. */

.arco-est__foot {
	margin: 0 -1.25rem -1.25rem;
	padding: 0.875rem 1.25rem 1.25rem;
	border-top: 1px solid var(--est-hair);
	border-radius: 0 0 var(--est-radius) var(--est-radius);
	background: var(--est-tile);
	color: var(--est-on-tile);
}

.arco-est__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0.25rem 1rem;
	margin: 0 0 0.75rem;
}

.arco-est__price-label {
	font-size: 1.125rem;
}

.arco-est__price-value {
	font-family: var(--f-heading, inherit);
	font-size: clamp(1.875rem, 1.6rem + 1.1vw, 2.375rem);
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
	white-space: nowrap;
}

.arco-est__notes {
	margin: 0 0 0.75rem;
	padding-left: 1.25rem;
	font-size: 1.0625rem;
}

.arco-est__small {
	margin: 0 0 1rem;
	color: var(--est-muted-tile);
	font-size: 1.0625rem;
}

.arco-est__lines {
	margin: 0 0 0.5rem;
}

.arco-est__lines summary {
	padding: 0.5rem 0;
	border-radius: 0.25rem;
	background: var(--est-none);
	color: var(--est-on-tile);
	font-weight: 700;
	cursor: pointer;
}

.arco-est__lines summary:hover {
	border-color: var(--est-none);
	background: var(--est-none);
	color: var(--est-on-tile);
	text-decoration: underline;
}

.arco-est__lines summary:focus-visible {
	border-color: var(--est-none);
	background: var(--est-none);
	color: var(--est-on-tile);
	outline: 3px solid var(--est-focus);
	outline-offset: 2px;
}

.arco-est__table {
	width: 100%;
	margin: 0.5rem 0 0;
	border-collapse: collapse;
	font-size: 1.0625rem;
}

.arco-est__table th,
.arco-est__table td {
	padding: 0.5rem 0;
	border-bottom: 1px solid var(--est-hair);
	text-align: left;
	vertical-align: top;
	font-weight: 400;
}

.arco-est__table td {
	padding-left: 1rem;
	text-align: right;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.arco-est__table tfoot th,
.arco-est__table tfoot td {
	border-bottom: 0;
	font-weight: 700;
}

.arco-est__table--rows td {
	white-space: normal;
	font-weight: 700;
}

.arco-est__qty {
	display: block;
	color: var(--est-muted-tile);
}

.arco-est__next {
	width: 100%;
}

/* The phone bar: the estimate and the way on, always in reach. */

.arco-est__bar {
	position: sticky;
	bottom: 0;
	z-index: 6;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin: 1.5rem 0 0;
	padding: 0.625rem 0 calc(0.625rem + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid var(--est-line);
	background: var(--est-bg);
	color: var(--est-ink);
}

/* The amount is never squeezed or cut: on a phone its name stands above it in two short lines, and the
   button gives way instead. */

.arco-est__bar-price {
	display: flex;
	flex: none;
	flex-direction: column;
	margin: 0;
	line-height: 1.2;
}

.arco-est__bar-label {
	width: min-content;
	font-size: 1.0625rem;
}

@container est (min-width: 30rem) {
	.arco-est__bar-label {
		width: auto;
	}
}

.arco-est__bar-value {
	font-family: var(--f-heading, inherit);
	font-size: 1.375rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* On a narrow phone the button gives way: its words go to two lines before anything leaves the screen. */

.arco-est__bar .arco-est__next {
	width: auto;
	flex: 0 1 auto;
	min-width: 0;
	padding-inline: 0.875rem;
	white-space: normal;
	text-align: center;
}

@container est (max-width: 55.99rem) {
	.arco-est__panel .arco-est__next {
		display: none;
	}
}

@container est (max-width: 55.99rem) {
	.arco-est__foot .arco-est__price {
		margin-bottom: 0;
	}
}

/* Beside the questions the side scrolls on a low screen; its foot stays in view. */

@container est (min-width: 56rem) {
	.arco-est__bar {
		display: none;
	}

	.arco-est__foot {
		position: sticky;
		bottom: 0;
		z-index: 1;
	}
}

/* While the page asks for its changed parts. */

.arco-est.is-busy .arco-est__price-value,
.arco-est.is-busy .arco-est__bar-value {
	opacity: 0.55;
}

@media (prefers-reduced-motion: reduce) {
	.arco-est__box {
		transition: none;
	}
}

/* Before sending: the summary and the contact --------------------------------- */

.arco-est__back {
	margin: 0 0 1.5rem;
}

.arco-est__title {
	margin: 0 0 1rem;
	font-size: 1.75rem;
	line-height: 1.2;
}

.arco-est__subtitle {
	margin: 1.5rem 0 0.25rem;
	font-size: 1.375rem;
	line-height: 1.25;
}

.arco-est__summary,
.arco-est__contact {
	min-width: 0;
}

.arco-est--send .arco-est__drawbox {
	margin-bottom: 1rem;
}

.arco-est--send .arco-est__draw {
	--est-draw-h: 26rem;
}

.arco-est--send .arco-est__qty {
	color: var(--est-muted);
}

.arco-est--send .arco-est__small {
	color: var(--est-muted);
}

@container est (min-width: 56rem) {
	.arco-est__cols--send {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}
}

.arco-est__mail {
	margin: 1rem 0 1.5rem;
	padding: 1.25rem;
	border: 1px solid var(--est-hair);
	border-radius: var(--est-radius);
	background: var(--est-tile);
	color: var(--est-on-tile);
}

.arco-est__mail-subject {
	margin: 0 0 0.25rem;
	font-family: var(--f-heading, inherit);
	font-size: 1.25rem;
	font-weight: 700;
}

.arco-est__cta {
	padding-top: 0.5rem;
	border-top: 1px solid var(--est-hair);
}

@media print {
	.arco-est__bar,
	.arco-est__back,
	.arco-est__recalc,
	.arco-est__next,
	.arco-est__range {
		display: none;
	}
}
