/********************************************************************

	    NAVIGATION
	
*********************************************************************/
nav {
	font-size: 75%;
	margin-bottom: 10pt;
	margin-left: 6pt;
	margin-right: 6pt;
}

main nav {
	position: relative;
}

main nav.Gateways
	{
	display: none;
	}
	
@media only screen and (max-width: 1024px)
	{
	main nav.Gateways { display: flex; }
	}

#OptionsBar {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	width: 100%;
}

/* Both nav bars should sit on the right */
nav.NavBar {
	display: flex;
	flex-direction: row-reverse; /* keeps visual order correct */
	justify-content: flex-start; /* with row-reverse, this keeps buttons right-aligned */
	align-items: flex-start;
	gap: 0;
}

/* Top nav should size to its contents, not stretch */
#OptionsBar > nav.NavBar {
	width: auto;
	margin: 0;
}

/* Bottom nav should span the row, but buttons still cluster at right */
main > nav.NavBar {
	width: 100%;
}

/* Share stays on the left */
#ShareBar {
	display: flex;
	flex: 0 0 auto;
	align-items: flex-start;
	width: auto;
	margin: 0;
}

/* Common button styling for nav links, Share, and Read Aloud */
nav.NavBar a,
#SharePageButton,
#ReadAloudButton {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	box-sizing: border-box;
	vertical-align: top;
	width: 65px;
	height: 100px;
	background-color: var(--clr_Nav_Background);
	color: var(--clr_Nav_Link);
	font-size: 9pt;
	font-family: var(--fnt_Nav_Link);
	line-height: 1.05;
	text-align: center;
	text-decoration: none;
	white-space: normal;
	word-break: break-word;
	overflow-wrap: break-word;
	border: none;
	cursor: pointer;
}

	nav.NavBar a:hover,
	#SharePageButton:hover,
	#ReadAloudButton:hover {
		color: #822526;
		font-style: italic;
		font-weight: normal;
	}

	#SharePageButton.Disabled {
		opacity: 0.3;
		cursor: default;
		pointer-events: none;
	}

	/* Nav button images */
	#SharePageButton img,
	#ReadAloudButton img,
	nav.NavBar a img {
		display: block;
		width: 50px;
		height: 50px;
		border: 1px solid #888;
		border-radius: 4px;
		box-shadow: 2px 2px 4px rgba(0,0,0,0.4);
		margin-bottom: 4px;
	}
	/* Hover color: tint B&W image to #822526 */
	#SharePageButton:hover img,
	#ReadAloudButton:hover img,
	nav.NavBar a:hover img {
		filter: sepia(100%) saturate(139%) hue-rotate(329deg);
		border-color: #822526;
	}

	/* Floating state for Read Aloud button during playback */
	#ReadAloudButton.Floating {
		position: fixed;
		top: 16px;
		right: 16px;
		z-index: 9999;
		border-radius: 8px;
		box-shadow: 0 4px 16px rgba(0,0,0,0.4);
		transition: box-shadow 0.3s ease;
	}

	/* Speed slider for Read Aloud */
	#ReadAloudSpeed {
		position: fixed;
		top: 100px;
		right: 16px;
		z-index: 9999;
		width: 80px;
		cursor: pointer;
	}

/* AI: Mobile fix - constrain NavBar to viewport and shrink buttons */
@media only screen and (max-width: 640px) {
	nav.NavBar {
		flex-wrap: wrap;
		max-width: 100%;
		overflow: hidden;
	}
	nav.NavBar a,
	#SharePageButton,
	#ReadAloudButton {
		width: 45px;
		height: 65px;
		font-size: 7pt;
		padding: 2px;
	}
	#SharePageButton img,
	#ReadAloudButton img,
	nav.NavBar a img {
		width: 32px;
		height: 32px;
	}
}
