/*
 * Build Your Own configurator.
 *
 * Ported from the demo Jed signed off (9/13 to 9/14). Two equal panels under a
 * centered title, the invitation to call centered beneath them. Sits inside
 * .se-design, so the palette and font tokens are already in scope.
 *
 * Color carries the one thing being chosen. Blues are soft, greens are firm,
 * and lighter always means softer within each family. The lightest blue is
 * Ultra Soft, the darkest green is Ultra Firm. Never red.
 *
 * The buyer skews well over fifty, so base type is 17px, every target is at
 * least 48px tall, and nothing is small tracked uppercase.
 */

.byo {
	--byo-ground: var(--white);
	--byo-panel: var(--mist);
	--byo-line: #CFE0E2;
	--byo-ink-soft: var(--ink2);
	--byo-deep: var(--blue-deep);
	--byo-mid: var(--blue-mid);
	--byo-clay: var(--accent);
	--byo-clay-deep: #A85E2F;
	--byo-edge: rgba(23, 40, 43, .09);
	--byo-lift: rgba(23, 40, 43, .16);

	display: grid;
	grid-template-rows: auto auto auto;
	gap: 16px;
	max-width: 1280px;
	margin: 0 auto;
	padding: 22px 26px 28px;
	font-family: var(--sans);
	font-size: 17px;
	line-height: 1.45;
	color: var(--ink);
}

.byo * {
	box-sizing: border-box;
}

.byo button {
	font: inherit;
	color: inherit;
}

.byo p.byo-down {
	max-width: 40ch;
	margin: 40px auto;
	text-align: center;
	font-size: 20px;
}

/* ------------------------------------------------------------ density scale
   Each density owns a color (--c) and a text color that passes on it (--fg).
   The same color follows the density onto the button, the slab and the
   arrangement swatch. */
