/*
 * Custom Spaces — component styles.
 * Override via CSS custom properties set on .cs-space or a parent Bricks global class.
 */

.cs-space {
	--cs-bg: #f6f2ec;
	--cs-card-bg: #ffffff;
	--cs-border: #e7e1d6;
	--cs-text: #1c1c1c;
	--cs-muted: #6b6b6b;
	--cs-accent: #2f4a32; /* dark green */
	--cs-accent-contrast: #ffffff;
	--cs-danger: #a33a2a;
	--cs-btn-bg: #111111;
	--cs-btn-bg-hover: #000000;
	--cs-btn-text: #ffffff;
	--cs-radius: 12px;
	--cs-radius-sm: 8px;
	--cs-gap: 14px;
	--cs-thumb: 68px;

	background: transparent;
	color: var(--cs-text);
	padding: 0;
	border-radius: var(--cs-radius);
	font-family: inherit;
	box-sizing: border-box;
	max-width: 100%;
}

.cs-space *, .cs-space *::before, .cs-space *::after {
	box-sizing: inherit;
}

.cs-space__list {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 18px;
}

/* ---------- Product row ---------- */

.cs-product {
	display: grid;
	grid-template-columns: var(--cs-thumb) 1fr auto;
	gap: 14px;
	align-items: center;
	background: var(--cs-card-bg);
	border: 1.5px solid var(--cs-border);
	border-radius: 14px;
	padding: 10px;
	cursor: pointer;
	transition: opacity .2s ease, border-color .2s ease;
}

.cs-product:hover {
	border-color: #C4A882;
}

.cs-product[data-selected="0"] {
	background: #F5F0E8;
}

.cs-product[data-selected="1"] {
	border-color: var(--cs-accent);
}

.cs-product.is-out-of-stock {
	opacity: .55;
	cursor: not-allowed;
}
.cs-product.is-in-cart-full {
	opacity: 1;
}

/* Unit badge — shown when a Space contains 2+ of the same product. Spans the
   full card width so it sits above the thumb/body/aside row. */
.cs-unit-pill {
	grid-column: 1 / -1;
	justify-self: start;
	font-size: 11px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: .06em;
	text-transform: uppercase;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--cs-accent);
	color: var(--cs-accent-contrast);
}

.cs-product[data-selected="0"] .cs-unit-pill {
	background: #8A7F74;
}

.cs-product.is-out-of-stock .cs-unit-pill {
	background: var(--cs-muted);
}

.cs-product__thumb {
	width: var(--cs-thumb);
	height: var(--cs-thumb);
	border-radius: var(--cs-radius-sm);
	overflow: hidden;
	background: #f0ebe1;
	flex-shrink: 0;
}

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

