/* theme/assets/css/_core_nav.css */

body > header,
#nav-bar {
	width: 100vw;
	height: 10vh;
}

body > header {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
}

body > header a {
  color: white;
  text-decoration: none;
}

#nav-bar {
	position: fixed;
	top: 0;
	left: 0;
	height: 10vh;
	width: 100vw;
	background-color: var(--mainColorTransparent);
	z-index: 2;
}

#logo-name {
	position: fixed;
	top: 28px;
	left: 50%;
	transform: translateX(-50%);
	color: white;
	z-index: 2;
	font-family: var(--font-brand);
	font-size: var(--font-size-logo);
	font-weight: var(--font-weight-bold);
	display: flex;
	gap: 1rem;
	min-width: 75vw;
	justify-content: center;
	align-items: center;
	cursor: pointer;
	transition: all 0.3s ease; /* Smooth transition for position changes */
}

#logo-name.logo-left.front-page {
	position: absolute !important;
}

#logo-name img {
	max-height: 5vh;
	width: auto;
}

#site-name,
#site-logo {
	align-self: center;
}

.user-nav,
#nav-bar.user-nav {
	margin-top: 32px;
}

/* --- Side slide-in menu: "glowing in the dark" styling -------------------
   Dark surface matching the landing page palette, amber accents on hover /
   expand icons, and a soft divider between items so the panel reads as a
   list without visible bullets or boxes. */

body > nav {
	position: fixed;
	top: 0;
	left: 0;
	width: 40vw;
	height: 100vh;
	animation: 0.5s slideInFromLeft forwards;
	background-color: var(--ff-surface, #141416);
	border-right: 1px solid var(--ff-border, rgba(255, 255, 255, 0.08));
	color: var(--ff-fg, #fafaf7);
	z-index: 4;
}

body > nav.slide-out {
	animation: 0.5s slideOutFromLeft forwards;
}

body > nav .website-menu {
	max-height: 85vh;
	overflow-y: auto;
	padding: 2.5rem 2rem 2rem;
}

body > nav a {
	color: var(--ff-fg, #fafaf7);
	text-decoration: none;
	transition: color 0.2s ease;
}

body > nav a:hover {
	color: var(--ff-amber, #f5b544);
}

.menu {
	margin-top: 3.5rem;
}

body > nav,
#close-nav-btn {
    display: none;
}

body > nav a {
	display: inline-block;
	width: 100%;
	font-family: var(--font-nav);
	font-size: var(--font-size-nav);
	font-weight: var(--font-weight-bold);
	text-align: right;
	padding: 0.6rem 0;
}

body > nav ul .menu-item {
	position: relative;
	border-bottom: 1px solid var(--ff-border, rgba(255, 255, 255, 0.08));
}

/* Position the link for top-level items */
body > nav .menu-item > a {
	display: block;
}

/* Position the link for nested items */
body > nav .sub-menu .menu-item > a {
	display: block;
}

/* Expand icon — amber accent, left edge of the right-aligned row */
body > nav .menu-item .expand-icon {
	position: absolute;
	left: 0;
	top: 0;
	width: 2rem;
	height: 2.6rem;
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	color: var(--ff-amber, #f5b544);
	font-size: 1.4rem;
	font-weight: 300;
	z-index: 1;
	transition: transform 0.3s ease;
}

body > nav .sub-menu {
	max-height: 0;
	transition: max-height 0.4s ease-out;
	overflow-y: hidden; /* Keep vertical clipping for animation */
	padding-right: 1rem;
	border-right: 2px solid var(--ff-amber-ring, rgba(245, 181, 68, 0.28));
}

body > nav .sub-menu a {
	font-size: 1.05rem;
	font-weight: 400;
	padding: 0.4rem 0;
	color: var(--ff-fg-muted, rgba(250, 250, 247, 0.72));
}

body > nav .sub-menu a:hover {
	color: var(--ff-amber, #f5b544);
}

body > nav ul {
	padding: 0;
}

body > nav ul > li {
	margin-top: .5rem;
}

body > nav li {
    list-style: none;
}

/* Menu items are now controlled via JavaScript based on authentication */

/* Generic Submenu Fixes - Handles Unlimited Nesting Levels */

/* Ensure nested submenus are properly displayed */
body > nav .website-menu .sub-menu {
    display: block !important;
    position: static !important;
    box-shadow: none !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    width: 100% !important;
    min-width: auto !important;
    max-width: none !important;
    overflow: hidden !important;
    transition: max-height 0.4s ease-out;
}

/* Ensure all nested submenu items are visible when parent is expanded */
body > nav .website-menu .sub-menu li {
    display: list-item !important;
    position: relative !important;
    float: none !important;
    clear: both !important;
    width: 100% !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    overflow: visible !important;
    margin-top: 0.25rem !important;
}

/* Ensure all nested submenu links are visible */
body > nav .website-menu .sub-menu a {
    display: block !important;
    color: var(--ff-fg-muted, rgba(250, 250, 247, 0.72)) !important;
    text-decoration: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    position: static !important;
    width: 100% !important;
    text-align: right;
}

body > nav .website-menu .sub-menu a:hover {
    color: var(--ff-amber, #f5b544) !important;
}

/* Force visibility for any authentication-hidden submenu items */
body > nav .sub-menu li[style*="display: none"] {
    display: list-item !important;
}

body > nav .sub-menu li[style*="visibility: hidden"] {
    visibility: visible !important;
}

/* --- Hamburger button: three bars that morph into an X ------------------
   CSS-drawn so it can animate with transforms instead of crossfading two
   images. `body.menu-open` drives the X state; we don't swap display
   between hamburger / close-nav-btn anymore. */

button#hamburger {
	position: fixed;
	top: 25px;
	left: 25px;
	width: 32px;
	height: 24px;
	padding: 0;
	background: transparent;
	border: 0;
	cursor: pointer;
	z-index: 5;
	outline: none;
	-webkit-tap-highlight-color: transparent;
	display: block;
}

/* Legacy <img id="hamburger"> used by views/app.html — keep image-style
   sizing for that path only. */
img#hamburger {
	max-width: 35px;
	height: auto;
	z-index: 5;
	position: fixed;
	top: 25px;
	left: 25px;
	cursor: pointer;
}

#hamburger .bar {
	position: absolute;
	left: 0;
	width: 100%;
	height: 2px;
	background: var(--ff-fg, #fafaf7);
	border-radius: 2px;
	transform-origin: center;
	transition: transform 0.35s cubic-bezier(.65, .05, .36, 1), opacity 0.2s ease, top 0.35s ease, bottom 0.35s ease;
}

#hamburger .bar-1 { top: 0; }
#hamburger .bar-2 { top: 50%; transform: translateY(-50%); }
#hamburger .bar-3 { bottom: 0; }

body.menu-open #hamburger .bar-1,
#hamburger.is-open .bar-1 {
	top: 50%;
	transform: translateY(-50%) rotate(45deg);
}
body.menu-open #hamburger .bar-2,
#hamburger.is-open .bar-2 {
	opacity: 0;
	transform: translateY(-50%) scaleX(0.2);
}
body.menu-open #hamburger .bar-3,
#hamburger.is-open .bar-3 {
	bottom: auto;
	top: 50%;
	transform: translateY(-50%) rotate(-45deg);
}

/* Landing page: hamburger dims as the user scrolls past the hero so
   the sticky button recedes into the content. Full opacity restores on
   hover or when scrolled back to top. */
body.page-home #hamburger {
	transition: opacity 0.3s ease;
}
body.page-home #hamburger.scrolled-dim {
	opacity: 0.3;
}
body.page-home #hamburger.scrolled-dim:hover,
body.page-home.menu-open #hamburger {
	opacity: 1;
}

