/*
 * Product card (Figma "Nettbutikk & Produktkatalog").
 *
 * Self-contained: it works in the shop archive, related/upsell lists,
 * [products] shortcodes and Elementor loop grids/carousels, with or without
 * the gg-modern-shop body class. body:not(#gg) lifts the specificity above
 * theme, WooCommerce and Elementor rules.
 */

body:not(#gg) .gg-card {
	--gc-ink-soft: #1b1c1a;
	--gc-muted: #6e6a64;
	--gc-gold: #d4af37;
	--gc-cream: #fbf9f5;
	--gc-stone: #efeeea;
	--gc-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	--gc-shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.08);

	box-sizing: border-box;
	margin: 0;
	color: var(--gc-ink-soft);
	font-family: Manrope, system-ui, -apple-system, 'Segoe UI', sans-serif;
	font-size: 13px;
	font-weight: 400;
	line-height: 20px;
	letter-spacing: normal;
	text-align: left;
	text-transform: none;
	list-style: none;

	*,
	*::before,
	*::after {
		box-sizing: border-box;
	}

	img {
		display: block;
		max-width: 100%;
		height: auto;
		margin: 0;
		border: 0;
		border-radius: 0;
		box-shadow: none;
	}

	p,
	h3 {
		margin: 0;
		padding: 0;
		letter-spacing: normal;
	}

	a {
		color: inherit;
		text-decoration: none;
		box-shadow: none;
	}

	svg {
		flex: none;
		stroke-width: 1.7;
	}

	.gg-stars {
		display: inline-flex;
		gap: 2px;
		line-height: 0;
	}

	.gg-stars svg {
		fill: none;
		stroke: none;
	}

	& {
		position: relative;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		min-width: 0;
		padding: 16px;
		border-radius: 8px;
		background: #fff;
		box-shadow: var(--gc-shadow);
		transition: box-shadow 0.2s ease, transform 0.2s ease;

		&:hover {
			box-shadow: var(--gc-shadow-lg);
			transform: translateY(-2px);
		}

		&.is-out .gg-card__media {
			opacity: 0.55;
		}
	}

	.gg-card__main {
		display: flex;
		flex-direction: column;
		gap: 4px;
		min-width: 0;
	}

	.gg-card__stage {
		position: relative;
		margin-bottom: 12px;
	}

	.gg-card__media {
		display: flex;
		align-items: center;
		justify-content: center;
		aspect-ratio: 1;
		padding: 12px;
		border-radius: 4px;
		background: var(--gc-cream);
		overflow: hidden;
	}

	.gg-card__media img,
	.gg-card__image {
		width: 100%;
		height: 100%;
		object-fit: contain;
		mix-blend-mode: multiply;
	}

	.gg-card__badge {
		position: absolute;
		top: 8px;
		left: 8px;
		z-index: 1;
		max-width: calc(100% - 52px);
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
		padding: 2px 8px;
		border-radius: 2px;
		background: #000;
		color: #fff;
		font-size: 10px;
		font-weight: 700;
		line-height: 14px;
		letter-spacing: 0.5px;
		text-transform: uppercase;

		&.gg-card__badge--sale {
			background: #ba1a1a;
		}

		&.gg-card__badge--muted {
			background: var(--gc-muted);
		}
	}

	.gg-card__wish {
		position: absolute;
		top: 8px;
		right: 8px;
		z-index: 2;
		display: flex;
		align-items: center;
		justify-content: center;
		width: 27px;
		height: 27px;
		border-radius: 12px;
		background: var(--gc-cream);
		color: var(--gc-muted);
		transition: color 0.15s ease, transform 0.15s ease;

		&:hover {
			color: #ba1a1a;
			transform: scale(1.08);
		}

		&.is-saved {
			color: #ba1a1a;
		}

		&.is-saved svg {
			fill: currentcolor;
		}
	}

	.gg-card__meta {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 12px;
		color: var(--gc-muted);
		font-size: 10px;
		font-weight: 700;
		line-height: 14px;
		letter-spacing: 0.5px;
		text-transform: uppercase;
	}

	.gg-card__brand {
		min-width: 0;
		overflow: hidden;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.gg-card__size {
		flex: none;
		white-space: nowrap;
	}

	.gg-card__title {
		margin: 0;
		color: var(--gc-ink-soft);
		font-family: 'Playfair Display', Georgia, serif;
		font-size: 18px;
		font-weight: 600;
		line-height: 25px;
		letter-spacing: normal;
		overflow-wrap: anywhere;

		a:hover {
			text-decoration: underline;
			text-underline-offset: 3px;
		}
	}

	.gg-card__excerpt {
		display: -webkit-box;
		overflow: hidden;
		color: var(--gc-muted);
		font-size: 13px;
		line-height: 20px;
		-webkit-line-clamp: 1;
		-webkit-box-orient: vertical;
	}

	.gg-card__rating {
		display: flex;
		align-items: center;
		gap: 4px;
		padding-top: 4px;
		font-size: 13px;
		line-height: 20px;

		strong {
			font-weight: 600;
		}

		span {
			color: var(--gc-muted);
		}
	}

	.gg-card__foot {
		display: flex;
		align-items: flex-end;
		justify-content: space-between;
		gap: 12px;
		padding-top: 16px;
	}

	.gg-card__price {
		display: flex;
		align-items: baseline;
		flex-wrap: wrap;
		gap: 0 8px;
		min-width: 0;

		strong {
			color: var(--gc-ink-soft);
			font-size: 18px;
			font-weight: 700;
			line-height: 26px;
			white-space: nowrap;
		}

		del {
			color: var(--gc-muted);
			font-size: 13px;
			line-height: 20px;
			white-space: nowrap;
		}

		.gg-card__tax {
			color: var(--gc-muted);
			font-size: 12px;
			font-weight: 400;
			line-height: 16px;
			white-space: nowrap;
		}
	}

	.gg-card__login {
		display: inline-flex;
		align-items: center;
		min-width: 0;
		max-width: calc(100% - 49px);
		color: var(--gc-ink-soft);
		font-size: 12px;
		font-weight: 600;
		line-height: 16px;
		letter-spacing: 0.4px;
		text-decoration: none;
		text-transform: uppercase;
		transition: color 0.15s ease;

		&:hover,
		&:focus-visible {
			color: var(--gc-gold);
		}
	}

	.gg-card__foot.is-retail {
		flex-direction: column;
		align-items: flex-start;
	}

	.gg-card__retail {
		color: var(--gc-ink-soft);
		font-size: 12px;
		font-weight: 600;
		line-height: 16px;
		letter-spacing: 0.2px;
		text-decoration: underline;
		text-underline-offset: 3px;

		&:hover,
		&:focus-visible {
			color: var(--gc-gold);
		}
	}

	.gg-card__from {
		width: 100%;
		color: var(--gc-muted);
		font-size: 10px;
		font-weight: 700;
		line-height: 12px;
		letter-spacing: 0.5px;
		text-transform: uppercase;
	}

	.gg-card__add {
		position: relative;
		display: flex;
		flex: none;
		align-items: center;
		justify-content: center;
		width: 37px;
		height: 37px;
		margin: 0;
		padding: 10px;
		border: 0;
		border-radius: 4px;
		background: var(--gc-stone);
		color: var(--gc-ink-soft);
		line-height: 1;
		transition: background-color 0.15s ease, color 0.15s ease;

		&:hover {
			background: #000;
			color: #fff;
		}

		&.loading {
			opacity: 0.6;
			pointer-events: none;
		}

		&.added {
			background: var(--gc-gold);
			color: #fff;
		}

		&::after {
			display: none;
		}
	}

	.added_to_cart {
		display: none;
	}
}

/* Lists produced by WooCommerce (related, upsells, [products], widgets) */

body:not(#gg) ul.products:has(> .gg-card) {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 24px;
	width: 100%;
	margin: 0 0 32px;
	padding: 0;
	list-style: none;
	float: none;

	&::before,
	&::after {
		display: none;
		content: none;
	}

	> .gg-card {
		float: none;
		width: auto;
		margin: 0;
	}

	@media (max-width: 1024px) {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	@media (max-width: 760px) {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 12px;
	}
}

/* Elementor loop item replaced by the card */

body:not(#gg) .gg-loop-card {
	display: flex;
	height: 100%;
	padding: 2px 0 6px;

	> .gg-card {
		flex: 1 1 auto;
		width: 100%;
	}
}

body:not(#gg) .gg-shop[data-view='list'] .gg-card__foot.is-retail {
	align-items: flex-end;
}

@media (max-width: 760px) {
	body:not(#gg) .gg-card {
		padding: 12px;

		.gg-card__title {
			font-size: 16px;
			line-height: 22px;
		}

		.gg-card__price strong {
			font-size: 16px;
			line-height: 24px;
		}
	}
}
