/* Header — maquette design/accueil.dc.html l. 35-106 (menu global : ADR-050).
 * Bascule menu/nav à 1200 px, comme la maquette (ADR-010, ADR-047, ADR-050, ADR-085). */

.wp-site-blocks > header.wp-block-template-part {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 50;
}

.sdl-header {
	/* Tailles du menu, des tiroirs et des contrôles de droite : handoff accueil compact §2 (menu mobile plein écran inchangé). */
	--sdl-nav-fs: var(--wp--preset--font-size--14);
	--sdl-nav-px: 8px;
	--sdl-nav-gap: 2px;
	--sdl-nav-ml: 4px;
	--sdl-ctl-h: 36px;
	--sdl-ctl-radius: var(--wp--preset--border-radius--8);
	--sdl-lang-fs: var(--wp--preset--font-size--12);
	--sdl-flag-w: 18px;
	--sdl-flag-h: 12px;
	--sdl-lang-opt-h: 38px;
	--sdl-lang-opt-fs: var(--wp--preset--font-size--14);
	--sdl-account-icon: 16px;
	--sdl-burger-w: 40px;
	--sdl-dd-w: 330px;
	--sdl-dd-pad: 6px;
	--sdl-dd-radius: var(--wp--preset--border-radius--12);
	--sdl-dd-row-py: 8px;
	--sdl-dd-row-px: 10px;
	--sdl-dd-row-radius: var(--wp--preset--border-radius--8);
	--sdl-dd-name-fs: 14.5px;
	--sdl-dd-tag-fs: 11px;
	--sdl-dd-desc-fs: var(--wp--preset--font-size--13);
	--sdl-dd-desc-pl: 28px;
	--sdl-dd-all-fs: 13.5px;
	background: rgba(10, 12, 16, 0.88);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--wp--preset--color--line);
}

.sdl-header__bar {
	height: var(--wp--custom--header--height);
}

/* Logo */
.sdl-header__logo {
	flex-shrink: 0;
	margin: 0;
}
.sdl-header__logo a {
	display: flex;
	align-items: center;
	position: relative;
}
.sdl-header__logo img {
	display: block;
	height: 20px;
	width: auto;
}
/* Sous 400 px, logo à 18 px (comme le footer) : « StarDeck Labs » (+13 px) ne tient plus à 375 px avec drapeaux et menu (ADR-047). */
@media (max-width: 399px) {
	.sdl-header__logo img {
		height: 18px !important; /* le bloc Image pose height:20px en style inline */
	}
}

/* Menu global desktop (walker SDL_Nav_Walker, ADR-050) : entrées de 40 px, tiroirs Logiciels et Matériel. */
.sdl-header .sdl-nav {
	margin-left: var(--sdl-nav-ml);
}
.sdl-nav__list,
.sdl-nav__sublist,
.sdl-mnav__list,
.sdl-mnav__sublist {
	margin: 0;
	padding: 0;
	list-style: none;
}
.sdl-nav__list {
	display: flex;
	align-items: center;
	gap: var(--sdl-nav-gap);
}
.sdl-nav__item {
	position: relative;
	margin: 0;
}
.sdl-header .sdl-nav__link {
	position: relative;
	display: flex;
	align-items: center;
	gap: 6px;
	height: 40px;
	padding: 0 var(--sdl-nav-px);
	border: 0;
	border-radius: var(--wp--preset--border-radius--8);
	background: transparent;
	color: var(--wp--preset--color--text-2);
	font-family: inherit;
	font-size: var(--sdl-nav-fs);
	font-weight: 500;
	line-height: 20px;
	white-space: nowrap;
	cursor: pointer;
}
.sdl-header .sdl-nav__link:hover,
.sdl-header .sdl-nav__link[aria-current="page"],
.sdl-header .sdl-nav__toggle[aria-expanded="true"] {
	color: var(--wp--preset--color--white);
	background: var(--wp--preset--color--stripe);
}
.sdl-nav__chevron {
	flex-shrink: 0;
	transition: transform 0.15s;
}
.sdl-nav__toggle[aria-expanded="true"] .sdl-nav__chevron {
	transform: rotate(180deg);
}

