/*
 * BDS Build Your Routine
 * Defaults reproduce the BeautyByDaz homepage 3 design. Every value here can be overridden
 * from the widget's Style tab (Elementor writes those rules with higher specificity).
 * Breakpoint fallbacks match Elementor's defaults (tablet <= 1024px, mobile <= 767px);
 * the widget's responsive "Arrangement" control follows the site's own breakpoints.
 */

.bds-routine {
	--bds-ink: #222222;
	--bds-muted: #696969;
	--bds-line: #D9D9D9;
	--bds-line-hover: #9A9A9A;
	--bds-soft: #F9F9F9;
	--bds-price: #FD3737;
	--bds-accent-hover: #4D2D2E;
	--bds-error: #C62828;
	--bds-thumb: 72px;
	--bds-picked: 84px;
	--bds-radio: 22px;
	/* --bds-row / --bds-row-span are printed inline from the step count (max four per row). */
	--bds-cols: var(--bds-row, repeat(3, minmax(0, 1fr)) minmax(240px, var(--bds-tray-w, 330px)));
	--bds-tray-span: var(--bds-row-span, auto);
	--bds-ease: cubic-bezier(0.23, 1, 0.32, 1);
	box-sizing: border-box;
	width: 100%;
	color: var(--bds-ink);
	font-family: "Manrope", sans-serif;
	letter-spacing: -0.02em;
	-webkit-font-smoothing: antialiased;
}

.bds-routine *,
.bds-routine *::before,
.bds-routine *::after {
	box-sizing: border-box;
}

.bds-routine .bds-routine__heading {
	margin: 0 0 43px;
	padding: 0;
	color: var(--bds-ink);
	font-family: inherit;
	font-size: 64px;
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -0.065em;
	text-transform: none;
}

.bds-routine__grid {
	display: grid;
	grid-template-columns: var(--bds-cols);
	gap: 20px;
	align-items: stretch;
}

/* ---------- Step cards ---------- */
.bds-routine .bds-routine__step {
	min-width: 0;
	margin: 0;
	padding: 22px 16px 16px;
	border: 1px solid var(--bds-line);
	border-radius: 26px;
	background: #FFFFFF;
}

.bds-routine .bds-routine__legend {
	float: left;
	display: flex;
	align-items: baseline;
	gap: 10px;
	width: 100%;
	max-width: none;
	margin: 0 0 16px;
	padding: 0 6px;
	border: 0;
	/* Rey (and many themes) style every <legend>: uppercase, white background, small text. */
	background: none;
	font-size: inherit;
	font-weight: inherit;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	white-space: normal;
}

.bds-routine__step-num {
	color: var(--bds-muted);
	font-size: 14px;
	font-weight: 600;
}

.bds-routine__step-title {
	color: var(--bds-ink);
	font-size: 24px;
	font-weight: 500;
	letter-spacing: -0.05em;
	line-height: 1.2;
}

.bds-routine__options {
	container-type: inline-size;
	clear: both;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* ---------- Product option rows ---------- */
.bds-routine .bds-routine__option {
	position: relative;
	display: grid;
	grid-template-columns: var(--bds-thumb) minmax(0, 1fr) var(--bds-radio);
	align-items: center;
	gap: 14px;
	margin: 0;
	padding-block: 10px;
	padding-inline: 10px 14px;
	border: 1px solid var(--bds-line);
	border-radius: 18px;
	background: #FFFFFF;
	color: inherit;
	cursor: pointer;
	outline: 2px solid transparent;
	outline-offset: 3px;
	transition: border-color 200ms ease, background-color 200ms ease, transform 160ms var(--bds-ease), outline-color 150ms ease;
	-webkit-tap-highlight-color: transparent;
}

.bds-routine .bds-routine__option:active:not(.is-soldout) {
	transform: scale(0.98);
}

/* Selected: class set by the script; :has() covers the no-script case in modern browsers.
   Kept as separate rules so a browser without :has() still applies the class-based one. */
.bds-routine .bds-routine__option.is-selected {
	border-color: var(--bds-ink);
}

.bds-routine .bds-routine__option:has(.bds-routine__input:checked) {
	border-color: var(--bds-ink);
}

/* Keyboard focus ring on the whole row. */
.bds-routine .bds-routine__option.is-focused {
	outline-color: var(--bds-ink);
}

.bds-routine .bds-routine__option:has(.bds-routine__input:focus-visible) {
	outline-color: var(--bds-ink);
}

/* The real radio stays in the DOM and in the tab order; it is only visually hidden. */
.bds-routine .bds-routine__input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	opacity: 0;
}

