/**
 * Harvest Moon build-your-own.
 *
 * Every visual decision is a custom property on .jwmhm-builder. When the
 * Elementor design lands, override these tokens in the theme — no markup or
 * logic changes needed.
 *
 * Palette defaults are a warm deli green on cream, which reads as food rather
 * than software and sits comfortably beside the existing brand.
 */

.jwmhm-builder {
	/* Brand */
	--hm-accent:        #B62A2A;
	--hm-accent-soft:   #FBEFEC;
	--hm-accent-ink:    #ffffff;
	--hm-highlight:     #A8842F;

	/* Ink */
	--hm-ink:           #1c1b19;
	--hm-ink-soft:      #6b6660;

	/* Surfaces */
	--hm-surface:       #ffffff;
	--hm-ground:        #fdf8f1;
	--hm-line:          #e6ded2;
	--hm-line-strong:   #cfc3b2;

	/* Feedback */
	--hm-danger:        #b3261e;

	/* Shape */
	--hm-radius:        14px;
	--hm-radius-sm:     10px;
	--hm-radius-pill:   999px;
	--hm-gap:           14px;
	--hm-tile:          122px;

	/* Motion */
	--hm-ease:          cubic-bezier(.2, .7, .3, 1);
	--hm-fast:          .16s;

	--hm-shadow:        0 1px 2px rgba(28,27,25,.05), 0 4px 14px rgba(28,27,25,.05);
	--hm-shadow-lift:   0 2px 6px rgba(28,27,25,.08), 0 12px 28px rgba(28,27,25,.10);

	--hm-font:          inherit;

	font-family: var(--hm-font);
	color: var(--hm-ink);
	max-width: 100%;
	container-type: inline-size;

	/*
	 * WooCommerce floats the product gallery left and the summary right. Sitting
	 * after them without clearing, the builder gets squeezed into the few pixels
	 * between the two floats — it rendered 46px wide inside a 1140px container.
	 */
	clear: both;
	display: block;
	width: 100%;
	margin-top: 36px;
	padding-top: 8px;
}

.jwmhm-builder *,
.jwmhm-builder *::before,
.jwmhm-builder *::after { box-sizing: border-box; }

/**
 * Theme reset.
 *
 * Most of the builder's interactive parts are <button> elements, which themes
 * and Elementor kits style aggressively — the first build came out in the
 * theme's magenta because its button and link rules won on specificity. These
 * rules take the surface back without needing !important everywhere.
 */
.jwmhm-builder button {
	font-family: inherit;
	font-size: inherit;
	letter-spacing: normal;
	text-transform: none;
	box-shadow: none;
	border: 0;
	border-radius: 0;
	background: none;
	color: inherit;
	padding: 0;
	line-height: inherit;
	min-height: 0;
	text-shadow: none;
}

/* Put back the borders the reset above just cleared, from our own tokens. */
.jwmhm-builder .jwmhm-preset { border: 1px solid var(--hm-line); border-radius: var(--hm-radius); }
.jwmhm-builder .jwmhm-preset:hover,
.jwmhm-builder .jwmhm-preset:focus-visible { border-color: var(--hm-accent); }
.jwmhm-builder .jwmhm-preset.is-applied { border-color: var(--hm-accent); }

.jwmhm-builder .jwmhm-rail__btn {
	border: 1px solid transparent;
	border-radius: var(--hm-radius-pill);
	padding: 6px 12px 6px 6px;
	font-size: .82rem;
}

.jwmhm-builder .jwmhm-qty__btn {
	border: 0;
	width: 38px;
	height: 40px;
	font-size: 1.1rem;
}

.jwmhm-builder .jwmhm-submit {
	border-radius: var(--hm-radius-pill);
	padding: 14px 24px;
	font-size: 1rem;
	font-weight: 800;
}

.jwmhm-builder .jwmhm-dietary__clear,
.jwmhm-builder .jwmhm-step__reset {
	border: 0;
	background: none;
	color: var(--hm-accent);
	text-decoration: underline;
	font-weight: 700;
	font-size: .82rem;
}

