/* ==========================================================================
   Product cards, grids and rails
   Every card image is the same 4:5 box, so the ADD button sits in the same
   corner on every card. Visual order: price pill, title, meta line
   (DOM order keeps the title first for screen readers).
   ========================================================================== */

body.xx ul.products.xx-grid,
body.xx .xx-rail__track {
	list-style: none;
	margin: 0;
	padding: 0;
}
body.xx ul.products.xx-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 16px;
}
body.xx ul.products.xx-grid::before,
body.xx ul.products.xx-grid::after { display: none; }
@media (max-width: 1099px) { body.xx ul.products.xx-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 749px) { body.xx ul.products.xx-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }

/* ---------- Card ---------- */
/* WooCommerce and Konte size li.product with widths, floats and margins; the grid/rail does that now. */
body.xx ul.products li.product.xx-card,
body.xx .woocommerce ul.products li.product.xx-card {
	width: auto !important;
	float: none !important;
	margin: 0 !important;
	clear: none !important;
	padding: 6px 6px 12px !important;
}
body.xx ul.products.xx-grid,
body.xx ul.products.xx-rail__track { margin-left: 0 !important; margin-right: 0 !important; }
@media (max-width: 749px) {
	body.xx ul.products li.product.xx-card { padding: 4px 4px 10px !important; }
	body.xx ul.products.xx-rail__track { margin-left: calc(var(--xx-gutter) * -1) !important; margin-right: calc(var(--xx-gutter) * -1) !important; }
}
body.xx .xx-card {
	position: relative;
	display: flex;
	flex-direction: column;
	width: auto;
	margin: 0;
	padding: 6px 6px 12px;
	float: none;
	border: 1px solid var(--xx-line);
	border-radius: var(--xx-r-card);
	background: #fff;
	transition: transform .25s var(--xx-ease), box-shadow .25s ease, border-color .25s ease;
	text-align: left;
	box-sizing: border-box;
}
body.xx .xx-card:hover { transform: translateY(-3px); box-shadow: var(--xx-shadow-md); border-color: transparent; }
@media (prefers-reduced-motion: reduce) { body.xx .xx-card:hover { transform: none; } }

.xx-card__media { position: relative; }
.xx-card__img {
	display: block;
	aspect-ratio: 4 / 5;
	border-radius: var(--xx-r-media);
	overflow: hidden;
	background: var(--xx-soft);
}
body.xx .xx-card__img img,
body.xx .xx-card__photo { width: 100%; height: 100%; object-fit: cover; display: block; margin: 0; transition: transform .6s var(--xx-ease); }
body.xx .xx-card:hover .xx-card__photo { transform: scale(1.04); }