/* Entrée à tiroir avec page (Logiciels, ADR-079) : nom en lien, chevron en bouton, une seule pastille au survol. */
.sdl-header .sdl-nav__split {
	gap: 0;
	padding: 0;
	cursor: auto;
}
.sdl-header .sdl-nav__split:has(.sdl-nav__toggle[aria-expanded="true"]) {
	color: var(--wp--preset--color--white);
	background: var(--wp--preset--color--stripe);
}
.sdl-header .sdl-nav__parent {
	position: relative;
	display: flex;
	align-items: center;
	height: 100%;
	padding: 0 3px 0 var(--sdl-nav-px);
	border-radius: var(--wp--preset--border-radius--8) 0 0 var(--wp--preset--border-radius--8);
	color: inherit;
	text-decoration: none;
}
.sdl-header .sdl-nav__split .sdl-nav__toggle {
	position: relative;
	display: flex;
	align-items: center;
	height: 100%;
	padding: 0 var(--sdl-nav-px) 0 3px;
	border: 0;
	border-radius: 0 var(--wp--preset--border-radius--8) var(--wp--preset--border-radius--8) 0;
	background: transparent;
	color: inherit;
	cursor: pointer;
}

/* La zone de 48 px (règle 7) passe du conteneur au lien et au bouton, sinon elle les recouvrirait. */
.sdl-header .sdl-nav__split::before {
	display: none;
}
.sdl-header .sdl-nav__parent::before,
.sdl-header .sdl-nav__split .sdl-nav__toggle::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 48px;
	transform: translateY(-50%);
}
/* Focus : un seul contour sur toute la pastille, comme le bouton de la maquette. */
.sdl-header .sdl-nav__split:has(:focus-visible) {
	outline: 2px solid var(--wp--preset--color--link);
	outline-offset: 3px;
}
.sdl-header .sdl-nav__parent:focus-visible,
.sdl-header .sdl-nav__split .sdl-nav__toggle:focus-visible {
	outline: none;
}

/* Tiroir : décalé de 8 px sous l'entrée, zone de 8 px comprise dans le survol (padding-top). */
.sdl-nav__dd {
	position: absolute;
	top: 100%;
	left: -8px;
	z-index: 60;
	padding-top: 8px;
	display: none;
}
/* Sans JS : ouverture au survol et au focus clavier. */
.sdl-nav__item--dd.is-open .sdl-nav__dd,
:root:not(.sdl-js) .sdl-nav__item--dd:hover .sdl-nav__dd,
:root:not(.sdl-js) .sdl-nav__item--dd:focus-within .sdl-nav__dd {
	display: block;
}
.sdl-nav__panel {
	display: flex;
	flex-direction: column;
	width: min(var(--sdl-dd-w), calc(100vw - 40px));
	padding: var(--sdl-dd-pad);
	background: var(--wp--preset--color--surface-menu);
	border: 1px solid var(--wp--preset--color--line-panel);
	border-radius: var(--sdl-dd-radius);
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
.sdl-nav__sublist {
	display: flex;
	flex-direction: column;
}
.sdl-nav__subitem {
	margin: 0;
}
.sdl-header .sdl-nav__sublink {
	display: flex;
	flex-direction: column;
	gap: 1px;
	padding: var(--sdl-dd-row-py) var(--sdl-dd-row-px);
	border-radius: var(--sdl-dd-row-radius);
	color: var(--wp--preset--color--text);
}
.sdl-header .sdl-nav__sublink:hover {
	color: var(--wp--preset--color--white);
	background: var(--wp--preset--color--stripe);
}
.sdl-nav__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}
.sdl-nav__name {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--sdl-dd-name-fs);
	font-weight: 600;
}
.sdl-badge {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--sdl-dd-tag-fs);
	white-space: nowrap;
}
.sdl-badge--pre {
	color: var(--wp--preset--color--status-pre);
}
.sdl-badge--ok {
	color: var(--wp--preset--color--status-ok);
}
.sdl-badge--beta {
	color: var(--wp--preset--color--accent-soft);
}
.sdl-badge--soon {
	color: var(--wp--preset--color--muted-2);
}
.sdl-nav__desc {
	color: var(--wp--preset--color--muted);
	padding-left: var(--sdl-dd-desc-pl);
	font-size: var(--sdl-dd-desc-fs);
	line-height: 1.4;
}
.sdl-header .sdl-nav__all {
	position: relative;
	margin-top: 4px;
	padding: 9px var(--sdl-dd-row-px) 6px;
	border-top: 1px solid var(--wp--preset--color--line);
	font-size: var(--sdl-dd-all-fs);
	font-weight: 600;
}

/* Actions à droite */
.sdl-header .sdl-header__actions {
	margin-left: auto;
}
.sdl-header__actions .wp-block-buttons {
	gap: 10px;
	flex-wrap: nowrap;
}

