/*
 * UT Offcanvas Menu
 *
 * Colors, width and the breakpoint are set per site as custom properties by the plugin (see inline CSS).
 * The values below are only fallbacks.
 */

.ut-ocm {
	--ut-ocm-width: 380px;
	--ut-ocm-bg: #fff;
	--ut-ocm-text: #333;
	--ut-ocm-accent: #017a45;
	--ut-ocm-on-accent: #fff;
	--ut-ocm-marker: #017a45;
	--ut-ocm-line: rgba(51, 51, 51, .14);
	--ut-ocm-tint: rgba(51, 51, 51, .06);
	--ut-ocm-shade: rgba(0, 0, 0, .55);
	--ut-ocm-speed: .3s;
	--ut-ocm-ease: cubic-bezier(.22, .61, .36, 1);

	position: fixed;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	z-index: 999999; /* above Divi's header (99999/100000) and the admin bar (99999) */
	visibility: hidden;
	pointer-events: none;
	/* hidden only after the closing animation has finished */
	transition: visibility 0s linear var(--ut-ocm-speed);
	font-size: 16px;
	line-height: 1.4;
	text-align: left;
	-webkit-text-size-adjust: 100%;
}

.ut-ocm.is-open {
	visibility: visible;
	pointer-events: auto;
	transition-delay: 0s;
}

/* ---- Reset: keep Divi's/WooCommerce's global element styles out of the panel ---------------------------------- */

.ut-ocm *,
.ut-ocm *::before,
.ut-ocm *::after {
	box-sizing: border-box;
}

.ut-ocm ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.ut-ocm li {
	margin: 0;
	padding: 0;
	list-style: none;
	float: none;
	width: auto;
}

.ut-ocm a {
	background: none;
	border: 0;
	box-shadow: none;
}

/*
 * Link color/underline: themes colour links per state and per color scheme (Divi: ".et_color_scheme_orange a"),
 * with the same specificity as a plain ".ut-ocm a" – so these use the class and cover every state.
 */
.ut-ocm .ut-ocm__link,
.ut-ocm .ut-ocm__link:hover,
.ut-ocm .ut-ocm__link:focus,
.ut-ocm .ut-ocm__link:active,
.ut-ocm .ut-ocm__link:visited {
	color: inherit;
	text-decoration: none;
}

.ut-ocm button {
	-webkit-appearance: none;
	appearance: none;
	margin: 0;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	color: inherit;
	font: inherit;
	line-height: 1;
	text-transform: none;
	cursor: pointer;
}

.ut-ocm svg {
	display: block;
}

/* ---- Overlay + panel ------------------------------------------------------------------------------------------- */

.ut-ocm__overlay {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	left: 0;
	background: var(--ut-ocm-shade);
	opacity: 0;
	transition: opacity var(--ut-ocm-speed) var(--ut-ocm-ease);
	-webkit-tap-highlight-color: transparent;
	touch-action: none;
}

.ut-ocm.is-open .ut-ocm__overlay {
	opacity: 1;
}

.ut-ocm__panel {
	position: absolute;
	top: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: min(var(--ut-ocm-width), 88vw);
	max-width: 100%;
	background: var(--ut-ocm-bg);
	color: var(--ut-ocm-text);
	box-shadow: 0 0 32px rgba(0, 0, 0, .28);
	transition: transform var(--ut-ocm-speed) var(--ut-ocm-ease);
	outline: 0;
}

.ut-ocm--left .ut-ocm__panel {
	left: 0;
	transform: translateX(-102%);
}

.ut-ocm--right .ut-ocm__panel {
	right: 0;
	transform: translateX(102%);
}

.ut-ocm.is-open .ut-ocm__panel {
	transform: none;
}

/* ---- Header (title + close): a bar in the accent color --------------------------------------------------------- */

.ut-ocm__header {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 64px;
	padding: 0 8px 0 20px;
	padding-top: env(safe-area-inset-top, 0);
	background: var(--ut-ocm-accent);
	color: var(--ut-ocm-on-accent);
	border-bottom: 1px solid var(--ut-ocm-line); /* only visible when the bar and the panel share a color */
}

.ut-ocm__title {
	flex: 1 1 auto;
	min-width: 0;
	padding-right: 12px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: .12em;
}

