/* Bottles for Earth — Shop mega menu: category bar + model-card panels (desktop 992px and up) and a slide-in
   panel on phones/tablets. Printed at the end of the page and positioned by mega-menu.js; the theme's own Shop
   dropdown is hidden only while the script has taken over, so without JavaScript it still works. */

.bfe-mega,
.bfe-mmenu {
	--bfe-mega-green: #17824f;
	--bfe-mega-ink: #1a1a1a;
	--bfe-mega-muted: #6f6f6f;
	--bfe-mega-line: #ececea;
}

/* The theme sets box-sizing: content-box on links and lists; keep sizes predictable inside both menus. */
.bfe-mega *,
.bfe-mmenu * {
	box-sizing: border-box;
}

.bfe-mega {
	display: none;
	font-family: inherit;
	color: var(--bfe-mega-ink);
}

.bfe-mmenu {
	display: none;
}

@media (min-width: 992px) {
	.bfe-mega {
		position: fixed;
		z-index: 9990;
		left: 50%;
		top: 100px;
		width: min(1140px, calc(100vw - 40px));
		flex-direction: column;
		gap: 8px;
		opacity: 0;
		visibility: hidden;
		transform: translate(-50%, 8px);
		transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s linear 0.16s;
	}

	.bfe-mega:not([hidden]) {
		display: flex;
	}

	.bfe-mega.is-open {
		opacity: 1;
		visibility: visible;
		transform: translate(-50%, 0);
		transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s;
	}

	/* Higher specificity than the theme's ".dropdownJavascript li.dropdownOpen > ul.sub-menu { display: block !important }". */
	ul.main-navigation-ul > li.bfe-has-mega.bfe-has-mega > ul.sub-menu {
		display: none !important;
		visibility: hidden !important;
		pointer-events: none !important;
	}
}

/* Category bar */
.bfe-mega__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 4px 6px;
	padding: 6px 12px;
	background: #1f1f1f;
	border-radius: 999px;
	box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}

.bfe-mega__tab {
	position: relative;
	padding: 12px 20px;
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
	transition: color 0.15s;
}

.bfe-mega__tab::after {
	content: "";
	position: absolute;
	right: 20px;
	bottom: 6px;
	left: 20px;
	height: 2px;
	background: #22b573;
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 0.2s ease;
}

.bfe-mega__tab:hover,
.bfe-mega__tab:focus-visible,
.bfe-mega__tab.is-active {
	color: #fff;
}

.bfe-mega__tab:hover::after,
.bfe-mega__tab:focus-visible::after,
.bfe-mega__tab.is-active::after {
	transform: scaleX(1);
}

.bfe-mega a:focus-visible,
.bfe-mmenu a:focus-visible,
.bfe-mmenu button:focus-visible {
	outline: 2px solid #22b573;
	outline-offset: 2px;
	border-radius: 6px;
}

/* Panel */
.bfe-mega__stage {
	width: fit-content;
	max-width: 100%;
	margin: 0 auto;
}

.bfe-mega__panel {
	/* On a short laptop screen the panel scrolls inside itself instead of running off the bottom. */
	max-height: calc(100vh - 190px);
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 28px 32px 30px;
	background: #fff;
	border-radius: 24px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.16), 0 2px 8px rgba(0, 0, 0, 0.06);
}

.bfe-mega__panel[hidden] {
	display: none;
}

.bfe-mega__cards {
	display: grid;
	gap: 28px;
}

/* One to three models: a wide card, text on the left and photos on the right. */
.bfe-mega__panel--wide .bfe-mega__cards {
	grid-template-columns: repeat(var(--bfe-count, 1), minmax(0, 560px));
}

.bfe-mega__panel--wide[data-count="1"] { --bfe-count: 1; }
.bfe-mega__panel--wide[data-count="2"] { --bfe-count: 2; }
.bfe-mega__panel--wide[data-count="3"] { --bfe-count: 3; }

.bfe-mega__panel--wide .bfe-card {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 28px;
	align-items: center;
}

/* Four or more models: compact cards in a row, photos on top. */
.bfe-mega__panel--compact .bfe-mega__cards {
	/* One track per card, none wider than 220px: three cards make a narrower panel, five fill it. */
	grid-template-columns: repeat(var(--bfe-count, 5), minmax(0, 220px));
}

.bfe-mega__panel--compact[data-count="3"] { --bfe-count: 3; }
.bfe-mega__panel--compact[data-count="4"] { --bfe-count: 4; }
.bfe-mega__panel--compact[data-count="5"] { --bfe-count: 5; }
.bfe-mega__panel--compact[data-count="6"] { --bfe-count: 6; }

