/**
 * Regroup Build Enquiry — build-card modal.
 *
 * Skin: the shop's own system — cream paper, Matter for reading,
 * MatterMono for the card (a workshop spec card, not a form), cactus
 * green for selection and the brevet stamps, mustard for the customer's
 * answers. One handwritten moment only: the sign-off after sending.
 */

#regroup-be-root {
	--be-cream: #F8F5F0;
	--be-card: #FFFCF7;
	--be-ink: #111;
	--be-muted: #6e6a64;
	--be-hairline: rgba(17, 17, 17, 0.10);
	--be-cactus: #7f8236;
	--be-cactus-soft: rgba(127, 130, 54, 0.12);
	--be-mustard: #95745A;
	--be-sans: 'MatterRegular', system-ui, sans-serif;
	--be-sans-bold: 'MatterSemiBold', 'MatterRegular', system-ui, sans-serif;
	--be-mono: 'MatterMonoRegular', ui-monospace, SFMono-Regular, monospace;
	--be-mono-med: 'MatterMonoMedium', 'MatterMonoRegular', ui-monospace, monospace;
	--be-hand: 'Bradley Hand', 'Segoe Print', cursive;
	font-family: var(--be-sans);
	color: var(--be-ink);
	line-height: 1.5;
}

/*
 * Launch buttons live in page flow, outside the root. On product pages the
 * launcher reuses the theme's own pill classes (buttonmedium
 * elementor-button half) so it matches Call Us / Visit exactly — these
 * rules only dress the standalone button on brand archive pages.
 */
