/*
 * Header CGT FT Occitanie — calques « Header 2 », « Menu », « menu:hover »
 * et « mini header » de la maquette (propriété site web.svg).
 *
 * Toutes les mesures viennent du SVG, exprimées en « unités de maquette » :
 * le calque fait 508 unités de large, soit 1920 px (1 unité = 3.7795 px).
 * --u vaut 1 unité : à 1920 px de large le rendu est identique à la maquette ;
 * de 900 à 1119 px la colonne de contenu se réduit pour tenir dans la fenêtre ;
 * sous 900 px, seule la barre compacte avec burger est affichée.
 *
 * Fonctionnement : un seul en-tête fixe (.site-header). La classe .est-reduit sur .site-top
 * (posée par js/script.js au défilement) le fait passer du Header 2 au mini header ;
 * toutes les différences entre les deux états sont des transitions CSS (voir --hd-transition).
 */
:root {
	--u: min(3.7795276px, calc((100vw - var(--sbw, 0px)) / 296.34));
	--cgt-rouge: #c30c07;
	--hd-haut: calc(26.458333 * var(--u));   /* bande rouge du Header 2 */
	--hd-barre: calc(13.229167 * var(--u));  /* barre de menu = hauteur du mini header */
	--hd-col: calc(296.34 * var(--u));       /* colonne de contenu (1120 px) */
	--hd-transition: .3s ease-out;           /* durée du passage Header 2 <-> mini header */
}

/* Neutralise les styles génériques du thème par défaut (liens, listes) à l'intérieur du header */
:where(.site-top) a, :where(.site-top) a:visited, :where(.site-top) a:hover, :where(.site-top) a:focus, :where(.site-top) a:active {
	background: transparent; color: inherit; text-decoration: none; text-shadow: none; box-shadow: none; border: 0; border-radius: 0;
}
:where(.site-top) ul, :where(.site-top) li { margin: 0; padding: 0; list-style: none; }