.bfe-mega__panel--compact .bfe-card {
	display: flex;
	flex-direction: column-reverse;
	justify-content: flex-end;
	gap: 14px;
}

/* Card */
.bfe-card__title {
	margin: 0;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.2;
}

.bfe-card__title a {
	color: inherit;
	text-decoration: none;
}

.bfe-mega__panel--compact .bfe-card__title {
	font-size: 17px;
}

.bfe-card__desc {
	margin: 8px 0 0;
	color: var(--bfe-mega-muted);
	font-size: 14px;
	line-height: 1.5;
}

.bfe-mega__panel--compact .bfe-card__desc {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 4;
	overflow: hidden;
	font-size: 13px;
}

.bfe-card__links {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	margin: 10px 0 0;
	padding: 0;
	list-style: none;
}

.bfe-card__links a {
	color: var(--bfe-mega-ink);
	font-size: 13px;
	text-decoration: underline;
	text-decoration-color: #cfcfca;
	text-underline-offset: 3px;
}

.bfe-card__links a:hover {
	color: var(--bfe-mega-green);
	text-decoration-color: currentColor;
}

.bfe-card__cta {
	display: inline-block;
	margin-top: 14px;
	color: var(--bfe-mega-green);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
}

.bfe-card__cta:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.bfe-card__thumbs {
	display: flex;
	gap: 10px;
}

.bfe-card__thumb {
	display: block;
	flex: 0 0 auto;
	width: 140px;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: #f2f2f2;
	border-radius: 14px;
}

.bfe-mega__panel--compact .bfe-card__thumb {
	flex: 1 1 0;
	width: auto;
	min-width: 0;
}

.bfe-card__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
}

.bfe-card__thumb:hover img {
	transform: scale(1.05);
}

.bfe-card__more {
	display: block;
	margin-top: 8px;
	color: var(--bfe-mega-muted);
	font-size: 12px;
	line-height: 1.3;
}

/* Sizes row */
.bfe-mega__sizes {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--bfe-mega-line);
}

.bfe-mega__sizes-label {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--bfe-mega-muted);
}

