/*
 * Crafter homepage sections: vouchers and mystery box.
 * Scoped to .crf / .crf-host so nothing leaks into the theme and theme rules don't leak in.
 */

/* ---------------------------------------------------------------- tokens */

.crf {
	--crf-ink: #191513;
	--crf-ink-hover: #37312e;
	--crf-text: #4e4946;
	--crf-muted: #7f7974;
	--crf-line: #e6e2de;
	--crf-line-strong: #ccc6c0;
	--crf-sand: #f5f2ed;
	--crf-white: #fff;

	--crf-font: "Oswald", "Arial Narrow", "Roboto Condensed", sans-serif;
	--crf-ease: cubic-bezier(0.25, 1, 0.5, 1); /* ease-out-quart */
	--crf-radius: 24px;
	--crf-gutter: clamp(16px, 2.1vw, 30px);
}

@supports (color: oklch(0 0 0)) {
	.crf {
		--crf-ink: oklch(0.2 0.008 50);
		--crf-ink-hover: oklch(0.32 0.01 50);
		--crf-text: oklch(0.41 0.009 55);
		--crf-muted: oklch(0.58 0.011 60);
		--crf-line: oklch(0.915 0.007 75);
		--crf-line-strong: oklch(0.83 0.011 75);
		--crf-sand: oklch(0.962 0.008 80);
	}
}

/* ---------------------------------------------------------------- Elementor host + reset */

.elementor .crf-host .elementor-widget-shortcode,
.elementor .crf-host .elementor-widget-shortcode:not(:last-child) {
	margin: 0 !important;
	--kit-widget-spacing: 0px;
}

.crf-host .elementor-widget-wrap,
.crf-host .elementor-column > .elementor-element-populated {
	padding: 0 !important;
}

.crf {
	padding-block: clamp(64px, 8vw, 128px);
	color: var(--crf-ink);
	font-family: var(--crf-font);
	font-size: 16px;
	font-weight: 400;
	line-height: 1.5;
	text-align: left;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
}

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

.crf h2,
.crf p,
.crf figure,
.crf fieldset,
.crf legend {
	margin: 0;
	padding: 0;
	border: 0;
	font-family: inherit;
	color: inherit;
	letter-spacing: normal;
	text-transform: none;
}

.crf a {
	color: inherit;
	text-decoration: none;
}

.crf :focus-visible {
	outline: 2px solid var(--crf-ink);
	outline-offset: 3px;
}

.crf .woocommerce-Price-amount,
.crf .woocommerce-Price-amount bdi {
	color: inherit;
	font: inherit;
}

.crf del {
	margin-right: 8px;
	color: var(--crf-muted);
	font-size: 0.7em;
	font-weight: 400;
}

.crf ins {
	text-decoration: none;
}

.crf-wrap {
	max-width: 1440px;
	margin-inline: auto;
	padding-inline: var(--crf-gutter);
}

/* ---------------------------------------------------------------- layout */

.crf-split {
	display: grid;
	grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
	align-items: center;
	gap: clamp(40px, 7vw, 128px);
}

.crf--reverse .crf-split {
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr);
}

.crf--reverse .crf-media {
	order: 2;
}

/* ---------------------------------------------------------------- media */

.crf .crf-media {
	position: relative;
	display: grid;
	place-items: center;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: var(--crf-radius);
	background: var(--crf-sand);
}

/* Photos fill the frame exactly (absolute, so the grid row can't stretch to the photo's ratio). */
.crf .crf-media .crf-media__img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	transition: opacity 0.22s var(--crf-ease);
}

/* Vouchers: the uncropped 2:1 card art, straight on the aubergine panel, no frame. */
.crf .crf-media--card {
	aspect-ratio: auto;
	overflow: visible;
	border-radius: 0;
	background: none;
}

.crf .crf-media--card .crf-media__img {
	position: static;
	width: 100%;
	max-width: 640px;
	height: auto;
	aspect-ratio: 2 / 1;
	border-radius: 16px;
	box-shadow:
		0 0 0 1px rgba(255, 255, 255, 0.08),
		0 22px 44px -18px rgba(0, 0, 0, 0.55),
		0 60px 90px -44px rgba(0, 0, 0, 0.6);
}

.crf .crf-media .crf-media__img.is-swapping {
	opacity: 0;
}

