/*
 * tdn-nav — glass pill blur navbar (unified across all pages)
 * Spec: docs/design-system-tdn.md §8.8 + Figma node 8115:5870
 * Mobile drawer spec: Figma node 8229:4604 (glassmorphism overlay)
 *
 * Required HTML structure (cf. tdn/data/patterns/tdn-nav.json):
 *
 *   <nav class="tdn-nav">
 *     <div class="tdn-nav__container">
 *       <a class="tdn-nav__logo">…logo…</a>
 *       <input type="checkbox" class="tdn-nav__toggle" id="tdn-nav-toggle" hidden>
 *       <label for="tdn-nav-toggle" class="tdn-nav__hamburger">…3 spans…</label>
 *       <div class="tdn-nav__collapse">                  ← wrapper (mobile drawer)
 *         <ul class="tdn-nav__menu">…items…</ul>
 *         <a class="tdn-nav__cta">CTA</a>
 *       </div>
 *     </div>
 *   </nav>
 */

.tdn-nav {
	position: fixed;
	top: 56px;
	left: 36px;
	right: 36px;
	z-index: 50;
	pointer-events: none; /* outer band is just for positioning */
}

.tdn-nav__container {
	position: relative;
	max-width: 1368px;
	margin: 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	min-height: 84px;
	padding: 16px 16px 16px 32px;
	background: rgba(26, 26, 46, 0.8);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, 0.06);
	border-radius: 99px;
	pointer-events: auto;
}

/* On desktop the wrapper unwraps via display:contents so menu + CTA become
 * direct flex children of .tdn-nav__container. The menu can then take flex:1
 * to centre itself between logo and CTA. The wrapper still holds them as
 * a single block on mobile (drawer mode below the pill).
 */
.tdn-nav__collapse {
	display: contents;
}

/* --- Logo ----------------------------------------------------------- */

.tdn-nav__logo {
	display: inline-flex;
	align-items: center;
	flex-shrink: 0;
	height: 50px;
	text-decoration: none;
	border-radius: 8px;
}

.tdn-nav__logo svg {
	height: 50px;
	width: auto;
	display: block;
}

