/* Shared horizontal split product card — used by the homepage products and
   water detectors sections via template-parts/product-card-horizontal.php */

.gd-home-product-card {
	--gd-hp-primary: var(--gd-primary, #E73F1E);
	--gd-hp-primary-hover: var(--gd-primary-hover, #D33618);
	--gd-hp-primary-active: var(--gd-primary-active, #B92D14);
	--gd-hp-secondary: var(--gd-secondary, #1F2A3A);
	--gd-hp-text-muted: var(--gd-text-muted, #556170);
	--gd-hp-card-bg: var(--gd-card, #FFFFFF);
	--gd-hp-border: var(--gd-border, #E8E8E8);
	--gd-hp-card-radius: 1.75rem;
	--gd-hp-split-image: 1.28fr;
	--gd-hp-split-info: 1fr;
}

/* ------------------------------------------------------------------ */
/* Card grid                                                          */
/* ------------------------------------------------------------------ */

.gd-home-products__grid,
.gd-home-water-detectors__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	align-items: stretch;
	gap: clamp(var(--space-md), 2vw, var(--space-xl));
	width: 100%;
}

/* ------------------------------------------------------------------ */
/* Horizontal split product card                                      */
/* ------------------------------------------------------------------ */

.gd-home-products .gd-home-product-card,
.gd-home-water-detectors .gd-home-product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	min-width: 0;
	overflow: hidden;
	border: 1px solid var(--gd-hp-border);
	border-radius: var(--gd-hp-card-radius);
	background: var(--gd-hp-card-bg);
	box-shadow:
		0 1px 3px rgba(var(--gd-secondary-rgb), 0.04),
		0 8px 24px rgba(var(--gd-secondary-rgb), 0.07);
	transition:
		border-color var(--transition-base),
		box-shadow var(--transition-base),
		transform var(--transition-base);
}

.gd-home-products .gd-home-product-card::before,
.gd-home-water-detectors .gd-home-product-card::before {
	content: '';
	position: absolute;
	inset-block-start: 0;
	inset-inline: 0;
	z-index: 2;
	height: 3px;
	background: var(--gd-hp-primary);
}

.gd-home-products .gd-home-product-card__split,
.gd-home-water-detectors .gd-home-product-card__split {
	display: grid;
	grid-template-columns: var(--gd-hp-split-image) var(--gd-hp-split-info);
	align-items: stretch;
	flex: 1 1 auto;
	min-height: 100%;
	min-width: 0;
}

.gd-home-products .gd-home-product-card__media,
.gd-home-water-detectors .gd-home-product-card__media {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	justify-content: stretch;
	min-width: 0;
	min-height: clamp(22.5rem, 24vw, 26.25rem);
	padding: 0;
	overflow: hidden;
	border: 0;
	text-decoration: none;
	border-start-start-radius: var(--gd-hp-card-radius);
	border-end-start-radius: var(--gd-hp-card-radius);
}

.gd-home-products .gd-home-product-card__media-inner,
.gd-home-water-detectors .gd-home-product-card__media-inner {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	min-width: 0;
	min-height: 100%;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	overflow: hidden;
}

.gd-home-products .gd-home-product-card__media:focus-visible,
.gd-home-water-detectors .gd-home-product-card__media:focus-visible {
	outline: 2px solid var(--gd-hp-primary);
	outline-offset: -2px;
	border-radius: 0;
	border-start-start-radius: var(--gd-hp-card-radius);
	border-end-start-radius: var(--gd-hp-card-radius);
}

.gd-home-products .gd-home-product-card__image,
.gd-home-water-detectors .gd-home-product-card__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	max-height: none;
	object-fit: contain;
	object-position: center center;
}

.gd-home-products .gd-home-product-card__info,
.gd-home-water-detectors .gd-home-product-card__info {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	min-width: 0;
	padding: clamp(1rem, 1.8vw, 1.375rem);
}

.gd-home-products .gd-home-product-card__title,
.gd-home-water-detectors .gd-home-product-card__title {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.35;
	color: var(--gd-hp-secondary);
}

.gd-home-products .gd-home-product-card__title a,
.gd-home-water-detectors .gd-home-product-card__title a {
	display: -webkit-box;
	overflow: hidden;
	color: inherit;
	text-decoration: none;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	transition: color var(--transition-fast);
}

.gd-home-products .gd-home-product-card__title a:hover,
.gd-home-products .gd-home-product-card__title a:focus-visible,
.gd-home-water-detectors .gd-home-product-card__title a:hover,
.gd-home-water-detectors .gd-home-product-card__title a:focus-visible {
	color: var(--gd-hp-primary);
	outline: none;
}

.gd-home-products .gd-home-product-card__price,
.gd-home-water-detectors .gd-home-product-card__price {
	color: var(--gd-hp-primary);
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1.25;
}

.gd-home-products .gd-home-product-card__price .amount,
.gd-home-products .gd-home-product-card__price bdi,
.gd-home-products .gd-home-product-card__price ins,
.gd-home-water-detectors .gd-home-product-card__price .amount,
.gd-home-water-detectors .gd-home-product-card__price bdi,
.gd-home-water-detectors .gd-home-product-card__price ins {
	color: inherit;
	font-size: inherit;
	font-weight: inherit;
	text-decoration: none;
}

.gd-home-products .gd-home-product-card__price del,
.gd-home-water-detectors .gd-home-product-card__price del {
	margin-inline-end: 0.35rem;
	/* Absolute, not relative to the price, so the current price stays dominant. */
	font-size: 1rem;
	font-weight: var(--font-weight-normal);
	color: var(--gd-hp-text-muted);
	opacity: 1;
}

.gd-home-products .gd-home-product-card__price del .amount,
.gd-home-products .gd-home-product-card__price del bdi,
.gd-home-water-detectors .gd-home-product-card__price del .amount,
.gd-home-water-detectors .gd-home-product-card__price del bdi {
	color: inherit;
	font-size: inherit;
	font-weight: inherit;
}

.gd-home-products .gd-home-product-card__divider,
.gd-home-water-detectors .gd-home-product-card__divider {
	flex-shrink: 0;
	height: 1px;
	margin: 0;
	border: 0;
	background: var(--gd-hp-border);
}

.gd-home-products .gd-home-product-card__attrs,
.gd-home-water-detectors .gd-home-product-card__attrs {
	display: flex;
	flex-direction: column;
	gap: 0;
	margin: 0;
}

.gd-home-products .gd-home-product-card__attr,
.gd-home-water-detectors .gd-home-product-card__attr {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin: 0;
	padding: 0.5rem 0.625rem;
	border-radius: 0.5rem;
}

.gd-home-products .gd-home-product-card__attr:nth-child(odd),
.gd-home-water-detectors .gd-home-product-card__attr:nth-child(odd) {
	background: rgba(var(--gd-secondary-rgb), 0.03);
}

.gd-home-products .gd-home-product-card__attr-label,
.gd-home-products .gd-home-product-card__attr-value,
.gd-home-water-detectors .gd-home-product-card__attr-label,
.gd-home-water-detectors .gd-home-product-card__attr-value {
	margin: 0;
	min-width: 0;
	font-size: 1rem;
	line-height: 1.45;
}

.gd-home-products .gd-home-product-card__attr-label,
.gd-home-water-detectors .gd-home-product-card__attr-label {
	display: inline-flex;
	align-items: center;
	gap: 0.625rem;
	flex: 0 1 auto;
	min-width: 0;
	color: var(--gd-hp-secondary);
	font-weight: 600;
}

.gd-home-products .gd-home-product-card__attr-name,
.gd-home-water-detectors .gd-home-product-card__attr-name {
	min-width: 0;
}

.gd-home-products .gd-home-product-card__attr-icon,
.gd-home-water-detectors .gd-home-product-card__attr-icon {
	flex: 0 0 auto;
	display: inline-grid;
	place-items: center;
	inline-size: 2.25rem;
	block-size: 2.25rem;
	border-radius: 50%;
	border: 1px solid rgba(var(--gd-primary-rgb), 0.18);
	background: rgba(var(--gd-primary-rgb), 0.08);
	color: var(--gd-hp-primary);
}

.gd-home-products .gd-home-product-card__attr-icon-svg,
.gd-home-water-detectors .gd-home-product-card__attr-icon-svg {
	inline-size: 1.125rem;
	block-size: 1.125rem;
}

.gd-home-products .gd-home-product-card__attr-value,
.gd-home-water-detectors .gd-home-product-card__attr-value {
	flex: 0 1 52%;
	color: var(--gd-hp-primary);
	font-weight: 700;
	text-align: end;
	min-width: 0;
	overflow-wrap: anywhere;
}

.gd-home-products .gd-home-product-card__action,
.gd-home-water-detectors .gd-home-product-card__action {
	margin-block-start: auto;
	padding-block-start: 0.25rem;
}

.gd-home-products .gd-home-product-card__button,
.gd-home-products .gd-home-product-card__action .button,
.gd-home-products .gd-home-product-card__action .added_to_cart,
.gd-home-water-detectors .gd-home-product-card__button,
.gd-home-water-detectors .gd-home-product-card__action .button,
.gd-home-water-detectors .gd-home-product-card__action .added_to_cart {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	min-height: 3rem;
	margin: 0;
	padding: 0.75rem 1rem;
	border: 0;
	border-radius: 0.8125rem;
	background: var(--gd-hp-primary);
	color: #ffffff;
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	box-shadow: 0 3px 12px rgba(var(--gd-primary-rgb), 0.22);
	transition:
		background var(--transition-fast),
		box-shadow var(--transition-fast),
		transform var(--transition-fast);
}

.gd-home-products .gd-home-product-card__button::before,
.gd-home-products .gd-home-product-card__action .button::before,
.gd-home-products .gd-home-product-card__action .added_to_cart::before,
.gd-home-water-detectors .gd-home-product-card__button::before,
.gd-home-water-detectors .gd-home-product-card__action .button::before,
.gd-home-water-detectors .gd-home-product-card__action .added_to_cart::before {
	content: '';
	flex-shrink: 0;
	width: 1.125rem;
	height: 1.125rem;
	background-color: currentColor;
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E");
	mask-repeat: no-repeat;
	mask-position: center;
	mask-size: contain;
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='21' r='1'/%3E%3Ccircle cx='20' cy='21' r='1'/%3E%3Cpath d='M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6'/%3E%3C/svg%3E");
	-webkit-mask-repeat: no-repeat;
	-webkit-mask-position: center;
	-webkit-mask-size: contain;
}

.gd-home-products .gd-home-product-card__button:hover,
.gd-home-products .gd-home-product-card__action .button:hover,
.gd-home-products .gd-home-product-card__button:focus-visible,
.gd-home-products .gd-home-product-card__action .button:focus-visible,
.gd-home-products .gd-home-product-card__action .added_to_cart:hover,
.gd-home-products .gd-home-product-card__action .added_to_cart:focus-visible,
.gd-home-water-detectors .gd-home-product-card__button:hover,
.gd-home-water-detectors .gd-home-product-card__action .button:hover,
.gd-home-water-detectors .gd-home-product-card__button:focus-visible,
.gd-home-water-detectors .gd-home-product-card__action .button:focus-visible,
.gd-home-water-detectors .gd-home-product-card__action .added_to_cart:hover,
.gd-home-water-detectors .gd-home-product-card__action .added_to_cart:focus-visible {
	background: var(--gd-hp-primary-hover);
	color: #ffffff;
	box-shadow: 0 5px 16px rgba(var(--gd-primary-rgb), 0.28);
}

.gd-home-products .gd-home-product-card__button:active,
.gd-home-products .gd-home-product-card__action .button:active,
.gd-home-water-detectors .gd-home-product-card__button:active,
.gd-home-water-detectors .gd-home-product-card__action .button:active {
	background: var(--gd-hp-primary-active);
}

@media (prefers-reduced-motion: no-preference) {
	.gd-home-products .gd-home-product-card:hover,
	.gd-home-water-detectors .gd-home-product-card:hover {
		border-color: rgba(var(--gd-primary-rgb), 0.28);
		box-shadow:
			0 2px 6px rgba(var(--gd-secondary-rgb), 0.06),
			0 14px 32px rgba(var(--gd-secondary-rgb), 0.11);
		transform: translateY(-4px);
	}

	.gd-home-products .gd-home-product-card:hover::before,
	.gd-home-water-detectors .gd-home-product-card:hover::before {
		height: 4px;
	}

	.gd-home-products .gd-home-product-card__button:hover,
	.gd-home-products .gd-home-product-card__action .button:hover,
	.gd-home-products .gd-home-product-card__action .added_to_cart:hover,
	.gd-home-water-detectors .gd-home-product-card__button:hover,
	.gd-home-water-detectors .gd-home-product-card__action .button:hover,
	.gd-home-water-detectors .gd-home-product-card__action .added_to_cart:hover {
		transform: translateY(-1px);
	}
}

@media (max-width: 1023px) {
	.gd-home-products__grid,
	.gd-home-water-detectors__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.gd-home-products .gd-home-product-card__media,
	.gd-home-water-detectors .gd-home-product-card__media {
		min-height: clamp(20rem, 42vw, 22.5rem);
	}

	.gd-home-products .gd-home-product-card__title,
	.gd-home-water-detectors .gd-home-product-card__title {
		font-size: 1.375rem;
	}

	.gd-home-products .gd-home-product-card__price,
	.gd-home-water-detectors .gd-home-product-card__price {
		font-size: 1.375rem;
	}

	.gd-home-products .gd-home-product-card__price del,
	.gd-home-water-detectors .gd-home-product-card__price del {
		font-size: 0.9375rem;
	}

	.gd-home-products .gd-home-product-card__button,
	.gd-home-products .gd-home-product-card__action .button,
	.gd-home-products .gd-home-product-card__action .added_to_cart,
	.gd-home-water-detectors .gd-home-product-card__button,
	.gd-home-water-detectors .gd-home-product-card__action .button,
	.gd-home-water-detectors .gd-home-product-card__action .added_to_cart {
		font-size: 1rem;
	}
}

@media (max-width: 767px) {
	.gd-home-products .gd-home-product-card__split,
	.gd-home-water-detectors .gd-home-product-card__split {
		grid-template-columns: minmax(0, 1fr);
	}

	.gd-home-products .gd-home-product-card__media,
	.gd-home-water-detectors .gd-home-product-card__media {
		width: 100%;
		min-height: clamp(17.5rem, 72vw, 21.25rem);
		padding: 0;
		border: 0;
		border-start-start-radius: var(--gd-hp-card-radius);
		border-start-end-radius: var(--gd-hp-card-radius);
		border-end-start-radius: 0;
		border-end-end-radius: 0;
	}

	.gd-home-products .gd-home-product-card__media-inner,
	.gd-home-water-detectors .gd-home-product-card__media-inner {
		width: 100%;
		min-height: clamp(17.5rem, 72vw, 21.25rem);
	}

	.gd-home-products .gd-home-product-card__media:focus-visible,
	.gd-home-water-detectors .gd-home-product-card__media:focus-visible {
		border-start-start-radius: var(--gd-hp-card-radius);
		border-start-end-radius: var(--gd-hp-card-radius);
		border-end-start-radius: 0;
		border-end-end-radius: 0;
	}

	.gd-home-products .gd-home-product-card__info,
	.gd-home-water-detectors .gd-home-product-card__info {
		padding-block-start: 0.25rem;
	}

	.gd-home-products .gd-home-product-card__title,
	.gd-home-water-detectors .gd-home-product-card__title {
		font-size: 1.3125rem;
	}

	.gd-home-products .gd-home-product-card__price,
	.gd-home-water-detectors .gd-home-product-card__price {
		font-size: 1.3125rem;
	}

	/* The percentage basis reserves more room than the short values need, which
	   pushes the longer labels onto a second line at this text size. */
	.gd-home-products .gd-home-product-card__attr-value,
	.gd-home-water-detectors .gd-home-product-card__attr-value {
		flex-basis: auto;
	}
}

@media (max-width: 640px) {
	.gd-home-products .gd-home-product-card__info,
	.gd-home-water-detectors .gd-home-product-card__info {
		padding: 1rem;
		gap: 0.625rem;
	}

	.gd-home-products .gd-home-product-card__attr,
	.gd-home-water-detectors .gd-home-product-card__attr {
		padding-inline: 0.5rem;
	}

	.gd-home-products .gd-home-product-card__attr-icon,
	.gd-home-water-detectors .gd-home-product-card__attr-icon {
		inline-size: 2rem;
		block-size: 2rem;
	}

	.gd-home-products .gd-home-product-card__attr-icon-svg,
	.gd-home-water-detectors .gd-home-product-card__attr-icon-svg {
		inline-size: 1rem;
		block-size: 1rem;
	}

	.gd-home-products .gd-home-product-card__button,
	.gd-home-products .gd-home-product-card__action .button,
	.gd-home-products .gd-home-product-card__action .added_to_cart,
	.gd-home-water-detectors .gd-home-product-card__button,
	.gd-home-water-detectors .gd-home-product-card__action .button,
	.gd-home-water-detectors .gd-home-product-card__action .added_to_cart {
		min-height: 2.875rem;
		border-radius: 0.75rem;
	}
}
