/**
 * Storefront styling for the surfaces this plugin renders.
 *
 * Measured from the owner's Figma product page; see docs/design-system.md in the hub. Every value
 * is exposed as a custom property with the measured value as its fallback, so a theme (Bricks) can
 * retheme these blocks by defining the properties once, without overriding individual rules.
 */

.slavic-commerce-member,
.sc-pack,
.sc-pack-options,
.sc-commerce-benefits,
.sc-club-invite,
.sc-delivery {
	--sc-ink: var(--slavic-ink, #04384d);
	--sc-accent: var(--slavic-accent, #00ccff);
	--sc-info: var(--slavic-info, #f2fbff);
	--sc-surface: var(--slavic-surface, #f9f9f9);
	--sc-line: var(--slavic-line, #cfcfcf);
	--sc-muted: var(--slavic-muted, #888888);
	--sc-page: var(--slavic-page, #ffffff);
	--sc-club-gradient: var(--slavic-club-gradient, linear-gradient(90deg, #e3a32f 0%, #f2d78f 52%, #fff8e8 100%));
	--sc-font: var(--slavic-font-body, "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif);
	--sc-radius: var(--slavic-radius-small, 10px);
	--sc-radius-tile: var(--slavic-radius-exception, 7px);
	--sc-radius-pill: var(--slavic-radius-pill, 27px);
	font-family: var(--sc-font);
	letter-spacing: 0;
	color: var(--sc-ink);
}

/* Bricks dims every `label` with `--bricks-text-light`, which would grey out the pack tiles and the
   gift line. A label here is part of the surface, so it takes the surface colour. */
.sc-pack label,
.sc-pack-options label,
.sc-commerce-benefits label {
	color: inherit;
}

/* Member price ------------------------------------------------------------- */

/* Inline variant: catalogue cards and the native price block. */
span.slavic-commerce-member {
	font-size: 14px;
	font-weight: 600;
	line-height: 20px;
	color: var(--sc-ink);
}

/* Bar variant: the single product page, per the design. */
p.slavic-commerce-member {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px;
	margin: 12px 0;
	padding: 10px 24px;
	border-radius: var(--sc-radius);
	background: var(--sc-club-gradient);
	font-size: 14px;
	font-weight: 600;
	line-height: 20px;
}

.slavic-commerce-member .sc-unit {
	font-size: 12px;
	font-weight: 300;
	line-height: 20px;
}

.slavic-commerce-unit {
	display: block;
	font-family: var(--sc-font);
	font-size: 12px;
	font-weight: 300;
	line-height: 20px;
	color: var(--sc-ink);
}

/* Multipack tiles ---------------------------------------------------------- */

.sc-pack-legend {
	display: block;
	margin-bottom: 14px;
	padding: 0;
	font-size: 14px;
	font-weight: 400;
	line-height: 17.5px;
	color: var(--sc-muted);
}

.sc-pack-options {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
	margin: 0 0 14px;
	padding: 0;
	border: 0;
}

.sc-pack-option {
	position: relative;
	display: block;
	margin: 0;
}

.sc-pack-option input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.sc-pack-tile {
	display: flex;
	flex-direction: column;
	gap: 8px;
	height: 100%;
	padding: 8px 8px 11px;
	border: 0.5px solid var(--sc-line);
	border-radius: var(--sc-radius);
	background: var(--sc-page);
	cursor: pointer;
	transition: border-color 120ms ease-in-out;
}

.sc-pack-option input:checked + .sc-pack-tile {
	border-width: 1px;
	border-color: var(--sc-accent);
}

.sc-pack-option input:focus-visible + .sc-pack-tile {
	outline: 2px solid var(--sc-ink);
	outline-offset: 2px;
}

.sc-pack-option input:disabled + .sc-pack-tile {
	opacity: 0.55;
	cursor: not-allowed;
}

.sc-pack-tile img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 128 / 136;
	object-fit: cover;
	border-radius: var(--sc-radius-tile);
}

.sc-pack-body {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.sc-pack-heading {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.sc-pack-name {
	font-size: 14px;
	font-weight: 700;
	line-height: 17px;
}

.sc-pack-note {
	font-size: 12px;
	font-weight: 300;
	line-height: 15px;
}

.sc-pack-amounts {
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin-top: auto;
}

.sc-pack-was {
	font-size: 12px;
	font-weight: 300;
	line-height: 15px;
	color: var(--sc-muted);
	text-decoration: line-through;
}

.sc-pack-total {
	font-size: 16px;
	font-weight: 700;
	line-height: 20px;
}

.sc-pack-total .slavic-commerce-unit {
	font-weight: 300;
}

.sc-pack-price:empty {
	display: none;
}

/* Club invitation and Coin estimate ---------------------------------------- */

.sc-club-invite {
	display: flex;
	align-items: center;
	gap: 20px;
	margin: 12px 0;
	padding: 10px 24px;
	min-height: 80px;
	box-sizing: border-box;
	border-radius: var(--sc-radius);
	background: var(--sc-info);
	font-size: 14px;
	font-weight: 600;
	line-height: 20px;
}

.sc-club-invite p {
	margin: 0;
}

.sc-club-invite a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 0.15em;
}

.sc-club-invite-icon {
	flex: 0 0 auto;
	width: 30px;
	height: 30px;
}

/* Delivery label ----------------------------------------------------------- */

.sc-delivery {
	display: flex;
	flex-wrap: wrap;
	gap: 21px;
	margin: 12px 0;
	padding: 0;
	list-style: none;
}

.sc-delivery li {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 71px;
	box-sizing: border-box;
	padding: 0 11px;
	border-radius: var(--sc-radius);
	background: var(--sc-surface);
	font-size: 14px;
	font-weight: 300;
	line-height: 20px;
}

.sc-delivery svg {
	flex: 0 0 auto;
	color: var(--sc-ink);
}

/* Cart and checkout benefit panel ------------------------------------------ */

.sc-commerce-benefits {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 12px 0;
	padding: 20px;
	border: 0.5px solid var(--sc-line);
	border-radius: var(--sc-radius);
	font-size: 14px;
	line-height: 20px;
}

.sc-commerce-benefits p {
	margin: 0;
}

.sc-commerce-benefits progress {
	width: 100%;
	height: 8px;
	border: 0;
	border-radius: var(--sc-radius-pill);
	background: var(--sc-surface);
	overflow: hidden;
	appearance: none;
	-webkit-appearance: none;
}

.sc-commerce-benefits progress::-webkit-progress-bar {
	background: var(--sc-surface);
	border-radius: var(--sc-radius-pill);
}

.sc-commerce-benefits progress::-webkit-progress-value {
	background: var(--sc-club-gradient);
	border-radius: var(--sc-radius-pill);
}

.sc-commerce-benefits progress::-moz-progress-bar {
	background: var(--sc-club-gradient);
	border-radius: var(--sc-radius-pill);
}

.sc-commerce-benefits .sc-gift {
	padding: 8px 12px;
	border: 0.5px solid var(--sc-line);
	border-radius: var(--sc-radius-pill);
	font-family: inherit;
	font-size: 14px;
	color: inherit;
	background: var(--sc-page);
}

@media (max-width: 767px) {
	.sc-pack-legend {
		font-size: 12px;
		line-height: 15px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.sc-pack-tile {
		transition: none;
	}
}
