/**
 * Ber4u catalog — premium light craft styling.
 * Light warm background, gold accent, serif display headings.
 * Loaded on shop / product-taxonomy / single-product pages only.
 */

/* ---- Palette & typography ------------------------------------------------ */

body.ber4u-catalog {
	--b4u-bg: #faf7f2;
	--b4u-surface: #ffffff;
	--b4u-line: #e9e1d2;
	--b4u-ink: #23201a;
	--b4u-muted: #8b8371;
	--b4u-gold: #d4a03c;
	--b4u-gold-dark: #b9862c;
	--b4u-serif: "Playfair Display", Georgia, serif;
	--b4u-sans: "Inter", -apple-system, "Segoe UI", sans-serif;

	background: var(--b4u-bg);
	font-family: var(--b4u-sans);
	color: var(--b4u-ink);
}

/* Keep the page content above the edge decorations. */
body.ber4u-catalog .site-content,
body.ber4u-catalog #content,
body.ber4u-catalog main {
	position: relative;
	z-index: 1;
}

/* ---- Edge decorations: hop & wheat line-art ------------------------------ */

.ber4u-deco {
	position: fixed;
	inset: 0;
	z-index: 0;
	pointer-events: none;
	color: #6b5b34;
}

.ber4u-deco__item {
	position: absolute;
	opacity: 0.1;
}
.ber4u-deco__item svg { width: 100%; height: 100%; }

.ber4u-deco__item:nth-child(1) { width: 90px;  top: 12%;  left: -18px; transform: rotate(-18deg); }
.ber4u-deco__item:nth-child(2) { width: 60px;  top: 42%;  left: 14px;  transform: rotate(12deg); opacity: 0.08; }
.ber4u-deco__item:nth-child(3) { width: 130px; bottom: 8%; left: -24px; transform: rotate(9deg); }
.ber4u-deco__item:nth-child(4) { width: 110px; top: 20%;  right: -22px; transform: rotate(21deg) scaleX(-1); opacity: 0.09; }
.ber4u-deco__item:nth-child(5) { width: 70px;  bottom: 14%; right: 10px; transform: rotate(-14deg) scaleX(-1); opacity: 0.12; }

@media (max-width: 1200px) {
	.ber4u-deco { display: none; } /* No empty side zones on narrow screens. */
}

/* ---- Hero banner ---------------------------------------------------------- */

.ber4u-banner {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 190px;
	margin: 0 0 1.75rem;
	border-radius: 18px;
	overflow: hidden;
	background-color: #2a251d;
	background-size: cover;
	background-position: center 35%;
}
.ber4u-banner::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(rgba(24, 20, 14, 0.35), rgba(24, 20, 14, 0.55));
}
.ber4u-banner__inner {
	position: relative;
	text-align: center;
	padding: 1.5rem;
}
.ber4u-banner__title {
	margin: 0;
	color: #fff;
	font-family: var(--b4u-serif);
	font-size: clamp(1.9rem, 4.5vw, 3rem);
	font-weight: 600;
	letter-spacing: 0.04em;
	text-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}
.ber4u-banner__subtitle {
	margin: 0.4rem 0 0;
	color: rgba(255, 255, 255, 0.85);
	font-size: 0.98rem;
	letter-spacing: 0.06em;
}

/* The banner replaces the theme's default archive heading. */
.ber4u-has-banner .woocommerce-products-header,
.ber4u-has-banner h1.page-title,
.ber4u-has-banner .ast-archive-description { display: none; }

@media (max-width: 640px) {
	.ber4u-banner { min-height: 130px; border-radius: 14px; }
}

/* ---- Toolbar: count · search · ordering ----------------------------------- */

.ber4u-shop-main .woocommerce-result-count {
	color: var(--b4u-muted);
	font-size: 0.92rem;
	padding-top: 0.6rem;
}

.ber4u-shop-main .woocommerce-ordering { float: right; margin-left: 0.75rem; }
.ber4u-shop-main .woocommerce-ordering select,
.ber4u-search input[type="search"] {
	padding: 0.55rem 0.8rem;
	border: 1px solid var(--b4u-line);
	border-radius: 10px;
	background: var(--b4u-surface);
	color: var(--b4u-ink);
	font-family: var(--b4u-sans);
	font-size: 0.92rem;
}
.ber4u-shop-main .woocommerce-ordering select:focus,
.ber4u-search input[type="search"]:focus {
	outline: none;
	border-color: var(--b4u-gold);
	box-shadow: 0 0 0 3px rgba(212, 160, 60, 0.18);
}