.bds-routine__thumb {
	display: grid;
	place-items: center;
	width: var(--bds-thumb);
	height: var(--bds-thumb);
	padding: 4px;
	border-radius: 12px;
	background: var(--bds-soft);
	overflow: hidden;
}

.bds-routine .bds-routine__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	margin: 0;
	border-radius: 0;
	object-fit: contain;
	box-shadow: none;
}

.bds-routine__text {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
}

.bds-routine__brand {
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	text-transform: uppercase;
}

.bds-routine__name {
	display: -webkit-box;
	overflow: hidden;
	color: var(--bds-muted);
	font-size: 15px;
	line-height: 1.35;
	overflow-wrap: anywhere;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.bds-routine__price {
	color: var(--bds-price);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
}

/* WooCommerce wraps prices in .amount and <bdi>; let them follow the price/total styles
   (including Elementor colour and typography controls) instead of fixing their own. */
.bds-routine .bds-routine__price .amount,
.bds-routine .bds-routine__price bdi,
.bds-routine .bds-routine__total .amount,
.bds-routine .bds-routine__total bdi {
	color: inherit;
	font: inherit;
	letter-spacing: inherit;
}

/* ---------- Radio indicator ---------- */
.bds-routine__radio {
	display: grid;
	place-items: center;
	width: var(--bds-radio);
	height: var(--bds-radio);
	border: 1.5px solid var(--bds-line);
	border-radius: 50%;
	transition: border-color 200ms ease;
}

.bds-routine__radio::after {
	content: "";
	width: 45%;
	height: 45%;
	border-radius: 50%;
	background: var(--bds-ink);
	transform: scale(0);
	transition: transform 200ms var(--bds-ease);
}

.bds-routine__option.is-selected .bds-routine__radio {
	border-color: var(--bds-ink);
}

.bds-routine__option:has(.bds-routine__input:checked) .bds-routine__radio {
	border-color: var(--bds-ink);
}

.bds-routine__option.is-selected .bds-routine__radio::after {
	transform: scale(1);
}

.bds-routine__option:has(.bds-routine__input:checked) .bds-routine__radio::after {
	transform: scale(1);
}

/* ---------- Sold out ---------- */
.bds-routine .bds-routine__option.is-soldout {
	cursor: not-allowed;
	opacity: 0.5;
}

.bds-routine__soldout {
	align-self: flex-start;
	margin-top: 4px;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--bds-soft);
	color: var(--bds-ink);
	font-size: 12px;
	font-weight: 600;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* ---------- Summary card ---------- */
.bds-routine .bds-routine__tray {
	grid-column: var(--bds-tray-span);
	display: flex;
	flex-direction: column;
	min-width: 0;
	padding: 26px 22px 22px;
	border-radius: 26px;
	background: var(--bds-soft);
}

.bds-routine__tray-label {
	color: var(--bds-muted);
	font-size: 16px;
}

.bds-routine__picked {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	min-height: var(--bds-picked);
	margin: 18px 0 22px;
}

.bds-routine__picked-item {
	display: grid;
	place-items: center;
	width: var(--bds-picked);
	height: var(--bds-picked);
	padding: 6px;
	border-radius: 14px;
	background: #FFFFFF;
	overflow: hidden;
}

.bds-routine .bds-routine__picked-item img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: contain;
}