/* Sélecteur de langue : bouton (drapeau, code, chevron) + liste (maquette l. 67-86 ; handoff accueil-launcher). */
.sdl-header .sdl-lang {
	position: relative;
	margin: 0;
}
.sdl-lang__btn {
	position: relative;
	box-sizing: border-box;
	height: var(--sdl-ctl-h);
	padding: 0 10px;
	display: flex;
	align-items: center;
	gap: 8px;
	border: 1px solid var(--wp--preset--color--line-panel);
	border-radius: var(--sdl-ctl-radius);
	background: transparent;
	color: var(--wp--preset--color--text-2);
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--sdl-lang-fs);
	cursor: pointer;
}
.sdl-lang__btn:hover {
	color: var(--wp--preset--color--white);
	border-color: var(--wp--preset--color--line-4);
}
.sdl-lang.is-open .sdl-lang__btn {
	background: var(--wp--preset--color--stripe);
}
.sdl-lang__flag {
	display: block;
	flex: none;
	width: 20px;
	height: 14px;
	border-radius: var(--wp--preset--border-radius--2);
	object-fit: cover;
}
/* Drapeau du bouton : 18 × 12 (celui de la liste reste à 20 × 14, comme la maquette). */
.sdl-lang__btn .sdl-lang__flag {
	width: var(--sdl-flag-w);
	height: var(--sdl-flag-h);
}
.sdl-lang__chevron {
	flex: none;
	transition: transform 0.15s;
}
.sdl-lang.is-open .sdl-lang__chevron {
	transform: rotate(180deg);
}
/* Liste alignée à droite, 8 px sous le bouton (zone de 8 px comprise dans le survol : padding-top). */
.sdl-lang__menu {
	position: absolute;
	top: 100%;
	right: 0;
	z-index: 60;
	padding-top: 8px;
	display: none;
}
.sdl-lang.is-open .sdl-lang__menu,
:root:not(.sdl-js) .sdl-lang:focus-within .sdl-lang__menu {
	display: block;
}
.sdl-lang__list {
	box-sizing: border-box;
	min-width: 210px;
	margin: 0;
	padding: 6px;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 2px;
	background: var(--wp--preset--color--surface-menu);
	border: 1px solid var(--wp--preset--color--line-panel);
	border-radius: var(--wp--preset--border-radius--12);
	box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
}
.sdl-lang__list li {
	margin: 0;
}
.sdl-header .sdl-lang__opt {
	position: relative;
	box-sizing: border-box;
	width: 100%;
	min-height: var(--sdl-lang-opt-h);
	padding: 0 12px;
	display: flex;
	align-items: center;
	gap: 12px;
	border-radius: var(--wp--preset--border-radius--8);
	color: var(--wp--preset--color--text);
	font-size: var(--sdl-lang-opt-fs);
	text-align: left;
}
.sdl-header .sdl-lang__opt.is-current {
	background: var(--wp--preset--color--line);
}
.sdl-header .sdl-lang__opt:hover,
.sdl-header .sdl-lang__opt.is-current:hover {
	background: var(--wp--preset--color--stripe);
	color: var(--wp--preset--color--text);
}
.sdl-lang__name {
	flex: 1;
}
.sdl-lang__opt-code {
	font-family: var(--wp--preset--font-family--mono);
	font-size: 12px;
	color: var(--wp--preset--color--muted-2);
}
.sdl-lang__opt.is-current .sdl-lang__opt-code {
	color: var(--wp--preset--color--accent-soft);
}
.sdl-lang__opt.is-disabled {
	opacity: 0.45;
	cursor: not-allowed;
}
.sdl-lang__opt.is-disabled:hover {
	background: transparent;
}

/* CTA Soutenir */
.sdl-header__cta {
	--sdl-button-height: var(--sdl-ctl-h);
}
.sdl-header__cta .wp-block-button__link {
	position: relative;
	padding: 0 14px;
	border-radius: var(--sdl-ctl-radius);
	font-size: var(--sdl-nav-fs);
	white-space: nowrap;
}

