/*
 * Home page (front page only): the few things Elementor's widgets can't set.
 * Layout, type and colour all live in Elementor (global classes on page 14 and the
 * "Home header" / "Home footer" templates).
 */

/* "Bring it + Refill it + Use it +": two identical tracks slide left forever. */
.rf-marquee-track {
	animation: rf-marquee 48s linear infinite;
	white-space: nowrap;
}

@keyframes rf-marquee {
	from { transform: translateX(0); }
	to { transform: translateX(-100%); }
}

@media (prefers-reduced-motion: reduce) {
	.rf-marquee-track { animation: none; }
}

/*
 * Sticky header (Elementor Pro "Sticky: Top" on .rf-site-header). At the top it's the
 * rounded bar inset from the edges; once the page scrolls it becomes a full-width bar
 * with a soft shadow.
 */
.rf-site-header {
	/* Size, width and corners switch instantly; only the shadow fades in. */
	transition: box-shadow 0.3s ease;
}

.rf-site-header.elementor-sticky--effects {
	--min-height: 72px;
	width: 100% !important;
	min-height: 72px !important;
	left: 0 !important;
	inset-inline-start: 0 !important;
	border-radius: 0 !important;
	box-shadow: 0 1px 0 rgba(139, 141, 157, 0.05), 0 5px 10px -7px rgba(65, 71, 108, 0.25);
}

/* A slightly smaller logo while stuck (186 → 168px wide at the same proportions). */
.rf-site-header.elementor-sticky--effects > .e-con-inner > .e-svg-base:first-child {
	width: 168px !important;
	height: 47px !important;
}

@media (max-width: 767px) {
	.rf-site-header.elementor-sticky--effects {
		--min-height: 58px;
		min-height: 58px !important;
	}

	.rf-site-header.elementor-sticky--effects > .e-con-inner > .e-svg-base:first-child {
		width: 121px !important;
		height: 34px !important;
	}
}

/*
 * Phone/tablet menu: the dropdown hangs from the header box at the header's width (Elementor
 * stretches it to the full screen), and the header's bottom corners square off while it's
 * open, so the two read as one panel. The header becomes the dropdown's positioning box.
 */
.rf-site-header {
	position: relative;
}

.rf-site-header > .e-con-inner,
.rf-site-header .rf-site-nav {
	position: static;
}

/* (Six classes, to beat the header template's own 12px margin rule.) */
.rf-site-header.e-con .rf-site-nav.elementor-element .elementor-nav-menu__container.elementor-nav-menu--dropdown {
	top: 100% !important;
	left: 0 !important;
	width: 100% !important;
	margin-top: 0 !important; /* Elementor's dropdown "distance" would leave a gap under the header. */
	border-radius: 0 0 16px 16px;
}

/* Menu text lines up with the logo (the header's 16px left padding). */
.rf-site-header.e-con .rf-site-nav.elementor-element .elementor-nav-menu--dropdown a {
	padding-inline: 16px;
}