.bds-routine__total {
	color: var(--bds-ink);
	font-size: 40px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.05em;
}

.bds-routine .bds-routine__note {
	margin: 8px 0 22px;
	color: var(--bds-muted);
	font-size: 14px;
}

/* ---------- Button (explicit resets so theme button styles cannot leak in) ---------- */
.bds-routine .bds-routine__button {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 45px;
	margin: auto 0 0;
	padding: 0 19px;
	border: 1px solid #222222;
	border-radius: 999px;
	background: #222222;
	box-shadow: none;
	color: #FFFFFF;
	cursor: pointer;
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.03em;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	transition: background-color 200ms ease, border-color 200ms ease, color 200ms ease, transform 160ms var(--bds-ease), opacity 200ms ease;
	-webkit-tap-highlight-color: transparent;
}

.bds-routine .bds-routine__button:hover:not(:disabled):not([aria-disabled="true"]) {
	border-color: var(--bds-accent-hover);
	background: var(--bds-accent-hover);
	color: #FFFFFF;
}

.bds-routine .bds-routine__button.bds-routine__button:focus-visible {
	/* Doubled class: outranks Rey's ".--no-acc-focus button:focus { outline: 0 }". */
	outline: 2px solid var(--bds-ink);
	outline-offset: 3px;
}

.bds-routine .bds-routine__button:active:not(:disabled):not([aria-disabled="true"]) {
	transform: scale(0.97);
}

.bds-routine .bds-routine__button:disabled {
	cursor: not-allowed;
	opacity: 0.55;
}

.bds-routine .bds-routine__button[aria-busy="true"],
.bds-routine .bds-routine__button[aria-disabled="true"] {
	cursor: progress;
	opacity: 0.8;
}

.bds-routine .bds-routine__status {
	min-height: 0;
	margin: 10px 0 0;
	color: var(--bds-ink);
	font-size: 14px;
	text-align: center;
}

.bds-routine .bds-routine__status:empty {
	display: none;
}

.bds-routine .bds-routine__status.is-error {
	color: var(--bds-error);
}

.bds-routine .bds-routine__help {
	margin: 14px 0 0;
	color: var(--bds-muted);
	font-size: 14px;
	text-align: center;
}

.bds-routine .bds-routine__help a {
	color: var(--bds-ink);
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	transition: color 200ms ease;
}

.bds-routine .bds-routine__help a:focus-visible {
	outline: 2px solid var(--bds-ink);
	outline-offset: 2px;
	border-radius: 2px;
}

.bds-routine__empty {
	padding: 24px;
	border: 1px dashed var(--bds-line-hover);
	border-radius: 16px;
	color: var(--bds-muted);
	font-family: inherit;
	font-size: 14px;
	text-align: center;
}

/* Screen-reader-only text (a name for steps with no visible title). */
.bds-routine .bds-routine__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
}

[dir="rtl"] .bds-routine .bds-routine__legend {
	float: right;
}

/* ---------- Narrow cards (e.g. four columns in a boxed container) ----------
   Smaller thumbnail and the radio tucked into the corner, so product names get the room. */
