/* ==========================================================================
   ChessDZ Super Header — styles frontend
   Les couleurs / police / tailles sont pilotées par variables CSS
   générées dynamiquement depuis le panneau d'administration.
   ========================================================================== */

.cdzsh-header {
	--cdzsh-primary: #1F3A5F;
	--cdzsh-accent: #C9A227;
	--cdzsh-bg: #F4E8CE;
	--cdzsh-text: #1F3A5F;
	--cdzsh-font: 'Poppins', sans-serif;
	--cdzsh-logo-size: 48px;
	--cdzsh-height: 80px;
	--cdzsh-content-gap: 0px;

	width: 100%;
	background-color: var(--cdzsh-primary);
	font-family: var(--cdzsh-font);
	box-sizing: border-box;
	z-index: 9999;
	transition: box-shadow 0.25s ease, background-color 0.25s ease;
}

.cdzsh-header * {
	box-sizing: border-box;
}

.cdzsh-header.cdzsh-sticky {
	position: sticky;
	top: 0;
}

.cdzsh-header.cdzsh-is-scrolled.cdzsh-shadow-on {
	box-shadow: 0 2px 14px rgba(0, 0, 0, 0.15);
}

/* ---- Espace entre le header et la 1ère section du thème ----
   Le header est injecté juste après <body> (hook wp_body_open), donc l'espace
   visible en dessous provient presque toujours d'une marge/padding posée par
   le thème sur son wrapper principal (#page, .site, #content, main, etc.).
   On neutralise cette marge par défaut puis on applique la valeur réglable
   --cdzsh-content-gap (option admin "Espace entre le header et la 1ère
   section"), ce qui permet de l'ajuster finement (y compris en négatif) sans
   toucher au code. */
.cdzsh-header {
	margin-bottom: 0 !important;
}

.cdzsh-header + * {
	margin-top: var(--cdzsh-content-gap, 0px) !important;
}

body > .cdzsh-header ~ #page,
body > .cdzsh-header ~ .site,
body > .cdzsh-header ~ #content,
body > .cdzsh-header ~ .site-content,
body > .cdzsh-header ~ main,
body > .cdzsh-header ~ #main-container {
	padding-top: 0 !important;
	margin-top: var(--cdzsh-content-gap, 0px) !important;
}

/* Cas Blocksy : sur ce thème, `main` n'est PAS un frère direct du header
   injecté après <body> — il est niché dans #main-container, lui-même le
   vrai frère du header (voir règle ci-dessus). Le padding vertical de
   Blocksy est en plus posé encore plus profondément, sur le conteneur de
   page (data-vertical-spacing), à l'intérieur de main. On neutralise donc
   ce padding via un sélecteur descendant (pas un frère direct), qui reste
   valable quelle que soit la profondeur d'imbrication du thème. */
body > .cdzsh-header ~ #main-container .ct-container-full[data-vertical-spacing] {
	padding-top: 0 !important;
}


/* ---- Anti-conflit thème (Blocksy et autres) --------------------------
   Certains thèmes ciblent des sélecteurs génériques comme "header nav"
   ou "nav ul li" pour leur propre système de menu, ce qui peut masquer
   notre <nav> puisqu'il est lui aussi injecté dans un <header>. Ces
   règles forcent l'affichage des éléments clés. Le comportement mobile
   (tiroir) reste géré par max-height/overflow, donc ce blindage ne casse
   rien : il ne touche ni position, ni max-height, ni flex-direction. */
.cdzsh-header {
	visibility: visible !important;
	opacity: 1 !important;
}

.cdzsh-header .cdzsh-container {
	display: flex !important;
}

