header
{
	--top-bar-height: 74px;
	--menu-height: 44px;
	--player-name-min-width: 140px;

	--padding-inline: calc(var(--spacing) * 1.25);
	--padding-block: calc(var(--spacing) * 0.25);

	display: flex;
	flex-direction: column;
	background: linear-gradient(180deg, rgb(255 226 186 / .1), transparent 40%, rgb(0 0 0 / .6)), var(--grain), var(--color-leather) var(--texture-leather) center / 420px auto;

	.top-bar
	{
		display: flex;
		gap: var(--spacing);
		justify-content: space-between;
		align-items: center;
		min-height: var(--top-bar-height);
		padding-inline: var(--padding-inline);
		padding-block: var(--padding-block);

		& .logo
		{
			display: flex;
			flex-shrink: 0;
			align-items: center;
			gap: 10px;
			text-decoration: none;

			span
			{
				margin-top: 6px;

				font-weight: 700;
				font-size: 1.2rem;
				font-family: var(--font-logo);
				letter-spacing: .16em;
				text-transform: uppercase;
				color: transparent;
				background: var(--gradient-gold);
				background-clip: text;
				-webkit-background-clip: text;
				filter: drop-shadow(0 0 10px rgb(0, 0, 0, 1));
			}

			& svg
			{
				width: 44px;
				height: 44px;
				stroke: currentColor;
				fill: none;
			}
		}

		& .stats
		{
			display: flex;
			flex-wrap: wrap;
			justify-content: flex-end;
			align-items: center;
			gap: calc(var(--spacing) * 2.5);
			min-width: 0;

			/* The house's currencies, in a sunken box - the framework demo's purse (Ashbound other/template-web/
			   framework). Ash only, so far; a link into the Scriptorium, where it is spent. */
			& .purse
			{
				display: flex;
				flex: none;
				gap: 14px;
				padding: 6px 14px;
				background: linear-gradient(180deg, rgb(0 0 0 / .5), rgb(0 0 0 / .3));
				border: 1px solid var(--color-gold-line);
				border-radius: 2px;
				box-shadow: inset 0 2px 5px rgb(0 0 0 / .7), 0 1px 0 rgb(255 255 255 / .05);
				text-decoration: none;
			}

			& .coin
			{
				display: flex;
				align-items: center;
				gap: 6px;
				font: 700 14px var(--font-header);
				letter-spacing: .04em;
				color: var(--color-gold);

				& svg
				{
					width: 20px;
					height: 20px;
					stroke: currentColor;
					fill: none;
					filter: drop-shadow(0 1px 1px rgb(0 0 0 / .9));
				}
			}

			& .player
			{
				font-weight: 700;
				font-size: 1em;
				text-shadow: 0 0 10px #000;
				min-width: var(--player-name-min-width);

				& > div
				{
					text-align: right;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
				}

				& .level
				{
					display: flex;
					align-items: center;
					gap: calc(var(--spacing) * 0.5);
					margin-top: 2px;
					font-size: 0.8em;
					font-family: var(--font-header);
					color: var(--color-gold-shaded);
					text-shadow: 0 0 10px rgba(0, 0, 0, 0.75);
					cursor: help;
				}
			}
		}
	}


	& .menu
	{
		min-height: var(--menu-height);

		background: linear-gradient(180deg, rgb(0 0 0 / .35), rgb(0 0 0 / .15));
		border-top: 1px solid rgb(0 0 0 / .6);
		box-shadow: inset 0 1px 0 rgb(255 255 255 / .05);

		& > div
		{
			display: flex;
			flex-wrap: wrap;
			justify-content: space-between;
			padding-inline: var(--padding-inline);
		}

		/* Buttons (a POST like logging out) look exactly like the links. */
		& a,
		& button
		{
			display: flex;
			min-height: var(--menu-height);
			align-items: center;
			padding: 0;
			background: none;
			border: 0;
			cursor: pointer;

			color: var(--color-gold-shaded);
			text-decoration: none;
			font-weight: 500;
			font-family: var(--font-header);
			font-size: 0.75em;
			letter-spacing: .1em;
			text-transform: uppercase;
			white-space: nowrap;
			border-bottom: 1px solid transparent;

			&.active
			{
				border-bottom-color: var(--color-gold-dark);
			}

			& svg
			{
				width: 18px;
				height: 18px;
				fill: none;
				stroke: currentColor;
				stroke-width: 1.4;
			}

			&:hover
			{
				text-shadow: 0 0 10px var(--color-gold);

				svg
				{
					filter: drop-shadow(0 0 10px var(--color-gold));
				}
			}
		}

		& ul
		{
			display: flex;
			flex-wrap: wrap;
			gap: var(--spacing);
			list-style: none;

			& li
			{
				position: relative;

				svg
				{
					margin-right: 10px;
				}

				& + li
				{
					padding-left: calc(var(--spacing) * 1.5);

					&::before
					{
						content: '';
						position: absolute;
						top: 20%;
						bottom: 20%;
						left: 0;
						width: 1px;
						background: linear-gradient(180deg, transparent, var(--color-gold-dark), transparent);
					}
				}
			}
		}

		& .secondary-menu
		{
			display: flex;
			gap: var(--spacing);
			align-items: center;

			a,
			button
			{
				position: relative;
				padding-inline: 6px;
			}

			/* The form is only there to make the button a POST - keep it out of the flex layout. */
			form
			{
				display: contents;
			}

			[data-count]:not([data-count="0"])::after
			{
				content: attr(data-count);
				position: absolute;
				top: 0;
				right: -6px;
				background: #800808;
				color: var(--color-gold-shaded);
				font-size: 0.9em;
				font-weight: bold;
				width: 18px;
				height: 18px;
				text-align: center;
				line-height: 18px;
				border-radius: 50%;
				letter-spacing: 0px;
			}
		}
	}
}

@media (max-width: 600px)
{
	header
	{
		& .top-bar
		{
			& .logo span
			{
				display: none;
			}

			& .stats .player
			{
				min-width: 100px;
			}
		}
	}
}

/* Too narrow for the menu in one line of icon-and-label. Letting the list wrap is what this replaces:
   the last item dropped to a line of its own, and took its `li + li::before` separator along to the
   start of that line. Instead the label goes under its icon, and nothing depends on how many items
   there are:

   - The icons on the right wrap, as one group, onto a line of their own when the list leaves them no
     room (with four items: below about 380px). That has no separator to strand.
   - The list itself never wraps. When even a whole line is not enough, it scrolls sideways.

   Its own breakpoint, wider than the phone one: from about 600 to 750px the one-line menu is already
   too wide, while the rest of the page is still laid out for a desktop. */
@media (max-width: 760px)
{
	header .menu
	{
		& > div
		{
			gap: var(--spacing);
		}

		& a
		{
			flex-direction: column;
			justify-content: center;
			gap: 4px;
			font-size: 0.6em;
			letter-spacing: .05em;
		}

		& ul
		{
			flex-wrap: nowrap;
			overflow-x: auto;
			scrollbar-width: none;

			& li
			{
				svg
				{
					margin-right: 0;
				}

				/* The separator sits in the middle of the gap, instead of in padding of its own. */
				& + li
				{
					padding-left: 0;

					&::before
					{
						left: calc(var(--spacing) * -0.5);
					}
				}
			}
		}

		/* Pushed right, also when it wraps onto a line of its own. */
		& .secondary-menu
		{
			margin-left: auto;
		}
	}
}
