/*
 * The category mega menu shared by the demos. Colours come from the niche
 * tokens so each demo's own brand and corners carry through.
 */

.prewebsite-mega {
	position: fixed;
	inset-block-start: 0;
	inset-inline: 0;
	z-index: 60;
	box-sizing: border-box;
	inline-size: min(var(--prewebsite-container, 1320px), 100vw - 32px);
	margin-inline: auto;
	border-radius: var(--prewebsite-radius-panel, 16px);
	background: var(--prewebsite-color-surface, #fff);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
	overflow: hidden;
}

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

.prewebsite-mega__inner {
	display: flex;
	align-items: stretch;
	block-size: min(440px, 70vh);
}

.prewebsite-mega__head,
.prewebsite-mega__close {
	display: none;
}

.prewebsite-mega__rail {
	flex: none;
	inline-size: 250px;
	margin: 0;
	padding: 20px 12px;
	background: var(--prewebsite-color-tint-1, #f6f6f6);
	list-style: none;
	overflow-y: auto;
	scrollbar-width: thin;
}

.prewebsite-mega__tab {
	display: flex;
	align-items: center;
	gap: 12px;
	inline-size: 100%;
	padding: 10px 14px;
	border: 0;
	border-radius: var(--prewebsite-radius-pill, 999px);
	background: none;
	color: var(--prewebsite-color-text, #222);
	font-family: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 24px;
	text-align: start;
	cursor: pointer;
	transition: background-color var(--prewebsite-transition), color var(--prewebsite-transition);
}

.prewebsite-mega__tab:hover {
	background: rgba(255, 255, 255, 0.7);
}

.prewebsite-mega__tab[aria-selected="true"] {
	background: var(--prewebsite-color-primary);
	color: #fff;
}

.prewebsite-mega__glyph {
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	inline-size: 36px;
	block-size: 36px;
	border-radius: 50%;
	background: var(--prewebsite-color-trim-strong, var(--prewebsite-color-primary));
	color: #fff;
	overflow: hidden;
}

.prewebsite-mega__glyph img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
}

.prewebsite-mega__panel {
	flex: 1;
	min-inline-size: 0;
	padding: 28px 32px;
	overflow-y: auto;
}

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

.prewebsite-mega__all {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin-block-end: 24px;
	color: var(--prewebsite-color-text, #222);
	font-size: 15px;
	font-weight: 700;
	text-decoration: none;
}

.prewebsite-mega__all:hover {
	color: var(--prewebsite-color-primary);
}

/* The groups flow into as many columns as fit. */
.prewebsite-mega__columns {
	column-width: 200px;
	column-gap: 32px;
}

.prewebsite-mega__group {
	break-inside: avoid;
	margin-block-end: 24px;
}

.prewebsite-mega__group-title {
	display: block;
	padding-inline-start: 10px;
	border-inline-start: 3px solid var(--prewebsite-color-primary);
	color: var(--prewebsite-color-text, #222);
	font-size: 14px;
	font-weight: 700;
	line-height: 24px;
	text-decoration: none;
}

.prewebsite-mega__group ul {
	margin: 8px 0 0;
	padding: 0 13px 0 0;
	list-style: none;
}

.prewebsite-mega__group li a {
	display: block;
	padding-block: 5px;
	color: var(--prewebsite-color-text-50, #777);
	font-size: 13px;
	line-height: 22px;
	text-decoration: none;
	transition: color var(--prewebsite-transition);
}

.prewebsite-mega__group li a:hover,
.prewebsite-mega__group-title:hover {
	color: var(--prewebsite-color-primary);
}

@media (max-width: 1023px) {
	/* A full screen sheet above the bottom bar, sliding in from the trailing
	   edge. */
	.prewebsite-mega {
		inset: 0;
		z-index: 90;
		inline-size: auto;
		border-radius: 0;
		background: var(--prewebsite-color-tint-1, #f6f6f6);
		box-shadow: none;
		transform: translateX(-100%);
		transition: transform 320ms cubic-bezier(0.2, 0, 0, 1);
	}

	[dir="rtl"] .prewebsite-mega {
		transform: translateX(100%);
	}

	.prewebsite-mega.is-open {
		transform: none;
	}

	.prewebsite-mega__inner {
		flex-wrap: wrap;
		align-content: stretch;
		block-size: 100%;
	}

	.prewebsite-mega__head {
		display: flex;
		flex: 0 0 100%;
		align-items: center;
		justify-content: space-between;
		block-size: 56px;
		padding-inline: 16px;
		border-block-end: 1px solid var(--prewebsite-color-trim-30, rgba(0, 0, 0, 0.08));
		font-size: 16px;
		font-weight: 700;
	}

	.prewebsite-mega__close {
		display: flex;
		align-items: center;
		justify-content: center;
		inline-size: 32px;
		block-size: 32px;
		padding: 0;
		border: 0;
		border-radius: 50%;
		background: var(--prewebsite-color-surface, #fff);
		color: var(--prewebsite-color-text, #222);
		font-size: 23px;
		line-height: 1;
		cursor: pointer;
	}

	.prewebsite-mega__rail {
		inline-size: 110px;
		block-size: calc(100% - 56px);
		padding: 8px 6px;
	}

	.prewebsite-mega__tab {
		flex-direction: column;
		gap: 6px;
		padding: 12px 4px;
		border-radius: 20px;
		font-size: 12px;
		line-height: 18px;
		text-align: center;
	}

	.prewebsite-mega__tab[aria-selected="true"] {
		background: var(--prewebsite-color-surface, #fff);
		color: var(--prewebsite-color-primary);
	}

	.prewebsite-mega__panel {
		block-size: calc(100% - 56px);
		padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
		background: var(--prewebsite-color-surface, #fff);
	}

	.prewebsite-mega__columns {
		column-width: auto;
		column-count: 1;
	}
}

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