/*
 * Product page and archive cards of the marketplace variant (MS2): seller block, Creator chip, licence picker skin,
 * seller policies tab, more-from-seller row, "by <store>" on cards, sold-by filter. Tokens only (theme.json presets).
 */

/* ---------- "by <store>" on archive cards ---------- */
.cs-byline {
	margin: -0.35rem 0 0.6rem;
	text-align: center;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	color: var(--wp--preset--color--muted, #4f5e7a);
	line-height: 1.4;
}
.cs-byline a {
	display: inline-block;
	min-height: 24px;
	line-height: 24px;
	color: var(--wp--preset--color--primary-dark, #a75e03);
	text-decoration: underline;
	text-underline-offset: 2px;
}
.cs-more-seller .cs-byline {
	display: none;
}

/* ---------- shop toolbar ---------- */
.cs-shop-toolbar {
	align-items: flex-end;
	gap: 12px 20px;
}
.cs-shop-toolbar__controls {
	align-items: flex-end;
	gap: 12px 16px;
}
.cs-soldby__form {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 0;
}
.cs-soldby__label {
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	color: var(--wp--preset--color--muted, #4f5e7a);
}
.cs-soldby select {
	min-height: 44px;
	max-width: 100%;
	padding: 0 32px 0 12px;
	font: inherit;
	font-size: 1rem;
	color: var(--wp--preset--color--contrast, #0e1c38);
	background-color: var(--wp--preset--color--base, #fff);
	border: 1px solid var(--cs-mkt-field, #6f7c94);
	border-radius: var(--cs-radius-field, 6px);
}
.cs-soldby__apply {
	min-height: 44px;
	padding: 0 18px;
	font: inherit;
	font-weight: 600;
	color: var(--wp--preset--color--contrast, #0e1c38);
	background: transparent;
	border: 2px solid var(--wp--preset--color--contrast, #0e1c38);
	border-radius: var(--cs-radius-pill, 999px);
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease;
}
.cs-soldby__apply:hover {
	color: var(--wp--preset--color--base, #fff);
	background: var(--wp--preset--color--contrast, #0e1c38);
}
.cs-soldby__active {
	flex-basis: 100%;
	margin: 8px 0 0;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	color: var(--wp--preset--color--muted, #4f5e7a);
}
.cs-soldby__active a {
	display: inline-block;
	min-height: 24px;
	margin-left: 6px;
	color: var(--wp--preset--color--primary-dark, #a75e03);
}
.cs-soldby {
	display: flex;
	flex-wrap: wrap;
}

/* ---------- seller block ---------- */
.cs-seller {
	display: flex;
	gap: 14px;
	align-items: flex-start;
	margin: 18px 0;
	padding: 14px 16px;
	background: var(--wp--preset--color--tertiary, #f5f7f9);
	border: 1px solid var(--wp--preset--color--border, #dbe0e8);
	border-radius: var(--cs-radius-card, 14px);
}
.cs-seller__logo {
	flex: none;
	width: 48px;
	height: 48px;
	overflow: hidden;
	border-radius: 50%;
	box-shadow: 0 0 0 2px var(--wp--preset--color--base, #fff), 0 0 0 3px var(--wp--preset--color--border, #dbe0e8);
}
.cs-seller__logo img {
	display: block;
	width: 48px;
	height: 48px;
	object-fit: cover;
}
.cs-seller__mono {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	font-family: var(--cs-font-heading, Poppins, system-ui, sans-serif);
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--wp--preset--color--contrast, #0e1c38);
	background: var(--wp--preset--color--primary, #f69821);
}
.cs-seller__body {
	min-width: 0;
	flex: 1;
}
.cs-seller__line {
	margin: 0;
	font-weight: 600;
	color: var(--wp--preset--color--contrast, #0e1c38);
}
.cs-seller__line a {
	color: var(--wp--preset--color--primary-dark, #a75e03);
	text-underline-offset: 2px;
}
.cs-seller__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 12px;
	align-items: center;
	margin: 6px 0 0;
	padding: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	color: var(--wp--preset--color--muted, #4f5e7a);
}
.cs-chip {
	display: inline-block;
	padding: 2px 10px;
	color: var(--wp--preset--color--contrast, #0e1c38);
	background: var(--wp--preset--color--surface, #eceff3);
	border-radius: 999px;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	line-height: 1.5;
}
.cs-chip a {
	color: var(--wp--preset--color--primary-deep, #884800);
	font-weight: 600;
}
.cs-chip--design {
	background: var(--wp--preset--color--base, #fff);
	border: 1px solid var(--wp--preset--color--border, #dbe0e8);
}
.cs-seller__rating,
.cs-seller__note {
	margin: 6px 0 0;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	color: var(--wp--preset--color--muted, #4f5e7a);
}
.cs-seller__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 14px;
	align-items: center;
	margin-top: 10px;
}
.cs-seller__contact {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--wp--preset--color--primary-dark, #a75e03);
	font-weight: 600;
	text-underline-offset: 2px;
}
.cs-seller .cmmk-follow {
	margin: 0;
}
.cs-seller .cmmk-follow .cmkit-btn {
	min-height: 44px;
}

/* ---------- licence picker (add-on markup) ---------- */
.cs-product .cmmk-licences {
	margin: 0 0 16px;
	padding: 14px 16px;
	border: 1px solid var(--wp--preset--color--border, #dbe0e8);
	border-radius: var(--cs-radius-card, 14px);
	background: var(--wp--preset--color--base, #fff);
}
.cs-product .cmmk-licences legend {
	padding: 0 6px;
	font-family: var(--cs-font-heading, Poppins, system-ui, sans-serif);
	font-size: 1.0625rem;
	color: var(--wp--preset--color--contrast, #0e1c38);
}
.cs-product .cmmk-licence {
	margin: 0;
}
.cs-product .cmmk-licence label {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
	align-items: center;
	min-height: 44px;
	cursor: pointer;
}
.cs-product .cmmk-licence input[type="radio"] {
	width: 20px;
	height: 20px;
	margin: 0;
	accent-color: var(--wp--preset--color--primary-dark, #a75e03);
}
.cs-product .cmmk-licence__fee {
	color: var(--wp--preset--color--muted, #4f5e7a);
}
.cs-product .cmmk-licence__note {
	flex-basis: 100%;
	padding-left: 28px;
	font-size: var(--wp--preset--font-size--small, 0.875rem);
	color: var(--wp--preset--color--muted, #4f5e7a);
}

/* ---------- trust row and tabs ---------- */
/* WooCommerce fades inactive tabs with opacity .65, which drops them below AA; use the AA muted colour at full opacity instead. */
html body .wp-block-woocommerce-product-details ul.tabs.wc-tabs li,
html body .wp-block-woocommerce-product-details ul.tabs.wc-tabs li:not(.active) {
	opacity: 1 !important;
}
html body .wp-block-woocommerce-product-details ul.tabs.wc-tabs li:not(.active) a {
	color: var(--wp--preset--color--muted);
}
.cs-trust--mkt {
	margin-top: 22px;
}
.cs-trust--mkt a {
	display: inline-block;
	min-height: 24px;
	color: var(--wp--preset--color--primary-dark, #a75e03);
}
.cs-policies h3 {
	margin: 1.25rem 0 0.25rem;
	font-size: 1.0625rem;
}
.cs-policies p {
	max-width: 68ch;
}
.cs-more-seller {
	margin-top: 40px;
}
.cs-more-seller > h2 {
	margin-bottom: 20px;
}

@media (max-width: 781px) {
	.cs-product {
		padding-top: 14px !important;
		gap: 18px;
	}
	.cs-product__cols {
		gap: 16px;
	}
	.cs-product__summary > * + * {
		margin-block-start: 8px;
	}
	.cs-seller {
		margin: 12px 0;
		padding: 10px 12px;
	}
	.cs-seller__note {
		display: none;
	}
	.cs-seller__actions {
		margin-top: 4px;
	}
	.cs-seller__contact,
	.cs-seller .cmmk-follow .cmkit-btn {
		min-height: 44px;
	}
	.cs-shop-toolbar__controls,
	.cs-soldby,
	.cs-soldby__form {
		width: 100%;
	}
	.cs-soldby select {
		flex: 1;
		min-width: 0;
	}
}
@media (prefers-reduced-motion: reduce) {
	.cs-soldby__apply {
		transition: none;
	}
}

/*
 * The main image is the LCP element: WooCommerce prints the gallery with an inline opacity:0 and fades it in after its
 * slider script runs, which held the first paint of the image back by 1-2 s on mobile (MS7 Lighthouse). The pre-init
 * layout (main image + thumbnail row) matches the initialised one, so showing it at once adds no layout shift (CLS 0).
 */
.cs-product .woocommerce-product-gallery {
	opacity: 1 !important;
}

/* An empty notices block must not add a row gap above the gallery. */
.cs-product .wc-block-store-notices:has(.woocommerce-notices-wrapper:empty) {
	display: none;
}

@media (max-width: 781px) {
	.cs-product,
	.cs-product > .cs-product__cols {
		margin-block-start: 0 !important;
	}
	.cs-product .woocommerce-product-gallery {
		margin-bottom: 0;
	}
}

/* Toolbar: count left, filter + sorting right, the active-store note on its own row under both. */
.cs-shop-toolbar {
	align-items: center;
}
.cs-shop-toolbar__controls {
	align-items: center;
	flex: 1 1 auto;
	justify-content: flex-end;
}
.cs-soldby {
	display: contents;
}
.cs-soldby__active {
	order: 5;
	flex-basis: 100%;
	margin: 0;
	text-align: right;
}
.cs-shop-toolbar .wc-block-catalog-sorting,
.cs-shop-toolbar .woocommerce-ordering {
	margin: 0;
}
@media (max-width: 781px) {
	.cs-shop-toolbar__controls {
		justify-content: flex-start;
	}
	.cs-soldby__active {
		text-align: left;
	}
}
