/* Light multi-product refresh (1.13.0): Shop listing, filters, product cards. Loaded after all base styles (inc/setup.php).
   Idea: one filter ("Rodzaj") does not need a sidebar, so it becomes a row of large chips above the grid and the grid
   gets the full 1200 px (4 columns). Cards have a fixed picture frame (bottle and jar both stand on the same line). */

/* ---------- Head: crumbs, title, compact ---------- */
:root body .k-shop-head { margin-bottom: 8px; }
:root body .k-shop-titlewrap h1 { font-size: clamp(28px, 3.4vw, 40px); }
:root body .k-shop-head .k-shop-intro { margin: 0; max-width: 680px; color: var(--text-body); font-size: 17px; line-height: 1.6; }

/* ---------- Body: no sidebar, filter row + toolbar + grid ---------- */
:root body .k-shop-body { display: flex; flex-direction: column; gap: 20px; }
:root body .k-shop-list { gap: 20px; }
:root body .k-shop-filters { width: 100%; }

/* Toolbar: count left, sorting right, hairline below the filter row */
:root body .k-shop-toolbar { padding-bottom: 14px; border-bottom: 1px solid var(--line-neutral); }
:root body .k-shop-toolbar .k-shop-results { font-size: 17px; line-height: 1.4; }
:root body .k-shop-toolbar .woocommerce-ordering select,
:root body .k-shop-toolbar .wc-block-catalog-sorting select { height: 48px; font-size: 16px; border-radius: var(--radius-sm); }
:root body .k-shop-toolbar .woocommerce-ordering select:focus-visible,
:root body .k-shop-toolbar .wc-block-catalog-sorting select:focus-visible { outline: 2px solid var(--cv-green-mist); outline-offset: 2px; }

/* ---------- Filter "Rodzaj" (native WooCommerce Product Filters block) ---------- */
@media (min-width: 783px) {
	:root body .cv-filters .wc-block-product-filters__overlay-content {
		display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 12px 28px;
		padding: 0; border: 0; border-radius: 0; background: none;
	}
	:root body .cv-filters .wp-block-woocommerce-product-filter-taxonomy {
		display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding: 0; border: 0;
	}
	:root body .cv-filters .wp-block-woocommerce-product-filter-active { padding: 0; }
	:root body .cv-filters .wp-block-woocommerce-product-filter-active:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
	:root body .cv-filters h3.cv-filter__h { margin: 0; font-size: 16px; }
	:root body .cv-filters .wc-block-product-filter-checkbox-list__items { flex-direction: row; flex-wrap: wrap; gap: 10px; }
	:root body .cv-filters .wc-block-product-filters__overlay-footer,
	:root body .cv-filters .wc-block-product-filters__overlay-header,
	:root body .cv-filters .wc-block-product-filters__open-overlay { display: none; }
}

/* Each option is a chip with a real checkbox inside (keyboard and screen readers work as in the native block) */
:root body .cv-filters .wc-block-product-filter-checkbox-list__label {
	min-height: 48px; padding: 0 16px 0 14px; gap: 10px; border: 1px solid var(--line-input); border-radius: var(--radius-sm);
	background: var(--surface-card); color: var(--text-heading); font-size: 16px; cursor: pointer;
	transition: border-color .2s, background-color .2s;
}
:root body .cv-filters .wc-block-product-filter-checkbox-list__label:hover { border-color: var(--cv-gold); background: var(--surface-hover); }
:root body .cv-filters .wc-block-product-filter-checkbox-list__label:has(input:checked) { border-color: var(--cv-gold); background: rgba(201, 154, 78, .16); }
:root body .cv-filters .wc-block-product-filter-checkbox-list__label:has(input:focus-visible) { outline: 2px solid var(--cv-green-mist); outline-offset: 2px; }
:root body .cv-filters .wc-block-product-filter-checkbox-list__text-wrapper { flex: 0 1 auto; gap: 6px; }
:root body .cv-filters .wc-block-product-filter-checkbox-list__count { color: var(--text-muted); }
:root body .cv-filters .wc-block-product-filter-checkbox-list__input { width: 22px; height: 22px; }
:root body .cv-filters .wc-block-product-filter-checkbox-list__input:focus-visible { outline: 0; }
:root body .cv-filters .wc-block-product-filter-removable-chips__item { min-height: 40px; font-size: 16px; }
:root body .cv-filters .wc-block-product-filter-clear-button .wp-block-button__link { min-height: 40px; padding: 0 16px; font-size: 16px; }