/* ---------------------------------------------------------------- copy */

.crf-body {
	max-width: 540px;
}

.crf--reverse .crf-body {
	justify-self: end;
	width: 100%;
}

.crf .crf-title {
	font-size: clamp(36px, calc(20px + 2.2vw), 56px);
	font-weight: 500;
	line-height: 1.05;
	letter-spacing: -0.005em;
	text-wrap: balance;
}

.crf .crf-text {
	max-width: 30em;
	margin-top: 20px;
	color: var(--crf-text);
	font-size: 18px;
	font-weight: 300;
	line-height: 1.65;
	text-wrap: pretty;
}

/* ---------------------------------------------------------------- picker */

.crf-form {
	margin-top: 40px;
	padding-top: 32px;
	border-top: 1px solid var(--crf-line);
}

.crf .crf-legend {
	margin-bottom: 14px;
	color: var(--crf-muted);
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

.crf-options {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.crf-option {
	position: relative;
	margin: 0;
	cursor: pointer;
}

/* The real radio stays in place for keyboards and screen readers; the pill is its label. */
.crf-option input {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.crf-option span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 92px;
	height: 50px;
	padding: 0 22px;
	border: 1px solid var(--crf-line-strong);
	border-radius: 999px;
	background: var(--crf-white);
	color: var(--crf-ink);
	font-size: 18px;
	font-weight: 400;
	line-height: 1;
	white-space: nowrap;
	transition: border-color 0.2s var(--crf-ease), background-color 0.2s var(--crf-ease), color 0.2s var(--crf-ease);
}

.crf-option:hover span {
	border-color: var(--crf-ink);
}

.crf-option input:checked + span {
	border-color: var(--crf-ink);
	background: var(--crf-ink);
	color: var(--crf-white);
}

.crf-option input:focus-visible + span {
	outline: 2px solid var(--crf-ink);
	outline-offset: 3px;
}

/* ---------------------------------------------------------------- price + actions */

.crf .crf-price {
	margin-top: 28px;
	font-size: 32px;
	font-weight: 500;
	line-height: 1.1;
	white-space: nowrap;
}

.crf-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 28px;
	margin-top: 24px;
}

.crf .crf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 54px;
	margin: 0;
	padding: 0 34px;
	border: 0;
	border-radius: 999px;
	background: var(--crf-ink);
	color: var(--crf-white);
	font-family: var(--crf-font);
	font-size: 16px;
	font-weight: 500;
	line-height: 1;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	box-shadow: none;
	transition: background-color 0.2s var(--crf-ease), transform 0.2s var(--crf-ease);
}

.crf .crf-btn:hover {
	background: var(--crf-ink-hover);
	color: var(--crf-white);
}

.crf .crf-btn:active {
	transform: scale(0.98);
}

/* States WooCommerce adds during AJAX add-to-cart. */
.crf .crf-btn.loading {
	opacity: 0.65;
	pointer-events: none;
}

.crf .crf-btn.added::after {
	content: "\2713";
	font-size: 1.1em;
	letter-spacing: 0;
}

.crf .crf-link,
.crf a.added_to_cart {
	padding-bottom: 2px;
	border-bottom: 1px solid var(--crf-line-strong);
	color: var(--crf-ink);
	font-size: 16px;
	font-weight: 400;
	transition: border-color 0.2s var(--crf-ease);
}

.crf .crf-link:hover,
.crf a.added_to_cart:hover {
	border-color: var(--crf-ink);
}

/* ---------------------------------------------------------------- vouchers: the voucher card's own colours */

.crf--vouchers {
	--crf-v-bg: #2a0b27; /* aubergine from the card */
	--crf-v-cream: #f5ece2; /* cream from the card */
	--crf-v-dim: rgba(245, 236, 226, 0.76);
	--crf-v-faint: rgba(245, 236, 226, 0.6);
	--crf-v-line: rgba(245, 236, 226, 0.16);
	--crf-v-line-strong: rgba(245, 236, 226, 0.36);
	--crf-v-yellow: #ffdb4c; /* brand yellow, as on the site's other buttons */
}

@supports (color: oklch(0 0 0)) {
	.crf--vouchers {
		--crf-v-bg: oklch(0.215 0.067 331.6);
		--crf-v-cream: oklch(0.947 0.017 70.5);
	}
}

