/*
 * The bike builder's build sheet (inc/bike-builder.php,
 * template-parts/bike-builder.php, js/bike-builder.js).
 *
 * Excluded from the LiteSpeed CSS optimizer and versioned by filemtime, so it
 * can land BEFORE the combined bundle that carries style.css. Every rule here
 * therefore wins on specificity, never source order: the tag is named with
 * its class throughout, which also beats the Elementor kit's bare `button`.
 *
 * House chrome: 4px corners, pills, 1px ink rules, no raised panels.
 */

.rg-bb {
	--ink: #1c1c1c;
	--cream: #F8F5F0;
	--cream-2: #ECE7DF;
	--muted: #6e6a64;
	--tan: #876850;
	--rule: rgba(28, 28, 28, 0.16);
	--line: rgba(28, 28, 28, 0.32);
	--gutter: 48px;

	--display: 'Graphik Condensed Web', 'Arial Narrow', sans-serif;
	--body: 'MatterRegular', sans-serif;
	--semi: 'MatterSemiBold', sans-serif;
	--mono-med: 'MatterMonoMedium', monospace;

	background: var(--cream);
	color: var(--ink);
}

.rg-bb *,
.rg-bb *::before,
.rg-bb *::after { box-sizing: border-box; }
.rg-bb [hidden] { display: none !important; }
.rg-bb :focus-visible { outline: 2px solid var(--tan); outline-offset: 3px; }

.rg-bb div.rg-bb-wrap {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(380px, 496px);
	gap: 56px;
	align-items: start;
	padding: 40px var(--gutter) 96px;
}

/* ---- The bike: stays in view while the sheet scrolls ---- */

.rg-bb div.rg-bb-stage {
	position: sticky;
	top: calc(var(--rg-header-h, 96px) + 24px);
	min-width: 0;
}

.rg-bb div.rg-bb-photo {
	position: relative;
	aspect-ratio: 3 / 2;
	max-height: calc(100vh - var(--rg-header-h, 96px) - 150px);
	width: 100%;
	border-radius: 4px;
	overflow: hidden;
	background: var(--cream-2);
}

/* Studio shots come on white: multiply lets the white take the tile's ground. */
.rg-bb div.rg-bb-photo img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: contain;
	mix-blend-mode: multiply;
	display: block;
}

.rg-bb p.rg-bb-cap {
	position: absolute;
	left: 20px;
	right: 20px;
	bottom: 14px;
	margin: 0;
	font: 400 14px/1.3 var(--body);
	color: var(--muted);
}

.rg-bb div.rg-bb-thumbs { display: flex; gap: 10px; margin-top: 12px; }

.rg-bb button.rg-bb-thumb {
	flex: 0 1 112px;
	min-width: 0;
	aspect-ratio: 3 / 2;
	margin: 0;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 4px;
	overflow: hidden;
	background: var(--cream-2);
	cursor: pointer;
}
.rg-bb button.rg-bb-thumb.is-on { border-color: var(--ink); }
.rg-bb button.rg-bb-thumb img { width: 100%; height: 100%; max-width: none; object-fit: cover; mix-blend-mode: multiply; display: block; }

/* ---- The sheet ---- */

.rg-bb div.rg-bb-sheet { min-width: 0; }

.rg-bb p.rg-bb-brand { margin: 0 0 12px; font: 500 16px/1.2 var(--mono-med); letter-spacing: 0.1em; text-transform: uppercase; }
.rg-bb p.rg-bb-brand a { color: var(--ink); font: inherit; text-decoration: none; }
.rg-bb p.rg-bb-brand a:hover { text-decoration: underline; text-underline-offset: 4px; }

body .rg-bb h1.rg-bb-ttl {
	margin: 0 0 16px !important;
	font-family: var(--display) !important;
	font-weight: 700 !important;
	font-size: 60px !important;
	line-height: 0.95 !important;
	letter-spacing: 0 !important;
	text-transform: uppercase;
	color: var(--ink);
}

.rg-bb p.rg-bb-lead { margin: 0 0 28px; font: 400 18px/1.5 var(--body); color: var(--ink); }
.rg-bb p.rg-bb-custom { margin: -16px 0 28px; font: 400 16px/1.5 var(--body); color: var(--muted); }
.rg-bb p.rg-bb-custom a { color: var(--ink); font: inherit; text-decoration: underline; text-underline-offset: 3px; }

.rg-bb section.rg-bb-step { border-top: 1px solid var(--rule); }
.rg-bb section.rg-bb-step:first-of-type { border-top-color: var(--ink); }
.rg-bb p.rg-bb-step-h { margin: 0; }

