/* =========================================================
   NJ BEAUTY COURSES — PREMIUM MOBILE NAVIGATION
   Sticky brand bar + full-screen drawer + student bottom nav.
   Replaces the block theme's default responsive overlay on
   phones (<=600px). Desktop nav is left untouched.
   Loaded after nj-brand.css so it inherits the :root brand
   variables (--nj-gold, --nj-ivory, --nj-espresso, etc).
   ========================================================= */

/* Hidden by default (desktop / tablet keep the theme's own nav). */
.nj-mobnav-bar,
.nj-mobnav-scrim,
.nj-mobnav-drawer,
.nj-bottomnav {
	display: none;
}

/* Body scroll lock while the drawer is open (applied by JS, any width). */
html.nj-nav-locked,
html.nj-nav-locked body {
	overflow: hidden;
	touch-action: none;
}

@media (max-width: 599.98px) {

	/* --- Swap the theme header for our own sticky bar --- */
	header.wp-block-template-part {
		display: none !important;
	}

	body {
		padding-top: 64px;
	}

	body.nj-has-bottomnav {
		padding-bottom: 66px;
	}

	/* If the course sticky enrol CTA is present, the student bottom nav
	   supersedes it — one bottom bar, never two stacked. */
	body.nj-has-bottomnav .nj-sticky-cta {
		display: none !important;
	}

	/* =======================  TOP BAR  ======================= */
	.nj-mobnav-bar {
		position: fixed;
		top: 0;
		left: 0;
		right: 0;
		z-index: 1000;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		height: 64px;
		padding: 0 16px;
		background: var(--nj-ivory);
		border-bottom: 1px solid var(--nj-border);
		box-shadow: 0 2px 14px rgba(42, 27, 20, 0.05);
	}

	.nj-mobnav-brand {
		display: flex;
		flex-direction: column;
		line-height: 1.1;
		text-decoration: none;
		min-width: 0;
	}

	/* When a site logo is set, show it in place of the name/tagline text. */
	.nj-mobnav-brand--logo {
		flex-direction: row;
		align-items: center;
	}

	.nj-mobnav-logo {
		display: block;
		height: 36px;
		width: auto;
	}

	.nj-mobnav-drawer__head .nj-mobnav-logo {
		height: 42px;
	}

	.nj-mobnav-brand__name {
		font-family: var(--nj-font-heading);
		font-weight: 700;
		font-size: 18px;
		color: var(--nj-espresso);
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.nj-mobnav-brand__sub {
		font-size: 10px;
		letter-spacing: 0.14em;
		text-transform: uppercase;
		color: var(--nj-gold-dark);
		font-weight: 700;
		margin-top: 3px;
	}

	.nj-mobnav-toggle {
		flex-shrink: 0;
		width: 44px;
		height: 44px;
		border-radius: 50%;
		border: 1px solid var(--nj-border);
		background: var(--nj-cream);
		color: var(--nj-espresso);
		display: flex;
		align-items: center;
		justify-content: center;
		cursor: pointer;
		box-shadow: var(--nj-shadow-sm);
		transition: background-color .18s ease, border-color .18s ease;
	}

	.nj-mobnav-toggle:active {
		background: var(--nj-gold-light);
		border-color: var(--nj-gold);
	}

	/* =======================  SCRIM  ======================= */
	.nj-mobnav-scrim {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 1001;
		background: rgba(42, 27, 20, 0.45);
		opacity: 0;
		visibility: hidden;
		transition: opacity .25s ease, visibility .25s ease;
	}

	.nj-mobnav.is-open .nj-mobnav-scrim {
		opacity: 1;
		visibility: visible;
	}

	/* =======================  DRAWER  ======================= */
	.nj-mobnav-drawer {
		display: block;
		position: fixed;
		inset: 0;
		z-index: 1002;
		background: var(--nj-cream);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
		transform: translateX(100%);
		visibility: hidden;
		transition: transform .32s cubic-bezier(.4, 0, .2, 1), visibility .32s;
	}

	.nj-mobnav.is-open .nj-mobnav-drawer {
		transform: none;
		visibility: visible;
	}

	.nj-mobnav-drawer__inner {
		max-width: 420px;
		margin: 0 auto;
		min-height: 100%;
		display: flex;
		flex-direction: column;
		padding: 18px 20px calc(28px + env(safe-area-inset-bottom, 0px));
	}

	.nj-mobnav-drawer__head {
		display: flex;
		align-items: flex-start;
		justify-content: space-between;
		gap: 12px;
		padding-bottom: 16px;
		margin-bottom: 20px;
		border-bottom: 1px solid var(--nj-border);
	}

	.nj-mobnav-close {
		flex-shrink: 0;
		width: 44px;
		height: 44px;
		border-radius: 50%;
		border: 1px solid var(--nj-border);
		background: var(--nj-ivory);
		color: var(--nj-espresso);
		display: flex;
		align-items: center;
		justify-content: center;
		cursor: pointer;
		transition: background-color .18s ease, border-color .18s ease;
	}

	.nj-mobnav-close:active {
		background: var(--nj-gold-light);
		border-color: var(--nj-gold);
	}

	/* --- Intro / welcome card --- */
	.nj-mobnav-card {
		background: var(--nj-ivory);
		border: 1px solid var(--nj-border);
		border-radius: var(--nj-radius-lg);
		padding: 20px;
		box-shadow: var(--nj-shadow-sm);
	}

	.nj-mobnav-card__eyebrow {
		font-size: 11px;
		font-weight: 700;
		letter-spacing: 0.12em;
		text-transform: uppercase;
		color: var(--nj-gold-dark);
		margin: 0 0 6px;
	}

	.nj-mobnav-card__title {
		font-family: var(--nj-font-heading);
		font-size: 22px;
		line-height: 1.2;
		color: var(--nj-espresso);
		margin: 0 0 8px;
	}

	.nj-mobnav-card__text {
		font-size: 14px;
		line-height: 1.55;
		color: var(--nj-muted);
		margin: 0 0 16px;
	}

	/* --- CTA buttons --- */
	.nj-mobnav-cta {
		display: flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		min-height: 52px;
		padding: 14px 22px;
		border-radius: var(--nj-radius-pill);
		font-family: var(--nj-font-body);
		font-weight: 700;
		font-size: 15px;
		text-align: center;
		text-decoration: none;
		transition: transform .15s ease, box-shadow .18s ease;
	}

	.nj-mobnav-cta--primary {
		background: linear-gradient(135deg, var(--nj-gold), var(--nj-gold-dark));
		color: #fff;
		border: 1px solid transparent;
		box-shadow: 0 12px 30px rgba(168, 132, 63, 0.28);
	}

	.nj-mobnav-cta--secondary {
		margin-top: 10px;
		background: transparent;
		color: var(--nj-espresso);
		border: 1px solid rgba(198, 167, 105, 0.5);
	}

	.nj-mobnav-cta:active {
		transform: translateY(1px);
	}

	/* --- Menu sections --- */
	.nj-mobnav-menu {
		margin-top: 22px;
	}

	.nj-mobnav-menu__label {
		font-size: 11px;
		font-weight: 700;
		letter-spacing: 0.14em;
		text-transform: uppercase;
		color: var(--nj-muted);
		margin: 0 0 6px;
		padding: 0 4px;
	}

	.nj-mobnav-list + .nj-mobnav-menu__label {
		margin-top: 18px;
		padding-top: 18px;
		border-top: 1px solid var(--nj-border);
	}

	.nj-mobnav-list {
		list-style: none;
		margin: 0;
		padding: 0;
	}

	.nj-mobnav-link {
		display: flex;
		align-items: center;
		gap: 12px;
		min-height: 52px;
		padding: 12px 14px;
		border-radius: 16px;
		color: var(--nj-espresso);
		text-decoration: none;
		font-weight: 600;
		font-size: 15px;
		transition: background-color .16s ease;
	}

	.nj-mobnav-link__ico {
		display: flex;
		flex-shrink: 0;
		color: var(--nj-gold-dark);
	}

	.nj-mobnav-link__label {
		flex: 1;
	}

	.nj-mobnav-link__chev {
		display: flex;
		flex-shrink: 0;
		color: var(--nj-muted);
		opacity: 0.45;
	}

	.nj-mobnav-link:hover,
	.nj-mobnav-link:focus,
	.nj-mobnav-link:active,
	.nj-mobnav-link.is-active {
		background: rgba(198, 167, 105, 0.16);
		color: var(--nj-espresso);
		outline: none;
	}

	/* --- Help block (sits at the foot of the drawer) --- */
	.nj-mobnav-help {
		display: flex;
		gap: 12px;
		margin-top: 28px;
		padding: 16px;
		border-radius: 16px;
		background: var(--nj-ivory);
		border: 1px solid var(--nj-border);
	}

	.nj-mobnav-help__ico {
		flex-shrink: 0;
		color: var(--nj-gold-dark);
	}

	.nj-mobnav-help__title {
		font-weight: 700;
		font-size: 14px;
		color: var(--nj-espresso);
		margin: 0 0 2px;
	}

	.nj-mobnav-help__text {
		font-size: 13px;
		line-height: 1.5;
		color: var(--nj-muted);
		margin: 0;
	}

	/* =======================  BOTTOM NAV  ======================= */
	.nj-bottomnav {
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		z-index: 999;
		display: flex;
		align-items: stretch;
		justify-content: space-around;
		background: var(--nj-cream);
		border-top: 1px solid var(--nj-border);
		box-shadow: 0 -6px 20px rgba(42, 27, 20, 0.06);
		padding-bottom: env(safe-area-inset-bottom, 0px);
	}

	.nj-bottomnav__item {
		flex: 1;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		gap: 3px;
		min-height: 60px;
		padding: 8px 2px;
		text-decoration: none;
		color: var(--nj-muted);
		font-size: 10px;
		font-weight: 600;
		letter-spacing: 0.01em;
	}

	.nj-bottomnav__item .nj-ico {
		width: 22px;
		height: 22px;
	}

	.nj-bottomnav__item.is-active {
		color: var(--nj-gold-dark);
	}

	.nj-bottomnav__item--primary {
		color: var(--nj-espresso);
	}

	.nj-bottomnav__fab {
		width: 46px;
		height: 46px;
		margin-top: -20px;
		border-radius: 50%;
		background: linear-gradient(135deg, var(--nj-gold), var(--nj-gold-dark));
		color: #fff;
		display: flex;
		align-items: center;
		justify-content: center;
		box-shadow: 0 8px 20px rgba(168, 132, 63, 0.35);
		border: 3px solid var(--nj-cream);
	}

	/* =======================  ADMIN BAR OFFSETS  =======================
	   Only editors/admins still get the WordPress toolbar (students are opted
	   out in PHP). On mobile WP makes #wpadminbar `position:absolute`, so it
	   scrolls away and leaves a 46px gap above our fixed bar. Pin it `fixed`
	   so it stays put and our 46px offset never reveals a gap on scroll. */
	body.admin-bar #wpadminbar {
		position: fixed !important;
		top: 0 !important;
	}

	body.admin-bar .nj-mobnav-bar {
		top: 46px;
	}

	body.admin-bar .nj-mobnav-drawer {
		top: 46px;
	}
}
