/**
 * Header, desktop submenu and mobile navigation states.
 */

.myc-nav a,
.myc-cart-link,
.myc-account-link,
.myc-mobile-menu-item a,
.myc-mobile-menu-item button {
	transition: color var(--ps-transition-fast), background-color var(--ps-transition-fast), opacity var(--ps-transition-fast);
}

.myc-nav a:hover,
.myc-nav a:focus-visible {
	color: var(--ps-color-brand-600);
	opacity: 1;
}

@media (hover: hover) and (pointer: fine) {
	.myc-cart-link:hover,
	.myc-account-link:hover {
		color: var(--ps-color-brand-600);
	}
}

.myc-cart-link:focus-visible,
.myc-account-link:focus-visible {
	color: var(--ps-color-brand-600);
}

.myc-header-actions {
	display: inline-flex;
	grid-column: 3;
	align-items: center;
	justify-self: end;
	gap: var(--ps-space-2);
}

.myc-site-search {
	display: inline-flex;
	align-items: center;
	min-width: 0;
	border: 1px solid var(--ps-color-border);
	border-radius: var(--ps-radius-sm);
	background: var(--ps-color-surface);
	transition: border-color var(--ps-transition-fast), background-color var(--ps-transition-fast);
}

.myc-site-search:focus-within {
	border-color: var(--ps-color-brand-600);
	background: var(--ps-color-surface);
}

/* The shared focus rule is intentionally replaced here by the component's
 * full-width border so a focused search input never draws a second outline. */
.myc-app-body .myc-site-search :is(input, button):focus,
.myc-app-body .myc-site-search :is(input, button):focus-visible {
	box-shadow: none;
	outline: none;
	-webkit-tap-highlight-color: transparent;
}

.myc-site-search input {
	width: 100%;
	min-width: 0;
	height: 36px;
	padding: 0 0 0 var(--ps-space-3);
	border: 0;
	background: transparent;
	color: var(--ps-color-text);
	font: inherit;
	font-size: 13px;
	font-weight: 650;
	outline: 0;
}

.myc-site-search input::placeholder {
	color: var(--ps-color-text-muted);
	opacity: 1;
}

.myc-site-search button {
	display: inline-grid;
	width: 36px;
	height: 36px;
	flex: 0 0 36px;
	place-items: center;
	padding: 0;
	border: 0;
	border-radius: 0 var(--ps-radius-sm) var(--ps-radius-sm) 0;
	background: transparent;
	color: var(--ps-color-text-muted);
	cursor: pointer;
}

.myc-site-search button svg {
	width: 18px;
	height: 18px;
	fill: currentcolor;
}

@media (hover: hover) {
	.myc-site-search:hover {
		border-color: var(--ps-color-text-muted);
	}

	.myc-site-search button:hover {
		color: var(--ps-color-brand-700);
	}
}

.myc-site-search button:focus-visible {
	color: var(--ps-color-brand-700);
}

.myc-mobile-site-search-wrap {
	display: none;
}

.myc-account-link {
	display: inline-grid;
	width: 36px;
	height: 36px;
	place-items: center;
	border: 1px solid transparent;
	border-radius: 50%;
	background: transparent;
	color: var(--ps-color-text);
	text-decoration: none;
	transition: color var(--ps-transition-fast), border-color var(--ps-transition-fast), background-color var(--ps-transition-fast);
}

.myc-account-link svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentcolor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
	transform: translateY(-1px);
}

@media (hover: hover) and (pointer: fine) {
	.myc-account-link:hover,
	.myc-account-menu:hover > .myc-account-link {
		border-color: var(--ps-color-brand-border);
		background: var(--ps-color-brand-50);
	}
}

.myc-account-link:focus-visible,
.myc-account-menu:focus-within > .myc-account-link {
	border-color: var(--ps-color-brand-border);
	background: var(--ps-color-brand-50);
}

.myc-account-link--mobile {
	display: none;
}

.myc-account-menu {
	position: relative;
}

.myc-account-menu::after {
	position: absolute;
	top: 100%;
	right: 0;
	width: 210px;
	height: 10px;
	content: '';
}

.myc-account-dropdown {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	display: grid;
	min-width: 210px;
	gap: 2px;
	padding: var(--ps-space-2);
	border: 1px solid var(--ps-color-border);
	border-radius: var(--ps-radius-md);
	background: var(--ps-color-surface);
	box-shadow: 0 18px 38px rgb(23 19 21 / 14%);
	z-index: 1001;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(6px) scale(.985);
	transform-origin: top right;
	transition: opacity .16s ease, transform .2s ease, visibility 0s linear .2s;
}