/* Bouton menu (burger) : texte masqué visuellement, trois traits 18×2 espacés de 5 px */
.sdl-menu-toggle {
	--sdl-button-height: var(--sdl-ctl-h);
}
.sdl-menu-toggle .wp-block-button__link {
	position: relative;
	width: var(--sdl-burger-w);
	padding: 0;
	border: 1px solid var(--wp--preset--color--line-2);
	border-radius: var(--sdl-ctl-radius);
	cursor: pointer;
	font-size: 0;
	color: transparent;
	background:
		linear-gradient(var(--wp--preset--color--text), var(--wp--preset--color--text)) center calc(50% - 7px) / 18px 2px no-repeat,
		linear-gradient(var(--wp--preset--color--text), var(--wp--preset--color--text)) center / 18px 2px no-repeat,
		linear-gradient(var(--wp--preset--color--text), var(--wp--preset--color--text)) center calc(50% + 7px) / 18px 2px no-repeat,
		transparent;
}
.sdl-menu-toggle .wp-block-button__link:hover {
	color: transparent;
	background-color: transparent;
}
/* Contraste élevé (Windows) : les dégradés disparaissent, on affiche le mot « Menu ». */
@media (forced-colors: active) {
	.sdl-menu-toggle .wp-block-button__link,
	.sdl-menu-toggle .wp-block-button__link:hover {
		width: auto;
		padding: 0 12px;
		font-size: var(--wp--preset--font-size--15);
		color: ButtonText;
	}
}

/* Zones cliquables ≥ 48 px de haut (règle 7), sans changer l'apparence */
.sdl-header__logo a::before,
.sdl-header .sdl-nav__link::before,
.sdl-header .sdl-nav__all::before,
.sdl-lang__btn::before,
.sdl-header__cta .wp-block-button__link::before,
.sdl-menu-toggle .wp-block-button__link::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 50%;
	height: 48px;
	transform: translateY(-50%);
}

/* Menu mobile */
.sdl-header .sdl-header__panel {
	display: none;
	margin-block-start: 0;
	border-top: 1px solid var(--wp--preset--color--line);
	padding: 8px 20px 20px;
}
.sdl-mnav__item {
	margin: 0;
}
.sdl-header .sdl-mnav__link,
.sdl-header .sdl-mnav__toggle {
	display: flex;
	align-items: center;
	width: 100%;
	min-height: 58px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--text);
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--20);
	font-weight: 600;
	line-height: var(--wp--custom--line-height--body);
	text-align: left;
}
.sdl-header .sdl-mnav__link {
	border-bottom: 1px solid var(--wp--preset--color--line-soft);
}
.sdl-mnav__group {
	border-bottom: 1px solid var(--wp--preset--color--line-soft);
}
.sdl-header .sdl-mnav__toggle {
	justify-content: space-between;
	cursor: pointer;
}
.sdl-mnav__icon {
	font-family: var(--wp--preset--font-family--mono);
	font-size: var(--wp--preset--font-size--20);
	color: var(--wp--preset--color--accent-text);
}
.sdl-mnav__icon::before {
	content: "+";
}
.sdl-mnav__toggle[aria-expanded="true"] .sdl-mnav__icon::before {
	content: "−";
}
:root:not(.sdl-js) .sdl-mnav__icon {
	display: none;
}
.sdl-mnav__sub {
	display: flex;
	flex-direction: column;
	margin-bottom: 12px;
	padding: 0 0 12px 14px;
	border-left: 2px solid var(--wp--preset--color--line-panel);
}
.sdl-js .sdl-mnav__group:not(.is-open) .sdl-mnav__sub {
	display: none;
}
.sdl-mnav__sublist {
	display: flex;
	flex-direction: column;
}
.sdl-mnav__subitem {
	margin: 0;
}
.sdl-header .sdl-mnav__sublink {
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: 52px;
	padding: 6px 0;
	color: var(--wp--preset--color--text);
}
.sdl-mnav__name {
	font-size: var(--wp--preset--font-size--17);
	font-weight: 600;
}
.sdl-mnav__desc {
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--14);
}
.sdl-header .sdl-mnav__all {
	display: flex;
	align-items: center;
	min-height: 48px;
	font-size: 15.5px;
	font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
	.sdl-nav__chevron {
		transition: none;
	}
}

@media (max-width: 1199px) {
	.sdl-header .sdl-nav {
		display: none;
	}
	.sdl-header.is-menu-open .sdl-header__panel,
	:root:not(.sdl-js) .sdl-header .sdl-header__panel {
		display: block;
	}
	:root:not(.sdl-js) .sdl-header .wp-block-button.sdl-menu-toggle {
		display: none;
	}
}

/* CTA Soutenir dans le menu sous 660 px : la barre (logo + langue + compte + CTA + menu) demande jusqu’à 659 px (ADR-010, ADR-047, ADR-116). */
.sdl-header .sdl-header__panel-cta {
	display: none;
	margin-block-start: 20px;
}
@media (max-width: 659px) {
	.sdl-header .sdl-header__cta-wrap {
		display: none;
	}
	.sdl-header .sdl-header__panel-cta {
		display: flex;
	}
}