.rg-bb button.rg-bb-step-hd {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	margin: 0;
	padding: 20px 0 14px;
	border: 0;
	border-radius: 0;
	background: none;
	box-shadow: none;
	color: var(--ink);
	text-align: left;
	cursor: default;
}

.rg-bb span.rg-bb-num { font: 500 15px/1 var(--mono-med); letter-spacing: 0.14em; color: var(--muted); }
.rg-bb span.rg-bb-num:empty { display: none; }
.rg-bb span.rg-bb-lab { font: 500 15px/1 var(--mono-med); letter-spacing: 0.14em; text-transform: uppercase; }
.rg-bb span.rg-bb-ans { margin-left: auto; font: 500 15px/1.2 var(--mono-med); letter-spacing: 0.04em; text-align: right; color: var(--tan); }
.rg-bb span.rg-bb-ans.is-todo { color: var(--muted); }

.rg-bb span.rg-bb-tick {
	display: none;
	flex: none;
	width: 22px;
	height: 22px;
	transform: rotate(-9deg);
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 26'%3E%3Ccircle cx='13' cy='13' r='11.5' fill='none' stroke='%237f8236' stroke-width='1.6'/%3E%3Cpath d='M8 13.5l3.3 3.2L18.5 9' fill='none' stroke='%237f8236' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.rg-bb section.rg-bb-step.is-done span.rg-bb-tick { display: block; }

.rg-bb span.rg-bb-chev { display: none; flex: none; width: 9px; height: 9px; margin: -4px 4px 0 2px; border-right: 1.6px solid var(--ink); border-bottom: 1.6px solid var(--ink); transform: rotate(45deg); transition: transform 0.2s; }

.rg-bb div.rg-bb-step-bd { padding: 0 0 26px; }

/* Builds */
.rg-bb div.rg-bb-opts { display: grid; gap: 10px; }

.rg-bb a.rg-bb-opt {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 16px 18px;
	border: 1px solid var(--line);
	border-radius: 4px;
	background: transparent;
	color: var(--ink);
	text-decoration: none;
	transition: border-color 0.15s;
}
.rg-bb a.rg-bb-opt:hover { border-color: var(--ink); }
.rg-bb a.rg-bb-opt.is-on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.rg-bb span.rg-bb-opt-tx { flex: 1 1 auto; min-width: 0; display: grid; gap: 3px; }
.rg-bb span.rg-bb-opt-nm { font: 400 18px/1.25 var(--semi); }
.rg-bb span.rg-bb-opt-sub { font: 400 15px/1.35 var(--body); color: var(--muted); }
.rg-bb span.rg-bb-opt-pr,
.rg-bb span.rg-bb-opt-pr * { font: 500 15px/1 var(--mono-med); letter-spacing: 0.04em; white-space: nowrap; color: var(--ink); }

/* Finishes */
.rg-bb div.rg-bb-swatches { display: flex; flex-wrap: wrap; gap: 10px; }

.rg-bb button.rg-bb-sw {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	min-height: 48px;
	margin: 0;
	padding: 7px 18px 7px 8px;
	border: 1px solid var(--line);
	border-radius: 99px;
	background: transparent;
	box-shadow: none;
	color: var(--ink);
	font: 400 15px/1.2 var(--body);
	letter-spacing: 0;
	text-transform: none;
	text-align: left;
	cursor: pointer;
	transition: border-color 0.15s;
}
.rg-bb button.rg-bb-sw:hover { border-color: var(--ink); }
.rg-bb button.rg-bb-sw.is-on { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.rg-bb span.rg-bb-sw-dot { flex: none; width: 32px; height: 32px; border-radius: 50%; border: 1px solid rgba(28, 28, 28, 0.18); background: var(--cream-2); }
/* A finish that costs more: the amount, in the same voice as a build's price. */
.rg-bb span.rg-bb-sw-pr { font: 500 13px/1 var(--mono-med); letter-spacing: 0.04em; white-space: nowrap; color: var(--muted); }

/* Sizes and fit */
.rg-bb div.rg-bb-chips { display: flex; flex-wrap: wrap; gap: 8px; }

.rg-bb button.rg-bb-chip {
	min-width: 58px;
	height: 44px;
	margin: 0;
	padding: 0 16px;
	border: 1px solid var(--line);
	border-radius: 99px;
	background: transparent;
	box-shadow: none;
	color: var(--ink);
	font: 500 15px/1 var(--mono-med);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	cursor: pointer;
	transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.rg-bb button.rg-bb-chip:hover { border-color: var(--ink); }
.rg-bb button.rg-bb-chip.is-on { border-color: var(--ink); background: var(--ink); color: var(--cream); }
.rg-bb button.rg-bb-chip.is-soft { border-style: dashed; }
.rg-bb button.rg-bb-chip.is-soft.is-on { border-style: solid; background: var(--cream-2); color: var(--ink); }

/* No size yet: a ringed field and an arrow-led note under it, never a banner. */
.rg-bb div.rg-bb-ring.is-missing { margin: -10px; padding: 9px; border: 1px solid var(--tan); border-radius: 30px; }
.rg-bb p.rg-bb-err { margin: 12px 0 0; font: 500 14px/1.3 var(--mono-med); letter-spacing: 0.1em; text-transform: uppercase; color: var(--tan); }
.rg-bb p.rg-bb-note { margin: 14px 0 0; padding: 16px 18px; border-radius: 4px; background: var(--cream-2); font: 400 16px/1.5 var(--body); }
.rg-bb p.rg-bb-note a { color: var(--ink); font: inherit; letter-spacing: 0; text-transform: none; text-decoration: underline; text-underline-offset: 3px; }
.rg-bb p.rg-bb-intro { margin: 0 0 4px; font: 400 16px/1.5 var(--body); }
.rg-bb p.rg-bb-sub { margin: 18px 0 10px; font: 500 14px/1.2 var(--mono-med); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.rg-bb p.rg-bb-hint { margin: 16px 0 0; font: 400 15px/1.45 var(--body); color: var(--muted); }

/* Geometry */
.rg-bb details.rg-bb-geo { margin-top: 16px; }
.rg-bb details.rg-bb-geo summary { font: 400 15px/1.4 var(--body); color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.rg-bb div.rg-bb-geo-scroll { margin-top: 12px; overflow-x: auto; }
.rg-bb details.rg-bb-geo table { width: 100%; margin: 0; border-collapse: collapse; border: 0; }
.rg-bb details.rg-bb-geo th,
.rg-bb details.rg-bb-geo td { padding: 9px 12px 9px 0; border: 0; border-top: 1px solid var(--rule); background: transparent; font: 500 14px/1.2 var(--mono-med); letter-spacing: 0.04em; text-align: right; white-space: nowrap; color: var(--ink); }
.rg-bb details.rg-bb-geo th:first-child { text-align: left; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.rg-bb details.rg-bb-geo tr:first-child th { border-top: 0; color: var(--ink); }

/* What's on it */
.rg-bb dl.rg-bb-specs { margin: 0; }
.rg-bb dl.rg-bb-specs > div { display: flex; gap: 24px; padding: 10px 0; border-top: 1px solid var(--rule); }
.rg-bb dl.rg-bb-specs > div:first-child { border-top: 0; padding-top: 0; }
.rg-bb dl.rg-bb-specs dt { flex: none; width: 150px; margin: 0; padding-top: 2px; font: 500 14px/1.3 var(--mono-med); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.rg-bb dl.rg-bb-specs dd { margin: 0; font: 400 16px/1.35 var(--body); }

/* ---- The total and the button: ride the foot of the window ---- */

.rg-bb form.rg-bb-form {
	position: sticky;
	bottom: 0;
	z-index: 3;
	display: flex;
	flex-wrap: wrap;
	gap: 12px 10px;
	margin: 0;
	padding: 16px 0 20px;
	border-top: 1px solid var(--ink);
	background: var(--cream);
}

/* The chat bubble is fixed in the window's corner, where the stuck foot's
   buttons end. While the foot is stuck (js/bike-builder.js) the buttons stop
   short, and the bubble sits in the slot like a third button. */
.rg-bb form.rg-bb-form.is-stuck { padding-right: var(--rg-bb-chat-slot, 0px); }
.rg-bb form.rg-bb-form.is-stuck p.rg-bb-total { margin-right: calc(var(--rg-bb-chat-slot, 0px) * -1); }

.rg-bb p.rg-bb-total { flex: 0 0 100%; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin: 0; }
.rg-bb p.rg-bb-total > span:first-child { font: 500 16px/1 var(--mono-med); letter-spacing: 0.1em; text-transform: uppercase; }
.rg-bb p.rg-bb-total > span:last-child,
.rg-bb p.rg-bb-total > span:last-child * { font: 500 24px/1 var(--mono-med); letter-spacing: 0.02em; color: var(--ink); }

.rg-bb form.rg-bb-form button.rg-bb-cta {
	flex: 1 1 0;
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 0;
	height: 56px;
	margin: 0;
	padding: 0 24px;
	border: 1px solid var(--ink);
	border-radius: 99px;
	background: var(--ink);
	box-shadow: none;
	color: var(--cream);
	font: 500 17px/1 var(--mono-med);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.15s;
}
.rg-bb form.rg-bb-form button.rg-bb-cta:hover { background: #333; }
.rg-bb form.rg-bb-form button.rg-bb-cta.is-adding { opacity: 0.7; cursor: progress; }

.rg-bb form.rg-bb-form a.rg-bb-second {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: center;
	height: 56px;
	margin: 0;
	padding: 0 22px;
	border: 1px solid var(--ink);
	border-radius: 99px;
	color: var(--ink);
	font: 500 15px/1 var(--mono-med);
	letter-spacing: 0.05em;
	text-transform: uppercase;
	text-decoration: none;
	transition: background 0.15s, color 0.15s;
}
.rg-bb form.rg-bb-form a.rg-bb-second:hover { background: var(--ink); color: var(--cream); }

@media (max-width: 1200px) {
	.rg-bb { --gutter: 32px; }
	.rg-bb div.rg-bb-wrap { gap: 40px; }
	body .rg-bb h1.rg-bb-ttl { font-size: 52px !important; }
}

/* ---- Narrow: the bike pins under the header, one step open at a time,
        the total and the button in a bar along the bottom ---- */

@media (max-width: 900px) {
	.rg-bb { --gutter: 24px; }

	.rg-bb div.rg-bb-wrap { display: block; padding: 0 0 132px; }

	.rg-bb div.rg-bb-stage { top: var(--rg-header-h, 60px); z-index: 4; }
	.rg-bb div.rg-bb-photo { max-height: 32vh; border-radius: 0; }
	.rg-bb p.rg-bb-cap { left: var(--gutter); bottom: 8px; }
	.rg-bb div.rg-bb-thumbs { display: none; }

	.rg-bb div.rg-bb-head { padding: 22px var(--gutter) 18px; }
	.rg-bb p.rg-bb-brand { font-size: 15px; margin-bottom: 8px; }
	body .rg-bb h1.rg-bb-ttl { font-size: 40px !important; margin-bottom: 10px !important; }
	.rg-bb p.rg-bb-lead { margin: 0; font-size: 16px; }
	.rg-bb p.rg-bb-custom { margin: 10px 0 0; font-size: 15px; }

	.rg-bb section.rg-bb-step:first-of-type { border-top-color: var(--rule); }
	.rg-bb button.rg-bb-step-hd { min-height: 64px; padding: 0 var(--gutter); gap: 10px; cursor: pointer; }
	.rg-bb span.rg-bb-num { font-size: 14px; }
	.rg-bb span.rg-bb-ans { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
	.rg-bb span.rg-bb-chev { display: block; }
	.rg-bb section.rg-bb-step.is-open span.rg-bb-chev { transform: rotate(225deg); margin-top: 4px; }
	.rg-bb div.rg-bb-step-bd { padding: 2px var(--gutter) 22px; }
	.rg-bb section.rg-bb-step:not(.is-open) div.rg-bb-step-bd { display: none; }
	.rg-bb section.rg-bb-step:last-of-type { border-bottom: 1px solid var(--rule); }

	.rg-bb span.rg-bb-opt-nm { font-size: 17px; }
	.rg-bb dl.rg-bb-specs > div { display: block; }
	.rg-bb dl.rg-bb-specs dt { width: auto; margin-bottom: 2px; }
	.rg-bb dl.rg-bb-specs dd { font-size: 15px; }

	.rg-bb form.rg-bb-form {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 90;
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto;
		align-items: center;
		gap: 12px;
		padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom, 0px));
	}
	.rg-bb p.rg-bb-total { flex: none; display: grid; gap: 4px; margin: 0; }
	.rg-bb p.rg-bb-total > span:first-child { font-size: 14px; color: var(--muted); }
	.rg-bb p.rg-bb-total > span:last-child,
	.rg-bb p.rg-bb-total > span:last-child * { font-size: 20px; }
	.rg-bb form.rg-bb-form button.rg-bb-cta { flex: none; height: 52px; padding: 0 22px; font-size: 15px; }
	/* The size step's "Not sure" note carries the way in to Plan Your Build here. */
	.rg-bb form.rg-bb-form a.rg-bb-second { display: none; }

	.rg-bb form.rg-bb-form.is-stuck { padding-right: var(--gutter); }
	.rg-bb form.rg-bb-form.is-stuck p.rg-bb-total { margin-right: 0; }

	/* The chat bubble would sit on the button: lift it clear of the bar. */
	body.rg-bb-page #regroup-chat-root { bottom: calc(92px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
	.rg-bb *,
	.rg-bb *::before,
	.rg-bb *::after { transition: none !important; }
}