.visuellement-cache {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.page { margin-top: 0; }               /* l'en-tête colle au haut de la page */

/* ---------- Emplacement dans le flux + en-tête fixe ----------
 * Tout ce qui bouge pendant la bascule utilise transform / opacity, animés par la carte graphique :
 * fond blanc, bande rouge, logo, barre de menu et ombre restent donc parfaitement synchronisés
 * (animer des hauteurs, calculées par le processeur, les faisait se décaler au moindre à-coup). */
.site-top {                            /* réserve la hauteur du Header 2 pour que le contenu ne saute pas */
	position: relative;
	height: calc(var(--hd-haut) + var(--hd-barre));
}
.site-header {
	position: fixed; z-index: 1000; top: 0; left: 0; right: 0;
	height: calc(var(--hd-haut) + var(--hd-barre));
	pointer-events: none;              /* seuls les éléments visibles captent la souris (cf. pointer-events: auto) */
}
.hd-fond {                             /* fond blanc : 39.7 u en haut de page, 1/3 (13.2 u) une fois réduit */
	position: absolute; top: 0; left: 0; right: 0;
	height: calc(var(--hd-haut) + var(--hd-barre));
	background: #fff; pointer-events: auto;
	transform-origin: 0 0;
	transition: transform var(--hd-transition);
}
.hd-ombre {                            /* ombre portée du calque Menu : elle suit la barre de menu, y compris réduite */
	position: absolute; left: 0; right: 0;
	top: var(--hd-haut); height: var(--hd-barre);
	box-shadow: 0 calc(1 * var(--u)) calc(2 * var(--u)) rgba(0, 0, 0, .498);
	transition: transform var(--hd-transition);
}
.hd-sentinelle { position: absolute; top: calc(23.18 * var(--u)); left: 0; width: 1px; height: 1px; pointer-events: none; }
.hd__col { position: relative; width: var(--hd-col); height: 100%; margin: 0 auto; }

/* ---------- Bande rouge (Header 2) ---------- */
.hd2 {
	position: absolute; z-index: 1; top: 0; left: 0; right: 0;
	height: var(--hd-haut);
	pointer-events: none;
}
.hd2::before {                         /* « marge rouge » à gauche de la colonne */
	content: '';
	position: absolute; top: 0; left: 0; height: 100%;
	width: calc(50% - var(--hd-col) / 2 + 3 * var(--u));
	background: var(--cgt-rouge);
	transform-origin: 0 0;
	transition: transform var(--hd-transition);
}
.hd-svg { position: absolute; top: 0; left: calc(-5.83 * var(--u)); display: block; max-width: none; pointer-events: none; }
.hd-svg a { pointer-events: visiblePainted; cursor: pointer; }
.hd-svg--logo, .hd-svg--contacts { width: calc(302.4 * var(--u)); height: var(--hd-haut); }
.hd-svg a:focus-visible { outline: calc(.4 * var(--u)) solid #000; outline-offset: calc(.4 * var(--u)); }
/* le logo se réduit de moitié autour de son coin haut-gauche : c'est exactement la taille du mini header */
.hd-svg--logo { transform-origin: calc(5.83 * var(--u)) 0; transition: transform var(--hd-transition); }

/* contacts et réseaux : ils s'effacent en remontant quand l'en-tête se réduit */
.hd-coordonnees {
	position: absolute; inset: 0; pointer-events: none;
	transition: opacity .2s ease-out .15s, transform var(--hd-transition), visibility 0s;
}
.hd-coordonnees a { pointer-events: auto; }

/* ---------- Barre de menu ---------- */
.hd-bar {
	position: absolute; z-index: 2; left: 0; right: 0;
	top: 0; height: var(--hd-barre);
	pointer-events: none;              /* la barre est transparente aux clics : en mini header elle recouvre le logo (qui doit rester cliquable) ; seul le menu capte la souris */
	transform: translateY(var(--hd-haut));
	transition: transform var(--hd-transition);
}

/* ---------- État réduit = mini header ---------- */
.site-top.est-reduit .hd-fond { transform: scaleY(.3333333); }
.site-top.est-reduit .hd-ombre { transform: translateY(calc(-1 * var(--hd-haut))); }
.site-top.est-reduit .hd2::before { transform: scaleY(.5); }
.site-top.est-reduit .hd-svg--logo { transform: scale(.5); }
.site-top.est-reduit .hd-bar { transform: translateY(0); }
.site-top.est-reduit .hd-coordonnees {
	opacity: 0; visibility: hidden; transform: translateY(calc(-4 * var(--u)));
	transition: opacity .12s ease-out, transform var(--hd-transition), visibility 0s linear .3s;
}
/* au chargement : pas d'animation (retiré par js/script.js) */
.site-header.hd-init, .site-header.hd-init *, .site-header.hd-init::before, .site-header.hd-init::after,
.site-header.hd-init *::before, .site-header.hd-init *::after { transition: none !important; }

/* ---------- Menu ---------- */
.hd-nav {
	pointer-events: auto;
	position: absolute; top: 0;
	left: calc(79.32 * var(--u));    /* la maison est à x = 185.15 */
	width: max-content;
	height: var(--hd-barre);
	font-family: 'Barlow Semi Condensed', sans-serif;
	font-weight: 700;
	/* --k (≤ 1) est posé par js/script.js : il réduit le menu pour qu'il ne dépasse pas la colonne ni la pastille de compte */
	font-size: calc(7.05556 * var(--u) * var(--k, 1));
	letter-spacing: calc(.34925 * var(--u) * var(--k, 1));
	line-height: 1.2;
	text-transform: uppercase;
	color: #000;
}
.hd-nav__liste { display: flex; align-items: flex-start; margin: 0; padding: 0; list-style: none; }
.hd-nav__item { position: relative; height: var(--hd-barre); margin: 0 calc(10.27 * var(--u) * var(--k, 1)) 0 0; padding: 0; }
.hd-nav__item--maison { margin-right: calc(11.08 * var(--u) * var(--k, 1)); }
.hd-nav__item--deroulant { margin-right: calc(10.84 * var(--u) * var(--k, 1)); }
.hd-nav__lien {
	display: flex; align-items: flex-start;
	padding-top: calc(1.98 * var(--u));
	color: inherit; text-decoration: none; white-space: nowrap;
}
.hd-nav__lien:hover, .hd-nav__lien:visited { color: inherit; }
.hd-nav__lien:focus-visible, .hd-nav__popup a:focus-visible { outline: calc(.4 * var(--u)) solid var(--cgt-rouge); outline-offset: calc(.3 * var(--u)); }
.hd-nav__maison { display: block; width: calc(6.35 * var(--u)); height: calc(5.82 * var(--u)); margin-top: calc(1.77 * var(--u)); fill: currentColor; }
.hd-nav__chevron { display: block; width: calc(4 * var(--u)); height: calc(2.5 * var(--u)); margin: calc(3.43 * var(--u)) 0 0 calc(1.55 * var(--u)); fill: currentColor; }

/* Menu déployé (calque « menu:hover ») */
.hd-nav__popup {
	position: absolute; z-index: 5;
	top: calc(11.778 * var(--u)); left: calc(.45 * var(--u));
	box-sizing: border-box;
	min-width: calc(79.218 * var(--u));
	margin: 0; padding: calc(.46 * var(--u)) 0 calc(1.58 * var(--u));
	list-style: none;
	background: #fff;
	border: calc(.157 * var(--u)) solid rgba(146, 146, 146, .358);
	font-size: calc(5.64444 * var(--u));
	font-style: italic; font-weight: 400;
	opacity: 0; visibility: hidden;
	transition: opacity .12s, visibility .12s;
}
.hd-nav__item:hover > .hd-nav__popup,
.hd-nav__item:focus-within > .hd-nav__popup { opacity: 1; visibility: visible; }
.hd-nav__popup li { position: relative; margin: 0; padding: 0 calc(3.7 * var(--u)) 0 calc(7.04 * var(--u)); line-height: calc(8.467 * var(--u)); white-space: nowrap; }
.hd-nav__popup li::before {
	content: '';
	position: absolute;
	left: calc(2.18 * var(--u)); top: calc(3.13 * var(--u));
	width: calc(2.514 * var(--u)); height: calc(2.514 * var(--u));
	border-radius: 50%; background: #4d4d4d;
}
.hd-nav__popup a { display: block; color: inherit; text-decoration: none; }
.hd-nav__popup a:hover { color: var(--cgt-rouge); }

/* ---------- Bureau : éléments propres au mode compact masqués ---------- */
.hd-burger, .hd-contacts { display: none; }

/* ---------- Compact (sous 900 px) : barre fixe réduite + burger ---------- */
@media (max-width: 899.98px) {
	:root { --u: 4.2333px; }                       /* barre de 13.229 unités = 56 px */
	.site-top { height: var(--hd-barre); }
	/* l'état réduit est permanent : mêmes valeurs que .est-reduit, sans transition */
	.site-header, .site-header *, .site-header::before, .site-header::after,
	.site-header *::before, .site-header *::after { transition: none !important; }
	.site-header { height: var(--hd-barre); }
	.hd-fond { transform: scaleY(.3333333); }
	.hd-ombre { transform: translateY(calc(-1 * var(--hd-haut))); }
	.hd2::before { width: calc(6 * var(--u)); transform: scaleY(.5); }   /* ne couvre que le bord gauche sous le logo : le reste du rouge est celui du logo */
	.hd__col { width: 100%; margin-left: 0; }
	.hd-svg { left: 0; }
	.hd-svg--logo { transform: scale(.5); }
	.hd-coordonnees { display: none; }

	.hd-burger {
		display: block; position: absolute; z-index: 3; top: 0; right: 0;
		width: var(--hd-barre); height: var(--hd-barre);
		padding: 0; background: none; border: 0; cursor: pointer; color: var(--cgt-rouge);
		pointer-events: auto;              /* l'en-tête est transparent aux clics : le bouton doit les capter */
	}
	.hd-burger__barres, .hd-burger__barres::before, .hd-burger__barres::after {
		content: ''; display: block; position: absolute; left: 16px; right: 16px;
		height: 3px; background: currentColor; transition: transform .2s, opacity .2s !important;
	}
	.hd-burger__barres { top: 26px; }
	.hd-burger__barres::before { left: 0; right: 0; top: -9px; }
	.hd-burger__barres::after { left: 0; right: 0; top: 9px; }
	.site-top.is-open .hd-burger__barres { background: transparent; }
	.site-top.is-open .hd-burger__barres::before { transform: translateY(9px) rotate(45deg); }
	.site-top.is-open .hd-burger__barres::after { transform: translateY(-9px) rotate(-45deg); }
	.hd-burger:focus-visible { outline: 2px solid var(--cgt-rouge); outline-offset: -4px; }

	/* le menu devient le panneau déroulant */
	.hd-bar {
		display: none; position: fixed; z-index: 1002; transform: none;
		top: var(--hd-barre); left: 0; right: 0; height: auto;
		max-height: calc(100vh - var(--hd-barre)); overflow-y: auto;
		background: #fff; box-shadow: 0 8px 16px rgba(0, 0, 0, .25);
	}
	.site-top.is-open .hd-bar { display: block; }
	.hd-bar .hd__col { height: auto; }
	.hd-bar, .hd-bar .hd__col, .hd-nav, .hd-contacts { pointer-events: auto; }   /* panneau déroulant : tout capte les clics */

	.hd-nav {
		position: static; width: auto; height: auto;
		font-size: 21px; letter-spacing: .02em; line-height: 1.2;
	}
	.hd-nav__liste { flex-direction: column; padding: 8px 0; }
	.hd-nav__item { height: auto; margin: 0; }
	.hd-nav__lien { padding: 12px 20px; }
	.hd-nav__maison { width: 20px; height: 18px; margin: 0; }
	.hd-nav__item--maison .visuellement-cache { position: static !important; width: auto; height: auto; clip: auto; margin-left: 10px; }
	.hd-nav__chevron { display: none; }
	.hd-nav__popup {
		position: static; min-width: 0; margin: 0; padding: 0 0 8px 0; border: 0;
		opacity: 1; visibility: visible; transition: none; font-size: 17px;
	}
	.hd-nav__popup li { padding: 0 20px 0 48px; line-height: 2.1; white-space: normal; }
	.hd-nav__popup li::before { left: 30px; top: .95em; width: 7px; height: 7px; }

	.hd-contacts {
		display: block; padding: 14px 20px 18px; border-top: 1px solid #ddd;
		font-family: 'Barlow Semi Condensed', sans-serif; font-size: 19px; letter-spacing: .02em;
	}
	.hd-contacts__ligne { display: block; padding: 6px 0; color: var(--cgt-rouge); overflow-wrap: anywhere; }
	.hd-contacts__reseaux { display: flex; flex-wrap: wrap; gap: 14px 18px; margin: 10px 0 0; }
	.hd-contacts__reseaux svg { display: block; width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
	.site-header, .site-header *, .site-header::before, .site-header::after,
	.site-header *::before, .site-header *::after { transition: none !important; }
}

/* Rendu précis des tracés et du texte du bandeau (pas d'indice de grille, positionnement sous-pixel) */
.site-top svg, .site-top .hd-nav { shape-rendering: geometricPrecision; text-rendering: geometricPrecision; }
.site-top { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ---------- Netteté : calage sur la grille de pixels ----------
 * Les bords droits qui tombent entre deux pixels s'étalent sur deux lignes grises (bords « mous »).
 * Les badges des réseaux (24,94 px, positions fractionnaires) sont des éléments à part dont on arrondit
 * la taille et la position au pixel ; la colonne de contenu est elle aussi posée sur un pixel entier. */
.hd-reseaux { margin: 0; padding: 0; }
.hd-reseau {
	position: absolute; display: block;
	top: calc(14.18 * var(--u));
	width: calc(6.599 * var(--u)); height: calc(6.599 * var(--u));
}
.hd-reseau svg { display: block; width: 100%; height: 100%; }
.hd-reseau { left: calc(var(--x, 289.738) * var(--u)); }
.hd-reseau:focus-visible { outline: calc(.4 * var(--u)) solid #000; outline-offset: calc(.4 * var(--u)); }
@supports (width: round(1.4px, 1px)) {
	.hd__col { margin-left: round(down, calc(50% - var(--hd-col) / 2), 1px); margin-right: 0; }
	.hd-reseau { top: round(calc(14.18 * var(--u)), 1px); width: round(calc(6.599 * var(--u)), 1px); height: round(calc(6.599 * var(--u)), 1px); }
	.hd-reseau { left: round(calc(var(--x, 289.738) * var(--u)), 1px); }
}
@media (max-width: 899.98px) {
	@supports (width: round(1.4px, 1px)) { .hd__col { margin-left: 0; } }
}

/* Le thème impose « a:focus { background:#222 !important; color:#f8f8f8 !important } » (visible après un clic) :
 * on le neutralise dans l'en-tête. Le focus au clavier reste signalé par un contour (:focus-visible). */
.site-top a:focus, .site-top a:active { background: transparent !important; color: inherit !important; text-shadow: none !important; }
.site-top .hd-nav__popup a:hover, .site-top .hd-nav__popup a:focus-visible { color: #C30C07 !important; }

/* ---------- Pages du thème par défaut (article, rubrique, plan…) : mêmes liens, sans bloc de couleur au survol ---------- */
.page .content a:hover, .page .content a:focus, .page .content a:active,
.page .aside a:hover, .page .aside a:focus, .page .aside a:active,
.page .footer a:hover, .page .footer a:focus, .page .footer a:active {
	background: transparent !important; color: #C30C07 !important; text-decoration: none; text-shadow: none !important;
}

/* ---------- Bouton de téléchargement d'un document : <docXX|bouton> (modeles/file_bouton.html) ---------- */
.doc-bouton-bloc { display: block; margin: 1.5em 0; }
.page .content a.doc-bouton, a.doc-bouton {
	display: inline-flex; align-items: center; gap: .5em;
	padding: .55em 1.2em; border-radius: 3px;
	background: #c30c07 !important; color: #fff !important; text-decoration: none !important;
	font-family: 'Barlow Semi Condensed', sans-serif; font-weight: 600; font-size: 1.1em; letter-spacing: .02em; text-transform: uppercase;
	transition: background-color .2s ease-out;
}
.page .content a.doc-bouton:hover, .page .content a.doc-bouton:focus, .page .content a.doc-bouton:active,
a.doc-bouton:hover, a.doc-bouton:focus { background: #8f0905 !important; color: #fff !important; }
a.doc-bouton:focus-visible { outline: 2px solid #000; outline-offset: 2px; }
.doc-bouton__icone { width: 1.2em; height: 1.2em; flex: none; }
.doc-bouton__taille { font-weight: 400; font-size: .8em; text-transform: none; opacity: .85; }

/* Pages formulaires sans colonne latérale (Rejoins nous / adhésion, contact) : le contenu occupe toute la largeur de la page
   au lieu des 70 % prévus par squelettes-dist pour laisser place à un bloc latéral. */
.page_rejoindre .wrapper, .page_adhesion .wrapper, .page_contact .wrapper { float: none; width: auto; }

/* ---------- Bureau : entrées du menu centrées verticalement dans la barre ---------- */
@media (min-width: 900px) {
	.hd-nav__lien { box-sizing: border-box; height: var(--hd-barre); align-items: center; padding-top: 0; padding-bottom: .1em; }   /* .1em : les capitales sont un peu sous le milieu de la ligne */
	.hd-nav__maison { margin-top: 0; }
	.hd-nav__chevron { margin: 0 0 0 calc(1.55 * var(--u)); }
	.hd-nav__maison, .hd-nav__chevron { position: relative; top: .05em; }   /* compense le padding-bas des liens */
}
