/* =========================================================================
   Arco Metal – shop: shop page, categories, brands (archive-product.html), product cards.
   Uses the tokens of sections.css and the page hero of pages.css.
   ========================================================================= */

/* ---------- hero ---------- */
.shop-hero__inner { gap: 14px; justify-items: start; }
.shop-hero__inner > * { margin-block: 0; }
.shop-hero .woocommerce-breadcrumb, .shop-hero .wc-block-breadcrumbs { color: var(--hero-muted); font-size: var(--step--1); }
.shop-hero .woocommerce-breadcrumb a, .shop-hero .wc-block-breadcrumbs a { color: #E3E8E5; text-decoration: none; }
.shop-hero .woocommerce-breadcrumb a:hover, .shop-hero .wc-block-breadcrumbs a:hover { color: var(--accent-on-dark); text-decoration: underline; }
.shop-hero .wp-block-query-title { color: var(--hero-fg); font-size: clamp(2rem, 1.5rem + 2vw, 3.25rem); line-height: 1.05; letter-spacing: -.03em; max-width: 24ch; }
.shop-hero__desc { color: var(--hero-muted); max-width: 64ch; font-size: var(--step-1); line-height: 1.55; }
.shop-hero__desc p { margin: 0; }
.shop-hero__desc a { color: var(--accent-on-dark); }

.shop-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: clamp(24px, 3vw, 40px); }
.shop-body > * { margin-block: 0; }

