/**
 * Mobile header and menu.
 *
 * Loaded after app.css so it can override the desktop header rules for small
 * screens. Scoped entirely inside the media query: nothing here affects the
 * desktop layout.
 */

/* 992px, not 991px: common.css switches the header to its mobile layout at
   max-width 992, and a 1px gap between the two left a broken state there. */
@media (max-width: 992px) {
	.faw-glass-header {
		--faw-pill-h: 56px;
		--faw-pill-bg: rgba(6, 38, 44, 0.75);
		--faw-pill-border: rgba(63, 210, 234, 0.38);
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		z-index: 1000;
		padding: 10px 14px !important;
		width: 100% !important;
		max-width: none !important;
		/* The panel is a child of the header, so it must not be clipped. */
		overflow: visible !important;
	}

	.faw-glass-inner {
		display: flex !important;
		align-items: center;
		/* Wrapping dropped the CTA onto a hidden second row on some templates. */
		flex-wrap: nowrap !important;
		/* No gap: the logo and the toggle butt together into a single pill. */
		gap: 0 !important;
		width: 100% !important;
		max-width: none !important;
		margin: 0 !important;
		padding: 0 !important;
		/* Keep the header itself as the panel's positioning ancestor. */
		position: static !important;
	}

	/* Dropping the pill box lets its children sit directly in the header row,
	   so the toggle can join the logo and the CTA can break away to the right. */
	.faw-menu-pill {
		display: contents !important;
	}

	/* ----- Left pill: logo + toggle ----- */
	.faw-logo-pill {
		order: 1;
		flex: 0 0 auto;
		display: flex !important;
		align-items: center;
		height: var(--faw-pill-h);
		margin: 0 !important;
		padding: 0 8px 0 16px !important;
		background: var(--faw-pill-bg) !important;
		border: 1px solid var(--faw-pill-border) !important;
		border-right: 0 !important;
		border-radius: var(--faw-pill-h) 0 0 var(--faw-pill-h) !important;
		box-shadow: none !important;
		box-sizing: border-box;
	}

	.faw-logo-wrap,
	.faw-logo-icon {
		display: flex !important;
		align-items: center;
	}

	.faw-logo-icon svg {
		display: block;
		width: 32px;
		height: 34px;
	}

	/* ----- Right: standalone CTA -----
	   .faw-menu-pill above is display:contents, so it is no longer a containing
	   block. Anything that positioned this button against the pill has to be
	   neutralised here, or the button lands somewhere off-screen. */
	.faw-cta-btn {
		order: 3;
		position: relative !important;
		top: auto !important;
		right: auto !important;
		bottom: auto !important;
		left: auto !important;
		float: none !important;
		flex: 0 0 auto;
		margin: 0 6px 0 auto !important;
		display: grid !important;
		place-items: center;
		visibility: visible !important;
		opacity: 1 !important;
		width: 46px;
		height: 46px;
		min-width: 46px;
		padding: 0 !important;
		border-radius: 50% !important;
		background: #136974 !important;
		border: 0 !important;
		box-shadow: none !important;
	}

	/* Detached ring, so the gap stays transparent over light page sections. */
	.faw-cta-btn::after {
		content: "";
		position: absolute;
		inset: -7px;
		border: 1px solid rgb(3 44 50 / 55%);
		border-radius: 50%;
		pointer-events: none;
	}

	.faw-cta-btn img {
		width: 20px;
		height: 20px;
	}

	/* ----- Toggle -----
	   The bars are centred on the same point and only rotate, so the open state
	   is an exact X no matter what margins or spacing app.css puts on them. */
	.faw-mobile-toggle {
		order: 2;
		display: block !important;
		position: relative;
		flex: 0 0 auto;
		width: 58px;
		height: var(--faw-pill-h);
		margin: 0 !important;
		padding: 0 !important;
		background: var(--faw-pill-bg) !important;
		border: 1px solid var(--faw-pill-border) !important;
		border-left: 0 !important;
		border-radius: 0 var(--faw-pill-h) var(--faw-pill-h) 0 !important;
		box-shadow: none !important;
		box-sizing: border-box;
		cursor: pointer;
		-webkit-tap-highlight-color: transparent;
	}

	.faw-mobile-toggle:active span {
		opacity: 0.65;
	}

	.faw-mobile-toggle:focus-visible {
		outline: 2px solid #3fd2ea;
		outline-offset: 2px;
	}

	.faw-mobile-toggle span {
		display: block;
		position: absolute;
		top: 50%;
		left: 50%;
		width: 25px;
		height: 2px;
		margin: 0 !important;
		border-radius: 2px;
		background: #eaf7f9;
		transform: translate(-50%, -50%);
		transform-origin: center;
		transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.18s ease;
	}

	.faw-mobile-toggle span:nth-child(1) {
		transform: translate(-50%, -50%) translateY(-8px);
	}

	.faw-mobile-toggle span:nth-child(3) {
		transform: translate(-50%, -50%) translateY(8px);
	}

	.faw-m-open .faw-mobile-toggle span:nth-child(1) {
		transform: translate(-50%, -50%) rotate(45deg);
	}

	.faw-m-open .faw-mobile-toggle span:nth-child(2) {
		opacity: 0;
		transform: translate(-50%, -50%) scaleX(0.4);
	}

	.faw-m-open .faw-mobile-toggle span:nth-child(3) {
		transform: translate(-50%, -50%) rotate(-45deg);
	}

	/* ----- Panel ----- */
	.faw-menu {
		order: 4;
		position: absolute;
		top: calc(100% + 8px);
		left: 14px;
		right: 14px;
		z-index: 1001;
		display: flex !important;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		margin: 0;
		padding: 8px;
		list-style: none;
		background: #06232a;
		border: 1px solid rgba(63, 210, 234, 0.18);
		border-radius: 20px;
		box-shadow: 0 24px 60px rgba(0, 12, 14, 0.55);
		max-height: calc(100vh - var(--faw-header-h, 68px) - 28px);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		opacity: 0;
		visibility: hidden;
		transform: translateY(-10px);
		transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
	}

	.faw-m-open .faw-menu {
		opacity: 1;
		visibility: visible;
		transform: translateY(0);
	}

	.faw-menu-item {
		width: 100%;
		position: static !important;
	}

	.faw-menu-item + .faw-menu-item {
		border-top: 1px solid rgba(255, 255, 255, 0.07);
	}

	.faw-menu-item > a {
		display: flex !important;
		align-items: center;
		justify-content: space-between;
		gap: 10px;
		width: 100%;
		padding: 15px 14px;
		border-radius: 12px;
		font-size: 15px;
		font-weight: 500;
		line-height: 1.2;
	}

	/* Visited links were rendering purple inside the panel. */
	.faw-menu a,
	.faw-menu a:visited,
	.faw-menu a:hover,
	.faw-menu a:focus {
		color: #eaf7f9 !important;
		text-decoration: none;
	}

	.faw-menu-item.is-active > a,
	.faw-menu-item.is-open > a {
		background: rgba(63, 210, 234, 0.1);
	}

	.faw-menu-caret {
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		flex: 0 0 auto;
		width: 24px;
		height: 24px;
		margin: 0 !important;
		border-radius: 50%;
		background: rgba(63, 210, 234, 0.1);
		transition: transform 0.25s ease, background-color 0.2s ease;
	}
.faw-menu-caret svg {
    margin-left: 0px;
}
	.faw-menu-caret svg {
		display: block;
		width: 9px !important;
		height: 9px !important;
	}

	/* app.css colours the path itself, so it has to be overridden there. */
	.faw-menu-caret svg,
	.faw-menu-caret svg path {
		fill: #7fd3dc !important;
		stroke: none !important;
	}

	.faw-menu-item.is-open > a .faw-menu-caret {
		background: rgba(63, 210, 234, 0.22);
		transform: rotate(180deg);
	}

	/* ----- Nested dropdowns become accordions ----- */
	.faw-dropdown {
		position: static !important;
		display: block !important;
		width: auto !important;
		min-width: 0 !important;
		max-width: none !important;
		left: auto !important;
		right: auto !important;
		top: auto !important;
		transform: none !important;
		opacity: 1 !important;
		visibility: visible !important;
		background: transparent !important;
		border: 0 !important;
		box-shadow: none !important;
		padding: 0 !important;
		margin: 0 !important;
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.3s ease;
	}

	.faw-menu-item.is-open > .faw-dropdown {
		max-height: 1200px;
	}

	.faw-dropdown-row {
		display: flex !important;
		align-items: center;
		gap: 12px;
		padding: 10px 14px;
		border-radius: 12px;
	}

	.faw-dropdown-row img {
		flex: 0 0 auto;
		width: 46px;
		height: 46px;
		object-fit: cover;
		border-radius: 10px;
	}

	.faw-dropdown-content {
		min-width: 0;
	}

	.faw-dropdown-content strong {
		display: block;
		font-size: 14px;
		line-height: 1.3;
		margin-bottom: 2px;
	}

	.faw-dropdown-content span {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		font-size: 12px;
		line-height: 1.45;
		color: #a9c9cd !important;
	}

	/* ----- Backdrop ----- */
	.faw-m-backdrop {
		position: fixed;
		inset: 0;
		z-index: 999;
		background: rgba(0, 12, 14, 0.6);
		opacity: 0;
		visibility: hidden;
		transition: opacity 0.22s ease, visibility 0.22s;
	}

	.faw-m-open .faw-m-backdrop {
		opacity: 1;
		visibility: visible;
	}

	body.faw-m-locked {
		overflow: hidden;
	}
}

@media (min-width: 993px) {
	.faw-m-backdrop {
		display: none;
	}
}