.tdn-nav__logo:focus-visible {
	outline: 2px solid var(--tdn-color-pink-100, #F6C9D0);
	outline-offset: 4px;
}

/* --- Menu links ----------------------------------------------------- */

.tdn-nav__menu {
	display: flex;
	flex-wrap: nowrap;
	align-items: center;
	justify-content: center;
	flex: 1 1 auto;
	margin: 0;
	padding: 0;
	list-style: none;
	gap: 0;
}

.tdn-nav__menu li {
	margin: 0;
	padding: 0;
}

.tdn-nav__menu a {
	display: inline-flex;
	align-items: center;
	height: 40px;
	padding: 0 20px;
	font-family: var(--tdn-font-family-brand, 'Nunito Sans', sans-serif);
	font-weight: var(--tdn-font-weight-bold, 700);
	font-size: 16px;
	line-height: 24px;
	color: rgba(255, 255, 255, 0.7);
	text-decoration: none;
	border-radius: 40px;
	white-space: nowrap;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.tdn-nav__menu a:hover {
	color: #fff;
	background: rgba(255, 255, 255, 0.05);
}

.tdn-nav__menu a:focus-visible {
	outline: 2px solid var(--tdn-color-pink-100, #F6C9D0);
	outline-offset: 2px;
}

/* Active state — current page (set via aria-current="page" or .is-active) */
.tdn-nav__menu a[aria-current="page"],
.tdn-nav__menu a.is-active {
	color: var(--tdn-color-pink-100, #F6C9D0);
	background: rgba(242, 194, 202, 0.05);
}

.tdn-nav__menu a[aria-current="page"]:hover,
.tdn-nav__menu a.is-active:hover {
	background: rgba(242, 194, 202, 0.1);
}

/* --- CTA "Parler de mon projet" ------------------------------------ */

.tdn-nav__cta {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	flex-shrink: 0;
	height: 52px;
	padding: 8px 8px 8px 24px;
	background: var(--tdn-color-pink-primary, #C06D80);
	color: #fff;
	font-family: var(--tdn-font-family-brand, 'Nunito Sans', sans-serif);
	font-weight: var(--tdn-button-weight);
	font-size: 16px;
	line-height: 24px;
	text-transform: none;
	text-decoration: none;
	border: 0;
	border-radius: 40px;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 200ms ease;
}

.tdn-nav__cta:hover {
	background: var(--tdn-color-action-primary-hover, #C06D80);
	transform: scale(1.02);
}

.tdn-nav__cta:active {
	transform: scale(0.98);
}

.tdn-nav__cta:focus-visible {
	outline: 2px solid var(--tdn-color-pink-100, #F6C9D0);
	outline-offset: 2px;
}

.tdn-nav__cta::after {
	content: '';
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	flex-shrink: 0;
	box-sizing: border-box;
	background-color: var(--tdn-color-midnight, #1a1a2e);
	/* Stroke-based ↗ NE arrow, white. Asset: assets/images/icons/arrow-up-right.svg
	 * The path is geometrically centred at viewBox (8,8) with extra visual padding
	 * around (content fits in [4.5..11.5] range) to compensate for the head's
	 * optical weight at top-right. */
	background-image: url("../../images/icons/arrow-up-right.svg");
	background-position: 50% 50%;
	background-repeat: no-repeat;
	background-size: 16px 16px;
	border-radius: 40px;
	transition: transform 200ms ease;
}

.tdn-nav__cta:hover::after {
	transform: translateX(2px);
}

/* --- Hamburger (hidden on desktop) --------------------------------- */

.tdn-nav__hamburger {
	display: none;
	width: 40px;
	height: 40px;
	cursor: pointer;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 5px;
	flex-shrink: 0;
	border-radius: 40px;
	background: transparent;
	border: 0;
	padding: 0;
	transition: background-color 0.2s ease;
}

.tdn-nav__hamburger:hover {
	background: rgba(255, 255, 255, 0.05);
}

.tdn-nav__hamburger span {
	display: block;
	width: 22px;
	height: 2px;
	background: #fff;
	border-radius: 2px;
	transition: transform 0.25s ease, opacity 0.2s ease;
}

.tdn-nav__hamburger:focus-visible {
	outline: 2px solid var(--tdn-color-pink-100, #F6C9D0);
	outline-offset: 2px;
}

.tdn-nav[data-open="true"] .tdn-nav__hamburger span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.tdn-nav[data-open="true"] .tdn-nav__hamburger span:nth-child(2) {
	opacity: 0;
}

.tdn-nav[data-open="true"] .tdn-nav__hamburger span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* --- Mobile / tablet breakpoint ------------------------------------ */

@media (max-width: 1024px) {
	.tdn-nav {
		top: 16px;
		left: 16px;
		right: 16px;
	}

	.tdn-nav__container {
		min-height: 64px;
		padding: 12px 12px 12px 20px;
		gap: 12px;
	}

	.tdn-nav__hamburger {
		display: flex;
	}

	.tdn-nav__logo svg {
		height: 32px;
	}

	/* Collapse menu+CTA into a drawer below the pill (glassmorphism — Figma 8229:4604) */
	.tdn-nav__collapse {
		display: none;
		position: absolute;
		top: calc(100% + 12px);
		left: 0;
		right: 0;
		flex-direction: column;
		align-items: stretch;
		justify-content: flex-start;
		gap: 24px;
		padding: 24px;
		/* Glassmorphism Figma — opacity légèrement remontée (0.85→0.95, Morgan) pour lisibilité. */
		background: rgba(18, 18, 33, 0.95);
		-webkit-backdrop-filter: blur(20px);
		backdrop-filter: blur(20px);
		border: 1px solid rgba(255, 255, 255, 0.06);
		border-radius: 32px;
		/* Visible quand checkbox cochée (CSS-only) OU quand JS pose [data-open] sur .tdn-nav. */
	}

	.tdn-nav[data-open="true"] .tdn-nav__collapse {
		display: flex;
	}

	.tdn-nav__menu {
		flex-direction: column;
		align-items: stretch;
		gap: 8px;
	}

	.tdn-nav__menu a {
		height: 40px;
		padding: 8px 20px;
		font-size: 14px;
		justify-content: center;
		border-radius: 150px;
	}

	.tdn-nav__cta {
		justify-content: center;
		height: 40px;
		padding: 4px 8px 4px 20px;
		font-size: 14px;
		gap: 12px;
	}

	.tdn-nav__cta::after {
		width: 32px;
		height: 32px;
		background-size: 14px 14px;
	}
}

/* --- Reduced motion ------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.tdn-nav__menu a,
	.tdn-nav__cta,
	.tdn-nav__cta::after,
	.tdn-nav__hamburger,
	.tdn-nav__hamburger span {
		transition: none;
	}

	.tdn-nav__cta:hover,
	.tdn-nav__cta:hover::after {
		transform: none;
	}
}

/* --- Désactivation visuelle nav mobile GeneratePress native -------------- */
/* GP injecte 2 navs dans le DOM (main-navigation + mobile-menu-control-wrapper).
 * On les masque pour éviter double burger / double menu — notre tdn-nav prend le relais.
 * À nettoyer en remove_action() côté PHP une fois validé en prod. */
#mobile-menu-control-wrapper,
.main-navigation#site-navigation:not(.tdn-nav) {
	display: none !important;
}
