/**
 * E-Grow Components: Flyout menu.
 *
 * Colours come from Settings > E-Grow Components (custom properties --egc-*).
 * Anything left empty there follows the theme.
 */

.egc-fly {
	--_accent: var(--egc-accent, currentColor);
	--_bg: var(--egc-bg, #fff);
	--_border: var(--egc-border, #e2e4e7);
	--_radius: var(--egc-radius, 6px);
	--_hover: rgba(0, 0, 0, 0.045);
	--_hover: color-mix(in srgb, var(--_accent) 8%, transparent);
	color: var(--egc-text);
	font-family: var(--egc-font, inherit);
	font-size: inherit;
	font-style: normal;
	font-weight: var(--egc-weight, inherit);
	line-height: 1.4;
	text-align: left;
}

.egc-fly,
.egc-fly * {
	box-sizing: border-box;
}

.egc-fly ul,
.egc-fly li {
	list-style: none;
	margin: 0;
	padding: 0;
}

.egc-fly li::before,
.egc-fly li::after {
	content: none;
}

.egc-fly [hidden],
.egc-fly[hidden] {
	display: none !important;
}

.egc-fly__title {
	margin: 0;
	padding: 0.85em 1em;
	font-weight: 600;
	border-bottom: 1px solid var(--_border);
}

/* Items */
.egc-fly .egc-fly__item {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: center;
	position: relative;
}

.egc-fly .egc-fly__list > .egc-fly__item + .egc-fly__item {
	border-top: 1px solid var(--_border);
}

.egc-fly .egc-fly__item > a {
	display: block;
	padding: 0.75em 1em;
	color: inherit;
	text-decoration: none;
	background: none;
	border: 0;
	box-shadow: none;
	transition: background-color 0.15s, color 0.15s;
}

.egc-fly .egc-fly__item > a:hover {
	background: var(--_hover);
	color: var(--_accent);
}

.egc-fly .is-current > a,
.egc-fly .is-current-parent > a {
	color: var(--_accent);
	font-weight: 600;
}

.egc-fly .egc-fly__toggle {
	all: unset;
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: 2.75em;
	height: 2.75em;
	cursor: pointer;
	color: inherit;
	border-radius: var(--_radius);
}

.egc-fly .egc-fly__toggle:hover {
	background: var(--_hover);
}

.egc-fly .egc-ico {
	display: block;
	width: 1.15em;
	height: 1.15em;
	transition: transform 0.2s;
}

/* Submenus as an accordion (phones and the panel) */
.egc-fly .egc-fly__sub {
	grid-column: 1 / -1;
	display: none;
	padding-left: 0.9em;
	border-top: 1px solid var(--_border);
}

.egc-fly .is-open > .egc-fly__sub {
	display: block;
}

.egc-fly .egc-fly__sub > .egc-fly__item + .egc-fly__item {
	border-top: 1px solid var(--_border);
}

.egc-fly .egc-fly__sub a {
	font-size: 0.95em;
}

.egc-fly .egc-fly__toggle .egc-ico {
	transform: rotate(90deg);
}

.egc-fly .is-open > .egc-fly__toggle .egc-ico {
	transform: rotate(-90deg);
}

/* Vertical layout */
.egc-fly--vertical {
	background: var(--_bg);
	border: 1px solid var(--_border);
	border-radius: var(--_radius);
}

/* Desktop: submenus open at the side on hover */
@media (hover: hover) and (min-width: 769px) {

	/* Hidden submenus use display:none so they never cause horizontal scrolling. */
	.egc-fly--vertical .egc-fly__sub {
		display: none;
		position: absolute;
		top: -1px;
		left: 100%;
		z-index: 60;
		min-width: 230px;
		padding: 0.3em 0;
		background: var(--_bg);
		border: 1px solid var(--_border);
		border-radius: var(--_radius);
		box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
	}

	.egc-fly--vertical .egc-fly__sub > .egc-fly__item + .egc-fly__item {
		border-top: 0;
	}

	.egc-fly--vertical .egc-has-sub:hover > .egc-fly__sub,
	.egc-fly--vertical .egc-has-sub:focus-within > .egc-fly__sub,
	.egc-fly--vertical .egc-has-sub.is-open > .egc-fly__sub {
		display: block;
		animation: egc-fly-r 0.16s ease-out both;
	}

	.egc-fly--vertical .egc-fly__toggle .egc-ico,
	.egc-fly--vertical .is-open > .egc-fly__toggle .egc-ico {
		transform: none;
	}

	/* Opening to the left */
	.egc-fly--dir-left .egc-fly__sub {
		left: auto;
		right: 100%;
	}

	.egc-fly--dir-left .egc-has-sub:hover > .egc-fly__sub,
	.egc-fly--dir-left .egc-has-sub:focus-within > .egc-fly__sub,
	.egc-fly--dir-left .egc-has-sub.is-open > .egc-fly__sub {
		animation-name: egc-fly-l;
	}

	.egc-fly--dir-left .egc-fly__toggle .egc-ico,
	.egc-fly--dir-left .is-open > .egc-fly__toggle .egc-ico {
		transform: rotate(180deg);
	}

	/* The submenu does not fit on screen: open on the other side (class set by flyout.js). */
	.egc-fly--vertical .egc-has-sub.egc-flip > .egc-fly__sub {
		left: auto;
		right: 100%;
		animation-name: egc-fly-l;
	}

	.egc-fly--dir-left .egc-has-sub.egc-flip > .egc-fly__sub {
		right: auto;
		left: 100%;
		animation-name: egc-fly-r;
	}
}

@keyframes egc-fly-r {
	from {
		opacity: 0;
		transform: translateX(6px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes egc-fly-l {
	from {
		opacity: 0;
		transform: translateX(-6px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* Panel layout */
.egc-fly--panel {
	display: inline-block;
}

/* The open button: menu icon, plus text when given, without a frame. */
.egc-fly .egc-fly__open {
	all: unset;
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.35em;
	cursor: pointer;
	font: inherit;
	line-height: 1.2;
	color: inherit;
	border-radius: var(--_radius);
	transition: opacity 0.15s;
}

.egc-fly .egc-fly__open:hover {
	opacity: 0.6;
}

.egc-fly .egc-fly__open .egc-ico {
	width: 1.6em;
	height: 1.6em;
	stroke-width: 1.8;
}

/* Focus ring for keyboard users only. */
.egc-fly .egc-fly__open:focus,
.egc-fly .egc-fly__toggle:focus,
.egc-fly .egc-fly__close:focus {
	outline: none;
	box-shadow: none;
}

.egc-fly .egc-fly__item > a:focus-visible,
.egc-fly .egc-fly__toggle:focus-visible,
.egc-fly .egc-fly__close:focus-visible {
	outline: 2px solid var(--_accent);
	outline-offset: -2px;
}

.egc-fly .egc-fly__open:focus-visible {
	outline: 2px solid var(--_accent);
	outline-offset: 2px;
}

.egc-fly__overlay {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: rgba(0, 0, 0, var(--egc-overlay, 0.75));
	opacity: 0;
	transition: opacity 0.35s;
}

.egc-fly__overlay.is-open {
	opacity: 1;
}

.egc-fly__overlay[hidden] {
	display: none !important;
}

.egc-fly.egc-fly__panel {
	position: fixed;
	top: 0;
	bottom: 0;
	left: 0;
	z-index: 99999;
	width: min(var(--egc-panel-w, 420px), 88vw);
	overflow-y: auto;
	overscroll-behavior: contain;
	background: var(--_bg);
	color: var(--egc-text, #1d2327);
	box-shadow: 0 0 40px rgba(0, 0, 0, 0.2);
	transform: translateX(-100%);
	transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
	padding-bottom: env(safe-area-inset-bottom, 0px);
}

.egc-fly.egc-fly__panel--right {
	left: auto;
	right: 0;
	transform: translateX(100%);
}

.egc-fly.egc-fly__panel.is-open {
	transform: none;
}

.egc-fly__head {
	position: sticky;
	top: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
	padding: calc(0.35em + env(safe-area-inset-top, 0px)) 0.35em 0.35em 0;
	background: var(--_bg);
	border-bottom: 1px solid var(--_border);
}

.egc-fly__head .egc-fly__title {
	border: 0;
	padding: 0.6em 1em;
}

.egc-fly .egc-fly__close {
	all: unset;
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: 2.75em;
	height: 2.75em;
	cursor: pointer;
	color: inherit;
	border-radius: var(--_radius);
}

.egc-fly .egc-fly__close:hover {
	background: var(--_hover);
}

/* Minimal style: no lines, arrow next to the text */
.egc-fly--look-minimal .egc-fly__item {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

.egc-fly--look-minimal .egc-fly__item > a {
	flex: 0 1 auto;
	padding: 0.8em 0.3em 0.8em 1.6em;
}

.egc-fly--look-minimal .egc-fly__sub .egc-fly__item > a {
	padding: 0.55em 0.3em 0.55em 1.6em;
	font-size: 0.94em;
}

.egc-fly--look-minimal .egc-fly__item > a:hover {
	background: none;
	color: var(--_accent);
	opacity: 0.7;
}

.egc-fly--look-minimal .egc-fly__toggle {
	flex: 0 0 auto;
	width: 1.9em;
	height: 1.9em;
}

.egc-fly--look-minimal .egc-fly__toggle:hover {
	background: none;
	opacity: 0.7;
}

.egc-fly--look-minimal .egc-fly__toggle .egc-ico {
	width: 0.8em;
	height: 0.8em;
	stroke-width: 3.2;
}

.egc-fly--look-minimal .egc-fly__item > .egc-fly__sub {
	flex: 1 0 100%;
	border-top: 0;
	padding: 0 0 0.4em 1em;
}

.egc-fly--look-minimal .egc-fly__list > .egc-fly__item + .egc-fly__item,
.egc-fly--look-minimal .egc-fly__sub > .egc-fly__item + .egc-fly__item {
	border-top: 0;
}

.egc-fly--look-minimal .egc-fly__list {
	padding: 0.6em 0 1.5em;
}

/* Vertical minimal: side submenus get their own spacing. */
@media (hover: hover) and (min-width: 769px) {

	.egc-fly--vertical.egc-fly--look-minimal .egc-fly__item > .egc-fly__sub {
		padding: 0.4em 0;
	}

	.egc-fly--vertical.egc-fly--look-minimal .egc-fly__sub .egc-fly__item > a {
		padding-left: 1.2em;
	}
}

/* Minimal panel: no line under the header, round close button. */
.egc-fly--look-minimal .egc-fly__head {
	border-bottom: 0;
	padding-right: 0.9em;
}

.egc-fly--look-minimal .egc-fly__head .egc-fly__title {
	padding: 0.9em 1.6em 0.2em;
}

.egc-fly.egc-fly--look-minimal .egc-fly__close {
	width: 2.3em;
	height: 2.3em;
	margin-top: 0.5em;
	border: 1.5px solid currentColor;
	border-radius: 50%;
}

.egc-fly.egc-fly--look-minimal .egc-fly__close:hover {
	background: none;
	opacity: 0.7;
}

.egc-fly--look-minimal .egc-fly__close .egc-ico {
	width: 1em;
	height: 1em;
	stroke-width: 2.6;
}

@media (prefers-reduced-motion: reduce) {

	.egc-fly *,
	.egc-fly.egc-fly__panel,
	.egc-fly__overlay {
		transition: none !important;
		animation: none !important;
	}
}

/* Item icons: menu item classes egc-icons and egc-icon-NAME.
   "a.egc-fly__link--icon" is stronger than the general ".egc-fly__item > a" rule. */
.egc-fly .egc-fly__item > a.egc-fly__link--icon {
	display: flex;
	align-items: center;
	gap: 14px;
}

.egc-fly .egc-fly__icon {
	display: block;
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
}

.egc-fly .egc-fly__label {
	min-width: 0;
}

/* A submenu with icons is shown in two columns in the panel. */
.egc-fly__panel .egc-icons.is-open > .egc-fly__sub {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: 12px;
}

.egc-fly__panel .egc-icons > .egc-fly__sub > .egc-fly__item + .egc-fly__item {
	border-top: 0;
}

/* ==========================================================================
   Modern style: uppercase items with wide letter spacing, thin plus and minus
   toggles, light blurred backdrop and a full screen panel on phones.
   ========================================================================== */

.egc-fly__overlay--look-modern {
	background: rgba(0, 0, 0, 0.28);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
}

.egc-fly.egc-fly__panel.egc-fly--look-modern {
	width: min(var(--egc-panel-w, 420px), 100vw);
	box-shadow: none;
	scrollbar-width: thin;
	scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
	transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@media (max-width: 480px) {

	.egc-fly.egc-fly__panel.egc-fly--look-modern {
		width: 100vw;
	}
}

/* Open button: two thin lines */
.egc-fly--look-modern .egc-fly__open .egc-ico {
	width: 1.55em;
	height: 1.55em;
	stroke-width: 1.25;
}

.egc-fly--look-modern .egc-fly__open:hover {
	opacity: 0.55;
}

/* Panel head with a thin close icon */
.egc-fly.egc-fly--look-modern .egc-fly__head {
	min-height: 72px;
	padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 0 32px;
	border-bottom: 0;
}

.egc-fly.egc-fly--look-modern .egc-fly__head .egc-fly__title {
	padding: 0;
	font-size: 11px;
	letter-spacing: 0.24em;
	text-transform: uppercase;
	opacity: 0.6;
}

.egc-fly.egc-fly--look-modern .egc-fly__close {
	width: 44px;
	height: 44px;
	margin: 0;
	border: 0;
	border-radius: 0;
}

.egc-fly.egc-fly--look-modern .egc-fly__close:hover {
	background: none;
	opacity: 1;
}

.egc-fly--look-modern .egc-fly__close .egc-ico {
	width: 22px;
	height: 22px;
	stroke-width: 1.25;
	transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.egc-fly--look-modern .egc-fly__close:hover .egc-ico {
	transform: rotate(90deg);
}

/* Items */
.egc-fly--look-modern .egc-fly__list {
	padding: 12px 0 48px;
}

.egc-fly.egc-fly--look-modern .egc-fly__item {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
}

.egc-fly--look-modern .egc-fly__list > .egc-fly__item + .egc-fly__item,
.egc-fly--look-modern .egc-fly__sub > .egc-fly__item + .egc-fly__item {
	border-top: 0;
}

.egc-fly.egc-fly--look-modern .egc-fly__list > .egc-fly__item > a {
	flex: 1 1 auto;
	padding: 14px 8px 14px 32px;
	font-size: 13px;
	letter-spacing: 0.18em;
	line-height: 1.5;
	text-transform: uppercase;
	transition: opacity 0.2s;
}

.egc-fly.egc-fly--look-modern .egc-fly__item > a:hover {
	background: none;
	color: inherit;
	opacity: 0.55;
}

.egc-fly.egc-fly--look-modern .is-current > a,
.egc-fly.egc-fly--look-modern .is-current-parent > a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 6px;
}

/* Plus and minus toggle, drawn with two thin lines */
.egc-fly.egc-fly--look-modern .egc-fly__toggle {
	position: relative;
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	margin-right: 16px;
	border-radius: 0;
}

.egc-fly.egc-fly--look-modern .egc-fly__toggle:hover {
	background: none;
	opacity: 0.55;
}

.egc-fly--look-modern .egc-fly__toggle .egc-ico {
	display: none;
}

.egc-fly--look-modern .egc-fly__toggle::before,
.egc-fly--look-modern .egc-fly__toggle::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: 11px;
	height: 1px;
	background: currentColor;
	transform: translate(-50%, -50%);
	transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.egc-fly--look-modern .egc-fly__toggle::after {
	transform: translate(-50%, -50%) rotate(90deg);
}

.egc-fly--look-modern .is-open > .egc-fly__toggle::after {
	transform: translate(-50%, -50%) rotate(0deg);
}

/* Submenus */
.egc-fly.egc-fly--look-modern .egc-fly__item > .egc-fly__sub {
	flex: 1 0 100%;
	padding: 0 0 14px;
	border-top: 0;
}

.egc-fly--look-modern .is-open > .egc-fly__sub {
	animation: egc-fly-down 0.3s ease both;
}

.egc-fly.egc-fly--look-modern .egc-fly__sub .egc-fly__item > a {
	flex: 1 1 auto;
	padding: 7px 8px 7px 48px;
	font-size: 15px;
	letter-spacing: 0.02em;
	text-transform: none;
	opacity: 0.7;
}

.egc-fly.egc-fly--look-modern .egc-fly__sub .egc-fly__item > a:hover {
	opacity: 1;
}

/* Items appear one after the other when the panel opens */
.egc-fly__panel.egc-fly--look-modern.is-open .egc-fly__list > li {
	animation: egc-fly-up 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.egc-fly__panel.egc-fly--look-modern.is-open .egc-fly__list > li:nth-child(1) { animation-delay: 0.06s; }
.egc-fly__panel.egc-fly--look-modern.is-open .egc-fly__list > li:nth-child(2) { animation-delay: 0.1s; }
.egc-fly__panel.egc-fly--look-modern.is-open .egc-fly__list > li:nth-child(3) { animation-delay: 0.14s; }
.egc-fly__panel.egc-fly--look-modern.is-open .egc-fly__list > li:nth-child(4) { animation-delay: 0.18s; }
.egc-fly__panel.egc-fly--look-modern.is-open .egc-fly__list > li:nth-child(5) { animation-delay: 0.22s; }
.egc-fly__panel.egc-fly--look-modern.is-open .egc-fly__list > li:nth-child(6) { animation-delay: 0.26s; }
.egc-fly__panel.egc-fly--look-modern.is-open .egc-fly__list > li:nth-child(7) { animation-delay: 0.3s; }
.egc-fly__panel.egc-fly--look-modern.is-open .egc-fly__list > li:nth-child(n+8) { animation-delay: 0.34s; }

@keyframes egc-fly-up {
	from {
		opacity: 0;
		transform: translateY(10px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes egc-fly-down {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

@media (prefers-reduced-motion: reduce) {

	.egc-fly__panel.egc-fly--look-modern.is-open .egc-fly__list > li,
	.egc-fly--look-modern .is-open > .egc-fly__sub {
		animation: none !important;
	}
}

/* Modern style: submenu with icons */
.egc-fly.egc-fly--look-modern .egc-icons > .egc-fly__sub {
	padding: 2px 20px 18px 32px;
}

.egc-fly.egc-fly--look-modern .egc-icons > .egc-fly__sub .egc-fly__item > a {
	padding: 10px 0;
	font-size: 14px;
	letter-spacing: 0.04em;
}
