/* Hansu Related Products: "You Might Also be Interested In"
   Design per the reference screenshots from QA (1.0.2): beige section, olive
   underline under the title, white product cards. */

.hrp,
.hrp-popup {
	--hrp-bg: #f4f1ea;                          /* section background */
	--hrp-padding: 32px;                        /* space inside the section */
	--hrp-card: #fff;                           /* product card */
	--hrp-card-padding: 16px;                   /* space inside each card */
	--hrp-card-width: 230px;
	--hrp-gap: 24px;                            /* between cards */
	--hrp-accent: #958e09;                      /* title underline: the theme's olive ("Sale!" badge) */
	--hrp-text: #000;
	--hrp-font-heading: Montserrat, sans-serif; /* the theme's heading font */
	--hrp-font-text: Poppins, sans-serif;       /* the theme's text font */
}

.hrp {
	clear: both;
	box-sizing: border-box;
	width: 100%;
	margin: 30px 0;
	padding: var(--hrp-padding);
	color: var(--hrp-text);
	font-family: var(--hrp-font-text);
	background: var(--hrp-bg);
}

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

/* Product page: same width as the product above and "Related products" below. */
.hrp.hrp--product {
	width: auto;
	max-width: min(1310px, calc(100% - 40px));
	margin: 40px auto;
}

/* Focused by script on the cart page after an add (not a control, so no ring).
   !important: the theme forces a focus ring on everything (:focus {... !important}). */
section.hrp h2.hrp__title:focus {
	outline: none !important;
}

section.hrp h2.hrp__title {
	margin: 0 0 24px;
	padding: 0;
	color: var(--hrp-text);
	font-family: var(--hrp-font-heading);
	font-size: 20px;
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: 0.4px;
	text-transform: uppercase;
}

/* Short olive underline. */
section.hrp h2.hrp__title::after {
	content: "";
	display: block;
	width: 44px;
	height: 3px;
	margin-top: 12px;
	background: var(--hrp-accent);
}

.hrp .hrp__list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--hrp-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.hrp .hrp__item {
	position: relative;
	display: flex;
	flex: 0 1 var(--hrp-card-width);
	flex-direction: column;
	align-items: center;
	min-width: 0;
	margin: 0;
	padding: var(--hrp-card-padding);
	text-align: center;
	background: var(--hrp-card);
}

.hrp .hrp__item::before {
	content: none;
}

.hrp .hrp__image {
	display: block;
	width: 100%;
	margin: 0 0 14px;
}

.hrp .hrp__image img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
	aspect-ratio: 1 / 1;
	object-fit: contain;
}

/* "Out of stock": over the image's top-left corner. */
.hrp .hrp__badge {
	position: absolute;
	top: calc(var(--hrp-card-padding) + 8px);
	left: calc(var(--hrp-card-padding) + 8px);
	z-index: 1;
	display: inline-block;
	margin: 0;
	padding: 4px 8px;
	color: #fff;
	font-family: var(--hrp-font-heading);
	font-size: 10px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0.5px;
	text-transform: uppercase;
	white-space: nowrap;
	background: #000;
}

.hrp .hrp__name {
	display: block;
	flex-grow: 1;
	margin: 0 0 14px;
	color: var(--hrp-text);
	font-family: var(--hrp-font-heading);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.35;
	letter-spacing: 0.3px;
	text-decoration: none;
	text-transform: uppercase;
}

.hrp .hrp__name:hover,
.hrp .hrp__name:focus {
	text-decoration: underline;
}

/* The button, and WooCommerce's "View cart" under it once added: same width. */
.hrp .hrp__action {
	display: inline-flex;
	flex-direction: column;
	align-items: stretch;
	gap: 8px;
}

.hrp .hrp__action .button {
	justify-content: center;
	margin: 0;
	white-space: nowrap;
}

/* Out of stock: outlined "View product". */
.hrp .hrp__action a.button.hrp__button--view {
	color: #000;
	background: #fff;
	border: 1px solid #000;
}

.hrp .hrp__action a.button.hrp__button--view:hover,
.hrp .hrp__action a.button.hrp__button--view:focus {
	color: #fff;
	background: #000;
}

/* "View cart" after an AJAX add: a black button centred under "Add to cart"
   (the theme makes it a small orange box pushed to the right). */
.hrp .hrp__action a.added_to_cart {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	float: none;
	width: auto;
	max-width: none;
	height: auto;
	min-height: 44px;
	margin: 0;
	padding: 10px 20px;
	color: #fff;
	font-family: var(--hrp-font-heading);
	font-size: 12px;
	font-weight: 400;
	line-height: 1.3;
	letter-spacing: 2px;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	background: #000;
	border: 0;
	border-radius: 0;
}

.hrp .hrp__action a.added_to_cart:hover,
.hrp .hrp__action a.added_to_cart:focus {
	color: #fff;
	background: #333;
}

/* Under the "added to your cart" notice. */
.hrp--added {
	margin: 0 0 30px;
}

