/* ==========================================================================
   Galleria De Rings: product card (reusable) + card grid
   Compact and light: a square photo on a navy #0B132A backdrop with soft
   corners (swipe or tap the dots for more photos; a small round "view"
   button shows on hover). Cut-out photos (PNG / WebP with a transparent
   background) sit whole in the middle of the navy; ordinary photos fill
   the square. Then a small coloured badge on the photo, then — centred by
   default — the category in gold, the name, the price with "% off" when on
   sale, and a slim outline "Get Best Price" WhatsApp button (from the
   Galleria Catalog plugin) that fills navy on hover.
   The grid can carry a small eyebrow line, a title and a "View all" button.
   Photos never zoom or move on hover.
   Colours: navy #0B132A, white, warm off-white #F7F5F1 (--g-cream), and
   small accents (champagne, gold, emerald, maroon, WhatsApp green).
   Markup: template-parts/product/card.php. PHP: inc/product-card.php.
   ========================================================================== */

/* ---------- Card ---------- */
.g-card {
	--g-card-radius: 14px;
	--g-card-champagne: #e9d8b4;
	--g-card-gold: #b8945a;
	--g-card-emerald: #1e6b57;
	--g-card-maroon: #8c2f39;
	--g-card-line: rgba(11, 19, 42, 0.18);

	/* Keeps absolutely positioned bits inside the card (e.g. WooCommerce's
	   hidden "Original price was" text), so a card inside a sideways slider
	   can never widen the page. */
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	height: 100%;
	color: var(--g-navy);
}

.g-card__media {
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: var(--g-card-radius);
	/* Navy backdrop, a touch lighter in the middle so the piece glows */
	background: radial-gradient(circle at 50% 45%, #1c2847 0%, #0b132a 70%);
	isolation: isolate;
}

/* Hairline edge drawn over the photo */
.g-card__media::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
	border: 1px solid rgba(11, 19, 42, 0.12);
	border-radius: inherit;
	pointer-events: none;
	transition: border-color 0.3s ease;
}

.g-card:hover .g-card__media::after {
	border-color: rgba(184, 148, 90, 0.6);
}

/* Photos side by side; swipe / scroll sideways, snapping one at a time */
.g-card__slides {
	display: flex;
	height: 100%;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.g-card__slides::-webkit-scrollbar {
	display: none;
}

.g-card__slide {
	flex: 0 0 100%;
	height: 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.g-card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Cut-out (transparent) photo: whole piece, centred, with breathing room */
.g-card__img--cutout {
	padding: 12%;
	object-fit: contain;
	filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.35));
}

/* No photo yet */
.g-card__slide--empty {
	display: grid;
	place-items: center;
	width: 100%;
	color: rgba(255, 255, 255, 0.3);
}

.g-card__slide--empty .icon {
	width: 30%;
	height: 30%;
	stroke-width: 0.8;
}

/* ---------- Badge (top-left, on the photo) ----------
   Colour follows the text: "Made to order" champagne, "New" emerald,
   "Sale" / "Bestseller" maroon, anything else white. */