.cdzsh-header nav.cdzsh-nav {
	display: flex !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.cdzsh-header ul.cdzsh-menu {
	display: flex !important;
	visibility: visible !important;
	opacity: 1 !important;
	list-style: none !important;
}

.cdzsh-header ul.cdzsh-menu > li {
	display: flex !important;
	visibility: visible !important;
	list-style: none !important;
}

.cdzsh-header ul.cdzsh-menu > li > a {
	display: inline-block !important;
	visibility: visible !important;
	opacity: 1 !important;
}

.cdzsh-container {
	max-width: 1280px;
	margin: 0 auto;
	min-height: var(--cdzsh-height);
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0 24px;
	gap: 16px;
	position: relative;
}

/* ---- Logo (gauche) ---- */
.cdzsh-logo {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
}

.cdzsh-logo a {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	background: var(--cdzsh-bg, #F4E8CE);
	padding: 6px 16px;
	border-radius: 8px;
	border: 1px solid var(--cdzsh-accent, #C9A227);
}

.cdzsh-logo-img {
	height: var(--cdzsh-logo-size);
	width: auto;
	display: block;
}

.cdzsh-logo-text {
	font-size: 1.4rem;
	font-weight: 700;
	color: #ffffff;
}

/* ---- Navigation (centre) ---- */
.cdzsh-nav {
	flex: 1 1 auto;
	display: flex;
	justify-content: center;
}

.cdzsh-menu {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	align-items: center;
	gap: 28px;
	flex-wrap: wrap;
	justify-content: center;
}

.cdzsh-menu li {
	position: relative;
}

.cdzsh-menu a {
	display: inline-block;
	color: #ffffff;
	text-decoration: none;
	font-weight: 500;
	font-size: 0.95rem;
	letter-spacing: 0.2px;
	padding: 8px 2px;
	transition: color 0.2s ease;
}

.cdzsh-menu a:hover,
.cdzsh-menu a:focus,
.cdzsh-menu .current-menu-item > a {
	color: var(--cdzsh-accent);
}

/* Sous-menus (niveau 2) */
.cdzsh-menu ul.sub-menu {
	list-style: none;
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 200px;
	background: var(--cdzsh-primary);
	margin: 0;
	padding: 8px 0;
	box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
	opacity: 0;
	visibility: hidden;
	transform: translateY(6px);
	transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
	z-index: 10000;
}

.cdzsh-menu li:hover > ul.sub-menu,
.cdzsh-menu li:focus-within > ul.sub-menu {
	opacity: 1;
	visibility: visible;
	transform: translateY(0);
}

.cdzsh-menu ul.sub-menu a {
	display: block;
	padding: 10px 18px;
	white-space: nowrap;
}

.cdzsh-admin-hint {
	color: #ffdede;
	font-size: 0.8rem;
	margin: 0;
}

/* ---- Réseaux sociaux (droite) ---- */
.cdzsh-socials {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 0 0 auto;
}

.cdzsh-social {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	color: #ffffff;
	background: rgba(255, 255, 255, 0.12);
	transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.cdzsh-social:hover,
.cdzsh-social:focus {
	background: var(--cdzsh-accent);
	color: var(--cdzsh-primary);
	transform: translateY(-2px);
}

/* ---- Bouton burger (mobile) ---- */
.cdzsh-burger {
	display: none;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	gap: 5px;
	width: 40px;
	height: 40px;
	background: transparent;
	border: none;
	cursor: pointer;
	padding: 0;
	flex: 0 0 auto;
}

.cdzsh-burger span {
	display: block;
	width: 24px;
	height: 2px;
	background: #ffffff;
	transition: transform 0.25s ease, opacity 0.25s ease;
}

.cdzsh-header.cdzsh-nav-open .cdzsh-burger span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.cdzsh-header.cdzsh-nav-open .cdzsh-burger span:nth-child(2) {
	opacity: 0;
}

.cdzsh-header.cdzsh-nav-open .cdzsh-burger span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

/* ==========================================================================
   Responsive — tablette
   ========================================================================== */
@media (max-width: 1024px) {
	.cdzsh-menu {
		gap: 18px;
	}

	.cdzsh-container {
		padding: 0 18px;
	}
}

/* ==========================================================================
   Responsive — mobile (menu en tiroir + burger)
   ========================================================================== */
@media (max-width: 782px) {
	.cdzsh-burger {
		display: inline-flex;
	}

	.cdzsh-nav {
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: var(--cdzsh-primary);
		flex-direction: column;
		max-height: 0;
		overflow: hidden;
		transition: max-height 0.3s ease;
		box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
	}

	.cdzsh-header.cdzsh-nav-open .cdzsh-nav {
		max-height: 80vh;
		overflow-y: auto;
	}

	.cdzsh-menu {
		flex-direction: column;
		align-items: flex-start;
		gap: 0;
		width: 100%;
		padding: 8px 24px 16px;
	}

	.cdzsh-menu li {
		width: 100%;
	}

	.cdzsh-menu a {
		width: 100%;
		padding: 12px 0;
		border-bottom: 1px solid rgba(255, 255, 255, 0.08);
	}

	.cdzsh-menu ul.sub-menu {
		position: static;
		box-shadow: none;
		opacity: 1;
		visibility: visible;
		transform: none;
		display: none;
		background: rgba(0, 0, 0, 0.12);
		padding-left: 16px;
	}

	.cdzsh-menu li.cdzsh-submenu-open > ul.sub-menu {
		display: block;
	}

	.cdzsh-socials {
		gap: 8px;
	}

	.cdzsh-logo-text {
		font-size: 1.15rem;
	}
}

@media (max-width: 480px) {
	.cdzsh-container {
		padding: 0 14px;
	}

	.cdzsh-social {
		width: 30px;
		height: 30px;
	}
}