.rg-be-open:not(.elementor-button) {
	display: inline-block;
	margin: 14px 0 6px;
	padding: 14px 28px;
	background: transparent;
	color: #111;
	border: 1px solid #111;
	border-radius: 999px;
	font-family: 'MatterMonoMedium', ui-monospace, monospace;
	font-size: 13px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
}
.rg-be-open:not(.elementor-button):hover { background: #111; color: #FFFCF7; }

/* ---------- shell ---------- */

.rg-be-scrim {
	position: fixed;
	inset: 0;
	background: rgba(17, 17, 17, 0.45);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s;
	z-index: 9998;
}
/*
 * Mobile: full-screen takeover per the battle-tested chat-panel spec.
 * Anchored top+bottom (NEVER an explicit height — iOS reports transitional
 * visualViewport values mid-keyboard-animation and a height-sized panel
 * collapses). JS feeds --be-top/left/width/kb from the Visual Viewport API
 * while open; the fallbacks fill the viewport on browsers without it.
 */
.rg-be-modal {
	position: fixed;
	top: var(--be-top, 0px);
	left: var(--be-left, 0px);
	right: auto;
	bottom: var(--be-kb, 0px);
	width: var(--be-width, 100%);
	max-width: none;
	height: auto;
	max-height: none;
	background: var(--be-cream);
	border-radius: 0;
	box-shadow: 0 -8px 40px rgba(17, 17, 17, 0.25);
	transform: translateY(103%);
	visibility: hidden;
	pointer-events: none;
	transition: transform 0.32s cubic-bezier(0.32, 0.72, 0.28, 1), visibility 0.32s;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	z-index: 9999;
}
#regroup-be-root.rg-be-on .rg-be-scrim { opacity: 1; pointer-events: auto; }
#regroup-be-root.rg-be-on .rg-be-modal { transform: translateY(0); visibility: visible; pointer-events: auto; }
body.rg-be-open-body { overflow: hidden; }

@media (min-width: 640px) {
	.rg-be-modal {
		inset: 0;
		width: auto;
		margin: auto;
		max-width: 430px;
		height: min(760px, 94vh);
		border-radius: 12px;
		transform: translateY(24px);
		opacity: 0;
		transition: transform 0.28s, opacity 0.28s, visibility 0.28s;
	}
	#regroup-be-root.rg-be-on .rg-be-modal { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
	.rg-be-modal, .rg-be-scrim { transition: none; }
}

.rg-be-top {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: max(14px, env(safe-area-inset-top)) 18px 10px;
	border-bottom: 1px solid var(--be-hairline);
}
@media (min-width: 640px) {
	.rg-be-top { padding-top: 14px; }
}
.rg-be-shopline {
	font-family: var(--be-mono);
	font-size: 11px;
	letter-spacing: 0.22em;
	color: var(--be-muted);
}
.rg-be-shopline-name {
	font-family: var(--be-mono-med);
	font-weight: 600;
	color: var(--be-ink);
}
.rg-be-close {
	padding: 8px;
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	color: var(--be-muted);
	cursor: pointer;
}
.rg-be-scroll {
	flex: 1;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	padding: 20px 22px calc(30px + env(safe-area-inset-bottom));
}

.rg-be-intro { font-size: 15.5px; margin: 0 0 4px; }
.rg-be-intronote { font-size: 13px; color: var(--be-muted); margin: 0 0 18px; }

/* ---------- the build card ---------- */

.rg-be-card {
	background: var(--be-card);
	border: 1px solid var(--be-hairline);
	border-radius: 6px;
	margin-bottom: 22px;
	overflow: hidden;
}
.rg-be-cardhead {
	font-family: var(--be-mono);
	font-size: 10px;
	letter-spacing: 0.22em;
	color: var(--be-muted);
	padding: 10px 14px 2px;
}
.rg-be-row {
	display: flex;
	align-items: baseline;
	gap: 12px;
	width: 100%;
	text-align: left;
	padding: 8px 14px;
	min-height: 40px;
	background: none;
	border: none;
	border-top: 1px solid var(--be-hairline);
	cursor: pointer;
	font: inherit;
	color: inherit;
}
div.rg-be-row.rg-be-pre { cursor: default; border-top: none; border-bottom: 1px dashed var(--be-hairline); }
.rg-be-k {
	font-family: var(--be-mono);
	font-size: 10px;
	letter-spacing: 0.14em;
	color: var(--be-muted);
	text-transform: uppercase;
	flex: 0 0 88px;
}
.rg-be-v {
	font-family: var(--be-mono-med);
	font-size: 13.5px;
	color: var(--be-mustard);
	flex: 1;
}
.rg-be-pre .rg-be-v { font-family: var(--be-mono); font-size: 12px; color: var(--be-muted); }
.rg-be-stamp {
	flex: 0 0 auto;
	color: var(--be-cactus);
	opacity: 0.9;
	transform: rotate(-8deg);
	align-self: center;
}
.rg-be-stamp svg { display: block; }
.rg-be-cardhint {
	font-family: var(--be-mono);
	font-size: 10px;
	letter-spacing: 0.04em;
	color: var(--be-muted);
	padding: 4px 14px 10px;
	border-top: 1px solid var(--be-hairline);
}

/* ---------- questions ---------- */

.rg-be-q h2 {
	font-family: var(--be-sans-bold);
	font-size: 21px;
	font-weight: 600;
	line-height: 1.3;
	margin: 0 0 6px;
}
.rg-be-why { font-size: 14px; color: var(--be-muted); margin: 0 0 16px; }

.rg-be-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.rg-be-chip {
	border: 1px solid var(--be-ink);
	border-radius: 22px;
	padding: 11px 17px;
	background: var(--be-card);
	color: var(--be-ink);
	font-family: var(--be-sans);
	font-size: 15px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	cursor: pointer;
	transition: background 0.12s, color 0.12s;
}
.rg-be-chip svg { display: none; }
.rg-be-chip.rg-be-sel { background: var(--be-cactus); border-color: var(--be-cactus); color: var(--be-card); }
.rg-be-chip.rg-be-sel svg { display: block; }

/* Pinned to the scrollport bottom: the build card grows as answers land,
   and the primary action must never slide below the fold. */
.rg-be-foot {
	margin: 20px -22px 0;
	/* Safari's toolbar already keeps the layout viewport off the home
	   indicator — extra safe-area padding here made the bar hover. */
	padding: 10px 22px 12px;
	display: flex;
	align-items: center;
	gap: 18px;
	position: sticky;
	bottom: 0;
	background: var(--be-cream);
}
.rg-be-foot::before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	top: -18px;
	height: 18px;
	background: linear-gradient(to bottom, rgba(248, 245, 240, 0), var(--be-cream));
	pointer-events: none;
}
.rg-be-primary {
	background: var(--be-ink);
	color: var(--be-card);
	border: none;
	border-radius: 3px;
	font-family: var(--be-mono-med);
	font-size: 13px;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	padding: 14px 24px;
	min-height: 44px;
	cursor: pointer;
}
.rg-be-primary:disabled { opacity: 0.35; cursor: default; }
.rg-be-skip {
	background: none;
	border: none;
	font-family: var(--be-mono);
	font-size: 12px;
	color: var(--be-muted);
	text-decoration: underline;
	text-underline-offset: 3px;
	padding: 10px 0;
	min-height: 44px;
	cursor: pointer;
}
/* A note pinned to the card, brevet-style: dashed rule, faint stamp tilt,
   drawn mark at the left — not the standard callout bar. */
