/**
 * MBF Events & Membership - the account icon in the site header.
 *
 * The header is an Elementor template on every page, so this is the one
 * stylesheet the plugin loads site wide. It is deliberately small, and every
 * selector sits under .mbf-account-icon, which only exists where the plugin
 * replaced the header widget.
 */

.mbf-account-icon-wrapper {
	display: flex;
	align-items: center;
	justify-content: center;
}

.mbf-account-icon {
	--mbf-accent: #369a32;
	--mbf-accent-light: #9ec828;

	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 34px;
	border-radius: 50%;
	border: 1px solid #e9eaeb;
	background: #f5f5f5;
	color: #a4a7ae;
	text-decoration: none;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.mbf-account-icon:hover,
.mbf-account-icon:focus-visible {
	border-color: var(--mbf-accent);
	color: var(--mbf-accent);
	text-decoration: none;
}

.mbf-account-icon:focus-visible {
	outline: 3px solid var(--mbf-accent);
	outline-offset: 2px;
}

.mbf-account-icon__glyph {
	display: block;
	width: 20px;
	height: 20px;
}

/* Signed in: the first letter, on the brand green. */
.mbf-account-icon--member {
	border-color: transparent;
	background-image: linear-gradient(135deg, var(--mbf-accent-light) 0%, var(--mbf-accent) 100%);
	background-color: var(--mbf-accent);
	color: #fff;
}

.mbf-account-icon--member:hover,
.mbf-account-icon--member:focus-visible {
	border-color: transparent;
	color: #fff;
	filter: brightness(.94);
}

.mbf-account-icon__initial {
	font-family: "Inter", sans-serif;
	font-size: 16px;
	font-weight: 600;
	line-height: 1;
	letter-spacing: .01em;
	/* The cap sits a touch high in the circle without this. */
	transform: translateY(1px);
}

/* --- The tooltip -------------------------------------------------------- */
/*
 * Shown on hover and on keyboard focus, so it is not mouse only. The link
 * carries its own accessible name in screen reader text, and the tooltip is
 * hidden from assistive technology, so the name is announced once.
 */

.mbf-account-icon__tip {
	position: absolute;
	top: calc(100% + 10px);
	left: 50%;
	z-index: 100;
	padding: 6px 12px;
	border-radius: 8px;
	background: #292929;
	color: #fff;
	font-family: "Inter", sans-serif;
	font-size: 13px;
	font-weight: 500;
	line-height: 20px;
	white-space: nowrap;
	box-shadow: 0 4px 12px rgba(10, 13, 18, .18);
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, -4px);
	transition: opacity .15s ease, transform .15s ease, visibility .15s;
	pointer-events: none;
}

/* The little arrow pointing back up at the icon. */
.mbf-account-icon__tip::before {
	content: "";
	position: absolute;
	bottom: 100%;
	left: 50%;
	border: 5px solid transparent;
	border-bottom-color: #292929;
	transform: translateX(-50%);
}

.mbf-account-icon:hover .mbf-account-icon__tip,
.mbf-account-icon:focus-visible .mbf-account-icon__tip {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
}

/* Near the right edge of a narrow window the tooltip would run off screen. */
@media (max-width: 600px) {
	.mbf-account-icon__tip {
		left: auto;
		right: 0;
		transform: translate(0, -4px);
	}

	.mbf-account-icon__tip::before {
		left: auto;
		right: 14px;
		transform: none;
	}

	.mbf-account-icon:hover .mbf-account-icon__tip,
	.mbf-account-icon:focus-visible .mbf-account-icon__tip {
		transform: translate(0, 0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.mbf-account-icon,
	.mbf-account-icon__tip {
		transition: none;
	}
}
