/**
 * The designer card on the product page.
 *
 * Deliberately plain and theme agnostic. Nothing here depends on Flatsome
 * markup or Flatsome class names, so the card survives a theme change, and the
 * button inherits the theme's own .button styling rather than fighting it.
 */

.skmpd-designer {
	display: flex;
	gap: 1em;
	align-items: center;
	margin: 0 0 1.5em;
	padding: 1em;
	border: 1px solid rgba( 0, 0, 0, 0.12 );
	border-radius: 4px;
	background: rgba( 0, 0, 0, 0.02 );
}

.skmpd-designer__preview {
	flex: 0 0 auto;
	width: 96px;
}

/*
 * The design shown on the bottle, once there is one.
 *
 * Two mockups plus the wording do not fit across a product column, so the card
 * stacks when the bottles are present and stays a row when it is only the
 * invitation and its button. `:has()` puts that decision in CSS rather than
 * adding a modifier class the template would have to keep in step; every
 * browser this shop supports has it, and without it the card simply wraps.
 */
.skmpd-designer:has( .skmpd-designer__bottles ) {
	flex-direction: column;
	align-items: stretch;
}

.skmpd-designer__bottles {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	justify-content: center;
}

/*
 * Front and back share the row rather than stacking.
 *
 * bottle-preview.php caps itself with an inline max-width, which is a ceiling
 * for a wide page rather than a width. A product column is narrow, so the cap
 * alone left the two mockups stacked and the card taller than the rest of the
 * page. `1 1 0` with `min-width: 0` lets them divide whatever the column has,
 * and the composite scales with its own photograph because every part of it is
 * positioned in percentages.
 *
 * The inline max-width has to be overridden for that to work, which is the one
 * place this stylesheet is allowed to reach into the template's own styling.
 */
.skmpd-designer__bottles .skmpd-bottle {
	flex: 1 1 0;
	min-width: 0;
	max-width: 50% !important;
}

.skmpd-designer__thumb {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid rgba( 0, 0, 0, 0.12 );
	border-radius: 2px;
	background: #fff;
}

.skmpd-designer__body {
	flex: 1 1 auto;
	min-width: 0;
}

.skmpd-designer__heading {
	margin: 0 0 0.25em;
	font-weight: 600;
	line-height: 1.3;
}

.skmpd-designer__description {
	margin: 0 0 0.75em;
	font-size: 0.9em;
	line-height: 1.4;
	opacity: 0.8;
}

.skmpd-designer__button,
.skmpd-designer__new {
	margin: 0 0.5em 0.5em 0;
}

/*
 * A theme's .button sets display, which beats the browser's own rule for the
 * hidden attribute, so the second button would show with nothing to start
 * again from.
 */
.skmpd-designer__new[hidden] {
	display: none;
}

/*
 * Shown when someone tries to add to the cart with no design.
 *
 * Its own color rather than the theme's error styling, because nothing here
 * may depend on Flatsome class names, and because this is a rule the customer
 * has not met yet rather than something that went wrong.
 */
.skmpd-designer__hint {
	margin: 0.75em 0 0;
	font-size: 0.9em;
	line-height: 1.4;
	color: #a0341f;
}

/*
 * On a phone the thumbnail beside the text leaves too little room for either,
 * so the card stacks and the preview grows into something worth looking at.
 */
@media screen and ( max-width: 549px ) {

	.skmpd-designer {
		display: block;
	}

	.skmpd-designer__preview {
		width: 100%;
		max-width: 220px;
		margin: 0 0 0.75em;
	}
}

/*
 * The quantity select and the volume discounts.
 *
 * Same rule as the card above: nothing here depends on Flatsome markup or class
 * names. The select replaces WooCommerce's number input on a product with
 * quantity rules, because the theme's own plus and minus buttons are not
 * reachable through woocommerce_quantity_input_args and would otherwise click
 * straight past an allowed step.
 */

.skmpd-qty {
	margin: 0 1em 1em 0;
}

.skmpd-qty__label {
	display: block;
	margin: 0 0 0.35em;
	font-size: 0.85em;
	font-weight: 600;
	line-height: 1.3;
}

/*
 * Wide enough for the longest option, which carries a quantity, a unit price
 * and a line total. A select that truncates its own text leaves the customer
 * choosing between two options that look identical.
 */
.skmpd-qty__select {
	width: auto;
	min-width: 16em;
	max-width: 100%;
	margin: 0;
}

.skmpd-qty__note {
	margin: 0.4em 0 0;
	font-size: 0.8em;
	line-height: 1.4;
	opacity: 0.75;
}

.skmpd-tiers {
	margin: 0 0 1.25em;
	padding: 0.75em 1em;
	border: 1px solid rgba( 0, 0, 0, 0.12 );
	border-radius: 4px;
	background: rgba( 0, 0, 0, 0.02 );
}

.skmpd-tiers__heading {
	margin: 0 0 0.5em;
	font-size: 0.9em;
	font-weight: 600;
	line-height: 1.3;
}

.skmpd-tiers__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.skmpd-tiers__row {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	padding: 0.25em 0;
	font-size: 0.85em;
	line-height: 1.4;
}

.skmpd-tiers__row + .skmpd-tiers__row {
	border-top: 1px solid rgba( 0, 0, 0, 0.07 );
}

.skmpd-tiers__saving {
	margin-left: 0.4em;
	opacity: 0.75;
}

/*
 * On a phone the select goes full width. At 16em beside a theme's own controls
 * it would otherwise push the add to cart button off the row.
 */
@media screen and ( max-width: 549px ) {

	.skmpd-qty {
		margin-right: 0;
	}

	.skmpd-qty__select {
		width: 100%;
	}
}
