/* ==========================================================================
   Modern product card  (.gps-pc)
   Used on Shop / category / related grids and the homepage showcase.
   ========================================================================== */

/* Loop wrapper from woocommerce/content-product.php */
/* !important: WooCommerce's own column rules (width %, float, right margin)
   have higher specificity than we can reasonably match. */
.woocommerce ul.products li.gps-pc-item,
.woocommerce-page ul.products li.gps-pc-item {
	float: none !important;
	width: auto !important;
	margin: 0 !important;
	padding: 0;
	list-style: none;
	display: flex;
}
.woocommerce ul.products li.gps-pc-item > .gps-pc { width: 100%; }

/* ---------- Card ---------- */
.gps-pc {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #fff;
	border: 1px solid var(--line);
	border-radius: 20px;
	overflow: hidden;
	box-shadow: 0 1px 2px rgba(22, 19, 32, .04), 0 10px 28px -16px rgba(22, 19, 32, .18);
	transition: transform .3s cubic-bezier(.2, .7, .2, 1), box-shadow .3s ease, border-color .3s ease;
	container-type: inline-size;
}
.gps-pc:hover,
.gps-pc:focus-within {
	transform: translateY(-5px);
	border-color: color-mix(in srgb, var(--violet) 40%, var(--line));
	box-shadow: 0 2px 4px rgba(22, 19, 32, .05), 0 26px 44px -20px rgba(124, 58, 237, .4);
}

/* ---------- Media ---------- */
.gps-pc__media {
	position: relative;
	aspect-ratio: 4 / 3;
	background: color-mix(in srgb, var(--violet) 9%, var(--cream));
	overflow: hidden;
}
.gps-pc.accent-coral .gps-pc__media { background: color-mix(in srgb, var(--coral) 14%, var(--cream)); }
.gps-pc.accent-mint  .gps-pc__media { background: color-mix(in srgb, var(--mint)  18%, var(--cream)); }
.gps-pc.accent-gold  .gps-pc__media { background: color-mix(in srgb, var(--gold)  22%, var(--cream)); }

.gps-pc__media-link { display: block; position: absolute; inset: 0; }
.gps-pc__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	border: 0;
	border-radius: 0;
	transition: opacity .5s ease, transform .7s cubic-bezier(.2, .7, .2, 1);
}
.gps-pc__img--alt { opacity: 0; }

/* Gentle zoom when there is no second image to swap to */
.gps-pc:hover .gps-pc__media:not(.has-alt) .gps-pc__img--main { transform: scale(1.05); }

/* Swap: pinned by dot/swipe (.is-alt), or by hover on devices that have it */
.gps-pc__media.is-alt .gps-pc__img--alt { opacity: 1; }
.gps-pc__media.is-alt .gps-pc__img--main { opacity: 0; }
@media (hover: hover) {
	.gps-pc__media.has-alt:not(.is-pinned):hover .gps-pc__img--alt { opacity: 1; }
	.gps-pc__media.has-alt:not(.is-pinned):hover .gps-pc__img--main { opacity: 0; }
}

.gps-pc__placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-display);
	font-weight: 800;
	font-size: clamp(2.6rem, 6vw, 3.6rem);
	color: var(--ink);
	opacity: .28;
}

/* ---------- Badges ---------- */
.gps-pc__badges { position: absolute; top: 12px; left: 12px; z-index: 2; display: flex; gap: 6px; }
.gps-pc__badge {
	font-family: var(--font-display);
	font-weight: 800;
	font-size: .72rem;
	line-height: 1;
	letter-spacing: .04em;
	padding: 7px 11px;
	border-radius: 999px;
	color: #fff;
	background: var(--ink);
}
.gps-pc__badge--sale { background: var(--coral); color: var(--ink); }
.gps-pc__badge--out  { background: var(--grey); }

/* ---------- Image dots ---------- */
.gps-pc__dots {
	position: absolute;
	left: 50%;
	bottom: 12px;
	z-index: 2;
	transform: translateX(-50%);
	display: flex;
	gap: 8px;
	padding: 6px 10px;
	background: rgba(255, 255, 255, .85);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	border-radius: 999px;
	box-shadow: 0 2px 8px rgba(22, 19, 32, .12);
	transition: opacity .25s ease;
}
.gps-pc__dot {
	position: relative;
	width: 8px;
	height: 8px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(22, 19, 32, .25);
	cursor: pointer;
	transition: background .2s ease, transform .2s ease;
}
.gps-pc__dot::before { content: ""; position: absolute; inset: -10px -6px; } /* bigger tap target */
.gps-pc__dot[aria-pressed="true"] { background: var(--violet); transform: scale(1.2); }
.gps-pc__dot:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; }