.crf--vouchers .crf-split {
	padding: clamp(28px, 5.5vw, 88px);
	border-radius: 32px;
	background: var(--crf-v-bg);
	color: var(--crf-v-cream);
}

.crf--vouchers .crf-text {
	color: var(--crf-v-dim);
}

.crf--vouchers .crf-form {
	border-top-color: var(--crf-v-line);
}

.crf--vouchers .crf-legend {
	color: var(--crf-v-faint);
}

.crf--vouchers .crf-option span {
	border-color: var(--crf-v-line-strong);
	background: transparent;
	color: var(--crf-v-cream);
}

.crf--vouchers .crf-option:hover span {
	border-color: var(--crf-v-cream);
}

.crf--vouchers .crf-option input:checked + span {
	border-color: var(--crf-v-cream);
	background: var(--crf-v-cream);
	color: var(--crf-v-bg);
}

.crf--vouchers .crf-btn {
	background: var(--crf-v-yellow);
	color: var(--crf-ink);
}

.crf--vouchers .crf-btn:hover {
	background: var(--crf-v-cream);
	color: var(--crf-ink);
}

.crf--vouchers .crf-link,
.crf--vouchers a.added_to_cart {
	border-color: var(--crf-v-line-strong);
	color: var(--crf-v-cream);
}

.crf--vouchers .crf-link:hover,
.crf--vouchers a.added_to_cart:hover {
	border-color: var(--crf-v-cream);
}

.crf--vouchers :focus-visible,
.crf--vouchers .crf-option input:focus-visible + span {
	outline-color: var(--crf-v-yellow);
}

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

@media (max-width: 1199px) {
	.crf-split,
	.crf--reverse .crf-split {
		gap: clamp(32px, 5vw, 64px);
	}
}

@media (max-width: 899px) {
	.crf-split,
	.crf--reverse .crf-split {
		grid-template-columns: minmax(0, 1fr);
	}

	.crf--reverse .crf-media {
		order: 0;
	}

	.crf .crf-media {
		max-width: 640px;
	}

	.crf--vouchers .crf-split {
		border-radius: 24px;
	}

	.crf-body,
	.crf--reverse .crf-body {
		justify-self: start;
		max-width: 640px;
	}
}

/* Phones: a compact buy block. "Детайли" on the picker label's line; price and button share a row. */
@media (max-width: 599px) {
	.crf {
		padding-block: 56px;
	}

	.crf-split,
	.crf--reverse .crf-split {
		gap: 28px;
	}

	.crf .crf-title {
		font-size: 34px;
	}

	.crf .crf-text {
		margin-top: 14px;
		font-size: 16px;
		line-height: 1.55;
	}

	.crf-form {
		position: relative;
		display: flex;
		flex-wrap: wrap;
		align-items: flex-start;
		column-gap: 16px;
		margin-top: 24px;
		padding-top: 20px;
	}

	.crf-form .crf-picker {
		flex: 1 1 100%;
		min-width: 0;
	}

	.crf .crf-legend {
		margin-bottom: 12px;
		font-size: 12px;
	}

	.crf-form--picker .crf-link {
		position: absolute;
		top: 16px;
		right: 0;
		font-size: 15px;
	}

	.crf-option {
		flex: 1 1 0;
	}

	.crf-option span {
		width: 100%;
		min-width: 0;
		height: 46px;
		padding: 0 12px;
		font-size: 17px;
	}

	/* Same line box as the button, so it stays level with it when "Преглед на количката" appears. */
	.crf .crf-price {
		flex: 0 0 auto;
		margin-top: 20px;
		font-size: 26px;
		line-height: 52px;
	}

	.crf-actions {
		flex: 1 1 190px;
		gap: 10px 16px;
		margin-top: 20px;
	}

	.crf .crf-btn {
		flex: 1 1 auto;
		width: 100%;
		min-height: 52px;
		padding: 0 20px;
		font-size: 15px;
	}

	.crf a.added_to_cart {
		flex: 1 1 100%;
		align-self: center;
		text-align: center;
	}
}

@media (max-width: 479px) {
	.crf--vouchers .crf-split {
		padding: 20px 20px 26px;
		border-radius: 20px;
	}

	.crf .crf-media--card .crf-media__img {
		border-radius: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.crf *,
	.crf *::before,
	.crf *::after {
		transition: none !important;
	}
}