.myc-account-menu:hover > .myc-account-dropdown,
.myc-account-menu:focus-within > .myc-account-dropdown {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: translateY(0) scale(1);
	transition-delay: 0s;
}

.myc-account-dropdown p {
	margin: 0;
	padding: var(--ps-space-2) var(--ps-space-3) var(--ps-space-4);
	border-bottom: 1px solid var(--ps-color-border);
	color: var(--ps-color-text-muted);
	font-size: 12px;
	font-weight: 750;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.myc-account-dropdown a {
	padding: 10px var(--ps-space-3);
	border-radius: var(--ps-radius-sm);
	color: var(--ps-color-text);
	font-size: 14px;
	font-weight: 700;
	text-decoration: none;
}

.myc-account-dropdown a:hover,
.myc-account-dropdown a:focus-visible {
	background: var(--ps-color-brand-50);
	color: var(--ps-color-brand-700);
	outline: none;
}

.myc-header-actions .myc-cart-link {
	position: relative;
	display: inline-grid;
	width: 36px;
	height: 36px;
	place-items: center;
	padding: 0;
	border: 1px solid transparent;
	border-radius: 50%;
	background: transparent;
}

.myc-header-actions .myc-cart-link svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentcolor;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 1.8;
}

.myc-header-actions .myc-cart-link > span[data-cart-count] {
	position: absolute;
	top: -4px;
	right: -2px;
	display: block;
	min-width: 18px;
	height: 18px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--ps-color-brand-600);
	color: var(--ps-color-surface);
	font-size: 10px;
	font-weight: 500;
	line-height: 18px;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.myc-brand--logo {
	gap: 0;
	padding-block: var(--ps-space-3);
}

.myc-brand-image {
	display: block;
	width: min(var(--myc-brand-logo-width), 100%);
	height: auto;
}

/*
 * The announcement strip. Full-bleed colour with the text on the header's
 * measure, so it reads as a band across the page rather than a sentence
 * floating above the logo. It is the only part of the header a shopkeeper
 * writes, and it disappears entirely when they leave it empty.
 */
.myc-topbar-announce {
	background: var(--ps-color-brand-800);
	color: #fff;
	font-size: 13px;
	line-height: 1.4;
	letter-spacing: .01em;
	text-align: center;
}

.myc-topbar-announce-inner {
	padding-top: 12px;
	padding-bottom: 12px;
}