.jwmhm-builder .jwmhm-preset,
.jwmhm-builder .jwmhm-preset__name,
.jwmhm-builder .jwmhm-preset__desc,
.jwmhm-builder .jwmhm-option__label,
.jwmhm-builder .jwmhm-step__label,
.jwmhm-builder .jwmhm-summary__build { color: var(--hm-ink); }

.jwmhm-builder .jwmhm-preset__desc,
.jwmhm-builder .jwmhm-step__desc { color: var(--hm-ink-soft); }

.jwmhm-builder .jwmhm-preset__price { color: var(--hm-accent); }

/* The primary action must win outright — it is the whole point of the page. */
.jwmhm-builder .jwmhm-submit,
.jwmhm-builder .jwmhm-submit:hover,
.jwmhm-builder .jwmhm-submit:focus {
	background: var(--hm-accent);
	color: var(--hm-accent-ink);
	border: 0;
	text-decoration: none;
}

.jwmhm-builder .jwmhm-submit[disabled],
.jwmhm-builder .jwmhm-submit[disabled]:hover { background: var(--hm-accent); }

/* Woo renders prices as markup; make them follow their container. */
.jwmhm-builder .woocommerce-Price-amount,
.jwmhm-builder .woocommerce-Price-currencySymbol { color: inherit; font-weight: inherit; }

/* ============================================================== presets */

.jwmhm-presets { margin: 0 0 28px; }

.jwmhm-presets__head h3 {
	margin: 0 0 2px;
	font-size: 1.25rem;
	letter-spacing: -.01em;
}

.jwmhm-presets__head p {
	margin: 0 0 14px;
	color: var(--hm-ink-soft);
	font-size: .9rem;
}

.jwmhm-presets__rail {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: minmax(210px, 1fr);
	gap: var(--hm-gap);
	overflow-x: auto;
	padding: 4px 4px 12px;
	margin: 0 -4px;
	scroll-snap-type: x mandatory;
	scrollbar-width: thin;
}

.jwmhm-preset {
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	text-align: left;
	padding: 0;
	border: 1px solid var(--hm-line);
	border-radius: var(--hm-radius);
	background: var(--hm-surface);
	cursor: pointer;
	overflow: hidden;
	box-shadow: var(--hm-shadow);
	transition: transform var(--hm-fast) var(--hm-ease),
	            box-shadow var(--hm-fast) var(--hm-ease),
	            border-color var(--hm-fast) var(--hm-ease);
	font: inherit;
	color: inherit;
}

.jwmhm-preset:hover,
.jwmhm-preset:focus-visible {
	transform: translateY(-2px);
	box-shadow: var(--hm-shadow-lift);
	border-color: var(--hm-accent);
	outline: none;
}

.jwmhm-preset.is-applied {
	border-color: var(--hm-accent);
	box-shadow: inset 0 0 0 2px var(--hm-accent), var(--hm-shadow-lift);
}

.jwmhm-preset__media {
	position: relative;
	aspect-ratio: 16 / 10;
	background: var(--hm-ground);
	display: grid;
	place-items: center;
	overflow: hidden;
}

.jwmhm-preset__media img { width: 100%; height: 100%; object-fit: cover; display: block; }