.ut-ocm .ut-ocm__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
}

/* ---- Navigation ------------------------------------------------------------------------------------------------ */

/* the scrolling area: main menu + additional links */
.ut-ocm__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-x: hidden;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding-bottom: env(safe-area-inset-bottom, 0);
}

.ut-ocm .ut-ocm__item {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	align-items: stretch;
}

.ut-ocm .ut-ocm__list--root > .ut-ocm__item {
	border-bottom: 1px solid var(--ut-ocm-line);
}

/* link */
.ut-ocm .ut-ocm__link {
	grid-column: 1;
	grid-row: 1;
	display: block;
	min-width: 0;
	padding: 16px 20px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere;
	-webkit-hyphens: auto;
	hyphens: auto;
	-webkit-tap-highlight-color: transparent;
}

.ut-ocm .ut-ocm__list--depth-1 > .ut-ocm__item > .ut-ocm__link {
	padding: 12px 20px 12px 34px;
	font-size: 15px;
	font-weight: 400;
}

.ut-ocm .ut-ocm__list--depth-2 > .ut-ocm__item > .ut-ocm__link,
.ut-ocm .ut-ocm__list--depth-3 > .ut-ocm__item > .ut-ocm__link {
	padding: 11px 20px 11px 48px;
	font-size: 14px;
	font-weight: 400;
}

.ut-ocm .ut-ocm__list--depth-3 > .ut-ocm__item > .ut-ocm__link {
	padding-left: 62px;
}

/* parents inside a sub-list stay a little stronger so the tree reads well */
.ut-ocm .ut-ocm__list--sub > .ut-ocm__item--has-children > .ut-ocm__link {
	font-weight: 600;
}

/* current page: accent marker + weight (not color alone) */
.ut-ocm .ut-ocm__item--current > .ut-ocm__link,
.ut-ocm .ut-ocm__item--ancestor > .ut-ocm__link {
	box-shadow: inset 4px 0 0 var(--ut-ocm-marker);
}

.ut-ocm .ut-ocm__item--current > .ut-ocm__link {
	font-weight: 700;
}

.ut-ocm .ut-ocm__item--overview > .ut-ocm__link {
	font-style: italic;
	opacity: .85;
}

/* menu-item icons (Menu Icons plugin) – and show the label even where the site hides it next to an icon on desktop */
.ut-ocm .ut-ocm__link img {
	display: inline-block;
	width: auto;
	max-width: none;
	height: 20px;
	margin: -2px 12px 0 0;
	vertical-align: middle;
}

.ut-ocm .ut-ocm__link span {
	display: inline;
}

/* on a dark panel (background chosen dark in the settings) dark icons would vanish: show them light */
.ut-ocm--dark .ut-ocm__link img {
	-webkit-filter: brightness(0) invert(1);
	filter: brightness(0) invert(1);
}

/* additional links (e.g. account, wishlist): a quiet single-level list below the main menu */
.ut-ocm .ut-ocm__nav--secondary {
	padding: 10px 0 14px;
}

.ut-ocm .ut-ocm__list--secondary > .ut-ocm__item > .ut-ocm__link {
	padding: 12px 20px;
	font-size: 15px;
	font-weight: 400;
}

/* cart item (Menu Bar Cart): its plugin writes a bare <a class="wpmenucart-contents"> inside the <li> and refreshes it over
   AJAX, so it is styled by position, not by our link class. Icon + label + live amount in one row. */
.ut-ocm .ut-ocm__item--cart > a,
.ut-ocm .ut-ocm__item--cart > a:hover,
.ut-ocm .ut-ocm__item--cart > a:focus,
.ut-ocm .ut-ocm__item--cart > a:active,
.ut-ocm .ut-ocm__item--cart > a:visited {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 4px 10px;
	min-width: 0;
	padding: 16px 20px;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.35;
	color: inherit;
	text-decoration: none;
	-webkit-tap-highlight-color: transparent;
}

.ut-ocm .ut-ocm__item--cart > a i {
	display: inline-block;
	flex: none;
	color: inherit;
}

.ut-ocm .ut-ocm__item--cart > a .amount,
.ut-ocm .ut-ocm__item--cart > a .cartcontents {
	display: inline;
	color: inherit;
}