.cs-product__body {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.cs-product__name {
	font-weight: 600;
	font-size: 14px;
	line-height: 1.3;
	color: var(--cs-text);
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* Pinned-variation attribute summary ("Color: Blue, Size: L"). */
.cs-product__variation {
	font-size: 12px;
	color: var(--cs-muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cs-product__price {
	font-size: 12px;
	color: var(--cs-muted);
}

.cs-product__price .amount {
	color: #8A7F74;
	font-weight: 500;
}

.cs-product__price del {
	opacity: .6;
	margin-right: 4px;
}

/* ---------- Variation attributes ---------- */

.cs-product__attrs {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 0;
}

.cs-attr {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.cs-attr__label {
	display: none;
	font-size: 12px;
	color: var(--cs-muted);
	text-transform: uppercase;
	letter-spacing: .04em;
}

.cs-attr__options {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

/* Text/pill options */
.cs-attr.is-text .cs-attr__opt {
	appearance: none;
	background: #FDFAF5;
	border: 1.5px solid #E8DFD0;
	border-radius: 999px;
	padding: 4px 10px;
	font-size: 12px;
	color: #8A7F74;
	cursor: pointer;
	line-height: 1;
	text-transform: capitalize;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.cs-attr.is-text .cs-attr__opt:hover {
	border-color: #5C7A4E;
}
.cs-attr.is-text .cs-attr__opt.is-selected {
	background: #5C7A4E;
	color: #fff;
	border-color: #5C7A4E;
}

/* Color swatches */
.cs-attr.is-color .cs-attr__opt {
	appearance: none;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	border: 2px solid #fff;
	box-shadow: 0 0 0 1px var(--cs-border);
	cursor: pointer;
	padding: 0;
	position: relative;
	transition: box-shadow .15s ease, transform .15s ease;
}
.cs-attr.is-color .cs-attr__opt:hover {
	transform: scale(1.06);
}
.cs-attr.is-color .cs-attr__opt.is-selected {
	box-shadow: 0 0 0 2px var(--cs-accent);
}

/* When product is deselected (toggle off), show attribute selection in black */
.cs-product[data-selected="0"] .cs-attr.is-text .cs-attr__opt.is-selected {
	background: #000;
	border-color: #000;
	color: white;
}
.cs-product[data-selected="0"] .cs-attr.is-color .cs-attr__opt.is-selected {
	box-shadow: 0 0 0 2px #000;
}

.cs-attr.is-color .cs-attr__opt-label {
	position: absolute;
	width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

.cs-attr__opt[aria-disabled="true"],
.cs-attr__opt:disabled {
	opacity: .4;
	cursor: not-allowed;
}

/* ---------- Aside (checkbox + OOS pill) ---------- */

.cs-product__aside {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: center;
	gap: 8px;
}

.cs-oos-pill,
.cs-in-cart-pill {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .08em;
	padding: 4px 12px;
	border-radius: 999px;
	border: 1.5px solid currentColor;
	background: #efe8dc;
	color: var(--cs-danger);
	text-transform: uppercase;
	white-space: nowrap;
}

.cs-oos-pill {
	border-color: #D9BFB0;
}

.cs-in-cart-pill {
	color: #D89F46;
	border-color: #D89F46;
	background: #FFF6E8;
}

.cs-check {
	appearance: none;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 1.5px solid var(--cs-border);
	background: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: transparent;
	cursor: pointer;
	padding: 0;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.cs-check svg {
	width: 18px;
	height: 18px;
	display: block;
}
.cs-check[aria-pressed="true"] {
	background: var(--cs-accent);
	border-color: var(--cs-accent);
	color: var(--cs-accent-contrast);
}
.cs-check:disabled {
	display: none;
}

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

.cs-space__footer {
	position: sticky;
	bottom: 0;
	background: white;
	padding-top: 14px;
	border-top: 1px solid var(--cs-border);
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.cs-space__summary {
	display: flex;
	flex-wrap: nowrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
	font-size: 14px;
}

.cs-space__count {
	color: var(--cs-muted);
	min-width: 0;
}

.cs-space__total {
	display: flex;
	align-items: flex-end;
	flex-wrap: nowrap;
	flex-shrink: 0;
	gap: 8px;
	font-weight: 600;
}

.cs-space__total-label {
	font-size: 12px;
	letter-spacing: .08em;
	color: var(--cs-muted);
	text-transform: uppercase;
}

.cs-space__total-value {
	font-size: 18px;
	color: var(--cs-text);
}

.cs-sale-price-stack {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0;
}

.cs-sale-price-stack del {
	font-size: 12px;
	font-weight: 400;
	opacity: .55;
	text-decoration: line-through;
	line-height: 1.3;
}

.cs-sale-price-stack ins {
	text-decoration: none;
}

.cs-space__add {
	appearance: none;
	background: var(--cs-btn-bg);
	color: var(--cs-btn-text);
	border: 0;
	border-radius: var(--cs-radius);
	padding: 14px 18px;
	font-size: 15px;
	font-weight: 600;
	letter-spacing: .02em;
	cursor: pointer;
	width: 100%;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	transition: background .15s ease, transform .05s ease;
}
.cs-space__add:hover:not(:disabled) {
	background: var(--cs-btn-bg-hover);
}
.cs-space__add:active:not(:disabled) {
	transform: translateY(1px);
}
.cs-space__add:disabled {
	opacity: .4;
	cursor: not-allowed;
}

.cs-space__add-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 18px;
	height: 18px;
	flex-shrink: 0;
}

.cs-space__add-icon svg {
	width: 100%;
	height: 100%;
}

.cs-space__add-spinner {
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid rgba(255,255,255,.35);
	border-top-color: #fff;
	border-radius: 50%;
	animation: cs-spin .7s linear infinite;
}

.cs-space.is-loading .cs-space__add-spinner {
	display: inline-block;
}
.cs-space.is-loading .cs-space__add {
	pointer-events: none;
	opacity: .7;
}

@keyframes cs-spin {
	to { transform: rotate(360deg); }
}

.cs-space__message {
	font-size: 13px;
	text-align: center;
	min-height: 1em;
	color: var(--cs-muted);
}
.cs-space__message.is-error {
	color: var(--cs-danger);
}
.cs-space__message.is-success {
	color: var(--cs-accent);
}
.cs-space__message-headline {
	display: block;
	font-weight: 600;
}
.cs-space__message-list {
	margin: 6px 0 0;
	padding: 0;
	list-style: none;
	text-align: left;
	font-weight: 400;
}
.cs-space__message-list li {
	padding: 2px 0;
}
.cs-space__message-list li + li {
	border-top: 1px solid rgba(0, 0, 0, 0.06);
}

/* ---------- Related Spaces ([related_spaces] shortcode) ---------- */

.cs-related__heading {
	margin: 0 0 16px;
	font-size: 20px;
}

.cs-related__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
}

.cs-related__card {
	display: flex;
	flex-direction: column;
	gap: 10px;
	text-decoration: none;
	color: inherit;
}

.cs-related__thumb {
	display: block;
	border-radius: var(--cs-radius, 12px);
	overflow: hidden;
	background: #f0ebe1;
	aspect-ratio: 4 / 3;
}

.cs-related__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .25s ease;
}

.cs-related__card:hover .cs-related__thumb img {
	transform: scale(1.04);
}

.cs-related__title {
	font-weight: 600;
	font-size: 15px;
	line-height: 1.3;
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
	.cs-space {
		--cs-thumb: 64px;
	}

	.cs-space__footer {
		position: static;
	}

	.cs-product {
		grid-template-columns: var(--cs-thumb) 1fr auto;
		gap: 12px;
	}

	.cs-space__summary {
		flex-direction: column;
		align-items: flex-start;
		gap: 4px;
	}

	.cs-related__grid {
		grid-template-columns: 1fr;
	}
}