.g-card__badge {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 2;
	padding: 4px 9px;
	border-radius: 999px;
	background: var(--g-white);
	color: var(--g-navy);
	font-family: var(--g-font-body);
	font-size: 10px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.g-card__badge--made-to-order {
	background: var(--g-card-champagne);
	color: var(--g-navy);
}

.g-card__badge--new {
	background: var(--g-card-emerald);
	color: var(--g-white);
}

.g-card__badge--sale,
.g-card__badge--bestseller {
	background: var(--g-card-maroon);
	color: var(--g-white);
}

/* ---------- Dots (bottom-centre) ---------- */
.g-card__dots {
	position: absolute;
	left: 50%;
	bottom: 8px;
	z-index: 2;
	display: flex;
	align-items: center;
	transform: translateX(-50%);
}

/* 18px tap area, small dot inside */
.g-card__dot {
	display: grid;
	place-items: center;
	width: 12px;
	height: 18px;
	padding: 0;
	border: 0;
	background: none;
	cursor: pointer;
}

.g-card__dot::before {
	content: "";
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: var(--g-white);
	opacity: 0.65;
	box-shadow: 0 0 2px rgba(11, 19, 42, 0.4);
	transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.g-card__dot.is-active::before {
	background: var(--g-card-gold);
	opacity: 1;
	transform: scale(1.25);
}

.g-card__dot:focus-visible {
	outline: 2px solid var(--g-white);
	outline-offset: -2px;
	border-radius: 4px;
}

/* ---------- View button (top-right, shows on hover) ---------- */
.g-card__view {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	display: grid;
	place-items: center;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--g-white);
	color: var(--g-navy);
	box-shadow: 0 2px 8px rgba(11, 19, 42, 0.12);
	opacity: 0;
	transition: opacity 0.25s ease, background-color 0.25s ease, color 0.25s ease;
}

.g-card__view .icon {
	width: 16px;
	height: 16px;
}

.g-card:hover .g-card__view,
.g-card:focus-within .g-card__view {
	opacity: 1;
}

.g-card__view:hover {
	background: var(--g-navy);
	color: var(--g-white);
}

/* Touch screens have no hover: keep it visible */
@media (hover: none) {
	.g-card__view {
		opacity: 1;
	}
}

/* ---------- Text ---------- */
.g-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding-top: 14px;
}

.g-card--center .g-card__body {
	align-items: center;
	text-align: center;
}

.g-card--center .g-card__price-row {
	justify-content: center;
}

.g-card__cat {
	margin: 0 0 4px;
	font-family: var(--g-font-body);
	font-size: 12px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--g-card-gold);
}

.g-card__title {
	max-width: 100%;
	margin: 0 0 6px;
	overflow: hidden;
	font-family: var(--g-font-heading);
	font-size: clamp(17px, 1.25vw, 19px);
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: 0;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: var(--g-navy);
}

.g-card__title a {
	color: inherit;
	text-decoration: none;
}

.g-card__title a:hover,
.g-card__title a:focus-visible {
	text-decoration: underline;
	text-decoration-color: var(--g-card-gold);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.g-card__price-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 8px;
	margin-bottom: 14px;
}

.g-card__price {
	font-family: var(--g-font-body);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--g-navy);
}

.g-card__price del {
	margin-right: 4px;
	font-weight: 400;
	color: rgba(11, 19, 42, 0.45);
}

.g-card__price ins {
	text-decoration: none;
}

.g-card__off {
	padding: 1px 7px;
	border-radius: 999px;
	background: rgba(140, 47, 57, 0.1);
	color: var(--g-card-maroon);
	font-family: var(--g-font-body);
	font-size: 11px;
	font-weight: 600;
	line-height: 1.5;
}

/* ---------- "Get Best Price" (plugin button, restyled for the card) ----------
   Slim outline pill; WhatsApp icon in its own green.
   Hover: a navy curtain sweeps in from the left (and out to the right when
   the pointer leaves), the text turns white, the WhatsApp icon gives a short
   "ring" and a small arrow slides in at the right edge. */
.g-card .gdr-wa-btn {
	--wa-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--wa-fill: var(--g-navy);
	--wa-on-fill: var(--g-white);

	position: relative;
	isolation: isolate;
	overflow: hidden;
	width: 100%;
	margin-top: auto;
	gap: 8px;
	padding: 10px 12px;
	border: 1px solid var(--g-card-line);
	background: transparent;
	color: var(--g-navy) !important;
	font-family: var(--g-font-body);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	box-shadow: none;
	transform: none;
	transition: color 0.3s var(--wa-ease) 0.05s, border-color 0.3s ease, box-shadow 0.35s ease;
}

/* The curtain: sweeps out to the right when the pointer leaves. */
.g-card .gdr-wa-btn::before {
	position: absolute;
	inset: 0;
	z-index: -1;
	border-radius: inherit;
	background: var(--wa-fill);
	content: "";
	transform: scaleX(0);
	transform-origin: right center;
	transition: transform 0.45s var(--wa-ease);
}