.ber4u-search { float: right; }
.ber4u-search form { display: flex; gap: 0.4rem; margin: 0; }
.ber4u-search button {
	padding: 0.55rem 0.9rem;
	border: none;
	border-radius: 10px;
	background: var(--b4u-gold);
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}
.ber4u-search button:hover { background: var(--b4u-gold-dark); }

/* ---- Two-column layout ----------------------------------------------------- */

.ber4u-shop-layout {
	display: flex;
	align-items: flex-start;
	gap: 1.75rem;
	clear: both;
}

.ber4u-filter-col {
	flex: 0 0 250px;
	position: sticky;
	top: 90px;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

.ber4u-shop-main { flex: 1 1 auto; min-width: 0; }

/* ---- Filter sidebar --------------------------------------------------------- */

.ber4u-filter {
	display: block;
	padding: 1.15rem 1.2rem 1.3rem;
	background: var(--b4u-surface);
	border: 1px solid var(--b4u-line);
	border-radius: 14px;
	box-shadow: 0 1px 3px rgba(35, 32, 26, 0.05);
}

.ber4u-filter__title {
	font-family: var(--b4u-serif);
	font-weight: 600;
	font-size: 1.25rem;
	color: var(--b4u-ink);
	padding-bottom: 0.8rem;
	margin-bottom: 1rem;
	border-bottom: 1px solid var(--b4u-line);
}

.ber4u-filter__group {
	display: block;
	margin: 0 0 1rem;
	padding: 0;
	border: none;
}

.ber4u-filter__label {
	display: block;
	font-weight: 600;
	font-size: 0.8rem;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--b4u-muted);
	margin-bottom: 0.4rem;
}

.ber4u-filter__select {
	appearance: auto;
	display: block;
	width: 100%;
	padding: 0.55rem 0.7rem;
	border: 1px solid var(--b4u-line);
	border-radius: 10px;
	background: var(--b4u-surface);
	color: var(--b4u-ink);
	font-family: var(--b4u-sans);
	font-size: 0.93rem;
	cursor: pointer;
}
.ber4u-filter__select:focus {
	outline: none;
	border-color: var(--b4u-gold);
	box-shadow: 0 0 0 3px rgba(212, 160, 60, 0.18);
}

/* Collapsible checkbox groups (Аромат / Вкус / Гастропара): closed by
   default, the chevron in the header toggles them open. */
details.ber4u-filter__group--checks { margin-bottom: 0.75rem; }

.ber4u-filter__label--toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	cursor: pointer;
	list-style: none;
	user-select: none;
	margin-bottom: 0;
	padding: 0.35rem 0;
}
.ber4u-filter__label--toggle::-webkit-details-marker { display: none; }
.ber4u-filter__label--toggle::marker { content: ""; }
.ber4u-filter__label--toggle:hover { color: var(--b4u-gold-dark); }

.ber4u-filter__arrow {
	flex: 0 0 auto;
	width: 9px;
	height: 9px;
	border-right: 2px solid var(--b4u-gold);
	border-bottom: 2px solid var(--b4u-gold);
	transform: rotate(45deg);          /* ▼ chevron pointing down when closed */
	transition: transform 0.18s ease;
	margin-top: -3px;
}
details[open] > .ber4u-filter__label--toggle .ber4u-filter__arrow {
	transform: rotate(225deg);         /* ▲ when open */
	margin-top: 3px;
}

details.ber4u-filter__group--checks .ber4u-checks { padding-top: 0.35rem; }

/* Checkbox groups (Аромат / Вкус / Гастропара) with a gold tick. */
.ber4u-checks {
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	max-height: 176px;
	overflow-y: auto;
	padding-right: 0.25rem;
}

.ber4u-check {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	font-size: 0.92rem;
	color: var(--b4u-ink);
	cursor: pointer;
}
.ber4u-check input[type="checkbox"] {
	width: 17px;
	height: 17px;
	margin: 0;
	accent-color: var(--b4u-gold);
	cursor: pointer;
}
.ber4u-check:hover span { color: var(--b4u-gold-dark); }

