/* =============================================================================
   Menu principal Wine Line
   Shortcode : [wineline_main_menu]

   Stratégie sur fond blanc :
   - Texte navigation en anthracite (lisible)
   - Or laiton réservé au soulignement / item courant (signature de marque)

   Tokens utilisés : voir style.css du child theme.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Conteneur
   ----------------------------------------------------------------------------- */
.wl-main-menu {
	width: 100%;
	font-family: var(--wl-font-body);
}

.wl-menu {
	list-style: none !important;
	margin: 0 !important;
	padding: 0 !important;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 2.5rem;
}

/* -----------------------------------------------------------------------------
   Item top-level
   ----------------------------------------------------------------------------- */
.wl-menu-item {
	position: relative;
	margin: 0 !important;
	padding: 0 !important;
}

.wl-menu-link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	padding: 1rem 0;
	color: var(--wl-color-primary) !important;
	text-decoration: none !important;
	font-size: 0.95rem !important;
	font-weight: 500 !important;
	letter-spacing: 0.02em;
	transition: color 0.2s ease;
	position: relative;
}

/* Soulignement animé en or laiton (signature de marque) */
.wl-menu-item-top > .wl-menu-link::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0.6rem;
	height: 2px;
	background: var(--wl-color-secondary);
	transform: scaleX(0);
	transform-origin: center;
	transition: transform 0.25s ease;
}

.wl-menu-item-top > .wl-menu-link:hover::after,
.wl-menu-item-top.wl-is-current > .wl-menu-link::after {
	transform: scaleX(1);
}

/* Le texte ne change pas de couleur au hover (on garde l'anthracite pour la lisibilité) */
/* Sauf l'item courant : on ajoute juste un poids légèrement plus fort */
.wl-menu-item-top.wl-is-current > .wl-menu-link {
	font-weight: 600 !important;
}

/* Flèche de dropdown */
.wl-menu-arrow {
	display: inline-flex;
	align-items: center;
	transition: transform 0.2s ease, color 0.2s ease;
	color: var(--wl-color-steel);
}

.wl-has-children:hover > .wl-menu-link .wl-menu-arrow,
.wl-has-children.wl-is-open > .wl-menu-link .wl-menu-arrow {
	transform: rotate(180deg);
	color: var(--wl-color-secondary-dk);
}

/* Toggle button (mobile uniquement) */
.wl-menu-toggle {
	display: none;
	background: none;
	border: 0;
	width: 44px;
	height: 44px;
	cursor: pointer;
	position: absolute;
	top: 0;
	right: 0;
}

/* -----------------------------------------------------------------------------
   Sous-menu (dropdown)
   ----------------------------------------------------------------------------- */
.wl-submenu {
	list-style: none !important;
	margin: 0 !important;
	padding: 0.5rem 0 !important;
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%) translateY(-8px);
	min-width: 240px;
	background: var(--wl-color-white);
	border: 1px solid var(--wl-color-border);
	box-shadow: var(--wl-shadow-md);
	border-radius: var(--wl-radius-lg);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
	z-index: 100;
}

.wl-has-children:hover > .wl-submenu,
.wl-has-children:focus-within > .wl-submenu,
.wl-has-children.wl-is-open > .wl-submenu {
	opacity: 1;
	visibility: visible;
	transform: translateX(-50%) translateY(0);
}

.wl-submenu .wl-menu-link {
	display: block;
	padding: 0.7rem 1.5rem;
	font-size: 0.9rem !important;
	font-weight: 400 !important;
	color: var(--wl-color-primary) !important;
	white-space: nowrap;
	transition: background 0.15s ease, color 0.15s ease;
}

.wl-submenu .wl-menu-link::after { display: none; }

.wl-submenu .wl-menu-link:hover {
	background: var(--wl-color-bg-soft);
	color: var(--wl-color-secondary-dk) !important;
}

.wl-submenu .wl-is-current > .wl-menu-link {
	background: var(--wl-color-bg-soft);
	color: var(--wl-color-secondary-dk) !important;
	font-weight: 500 !important;
}

/* -----------------------------------------------------------------------------
   Mobile : transformation en stack vertical avec accordéon
   ----------------------------------------------------------------------------- */
@media (max-width: 768px) {
	.wl-menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.wl-menu-item {
		border-bottom: 1px solid var(--wl-color-border);
	}

	.wl-menu-item:last-child { border-bottom: 0; }

	.wl-menu-link {
		padding: 1rem 1.25rem;
		justify-content: space-between;
	}

	.wl-menu-item-top > .wl-menu-link::after { display: none; }

	/* Toggle visible sur mobile pour les items à enfants */
	.wl-has-children > .wl-menu-toggle { display: block; }

	.wl-has-children > .wl-menu-toggle::before {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		width: 12px;
		height: 12px;
		border-right: 1.5px solid var(--wl-color-primary);
		border-bottom: 1.5px solid var(--wl-color-primary);
		transform: translate(-50%, -65%) rotate(45deg);
		transition: transform 0.2s ease;
	}

	.wl-has-children.wl-is-open > .wl-menu-toggle::before {
		transform: translate(-50%, -35%) rotate(-135deg);
	}

	.wl-has-children > .wl-menu-link .wl-menu-arrow { display: none; }

	/* Sous-menu en accordéon (pas absolute) */
	.wl-submenu {
		position: static !important;
		transform: none !important;
		box-shadow: none !important;
		border: 0 !important;
		border-radius: 0 !important;
		background: var(--wl-color-bg-soft) !important;
		min-width: auto;
		opacity: 1;
		visibility: visible;
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.3s ease;
		padding: 0 !important;
	}

	.wl-has-children.wl-is-open > .wl-submenu {
		max-height: 500px;
		padding: 0.25rem 0 !important;
	}

	.wl-submenu .wl-menu-link {
		padding: 0.8rem 2rem;
	}
}
