/* ============================================================
 * UGREEN — coded homepage (front-page.php) + Deals page
 * New Arrivals carousel, Best Deals carousel, brands strip.
 * Brand colours: logo blue #018454, navy #013d28, green #03b178.
 * ============================================================ */

.ugreen-home { --mt-navy: #013d28; --mt-blue: #018454; --mt-blue-d: #016b44; --mt-green: #03b178; }

/* Suppress the theme's empty archive header + top padding on the homepage. */
body.home .archive-header,
body.page-template .archive-header { display: none; }
body.home #content.site-content,
body.home .shoptimizer-archive > .col-full { padding-top: 0 !important; }

/* ---------- Full-width homepage ----------
 * Shoptimizer boxes content in .col-full (max-width 1170px) and sizes
 * #primary as an archive column with room reserved for a sidebar, so the
 * homepage sat narrow and left-aligned while the header ran edge to edge.
 * On the front page only, unbox both so the sections span the viewport the
 * way the header does. Scoped to body.home so shop and product pages keep
 * the theme's normal boxed layout. */
body.home #content.site-content > .shoptimizer-archive > .col-full,
body.home .shoptimizer-archive > .col-full {
	max-width: none !important;
	width: 100% !important;
	padding-left: 0 !important;
	padding-right: 0 !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}
body.home #primary.content-area.ugreen-home {
	width: 100% !important;
	max-width: none !important;
	float: none !important;
	margin: 0 !important;
	padding: 0 !important;
}
/* No sidebar on the homepage - it would re-introduce the empty right band. */
body.home #secondary,
body.home .widget-area { display: none !important; }
/* Guard against a stray horizontal scrollbar from the now-full-width rows. */
body.home { overflow-x: hidden; }

.ugreen-hsec {
	position: relative;
	width: 100%;
}

