/* ---------- En-tête ---------- */

.c-header {
	position: fixed;
	top: 0;
	right: 0;
	left: 0;
	z-index: 100;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 1.5rem;
	padding: clamp(16px, 3vh, 28px) var(--cg-gutter);
	color: var(--cg-ivory);
	font-family: var(--cg-sans);
	transition: transform 0.9s var(--cg-ease), opacity 1.4s var(--cg-ease) 0.6s;
}

/* Pendant l'animation d'ouverture, l'en-tête attend que les ailes s'écartent. */
html.is-intro .c-header {
	opacity: 0;
	transition: none;
}

.c-header::before {
	content: "";
	position: absolute;
	inset: 0 0 -40%;
	z-index: -1;
	background: linear-gradient(180deg, rgba(var(--cg-ink-rgb), 0.82) 0%, rgba(var(--cg-ink-rgb), 0.4) 55%, rgba(var(--cg-ink-rgb), 0) 100%);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.8s ease;
}

.c-header.is-scrolled::before {
	opacity: 1;
}

.c-header.is-hidden {
	transform: translate3d(0, -110%, 0);
}

.c-header a {
	color: inherit;
	text-decoration: none;
}

/* Logo */

.c-header__logo {
	justify-self: start;
	display: inline-flex;
}

.c-logo {
	display: inline-flex;
	align-items: center;
	gap: 12px;
}

.c-logo__mark {
	width: 34px;
	height: auto;
	transition: transform 1.2s var(--cg-ease);
}

.c-logo__word {
	font-family: var(--cg-serif);
	font-size: 1.05rem;
	letter-spacing: 0.42em;
	margin-right: -0.42em;
}

.c-header__logo:hover .c-logo__mark {
	transform: scaleX(1.18);
}

.c-logo__svg {
	display: block;
	width: auto;
	height: clamp(27px, 3.3vh, 35px); /* logo recadré au plus près : même taille visible qu'avant */
	color: var(--cg-ivory);
	transition: color 0.6s ease;
}

/* Papillon seul : un peu plus haut que le logo écrit, traits légèrement épaissis pour rester net en petit. */
.c-logo__svg--butterfly {
	height: clamp(32px, 4vh, 42px);
	overflow: visible;
}

.c-logo__svg--butterfly path {
	stroke: currentColor;
	stroke-width: 2.5px;
	stroke-linejoin: round;
}

.c-logo__svg--butterfly defs path {
	stroke: none;
}

.c-header__logo:hover .c-logo__svg {
	color: var(--cg-amber);
}

.c-emblem-svg {
	height: auto;
	color: var(--cg-ivory);
}

.c-logo__img {
	display: block;
	width: auto;
	max-height: 34px;
}

.c-monogram__eye {
	fill: var(--cg-amber);
}

/* Navigation */