.bfe-mega__sizes ul {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bfe-mega__sizes li {
	margin: 0;
	padding: 0;
}

.bfe-mega__sizes a,
.bfe-mega__linklist a {
	display: block;
	padding: 7px 14px;
	border: 1px solid #e2e2de;
	border-radius: 999px;
	color: var(--bfe-mega-ink);
	font-size: 13px;
	line-height: 1.3;
	text-decoration: none;
	transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.bfe-mega__sizes a:hover,
.bfe-mega__linklist a:hover {
	background: #e8f4ee;
	border-color: var(--bfe-mega-green);
	color: var(--bfe-mega-green);
}

/* Plain list of links (Accessories) */
.bfe-mega__linklist {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	max-width: 620px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bfe-mega__linklist li {
	margin: 0;
}

.bfe-mega__linklist a {
	padding: 10px 18px;
	font-size: 14px;
}

@media (prefers-reduced-motion: reduce) {
	.bfe-mega,
	.bfe-mega.is-open,
	.bfe-mega__tab::after,
	.bfe-card__thumb img {
		transition: none;
	}
}

/* ---------------------------------------------------------------------------------------------
   Phones and tablets (under 992px): slide-in panel opened from "Shop" in the theme's mobile menu (the
   hamburger in the Mobile Dock's top bar). First the category list, then the chosen category's cards.
   ------------------------------------------------------------------------------------------- */
@media (max-width: 991px) {
	.bfe-mmenu {
		position: fixed;
		z-index: 990; /* under the dock (998) so the dock stays reachable, over the page */
		top: var(--bfe-topbar-h, 60px);
		right: 0;
		bottom: 0;
		left: 0;
		display: flex;
		flex-direction: column;
		background: #fff;
		color: var(--bfe-mega-ink);
		font-family: "Montserrat", "Inter", sans-serif; /* same as the main menu sheet it slides out of */
		transform: translateX(100%);
		visibility: hidden;
		transition: transform 0.26s ease, visibility 0s linear 0.26s;
	}

	.bfe-mmenu[hidden] {
		display: none;
	}

	.bfe-mmenu.is-open {
		transform: none;
		visibility: visible;
		transition: transform 0.26s ease, visibility 0s;
	}

	/* The theme's own menu list steps aside while the panel is open, and its Shop sub-list is replaced. */
	body.bfe-mmenu-open .mk-responsive-wrap {
		visibility: hidden !important;
	}

	ul.mk-responsive-nav > li.bfe-has-mmenu > ul.sub-menu {
		display: none !important;
	}

	.bfe-mmenu__bar {
		display: flex;
		flex: 0 0 auto;
		align-items: center;
		gap: 4px;
		height: 56px;
		padding: 0 8px;
		border-bottom: 1px solid var(--bfe-mega-line);
	}

	.bfe-mmenu__back {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 44px;
		height: 44px;
		padding: 0;
		border: 0;
		background: transparent;
		color: var(--bfe-mega-ink);
		cursor: pointer;
	}

	.bfe-mmenu__back svg {
		width: 24px;
		height: 24px;
		fill: none;
		stroke: currentColor;
		stroke-width: 2;
		stroke-linecap: round;
		stroke-linejoin: round;
	}

	.bfe-mmenu__title {
		font-size: 13px;
		font-weight: 600;
		letter-spacing: 0.1em;
		text-transform: uppercase;
	}

	.bfe-mmenu__body {
		flex: 1 1 auto;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px)); /* clear of the dock */
	}

	.bfe-mmenu__list {
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.bfe-mmenu__list li {
		margin: 0;
		padding: 0;
		border-bottom: 1px solid var(--bfe-mega-line);
	}

	.bfe-mmenu__row {
		display: flex;
		align-items: center;
		justify-content: space-between;
		width: 100%;
		min-height: 56px;
		padding: 0 20px;
		border: 0;
		background: transparent;
		color: var(--bfe-mega-ink);
		font: inherit;
		font-size: 14px;
		font-weight: 600;
		letter-spacing: 0.08em;
		text-align: left;
		text-decoration: none;
		text-transform: uppercase;
		cursor: pointer;
	}

	.bfe-mmenu__row svg {
		width: 20px;
		height: 20px;
		fill: none;
		stroke: currentColor;
		stroke-width: 2;
		stroke-linecap: round;
		stroke-linejoin: round;
	}

	.bfe-mmenu__view[hidden],
	.bfe-mmenu__list[hidden] {
		display: none;
	}

	.bfe-mmenu__all {
		display: flex;
		align-items: center;
		justify-content: space-between;
		min-height: 52px;
		padding: 0 20px;
		border-bottom: 1px solid var(--bfe-mega-line);
		color: var(--bfe-mega-green);
		font-size: 14px;
		font-weight: 600;
		text-decoration: none;
	}

	/* Cards, stacked: two small photos on the left, text on the right, so a long category stays short. */
	.bfe-mmenu .bfe-mega__cards {
		display: flex;
		flex-direction: column;
		gap: 0;
	}

	.bfe-mmenu .bfe-card {
		display: grid;
		grid-template-columns: max-content minmax(0, 1fr);
		gap: 16px;
		align-items: start;
		padding: 18px 20px;
		border-bottom: 1px solid var(--bfe-mega-line);
	}

	.bfe-mmenu .bfe-card__media {
		grid-column: 1;
		grid-row: 1;
	}

	.bfe-mmenu .bfe-card__text {
		grid-column: 2;
		grid-row: 1;
		min-width: 0;
	}

	.bfe-mmenu .bfe-card__thumbs {
		gap: 8px;
	}

	.bfe-mmenu .bfe-card__thumb {
		flex: 0 0 72px;
		width: 72px;
		border-radius: 10px;
	}

	.bfe-mmenu .bfe-card__title {
		font-size: 17px;
	}

	.bfe-mmenu .bfe-card__desc {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 4;
		overflow: hidden;
		margin-top: 6px;
		font-size: 13px;
	}

	.bfe-mmenu .bfe-card__cta {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
		margin-top: 4px;
		font-size: 14px;
	}

	.bfe-mmenu .bfe-mega__sizes {
		margin: 0;
		padding: 20px;
		border-top: 0;
	}

	.bfe-mmenu .bfe-mega__sizes a {
		display: flex;
		align-items: center;
		min-height: 40px;
		padding: 9px 16px;
		font-size: 14px;
	}

	.bfe-mmenu .bfe-mega__linklist {
		display: block;
		max-width: none;
		padding: 0 20px;
	}

	.bfe-mmenu .bfe-mega__linklist a {
		display: flex;
		align-items: center;
		min-height: 52px;
		padding: 0;
		border: 0;
		border-bottom: 1px solid var(--bfe-mega-line);
		border-radius: 0;
		font-size: 15px;
	}

	@media (prefers-reduced-motion: reduce) {
		.bfe-mmenu,
		.bfe-mmenu.is-open {
			transition: none;
		}
	}
}