/* Alternating tint so consecutive category rows read as separate bands. */
.ugreen-hsec--alt { background: #f6f9f7; }

.ugreen-hwrap {
	max-width: 1720px;
	margin: 0 auto;
	padding: 0 28px;
}

/* ---------- Section heading ---------- */
.ugreen-sec-head { margin: 0 0 20px; }
.ugreen-sec-head h2 {
	font-size: clamp(20px, 1.3rem + 1vw, 28px);
	font-weight: 800;
	color: var(--mt-navy);
	margin: 0 0 4px;
	letter-spacing: -.01em;
}
.ugreen-sec-head p { color: #67766e; margin: 0; font-size: 14.5px; }
.ugreen-sec-head--row {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
}
.ugreen-sec-link {
	flex: 0 0 auto;
	font-weight: 700;
	font-size: 14px;
	color: var(--mt-blue);
	text-decoration: none;
	white-space: nowrap;
}
.ugreen-sec-link:hover { color: var(--mt-navy); }

/* ---------- Buttons ---------- */
.ugreen-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font-weight: 700;
	font-size: 15px;
	line-height: 1;
	padding: 13px 26px;
	border-radius: 3px;
	text-decoration: none;
	border: 2px solid transparent;
	transition: background .15s, color .15s, border-color .15s;
}
.ugreen-btn--primary { background: var(--mt-blue); color: #fff; }
.ugreen-btn--primary:hover { background: var(--mt-blue-d); color: #fff; }

/* ============================================================
 * 1/2. CAROUSELS (New Arrivals, Best Deals)
 * ============================================================ */
.ugreen-carousel-sec { padding: 40px 0 8px; }
.ugreen-carousel {
	position: relative;
	--gap: 16px;
	--n: 7; /* items shown by default (desktop) — the rows are full width */
}

.ugreen-carousel__viewport {
	overflow-x: auto;
	/* 'proximity', not 'mandatory'. Item widths are calc()'d fractions, so their
	 * rounded pixel widths accumulate a few px of drift across a long track.
	 * Under mandatory snapping the container must come to rest on a snap point,
	 * and the final start-aligned point sits just short of the true scroll end —
	 * so the last card could never be scrolled fully into view. */
	scroll-snap-type: x proximity;
	scroll-behavior: smooth;
	/* Let the last card clear the right edge instead of butting against it. */
	scroll-padding-inline-end: 2px;
	-ms-overflow-style: none;
	scrollbar-width: none;
}
.ugreen-carousel__viewport::-webkit-scrollbar { display: none; }

/* Turn the WooCommerce product grid into a horizontal track */
.ugreen-carousel__viewport ul.products {
	display: flex !important;
	flex-wrap: nowrap !important;
	grid-template-columns: none !important;
	gap: var(--gap);
	margin: 0 !important;
	padding: 4px 0;
}
.ugreen-carousel__viewport ul.products li.product {
	flex: 0 0 auto;
	width: calc((100% - (var(--n) - 1) * var(--gap)) / var(--n)) !important;
	margin: 0 !important;
	scroll-snap-align: start;
}
/* The last item of each track snaps to its END, so there is a snap point that
 * coincides with the real end of the content. With start-only alignment the
 * track can come to rest one partial card short of the end. */
.ugreen-carousel__viewport ul.products li.product:last-child,
.ugreen-brands-track .ugreen-brand:last-child {
	scroll-snap-align: end;
}

/* Arrows */
.ugreen-car-arrow {
	position: absolute;
	top: 42%;
	transform: translateY(-50%);
	width: 42px;
	height: 42px;
	border: 1px solid #e0eae4;
	border-radius: 50%;
	background: #fff;
	color: var(--mt-blue);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 3px 10px rgba(10, 26, 18, .12);
	z-index: 3;
	transition: opacity .15s, background .15s;
}
.ugreen-car-arrow svg { width: 20px; height: 20px; }
.ugreen-car-arrow:hover { background: var(--mt-blue); color: #fff; }
.ugreen-car-prev { left: -8px; }
.ugreen-car-next { right: -8px; }
.ugreen-car-arrow[hidden] { display: none; }

/* ============================================================
 * 2. BEST DEALS — CTA
 * ============================================================ */
.ugreen-deals-cta { text-align: center; margin-top: 22px; }

/* ============================================================
 * 3. OUR BRANDS
 * ============================================================ */
.ugreen-cats-sec { padding: 42px 0 8px; }
.ugreen-carousel--cats .ugreen-carousel__viewport { padding: 4px 0; }
.ugreen-brands-track {
	--bgap: 10px; /* minimal spacing between logos */
	display: flex;
	flex-wrap: nowrap;
	gap: var(--bgap);
}
.ugreen-brand {
	flex: 0 0 auto;
	width: calc((100% - 7 * var(--bgap)) / 8); /* 8 visible before scroll (desktop) */
	scroll-snap-align: start;
	text-decoration: none;
}
.ugreen-brand__logo {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 3 / 2; /* landscape tile fits wordmark logos better than a square */
	background: #fff;
	border: 1px solid #eef6f2;
	border-radius: 3px;
	padding: 5px 6px;
	transition: border-color .15s, box-shadow .15s;
}
.ugreen-brand__logo img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}
/* Fallback tile for a category with no thumbnail set yet: the category name
 * as a wordmark. Reads far better than initials, and sits on the same
 * landscape tile so the strip stays even. */
.ugreen-brand__logo--text {
	font-weight: 800;
	font-size: clamp(10px, 0.62rem + 0.25vw, 14px);
	line-height: 1.15;
	letter-spacing: .02em;
	text-transform: uppercase;
	text-align: center;
	color: var(--mt-navy);
	background: #f7fbf9;
	overflow: hidden;
	overflow-wrap: anywhere;
	hyphens: auto;
}
.ugreen-brand__count {
	display: block;
	margin-top: 6px;
	font-size: 11px;
	line-height: 1.3;
	text-align: center;
	color: var(--ug-muted, #67766e);
}
.ugreen-brand:hover .ugreen-brand__count { color: var(--mt-blue); }
.ugreen-brand:hover .ugreen-brand__logo {
	border-color: var(--mt-blue);
	box-shadow: 0 4px 12px rgba(1, 132, 84, .15);
}

/* ============================================================
 * DEALS PAGE (page-deals.php)
 * ============================================================ */
.ugreen-deals-hero { padding: 30px 0 6px; text-align: center; }
.ugreen-deals-hero h1 {
	font-size: clamp(26px, 1.5rem + 1.5vw, 38px);
	font-weight: 800;
	color: #0f172a;
	margin: 0 0 8px;
}
.ugreen-deals-hero p { color: #67766e; margin: 0 auto; max-width: 640px; }
.ugreen-deals-grid-sec { padding: 24px 0 48px; }
.ugreen-deals-intro { margin: 0 auto 28px; max-width: 800px; }
.ugreen-deals-grid-sec ul.products { margin-top: 8px; }

/* ============================================================
 * RESPONSIVE
 * ============================================================ */
@media (max-width: 1500px) {
	.ugreen-carousel { --n: 6; }
}

@media (max-width: 1280px) {
	.ugreen-carousel { --n: 5; }
}

@media (max-width: 1100px) {
	.ugreen-carousel { --n: 4; }
	.ugreen-brand { width: calc((100% - 5 * var(--bgap)) / 6); } /* 6 visible */
}

@media (max-width: 900px) {
	.ugreen-carousel { --n: 3; }
	.ugreen-brand { width: calc((100% - 3 * var(--bgap)) / 4); } /* 4 visible */
}

@media (max-width: 600px) {
	.ugreen-hwrap { padding: 0 15px; }
	.ugreen-carousel-sec,
	.ugreen-cats-sec { padding: 28px 0 4px; }
	.ugreen-carousel { --n: 2; --gap: 12px; } /* New Arrivals + Best Deals: show 2 */
	.ugreen-brand { width: calc((100% - 2 * var(--bgap)) / 2.4); } /* Categories: ~2.4 across, drag for more */
	/* Arrows hidden on touch; drag/swipe instead */
	.ugreen-car-arrow { display: none !important; }
	.ugreen-sec-head--row { align-items: center; }
}