/* Le conteneur du bouton est masqué, pas seulement le bouton : vide, il garderait un écart de 10 px dans la barre. */
@media (min-width: 1200px) {
	.sdl-header .sdl-header__menu {
		display: none;
	}
}

/* Pages de la boutique : boutons Compte (icône) et Panier (icône + nombre), maquette design/boutique.dc.html l. 70-76 (ADR-051). */
.sdl-header__shop {
	display: flex;
	gap: 10px;
}
.sdl-header .sdl-header__icon {
	position: relative;
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: var(--sdl-ctl-h);
	border: 1px solid var(--wp--preset--color--line-2);
	border-radius: var(--sdl-ctl-radius);
	color: var(--wp--preset--color--text);
	font-size: var(--sdl-nav-fs);
	font-weight: 600;
	line-height: 1.6;
	white-space: nowrap;
}
.sdl-header .sdl-header__icon:hover {
	border-color: var(--wp--preset--color--text);
	color: var(--wp--preset--color--white);
}
.sdl-header .sdl-header__cart {
	padding: 0 14px;
}
.sdl-header .sdl-header__icon::before {
	content: "";
	position: absolute;
	inset: -3px 0;
}
.sdl-header__icon svg {
	flex-shrink: 0;
}
.sdl-header .sdl-header__account svg {
	width: var(--sdl-account-icon);
	height: var(--sdl-account-icon);
}

/* Dès 1200 px, la barre de la boutique (logo, menu avec Docs et tiroir À propos, drapeaux, CTA, compte, panier) demande
 * jusqu'à 1280 px en FR pour 1200 disponibles : le CTA Soutenir en sort, les liens de soutien restent dans le footer (ADR-090). */
@media (min-width: 1200px) {
	.sdl-header__actions:has(.sdl-header__shop) > .sdl-header__cta-wrap {
		display: none;
	}
}

/* Icône Mon compte du header commun : 36 × 36, picto de 16 px, bordure et survol de la maquette (handoff accueil compact §2). */
.sdl-header .sdl-header__account::before {
	inset: -3px;
}
.sdl-header .sdl-header__account {
	width: var(--sdl-ctl-h);
	border-color: var(--wp--preset--color--line-panel);
	border-radius: var(--sdl-ctl-radius);
	color: var(--wp--preset--color--text-2);
}
.sdl-header .sdl-header__account:hover {
	border-color: var(--wp--preset--color--line-4);
	color: var(--wp--preset--color--white);
}

/* Petits écrans : la barre (logo, langue, compte, burger) tient dans 375 px ; sous 460 px, le code de langue se masque
 * (drapeau + chevron) et le logo se réduit d'un cran. La maquette déborde à cette largeur (écart technique, ADR-116). */
@media (max-width: 459px) {
	.sdl-header .sdl-header__bar {
		gap: 12px !important;
	}
	.sdl-header .sdl-header__actions {
		gap: 8px !important;
	}
	.sdl-header .sdl-header__logo img {
		height: 16px !important;
	}
	.sdl-lang__code {
		display: none;
	}
	.sdl-lang__btn {
		padding: 0 8px;
		gap: 6px;
	}
}
/* Pages de la boutique, sous 560 px : le panier prend la place de la langue, qui passe dans le menu mobile. */
@media (max-width: 559px) {
	.sdl-header__actions:has(.sdl-header__shop) > .sdl-lang {
		display: none;
	}
	.sdl-header .sdl-header__panel-lang {
		display: flex;
	}
}
.sdl-header .sdl-header__panel-lang {
	display: none;
	flex-wrap: wrap;
	gap: 8px;
	padding: 12px 0;
	border-bottom: 1px solid var(--wp--preset--color--line-soft);
}
.sdl-header .sdl-header__panel-lang a {
	position: relative;
	min-height: 48px;
	padding: 0 12px;
	display: flex;
	align-items: center;
	gap: 8px;
	border: 1px solid var(--wp--preset--color--line-panel);
	border-radius: var(--wp--preset--border-radius--8);
	color: var(--wp--preset--color--text);
	font-size: 15px;
}
.sdl-header .sdl-header__panel-lang a[aria-current="true"] {
	background: var(--wp--preset--color--line);
}

/* Pages de la boutique : avec le panier, la barre n'a plus la place du CTA Soutenir sous 760 px ; il passe dans le menu mobile. */
@media (max-width: 759px) {
	.sdl-header__actions:has(.sdl-header__shop) > .sdl-header__cta-wrap {
		display: none;
	}
	.sdl-header:has(.sdl-header__shop) .sdl-header__panel-cta {
		display: flex;
	}
}