/* Hover/tap: the brand's lilac tint (the cream was too close to the page background). */
.rf-site-header.e-con .rf-site-nav.elementor-element .elementor-nav-menu--dropdown a:is(:hover, :focus-visible, .elementor-item-active, .highlighted) {
	background-color: var(--rm-lilac-tint, #F0DEE8);
	color: var(--rm-aubergine, #362336);
}

.rf-site-header:has(.elementor-menu-toggle.elementor-active) {
	border-bottom-left-radius: 0 !important;
	border-bottom-right-radius: 0 !important;
}

/* Stuck to the top, the header is a full-width bar with square corners: square the menu too. */
.rf-site-header.elementor-sticky--effects .rf-site-nav .elementor-nav-menu--dropdown {
	border-radius: 0;
}

/* "Cart · 2" in the header ([refillery_header_cart] in a Shortcode widget with the class
   rf-header-cart-slot): an aubergine pill in the menu's lettering. The widget takes no room
   while the cart is empty. */
.rf-header-cart-slot {
	flex: none;
	width: auto !important;
	margin-inline-start: 28px;
}

.rf-header-cart-slot:not(:has(.rf-header-cart:not([hidden]))) {
	display: none;
}

.rf-header-cart,
.rf-header-cart:is(:hover, :focus, :visited) {
	display: inline-block;
	padding: 9px 18px 8px;
	border-radius: 999px;
	background: var(--rm-aubergine, #362336);
	color: var(--rm-cream, #F7F0E6);
	font-family: var(--rm-font-margem, "Marg"), var(--rm-font-label, "Nunito"), sans-serif;
	font-size: 15px;
	font-weight: 500;
	line-height: 20px;
	letter-spacing: 0.01em;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
}

.rf-header-cart[hidden] {
	display: none;
}

.rf-header-cart:hover {
	background: var(--rm-brown, #613E3A);
}

.rf-header-cart.is-bumped {
	animation: rf-header-cart-bump 0.4s ease;
}

@keyframes rf-header-cart-bump {
	50% { transform: scale(1.1); }
}

@media (max-width: 767px) {
	.rf-header-cart-slot {
		margin-inline: 8px;
	}

	.rf-header-cart,
	.rf-header-cart:is(:hover, :focus, :visited) {
		padding: 6px 12px 5px;
		font-size: 13px;
		line-height: 18px;
	}
}

/* The theme gives lists a bottom margin, which lifts the menu off centre in the bar. */
.rf-site-nav .elementor-nav-menu,
.rf-footer-nav .elementor-nav-menu {
	margin-block: 0;
}

/*
 * Product carousel (Loop Carousel, class rf-products-carousel). Cards keep the mock-up's
 * width (526px, a little narrower on phones; home.js lets Swiper use it).
 * Left edge: the carousel reaches one card-gap (--rf-fade) past the content edge and is
 * masked there, so a card leaving to the left fades out across the gap (the paper shows
 * through) and is fully hidden beyond it.
 */
.rf-products-carousel {
	--rf-fade: 23px;
	/* Wider by the fade so the right edge still reaches the window edge. */
	width: calc(100% + var(--rf-fade)) !important;
	max-width: none !important;
	margin-inline-start: calc(var(--rf-fade) * -1);
	padding-inline-start: var(--rf-fade);
	overflow: hidden;
	-webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--rf-fade));
	mask-image: linear-gradient(to right, transparent 0, #000 var(--rf-fade));
}

@media (max-width: 1024px) {
	.rf-products-carousel { --rf-fade: 18px; }
}

@media (max-width: 767px) {
	.rf-products-carousel { --rf-fade: 14px; }
}

.rf-products-carousel .swiper {
	overflow: visible;
	cursor: grab;
}

.rf-products-carousel .swiper:active { cursor: grabbing; }

.rf-products-carousel .swiper-slide {
	width: min(526px, 80vw) !important;
	/* Swiper's GPU "backface" trick can leave slides undrawn in Chrome after a resize. */
	-webkit-backface-visibility: visible !important;
	backface-visibility: visible !important;
	transform: none !important;
}

/* Scent pills on each product photo ([refillery_scent_tags]). */
.rf-scent-tags {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
	/* Own compositing layer. On iPhones (Safari and Chrome), the photo gets a layer while the
	   carousel slides, and inside the rounded, clipped card it was painted over the pills
	   until the slide settled. */
	position: relative;
	z-index: 1;
	-webkit-transform: translateZ(0);
	transform: translateZ(0);
}

.rf-scent-tag {
	padding: 4px 14px;
	border-radius: 999px;
	font-family: var(--rm-font-margem, "Marg"), var(--rm-font-label, "Nunito"), sans-serif;
	font-size: 16px;
	font-weight: 500;
	line-height: 22px;
	letter-spacing: 0.01em;
	text-transform: uppercase;
}

/* Colours come from each scent's "Tag colour" (Products > Attributes > Scent), set inline. */

@media (max-width: 767px) {
	.rf-scent-tag {
		padding: 3px 11px;
		font-size: 14px;
		line-height: 20px;
	}
}

/* "Refill me · Repeat · Use me · Bring me" badge: one slow clockwise turn every 30s. */
@keyframes rf-badge-spin {
	to { transform: rotate(360deg); }
}

img[src*="refill-me-badge"] {
	animation: rf-badge-spin 30s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
	img[src*="refill-me-badge"] {
		animation: none;
	}
}

/* Gift bags section: slow snowfall behind the text (Figma 557:111).
   The strip at the bottom has its own background, so the snow stops there. */
.rf-gift-card {
	isolation: isolate;
}

.rf-gift-card::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cg fill='%23F7F0E6'%3E%3Ccircle cx='18' cy='26' r='1.6' opacity='.55'/%3E%3Ccircle cx='96' cy='70' r='1.2' opacity='.4'/%3E%3Ccircle cx='170' cy='18' r='2' opacity='.45'/%3E%3Ccircle cx='232' cy='104' r='1.4' opacity='.5'/%3E%3Ccircle cx='60' cy='150' r='2.2' opacity='.35'/%3E%3Ccircle cx='140' cy='196' r='1.3' opacity='.5'/%3E%3Ccircle cx='210' cy='238' r='1.8' opacity='.4'/%3E%3Ccircle cx='28' cy='226' r='1.1' opacity='.45'/%3E%3C/g%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='380' height='380'%3E%3Cg fill='%23F7F0E6'%3E%3Ccircle cx='54' cy='40' r='2.8' opacity='.3'/%3E%3Ccircle cx='250' cy='96' r='3.2' opacity='.25'/%3E%3Ccircle cx='130' cy='210' r='2.6' opacity='.3'/%3E%3Ccircle cx='330' cy='270' r='3' opacity='.22'/%3E%3Ccircle cx='200' cy='344' r='2.4' opacity='.28'/%3E%3C/g%3E%3C/svg%3E");
	background-size: 260px 260px, 380px 380px;
	animation: rf-snow 40s linear infinite;
}

/* Each layer falls exactly one tile per loop, so the repeat is seamless; the larger flakes fall faster. */
@keyframes rf-snow {
	to { background-position: 0 260px, 0 380px; }
}

@media (prefers-reduced-motion: reduce) {
	.rf-gift-card::before {
		animation: none;
	}
}
