/* Homepage banner and top categories (see inc/home-hero.php) */

/* ---------- Page width ----------
 * Every Beaver Builder row on the front page shares the banner's bounds:
 * 1360px of content (modules keep their own 20px side margins, hence +40px).
 * With the row wrapper's 20px padding that leaves a 40px gutter on smaller screens. Row backgrounds still run
 * full width because they sit on .fl-row-content-wrap.
 */
.home .fl-builder-content > .fl-row > .fl-row-content-wrap > .fl-row-content,
.home .fl-builder-content > .fl-row.fl-row-full-width > .fl-row-content-wrap > .fl-row-content.fl-row-full-width {
	width: 100%; /* the wrapper is a flex container; without this the row shrinks to its content and sliders grow without limit */
	max-width: 1400px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 0;
	padding-right: 0;
	box-sizing: border-box;
}

/* ---------- Banner ---------- */

.se-hero {
	--se-hero-navy: #093749;
	position: relative;
	width: 100%;
	margin: 40px 0 0; /* the builder row's 20px + the next row's 20px = Figma's 40px to the next heading */
	padding: 0;
}

.se-hero__viewport {
	overflow: hidden;
}

.se-hero__track {
	display: flex;
	transition: transform 0.6s ease;
	will-change: transform;
}

.se-hero__slide {
	position: relative;
	flex: 0 0 100%;
	aspect-ratio: 1360 / 472;
	min-height: 400px;
	overflow: hidden;
	background: #ced9d0;
	color: #000;
}

.se-hero__slide--half-sheet {
	background: #ebebe7;
}

/* Photo: fades into the slide colour on its inner edge */
.se-hero__media {
	position: absolute;
	top: 0;
	bottom: 0;
	width: 62.22%; /* 846 / 1360 */
}

.se-hero__slide--image-right .se-hero__media {
	right: 0;
}

.se-hero__slide--image-left .se-hero__media {
	left: 0;
}

.se-hero__image {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	-webkit-mask-image: url("../images/home-hero/fade-mask.svg");
	mask-image: url("../images/home-hero/fade-mask.svg");
	-webkit-mask-size: 100% 100%;
	mask-size: 100% 100%;
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
}

/* Left-hand photo is mirrored, so its fade runs the other way */
.se-hero__slide--image-left .se-hero__image {
	transform: scaleX(-1);
}

.se-hero__badge {
	position: absolute;
	z-index: 2;
	display: block;
	line-height: 0;
}

.se-hero__badge img {
	display: block;
	width: 100%;
	height: auto;
	max-width: none;
}

/* 90-day guarantee: enlarged from Figma's 142.8px so its curved small print is readable; links to the guarantee page */
.se-hero__badge--guarantee {
	top: 11%;
	right: 12%;
	width: clamp(150px, 24%, 210px);
	border-radius: 50%;
	transform: rotate(6.66deg);
	transition: transform 0.2s ease;
}

a.se-hero__badge--guarantee:hover {
	transform: rotate(6.66deg) scale(1.04);
}

a.se-hero__badge--guarantee:focus-visible {
	outline: 3px solid #fff;
	outline-offset: 3px;
}

.se-hero__badge--uk {
	top: 21%;
	left: 18.53%; /* 156.78 / 846 */
	width: 19.64%; /* 166.22 / 846 */
}

.se-hero__badge--uk img {
	aspect-ratio: 1;
	object-fit: cover;
	object-position: 47% 48%;
	border: 1.889px solid rgba(0, 0, 0, 0.66);
	border-radius: 50%;
}

/* Copy */
.se-hero__content {
	position: absolute;
	top: 50%;
	z-index: 1;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 60px;
	width: min(533.6px, 46%); /* 533.6px at the 1360px design width */
	transform: translateY(-50%);
}

.se-hero__slide--image-right .se-hero__content {
	left: 9.17%; /* 124.67 / 1360 */
}

.se-hero__slide--image-left .se-hero__content {
	right: 9.17%;
}

.se-hero__copy {
	display: flex;
	flex-direction: column;
	gap: 22.667px;
}

.se-hero .se-hero__title {
	max-width: 416px;
	margin: 0;
	font-family: 'Baskervville', Baskerville, Georgia, serif;
	font-size: clamp(34px, 4.17vw, 56.667px);
	font-weight: 400;
	line-height: 0.9;
	color: #000;
}

.se-hero .se-hero__text {
	margin: 0;
	font-size: clamp(16px, 1.4vw, 19.054px);
	line-height: 1.4;
	color: #000;
	opacity: 0.7;
}

.se-hero .se-hero__button,
.se-hero .se-hero__button:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 15.111px 18.889px;
	border-radius: 0;
	background: var(--se-hero-navy);
	font-size: clamp(16px, 1.4vw, 19.054px);
	line-height: 1;
	color: #fff;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.se-hero .se-hero__button:hover,
