/**
 * Nav — Header navigation styles.
 *
 * Fixed-position nav with scroll-aware states.
 * Alpine.js handles mobile toggle; CSS handles all visual states.
 *
 * @package WEO
 */

/* ═══════════════════════════════════════════
   Site Header
   ═══════════════════════════════════════════ */

.site-header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: var(--z-nav);
	background: transparent;
	transition: background 0.4s ease, border-color 0.4s ease;
}

/* Admin bar offset — WP adds 32px admin bar when logged in */
.admin-bar .site-header {
	top: 32px;
}

@media (max-width: 782px) {
	.admin-bar .site-header {
		top: 46px;
	}
}

/* Scrolled state — JS adds this class */
.site-header.is-scrolled {
	background: var(--midnight);
	border-bottom: 1px solid rgba(168, 156, 200, 0.08);
}

/* Always-solid nav — for light-background templates (e.g. the Plain Page
   template) where the default transparent nav's light text would be
   invisible. Mirrors .is-scrolled so the two combine seamlessly on scroll. */
.weo-solid-nav .site-header {
	background: var(--midnight);
	border-bottom: 1px solid rgba(168, 156, 200, 0.08);
}

/* ═══════════════════════════════════════════
   Nav Container
   ═══════════════════════════════════════════ */

.nav-container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 var(--space-xl);
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: var(--nav-height);
	transition: height 0.4s ease;
}

/* ═══════════════════════════════════════════
   Logo
   ═══════════════════════════════════════════ */

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

.nav-logo:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 4px;
	border-radius: 6px;
}

.nav-logo__img {
	max-width: 150px;
	height: auto;
	transition: max-width 0.4s ease;
}

.nav-logo__icon {
	font-size: var(--text-h2);
	line-height: 1;
}

.nav-logo__text {
	font-family: var(--font-display);
	font-weight: 700;
	font-size: var(--text-h4);
	color: var(--white);
	letter-spacing: -0.02em;
}

/* ═══════════════════════════════════════════
   Desktop Nav Links
   ═══════════════════════════════════════════ */

.nav-links {
	display: none;
	align-items: center;
	gap: 28px;
}

@media (min-width: 960px) {
	.nav-links {
		display: flex;
	}
}

.nav-link {
	font-family: var(--font-body);
	font-weight: 500;
	color: var(--white);
	text-decoration: none;
	transition: color var(--transition-fast);
	padding: var(--space-xs) 0;
}

.nav-link:hover,
.nav-link:focus-visible {
	color: var(--subtle);
}

.nav-link:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* Active page link */
.nav-link--active {
	color: var(--white);
}

/* CTA button in nav */
.nav-cta {
	font-size: var(--text-s);
	padding: 9px 20px;
}

/* Plain-text "Log in" link sitting just before .nav-cta for signed-out
 * visitors. Mirrors .nav-link's muted-lavender / white-on-hover treatment
 * so it reads as a peer of the menu rather than a competing CTA. */
.nav-login {
	font-family: var(--font-body);
	font-size: var(--text-body);
	font-weight: 500;
	color: var(--white);
	text-decoration: none;
	margin-right: 14px;
	transition: color var(--transition-fast);
}

.nav-login:hover,
.nav-login:focus-visible {
	color: var(--subtle);
}

.nav-login:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* Logged-in member badge in nav */
.nav-member {
	display: flex;
	align-items: center;
	gap: 10px;
	text-decoration: none;
	padding: 5px 14px 5px 5px;
	border-radius: var(--radius-full);
	border: 1px solid rgba(255, 255, 255, 0.15);
	transition: all 0.25s ease;
}

.nav-member:hover {
	border-color: rgba(255, 255, 255, 0.3);
	background: rgba(255, 255, 255, 0.08);
}

.nav-member__avatar {
	width: 42px;
	height: 42px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(135deg, var(--accent) 0%, var(--violet) 100%);
	font-family: var(--font-heading);
	font-weight: 800;
	font-size: var(--text-s);
	color: var(--white);
	overflow: hidden;
	flex-shrink: 0;
}

.nav-member__avatar-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 50%;
}

.nav-member__info {
	display: flex;
	flex-direction: column;
	line-height: 1.2;
}

.nav-member__name {
	font-family: var(--font-body);
	font-size: var(--text-s);
	font-weight: 600;
	color: var(--white);
}

.nav-member__tier {
	font-family: var(--font-body);
	font-size: var(--text-xs);
	color: rgba(255, 255, 255, 0.6);
	font-weight: 600;
}

/* Wallet-credit pill — matches the account-menu badge
 * (.weo-sidebar-nav__wallet). margin-left: auto pins it to the
 * right edge of the full-width mobile member card; on the
 * content-width desktop pill it just trails the info block. */
.nav-member__wallet {
	margin-left: auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	padding: 2px 8px;
	background: var(--violet);
	color: var(--white);
	font-family: var(--font-body);
	font-size: var(--text-xs);
	font-weight: 700;
	border-radius: var(--radius-full);
	line-height: 1.4;
	white-space: nowrap;
}

