/* The nav's right side on every page that draws src/php/nav.php: signed in,
   only "Welcome, <name>", and the menu under it on hover or tap. Linked from
   head.php, ahead of each page's own sheet, so it reads that page's tokens;
   --tint falls back for the sheets that do not name it. src/js/nav.js does
   the tap, the outside tap and Escape. */

/* Its own layer, so the open menu sits over whatever the page puts below
   the nav, animated or not. */
.nav {
	position: relative;
	z-index: 50;
	--brand-mark-size: 84px;
	--brand-name-size: 36px;
	--brand-lead-size: calc(var(--brand-name-size) * 0.5);
}

.nav .actions { flex: 0 0 auto; }

/* The tag under the name stays one line at the phone's smaller mark. */
.nav .brand .meta { white-space: nowrap; }

.navUser { position: relative; }

.navUser .welcome {
	appearance: none;
	border: 0;
	background: none;
	padding: 10px 0;
	margin: 0;
	font: 600 18px/1 var(--font-body);
	letter-spacing: 0.2px;
	color: var(--ink-soft);
	cursor: pointer;
	touch-action: manipulation;
	display: inline-flex;
	align-items: baseline;
	gap: 5px;
}

.navUser .welcome b {
	color: var(--ink);
	font-weight: 700;
	font-size: 19px;
	border-bottom: 2px solid transparent;
	padding-bottom: 2px;
	transition: border-color 0.12s ease;
}

.navUser:hover .welcome b,
.navUser.open .welcome b,
.navUser .welcome:focus-visible b { border-bottom-color: var(--brand-candor); }

.navUser .welcome:focus-visible { outline: 2px solid var(--blue-strong); outline-offset: 2px; border-radius: 6px; }

.navMenu {
	position: absolute;
	top: 100%;
	right: 0;
	padding-top: 4px;
	display: none;
	z-index: 60;
	min-width: 184px;
}

.navMenuInner {
	display: grid;
	gap: 2px;
	padding: 6px;
	border-radius: 14px;
	border: 1px solid var(--line);
	background: var(--white);
	box-shadow: var(--shadow);
}

.navMenu a {
	display: block;
	padding: 10px 14px;
	border-radius: 10px;
	font-family: var(--font-body);
	font-weight: 600;
	font-size: 14px;
	line-height: 1.6;
	color: var(--ink);
	text-decoration: none;
	white-space: nowrap;
}

.navMenu a:hover,
.navMenu a:focus-visible { background: var(--tint, rgba(185, 219, 242, 0.5)); outline: none; }

.navMenuRule { height: 1px; margin: 4px 8px; background: var(--line); }

/* :hover only where a pointer can hover, so a phone's tap does not leave it
   stuck open. */
@media (hover: hover) {
	.navUser:not(.closed):hover .navMenu { display: block; }
}

.navUser.open .navMenu { display: block; }

@media (max-width: 720px) {
	/* Signed out, the two buttons take a line of their own under the brand.
	   header.nav, to outrank a page sheet's own .nav. */
	header.nav {
		--brand-mark-size: 60px;
		--brand-name-size: 27px;
		gap: 10px;
		flex-wrap: wrap;
	}

	.nav .actions { margin-left: auto; }
	.nav .brand { gap: 8px; }
	.nav .brand .meta { font-size: 10px; letter-spacing: 1px; }

	.navUser .welcome { font-size: 15px; }
	.navUser .welcome b { font-size: 16px; }

	.nav .actions .btn { min-height: 40px; padding: 0 14px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
	.navUser .welcome b { transition: none; }
}