.rg-be-nudge {
	margin-top: 16px;
	padding: 12px 14px 14px;
	background: var(--be-card);
	border: 1px dashed var(--be-cactus);
	border-radius: 6px;
	font-size: 14px;
	display: flex;
	gap: 11px;
	align-items: flex-start;
	transform: rotate(-0.4deg);
	position: relative;
	overflow: hidden;
	cursor: pointer;
}
.rg-be-nudge-ic { color: var(--be-cactus); flex: 0 0 auto; margin-top: 1px; }
.rg-be-nudge-ic svg { display: block; }
/* The dwell timer: a line growing along the bottom edge; when it reaches
   the end, the flow advances. Duration set inline from text length. */
.rg-be-nudge-line {
	position: absolute;
	left: 0;
	bottom: 0;
	height: 2px;
	width: 100%;
	background: var(--be-cactus);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0ms linear;
}
.rg-be-nudge.rg-be-run .rg-be-nudge-line { transform: scaleX(1); }
@media (prefers-reduced-motion: reduce) {
	.rg-be-nudge { transform: none; }
	.rg-be-nudge-line { display: none; }
}

.rg-be-nm { margin-bottom: 10px; }
.rg-be-ta, .rg-be-tl, .rg-be-nm, .rg-be-em {
	width: 100%;
	border: 1px solid var(--be-ink);
	border-radius: 6px;
	background: var(--be-card);
	font-family: var(--be-sans);
	font-size: 16px;
	color: var(--be-ink);
	padding: 13px 14px;
}
.rg-be-ta { min-height: 110px; resize: vertical; }
.rg-be-ta:focus, .rg-be-tl:focus, .rg-be-nm:focus, .rg-be-em:focus,
#regroup-be-root :is(button, input, textarea):focus-visible {
	outline: 2px solid var(--be-cactus);
	outline-offset: 1px;
}
.rg-be-err { font-size: 13px; color: #a03d2e; margin: 8px 0 0; }

/* ---------- read-back / sent ---------- */

.rg-be-readback p { font-size: 16px; line-height: 1.65; margin: 0 0 14px; }
.rg-be-aside { font-size: 13px; color: var(--be-muted); }
.rg-be-sent { text-align: center; padding: 36px 0 10px; }
.rg-be-hand {
	font-family: var(--be-hand);
	font-size: 28px;
	color: var(--be-mustard);
	transform: rotate(-1.2deg);
	display: block;
	margin-bottom: 14px;
}
.rg-be-sent p { font-size: 14.5px; color: var(--be-muted); max-width: 32ch; margin: 0 auto; }