.se-hero .se-hero__button:focus-visible {
	background: #021533;
	color: #fff;
}

/* Dots: same as the "Our Best Sellers" slider's pagination (12px, 6px apart, #ccc / #333) */
.se-hero__dots {
	display: flex;
	justify-content: center;
	gap: 6px;
	margin-top: 21px;
}

.se-hero .se-hero__dot {
	width: 12px;
	height: 12px;
	min-height: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #ccc;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.se-hero .se-hero__dot:hover,
.se-hero .se-hero__dot[aria-current="true"] {
	background: #333;
}

.se-hero .se-hero__dot:focus-visible {
	outline: 2px solid #333;
	outline-offset: 3px;
}

@media (max-width: 1024px) {
	.se-hero__content {
		gap: 36px;
		width: 44%;
	}
}

/* Phones and small tablets: photo on top, copy underneath */
@media (max-width: 767px) {
	/* The banner's builder module drops its side margins on phones; match the other sections' 20px */
	.fl-module:has(> .se-hero) {
		margin-left: 0;
		margin-right: 0;
	}

	.se-hero {
		width: auto;
		margin: 20px 20px 32px;
	}

	.se-hero__slide {
		display: flex;
		flex-direction: column;
		aspect-ratio: auto;
		min-height: 0;
	}

	.se-hero__media {
		position: relative;
		width: 100%;
		height: 240px;
	}

	.se-hero__image,
	.se-hero__slide--image-left .se-hero__image {
		-webkit-mask-image: linear-gradient(to top, transparent 0, #000 45%);
		mask-image: linear-gradient(to top, transparent 0, #000 45%);
	}

	.se-hero__badge--guarantee {
		top: 12px;
		right: 12px;
		width: 132px;
	}

	.se-hero__badge--uk {
		top: 24px;
		left: 20px;
		width: 104px;
	}

	.se-hero__content,
	.se-hero__slide--image-right .se-hero__content,
	.se-hero__slide--image-left .se-hero__content {
		position: static;
		width: auto;
		gap: 24px;
		padding: 4px 20px 32px;
		transform: none;
	}

	.se-hero__copy {
		gap: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.se-hero__track {
		transition: none;
	}
}

/* ---------- Our Top Categories ----------
 * Figma: four 275px cards with 20px gaps (a 1160px row), heading 36px above
 * the cards, 40px below the banner dots and 40px of space after the row.
 * The block is centred, with the heading lined up on the first card.
 * The scroll area keeps 16px of padding round the cards so their shadows
 * aren't clipped; negative margins take that padding back out of the layout.
 */

.fl-rich-text:has(.se-top-categories) > h2 {
	max-width: 1160px;
	margin: 0 auto 32px; /* + the scroll area's 4px top padding = 36px */
	text-align: left !important; /* overrides the inline centring in the builder module */
	font-size: 25.5px;
	line-height: 33px;
	color: #3a3a3a;
}

/* The builder wraps the shortcode in a <p>, which the browser closes early, leaving empty paragraphs */
.fl-rich-text:has(.se-top-categories) > p:empty {
	display: none;
}

/* Space after the row: the builder module and row add 20px each, which is Figma's 40px */
.fl-rich-text:has(.se-top-categories) > p:last-child,
.fl-rich-text:has(.se-top-categories) > :last-child {
	margin-bottom: 0;
}

.se-top-categories {
	/* Centred 1160px row + 16px shadow room each side; on narrow screens it
	   scrolls and the shadow room hangs 16px outside the content edge. */
	margin: 0 max(-16px, calc((100% - 1192px) / 2)) -20px;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scroll-padding: 0 16px;
	scrollbar-width: thin;
}

.se-top-categories:focus-visible {
	outline: 2px solid #093749;
	outline-offset: 2px;
}

.se-top-categories .woocommerce ul.products,
.woocommerce .se-top-categories ul.products {
	display: flex;
	flex-wrap: nowrap;
	gap: 20px;
	width: max-content;
	margin: 0;
	padding: 4px 16px 20px;
	border-top: 0; /* style.css gives every ul.products a 45px white top border */
}

.se-top-categories .woocommerce ul.products::before,
.se-top-categories .woocommerce ul.products::after {
	content: none;
}

.se-top-categories .woocommerce ul.products li.product,
.woocommerce .se-top-categories ul.products li.product {
	flex: 0 0 275px;
	float: none;
	width: 275px;
	height: 275px;
	margin: 0;
	padding: 0;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
	scroll-snap-align: start;
}

.se-top-categories ul.products li.product-category a {
	display: block;
	height: 100%;
}

.woocommerce .se-top-categories ul.products li.product-category a img,
.se-top-categories .woocommerce ul.products li.product-category a img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: cover;
}

@media (max-width: 767px) {
	.se-top-categories .woocommerce ul.products li.product,
	.woocommerce .se-top-categories ul.products li.product {
		flex-basis: 240px;
		width: 240px;
		height: 240px;
	}
}