.myc-topbar-announce a {
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/*
 * Social links and the secondary menu are desktop furniture. On a phone the
 * header has to leave room for the catalogue, and both sets of links are in
 * the footer of every page, so this row is not rendered small — it is not
 * rendered at all below the breakpoint where the desktop menu appears.
 */
.myc-topbar-secondary,
.myc-topbar-main-nav {
	display: none;
}

@media (min-width: 1081px) {
	.myc-site-search--desktop {
		/*
		 * Wider than it was, because it no longer shares the right-hand side
		 * with the cart: it has the middle column to itself, and searching is
		 * what most visitors come to do. Still bounded, so it does not run into
		 * the logo on a narrow laptop or stretch across a very wide screen.
		 */
		width: clamp(320px, 38vw, 620px);
	}

	/*
	 * Four bands on desktop, in the order a visitor needs them: what the shop
	 * is announcing, where to find it and reach it, what it sells, and how it
	 * is organised.
	 *
	 * The middle band is the one that matters. Search takes the centre column
	 * rather than sitting beside the cart, because it is the widest part of the
	 * header and searching is what most visitors come to do; the logo and the
	 * account and cart icons take an equal column each side, so the field stays
	 * centred on the page whatever the logo's width turns out to be.
	 */
	.myc-topbar-secondary {
		display: block;
		border-bottom: 1px solid var(--ps-color-border);
	}

	.myc-topbar-secondary-inner {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: var(--ps-space-4);
		min-height: 38px;
	}

	.myc-topbar-socials {
		display: inline-flex;
		align-items: center;
		gap: var(--ps-space-2);
	}

	.myc-topbar-social-link {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		color: var(--ps-color-text-muted);
		transition: color var(--ps-transition-fast);
	}

	/*
	 * WhatsApp and Facebook are one filled path each; Instagram is a rounded
	 * square, a lens and a dot, so its outlines are stroked and only the dot is
	 * filled. Same treatment as the footer's icons, at the smaller size this row
	 * calls for.
	 */
	.myc-topbar-social-link svg {
		width: 17px;
		height: 17px;
		fill: currentcolor;
	}

	.myc-topbar-social-link svg rect,
	.myc-topbar-social-link svg circle {
		fill: none;
		stroke: currentcolor;
		stroke-width: 1.8;
	}

	.myc-topbar-social-link svg .myc-footer-social-dot {
		fill: currentcolor;
		stroke: 0;
	}

	.myc-topbar-social-link:not(.is-unavailable):hover,
	.myc-topbar-social-link:not(.is-unavailable):focus-visible {
		color: var(--ps-color-brand-600);
	}

	/* A network with no URL saved keeps its place without inviting a click. */
	.myc-topbar-social-link.is-unavailable {
		opacity: .42;
		pointer-events: none;
	}

	.myc-secondary-nav-list {
		display: flex;
		align-items: center;
		gap: var(--ps-space-4);
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.myc-secondary-nav-list a {
		color: var(--myc-muted);
		font-size: 13px;
		text-decoration: none;
		transition: color var(--ps-transition-fast);
	}

	.myc-secondary-nav-list a:hover,
	.myc-secondary-nav-list a:focus-visible {
		color: var(--ps-color-brand-600);
	}

	.myc-topbar-inner {
		grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	}

	.myc-brand {
		grid-column: 1;
		justify-self: start;
	}

	.myc-site-search--desktop {
		grid-column: 2;
	}

	.myc-header-actions {
		grid-column: 3;
		justify-self: end;
	}

	/*
	 * The menu spans the page rather than the space the logo leaves, so it
	 * centres on the header and not on whatever is left over.
	 *
	 * A shade darker than the page, and full-bleed rather than only under the
	 * links, so the band reads as the base of the header instead of a stripe
	 * floating in it. The vertical padding is the row's own: the row above ends
	 * at the logo, and with nothing underneath the menu sat flush against the
	 * border and read as clipped.
	 */
	.myc-topbar-main-nav {
		display: block;
		border-top: 1px solid var(--ps-color-border);
		background: var(--ps-color-surface-muted);
	}

	.myc-topbar-main-nav-inner {
		padding-top: var(--ps-space-3);
		padding-bottom: var(--ps-space-3);
	}

	.myc-nav-list > li {
		position: relative;
	}

	.myc-nav-list > li.myc-has-mega-menu > a {
		display: inline-flex;
		align-items: center;
		gap: 7px;
	}

	.myc-nav-list > li.myc-has-mega-menu > a::after {
		width: 7px;
		height: 7px;
		border-right: 1.5px solid currentColor;
		border-bottom: 1.5px solid currentColor;
		content: "";
		transform: translateY(-2px) rotate(45deg);
		transition: transform var(--ps-transition-fast);
	}

	.myc-nav-list > li.myc-has-mega-menu:hover > a::after,
	.myc-nav-list > li.myc-has-mega-menu:focus-within > a::after {
		transform: translateY(2px) rotate(225deg);
	}

	.myc-nav-list > li > .sub-menu {
		position: absolute;
		top: calc(100% + 10px);
		left: 50%;
		display: grid;
		width: min(860px, calc(100vw - 48px));
		gap: var(--ps-space-2);
		margin: 0;
		padding: var(--ps-space-4);
		border: 1px solid var(--ps-color-border);
		border-radius: var(--ps-radius-md);
		background: var(--ps-color-surface);
		box-shadow: 0 20px 42px rgb(23 19 21 / 14%);
		list-style: none;
		opacity: 0;
		pointer-events: none;
		transform: translateX(-50%) translateY(8px) scale(.985);
		transform-origin: 50% 0;
		transition: opacity .16s ease, transform .2s cubic-bezier(.22, .61, .36, 1), visibility 0s linear .2s;
		visibility: hidden;
	}

	.myc-nav-list > li > .sub-menu::before {
		position: absolute;
		top: -14px;
		right: 0;
		left: 0;
		height: 14px;
		content: "";
	}

	.myc-nav-list > li:hover > .sub-menu,
	.myc-nav-list > li:focus-within > .sub-menu {
		opacity: 1;
		pointer-events: auto;
		transform: translateX(-50%) translateY(0) scale(1);
		transition-delay: 0s;
		visibility: visible;
	}

	.myc-nav-list > li.myc-has-mega-menu.myc-mega-menu-columns-1 > .sub-menu {
		width: min(286px, calc(100vw - 48px));
		grid-template-columns: minmax(0, 1fr);
	}

	.myc-nav-list > li.myc-has-mega-menu.myc-mega-menu-columns-2 > .sub-menu {
		width: min(470px, calc(100vw - 48px));
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.myc-nav-list > li.myc-has-mega-menu.myc-mega-menu-columns-3 > .sub-menu {
		width: min(660px, calc(100vw - 48px));
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.myc-nav-list > li.myc-has-mega-menu.myc-mega-menu-columns-4 > .sub-menu {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.myc-nav-list > li.myc-has-mega-menu.myc-mega-menu-columns-5 > .sub-menu {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}

	.myc-nav-list > li:not(.myc-has-mega-menu) > .sub-menu {
		width: max-content;
		min-width: 190px;
		padding: var(--ps-space-2);
	}

	.myc-nav-list > li > .sub-menu > li {
		min-width: 0;
	}

	.myc-nav-list > li > .sub-menu > li > a {
		display: flex;
		align-items: center;
		gap: var(--ps-space-2);
		min-height: 44px;
		border: 1px solid transparent;
		border-radius: var(--ps-radius-sm);
		color: var(--ps-color-text);
		font-size: 14px;
		font-weight: 750;
		line-height: 1.25;
		text-decoration: none;
	}

	.myc-nav-list > li.myc-has-mega-menu > .sub-menu > li:not(.menu-item-has-children) > a {
		min-height: 54px;
		padding: var(--ps-space-3);
		background: var(--ps-color-surface-subtle);
	}

	.myc-nav-list > li.myc-has-mega-menu > .sub-menu > li.menu-item-has-children > a {
		min-height: auto;
		padding: var(--ps-space-2) var(--ps-space-2) var(--ps-space-2);
		color: var(--ps-color-text);
		font-size: 13px;
		font-weight: 850;
	}

	.myc-nav-list > li > .sub-menu > li > .sub-menu {
		display: grid;
		gap: 2px;
		margin: 0;
		padding: 0;
		list-style: none;
	}

	.myc-nav-list > li > .sub-menu > li > .sub-menu a {
		display: flex;
		align-items: center;
		gap: var(--ps-space-2);
		min-height: 38px;
		padding: var(--ps-space-2);
		border: 1px solid transparent;
		border-radius: var(--ps-radius-sm);
		color: var(--ps-color-text-muted);
		font-size: 13px;
		font-weight: 650;
		line-height: 1.25;
		text-decoration: none;
	}

	.myc-desktop-menu-image {
		display: block;
		width: 28px;
		height: 28px;
		flex: 0 0 28px;
		border-radius: var(--ps-radius-sm);
		object-fit: cover;
	}

	.myc-nav-list > li > .sub-menu > li > .sub-menu .myc-desktop-menu-image {
		width: 20px;
		height: 20px;
		flex-basis: 20px;
	}

	.myc-nav-list > li > .sub-menu > li > a:hover,
	.myc-nav-list > li > .sub-menu > li > a:focus-visible,
	.myc-nav-list > li > .sub-menu > li > .sub-menu a:hover,
	.myc-nav-list > li > .sub-menu > li > .sub-menu a:focus-visible {
		border-color: var(--ps-color-brand-border);
		background: var(--ps-color-brand-50);
		color: var(--ps-color-brand-700);
		outline: none;
	}

	@media (prefers-reduced-motion: reduce) {
		.myc-nav-list > li > .sub-menu,
		.myc-nav-list > li.myc-has-mega-menu > a::after {
			transition: none;
		}
	}
}

.myc-mobile-menu-tab.is-active::after {
	background: var(--ps-color-brand-600);
}

.myc-mobile-menu-item a:focus-visible,
.myc-mobile-menu-item button:focus-visible {
	background: var(--ps-color-surface);
	color: var(--ps-color-text);
	outline: 2px solid var(--ps-color-text);
	outline-offset: -2px;
}

@media (hover: hover) and (pointer: fine) {
	.myc-mobile-menu-item a:hover,
	.myc-mobile-menu-item button:hover {
		background: var(--ps-color-brand-50);
		color: var(--ps-color-brand-600);
	}
}

@media (max-width: 1080px) {
	.myc-mobile-menu-panel {
		border-right: 0;
		box-shadow: none;
	}

	.myc-menu-toggle {
		border-radius: var(--ps-radius-sm);
		box-shadow: none;
		outline: none;
		-webkit-tap-highlight-color: transparent;
	}

	.myc-menu-toggle:focus,
	.myc-menu-toggle:active {
		background: transparent;
		box-shadow: none;
		outline: none;
	}

	.myc-app-body .myc-menu-toggle:focus-visible {
		outline: 2px solid var(--ps-color-brand-border);
		outline-offset: 2px;
	}

	.myc-header-actions :is(.myc-account-link, .myc-cart-link) {
		-webkit-tap-highlight-color: transparent;
	}

	.myc-app-body .myc-header-actions :is(.myc-account-link, .myc-cart-link):focus,
	.myc-app-body .myc-header-actions :is(.myc-account-link, .myc-cart-link):active {
		background: transparent;
		box-shadow: none;
		outline: none;
	}

	.myc-app-body .myc-header-actions :is(.myc-account-link, .myc-cart-link):focus-visible {
		outline: 2px solid var(--ps-color-brand-border);
		outline-offset: 2px;
	}

	.myc-header-actions .myc-cart-link > span[data-cart-count] {
		padding-top: 1px;
	}

	.myc-header-actions .myc-account-link--mobile {
		transition: background-color 0s;
	}

	.myc-app-body .myc-header-actions .myc-account-link--mobile.is-touch-pressed {
		background: var(--ps-color-border);
	}

	.myc-site-search--desktop {
		display: none;
	}

	/*
	 * Collapsed rather than hidden, so the sticky header shrinks with it instead
	 * of leaving a gap where the field was.
	 *
	 * The row measures itself. An earlier build animated a max-height ceiling
	 * set above the field's real height, and the part of the animation between
	 * the ceiling and the content was time in which nothing moved — which fell
	 * at the end of the collapse and at the start of the reveal, so the reveal
	 * spent its whole budget on the fast head of the easing curve and dropped
	 * the gentle tail. It read as a snap. A grid track sized to its own content
	 * has no slack to waste, so both directions use the full curve.
	 */
	.myc-mobile-site-search-wrap {
		display: grid;
		grid-template-rows: 1fr;
		padding: var(--ps-space-3) var(--ps-space-4) var(--ps-space-4);
		overflow: hidden;
		background: transparent;

		/*
		 * One declaration for both directions, so opening and closing are the
		 * same movement run each way. That is only true now that the track
		 * measures itself: with the fixed ceiling this used to sit above, the
		 * same declaration produced two different animations, because the slack
		 * between ceiling and content was dead time that fell at the end of one
		 * direction and the start of the other.
		 */
		transition: grid-template-rows var(--ps-transition-base), padding var(--ps-transition-base), opacity var(--ps-transition-fast);
	}

	.myc-mobile-site-search-wrap > * {
		min-height: 0;
	}

	.myc-topbar.is-search-collapsed .myc-mobile-site-search-wrap {
		grid-template-rows: 0fr;
		padding-top: 0;
		padding-bottom: 0;
		opacity: 0;
	}

	/*
	 * A track sized to its content still stops at the field's own borders: they
	 * are 1px each and no min-height reaches them, so the closed header kept a
	 * two-pixel sliver under the logo. They are invisible at this point anyway.
	 */
	.myc-topbar.is-search-collapsed .myc-site-search--mobile {
		border-top-width: 0;
		border-bottom-width: 0;
	}

	@media (prefers-reduced-motion: reduce) {
		.myc-mobile-site-search-wrap {
			transition: none;
		}
	}

	.myc-site-search--mobile {
		width: 100%;
	}

	.myc-site-search--mobile input,
	.myc-site-search--mobile button {
		height: 42px;
	}

	/* Safari only avoids automatic form zoom from a 16px input size. */
	.myc-site-search--mobile input {
		font-size: 16px;
	}

	.myc-site-search--mobile input::placeholder {
		font-size: 14px;
		letter-spacing: -.01em;
	}

	.myc-site-search--mobile button {
		width: 42px;
		flex-basis: 42px;
	}

	.myc-brand--logo {
		width: min(var(--myc-brand-logo-width-mobile), calc(100% - 184px));
	}

	.myc-topbar .myc-brand {
		-webkit-tap-highlight-color: transparent;
	}

	.myc-topbar .myc-brand.is-touch-pressed {
		transform: translateX(-50%) translateY(-2px);
	}

	.myc-brand-image {
		width: 100%;
	}

	.myc-mobile-menu {
		visibility: hidden;
		transition: visibility 0s linear 220ms;
	}

	.myc-mobile-menu.is-open {
		visibility: visible;
		transition-delay: 0s;
	}

	.myc-account-link--desktop,
	.myc-account-menu {
		display: none;
	}

	.myc-account-link--mobile {
		display: inline-grid;
	}
}