.jwmhm-preset__placeholder {
	width: 100%; height: 100%;
	background:
		radial-gradient(circle at 30% 30%, rgba(31,107,59,.10), transparent 60%),
		repeating-linear-gradient(45deg, var(--hm-ground) 0 10px, #f6efe4 10px 20px);
}

.jwmhm-preset__badge {
	position: absolute;
	top: 8px; left: 8px;
	background: var(--hm-highlight);
	color: #fff;
	font-size: .66rem;
	font-weight: 800;
	letter-spacing: .06em;
	text-transform: uppercase;
	padding: 4px 9px;
	border-radius: var(--hm-radius-pill);
}

.jwmhm-preset__body { padding: 11px 13px 14px; display: flex; flex-direction: column; gap: 3px; }
.jwmhm-preset__name { font-weight: 700; font-size: .97rem; line-height: 1.25; }

.jwmhm-preset__desc {
	font-size: .8rem;
	color: var(--hm-ink-soft);
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.jwmhm-preset__price { font-weight: 700; color: var(--hm-accent); margin-top: 3px; font-size: .92rem; }
.jwmhm-preset__price .woocommerce-Price-amount { color: inherit; }

/* ====================================================== dietary filters */

.jwmhm-dietary {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
	padding: 12px 14px;
	margin-bottom: 22px;
	background: var(--hm-ground);
	border: 1px solid var(--hm-line);
	border-radius: var(--hm-radius);
}

.jwmhm-dietary__label {
	font-size: .78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--hm-ink-soft);
}

.jwmhm-chip { cursor: pointer; }
.jwmhm-chip__input { position: absolute; opacity: 0; width: 0; height: 0; }

.jwmhm-chip__body {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 12px;
	border: 1px solid var(--hm-line-strong);
	border-radius: var(--hm-radius-pill);
	background: var(--hm-surface);
	font-size: .82rem;
	font-weight: 600;
	transition: all var(--hm-fast) var(--hm-ease);
}

.jwmhm-chip:hover .jwmhm-chip__body { border-color: var(--chip, var(--hm-accent)); }

.jwmhm-chip__input:checked + .jwmhm-chip__body {
	background: var(--chip, var(--hm-accent));
	border-color: var(--chip, var(--hm-accent));
	color: #fff;
}

.jwmhm-chip__input:focus-visible + .jwmhm-chip__body {
	outline: 3px solid var(--hm-accent);
	outline-offset: 2px;
}

.jwmhm-dietary__clear {
	margin-left: auto;
	background: none;
	border: 0;
	color: var(--hm-accent);
	font-weight: 700;
	font-size: .82rem;
	cursor: pointer;
	text-decoration: underline;
}

/* ============================================================ step rail */

.jwmhm-rail {
	position: sticky;
	top: 0;
	z-index: 30;
	background: color-mix(in srgb, var(--hm-surface) 92%, transparent);
	backdrop-filter: blur(8px);
	border-bottom: 1px solid var(--hm-line);
	margin-bottom: 6px;
	padding-top: 6px;
}

.jwmhm-rail__list {
	display: flex;
	gap: 4px;
	list-style: none;
	margin: 0;
	padding: 0 0 8px;
	overflow-x: auto;
	scrollbar-width: none;
}

.jwmhm-rail__list::-webkit-scrollbar { display: none; }

.jwmhm-rail__btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	padding: 6px 12px 6px 6px;
	border: 1px solid transparent;
	border-radius: var(--hm-radius-pill);
	background: none;
	cursor: pointer;
	white-space: nowrap;
	font: inherit;
	font-size: .82rem;
	color: var(--hm-ink-soft);
	transition: all var(--hm-fast) var(--hm-ease);
}

.jwmhm-rail__btn:hover { background: var(--hm-accent-soft); color: var(--hm-ink); }

.jwmhm-rail__dot {
	display: grid;
	place-items: center;
	width: 22px; height: 22px;
	border-radius: 50%;
	background: var(--hm-line);
	color: var(--hm-ink-soft);
	font-size: .7rem;
	font-weight: 800;
	flex: none;
	transition: all var(--hm-fast) var(--hm-ease);
}

.jwmhm-rail__item.is-active .jwmhm-rail__btn {
	background: var(--hm-accent-soft);
	color: var(--hm-ink);
	font-weight: 700;
}

.jwmhm-rail__item.is-active .jwmhm-rail__dot { background: var(--hm-accent); color: var(--hm-accent-ink); }

.jwmhm-rail__item.is-done .jwmhm-rail__dot {
	background: var(--hm-accent);
	color: transparent;
	position: relative;
}