@media (hover: hover) {
	.gps-pc__dots { opacity: 0; }
	.gps-pc:hover .gps-pc__dots,
	.gps-pc:focus-within .gps-pc__dots { opacity: 1; }
	/* keep the dots in step with the hover swap */
	.gps-pc__media:not(.is-pinned):hover .gps-pc__dot[data-view="main"] { background: rgba(22, 19, 32, .25); transform: none; }
	.gps-pc__media:not(.is-pinned):hover .gps-pc__dot[data-view="alt"]  { background: var(--violet); transform: scale(1.2); }
}

/* ---------- Body ---------- */
.gps-pc__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 6px;
	padding: 18px 18px 18px;
}
.gps-pc__cat {
	margin: 0;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: .7rem;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--violet);
}
.gps-pc__title,
.woocommerce ul.products li.product .gps-pc__title {
	margin: 0;
	padding: 0;
	font-family: var(--font-display);
	font-size: clamp(1rem, 1.5vw, 1.12rem);
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -.01em;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.gps-pc__title a { color: var(--ink); text-decoration: none; }
.gps-pc__title a:hover, .gps-pc__title a:focus-visible { color: var(--violet); }

.gps-pc__rating .star-rating { margin: 0; font-size: .8rem; color: var(--gold); float: none; }
.gps-pc__excerpt {
	margin: 0;
	font-size: .88rem;
	line-height: 1.5;
	color: var(--grey);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.gps-pc__price {
	margin: 4px 0 0;
	font-family: var(--font-display);
	font-weight: 800;
	font-size: 1.2rem;
	line-height: 1.2;
	color: var(--ink);
}
.gps-pc__price del { color: var(--grey); font-weight: 500; font-size: .88em; opacity: .75; margin-right: 6px; }
.gps-pc__price ins { text-decoration: none; background: none; color: var(--violet); }
.gps-pc__price .woocommerce-price-suffix { font-size: .7em; font-weight: 500; color: var(--grey); }

/* ---------- Actions: Add to Cart + Buy Now, side by side ---------- */
.gps-pc__actions {
	display: flex;
	gap: 8px;
	margin-top: auto;
	padding-top: 14px;
}
.gps-pc__btn {
	flex: 1 1 0;
	min-width: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 44px;
	padding: 0 12px;
	font-family: var(--font-display);
	font-weight: 700;
	font-size: .84rem;
	line-height: 1;
	white-space: nowrap;
	text-decoration: none;
	border: 2px solid var(--ink);
	border-radius: 999px;
	cursor: pointer;
	transition: transform .18s ease, box-shadow .18s ease, background .18s ease, color .18s ease, border-color .18s ease;
	-webkit-tap-highlight-color: transparent;
}
.gps-pc__btn svg { flex-shrink: 0; }
.gps-pc__btn:focus-visible { outline: 3px solid var(--violet-light); outline-offset: 2px; }

.gps-pc__btn--cart { background: transparent; color: var(--ink); }
.gps-pc__btn--cart:hover { background: var(--ink); color: var(--cream); }

.gps-pc__btn--buy { background: var(--violet); border-color: var(--violet); color: #fff; }
.gps-pc__btn--buy:hover { background: var(--coral); border-color: var(--coral); color: var(--ink); transform: translateY(-2px); box-shadow: 0 8px 16px -8px rgba(255, 107, 91, .7); }

.gps-pc__btn--full { background: var(--ink); color: var(--cream); }
.gps-pc__btn--full:hover { background: var(--coral); border-color: var(--coral); color: var(--ink); transform: translateY(-2px); }

.gps-pc__btn--disabled { background: var(--surface); border-color: var(--line); color: var(--grey); cursor: not-allowed; }

/* AJAX add-to-cart states (classes added by WooCommerce's script) */
.gps-pc__btn--cart.loading { opacity: .6; pointer-events: none; }
.gps-pc__btn--cart.added { background: var(--mint); border-color: var(--ink); color: var(--ink); }
.gps-pc__btn--cart.added span::after { content: " ✓"; }
.gps-pc .added_to_cart { display: none; } /* WooCommerce's "View cart" link would break the row */

/* Narrow cards: drop the icons so the labels never wrap */
@container (max-width: 285px) {
	.gps-pc__btn svg { display: none; }
	.gps-pc__btn { padding: 0 8px; font-size: .8rem; }
}

.gps-pc.is-soldout .gps-pc__img { filter: grayscale(.7); opacity: .8; }

/* ---------- Homepage / shortcode grid ---------- */
.gps-shop__grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.gps-shop__grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.gps-shop__grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.gps-shop__grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
	.gps-shop__grid.cols-3, .gps-shop__grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
	.gps-shop__grid.cols-2, .gps-shop__grid.cols-3, .gps-shop__grid.cols-4 { grid-template-columns: 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
	.gps-pc, .gps-pc__img, .gps-pc__btn, .gps-pc__dots, .gps-pc__dot { transition: none; }
	.gps-pc:hover, .gps-pc:focus-within { transform: none; }
	.gps-pc:hover .gps-pc__media:not(.has-alt) .gps-pc__img--main,
	.gps-pc__media.has-alt:not(.is-pinned):hover .gps-pc__img--alt { transform: none; }
}