/* Legacy close button — no longer rendered by header.php, but keep it
   hidden defensively in case a cached or older template serves it. */
#close-nav-btn {
	display: none !important;
}

#backdrop {
	display: none;
	width: 100vw;
	height: 200vh;
	top: -50vh;
	background-color: rgba(10, 10, 11, 0.88);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	position: fixed;
	z-index: 3;
	animation: 0.5s fadeIn forwards;
}

#backdrop.fade {
	animation: 0.5s fadeOut forwards;
}

@media (max-width: 800px) {
	body > nav {
		width: 70vw;
	}

	#logo-name img {
		max-height: 4.5vh;
	}

	#logo-name {
		font-size: 1.4rem;
		gap: 0.5rem;
		white-space: nowrap;
	}

	#site-name a {
		white-space: nowrap;
	}

	#wpadminbar {
		position: fixed;
	}
	
	/* Critical: Re-enable ONLY hamburger menu at mobile breakpoint even with .element-disable */
	.element-disable #hamburger {
		display: block !important;
	}
	
	/* Ensure the parent container of hamburger element is shown */
	.element-disable:has(#hamburger) {
		display: block !important;
	}
	
	/* Close button should remain hidden initially (shown by JS when menu opens) */
	.element-disable #close-nav-btn {
		display: none !important;
	}
	
	/* Make sure nav functionality works normally at mobile */
	body > nav {
		display: none; /* Still hidden by default, shown by JS */
	}
	
	/* Ensure logo returns to center on mobile regardless of .logo-left class */
	#logo-name.logo-left {
		position: fixed;
		top: 28px;
		left: 50% !important;
		transform: translateX(-50%) !important;
		justify-content: center !important;
		min-width: 75vw !important;
	}
	
	/* Adjust font size + padding for mobile navigation */
	body > nav a {
		font-size: var(--font-size-nav-mobile);
		padding: 0.7rem 0;
	}

	body > nav .sub-menu a {
		font-size: 1.1rem;
		padding: 0.5rem 0;
	}
}