.jwmhm-rail__item.is-done .jwmhm-rail__dot::after {
	content: "";
	position: absolute; inset: 0; margin: auto;
	width: 5px; height: 9px;
	border: solid #fff;
	border-width: 0 2px 2px 0;
	transform: translateY(-1px) rotate(45deg);
}

.jwmhm-rail__progress {
	display: block;
	height: 3px;
	background: var(--hm-line);
	border-radius: 2px;
	overflow: hidden;
}

.jwmhm-rail__progress > span {
	display: block;
	height: 100%;
	width: 0;
	background: var(--hm-accent);
	transition: width .3s var(--hm-ease);
}

/* =============================================================== steps */

.jwmhm-step {
	border-top: 1px solid var(--hm-line);
	padding: 26px 0;
	scroll-margin-top: 74px;
}

.jwmhm-step:first-child { border-top: 0; }

.jwmhm-step__title {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin: 0 0 4px;
	font-size: 1.16rem;
	line-height: 1.3;
	letter-spacing: -.01em;
}

.jwmhm-step__number {
	display: inline-grid;
	place-items: center;
	width: 27px; height: 27px;
	border-radius: 50%;
	background: var(--hm-accent);
	color: var(--hm-accent-ink);
	font-size: .8rem;
	font-weight: 800;
	flex: none;
}

.jwmhm-step.is-complete .jwmhm-step__number { background: var(--hm-accent); }
.jwmhm-step.is-invalid .jwmhm-step__number { background: var(--hm-danger); }

.jwmhm-step__required,
.jwmhm-step__optional {
	font-size: .64rem;
	font-weight: 800;
	letter-spacing: .07em;
	text-transform: uppercase;
	padding: 3px 8px;
	border-radius: var(--hm-radius-pill);
}

.jwmhm-step__required { background: #fdeceb; color: var(--hm-danger); }
.jwmhm-step__optional { background: var(--hm-ground); color: var(--hm-ink-soft); }

.jwmhm-step__chosen {
	margin-left: auto;
	font-size: .82rem;
	font-weight: 600;
	color: var(--hm-accent);
}

.jwmhm-step__desc { margin: 0 0 12px; color: var(--hm-ink-soft); font-size: .88rem; }

.jwmhm-step__search { position: relative; margin: 0 0 14px; max-width: 340px; }

.jwmhm-search {
	width: 100%;
	padding: 9px 13px;
	border: 1px solid var(--hm-line-strong);
	border-radius: var(--hm-radius-pill);
	font-size: .9rem;
	background: var(--hm-surface);
}

.jwmhm-search:focus { border-color: var(--hm-accent); outline: none; box-shadow: 0 0 0 3px var(--hm-accent-soft); }

.jwmhm-search__count {
	position: absolute;
	right: 14px; top: 50%;
	transform: translateY(-50%);
	font-size: .74rem;
	color: var(--hm-ink-soft);
	pointer-events: none;
}

.jwmhm-step__error {
	margin: 10px 0 0;
	color: var(--hm-danger);
	font-size: .86rem;
	font-weight: 600;
}

.jwmhm-step__noresults { color: var(--hm-ink-soft); font-size: .88rem; }

.jwmhm-step__reset {
	background: none; border: 0; padding: 0;
	color: var(--hm-accent); font: inherit; font-weight: 700;
	cursor: pointer; text-decoration: underline;
}

/* ============================================================= options */

.jwmhm-options {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--hm-tile), 1fr));
	gap: var(--hm-gap);
	margin-top: 12px;
}

.jwmhm-option { cursor: pointer; display: block; }
.jwmhm-option[hidden] { display: none; }

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

.jwmhm-option__tile {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	height: 100%;
	padding: 10px 8px 12px;
	background: var(--hm-surface);
	border: 2px solid var(--hm-line);
	border-radius: var(--hm-radius);
	text-align: center;
	transition: border-color var(--hm-fast) var(--hm-ease),
	            box-shadow var(--hm-fast) var(--hm-ease),
	            transform var(--hm-fast) var(--hm-ease);
}