/* Price slider: two native ranges layered over one track. */
.ber4u-price__slider {
	position: relative;
	height: 26px;
	margin: 0.4rem 0 0.2rem;
}
.ber4u-price__track,
.ber4u-price__fill {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	height: 4px;
	border-radius: 2px;
}
.ber4u-price__track { left: 0; right: 0; background: var(--b4u-line); }
.ber4u-price__fill { left: 0; right: 0; background: var(--b4u-gold); }

.ber4u-price__slider input[type="range"] {
	position: absolute;
	inset: 0;
	width: 100%;
	margin: 0;
	background: none;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}
.ber4u-price__slider input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	pointer-events: auto;
	width: 17px;
	height: 17px;
	border-radius: 50%;
	background: var(--b4u-gold);
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(35, 32, 26, 0.35);
	cursor: pointer;
}
.ber4u-price__slider input[type="range"]::-moz-range-thumb {
	pointer-events: auto;
	width: 15px;
	height: 15px;
	border-radius: 50%;
	background: var(--b4u-gold);
	border: 2px solid #fff;
	box-shadow: 0 1px 4px rgba(35, 32, 26, 0.35);
	cursor: pointer;
}
.ber4u-price__slider input[type="range"]::-moz-range-track { background: none; }

.ber4u-price__label {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--b4u-gold-dark);
}

.ber4u-filter__apply {
	display: block;
	width: 100%;
	margin-top: 0.4rem;
	padding: 0.7rem 1rem;
	border: none;
	border-radius: 10px;
	background: var(--b4u-gold);
	color: #fff;
	font-family: var(--b4u-sans);
	font-weight: 700;
	font-size: 0.95rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.15s ease;
}
.ber4u-filter__apply:hover { background: var(--b4u-gold-dark); }

.ber4u-filter__reset {
	display: inline-block;
	margin-top: 0.6rem;
	color: var(--b4u-muted);
	font-size: 0.88rem;
	text-decoration: none;
}
.ber4u-filter__reset:hover { color: var(--b4u-gold-dark); }

/* Promo banner under the filter. */
.ber4u-promo {
	position: relative;
	display: block;
	min-height: 150px;
	border-radius: 14px;
	overflow: hidden;
	background-color: #2a251d;
	background-size: cover;
	background-position: center;
	text-decoration: none;
}
.ber4u-promo::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(rgba(24, 20, 14, 0.25), rgba(24, 20, 14, 0.72));
}
.ber4u-promo__inner {
	position: absolute;
	left: 1rem;
	right: 1rem;
	bottom: 0.9rem;
}
.ber4u-promo__title {
	display: block;
	color: #fff;
	font-family: var(--b4u-serif);
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.3;
}
.ber4u-promo__text {
	display: block;
	margin-top: 0.25rem;
	color: var(--b4u-gold);
	font-size: 0.82rem;
	font-weight: 600;
}

/* Mobile filter toggle. */
.ber4u-filter-toggle {
	display: none;
	margin: 0 0 1rem;
	padding: 0.65rem 1.4rem;
	border: 1px solid var(--b4u-gold);
	border-radius: 10px;
	background: var(--b4u-surface);
	color: var(--b4u-gold-dark);
	font-weight: 700;
	cursor: pointer;
}
.ber4u-filter-toggle.is-open,
.ber4u-filter-toggle:hover { background: var(--b4u-gold); color: #fff; }

/* ---- Product cards ----------------------------------------------------------- */

.ber4u-shop-main ul.products {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
	gap: 1.3rem;
	margin: 1.25rem 0 0;
	padding: 0;
	list-style: none;
	clear: both;
}

.ber4u-shop-main ul.products li.ber4u-card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: auto;
	float: none;
	margin: 0;
	background: var(--b4u-surface);
	border: 1px solid var(--b4u-line);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(35, 32, 26, 0.05);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.ber4u-shop-main ul.products li.ber4u-card:hover {
	box-shadow: 0 10px 26px rgba(35, 32, 26, 0.13);
	transform: translateY(-3px);
}

.ber4u-card__media {
	display: block;
	background: #f4efe6;
	overflow: hidden;
}
.ber4u-card__media img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	height: auto;
	object-fit: contain;
	padding: 0.8rem;
	box-sizing: border-box;
	transition: transform 0.25s ease;
}
.ber4u-shop-main ul.products li.ber4u-card:hover .ber4u-card__media img {
	transform: scale(1.05);
}