/* Menu Bar Cart hides an empty cart by itself (".empty-wpmenucart"); keep that, and the cart/checkout page setting */
.ut-ocm .ut-ocm__item--cart.empty-wpmenucart,
.ut-ocm .ut-ocm__item--cart.hidden-wpmenucart {
	display: none;
}

/* in the additional-links list the cart is as quiet as the other entries */
.ut-ocm .ut-ocm__list--secondary > .ut-ocm__item--cart > a {
	padding: 12px 20px;
	font-size: 15px;
	font-weight: 400;
}

/* arrow button */
.ut-ocm .ut-ocm__toggle {
	grid-column: 2;
	grid-row: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 54px;
	border-left: 1px solid var(--ut-ocm-line);
	-webkit-tap-highlight-color: transparent;
}

.ut-ocm__chevron {
	transition: transform var(--ut-ocm-speed) var(--ut-ocm-ease);
}

.ut-ocm .ut-ocm__item.is-open > .ut-ocm__toggle .ut-ocm__chevron {
	transform: rotate(180deg);
}

.ut-ocm .ut-ocm__item.is-open > .ut-ocm__link,
.ut-ocm .ut-ocm__item.is-open > .ut-ocm__toggle {
	background: var(--ut-ocm-tint);
}

/* ---- Sub-lists: animate height without measuring it (grid 0fr -> 1fr) ------------------------------------------ */

.ut-ocm .ut-ocm__sub {
	grid-column: 1 / -1;
	grid-row: 2;
	display: grid;
	grid-template-rows: 0fr;
	visibility: hidden; /* keeps collapsed links out of the tab order and away from screen readers */
	transition: grid-template-rows var(--ut-ocm-speed) var(--ut-ocm-ease), visibility 0s linear var(--ut-ocm-speed);
}

.ut-ocm .ut-ocm__item.is-open > .ut-ocm__sub {
	grid-template-rows: 1fr;
	visibility: visible;
	transition-delay: 0s, 0s;
}

.ut-ocm .ut-ocm__sub-inner {
	min-height: 0;
	overflow: hidden;
	background: var(--ut-ocm-tint);
}

.ut-ocm .ut-ocm__list--sub {
	padding: 4px 0 8px;
}

/* ---- States ---------------------------------------------------------------------------------------------------- */

@media (hover: hover) {
	.ut-ocm .ut-ocm__link:hover,
	.ut-ocm .ut-ocm__item--cart > a:hover,
	.ut-ocm .ut-ocm__toggle:hover,
	.ut-ocm .ut-ocm__close:hover {
		background: var(--ut-ocm-tint);
	}
}

/* touch screens have no hover: show the press */
.ut-ocm .ut-ocm__link:active,
.ut-ocm .ut-ocm__item--cart > a:active,
.ut-ocm .ut-ocm__toggle:active,
.ut-ocm .ut-ocm__close:active {
	background: var(--ut-ocm-line);
}

/* the close button sits on the accent bar: lighten instead of darken */
.ut-ocm .ut-ocm__header .ut-ocm__close:hover {
	background: rgba(255, 255, 255, .18);
}

.ut-ocm .ut-ocm__header .ut-ocm__close:active {
	background: rgba(255, 255, 255, .3);
}

.ut-ocm .ut-ocm__link:focus-visible,
.ut-ocm .ut-ocm__item--cart > a:focus-visible,
.ut-ocm .ut-ocm__toggle:focus-visible,
.ut-ocm .ut-ocm__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: -3px;
}

/* ---- Page behind the panel ------------------------------------------------------------------------------------- */

/* (The rule that locks page scrolling while the panel is open lives in the plugin's inline CSS, inside the
   breakpoint media query – so it can never lock scrolling on desktop.) */

/* The script resets the open/closed state without animating it while the panel is not visible. */
.ut-ocm.ut-ocm--instant *,
.ut-ocm.ut-ocm--instant *::before,
.ut-ocm.ut-ocm--instant *::after {
	transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
	.ut-ocm,
	.ut-ocm *,
	.ut-ocm *::before,
	.ut-ocm *::after {
		transition-duration: 0s !important;
		transition-delay: 0s !important;
	}
}

@media print {
	.ut-ocm {
		display: none !important;
	}
}