@container (max-width: 250px) {
	.bds-routine .bds-routine__option {
		grid-template-columns: min(var(--bds-thumb), 52px) minmax(0, 1fr);
		gap: 10px;
		padding: 8px;
	}

	.bds-routine .bds-routine__thumb {
		width: min(var(--bds-thumb), 52px);
		height: min(var(--bds-thumb), 52px);
	}

	.bds-routine .bds-routine__text {
		padding-inline-end: calc(var(--bds-radio) + 6px);
	}

	.bds-routine .bds-routine__brand {
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.bds-routine .bds-routine__name {
		overflow-wrap: normal;
		word-break: normal;
	}

	.bds-routine .bds-routine__radio {
		position: absolute;
		top: 10px;
		inset-inline-end: 10px;
	}
}

/* Very narrow cards: thumbnail on its own row above the text, radio in the top corner beside
   it, so the text gets the full card width. */
@container (max-width: 200px) {
	.bds-routine .bds-routine__option {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 8px;
	}

	.bds-routine .bds-routine__text {
		padding-inline-end: 0;
	}
}

/* ---------- Hover only on devices that really hover (no sticky hover on phones) ---------- */
@media (hover: hover) and (pointer: fine) {
	.bds-routine .bds-routine__option:not(.is-selected):not(.is-soldout):hover {
		border-color: var(--bds-line-hover);
	}

	.bds-routine .bds-routine__help a:hover {
		color: var(--bds-accent-hover);
	}
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
	.bds-routine {
		--bds-cols: repeat(2, minmax(0, 1fr));
		--bds-tray-span: 1 / -1;
	}

	.bds-routine .bds-routine__heading {
		font-size: 52px;
		margin-bottom: 32px;
	}

	.bds-routine__total {
		font-size: 34px;
	}
}

/* ---------- Layout and heading alignment chosen in Elementor ----------
   Elementor adds one class per device to the widget wrapper (prefix_class), e.g.
   bds-routine-layout-row, bds-routine-layout-tablet-two, bds-routine-layout-mobile-stack. */
.bds-routine-layout-row .bds-routine {
	/* --bds-row / --bds-row-span are printed inline from the step count (max four per row). */
	--bds-cols: var(--bds-row, repeat(3, minmax(0, 1fr)) minmax(240px, var(--bds-tray-w, 330px)));
	--bds-tray-span: var(--bds-row-span, auto);
}

.bds-routine-layout-two .bds-routine {
	--bds-cols: repeat(2, minmax(0, 1fr));
	--bds-tray-span: 1 / -1;
}

.bds-routine-layout-stack .bds-routine {
	--bds-cols: minmax(0, 1fr);
	--bds-tray-span: auto;
}

.bds-routine-heading-left .bds-routine .bds-routine__heading {
	text-align: left;
}

.bds-routine-heading-center .bds-routine .bds-routine__heading {
	text-align: center;
}

.bds-routine-heading-right .bds-routine .bds-routine__heading {
	text-align: right;
}

/* Tablet, mobile and any extra Elementor devices: generated from the site's breakpoints
   (see device_css() in the main plugin file) and printed after this stylesheet. */

/* With an odd number of steps in a two- or three-column layout, the summary fills the empty
   cell instead of leaving a gap (harmless in one-column and single-row layouts). */
.bds-routine .bds-routine__grid:has(> .bds-routine__step:nth-of-type(odd):last-of-type) > .bds-routine__tray {
	grid-column: auto;
}

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	.bds-routine {
		--bds-cols: minmax(0, 1fr);
		--bds-tray-span: auto;
		--bds-thumb: 60px;
		--bds-picked: 60px;
	}

	.bds-routine .bds-routine__heading {
		font-size: 36px;
		margin-bottom: 24px;
	}

	.bds-routine__grid {
		gap: 14px;
	}

	.bds-routine .bds-routine__step {
		padding: 18px 12px 12px;
		border-radius: 22px;
	}

	.bds-routine__step-title {
		font-size: 21px;
	}

	.bds-routine .bds-routine__option {
		gap: 12px;
		padding: 8px 12px 8px 8px;
		border-radius: 16px;
	}

	.bds-routine .bds-routine__tray {
		padding: 20px 18px 18px;
		border-radius: 22px;
	}

	.bds-routine__picked {
		margin: 12px 0 16px;
	}

	.bds-routine__total {
		font-size: 30px;
	}

	.bds-routine .bds-routine__button {
		min-height: 48px;
	}

	/* The sticky summary bar is generated for the site's mobile breakpoint (device_css()). */
}

@media (prefers-reduced-motion: reduce) {
	.bds-routine *,
	.bds-routine *::before,
	.bds-routine *::after {
		transition-duration: 0ms !important;
	}
}