/* The arrow, waiting just left of its spot, invisible. */
.g-card .gdr-wa-btn::after {
	position: absolute;
	top: 50%;
	right: 16px;
	width: 7px;
	height: 7px;
	border-top: 1.5px solid currentColor;
	border-right: 1.5px solid currentColor;
	content: "";
	opacity: 0;
	transform: translate(-8px, -50%) rotate(45deg);
	transition: opacity 0.25s ease, transform 0.35s var(--wa-ease);
}

.g-card .gdr-wa-btn:hover,
.g-card .gdr-wa-btn:focus-visible {
	border-color: var(--wa-fill);
	background: transparent;
	color: var(--wa-on-fill) !important;
	box-shadow: 0 10px 22px -14px rgba(11, 19, 42, 0.6);
	transform: none;
}

/* Curtain sweeps in from the left. */
.g-card .gdr-wa-btn:hover::before,
.g-card .gdr-wa-btn:focus-visible::before {
	transform: scaleX(1);
	transform-origin: left center;
}

.g-card .gdr-wa-btn:hover::after,
.g-card .gdr-wa-btn:focus-visible::after {
	opacity: 1;
	transform: translate(0, -50%) rotate(45deg);
	transition-delay: 0.12s;
}

/* WhatsApp icon "rings" once. */
.g-card .gdr-wa-btn:hover .gdr-wa-btn__icon,
.g-card .gdr-wa-btn:focus-visible .gdr-wa-btn__icon {
	animation: g-wa-ring 0.6s var(--wa-ease) 0.1s;
}

@keyframes g-wa-ring {
	0%,
	100% { transform: rotate(0); }
	20% { transform: rotate(-16deg); }
	40% { transform: rotate(13deg); }
	60% { transform: rotate(-8deg); }
	80% { transform: rotate(4deg); }
}

.g-card .gdr-wa-btn:active::before {
	background: var(--g-navy-hover);
}

.g-card .gdr-wa-btn__icon {
	width: 17px;
	height: 17px;
}

/* ---------- Grid ---------- */
.g-card-grid {
	--g-card-cols: 4;
	--g-card-gap: clamp(12px, 1.8vw, 24px);
}

.g-card-grid__head {
	margin-bottom: clamp(18px, 2vw, 28px);
	text-align: center;
}

.g-card-grid__eyebrow {
	margin: 0 0 6px;
	font-family: var(--g-font-body);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	color: #b8945a;
}

.g-card-grid__title {
	margin: 0;
	font-family: var(--g-font-heading);
	font-size: clamp(28px, 3.2vw, 40px);
	font-weight: 400;
	line-height: 1.1;
	letter-spacing: -0.01em;
	text-align: center;
	color: var(--g-navy);
}