/* "… has been added to your cart." after an add from the block: WooCommerce's
   own notice (the theme styles it), at the top of the block. */
.hrp .hrp__notice {
	margin: 0 0 24px;
}

.hrp .hrp__notice .woocommerce-message {
	margin: 0;
}

/* Mobile: one product per row, tight.
   [ image ] [ out of stock ]
   [ image ] [ name         ]
   [ image ] [ button       ] */
@media (max-width: 600px) {
	.hrp,
	.hrp-popup {
		--hrp-padding: 16px;
		--hrp-card-padding: 10px;
		--hrp-gap: 12px;
	}

	.hrp {
		margin: 20px 0;
	}

	.hrp.hrp--product {
		margin: 30px auto;
	}

	section.hrp h2.hrp__title {
		margin-bottom: 16px;
		font-size: 18px;
	}

	section.hrp h2.hrp__title::after {
		margin-top: 10px;
	}

	.hrp .hrp__list {
		flex-direction: column;
	}

	.hrp .hrp__item {
		display: grid;
		flex: 0 0 auto;
		grid-template-columns: 80px minmax(0, 1fr);
		grid-template-rows: auto auto auto;
		grid-template-areas:
			"image badge"
			"image name"
			"image action";
		column-gap: 12px;
		align-content: center;
		align-items: start;
		text-align: left;
	}

	.hrp .hrp__image {
		grid-area: image;
		align-self: center;
		margin: 0;
	}

	.hrp .hrp__badge {
		position: static;
		grid-area: badge;
		justify-self: start;
		margin: 0 0 6px;
	}

	.hrp .hrp__name {
		grid-area: name;
		margin: 0 0 8px;
		font-size: 13px;
	}

	.hrp .hrp__action {
		grid-area: action;
		justify-self: start;
	}

	/* The "added" notice: message on top, "View cart" under it (side by side the
	   text was squeezed into a narrow column). */
	.hrp .hrp__notice .woocommerce-message {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
	}

	/* !important: the theme sets height: 58px !important on this button. */
	.hrp .hrp__notice .woocommerce-message a.button.wc-forward {
		height: auto !important;
		margin-left: 0;
	}

	/* The theme gives shop buttons a fixed 58px height; keep these compact. */
	.hrp .hrp__notice .woocommerce-message a.button,
	.hrp .hrp__action a.button,
	.hrp .hrp__action a.added_to_cart {
		height: auto;
		min-height: 0;
		padding: 9px 14px;
		font-size: 11px;
		line-height: 1.3;
	}
}

/* Popup after an AJAX add to cart. */
body.hrp-popup-open {
	overflow: hidden;
}

.hrp-popup {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.hrp-popup__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
}

.hrp-popup .hrp-popup__dialog {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 760px;
	max-height: calc(100vh - 32px);
	overflow: auto;
	padding: 28px 24px 20px;
	color: var(--hrp-text);
	font-family: var(--hrp-font-text);
	background: #fff;
	border: 0;
	border-radius: 6px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* The dialog itself only takes focus so keyboard users start inside it.
   !important: the theme forces a focus ring on everything (:focus {... !important}). */
.hrp-popup .hrp-popup__dialog:focus,
.hrp-popup .hrp-popup__dialog:focus-visible {
	outline: none !important;
}

.hrp-popup .hrp-popup__close {
	position: absolute;
	top: 6px;
	right: 8px;
	margin: 0;
	padding: 4px 10px;
	color: #000;
	font-size: 28px;
	line-height: 1;
	background: none;
	border: 0;
	cursor: pointer;
}

.hrp-popup .hrp-popup__added {
	margin: 0 36px 0 0;
	color: var(--hrp-text);
	font-family: var(--hrp-font-text);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.4;
}

.hrp-popup .hrp {
	margin: 16px 0;
}

.hrp-popup .hrp-popup__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: center;
	justify-content: flex-end;
	margin: 0;
}

.hrp-popup .hrp-popup__continue {
	margin: 0;
	padding: 8px 4px;
	color: inherit;
	font: inherit;
	text-decoration: underline;
	background: none;
	border: 0;
	cursor: pointer;
}

@media (max-width: 600px) {
	.hrp-popup .hrp-popup__dialog {
		padding: 24px 14px 14px;
	}

	.hrp-popup .hrp-popup__actions {
		flex-wrap: nowrap;
		justify-content: space-between;
	}

	.hrp-popup .hrp-popup__actions a.button {
		height: auto;
		min-height: 0;
		padding: 12px 16px;
		line-height: 1.3;
	}
}

/* Cart page "added" notice (1.0.5, after QA): it has no "View cart" button, and
   the theme's justify-content: flex-end pushed the text to the right. Centred
   and bold, on PC and mobile. */
.hrp--cart .hrp__notice .woocommerce-message {
	justify-content: center;
	align-items: center;
	text-align: center;
	font-weight: 600;
}