/* Phone overlay: big trigger, readable dialog, 48 px apply button */
@media (max-width: 782px) {
	:root body .k-shop-head { gap: 8px; }
	:root body .k-shop-body { gap: 14px; }
	:root body .cv-filters .wc-block-product-filters__open-overlay { min-height: 48px; width: 100%; justify-content: center; font-size: 17px; }
	:root body .cv-filters .wc-block-product-filters__open-overlay:focus-visible,
	:root body .cv-filters .wc-block-product-filters__close-overlay:focus-visible,
	:root body .cv-filters .wc-block-product-filters__apply:focus-visible { outline: 2px solid var(--cv-green-mist); outline-offset: 2px; }
	:root body .cv-filters .wc-block-product-filters__close-overlay { min-height: 48px; padding: 0 12px; font-size: 16px; color: var(--text-heading); }
	:root body .cv-filters .wc-block-product-filters__overlay-content { padding: 8px 20px 24px; }
	:root body .cv-filters .wp-block-woocommerce-product-filter-taxonomy { padding: 12px 0 0; border: 0; }
	:root body .cv-filters .wc-block-product-filter-checkbox-list__items { gap: 10px; }
	:root body .cv-filters .wc-block-product-filter-checkbox-list__label { width: 100%; min-height: 52px; }
	:root body .cv-filters .wc-block-product-filter-checkbox-list__text-wrapper { flex: 1; justify-content: space-between; }
	:root body .cv-filters .wc-block-product-filters__apply { min-height: 52px; width: 100%; font-size: 17px; border-radius: var(--radius-sm); }
	:root body .k-shop-toolbar { padding-bottom: 12px; }
}