.g-card-grid__list {
	display: grid;
	grid-template-columns: repeat(var(--g-card-cols), minmax(0, 1fr));
	gap: clamp(24px, 2.6vw, 36px) var(--g-card-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.g-card-grid__item {
	min-width: 0;
	margin: 0;
}

/* "View all" button under the grid */
.g-card-grid__foot {
	display: flex;
	justify-content: center;
	margin-top: clamp(24px, 3vw, 40px);
}

.g-card-grid__all {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 22px 12px 28px;
	border: 1px solid var(--g-navy);
	border-radius: 999px;
	color: var(--g-navy);
	font-family: var(--g-font-body);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.25s ease, color 0.25s ease;
}

.g-card-grid__all .icon {
	width: 18px;
	height: 18px;
	transition: transform 0.25s ease;
}

.g-card-grid__all:hover,
.g-card-grid__all:focus-visible {
	background: var(--g-navy);
	color: var(--g-white);
}

.g-card-grid__all:hover .icon {
	transform: translateX(3px);
}

@media (max-width: 1024px) {
	.g-card-grid__list {
		grid-template-columns: repeat(min(var(--g-card-cols), 3), minmax(0, 1fr));
	}
}

@media (max-width: 760px) {
	.g-card-grid__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* ---------- Dark theme: for a navy #0B132A background ----------
   Used with galleria_product_grid( …, array( 'theme' => 'dark' ) ) or
   [galleria_products theme="dark"]; a single card can take the
   "g-card--dark" class. Text turns white / champagne, lines turn light. */
.g-card--dark {
	--g-card-line: rgba(255, 255, 255, 0.3);

	color: var(--g-white);
}

.g-card--dark .g-card__media {
	background: rgba(255, 255, 255, 0.06);
}

.g-card--dark .g-card__media::after {
	border-color: rgba(255, 255, 255, 0.1);
}

.g-card--dark:hover .g-card__media::after {
	border-color: rgba(233, 216, 180, 0.7);
}

.g-card--dark .g-card__cat {
	color: var(--g-card-champagne);
}

.g-card--dark .g-card__title {
	color: var(--g-white);
}

.g-card--dark .g-card__title a:hover,
.g-card--dark .g-card__title a:focus-visible {
	text-decoration-color: var(--g-card-champagne);
}

.g-card--dark .g-card__price {
	color: var(--g-white);
}

.g-card--dark .g-card__price del {
	color: rgba(255, 255, 255, 0.5);
}

.g-card--dark .g-card__off {
	background: var(--g-card-maroon);
	color: var(--g-white);
}

/* Badge that is navy on light cards stays readable on the photo; keep it */

.g-card--dark .gdr-wa-btn {
	--wa-fill: var(--g-white);
	--wa-on-fill: var(--g-navy);

	background: transparent;
	color: var(--g-white) !important;
}

.g-card--dark .gdr-wa-btn:hover,
.g-card--dark .gdr-wa-btn:focus-visible {
	box-shadow: 0 10px 22px -14px rgba(0, 0, 0, 0.7);
}

.g-card--dark .gdr-wa-btn:active::before {
	background: #e9ecf3;
}

.g-card--dark .g-card__dot:focus-visible,
.g-card--dark .gdr-wa-btn:focus-visible {
	outline-color: var(--g-card-champagne);
}

.g-card-grid--dark .g-card-grid__eyebrow {
	color: #e9d8b4;
}

.g-card-grid--dark .g-card-grid__title {
	color: var(--g-white);
}

.g-card-grid--dark .g-card-grid__all {
	border-color: rgba(255, 255, 255, 0.6);
	color: var(--g-white);
}

.g-card-grid--dark .g-card-grid__all:hover,
.g-card-grid--dark .g-card-grid__all:focus-visible {
	border-color: var(--g-white);
	background: var(--g-white);
	color: var(--g-navy);
}

/* ---------- Phones ---------- */
@media (max-width: 600px) {
	.g-card {
		--g-card-radius: 12px;
	}

	.g-card__badge {
		top: 6px;
		left: 6px;
		padding: 3px 7px;
		font-size: 8.5px;
	}

	.g-card__view {
		top: 6px;
		right: 6px;
		width: 28px;
		height: 28px;
	}

	.g-card__view .icon {
		width: 14px;
		height: 14px;
	}

	.g-card__body {
		padding-top: 10px;
	}

	.g-card__cat {
		margin-bottom: 2px;
		font-size: 11px;
	}

	.g-card__title {
		font-size: 15px;
	}

	.g-card__price {
		font-size: 13px;
	}

	.g-card__price-row {
		margin-bottom: 10px;
	}

	.g-card .gdr-wa-btn {
		gap: 5px;
		padding: 8px 4px;
		font-size: 10px;
	}

	/* Narrow buttons: no room for the arrow beside the text. */
	.g-card .gdr-wa-btn::after {
		display: none;
	}

	.g-card .gdr-wa-btn__icon {
		width: 14px;
		height: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.g-card__slides {
		scroll-behavior: auto;
	}

	.g-card__dot::before,
	.g-card__view,
	.g-card__media::after,
	.g-card .gdr-wa-btn,
	.g-card .gdr-wa-btn::before,
	.g-card .gdr-wa-btn::after,
	.g-card-grid__all,
	.g-card-grid__all .icon {
		transition: none;
	}

	.g-card .gdr-wa-btn:hover .gdr-wa-btn__icon,
	.g-card .gdr-wa-btn:focus-visible .gdr-wa-btn__icon {
		animation: none;
	}
}