.jwmhm-option:hover .jwmhm-option__tile {
	border-color: var(--hm-accent);
	transform: translateY(-2px);
	box-shadow: var(--hm-shadow);
}

.jwmhm-option__input:focus-visible + .jwmhm-option__tile {
	outline: 3px solid var(--hm-accent);
	outline-offset: 2px;
}

.jwmhm-option__input:checked + .jwmhm-option__tile {
	border-color: var(--hm-accent);
	background: var(--hm-accent-soft);
	box-shadow: inset 0 0 0 1px var(--hm-accent);
}

.jwmhm-option__media {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	display: grid;
	place-items: center;
}

.jwmhm-option__media img {
	width: 100%; height: 100%;
	object-fit: contain;
	border-radius: var(--hm-radius-sm);
}

/* Stand-in until the generated option images are attached. Shows the first
   letter so a tile is still identifiable at a glance. */
.jwmhm-option__placeholder {
	display: grid;
	place-items: center;
	width: 100%; height: 100%;
	border-radius: var(--hm-radius-sm);
	background: var(--hm-ground);
	border: 1px dashed var(--hm-line-strong);
	font-size: 1.5rem;
	font-weight: 800;
	color: var(--hm-line-strong);
	text-transform: uppercase;
}

.jwmhm-option__check {
	position: absolute;
	top: 3px; right: 3px;
	width: 23px; height: 23px;
	border-radius: 50%;
	background: var(--hm-accent);
	opacity: 0;
	transform: scale(.5);
	transition: opacity var(--hm-fast) var(--hm-ease), transform var(--hm-fast) var(--hm-ease);
}

.jwmhm-option__check::after {
	content: "";
	position: absolute; inset: 0; margin: auto;
	width: 6px; height: 11px;
	border: solid var(--hm-accent-ink);
	border-width: 0 2px 2px 0;
	transform: translateY(-1px) rotate(45deg);
}

.jwmhm-option__input:checked + .jwmhm-option__tile .jwmhm-option__check { opacity: 1; transform: scale(1); }

.jwmhm-option__label { font-size: .83rem; line-height: 1.25; font-weight: 600; }
.jwmhm-option__price { font-size: .78rem; color: var(--hm-highlight); font-weight: 700; }
.jwmhm-option__price .woocommerce-Price-amount { color: inherit; }

.jwmhm-option__tags { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; margin-top: 1px; }

.jwmhm-tag {
	display: inline-grid;
	place-items: center;
	min-width: 18px; height: 18px;
	padding: 0 4px;
	border-radius: var(--hm-radius-pill);
	background: color-mix(in srgb, var(--chip) 14%, transparent);
	color: var(--chip);
	font-size: .62rem;
	font-weight: 800;
	line-height: 1;
}

/* Text-entry steps (the "Who's this for?" name field). */
.jwmhm-text-input {
	width: 100%;
	max-width: 380px;
	padding: 11px 14px;
	border: 2px solid var(--hm-line);
	border-radius: var(--hm-radius-sm);
	font-size: 1rem;
	background: var(--hm-surface);
}

.jwmhm-text-input:focus { border-color: var(--hm-accent); outline: none; box-shadow: 0 0 0 3px var(--hm-accent-soft); }

/* ============================================================== footer */

.jwmhm-builder__footer {
	position: sticky;
	bottom: 0;
	z-index: 25;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--hm-gap);
	margin-top: 10px;
	padding: 14px 0;
	border-top: 1px solid var(--hm-line);
	background: color-mix(in srgb, var(--hm-surface) 94%, transparent);
	backdrop-filter: blur(8px);
}

.jwmhm-summary { min-width: 0; flex: 1 1 240px; }

