/* Bottle Cap Selector — front end */

.bcs-wrap {
	--bcs-radius: 12px;
	--bcs-border: rgba(17, 17, 17, .14);
	--bcs-border-strong: rgba(17, 17, 17, .85);
	--bcs-muted: rgba(17, 17, 17, .6);
	--bcs-surface: #fff;
	--bcs-surface-alt: rgba(17, 17, 17, .025);
	--bcs-gap: 12px;

	box-sizing: border-box;
	margin: 24px 0;
	padding: 20px;
	border: 1px solid var(--bcs-border);
	border-radius: var(--bcs-radius);
	background: var(--bcs-surface);
}

.bcs-wrap *,
.bcs-wrap *::before,
.bcs-wrap *::after {
	box-sizing: border-box;
}

/* ---------- header ---------- */

.bcs-header {
	margin-bottom: 16px;
}

.bcs-heading {
	margin: 0;
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: -.01em;
}

.bcs-intro {
	margin: 4px 0 0;
	font-size: .875rem;
	line-height: 1.5;
	color: var(--bcs-muted);
}

/* ---------- cap grid ---------- */

.bcs-caps {
	display: grid;
	gap: var(--bcs-gap);
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
	align-items: stretch;
}

.bcs-layout-list .bcs-caps {
	grid-template-columns: 1fr;
}

/* ---------- cap card ---------- */

.bcs-cap {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 14px;
	padding: 14px;
	border: 1px solid var(--bcs-border);
	border-radius: 10px;
	background: var(--bcs-surface);
	transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.bcs-cap.is-selected {
	border-color: var(--bcs-border-strong);
	box-shadow: 0 0 0 1px var(--bcs-border-strong) inset;
	background: var(--bcs-surface-alt);
}

.bcs-cap--oos {
	opacity: .55;
	background: var(--bcs-surface-alt);
}

/* image */

.bcs-cap__media {
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	border-radius: 8px;
	overflow: hidden;
	background: var(--bcs-surface-alt);
}

.bcs-cap__media img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: contain;
	margin: 0;
	border-radius: 0;
}

/* text block */

.bcs-cap__info {
	flex: 1 1 130px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.bcs-cap__name {
	font-size: .9375rem;
	font-weight: 600;
	line-height: 1.3;
	/* Stop long SKU-style names breaking mid-word. */
	overflow-wrap: break-word;
	word-break: normal;
	hyphens: none;
}

.bcs-cap__note {
	font-size: .8125rem;
	line-height: 1.4;
	color: var(--bcs-muted);
}

.bcs-cap__price {
	font-size: .8125rem;
	line-height: 1.4;
	color: var(--bcs-muted);
	white-space: nowrap;
}

.bcs-cap__price .amount,
.bcs-cap__price bdi {
	white-space: nowrap;
}

.bcs-cap__stock {
	font-size: .75rem;
	line-height: 1.4;
	color: var(--bcs-muted);
}

.bcs-cap__stock--oos {
	color: #b32d2e;
}

/* quantity stepper */

.bcs-cap__qty {
	flex: 0 0 auto;
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 4px;
}

.bcs-cap__qty .bcs-step {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	min-width: 34px;
	min-height: 34px;
	padding: 0;
	margin: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1rem;
	font-weight: 500;
	line-height: 1;
	color: inherit;
	background: var(--bcs-surface);
	border: 1px solid var(--bcs-border);
	border-radius: 8px;
	cursor: pointer;
	transition: background-color .12s ease, border-color .12s ease;
}

.bcs-cap__qty .bcs-step:hover,
.bcs-cap__qty .bcs-step:focus-visible {
	background: var(--bcs-surface-alt);
	border-color: var(--bcs-border-strong);
}

.bcs-cap__qty .bcs-step[disabled] {
	opacity: .4;
	cursor: default;
}

.bcs-cap__qty .bcs-qty-input {
	flex: 0 0 auto;
	width: 46px;
	height: 34px;
	min-height: 34px;
	padding: 0 4px;
	margin: 0;
	text-align: center;
	font-size: .9375rem;
	line-height: 1;
	color: inherit;
	background: var(--bcs-surface);
	border: 1px solid var(--bcs-border);
	border-radius: 8px;
	-moz-appearance: textfield;
	appearance: textfield;
}

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

/* Matches the stepper's footprint so out-of-stock cards wrap the same way. */
.bcs-cap__unavailable {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 116px;
	height: 34px;
	color: var(--bcs-muted);
}

/* variation dropdown — full width row under the card */

.bcs-cap__options {
	flex: 1 1 100%;
	min-width: 0;
}

.bcs-cap__options .bcs-variation-select {
	width: 100%;
	max-width: 100%;
	height: 38px;
	min-height: 38px;
	padding: 0 32px 0 10px;
	margin: 0;
	font-size: .875rem;
	line-height: 1.2;
	color: inherit;
	background-color: var(--bcs-surface);
	background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%23555' d='M4 6l4 4 4-4z'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 14px;
	border: 1px solid var(--bcs-border);
	border-radius: 8px;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
}

/* ---------- summary ---------- */

.bcs-summary {
	margin-top: 18px;
	padding-top: 14px;
	border-top: 1px solid var(--bcs-border);
}

.bcs-summary__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding: 3px 0;
	font-size: .875rem;
}

.bcs-summary__label {
	color: var(--bcs-muted);
}

.bcs-summary__value {
	text-align: right;
	font-variant-numeric: tabular-nums;
}

.bcs-summary__row--total {
	margin-top: 6px;
	padding-top: 10px;
	border-top: 1px solid var(--bcs-border);
	font-size: 1.0625rem;
	font-weight: 600;
}

.bcs-summary__row--total .bcs-summary__label {
	color: inherit;
}

.bcs-warning {
	margin: 12px 0 0;
	padding: 10px 12px;
	border-radius: 8px;
	background: #fdf3e3;
	color: #8a5700;
	font-size: .8125rem;
	line-height: 1.45;
}

.bcs-warning[hidden] {
	display: none;
}

/* ---------- cart ---------- */

.bcs-cart-cap .bcs-child-marker {
	opacity: .45;
	margin-right: .35em;
}

.bcs-cart-cap td {
	background: rgba(0, 0, 0, .02);
}

.bcs-locked-qty {
	opacity: .7;
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
	.bcs-wrap {
		padding: 16px;
		margin: 20px 0;
	}

	.bcs-caps {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 400px) {
	.bcs-wrap {
		padding: 14px;
		--bcs-gap: 10px;
	}

	.bcs-cap {
		gap: 10px;
		padding: 12px;
	}

	.bcs-cap__media {
		width: 46px;
		height: 46px;
	}

	.bcs-cap__info {
		flex: 1 1 100px;
	}

	/* Keep the stepper on its own line so the name never gets squeezed. */
	.bcs-cap__qty {
		flex: 1 1 100%;
		margin-left: 0;
		justify-content: flex-end;
	}
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
	.bcs-cap,
	.bcs-cap__qty .bcs-step {
		transition: none;
	}
}

/* Fallback in case the theme does not define it */
.bcs-wrap .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
