/**
 * Desktop-to-mobile collapse uses max-width because the desktop layout is the source and small screens simplify it. Queries are rem; 782px is the admin-bar exception only.
 *
 * Shop mega menu — Figma mega menu (894:1809).
 */

.site-nav__mega-trigger {
	display: inline-flex;
	align-items: center;
	gap: 0.5625rem;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: #ffffff;
	font-family: var(--font-inter);
	font-size: 1rem;
	font-weight: var(--font-weight-medium);
	line-height: 1.3;
	cursor: pointer;
	text-decoration: none;
}

.site-nav__mega-trigger:hover,
.site-nav__mega-trigger:focus-visible {
	color: #ffffff;
	opacity: 0.9;
}

.site-nav .menu-item-has-mega-menu > .site-nav__mega-trigger::after {
	content: "";
	display: block;
	width: 0.625rem;
	height: 0.625rem;
	background: url("../images/header/icon-chevron-down.svg") center / contain no-repeat;
	flex-shrink: 0;
	transform: rotate(90deg);
	transition: transform 0.28s ease;
}

.site-header.is-mega-menu-open .menu-item-has-mega-menu > .site-nav__mega-trigger::after {
	transform: rotate(-90deg);
}

.shop-mega-menu {
	--mega-duration: 0.38s;
	--mega-ease: cubic-bezier(0.22, 1, 0.36, 1);
	font-family: var(--font-inter);
	position: absolute;
	inset-inline: 0;
	top: 100%;
	z-index: 1;
	pointer-events: none;
}

.shop-mega-menu.is-open {
	pointer-events: auto;
}

.shop-mega-menu__backdrop {
	position: fixed;
	inset: 0;
	z-index: 0;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(20, 20, 20, 0.45);
	cursor: pointer;
	opacity: 0;
	transition: opacity var(--mega-duration) ease;
}

.shop-mega-menu.is-open .shop-mega-menu__backdrop {
	opacity: 1;
}

.shop-mega-menu__panel {
	position: relative;
	z-index: 1;
	overflow: hidden;
	min-height: 23.4375rem;
	background: var(--color-bg);
	border-bottom-left-radius: var(--header-radius);
	border-bottom-right-radius: var(--header-radius);
	box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.08);
	transform: translateY(-100%);
	transition: transform var(--mega-duration) var(--mega-ease);
	will-change: transform;
}

.shop-mega-menu.is-open .shop-mega-menu__panel {
	transform: translateY(0);
}

.shop-mega-menu__inner {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--space-lg);
	width: var(--content-shell);
	margin-inline: auto;
	padding-block: 2.125rem var(--space-xl);
}