.jwmhm-summary__label {
	display: block;
	font-size: .68rem;
	letter-spacing: .09em;
	text-transform: uppercase;
	color: var(--hm-ink-soft);
	font-weight: 700;
}

.jwmhm-summary__build { margin: 3px 0 0; font-size: .88rem; line-height: 1.45; }
.jwmhm-summary__build em { color: var(--hm-ink-soft); font-style: normal; }

.jwmhm-builder__actions { display: flex; align-items: center; gap: 12px; }

.jwmhm-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--hm-line-strong);
	border-radius: var(--hm-radius-pill);
	overflow: hidden;
	background: var(--hm-surface);
}

.jwmhm-qty__btn {
	width: 38px; height: 40px;
	border: 0;
	background: none;
	font-size: 1.1rem;
	cursor: pointer;
	color: var(--hm-ink);
	transition: background var(--hm-fast) var(--hm-ease);
}

.jwmhm-qty__btn:hover { background: var(--hm-accent-soft); }

.jwmhm-qty input {
	width: 46px;
	padding: 8px 0;
	border: 0;
	text-align: center;
	font-size: .95rem;
	font-weight: 700;
	background: none;
	-moz-appearance: textfield;
}

.jwmhm-qty input::-webkit-outer-spin-button,
.jwmhm-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.jwmhm-submit {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 14px 24px;
	border: 0;
	border-radius: var(--hm-radius-pill);
	background: var(--hm-accent);
	color: var(--hm-accent-ink);
	font-size: 1rem;
	font-weight: 800;
	cursor: pointer;
	box-shadow: var(--hm-shadow);
	transition: transform var(--hm-fast) var(--hm-ease), opacity var(--hm-fast) var(--hm-ease);
}

.jwmhm-submit:hover:not([disabled]) { transform: translateY(-1px); box-shadow: var(--hm-shadow-lift); }
.jwmhm-submit:active:not([disabled]) { transform: translateY(0); }
.jwmhm-submit[disabled] { opacity: .45; cursor: not-allowed; }

.jwmhm-submit__price {
	padding-left: 12px;
	border-left: 1px solid rgba(255,255,255,.3);
	opacity: .95;
}

.jwmhm-submit__price .woocommerce-Price-amount { color: inherit; }

/* Off-screen but still announced — see announce() in builder.js. */
.jwmhm-a11y-live {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.jwmhm-disclaimer {
	margin: 18px 0 0;
	font-size: .76rem;
	color: var(--hm-ink-soft);
	line-height: 1.5;
	padding: 10px 12px;
	background: var(--hm-ground);
	border-radius: var(--hm-radius-sm);
}

/* ========================================================== responsive */

@container (max-width: 560px) {
	.jwmhm-builder { --hm-tile: 96px; --hm-gap: 10px; }
}

@media (max-width: 560px) {
	.jwmhm-builder { --hm-tile: 92px; --hm-gap: 9px; }

	.jwmhm-builder__footer { flex-direction: column; align-items: stretch; padding: 12px 0 14px; }
	.jwmhm-builder__actions { justify-content: space-between; }
	.jwmhm-submit { flex: 1 1 auto; justify-content: center; }
	.jwmhm-presets__rail { grid-auto-columns: minmax(168px, 1fr); }
	.jwmhm-step__chosen { margin-left: 0; flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.jwmhm-builder * { transition: none !important; animation: none !important; }
}

/* Respect a dark host theme without forcing one. */
@media (prefers-color-scheme: dark) {
	.jwmhm-builder:not([data-theme="light"]) {
		--hm-ink:         #f2ede6;
		--hm-ink-soft:    #a9a19a;
		--hm-surface:     #1e1d1b;
		--hm-ground:      #262421;
		--hm-line:        #38352f;
		--hm-line-strong: #4a463f;
		--hm-accent-soft: #3A1F1D;
		--hm-shadow:      0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
		--hm-shadow-lift: 0 2px 6px rgba(0,0,0,.5), 0 12px 28px rgba(0,0,0,.4);
	}
}