/* ---------- category tiles ---------- */
.arco-cats { margin-bottom: clamp(20px, 2.5vw, 32px); }
.arco-cats__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 10px; }
.arco-cat { display: flex; margin: 0; }
.arco-cat a { flex: 1 1 auto; min-width: 0; box-sizing: border-box; }
.arco-cat a {
	display: grid; grid-template-columns: 52px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 12px; align-content: center;
	padding: 8px 14px 8px 8px; border: 1px solid var(--line); border-radius: var(--r-md); background: #fff; color: var(--head); text-decoration: none;
	transition: border-color .2s, box-shadow .3s var(--ease), transform .3s var(--ease);
}
.arco-cat a:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-1px); }
.arco-cat a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.arco-cat__img { grid-row: 1 / 3; display: block; width: 52px; height: 52px; border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.arco-cat__img img { width: 100%; height: 100%; object-fit: contain; padding: 6%; mix-blend-mode: multiply; transition: transform .5s var(--ease); }
.arco-cat a:hover .arco-cat__img img { transform: scale(1.08); }
.arco-cat__name { align-self: end; font: 600 .9375rem/1.25 var(--font-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arco-cat a:hover .arco-cat__name { color: var(--accent); }
.arco-cat__count { align-self: start; color: var(--muted); font-size: .8125rem; }
@media (max-width: 700px) {
	/* one swipeable row instead of a tall block above the products */
	.arco-cats { margin-inline: calc(-1 * var(--wp--style--root--padding-left, 16px)); }
	.arco-cats__list { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px var(--wp--style--root--padding-left, 16px) 6px; scrollbar-width: none; }
	.arco-cats__list::-webkit-scrollbar { display: none; }
	.arco-cat { flex: 0 0 auto; scroll-snap-align: start; }
	.arco-cat a { grid-template-columns: 40px auto; column-gap: 10px; padding: 6px 14px 6px 6px; }
	.arco-cat__img { width: 40px; height: 40px; }
}

/* ---------- brand chips ---------- */
.shop-body .brand-filter { margin: 0 0 14px; gap: 10px 14px; }
.shop-body .brand-filter__label { color: var(--muted); font-size: var(--step--1); font-weight: 600; }
.shop-body .brand-btn { min-height: 36px; padding: 0 14px; border-color: var(--line); color: var(--head); }
.shop-body .brand-btn:hover { border-color: var(--accent); background: var(--mint); color: var(--accent); }
.shop-body .brand-btn.active { border-color: var(--accent); background: var(--accent); color: #fff; }
@media (max-width: 700px) {
	.shop-body .brand-filter { flex-wrap: nowrap; margin-inline: calc(-1 * var(--wp--style--root--padding-left, 16px)); padding-left: var(--wp--style--root--padding-left, 16px); }
	.shop-body .brand-filter__list { flex-wrap: nowrap; overflow-x: auto; padding-right: 16px; scrollbar-width: none; }
	.shop-body .brand-filter__list::-webkit-scrollbar { display: none; }
	.shop-body .brand-btn { flex: 0 0 auto; }
}

/* ---------- sticky toolbar ---------- */
.shop-toolbar {
	position: sticky; top: calc(var(--am-header-h) + var(--wp-admin--admin-bar--height, 0px)); z-index: 5;
	gap: 10px 20px; margin-bottom: 24px !important; padding: 10px 0; isolation: isolate;
}
/* full-bleed frosted band behind the toolbar */
.shop-toolbar::before {
	content: ""; position: absolute; inset: 0 -100vw; z-index: -1; border-block: 1px solid var(--line);
	background: rgba(255, 255, 255, .92); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
main:has(> .shop-body) { overflow-x: clip; }
@media (max-width: 600px) {
	/* phone: toolbar scrolls away (a sticky two-row bar would eat the screen); count hidden, sort beside the switch */
	.shop-toolbar { position: relative; top: auto; flex-wrap: nowrap !important; gap: 10px; }
	.shop-toolbar .wc-block-product-results-count, .shop-toolbar .woocommerce-result-count { display: none; }
	.shop-toolbar .only-instock-label { font-size: .8125rem; line-height: 1.2; }
	.shop-toolbar select.orderby { max-width: 150px; padding-right: 30px; background-position: right 10px center; }
}
.shop-toolbar__left { gap: 8px 20px; align-items: center; }
.shop-toolbar > *, .shop-toolbar__left > * { margin: 0 !important; }
.shop-toolbar .woocommerce-result-count, .shop-toolbar .wc-block-product-results-count { margin: 0; color: var(--muted); font-size: var(--step--1); }
.shop-toolbar .woocommerce-ordering { margin: 0; }
.shop-toolbar select.orderby {
	min-height: 40px; padding: 0 36px 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23151716' stroke-width='1.6'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E") no-repeat right 14px center;
	-webkit-appearance: none; appearance: none; color: var(--head); font: 500 .875rem/1 var(--font-body); cursor: pointer;
}
.shop-toolbar select.orderby:hover { border-color: var(--accent); }
.shop-toolbar select.orderby:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* "Kuva ainult laos tooted" as a switch */
.shop-toolbar .only-instock-label { gap: 10px; min-height: 40px; color: var(--head); font-size: .9375rem; font-weight: 500; }
.shop-toolbar .only-instock-label input {
	position: relative; flex: 0 0 auto; width: 38px; height: 22px; margin: 0; border-radius: 999px; background: #C9D3CB;
	-webkit-appearance: none; appearance: none; cursor: pointer; transition: background .2s;
}
.shop-toolbar .only-instock-label input::after {
	content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s var(--ease);
}
.shop-toolbar .only-instock-label input:checked { background: var(--accent); }
.shop-toolbar .only-instock-label input:checked::after { transform: translateX(16px); }
.shop-toolbar .only-instock-label input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- product grid + cards ---------- */
.shop-grid .wc-block-product-template, .product-cards {
	display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(14px, 2vw, 28px) clamp(12px, 1.6vw, 24px);
	list-style: none; margin: 0; padding: 0;
}
@media (max-width: 1080px) { .shop-grid .wc-block-product-template, .product-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .shop-grid .wc-block-product-template, .product-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.product-cards > li { position: relative; display: flex; flex-direction: column; gap: 6px; width: auto !important; margin: 0 !important; text-align: left; }
.product-cards > li > * { margin: 0 !important; }

.product-card__media { position: relative; margin-bottom: 8px !important; border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.product-card__media a { display: block; position: relative; aspect-ratio: 1; }
.product-card__media img { position: absolute; inset: 0; width: 100% !important; height: 100% !important; object-fit: contain !important; padding: 7%; mix-blend-mode: multiply; transition: opacity .45s var(--ease), transform .7s var(--ease); }
.product-card__media .arco-alt-img { opacity: 0; }
/* arco-core "Tootepiltide joondus": --fs/--fx/--fy scale the object to fill the frame and centre it.
   --k = share of the box inside the padding (translate % is of the whole box). */
.product-card__media img, .arco-cat__img img { --k: .86; }
.arco-cat__img img { --k: .88; }
.product-card__media img, .arco-cat__img img {
	scale: var(--fs, 1); translate: calc(var(--fx, 0) * var(--k, .88) * 100%) calc(var(--fy, 0) * var(--k, .88) * 100%);
}
@media (hover: hover) {
	.product-cards > li:hover .product-card__media img { transform: scale(1.04); }
	.product-cards > li:hover .product-card__media:has(.arco-alt-img) img:not(.arco-alt-img) { opacity: 0; }
	.product-cards > li:hover .product-card__media .arco-alt-img { opacity: 1; }
}
.product-card__media .wc-block-components-product-sale-badge {
	position: absolute; top: 10px; left: 10px; z-index: 1; margin: 0; padding: 4px 10px; border: 0; border-radius: 999px;
	background: var(--accent); color: #fff; font: 600 .75rem/1.4 var(--font-body); letter-spacing: .02em; text-transform: none;
}

.product-cards .arco-card-swatches { display: flex; align-items: center; gap: 5px; min-height: 20px; }
.arco-dot { display: block; width: 16px; height: 16px; border-radius: 50%; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .14); }
.arco-dot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.arco-dot-more { margin-left: 2px; color: var(--muted); font-size: .75rem; font-weight: 600; }

.product-card__title { font: 600 1rem/1.35 var(--font-display) !important; letter-spacing: -.005em; }
.product-card__title a { color: var(--head); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 0; } /* whole card is the link */
.product-cards > li:hover .product-card__title a { color: var(--accent); }
.product-card__title a:focus-visible { outline: none; }
.product-cards > li:has(.product-card__title a:focus-visible) { outline: 3px solid var(--accent); outline-offset: 6px; border-radius: var(--r-md); }

.product-card__price { color: var(--head); font-size: .9375rem !important; font-weight: 600; text-align: left !important; }
.product-card__price del { color: var(--muted); font-weight: 400; margin-right: 6px; }
.product-card__price ins { text-decoration: none; color: var(--accent); }
.product-card__price .woocommerce-price-suffix, .product-card__price small { color: var(--muted); font-size: .75rem; font-weight: 400; }

.product-card__button { position: relative; z-index: 1; display: block !important; margin-top: auto !important; padding-top: 8px; text-align: left !important; }
.product-card__button .wp-block-button__link, .product-card__button .button {
	display: inline-flex; align-items: center; justify-content: center; width: 100% !important; min-height: 42px; padding: 0 14px !important; border: 1.5px solid var(--line) !important;
	border-radius: var(--r-sm); background: #fff !important; color: var(--head) !important; font: 600 .875rem/1 var(--font-body) !important; text-transform: none; letter-spacing: 0;
	transition: background .2s, border-color .2s, color .2s;
}
.product-card__button .wp-block-button__link:hover, .product-card__button .button:hover { border-color: var(--accent) !important; background: var(--accent) !important; color: #fff !important; }
.product-card__button .added_to_cart { display: none; } /* the button itself says "1 ostukorvis", the header cart counts */
.product-card__button .wc-block-components-product-button__button.loading { opacity: .6; }

/* pagination */
.shop-pagination { margin-top: clamp(32px, 4vw, 56px) !important; gap: 6px; font-weight: 600; }
.shop-pagination a, .shop-pagination .page-numbers {
	display: inline-grid; place-items: center; min-width: 42px; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r-sm);
	color: var(--head); text-decoration: none;
}
.shop-pagination a:hover { border-color: var(--accent); color: var(--accent); }
.shop-pagination .page-numbers.current { border-color: var(--accent); background: var(--accent); color: #fff; }
.shop-pagination .page-numbers.dots { border: 0; min-width: 0; }

/* empty state */
.shop-empty { padding: clamp(40px, 6vw, 80px) 16px; border: 1px dashed var(--line); border-radius: var(--r-lg); text-align: center; }
.shop-empty > * { margin: 0; }
.shop-empty p { color: var(--muted); max-width: 52ch; }

@media (prefers-reduced-motion: reduce) {
	.arco-cat a, .arco-cat__img img, .product-card__media img { transition: none; }
	.arco-cat a:hover, .product-cards > li:hover .product-card__media img { transform: none; }
}

/* ================= product search: search box in the hero, helpful empty state ================= */
.shop-hero__search { width: min(560px, 100%); }
.shop-hero__search .wp-block-search__inside-wrapper { gap: 8px; padding: 0; border: 0; background: none; }
.shop-hero__search .wp-block-search__input { height: 50px; padding: 0 18px; border: 1px solid var(--hero-line); border-radius: var(--r-md); background: rgba(255, 255, 255, .06); color: #fff; font: inherit; }
.shop-hero__search .wp-block-search__input::placeholder { color: var(--hero-muted); }
.shop-hero__search .wp-block-search__input:focus { outline: none; border-color: var(--accent-on-dark); background: rgba(255, 255, 255, .1); }
.shop-hero__search .wp-block-search__button { height: 50px; margin: 0; padding: 0 22px; }
.shop-empty--search { gap: 18px; max-width: 760px; margin-inline: auto; }
.shop-empty--search > * { margin-block: 0 !important; }
.shop-empty--search p { color: var(--muted); max-width: 56ch; margin-inline: auto !important; }
.shop-empty__cats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.shop-empty__cats a {
	padding: 9px 16px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper); color: var(--head);
	font-size: .9375rem; font-weight: 500; text-decoration: none; transition: border-color .2s, color .2s, background .2s;
}
.shop-empty__cats a:hover { border-color: var(--accent); color: var(--accent); background: var(--mint); }
.shop-body:has(.shop-empty--search) .shop-toolbar { display: none; }
.shop-body:has(.shop-empty--search) .arco-brand-filter, .shop-body:has(.shop-empty--search) [class*="brand-filter"] { display: none; }