.xx-card__body { display: flex; flex-direction: column; gap: 6px; padding: 10px 6px 0; }
body.xx .xx-card__title {
	order: 2;
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: calc(1.35em * 2);
}
body.xx .xx-card__link { color: var(--xx-ink); text-decoration: none; }
/* Whole card is clickable: the title link stretches over the card. Controls sit above it. */
body.xx .xx-card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: var(--xx-r-card); }
body.xx .xx-card__link:focus-visible { outline: none; }
body.xx .xx-card__link:focus-visible::after { outline: 2px solid var(--xx-ink); outline-offset: 2px; }
.xx-card__price { order: 1; display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0; font-size: 13px; }
.xx-card__meta { order: 3; margin: 0; font-size: 12.5px; color: var(--xx-muted); line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Price pill */
.xx-price-pill {
	display: inline-flex;
	align-items: center;
	padding: 3px 9px;
	border-radius: 7px;
	background: var(--xx-price);
	color: #fff;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: 0;
}
.xx-price-pill .woocommerce-Price-amount, .xx-price-pill bdi { color: inherit; }
.xx-price-was { color: var(--xx-muted); font-size: 13px; }
.xx-price-off { color: var(--xx-success); font-weight: 700; font-size: 12px; }

/* Badges */
.xx-card__badges { position: absolute; top: 8px; left: 8px; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none; }
.xx-badge {
	display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 6px;
	background: #fff; color: var(--xx-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
	font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 1.4;
}
.xx-badge--accent { background: var(--xx-accent); color: #fff; }
.xx-badge--muted { background: var(--xx-ink); color: #fff; }

/* Wishlist heart (WCBoost button restyled) */
.xx-card__wish { position: absolute; top: 8px; right: 8px; z-index: 2; }
body.xx .xx-card__wish a,
body.xx .xx-card__wish .wcboost-wishlist-button {
	width: 36px; height: 36px; padding: 0; margin: 0; border: 0; border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: rgba(255, 255, 255, .92); color: var(--xx-ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .12);
	font-size: 0; line-height: 0; text-decoration: none; min-height: 0;
}
body.xx .xx-card__wish a:hover { color: var(--xx-accent); }
body.xx .xx-card__wish .wcboost-wishlist-button__text { display: none; }
body.xx .xx-card__wish .wcboost-wishlist-button__icon,
body.xx .xx-card__wish svg { width: 18px; height: 18px; margin: 0; }
body.xx .xx-card__wish .wcboost-wishlist-button--added { color: var(--xx-accent); }

/* ADD button and stepper (bottom-right of the photo) */
.xx-card__action { position: absolute; right: 8px; bottom: 8px; z-index: 2; }
body.xx .xx-card__media > .xx-add { position: absolute; right: 8px; bottom: 8px; z-index: 2; }
body.xx .xx-add,
body.xx button.xx-add {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 64px; height: 36px; padding: 0 14px; margin: 0;
	border: 1.5px solid var(--xx-accent); border-radius: 9px;
	background: #fff; color: var(--xx-accent);
	font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; text-decoration: none;
	box-shadow: 0 2px 8px rgba(22, 22, 25, .14);
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease, transform .15s ease;
}
body.xx .xx-add:hover { background: var(--xx-accent); color: #fff; }
body.xx .xx-add:active { transform: scale(.96); }
body.xx .xx-add.is-loading { pointer-events: none; color: transparent; position: relative; }
body.xx .xx-add.is-loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid var(--xx-accent); border-right-color: transparent; border-radius: 50%; animation: xx-spin .7s linear infinite; }
body.xx .xx-add.is-disabled { border-color: var(--xx-line); color: var(--xx-muted); box-shadow: none; cursor: default; position: absolute; right: 8px; bottom: 8px; z-index: 2; background: rgba(255, 255, 255, .95); }
body.xx .xx-add.is-disabled:hover { background: rgba(255, 255, 255, .95); color: var(--xx-muted); }
@keyframes xx-spin { to { transform: rotate(360deg); } }

.xx-stepper {
	display: inline-flex; align-items: center;
	height: 36px; border-radius: 9px; overflow: hidden;
	background: var(--xx-accent); color: #fff; box-shadow: 0 2px 8px rgba(22, 22, 25, .14);
}
body.xx .xx-stepper__btn {
	width: 32px; height: 36px; padding: 0; margin: 0; border: 0; border-radius: 0;
	display: flex; align-items: center; justify-content: center;
	background: transparent; color: inherit; cursor: pointer;
}
body.xx .xx-stepper__btn:hover { background: rgba(0, 0, 0, .14); }
.xx-stepper__qty { min-width: 20px; text-align: center; font-weight: 800; font-size: 14px; }
.xx-stepper.is-busy { opacity: .7; pointer-events: none; }

@media (max-width: 749px) {
	body.xx .xx-card { padding: 4px 4px 10px; }
	.xx-card__body { padding: 8px 4px 0; }
	body.xx .xx-card__title { font-size: 13px; }
	.xx-price-pill { font-size: 13px; }
	body.xx .xx-add { min-width: 54px; height: 32px; padding: 0 10px; font-size: 12px; }
	.xx-stepper { height: 32px; }
	body.xx .xx-stepper__btn { width: 28px; height: 32px; }
	body.xx .xx-card__wish a { width: 32px; height: 32px; }
}

/* ---------- Rail (horizontal scroller) ---------- */
.xx-rail { position: relative; }
body.xx .xx-rail__track {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: calc((100% - 16px * 5) / 6);
	gap: 16px;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-padding: 0 2px;
	padding: 4px 2px 14px;
	scrollbar-width: none;
	overscroll-behavior-x: contain;
}
body.xx .xx-rail__track::-webkit-scrollbar { display: none; }
body.xx .xx-rail__track > li { scroll-snap-align: start; }
@media (max-width: 1199px) { body.xx .xx-rail__track { grid-auto-columns: calc((100% - 16px * 3) / 4); } }
@media (max-width: 749px) {
	body.xx .xx-rail__track { grid-auto-columns: 46%; gap: 10px; margin: 0 calc(var(--xx-gutter) * -1); padding-left: var(--xx-gutter); padding-right: var(--xx-gutter); scroll-padding: 0 var(--xx-gutter); }
}
body.xx .xx-rail__arrow {
	position: absolute; top: 38%; z-index: 3;
	width: 44px; height: 44px; padding: 0; border: 1px solid var(--xx-line); border-radius: 50%;
	display: flex; align-items: center; justify-content: center;
	background: #fff; color: var(--xx-ink); box-shadow: var(--xx-shadow-md); cursor: pointer;
}
body.xx .xx-rail__arrow:hover { background: var(--xx-ink); color: #fff; }
.xx-rail__arrow--prev { left: -18px; }
.xx-rail__arrow--next { right: -18px; }
body.xx .xx-rail__arrow[hidden] { display: none; }
@media (max-width: 989px) { body.xx .xx-rail__arrow { display: none; } }

.xx-rail__all { display: flex; }
body.xx .xx-rail__all a {
	flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
	min-height: 100%; padding: 16px; border: 1.5px dashed var(--xx-line); border-radius: var(--xx-r-card);
	background: var(--xx-soft); color: var(--xx-ink); font-weight: 700; font-size: 15px; text-align: center; text-decoration: none;
}
body.xx .xx-rail__all a:hover { border-color: var(--xx-ink); }
.xx-rail__all-icon { width: 48px; height: 48px; border-radius: 50%; background: var(--xx-ink); color: #fff; display: flex; align-items: center; justify-content: center; }
