:root {
	--tdn-topbar-height: 22px;
}

/* Own fixed layer so z-index is not trapped inside #mvp-top-head-wrap. */
#tdn-topbar {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	width: 100%;
	z-index: 100001;
	background: #efefef;
	color: #393939;
	font-family: "Source Sans 3", "Titillium Web", sans-serif;
}

/* WP admin bar is 99999 — stay below it so dropdowns layer correctly. */
body.admin-bar #tdn-topbar {
	top: 32px;
	z-index: 99998;
}

@media screen and (max-width: 782px) {
	body.admin-bar #tdn-topbar {
		top: 46px;
	}
}

/* Keep the theme header above page content; sit just below the top bar. */
#mvp-top-head-wrap {
	top: var(--tdn-topbar-height) !important;
	z-index: 100000 !important;
}

body.admin-bar #mvp-top-head-wrap {
	top: calc(var(--tdn-topbar-height) + 32px) !important;
	z-index: 99997 !important;
}

@media screen and (max-width: 782px) {
	body.admin-bar #mvp-top-head-wrap {
		top: calc(var(--tdn-topbar-height) + 46px) !important;
	}
}

#tdn-topbar .tdn-topbar__inner {
	box-sizing: border-box;
	max-width: 1200px;
	width: 100%;
	margin: 0 auto;
	padding: 0 max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
	height: 22px;
	display: flex;
	align-items: center;
	justify-content: flex-end;
}

#tdn-topbar .tdn-topbar__nav {
	display: flex;
	align-items: center;
	gap: 18px;
}

#tdn-topbar .tdn-topbar__link {
	color: #393939;
	font-size: 13px;
	line-height: 22px;
	text-decoration: none;
	white-space: nowrap;
	font-weight: 600; 
}

#tdn-topbar .tdn-topbar__plan {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	height: 15px;
	padding: 0 8px;
	border: 1px solid #DA1D25;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.6);
	color: #DA1D25;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1;
	white-space: nowrap;
	box-sizing: border-box;
}

#tdn-topbar .tdn-topbar__link:hover {
	text-decoration: underline;
}

#tdn-topbar .tdn-topbar__link--accent {
	color: #393939;
	font-weight: 700;
}

#tdn-topbar .tdn-topbar__menu {
	position: relative;
	display: inline-flex;
	align-items: center;
	height: 22px;
}

/* Invisible bridge across the 2px gap between the name and the dropdown.
   Without it the cursor leaves .tdn-topbar__menu on the way down, :hover
   goes false and the menu closes mid-movement. Inert until the menu is
   actually open, so it never blocks anything underneath it. */
#tdn-topbar .tdn-topbar__menu::after {
	content: "";
	position: absolute;
	top: 100%;
	right: 0;
	left: auto;
	width: 100%;
	min-width: 156px;
	height: 8px;
	pointer-events: none;
}

#tdn-topbar .tdn-topbar__menu:hover::after,
#tdn-topbar .tdn-topbar__menu:focus-within::after {
	pointer-events: auto;
}

#tdn-topbar .tdn-topbar__menu-trigger {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	max-width: 180px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: #393939;
	font-family: "Source Sans 3", "Titillium Web", sans-serif;
	font-size: 13px;
	font-weight: 600;
	line-height: 22px;
	letter-spacing: normal;
	text-transform: none;
	-webkit-appearance: none;
	appearance: none;
	cursor: pointer;
}

#tdn-topbar .tdn-topbar__menu-label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 160px;
}

#tdn-topbar .tdn-topbar__menu-caret {
	display: inline-block;
	width: 0;
	height: 0;
	margin-top: 1px;
	border-left: 4px solid transparent;
	border-right: 4px solid transparent;
	border-top: 5px solid currentColor;
	flex-shrink: 0;
}

#tdn-topbar .tdn-topbar__menu-dropdown {
	position: absolute;
	top: calc(100% + 2px);
	/* Open toward the left so the menu stays inside the viewport on
	   narrow phones (account control sits at the far right). */
	left: auto;
	right: 0;
	z-index: 100002;
	min-width: 156px;
	max-width: min(240px, calc(100vw - 32px));
	margin: 0;
	padding: 6px 0;
	list-style: none;
	background: #fff;
	border: 1px solid #d8d8d8;
	border-radius: 4px;
	box-shadow: 0 6px 18px rgba(16, 26, 20, 0.12);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease, visibility 0.15s ease;
	box-sizing: border-box;
}

#tdn-topbar .tdn-topbar__menu:hover .tdn-topbar__menu-dropdown,
#tdn-topbar .tdn-topbar__menu:focus-within .tdn-topbar__menu-dropdown {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

#tdn-topbar .tdn-topbar__menu-item {
	display: block;
	padding: 7px 14px;
	color: #393939;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	white-space: nowrap;
}

#tdn-topbar .tdn-topbar__menu-item:hover,
#tdn-topbar .tdn-topbar__menu-item:focus {
	background: #f5f5f5;
	color: #101a14;
	text-decoration: none;
}

/* Log out sits at the bottom of the account dropdown, set apart from the
   navigation items above it. */
#tdn-topbar .tdn-topbar__menu-item--logout {
	margin-top: 6px;
	padding-top: 10px;
	border-top: 1px solid #e6e6e6;
}