/* Mobile nav member */
.mobile-nav__member {
	margin-top: var(--space-xl);
	width: 100%;
	justify-content: center;
	border-color: rgba(106, 96, 128, 0.2);
}

.mobile-nav__member .nav-member__name {
	color: var(--text-dark);
}

.mobile-nav__member .nav-member__tier {
	color: var(--text-mid);
}

.mobile-nav__member:hover {
	border-color: var(--accent);
	background: var(--accent-light);
}

@media (max-width: 959px) {
	.mobile-nav {
		display: flex;
		flex-direction: column;
	}
	.logged-in .mobile-nav__link {
		order: 2;
	}
	:not(.logged-in) .mobile-nav__login + .mobile-nav__cta {
		font-size: var(--text-body);
		padding: 14px 32px;
		line-height: 1.2;
	}
	.mobile-nav__member {
		justify-content: flex-start;
		margin: 0 0 var(--space-xl);
		border-color: rgba(106, 96, 128, 1);
		padding: 10px;
	}
	.nav-member__avatar {
		width: 60px;
		height: 60px;
		font-size: var(--text-body);
	}
	.mobile-nav__member .nav-member__name {
		font-size: var(--text-h3);
		color: var(--white);
	}
	.mobile-nav__member .nav-member__tier {
		font-size: var(--text-s);
		color: var(--subtle);
	}
	.nav-member__wallet {
		font-size: var(--text-s);
	}
}

/* ═══════════════════════════════════════════
   Mobile Menu Toggle (Hamburger)
   ═══════════════════════════════════════════ */

.nav-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
	position: relative;
	z-index: calc(var(--z-nav) + 2);
}

@media (min-width: 960px) {
	.nav-toggle {
		display: none;
	}
}

.nav-toggle__bar {
	display: block;
	width: 22px;
	height: 2px;
	background: var(--white);
	border-radius: 2px;
	transition: all 0.3s ease;
	position: absolute;
}

.nav-toggle__bar:nth-child(1) {
	transform: translateY(-7px);
}

.nav-toggle__bar:nth-child(3) {
	transform: translateY(7px);
}

/* Open state transforms */
.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(1) {
	transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(2) {
	opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle__bar:nth-child(3) {
	transform: rotate(-45deg);
}

/* ═══════════════════════════════════════════
   Mobile Nav Panel
   ═══════════════════════════════════════════ */

.mobile-nav {
	position: fixed;
	top: 0;
	right: 0;
	width: 100%;
	max-width: 400px;
	height: 100vh;
	height: 100dvh;
	background: var(--dark);
	z-index: calc(var(--z-nav) + 1);
	padding: calc(var(--nav-height) + var(--space-xl)) var(--space-xl) var(--space-xl);
	transform: translateX(100%);
	transition: transform 0.4s var(--ease-out-expo);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.mobile-nav[aria-hidden="false"] {
	transform: translateX(0);
}

/* Overlay behind mobile nav */
.mobile-nav-overlay {
	position: fixed;
	inset: 0;
	background: rgba(14, 10, 24, 0.7);
	z-index: var(--z-nav);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

.mobile-nav-overlay.is-active {
	opacity: 1;
	visibility: visible;
}

/* Mobile nav links */
.mobile-nav__link {
	display: block;
	font-family: var(--font-display);
	font-size: var(--text-m);
	font-weight: 600;
	color: var(--muted);
	padding: var(--space-md) 0;
	text-decoration: none;
	border-bottom: 1px solid rgba(168, 156, 200, 0.08);
	transition: color var(--transition-fast);
}

.mobile-nav__link:hover,
.mobile-nav__link:focus-visible {
	color: var(--accent);
}

.mobile-nav__link:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* Mobile-nav login link — plain underlined text above the join CTA. */
.mobile-nav__login {
	display: block;
    font-family: var(--font-display);
    font-size: var(--text-m);
    font-weight: 600;
    color: var(--muted);
    padding: var(--space-md) 0;
    text-decoration: none;
    border-bottom: 1px solid rgba(168, 156, 200, 0.08);
    transition: color var(--transition-fast);
	margin-bottom: var(--space-xl);
}

.mobile-nav__login:hover,
.mobile-nav__login:focus-visible {
	color: var(--accent);
}

.mobile-nav__login:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

/* Mobile nav CTA */
.mobile-nav__cta {
	margin-top: var(--space-xl);
	width: 100%;
	justify-content: center;
}

/* Tighter gap when the login link is the immediate sibling above. */
.mobile-nav__login + .mobile-nav__cta {
	margin-top: var(--space-md);
}

/* ═══════════════════════════════════════════
   Body Scroll Lock (when mobile nav open)
   ═══════════════════════════════════════════ */

body.nav-open {
	overflow: hidden;
}

/* ═══════════════════════════════════════════
   Scrolled state — shrink on mobile
   ═══════════════════════════════════════════ */

@media (max-width: 959px) {
	.site-header.is-scrolled .nav-container {
		height: 56px;
	}
	.site-header.is-scrolled .nav-logo__img {
		max-width: 110px;
	}
}