/* Ensure overlay menu elements are properly hidden on desktop when not using overlay */
@media (min-width: 801px) {
	/* When overlay menu is not active, these should remain hidden */
	.element-disable:not(:has(#overlay-menu-container)):not(:has(#nav-overlay-container)) {
		display: none;
	}
}

/* Profile Dropdown Styles */
#profile-dropdown-container {
	position: fixed;
	top: 25px;
	right: 25px;
	z-index: 6;
	-webkit-tap-highlight-color: transparent;
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}

/* Hide profile dropdown behind backdrop when menu is open */
body.menu-open #profile-dropdown-container {
	z-index: 0;
}

/* Hide profile dropdown initially until auth state is determined */
#profile-dropdown-container {
	display: none;
}

/* Show profile dropdown only when auth state is determined */
body.auth-checked #profile-dropdown-container {
	display: block;
}

/* Hide main navigation initially until auth state is determined */
body > nav {
	visibility: hidden;
	opacity: 0;
	transition: opacity 0.2s ease;
}

/* Hide all nav menu items initially */
body > nav ul li {
	display: none !important;
}

/* Show main navigation only when auth state is determined */
body.auth-checked > nav {
	visibility: visible;
	opacity: 1;
}

/* Allow nav items to be shown after auth check (override the !important) */
body.auth-checked > nav ul li {
	display: list-item !important;
}

/* Hide auth-specific items (login/signup when logged in, etc.) */
body.auth-checked > nav ul > li.auth-hide {
	display: none !important;
}

/* Profile button — circular amber-tinted icon button matching the
   firefly-page chrome. Sits top-right next to the nav. */
#profile-button {
	background: var(--ff-amber-soft);
	border: 1px solid var(--ff-amber-ring);
	border-radius: 50%;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 200ms ease, border-color 200ms ease, transform 200ms ease;
	color: var(--ff-fg);
	padding: 0;
	-webkit-tap-highlight-color: transparent;
	-webkit-user-select: none;
	user-select: none;
	outline: none;
}

#profile-button:hover {
	background: var(--ff-amber);
	border-color: var(--ff-amber);
	color: #0a0a0b;
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(245, 181, 68, 0.22);
}

#profile-button:focus-visible {
	outline: 2px solid var(--ff-amber-ring);
	outline-offset: 3px;
}

#profile-button svg {
	width: 22px;
	height: 22px;
	color: currentColor;
}

/* Dropdown panel — dark surface, amber accents, matches the side-nav
   slide-in panel from _core_nav.css. */
.profile-dropdown-menu {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	background: var(--ff-surface);
	border: 1px solid var(--ff-border);
	border-radius: var(--ff-radius);
	box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 2px 8px rgba(0, 0, 0, 0.3);
	min-width: 200px;
	padding: 0.375rem 0;
	opacity: 0;
	visibility: hidden;
	transform: translateY(-6px);
	transition: opacity 200ms ease, transform 200ms ease, visibility 200ms;
	overflow: hidden;
}

.profile-dropdown-menu[aria-hidden="false"] {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.profile-dropdown-item {
	cursor: pointer;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.625rem 1rem;
	color: var(--ff-fg);
	text-decoration: none;
	font-family: var(--ff-font-sans);
	font-size: 0.875rem;
	font-weight: 500;
	letter-spacing: -0.005em;
	transition: background-color 180ms ease, color 180ms ease, padding-left 180ms ease;
	-webkit-tap-highlight-color: transparent;
	-webkit-user-select: none;
	user-select: none;
	outline: none;
}

.profile-dropdown-item:hover,
.profile-dropdown-item:focus-visible {
	background-color: var(--ff-amber-soft);
	color: var(--ff-amber);
	padding-left: 1.25rem;
}

.profile-dropdown-item svg {
	width: 16px;
	height: 16px;
	flex-shrink: 0;
	opacity: 0.75;
	transition: opacity 180ms ease;
}

.profile-dropdown-item:hover svg {
	opacity: 1;
}

.profile-dropdown-item:not(:last-child) {
	border-bottom: 1px solid var(--ff-border);
}

/* Adjust profile dropdown for user-nav state */
#profile-dropdown-container.user-nav {
	margin-top: 32px;
}

/* Mobile adjustments */
@media (max-width: 800px) {
	#profile-dropdown-container {
		top: 20px;
		right: 20px;
	}

	#profile-button {
		width: 35px;
		height: 35px;
	}

	#profile-button svg {
		width: 20px;
		height: 20px;
	}

	.profile-dropdown-menu {
		min-width: 160px;
	}

	.profile-dropdown-item {
		padding: 10px 14px;
		font-size: 13px;
	}
}