/* ==========================================================================
   Mobile header & menu panel (below 1024px)

   Loaded right after custom.css, so every selector here only has to match the
   specificity of the mobile block at the bottom of custom.css to override it -
   the later stylesheet wins. Nothing in this file touches the desktop header.

   Layout of the mobile header, top to bottom:
     1. blue event bar   - the featured event on a single row
     2. brand row        - logo, Sale pill, burger (sticky, shrinks on scroll)
     3. pill strip       - top level of the menu, scrolls sideways
     4. menu panel       - slides in from the right over a dimmed backdrop
   ========================================================================== */

/* The mobile only pieces sit in the markup at every width, so they are switched
   off here and turned back on inside the media query below. */
.menu-panel-head,
.menu-panel-foot,
.mobile-sale-button,
.mobile-nav-strip-wrap {
	display: none;
}

@media (max-width: 1023px) {
	.admin-bar .menu-container {
		top: 32px;
		height: calc(100% - 32px);
	}
	/* Fallback until custom.js measures the header - the fixed part is the event
	   bar plus the brand row, the pill strip below it scrolls with the page */
	:root {
		--header-height: 140px;
	}

	/* --- 1. Blue event bar ------------------------------------------------
	   The two info items that used to sit here move into the panel footer, so
	   the bar carries the featured event alone and fits on one line. */
	.header-bar,
	.scroll-body .header-bar {
		padding: 0;
	}
	.header-bar-inner {
		flex-flow: row;
		justify-content: flex-start;
		align-items: center;
	}
	.header-bar-left {
		display: block;
		flex: 1 1 auto;
		min-width: 0;
	}
	.header-bar-right {
		display: none;
	}
	.header-bar-left-inner {
		gap: 10px;
		padding: 9px 0px;
	}
	.header-bar-left .info-bar-event-icon {
		flex: 0 0 18px;
		width: 18px;
		height: 18px;
	}
	.header-bar-left .info-bar-event-icon img {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: contain;
	}
	/* Label and date read as one sentence that may wrap onto a second line */
	.header-bar-left-inner .info-bar-event-text {
		display: flex;
		flex-flow: row wrap;
		gap: 0 5px;
		min-width: 0;
	}
	.header-bar-left-inner .info-bar-event-subtitle {
		font-family: var(--font-family-text);
		font-size: 13px;
		font-weight: 400;
		letter-spacing: 0;
		line-height: 1.3;
		opacity: 0.85;
	}
	.header-bar-left-inner .event-text {
		font-size: 13px;
		line-height: 1.3;
	}

	/* --- 2. Brand row -----------------------------------------------------
	   The padding moves onto the inner row, so the shrink on scroll can change
	   it without the pill strip below jumping with it. */
	.header-content,
	.scroll-body .header-content {
		padding: 0;
	}
	.header-content-inner {
		gap: 12px;
		padding: 12px 0px;
		transition: padding 0.3s ease-in-out;
	}
	.scroll-body .header-content-inner {
		padding: 7px 0px;
	}
	.header-content .logo-container {
		max-width: 165px;
	}
	.scroll-body .header-content .logo-container {
		max-width: 112px;
	}
	.header-content .logo-container img {
		width: 100%;
		height: auto;
	}
	.menu-container-wrap {
		flex: 0 0 auto;
		gap: 10px;
	}
	.scroll-body .masthead {
		box-shadow: 0 5px 18px rgba(32, 63, 148, 0.14);
	}

	/* Sale is rendered next to the burger from the same menu item, so the copy
	   inside the panel would be a duplicate */
	.mobile-sale-button {
		display: block;
		flex: 0 0 auto;
		padding: 9px 22px;
		border-radius: 50px;
		background-color: var(--red);
		color: #fff;
		font-size: 15px;
		font-weight: 500;
		line-height: 1.2;
		white-space: nowrap;
		transition: background-color 0.3s ease-in-out;
	}
	.mobile-sale-button:hover {
		background-color: var(--dark-blue);
		color: #fff;
	}
	.menu-container .menu > li.button-sale {
		display: none;
	}

	/* Burger: three even bars, no cross state - the panel covers it and closes
	   through its own X */
	.menu--stripes {
		display: flex !important;
		flex-flow: column;
		justify-content: space-between;
		flex: 0 0 24px;
		width: 24px;
		height: 18px;
		margin-left: 6px;
		/* It used to be lifted above the panel that came in from the left. The
		   panel now covers it, so it has to drop back into the normal flow -
		   otherwise it shows through both the backdrop and the panel. */
		position: static;
		z-index: auto;
	}
	.menu--stripes span {
		height: 3px;
		margin-bottom: 0;
		border-radius: 2px;
		background-color: var(--dark-blue);
	}

	/* --- 3. Pill strip ----------------------------------------------------
	   Same top level entries as the panel, as a row that scrolls sideways. It is
	   the first thing in the page content rather than part of the header: the
	   header is fixed, and a third pinned row would leave too little viewport on
	   a phone. So it scrolls away with the page. */
	.mobile-nav-strip-wrap {
		display: block;
		background-color: #fff;
	}
	.mobile-nav-strip {
		display: flex;
		gap: 8px;
		padding: 12px 0 14px;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}
	.mobile-nav-strip::-webkit-scrollbar {
		display: none;
	}
	.mobile-nav-pill {
		flex: 0 0 auto;
		padding: 7px 15px;
		border-radius: 50px;
		background-color: var(--light-gray);
		color: var(--text-color);
		font-size: 14px;
		font-weight: 500;
		line-height: 1.2;
		white-space: nowrap;
		transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
	}
	.mobile-nav-pill:hover,
	.mobile-nav-pill:focus {
		background-color: var(--dark-blue);
		color: #fff;
	}

	/* --- 4. Menu panel ----------------------------------------------------
	   Slides in from the right as a partial width sheet, so the page stays
	   visible - and dimmed - behind it. The panel is a column: fixed head,
	   scrolling list, fixed footer. */
	.menu-container {
		top: 0;
		left: auto;
		right: -100%;
		display: flex;
		flex-flow: column;
		width: 88%;
		max-width: 380px;
		height: 100%;
		padding-top: 0;
		background-color: #fff;
		box-shadow: -12px 0 40px rgba(32, 63, 148, 0.18);
		overflow: hidden;
		z-index: 4;
		transition: right 0.3s ease-in-out;
	}
	.open_menu .menu-container {
		left: auto;
		right: 0;
	}
	/* Only the list scrolls - the wrapper wp_nav_menu prints around ul.menu */
	.menu-container > div:not(.menu-panel-head):not(.menu-panel-foot) {
		flex: 1 1 auto;
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* Backdrop. It has to be a pseudo element of the panel's own parent: the
	   header row around it is positioned with a z-index of its own, so anything
	   drawn outside that box - on .masthead, say - would land on top of the
	   panel no matter how high its z-index is. From here the two stack against
	   each other, and the dimming still reaches the header and the page below
	   because it is fixed to the viewport. */
	.menu-container-wrap::before {
		content: "";
		position: fixed;
		top: 0;
		right: 0;
		bottom: 0;
		left: 0;
		background-color: rgba(32, 63, 148, 0.35);
		opacity: 0;
		visibility: hidden;
		z-index: 1;
		transition: opacity 0.3s ease-in-out, visibility 0.3s ease-in-out;
	}
	.open_menu .menu-container-wrap::before {
		opacity: 1;
		visibility: visible;
	}

	/* Panel head */
	.menu-panel-head {
		display: flex;
		flex: 0 0 auto;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 18px 22px;
		border-bottom: 1px solid #e4e9f3;
	}
	.menu-panel-title {
		font-family: var(--font-family-display);
		font-size: 13px;
		font-weight: 500;
		letter-spacing: 1.5px;
		text-transform: uppercase;
		color: #8e9ab8;
	}
	.menu-panel-close {
		position: relative;
		flex: 0 0 26px;
		width: 26px;
		height: 26px;
		cursor: pointer;
	}
	.menu-panel-close::before,
	.menu-panel-close::after {
		content: "";
		position: absolute;
		left: 50%;
		top: 50%;
		width: 22px;
		height: 2.4px;
		border-radius: 2px;
		background-color: var(--dark-blue);
	}
	.menu-panel-close::before {
		transform: translate(-50%, -50%) rotate(45deg);
	}
	.menu-panel-close::after {
		transform: translate(-50%, -50%) rotate(-45deg);
	}

	/* Top level rows: the whole row is the hit area, hairlines instead of gaps */
	.menu-container .menu {
		padding: 0;
	}
	.menu-container .menu > li {
		border-bottom: 1px solid #e4e9f3;
		padding-top: 0;
	}
	.menu-container .menu > li > a {
		position: relative;
		padding: 19px 22px;
		margin-bottom: 0;
		font-size: 19px;
		font-weight: 400;
	}
	/* An entry without children only leads somewhere, so it gets the caret
	   pointing right; a parent keeps the toggle that folds the list open */
	.menu-container .menu > li:not(.menu-item-has-children) > a::after {
		content: "";
		position: absolute;
		right: 22px;
		top: 50%;
		width: 7px;
		height: 12px;
		transform: translateY(-50%);
		background-color: #8e9ab8;
		-webkit-mask: url('../images/Arrow-caret.svg') no-repeat center / contain;
		mask: url('../images/Arrow-caret.svg') no-repeat center / contain;
	}
	.menu-container .menu > .menu-item-has-children > a {
		padding-right: 8px;
	}
	.menu-container .menu > .menu-item-has-children > .expend-icon {
		flex: 0 0 44px;
		width: 44px;
		height: 44px;
	}
	.menu-container .menu > .menu-item-has-children > .expend-icon::before {
		width: 8px;
		height: 14px;
		background-color: var(--dark-blue);
	}
	/* A parent no longer navigates in the panel - it unfolds its list, so the
	   whole row reads as a control (see custom.js) */
	.menu-container .menu-item-has-children > a {
		cursor: pointer;
	}

	/* Sub menus: tinted so an open branch reads as a group inside the list */
	.menu-container .sub-menu {
		padding: 0 0 12px;
		background-color: #f5f7fb;
	}
	.menu-container .sub-menu a {
		padding: 11px 22px 11px 34px;
		margin-bottom: 0;
		font-size: 16px;
	}
	.menu-container .sub-menu .sub-menu {
		padding-left: 0;
	}
	.menu-container .sub-menu .sub-menu a {
		padding-left: 48px;
	}
	/* Nested parents keep their caret on the same right edge as the top level,
	   one shade lighter so the depth is readable */
	.menu-container .sub-menu .menu-item-has-children > a {
		padding-right: 8px;
	}
	.menu-container .sub-menu .menu-item-has-children > .expend-icon {
		flex: 0 0 44px;
		width: 44px;
		height: 44px;
	}
	.menu-container .sub-menu .menu-item-has-children > .expend-icon::before {
		width: 8px;
		height: 12px;
		background-color: #8e9ab8;
	}

	/* Panel footer - the contact items the blue bar gave up */
	.menu-panel-foot {
		display: flex;
		flex: 0 0 auto;
		flex-flow: column;
		gap: 16px;
		padding: 22px;
		border-top: 1px solid #e4e9f3;
	}
	.menu-panel-contact {
		display: flex;
		align-items: flex-start;
		gap: 12px;
		color: var(--dark-blue);
		font-size: 15px;
		font-weight: 500;
		line-height: 1.3;
	}
	.menu-panel-contact svg {
		flex: 0 0 18px;
		width: 18px;
		height: 18px;
		margin-top: 1px;
	}
	.menu-panel-contact.item-phone {
		color: var(--red);
	}
}
@media (max-width:768px) {
	.menu-container .menu > li > a {		padding: 14px 22px;		font-size: 16px;	}
	.menu-panel-foot {		padding: 10px 20px;	}
	.header-bar-left-inner .event-text, .header-bar-left-inner .info-bar-event-subtitle {		font-size: 12px;	}
	
}
/* Narrow phones: the logo gives way first, so Sale and the burger keep their
   full tap targets */
@media (max-width: 380px) {
	.header-content-inner {
		padding: 10px 0px;
	}
	.scroll-body .header-content-inner {
		padding: 7px 0px;
	}
	.header-content .logo-container {
		max-width: 132px;
	}
	.mobile-sale-button {
		padding: 8px 16px;
		font-size: 14px;
	}
	.mobile-nav-strip {
		padding: 2px 0 12px;
	}
	.header-bar-left-inner {
		padding: 9px 0px;
	}
}