/* ---------- Grid ---------- */
:root body .wc-block-product-template,
:root body .wc-block-product-template.wc-block-product-template__responsive { gap: 18px; grid-gap: 18px; }
@media (min-width: 640px) {
	:root body .wc-block-product-template,
	:root body .wc-block-product-template.wc-block-product-template__responsive { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; grid-gap: 20px; }
}
@media (min-width: 900px) {
	:root body .wc-block-product-template,
	:root body .wc-block-product-template.wc-block-product-template__responsive { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1180px) {
	:root body .wc-block-product-template,
	:root body .wc-block-product-template.wc-block-product-template__responsive { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; grid-gap: 24px; }
}
/* Phone: one column of horizontal cards (picture left, text right) in the shop and in "Nasze produkty" on the home page: readable for 55+, short sections */
@media (max-width: 639px) {
	:root body .wc-block-product-template,
	:root body .wc-block-product-template.wc-block-product-template__responsive { grid-template-columns: minmax(0, 1fr); gap: 14px; grid-gap: 14px; }
	:root body :is(.k-shop-body, .cv-products) .cv-pcard { display: grid; grid-template-columns: minmax(104px, 36%) minmax(0, 1fr); }
	:root body :is(.k-shop-body, .cv-products) .cv-pcard__media { aspect-ratio: auto; min-height: 100%; }
	:root body :is(.k-shop-body, .cv-products) .cv-pcard__media .cv-pcard__pic { inset: 12px 8px; width: calc(100% - 16px); height: calc(100% - 24px); }
	:root body :is(.k-shop-body, .cv-products) .cv-pcard__badges { top: 8px; left: 8px; }
	:root body :is(.k-shop-body, .cv-products) .cv-pcard__body { padding: 14px 14px 16px; }
	:root body :is(.k-shop-body, .cv-products) .cv-pcard__name { font-size: 21px; }
	:root body :is(.k-shop-body, .cv-products) .cv-pcard__price { font-size: 22px; }
	:root body :is(.k-shop-body, .cv-products) .cv-pcard__buy .cv-btn,
	:root body :is(.k-shop-body, .cv-products) .cv-pcard__more { height: 48px; }
}

/* ---------- Card ---------- */
.cv-pcard { transition: border-color .25s, box-shadow .25s, transform .35s cubic-bezier(.2, .7, .2, 1); }
.cv-pcard:hover { border-color: var(--line-gold-soft); }
.cv-pcard:focus-within { border-color: var(--cv-gold); box-shadow: 0 0 0 2px var(--cv-green-mist); }
/* The stretched link (name) carries the focus: show it on the whole card instead of a tiny outline on the text */
.cv-pcard__name a:focus-visible { outline: 0; }
.cv-pcard__media:focus-visible { outline: 0; }

/* Fixed picture frame; different proportions (tall bottle, wide jar) stand on one shelf line */
:root .cv-pcard__media {
	aspect-ratio: 1 / 1;
	background:
		radial-gradient(ellipse 70% 55% at 50% 62%, rgba(63, 191, 154, .13), rgba(63, 191, 154, 0) 70%),
		linear-gradient(180deg, rgba(27, 58, 48, .18), rgba(27, 58, 48, .42));
	border-bottom: 1px solid var(--line-neutral);
}
.cv-pcard__media .cv-pcard__pic { inset: 20px 16px 14px; width: calc(100% - 32px); height: calc(100% - 34px); object-fit: contain; object-position: center bottom; }
.cv-pcard__badges { top: 12px; left: 12px; gap: 6px; }
.cv-pcard__tag { font-size: 16px; line-height: 1.2; }

/* Text block */
:root .cv-pcard__body { gap: 6px; padding: 16px 18px 18px; }
.cv-pcard__need { font-size: 16px; font-weight: 500; letter-spacing: .02em; }
:root .cv-pcard__name { font-size: 22px; line-height: 1.2; }
.cv-pcard__herbs { font-size: 16px; line-height: 1.5; color: var(--text-body); }

/* Foot: prices on top, button always on the bottom edge so buttons line up across the row */
:root .cv-pcard__foot { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 0; margin-top: auto; padding-top: 12px; }
.cv-pcard__prices { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; min-height: 58px; align-content: flex-start; }
.cv-pcard__price { font-size: 24px; }
.cv-pcard__unit { font-size: 16px; }
.cv-pcard__buy { margin-top: 14px; }
:root .cv-pcard__buy .cv-btn,
.cv-pcard__more { height: 48px; font-size: 16px; }
.cv-pcard__buy .cv-btn:focus-visible { outline: 2px solid var(--cv-green-mist); outline-offset: 3px; }

/* "Wkrótce": no price, outlined look-alike of the button (the whole card is the link) */
.cv-pcard.is-soon .cv-pcard__prices { display: none; }
/* In place of the price: plain status text, so the card says why there is no price and no "Do koszyka". */
.cv-pcard__soon { margin: 0 0 12px; font-size: 16px; font-style: italic; line-height: 1.4; color: var(--cv-gold-light); }
.cv-pcard.is-soon .cv-pcard__media .cv-pcard__pic { filter: saturate(.85); }
.cv-pcard__more {
	box-sizing: border-box; display: flex; align-items: center; justify-content: center; width: 100%; margin-top: 14px;
	border: 1px solid var(--line-gold-soft); border-radius: var(--radius-sm); color: var(--cv-gold-light);
	font: 600 16px var(--font-sans); letter-spacing: var(--ls-button); text-transform: uppercase;
	transition: border-color .2s, background-color .2s;
}
.cv-pcard:hover .cv-pcard__more,
.cv-pcard:focus-within .cv-pcard__more { border-color: var(--cv-gold); background: rgba(201, 154, 78, .12); }
:root .cv-pcard__tag--soon { background: var(--cv-gold); color: var(--text-on-gold); }

/* ---------- Pagination ---------- */
:root body .wp-block-query-pagination { margin-top: 12px; gap: 8px; }
:root body .wp-block-query-pagination a,
:root body .wp-block-query-pagination .page-numbers { display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 48px; padding: 0 14px; border-radius: var(--radius-sm); font-size: 16px; }
:root body .wp-block-query-pagination a:focus-visible { outline: 2px solid var(--cv-green-mist); outline-offset: 2px; }

/* ---------- Empty state (category, search) ---------- */
:root body .wp-block-woocommerce-product-collection-no-results,
:root body .wc-block-product-collection__no-results,
:root body .k-empty { width: 100%; max-width: none; box-sizing: border-box; align-self: stretch; }
:root body .k-empty { align-items: center; gap: 14px; padding: 48px 20px; }
:root body .k-empty p.k-empty-title { font: 500 clamp(22px, 3vw, 28px)/1.25 var(--font-display); letter-spacing: .03em; text-transform: uppercase; }
:root body .k-empty p.k-empty-lead { max-width: 520px; font-size: 17px; line-height: 1.6; color: var(--text-body); }
:root body .k-empty-actions { margin-top: 6px; }
:root body .k-empty-btn .wp-block-button__link {
	display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 28px; border: 0; border-radius: var(--radius-sm);
	background: var(--cv-gold); color: var(--text-on-gold); font: 600 16px var(--font-sans); letter-spacing: var(--ls-button); text-transform: uppercase; text-decoration: none;
}
:root body .k-empty-btn .wp-block-button__link:hover { background: var(--cv-gold-light); color: var(--text-on-gold); }
:root body .k-empty-btn .wp-block-button__link:focus-visible { outline: 2px solid var(--cv-green-mist); outline-offset: 3px; }

@media (prefers-reduced-motion: reduce) {
	.cv-pcard, .cv-pcard__more, .cv-filters .wc-block-product-filter-checkbox-list__label { transition: none; }
	.cv-pcard:hover { transform: none; }
	.cv-pcard:hover .cv-pcard__img { transform: none; }
}

/* ---------- Fixes after first visual pass ---------- */
:root body .cv-filters .wc-block-product-filter-checkbox-list__label { box-sizing: border-box; }
:root body .cv-filters .wc-block-product-filter-checkbox-list__input { border: 2px solid var(--cv-sand); background: var(--surface-input); border-radius: 4px; }
:root body .cv-filters .wc-block-product-filter-checkbox-list__input:checked { border-color: var(--cv-gold); background: var(--cv-gold); }
:root body .cv-filters .wc-block-product-filters__close-overlay,
:root body .cv-filters .wc-block-product-filters__apply { font-family: var(--font-sans); }
@media (max-width: 782px) {
	:root body .cv-filters .wc-block-product-filters__open-overlay { display: flex; box-sizing: border-box; }
	:root body .cv-filters .wc-block-product-filters__overlay-content { box-sizing: border-box; }
}
:root body .k-shop-body { align-items: stretch; }
:root body .k-shop-body > *,
:root body .k-shop-list > *,
:root body .k-shop-body .wp-block-woocommerce-product-collection { width: 100%; max-width: none; box-sizing: border-box; }
:root body .k-shop-list { width: 100%; }
@media (min-width: 783px) {
	:root body .cv-filters,
	:root body .cv-filters .wc-block-product-filters__overlay,
	:root body .cv-filters .wc-block-product-filters__overlay-wrapper,
	:root body .cv-filters .wc-block-product-filters__overlay-dialog { background: none; }
	:root body .cv-filters .wp-block-woocommerce-product-filter-active { order: 2; }
}