.ber4u-card__body {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	min-width: 0;
	gap: 0.25rem;
	padding: 0.9rem 1rem 1rem;
}

.ber4u-card__style {
	font-size: 0.74rem;
	font-weight: 600;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	color: var(--b4u-gold-dark);
}

.ber4u-card__title {
	color: var(--b4u-ink);
	font-weight: 600;
	font-size: 1rem;
	line-height: 1.3;
	text-decoration: none;
}
.ber4u-card__title:hover { color: var(--b4u-gold-dark); }

.ber4u-card__meta {
	font-size: 0.84rem;
	color: var(--b4u-muted);
}

.ber4u-card__price {
	margin-top: 0.35rem;
	font-family: var(--b4u-serif);
	font-size: 1.35rem;
	font-weight: 600;
	color: var(--b4u-gold-dark);
}
.ber4u-card__price del { opacity: 0.45; font-size: 0.95rem; margin-right: 0.35rem; }
.ber4u-card__price ins { text-decoration: none; }

.ber4u-card__actions {
	margin-top: auto;
	padding-top: 0.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
}
.ber4u-card__tara {
	flex: 1 1 auto;
	min-width: 56px;
	padding: 0.4rem 0.5rem;
	border: 1px solid var(--b4u-line);
	border-radius: 10px;
	background: var(--b4u-surface);
	color: var(--b4u-ink);
	font-family: var(--b4u-sans);
	font-size: 0.85rem;
}
.ber4u-card__opts {
	display: flex;
	align-items: center;
	gap: 0.4rem;
}
.ber4u-card__qty {
	display: inline-flex;
	align-items: center;
	flex: 0 0 auto;
	border: 1px solid var(--b4u-line);
	border-radius: 10px;
	background: var(--b4u-surface);
	overflow: hidden;
}
.ber4u-card__qty-btn {
	box-sizing: border-box;
	width: 28px !important;
	min-width: 0 !important;
	height: 32px;
	padding: 0 !important;
	border: none !important;
	background: transparent !important;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
	color: var(--b4u-ink);
}
.ber4u-card__qty-btn:hover { color: var(--b4u-gold-dark); }
.ber4u-card__qty-val {
	min-width: 20px;
	text-align: center;
	font-weight: 700;
	font-size: 0.88rem;
}
.ber4u-card__actions .ber4u-card__add.button {
	width: 100%;
}
.ber4u-card__actions .button {
	display: block;
	width: 100%;
	padding: 0.5rem 1rem;
	border: none;
	border-radius: 10px;
	background: var(--b4u-gold);
	color: #fff;
	font-family: var(--b4u-sans);
	font-weight: 700;
	font-size: 0.9rem;
	letter-spacing: 0.04em;
	text-align: center;
	text-transform: uppercase;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s ease;
}
.ber4u-card__actions .button:hover { background: var(--b4u-gold-dark); color: #fff; }
.ber4u-card__actions .added_to_cart {
	display: block;
	margin-top: 0.4rem;
	text-align: center;
	font-size: 0.85rem;
	color: var(--b4u-gold-dark);
}

/* Round corner badges. */
.ber4u-badge {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 46px;
	height: 46px;
	border-radius: 50%;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: #fff;
	box-shadow: 0 2px 8px rgba(35, 32, 26, 0.25);
}
.ber4u-badge--sale { background: #bc4530; }
.ber4u-badge--hit  { background: #23201a; color: var(--b4u-gold); }
.ber4u-badge--new  { background: var(--b4u-gold); }

/* ---- Smooth loading & pagination fallback -------------------------------------- */

.ber4u-loadmore {
	display: flex;
	justify-content: center;
	padding: 1.5rem 0 0.5rem;
	clear: both;
}
.ber4u-loadmore__btn {
	padding: 0.75rem 2.4rem;
	border: none;
	border-radius: 10px;
	background: var(--b4u-gold);
	color: #fff;
	font-family: var(--b4u-sans);
	font-weight: 700;
	font-size: 0.95rem;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	cursor: pointer;
	transition: background 0.15s ease, opacity 0.15s ease;
}
.ber4u-loadmore__btn:hover { background: var(--b4u-gold-dark); }
.ber4u-loadmore__btn.is-loading { opacity: 0.6; cursor: wait; }

.ber4u-fade-in { animation: ber4uFadeIn 0.45s ease both; }
@keyframes ber4uFadeIn {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: none; }
}

.ber4u-shop-main .woocommerce-pagination {
	margin-top: 1.5rem;
	text-align: center;
}
.ber4u-shop-main .woocommerce-pagination .page-numbers {
	display: inline-flex;
	gap: 0.35rem;
	list-style: none;
	margin: 0;
	padding: 0;
}
.ber4u-shop-main .woocommerce-pagination .page-numbers li .page-numbers {
	display: inline-block;
	min-width: 2.5rem;
	padding: 0.55rem 0.75rem;
	border: 1px solid var(--b4u-line);
	border-radius: 10px;
	background: var(--b4u-surface);
	color: var(--b4u-ink);
	font-weight: 600;
	text-decoration: none;
}
.ber4u-shop-main .woocommerce-pagination .page-numbers li .page-numbers.current,
.ber4u-shop-main .woocommerce-pagination .page-numbers li .page-numbers:hover {
	background: var(--b4u-gold);
	border-color: var(--b4u-gold);
	color: #fff;
}

/* ---- Responsive ------------------------------------------------------------------ */

@media (max-width: 860px) {
	.ber4u-shop-layout { flex-direction: column; }

	.ber4u-filter-toggle { display: inline-block; }

	.ber4u-filter-col {
		position: static;
		flex: 1 1 auto;
		width: 100%;
		display: none;
	}
	.ber4u-filter-col.is-open { display: flex; }

	.ber4u-search { float: none; margin-bottom: 0.75rem; }
	.ber4u-search input[type="search"] { flex: 1 1 auto; }

	.ber4u-shop-main ul.products {
		grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
		gap: 0.9rem;
	}
}

/* ---- Phone: horizontal one-per-row cards, cleaned-up toolbar -------------- */
@media (max-width: 640px) {
	/* Drop the hero banner and the "showing N of M" count */
	.ber4u-banner { display: none !important; }
	.ber4u-shop-main .woocommerce-result-count { display: none !important; }

	/* Toolbar: full-width, aligned controls (Фильтр / Сортировка / Поиск) */
	.ber4u-filter-toggle {
		display: block;
		width: 100%;
		text-align: center;
		margin: 0 0 0.6rem;
	}
	.ber4u-shop-main .woocommerce-ordering {
		float: none;
		width: 100%;
		margin: 0 0 0.6rem;
	}
	.ber4u-shop-main .woocommerce-ordering select { width: 100%; }
	.ber4u-search { float: none; margin: 0 0 1rem; }
	.ber4u-search form { display: flex; gap: 0.5rem; margin: 0; }
	.ber4u-search input[type="search"] { flex: 1 1 auto; min-width: 0; }

	/* One product per row: image left, text + button right */
	.ber4u-shop-main ul.products {
		grid-template-columns: 1fr;
		gap: 0.75rem;
	}
	.ber4u-shop-main ul.products li.ber4u-card {
		flex-direction: row;
		align-items: stretch;
	}
	.ber4u-card__media {
		flex: 0 0 118px;
		width: 118px;
		display: flex;
		align-items: center;
		justify-content: center;
	}
	.ber4u-card__media img {
		width: 100%;
		aspect-ratio: 1 / 1;
		height: auto;
		padding: 0.5rem;
	}
	.ber4u-card__body {
		padding: 0.7rem 0.9rem;
	}
	.ber4u-card__price {
		margin-top: 0.2rem;
		font-size: 1.2rem;
	}
	.ber4u-card__actions {
		padding-top: 0.5rem;
	}
	/* Tara full-width above the compact stepper on phones */
	.ber4u-card__opts {
		flex-direction: column;
		align-items: stretch;
		gap: 0.45rem;
	}
	.ber4u-card__tara { width: 100%; }
	.ber4u-card__qty {
		align-self: flex-start;
	}
	.ber4u-card__qty-btn {
		width: 28px;
		min-height: 34px;
		font-size: 1rem;
	}
	.ber4u-card__qty-val {
		min-width: 18px;
		font-size: 0.85rem;
	}
	.ber4u-card__actions .ber4u-card__add.button {
		width: 100%;
		flex: none;
		padding: 0.55rem 0.6rem;
		font-size: 0.82rem;
	}
	/* Badge over the image (now on the left) */
	.ber4u-card .ber4u-badge {
		top: 8px;
		left: 8px;
		right: auto;
		width: 40px;
		height: 40px;
	}
}