.c-header__nav ul {
	display: flex;
	gap: clamp(1.5rem, 3vw, 3rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.c-header__nav a,
.c-lang a {
	position: relative;
	display: inline-block;
	padding: 6px 0;
	font-size: 0.7rem;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: rgba(var(--cg-ivory-rgb), 0.72);
	transition: color 0.5s ease;
}

.c-header__nav a::after {
	content: "";
	position: absolute;
	right: 0;
	bottom: 0;
	left: 0;
	height: 1px;
	background: var(--cg-amber);
	transform: scaleX(0);
	transform-origin: right;
	transition: transform 0.9s var(--cg-ease);
}

.c-header__nav a:hover,
.c-header__nav a.is-active {
	color: var(--cg-ivory);
}

.c-header__nav a:hover::after,
.c-header__nav a.is-active::after {
	transform: scaleX(1);
	transform-origin: left;
}

/* Côté droit : compteur, langues, menu */

.c-header__aside {
	justify-self: end;
	display: flex;
	align-items: center;
	gap: clamp(1.25rem, 2.5vw, 2.5rem);
}

.c-header__count {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-size: 0.7rem;
	letter-spacing: 0.2em;
	color: var(--cg-bark);
	font-variant-numeric: tabular-nums;
}

.c-header__count [data-section-current] {
	color: var(--cg-amber);
}

.c-header__count-sep {
	width: 24px;
	height: 1px;
	background: currentColor;
	opacity: 0.6;
}

.c-lang {
	display: flex;
	flex-wrap: nowrap;
	white-space: nowrap;
	gap: 0.9rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.c-lang li + li::before {
	content: "/";
	margin-right: 0.9rem;
	font-size: 0.7rem;
	color: var(--cg-bark);
}

.c-lang a[aria-current] {
	color: var(--cg-ivory);
}

.c-lang a:not([aria-current]):hover {
	color: var(--cg-amber);
}

/* Sélecteur Nuit / Jour */

.c-mode {
	display: inline-flex;
	align-items: center;
	gap: 0.7rem;
}

.c-mode button {
	position: relative;
	padding: 6px 0;
	border: 0;
	background: none;
	font-family: var(--cg-sans);
	font-size: 0.7rem;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: rgba(var(--cg-ivory-rgb), 0.5);
	cursor: pointer;
	transition: color 0.5s ease;
}

.c-mode button:hover {
	color: var(--cg-amber);
}

.c-mode button[aria-pressed="true"] {
	color: var(--cg-ivory);
}

/* Petit astre : plein la nuit, cerclé le jour. */
.c-mode__sep {
	width: 7px;
	height: 7px;
	border: 1px solid var(--cg-amber);
	border-radius: 50%;
	background: var(--cg-amber);
	transition: background 0.6s ease;
}

html[data-theme="day"] .c-mode__sep {
	background: transparent;
}

.c-header__toggle {
	display: none;
	align-items: center;
	gap: 12px;
	padding: 6px 0;
	border: 0;
	background: none;
	color: inherit;
	font-family: var(--cg-sans);
	font-size: 0.7rem;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	cursor: pointer;
}

.c-header__burger {
	position: relative;
	width: 26px;
	height: 8px;
}

.c-header__burger i {
	position: absolute;
	left: 0;
	width: 100%;
	height: 1px;
	background: currentColor;
	transition: transform 0.8s var(--cg-ease), top 0.8s var(--cg-ease);
}

.c-header__burger i:first-child { top: 0; }
.c-header__burger i:last-child { top: 7px; }

.c-header.is-menu-open .c-header__burger i:first-child { top: 4px; transform: rotate(20deg); }
.c-header.is-menu-open .c-header__burger i:last-child { top: 4px; transform: rotate(-20deg); }

/* Menu plein écran (mobile) : s'ouvre depuis l'axe central */

.c-menu {
	position: fixed;
	inset: 0;
	z-index: 90;
	display: flex;
	flex-direction: column;
	justify-content: space-between;
	padding: calc(clamp(16px, 3vh, 28px) * 2 + 40px) var(--cg-gutter) clamp(24px, 5vh, 48px);
	background: var(--cg-ink);
	color: var(--cg-ivory);
	clip-path: inset(0 50% 0 50%);
	transition: clip-path 1s var(--cg-ease-wing);
}

.c-menu.is-open {
	clip-path: inset(0 0 0 0);
}

.c-menu ol {
	margin: 0;
	padding: 0;
	list-style: none;
}

.c-menu li {
	overflow: hidden;
	border-bottom: 1px solid var(--cg-line);
}

.c-menu a {
	display: flex;
	align-items: baseline;
	gap: 1.25rem;
	padding: 0.85rem 0;
	color: inherit;
	text-decoration: none;
	transform: translate3d(0, 105%, 0);
	transition: transform 1.1s var(--cg-ease);
	transition-delay: calc(var(--i) * 70ms + 0.25s);
}

.c-menu.is-open a {
	transform: none;
}

.c-menu__num {
	font-family: var(--cg-sans);
	font-size: 0.72rem;
	letter-spacing: 0.2em;
	color: var(--cg-amber);
}

.c-menu__label {
	padding-bottom: 0.08em;
	font-family: var(--cg-serif);
	font-size: clamp(1.75rem, 7.5vw, 3rem);
	line-height: 1.2;
}

.c-menu .c-lang {
	flex-wrap: nowrap;
	white-space: nowrap;
}

.c-menu a:hover .c-menu__label {
	font-style: italic;
}

.c-menu__footer {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
}

.c-menu__options {
	display: grid;
	gap: 0.75rem;
}

.c-menu__mark {
	width: 56px;
	color: var(--cg-ivory);
}

html.is-locked {
	overflow: hidden;
}

/* Éditeur de site */

.c-editor-preview .c-header {
	position: relative;
}

.c-editor-preview .c-menu {
	display: none;
}

@media (max-width: 899px) {
	.c-header {
		grid-template-columns: 1fr auto;
	}

	.c-header__nav,
	.c-header__count,
	.c-header__aside > .c-lang,
	.c-header__aside > .c-mode {
		display: none;
	}

	.c-header__toggle {
		display: inline-flex;
	}
}

@media (min-width: 900px) {
	.c-menu {
		display: none !important;
	}
}

/* Écrans moyens : le compteur de sections cède la place aux langues et à l'ambiance. */
@media (min-width: 900px) and (max-width: 1200px) {
	.c-header__count {
		display: none;
	}

	.c-header__nav ul {
		gap: 1.25rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.c-menu,
	.c-menu a {
		transition: none;
	}
}