.shop-mega-menu__grid {
	display: grid;
	grid-template-columns: repeat(6, 140px);
	justify-content: center;
	gap: 25px 15px;
	width: max-content;
	max-width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

.shop-mega-menu__grid--count-1 { grid-template-columns: 6.6875rem; }
.shop-mega-menu__grid--count-2 { grid-template-columns: repeat(2, 6.6875rem); }
.shop-mega-menu__grid--count-3 { grid-template-columns: repeat(3, 6.6875rem); }
.shop-mega-menu__grid--count-4 { grid-template-columns: repeat(4, 6.6875rem); }
.shop-mega-menu__grid--count-5 { grid-template-columns: repeat(5, 6.6875rem); }

.shop-mega-menu__item {
	opacity: 0;
	transform: translateY(-0.5rem);
	transition:
		opacity 0.28s ease,
		transform 0.32s var(--mega-ease);
}

.shop-mega-menu.is-open .shop-mega-menu__item {
	opacity: 1;
	transform: translateY(0);
}

.shop-mega-menu.is-open .shop-mega-menu__item:nth-child(1) { transition-delay: 0.04s; }
.shop-mega-menu.is-open .shop-mega-menu__item:nth-child(2) { transition-delay: 0.07s; }
.shop-mega-menu.is-open .shop-mega-menu__item:nth-child(3) { transition-delay: 0.1s; }
.shop-mega-menu.is-open .shop-mega-menu__item:nth-child(4) { transition-delay: 0.13s; }
.shop-mega-menu.is-open .shop-mega-menu__item:nth-child(5) { transition-delay: 0.16s; }
.shop-mega-menu.is-open .shop-mega-menu__item:nth-child(6) { transition-delay: 0.19s; }
.shop-mega-menu.is-open .shop-mega-menu__item:nth-child(7) { transition-delay: 0.22s; }
.shop-mega-menu.is-open .shop-mega-menu__item:nth-child(8) { transition-delay: 0.25s; }
.shop-mega-menu.is-open .shop-mega-menu__item:nth-child(9) { transition-delay: 0.28s; }
.shop-mega-menu.is-open .shop-mega-menu__item:nth-child(10) { transition-delay: 0.31s; }
.shop-mega-menu.is-open .shop-mega-menu__item:nth-child(11) { transition-delay: 0.34s; }

.shop-mega-menu:not(.is-open) .shop-mega-menu__item {
	transition-delay: 0s;
	transition-duration: 0.16s;
}

.shop-mega-menu__card {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.8125rem;
	width: 100%;
	color: var(--color-neutral-950);
	text-decoration: none;
}

.shop-mega-menu__thumb {
	position: relative;
	display: block;
	width: 140px;
    height: 115px;
	overflow: hidden;
	border: 1px solid var(--color-brand-primary);
	border-radius: 0.6875rem;
	background: #ffffff;
	transition:
		border-color 0.2s ease,
		box-shadow 0.2s ease,
		transform 0.2s ease;
}

.shop-mega-menu__image,
.shop-mega-menu__thumb img {
	position: absolute;
	inset: 0;
	display: block;
	box-sizing: border-box;
	width: 100%;
	max-width: none;
	height: 100%;
	padding: 0.375rem;
	object-fit: contain;
	object-position: center;
}

.shop-mega-menu__image--placeholder {
	background: linear-gradient(145deg, #f6f6f6 0%, #ececec 100%);
}

.shop-mega-menu__label {
	font-family: var(--font-inter);
	font-size: 12px;
	font-weight: var(--font-weight-bold);
	line-height: 1.2;
	text-align: center;
	white-space: nowrap;
}

.shop-mega-menu__card:hover .shop-mega-menu__thumb,
.shop-mega-menu__card:focus-visible .shop-mega-menu__thumb {
	border-color: #8f1a16;
	box-shadow: 0 0.375rem 0.875rem rgba(181, 34, 29, 0.14);
	transform: translateY(-0.125rem);
}

.shop-mega-menu__footer {
	display: flex;
	justify-content: center;
	opacity: 0;
	transform: translateY(-0.35rem);
	transition:
		opacity 0.28s ease 0.12s,
		transform 0.28s var(--mega-ease) 0.12s;
}

.shop-mega-menu.is-open .shop-mega-menu__footer {
	opacity: 1;
	transform: translateY(0);
}

.shop-mega-menu__all-link {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	color: var(--color-brand-primary);
	font-family: var(--font-inter);
	font-size: var(--font-size-sm);
	font-weight: var(--font-weight-medium);
	line-height: 1.3;
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.shop-mega-menu__all-link:hover,
.shop-mega-menu__all-link:focus-visible {
	text-decoration: underline;
}

.shop-mega-menu__empty {
	margin: 0;
	padding-block: var(--space-md);
	color: var(--color-text-muted);
	font-size: var(--font-size-sm);
	text-align: center;
}

body.is-shop-mega-menu-open {
	overflow: hidden;
}

@media (prefers-reduced-motion: reduce) {
	.shop-mega-menu,
	.shop-mega-menu__backdrop,
	.shop-mega-menu__panel,
	.shop-mega-menu__item,
	.shop-mega-menu__thumb,
	.shop-mega-menu__image,
	.shop-mega-menu__footer,
	.site-nav .menu-item-has-mega-menu > .site-nav__mega-trigger::after {
		transition-duration: 0.01ms !important;
		transition-delay: 0s !important;
	}
}

/* Between nav and xl: tighten mega grid without overlapping drawer bp. */
@media (min-width: 62rem) and (max-width: 75rem) {
	.shop-mega-menu__grid,
	.shop-mega-menu__grid--count-5,
	.shop-mega-menu__grid--count-4 {
		grid-template-columns: repeat(4, minmax(0, 6.6875rem));
	}
}

/* Drawer viewport (nav bp): title-only accordion, not image cards. */
@media (max-width: 61.9375rem) {
	.site-nav > .menu-item-has-mega-menu {
		flex-direction: column;
		align-items: stretch;
		width: 100%;
	}

	.site-nav__mega-trigger {
		width: 100%;
		justify-content: space-between;
		padding-block: 0.7rem;
		font-size: 1.0625rem;
	}

	.shop-mega-menu {
		position: static;
		inset: auto;
		z-index: 0;
		width: 100%;
	}

	.shop-mega-menu[hidden] {
		display: none;
	}

	.shop-mega-menu__backdrop {
		display: none;
	}

	.shop-mega-menu__panel {
		display: grid;
		grid-template-rows: 0fr;
		min-height: 0;
		overflow: hidden;
		background: transparent;
		border-radius: 0;
		box-shadow: none;
		transform: none;
		will-change: grid-template-rows;
		transition: grid-template-rows var(--mega-duration) var(--mega-ease);
	}

	.shop-mega-menu.is-open .shop-mega-menu__panel {
		grid-template-rows: 1fr;
		transform: none;
	}

	.shop-mega-menu__inner {
		display: flex;
		flex-direction: column;
		align-items: stretch;
		overflow: hidden;
		min-width: 0;
		min-height: 0;
		width: 100%;
		gap: 0;
		padding: 0 0 0.25rem;
	}

	.shop-mega-menu__grid,
	.shop-mega-menu__grid--count-1,
	.shop-mega-menu__grid--count-2,
	.shop-mega-menu__grid--count-3,
	.shop-mega-menu__grid--count-4,
	.shop-mega-menu__grid--count-5 {
		display: flex;
		flex-direction: column;
		grid-template-columns: none;
		width: 100%;
		max-width: none;
		gap: 0;
	}

	.shop-mega-menu__item {
		min-width: 0;
		width: 100%;
		opacity: 1;
		transform: none;
	}

	.shop-mega-menu.is-open .shop-mega-menu__item {
		opacity: 1;
		transform: none;
	}

	.shop-mega-menu__card {
		align-items: stretch;
		gap: 0;
		color: #ffffff;
	}

	.shop-mega-menu__thumb {
		display: none;
	}

	.shop-mega-menu__label {
		display: block;
		width: 100%;
		padding-block: 0.55rem;
		padding-inline: 0.875rem 0;
		font-family: var(--font-sans);
		font-size: 1.0625rem;
		font-weight: var(--font-weight-medium);
		line-height: 1.3;
		text-align: left;
		white-space: normal;
		color: #ffffff;
	}

	.shop-mega-menu__card:hover .shop-mega-menu__thumb,
	.shop-mega-menu__card:focus-visible .shop-mega-menu__thumb {
		box-shadow: none;
		transform: none;
	}

	.shop-mega-menu__card:hover .shop-mega-menu__label,
	.shop-mega-menu__card:focus-visible .shop-mega-menu__label {
		opacity: 0.9;
	}

	.shop-mega-menu__footer {
		justify-content: flex-start;
		width: 100%;
		opacity: 1;
		transform: none;
	}

	.shop-mega-menu.is-open .shop-mega-menu__footer {
		opacity: 1;
		transform: none;
	}

	.shop-mega-menu__all-link {
		justify-content: flex-start;
		width: 100%;
		padding-block: 0.55rem;
		padding-inline: 0.875rem 0;
		color: #ffffff;
		font-size: 1.0625rem;
		text-transform: none;
		letter-spacing: 0;
	}

	.shop-mega-menu__empty {
		padding-inline: 0.875rem;
		color: #ffffff;
		text-align: left;
	}
}