.byo .d1 { --c: #A9D3EE; --fg: #17282B; }
.byo .d2 { --c: #62A9DE; --fg: #17282B; }
.byo .d3 { --c: #2C6FB5; --fg: #FFFFFF; }
.byo .d4 { --c: #A9D48C; --fg: #17282B; }
.byo .d5 { --c: #63A94F; --fg: #17282B; }
.byo .d6 { --c: #2A6B35; --fg: #FFFFFF; }

/* ------------------------------------------------------------------ title */
.byo .byo-mast {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	text-align: center;
}

.byo .byo-title {
	margin: 0;
	font-family: var(--soft);
	font-weight: 300;
	letter-spacing: -.03em;
	font-size: clamp(34px, 4.6vw, 56px);
	line-height: 1.05;
	color: var(--ink);
	text-wrap: balance;
}
.byo .byo-title b {
	font-weight: 800;
	color: var(--byo-deep);
}

.byo .byo-tagline {
	margin: 0;
	font-family: var(--soft);
	font-size: clamp(20px, 2vw, 26px);
	font-weight: 700;
	color: var(--byo-ink-soft);
}

/* ---------------------------------------------------------------- columns
   Both columns are panels with the same padding, so their headings start on
   the same line and their bottoms end on the same line. */
.byo .byo-split {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 24px;
	min-height: 0;
}

.byo .byo-ctl,
.byo .byo-vis {
	display: flex;
	flex-direction: column;
	min-height: 0;
	padding: 18px 18px 16px;
	border-radius: 18px;
	background: var(--byo-panel);
}
.byo .byo-ctl {
	gap: 16px;
}
/* design.css pads every section inside .se-design. These are steps in a
   panel, not page sections. */
.byo .byo-step {
	margin: 0;
	padding: 0;
}

/* Step titles. Numbered, because the page is a sequence and the number is the
   thing that tells a first-time visitor what to do next. */
.byo .byo-head {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 4px;
	font-family: var(--soft);
	font-size: 21px;
	font-weight: 800;
	letter-spacing: 0;
	color: var(--ink);
	line-height: 1.2;
	text-wrap: balance;
}
.byo .byo-n {
	display: grid;
	place-items: center;
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--byo-deep);
	color: #fff;
	font-family: var(--soft);
	font-size: 17px;
	font-weight: 800;
}
.byo .byo-sub {
	margin: 0 0 8px 46px;
	font-size: 15.5px;
	color: var(--byo-ink-soft);
	text-wrap: pretty;
}

/* ---------------------------------------------------------------- filters */
.byo .byo-filters {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 24px;
	margin: 10px 0 0 46px;
}
.byo .byo-filter {
	display: flex;
	align-items: center;
	gap: 10px;
}
.byo .byo-filter > span {
	font-family: var(--soft);
	font-size: 15px;
	font-weight: 700;
	color: var(--byo-ink-soft);
}

.byo select {
	min-height: 42px;
	padding: 6px 36px 6px 13px;
	border: 2px solid var(--byo-line);
	border-radius: 10px;
	background: var(--byo-ground);
	color: var(--ink);
	font: inherit;
	font-family: var(--soft);
	font-weight: 700;
	font-size: 16px;
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, var(--byo-deep) 50%), linear-gradient(135deg, var(--byo-deep) 50%, transparent 50%);
	background-position: calc(100% - 19px) 55%, calc(100% - 13px) 55%;
	background-size: 6px 6px, 6px 6px;
	background-repeat: no-repeat;
}
.byo select:focus-visible {
	outline: 3px solid var(--byo-clay);
	outline-offset: 2px;
}

.byo .byo-seg {
	display: inline-flex;
	padding: 3px;
	border-radius: 10px;
	background: var(--pale);
}
.byo .byo-seg label {
	position: relative;
	margin: 0;
}
.byo .byo-seg input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}
.byo .byo-seg span {
	display: block;
	min-height: 36px;
	padding: 7px 15px;
	border-radius: 8px;
	font-family: var(--soft);
	font-size: 16px;
	font-weight: 700;
	color: var(--byo-ink-soft);
	cursor: pointer;
	transition: background .15s, color .15s;
}
.byo .byo-seg input:checked + span {
	background: var(--byo-deep);
	color: #fff;
}
.byo .byo-seg input:disabled + span {
	opacity: .4;
	cursor: default;
}
.byo .byo-seg input:focus-visible + span {
	outline: 3px solid var(--byo-clay);
	outline-offset: 1px;
}

/* ---------------------------------------------------------------- presets
   Compact on purpose. The card carries the code, a swatch and the benefit;
   the reasoning lives in the popup, so the cards stay a single quiet row. */
.byo .byo-presets {
	position: relative;
	z-index: 2;
}
.byo .byo-preset-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 8px;
}

.byo .byo-preset {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-height: 0;
	padding: 9px 12px;
	border: 2px solid var(--byo-line);
	border-radius: 14px;
	background: var(--byo-ground);
	text-align: left;
	cursor: pointer;
	transition: border-color .16s, background .16s, transform .16s;
}
.byo .byo-preset:hover {
	border-color: var(--byo-mid);
	transform: translateY(-1px);
}
.byo .byo-preset:focus-visible {
	outline: 3px solid var(--byo-clay);
	outline-offset: 2px;
}
/* The hover transform makes the card its own stacking context, which trapped
   the popup beneath the density buttons drawn later. Lift the whole card. */
.byo .byo-preset:hover,
.byo .byo-preset:focus-within {
	z-index: 30;
}
.byo .byo-preset.on {
	border-color: var(--byo-deep);
	background: var(--pale);
}

.byo .byo-tag {
	font-family: var(--soft);
	font-size: 13px;
	font-weight: 800;
	letter-spacing: .05em;
	color: var(--byo-mid);
}
/* A three-stripe swatch, top layer on top, so the four arrangements can be
   told apart before a word is read. */
.byo .byo-sw {
	position: absolute;
	top: 10px;
	right: 12px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	width: 26px;
}
.byo .byo-sw i {
	display: block;
	height: 7px;
	border-radius: 3px;
	background: var(--c);
}
.byo .byo-preset b {
	font-family: var(--soft);
	font-size: 15.5px;
	font-weight: 800;
	color: var(--byo-deep);
	line-height: 1.2;
	text-wrap: balance;
}

.byo .byo-more {
	position: absolute;
	left: 0;
	width: 340px;
	max-width: 82vw;
	top: calc(100% + 8px);
	z-index: 20;
	display: none;
	padding: 12px 14px;
	border-radius: 12px;
	background: var(--ink);
	color: var(--byo-ground);
	font-size: 15px;
	font-weight: 400;
	line-height: 1.45;
	box-shadow: 0 12px 28px var(--byo-lift);
	text-wrap: pretty;
}
.byo .byo-more::after {
	content: "";
	position: absolute;
	bottom: 100%;
	left: 26px;
	border: 8px solid transparent;
	border-bottom-color: var(--ink);
}
.byo .byo-preset:hover .byo-more,
.byo .byo-preset:focus-visible .byo-more {
	display: block;
}
/* The two right-hand cards open their popup toward the left so it stays on screen. */
.byo .byo-preset:nth-child(n+3) .byo-more {
	left: auto;
	right: 0;
}
.byo .byo-preset:nth-child(n+3) .byo-more::after {
	left: auto;
	right: 26px;
}
.byo .byo-more strong {
	color: inherit;
}
.byo .byo-more em {
	display: block;
	margin-top: 6px;
	font-style: normal;
	font-size: 13px;
	opacity: .7;
}

/* --------------------------------------------------------------- fine tune
   One layer at a time. Layers down the left, the six densities for the chosen
   layer on the right. On a split bed a Left / Right switch sits above them. */
.byo .byo-tune {
	display: grid;
	grid-template-columns: 150px minmax(0, 1fr);
	gap: 16px;
	align-items: start;
}
.byo .byo-tune-grid {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.byo .byo-tabs {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.byo .byo-tab {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 54px;
	padding: 8px 10px;
	border: 2px solid var(--byo-line);
	border-radius: 10px;
	background: var(--byo-ground);
	font-family: var(--soft);
	font-size: 16px;
	font-weight: 700;
	color: var(--byo-ink-soft);
	cursor: pointer;
	transition: border-color .15s, background .15s, color .15s;
}
.byo .byo-tab:hover {
	border-color: var(--byo-mid);
}
.byo .byo-tab.on {
	border-color: var(--ink);
	background: var(--ink);
	color: var(--byo-ground);
}
.byo .byo-tab:focus-visible {
	outline: 3px solid var(--byo-clay);
	outline-offset: 2px;
}
.byo[data-layers="3"] .byo-tab[data-slot="base"] {
	display: none;
}

/* Left / Right spans the full width of the density grid beneath it. */
.byo .byo-sides {
	display: none;
	width: 100%;
	margin-bottom: 10px;
}
.byo.is-split .byo-sides {
	display: flex;
}
.byo .byo-sides label {
	flex: 1 1 0;
}
.byo .byo-sides span {
	text-align: center;
}

.byo .byo-dens {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

/* Each density cell sits in its real color all the time. Testers read a faded
   tint as "not that color yet". Selection is a heavier frame, not a color
   change. */
.byo .byo-den {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 9px;
	min-height: 64px;
	margin: 0;
	padding: 6px 10px;
	border: 2px solid transparent;
	border-radius: 11px;
	background: var(--c);
	color: var(--fg);
	text-align: center;
	cursor: pointer;
	transition: transform .1s, box-shadow .15s, border-color .15s;
}
.byo .byo-den input {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
}
.byo .byo-den span {
	font-family: var(--soft);
	font-size: 16.5px;
	font-weight: 700;
	line-height: 1.15;
	color: var(--fg);
}
.byo .byo-den:hover {
	transform: translateY(-1px);
	box-shadow: 0 6px 14px color-mix(in srgb, var(--c) 45%, transparent);
}
.byo .byo-den:active {
	transform: scale(.96);
}
/* Selected: same color, heavier frame. A dark ring with a white gap reads on
   every shade, light blue through dark green. */
.byo .byo-den.on {
	border-color: var(--ink);
	box-shadow: 0 0 0 2px var(--byo-ground) inset, 0 6px 16px color-mix(in srgb, var(--c) 45%, transparent);
}
.byo .byo-den.on span {
	font-weight: 800;
}
.byo .byo-den:focus-within {
	outline: 3px solid var(--ink);
	outline-offset: 2px;
}

.byo .byo-fallback {
	margin: 12px 0 0;
	font-size: 15px;
	color: var(--byo-ink-soft);
}

/* --------------------------------------------------------------- the stack
   Visualization, and the way you pick which layer to work on. */
.byo .byo-stagehead {
	margin: 0;
	font-family: var(--soft);
	font-size: clamp(30px, 3.4vw, 42px);
	font-weight: 800;
	letter-spacing: -.02em;
	line-height: 1.1;
	color: var(--byo-deep);
	text-align: center;
	text-wrap: balance;
}
.byo .byo-vistitle {
	margin: 6px 0 0;
	font-family: var(--soft);
	font-size: 18px;
	font-weight: 800;
	color: var(--byo-ink-soft);
	text-align: center;
}
.byo .byo-tries {
	margin: 2px 0 0;
	font-size: 14px;
	color: var(--byo-ink-soft);
	text-align: center;
}
.byo .byo-tries b {
	font-family: var(--soft);
	font-weight: 800;
	color: var(--byo-deep);
	font-variant-numeric: tabular-nums;
}

/* The slabs share the column's height between them, so the stack fills the
   space instead of leaving a void below it. */
.byo .byo-stack {
	display: flex;
	flex-direction: column;
	gap: 7px;
	flex: 1 1 auto;
	min-height: 0;
	margin: 14px 0;
}
.byo .byo-layers {
	display: flex;
	flex-direction: column;
	gap: 7px;
	flex: 1 1 auto;
	min-height: 0;
}

.byo .byo-cover {
	display: grid;
	place-items: center;
	min-height: 26px;
	margin: 0 -7px;
	padding: 4px 10px;
	border-radius: 10px 10px 4px 4px;
	background: linear-gradient(180deg, var(--pale), var(--byo-line));
	font-family: var(--soft);
	font-size: 13px;
	font-weight: 800;
	color: var(--byo-deep);
}
.byo .byo-cover.foot {
	border-radius: 4px 4px 12px 12px;
	background: linear-gradient(180deg, var(--byo-line), var(--pale));
}

/* A layer is one slab, or two side by side on a split bed. The gap between the
   two halves is the split. The default color only applies until the first
   paint; it lives on the layer so the density class on the face wins. */
.byo .byo-layer {
	--c: #F3F0EA;
	--fg: var(--ink);
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 12px;
	flex: 1 1 0;
	min-height: 64px;
}
.byo.is-split .byo-layer {
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.byo .byo-face.r {
	display: none;
}
.byo.is-split .byo-face.r {
	display: flex;
}

/* A slab in its density's color. A lighter top edge and a darker foot keep it
   reading as a thing with thickness. */
.byo .byo-face {
	flex: 1 1 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-width: 0;
	padding: 10px 18px;
	border: 3px solid transparent;
	border-radius: 12px;
	background: linear-gradient(180deg, color-mix(in srgb, var(--c) 82%, white) 0%, var(--c) 55%, color-mix(in srgb, var(--c) 86%, black) 100%);
	box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 2px 5px var(--byo-edge);
	text-align: left;
	cursor: grab;
	touch-action: none;
	transition: transform .22s cubic-bezier(.34, 1.56, .64, 1), box-shadow .22s, border-color .2s, background .25s;
}
.byo .byo-face:hover {
	transform: translateX(3px);
}
.byo .byo-face:focus-visible {
	outline: 3px solid var(--ink);
	outline-offset: 3px;
}

/* The layer being worked on gets a dark ring, which shows on any color. On a
   split bed only the side being worked on reacts: the layer carries side-l or
   side-r while split; with neither, both faces qualify and only the left one
   is visible anyway. */
.byo .byo-layer.on:not(.side-r) .byo-face.l,
.byo .byo-layer.on:not(.side-l) .byo-face.r {
	border-color: var(--ink);
	box-shadow: inset 0 2px 0 rgba(255, 255, 255, .35), 0 8px 20px var(--byo-lift);
}
.byo .byo-layer.bump:not(.side-r) .byo-face.l,
.byo .byo-layer.bump:not(.side-l) .byo-face.r {
	transform: translateY(-8px) scale(1.015);
}
.byo .byo-layer.drag .byo-face {
	cursor: grabbing;
	transition: none;
	box-shadow: 0 18px 34px var(--byo-lift);
	z-index: 5;
}
.byo .byo-layer.target .byo-face {
	border-color: var(--ink);
	border-style: dashed;
}

.byo .byo-pos {
	font-family: var(--soft);
	font-size: 15px;
	font-weight: 700;
	color: var(--fg);
	opacity: .85;
	white-space: nowrap;
}
.byo .byo-vals {
	text-align: right;
}
.byo .byo-vals i {
	font-style: normal;
	font-family: var(--soft);
	font-size: 21px;
	font-weight: 800;
	color: var(--fg);
	white-space: nowrap;
}
.byo .byo-layer.bump:not(.side-r) .byo-face.l .byo-vals i,
.byo .byo-layer.bump:not(.side-l) .byo-face.r .byo-vals i {
	text-decoration: underline;
	text-decoration-thickness: 3px;
	text-underline-offset: 4px;
}

/* ----------------------------------------------------------- the quiet close */
.byo .byo-close {
	padding-top: 12px;
	border-top: 2px solid var(--byo-line);
}
.byo .byo-meta {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
	margin: 0 0 10px;
	font-size: 15px;
	color: var(--byo-ink-soft);
}
.byo .byo-meta b {
	font-family: var(--soft);
	font-weight: 800;
	color: var(--byo-deep);
	font-variant-numeric: tabular-nums;
}
.byo .byo-meta code {
	padding: 0;
	background: none;
	font-family: var(--soft);
	font-weight: 800;
	font-size: 15px;
	letter-spacing: .04em;
	color: var(--byo-deep);
}

.byo .byo-cta {
	display: block;
	width: 100%;
	min-height: 54px;
	padding: 13px 20px;
	border: 0;
	border-radius: 999px;
	background: var(--byo-clay);
	color: #fff;
	font-family: var(--soft);
	font-size: 18px;
	font-weight: 800;
	cursor: pointer;
	transition: background .18s, transform .16s;
}
.byo .byo-cta:hover {
	background: var(--byo-clay-deep);
	transform: translateY(-2px);
}
.byo .byo-cta:focus-visible {
	outline: 3px solid var(--byo-deep);
	outline-offset: 3px;
}
.byo .byo-cta:disabled {
	opacity: .6;
	cursor: default;
	transform: none;
}

.byo .byo-msg {
	min-height: 1.4em;
	margin: 8px 0 0;
	font-size: 14.5px;
	color: var(--byo-deep);
	text-align: center;
}
.byo .byo-msg.bad {
	color: var(--alarm);
}

/* ------------------------------------------------------------ the consult
   Centered under both panels, like the title above them. This is a path we
   want people to take, so the number is the biggest thing on the bar. */
.byo .byo-consult {
	display: grid;
	grid-template-columns: auto auto;
	align-items: center;
	justify-self: center;
	gap: 0 22px;
	width: min(100%, 760px);
	padding: 10px 12px 10px 24px;
	border-radius: 14px;
	background: var(--byo-deep);
	color: #fff;
}
.byo .byo-consult h2 {
	grid-column: 1;
	margin: 0;
	font-family: var(--soft);
	font-size: 21px;
	font-weight: 800;
	letter-spacing: 0;
	color: #fff;
	line-height: 1.2;
}
.byo .byo-consult a {
	grid-column: 2;
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	min-height: 54px;
	padding: 6px 26px;
	border-radius: 999px;
	background: var(--byo-clay);
	color: #fff;
	font-family: var(--soft);
	font-size: 26px;
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: .01em;
	text-decoration: none;
	white-space: nowrap;
	transition: background .18s, transform .16s;
}
.byo .byo-consult a small {
	font-size: 12.5px;
	font-weight: 700;
	opacity: .9;
	letter-spacing: 0;
}
.byo .byo-consult a:hover {
	background: var(--byo-clay-deep);
	transform: translateY(-2px);
}
.byo .byo-consult a:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

.byo .byo-live {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* --------------------------------------------------------- smaller screens */
@media (max-width: 900px) {
	.byo {
		padding: 16px 16px 24px;
	}
	.byo .byo-split {
		grid-template-columns: minmax(0, 1fr);
		gap: 18px;
	}
	/* The stack first, so the thing being built is on screen while the
	   controls below change it. */
	.byo .byo-vis {
		order: -1;
	}
	.byo .byo-layer {
		min-height: 58px;
	}
	.byo .byo-tune {
		grid-template-columns: minmax(0, 1fr);
	}
	.byo .byo-tabs {
		flex-direction: row;
	}
	.byo .byo-tab {
		flex: 1 1 0;
		min-height: 46px;
	}
	.byo .byo-preset-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
	/* No hover on a phone, so the popup would only ever be in the way. */
	.byo .byo-more {
		display: none !important;
	}
	.byo .byo-consult {
		grid-template-columns: minmax(0, 1fr);
		text-align: center;
	}
	.byo .byo-consult a {
		grid-column: 1;
		margin-top: 8px;
	}
}
@media (max-width: 480px) {
	.byo .byo-filters {
		margin-left: 0;
	}
	.byo .byo-sub {
		margin-left: 0;
	}
	.byo.is-split .byo-layer {
		gap: 6px;
	}
	.byo.is-split .byo-face {
		flex-direction: column;
		align-items: flex-start;
		gap: 2px;
		padding: 8px 10px;
	}
	.byo.is-split .byo-vals i {
		font-size: 17px;
	}
}
@media (prefers-reduced-motion: reduce) {
	.byo .byo-face,
	.byo .byo-den,
	.byo .byo-tab,
	.byo .byo-seg span,
	.byo .byo-preset {
		transition: none;
	}
	.byo .byo-layer.bump .byo-face.l,
	.byo .byo-layer.bump .byo-face.r,
	.byo .byo-face:hover,
	.byo .byo-cta:hover,
	.byo .byo-preset:hover {
		transform: none;
	}
}
