/**
 * Haramain Pure - extras (2026-11-10), loaded on every page with hp-extras.js:
 * page fade, WhatsApp button, "added to cart" confirmation, sticky add to cart
 * on phones, scroll reveal, image placeholders, floating specks, reorder.
 *
 * Everything that moves sits behind prefers-reduced-motion, and nothing is
 * hidden unless hp-extras.js is running (it adds the .hp-rv and .hp-ph classes).
 */

/* --------------------------------------------------------------------------
   Page-to-page fade. Browsers without view transitions simply navigate.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
	@view-transition { navigation: auto; }
	::view-transition-old(root),
	::view-transition-new(root) { animation-duration: .22s; }
}

/* --------------------------------------------------------------------------
   WhatsApp button (functions.php: haramain_whatsapp_button)
   -------------------------------------------------------------------------- */
.hp-wa {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 349;   /* under the side cart, mobile menu and popups */
	display: inline-flex;
	align-items: center;
	gap: 9px;
	height: 52px;
	padding: 0 20px 0 15px;
	border-radius: 999px;
	background: #25D366;   /* WhatsApp's green */
	color: #06301C !important;   /* white on this green is too faint to read */
	font: 700 14.5px/1 "Inter", "Segoe UI", Arial, sans-serif;
	text-decoration: none !important;
	box-shadow: 0 10px 26px rgba(18, 140, 66, .42);
	transition: transform .2s ease, box-shadow .2s ease, bottom .25s ease;
}
.hp-wa svg { flex: none; color: #fff; }
.hp-wa:hover { transform: translateY(-2px); box-shadow: 0 14px 30px rgba(18, 140, 66, .5); }
/* a ring that spreads and fades every few seconds */
.hp-wa::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: inherit;
	box-shadow: 0 0 0 0 rgba(37, 211, 102, .55);
	pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
	.hp-wa::after { animation: hp-wa-ring 3.2s ease-out infinite; }
}
@keyframes hp-wa-ring {
	0%        { box-shadow: 0 0 0 0 rgba(37, 211, 102, .55); }
	45%, 100% { box-shadow: 0 0 0 16px rgba(37, 211, 102, 0); }
}
.hp-wa:focus-visible { outline: 3px solid #E2B54C; outline-offset: 3px; }
/* the back-to-top disc sits above it instead of under it */
.scrollToTop { bottom: 84px !important; right: 20px !important; }   /* 20px lines it up with the pill's edge, and centres it over the 52px circle on phones */
@media (max-width: 768px) {
	.hp-wa { right: 14px; bottom: 14px; width: 52px; padding: 0; justify-content: center; }
	.hp-wa span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
	.scrollToTop { bottom: 76px !important; }
	/* product pages: clear of the sticky add-to-cart bar while it is showing */
	body:has(.wd-sticky-btn.wd-sticky-btn-shown) .hp-wa { bottom: 86px; }
	body:has(.wd-sticky-btn.wd-sticky-btn-shown) .scrollToTop { bottom: 148px !important; }
}
@media print { .hp-wa { display: none; } }

/* --------------------------------------------------------------------------
   "Added to cart" confirmation and the cart icon's bump
   -------------------------------------------------------------------------- */
#hp-toast {
	position: fixed;
	top: 92px;
	left: 50%;
	z-index: 100002;
	display: flex;
	align-items: center;
	gap: 12px;
	width: max-content;
	max-width: min(92vw, 440px);
	padding: 11px 12px 11px 14px;
	border-radius: 14px;
	background: #0F3A29;
	color: #F4EFDD;
	font: 500 14.5px/1.3 "Inter", "Segoe UI", Arial, sans-serif;
	box-shadow: 0 14px 34px rgba(7, 49, 31, .3);
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, -14px);
	transition: opacity .22s ease, transform .22s ease, visibility .22s;
}
#hp-toast.is-on { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
#hp-toast .hp-toast__tick {
	flex: none;
	display: grid;
	place-items: center;
	width: 28px;
	height: 28px;
	border-radius: 50%;
	background: #E2B54C;
	color: #0F3A29;
}
#hp-toast .hp-toast__text { min-width: 0; }
#hp-toast .hp-toast__text strong { display: block; font-weight: 700; }
#hp-toast .hp-toast__name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .82; font-size: 13px; }
#hp-toast .hp-toast__name:empty { display: none; }
#hp-toast a {
	flex: none;
	padding: 8px 14px;
	border-radius: 999px;
	background: #F4EFDD;
	color: #0F3A29 !important;
	font-weight: 700;
	font-size: 13.5px;
	text-decoration: none !important;
}
#hp-toast a:hover { background: #fff; }
@media (max-width: 768px) { #hp-toast { top: 74px; } }

.wd-header-cart .wd-tools-icon.hp-bump { animation: hp-bump .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes hp-bump { 30% { transform: scale(1.28) rotate(-6deg); } 60% { transform: scale(.94); } }

/* --------------------------------------------------------------------------
   Sticky add to cart: phones only (Woodmart's bar, switched on in functions.php)
   -------------------------------------------------------------------------- */
@media (min-width: 769px) { .wd-sticky-btn { display: none !important; } }
@media (max-width: 768px) {
	.wd-sticky-btn {
		padding: 10px 0 calc(10px + env(safe-area-inset-bottom)) !important;
		background: #FFFBF2 !important;
		border-top: 1px solid #EADFC6;
		box-shadow: 0 -8px 24px rgba(15, 58, 41, .1) !important;
	}
	.wd-sticky-btn .wd-sticky-btn-container { display: flex; align-items: center; gap: 12px; padding-inline: 16px !important; }
	.wd-sticky-btn .wd-sticky-btn-content { display: none; }   /* the page title is still on screen above */
	html body .wd-sticky-btn .wd-sticky-btn-cart { display: flex; flex: 1 1 0; align-items: center; gap: 12px; width: auto !important; min-width: 0; margin: 0 !important; }
	.wd-sticky-btn .wd-sticky-btn-cart > .price { display: block !important; flex: none; margin: 0; font: 700 17px/1.1 "Playfair Display", Georgia, serif; color: #0F3A29; }
	.wd-sticky-btn .wd-sticky-btn-cart > .price del { display: none; }
	html body .wd-sticky-btn form.cart { display: flex; flex: 1 1 0 !important; gap: 8px; width: auto !important; min-width: 0; margin: 0 !important; }
	.wd-sticky-btn .quantity { display: none !important; }
	html body .wd-sticky-btn .wd-sticky-btn-cart .single_add_to_cart_button,
	html body .wd-sticky-btn .wd-sticky-btn-cart .wd-sticky-add-to-cart {
		flex: 1;
		display: inline-flex;
		align-items: center;
		justify-content: center;
		min-height: 48px;
		padding: 0 16px !important;
		border-radius: 999px !important;
		background: #0E4A31 !important;
		color: #F4EFDD !important;
		font: 700 15px/1 "Inter", "Segoe UI", Arial, sans-serif !important;
		text-transform: none !important;
		letter-spacing: 0 !important;
		box-shadow: none !important;
	}
	.wd-sticky-btn .wd-buttons, .wd-sticky-btn .wd-wishlist-btn, .wd-sticky-btn .wd-compare-btn { display: none !important; }
}

/* --------------------------------------------------------------------------
   Scroll reveal: hp-extras.js tags only what starts below the screen
   -------------------------------------------------------------------------- */
.hp-rv { opacity: 0; transform: translateY(18px); }
.hp-rv.hp-rv-in {
	opacity: 1;
	transform: none;
	transition: opacity .55s ease var(--hp-rv-d, 0ms), transform .55s cubic-bezier(.2, .7, .2, 1) var(--hp-rv-d, 0ms);
}

/* --------------------------------------------------------------------------
   Image placeholders: a soft sweep until the picture has loaded
   -------------------------------------------------------------------------- */
.hp-ph {
	background-image: linear-gradient(100deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, .6) 50%, rgba(255, 255, 255, 0) 70%) !important;
	background-size: 220% 100% !important;
	background-repeat: no-repeat !important;
	animation: hp-sweep 1.25s linear infinite;
}
@keyframes hp-sweep { from { background-position: 120% 0; } to { background-position: -120% 0; } }

/* --------------------------------------------------------------------------
   Floating specks behind the green contact band and the page heroes.
   Two tiled layers rising at different speeds; transform only, so it stays
   off the main thread. Added by hp-extras.js, never with reduced motion.
   -------------------------------------------------------------------------- */
.hp-ihero, .hp-shop-hero { isolation: isolate; }
.hp-specks {
	position: absolute;
	inset: 0;
	z-index: -1;
	overflow: hidden;
	pointer-events: none;
	-webkit-mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 76%, transparent);
	mask-image: linear-gradient(to bottom, transparent, #000 24%, #000 76%, transparent);
}
.hp-specks::before,
.hp-specks::after {
	content: "";
	position: absolute;
	top: 0;
	right: 0;
	left: 0;
	will-change: transform;
}
.hp-specks::before {
	height: calc(100% + 260px);
	background-size: 260px 260px;
	background-image:
		radial-gradient(circle at 12% 18%, var(--hp-speck) 0 1.6px, transparent 2.6px),
		radial-gradient(circle at 71% 9%, var(--hp-speck) 0 1.1px, transparent 2px),
		radial-gradient(circle at 44% 52%, var(--hp-speck) 0 2px, transparent 3.2px),
		radial-gradient(circle at 88% 67%, var(--hp-speck) 0 1.3px, transparent 2.2px),
		radial-gradient(circle at 23% 86%, var(--hp-speck) 0 1.2px, transparent 2.1px);
	animation: hp-rise-a 30s linear infinite;
}
.hp-specks::after {
	height: calc(100% + 370px);
	background-size: 370px 370px;
	background-image:
		radial-gradient(circle at 31% 14%, var(--hp-speck-2) 0 2.4px, transparent 4.5px),
		radial-gradient(circle at 79% 41%, var(--hp-speck-2) 0 1.5px, transparent 3px),
		radial-gradient(circle at 9% 63%, var(--hp-speck-2) 0 3px, transparent 5.5px),
		radial-gradient(circle at 58% 88%, var(--hp-speck-2) 0 1.8px, transparent 3.4px);
	animation: hp-rise-b 47s linear infinite;
}
@keyframes hp-rise-a { to { transform: translateY(-260px); } }
@keyframes hp-rise-b { to { transform: translateY(-370px); } }
.hp-cta__inner .hp-specks { --hp-speck: rgba(226, 181, 76, .7); --hp-speck-2: rgba(244, 239, 221, .28); }
.hp-ihero .hp-specks, .hp-shop-hero .hp-specks { --hp-speck: rgba(46, 107, 69, .3); --hp-speck-2: rgba(226, 168, 59, .34); }

@media (prefers-reduced-motion: reduce) {
	.hp-specks { display: none; }
	.hp-ph, .wd-header-cart .wd-tools-icon.hp-bump { animation: none; }
	.hp-rv { opacity: 1; transform: none; }
	#hp-toast, .hp-wa { transition: none; }
}

/* --------------------------------------------------------------------------
   My Account: "Order again" beside View, and the Buy it again row
   -------------------------------------------------------------------------- */
.hp-dash__again-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: max-content;
	margin: 6px 0 0;   /* under View: the table has no room beside it */
	padding: 6px 12px;
	border: 1px solid #0E4A31;
	border-radius: 999px;
	background: #0E4A31;
	color: #F4EFDD !important;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	text-decoration: none !important;
}
.hp-dash__again-btn:hover { background: #0F3A29; }
.hp-dash__again { margin-block: 22px; }
.hp-dash__again > p { margin: 2px 0 16px; color: #6A6B62; }
.hp-dash__again .products { margin-bottom: 0 !important; }
.hp-dash__again .product-wrapper > .wd-add-btn {
	position: static !important;
	display: flex !important;
	justify-content: center;
	margin: 12px 0 4px;
	opacity: 1 !important;
	visibility: visible !important;
	transform: none !important;
	background: none !important;
	box-shadow: none !important;
}
.hp-dash__again .product-wrapper > .wd-add-btn > a {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: auto !important;
	min-width: 0;
	height: 38px !important;
	padding: 0 18px !important;
	border: 1px solid #0E4A31 !important;
	border-radius: 999px !important;
	background: #0E4A31 !important;
	color: #F4EFDD !important;
	font: 600 13.5px/1 "Inter", "Segoe UI", Arial, sans-serif !important;
	text-indent: 0 !important;
	text-transform: none !important;
	letter-spacing: 0 !important;
}
.hp-dash__again .product-wrapper > .wd-add-btn > a::before,
.hp-dash__again .product-wrapper > .wd-add-btn > a::after { display: none !important; }
.hp-dash__again .product-wrapper > .wd-add-btn > a span { display: inline !important; font-size: inherit !important; }
.woocommerce-orders-table__cell-order-actions .button.hp-reorder { background: #0E4A31 !important; color: #F4EFDD !important; }
