/* Sommet — langage de mouvement. Carte et justification : docs/05-design-system/MOTION.md.
   Règle : la page est complète sans ce fichier ni motion.js. L'état caché n'existe que sous html.sgf-motion,
   sur les éléments que motion.js a marqués (data-sgf-reveal) ; « réduire les animations » coupe tout. */

:root {
	--sgf-ease: cubic-bezier(.16, 1, .3, 1);      /* sortie longue : le geste arrive vite puis se pose */
	--sgf-ease-io: cubic-bezier(.65, 0, .35, 1);  /* rideaux d'image */
	--sgf-micro: 280ms;
}

/* Masque d'un mot de l'accroche (statique : sans animation, le mot est simplement là) */
.sgf-mot { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: .14em; margin-bottom: -.14em; }

/* Filet or devant chaque surtitre (statique ; il se trace à l'apparition) */
.sgf-eyebrow::before { content: ""; display: inline-block; vertical-align: middle; width: 2rem; height: 1px; margin: -.2em .8rem 0 0; background: currentColor; transform-origin: left; }

/* ---------- 1. Micro-interactions ---------- */

/* Boutons : balayage de gauche à droite (reprend le « sweep » de l'ancien site) */
.sgf-button { position: relative; isolation: isolate; overflow: hidden; transition: color var(--sgf-micro) ease, border-color var(--sgf-micro) ease; }
.sgf-button::before { content: ""; position: absolute; inset: 0; z-index: -1; transform: scaleX(0); transform-origin: right; transition: transform 560ms var(--sgf-ease); }
.sgf-button--or::before { background: #cbc19c; }
.sgf-button--ligne::before { background: var(--blanc); }
.sgf-button--or:hover { background: var(--or); }
.sgf-button--ligne:hover { background: transparent; }
.sgf-button:hover::before, .sgf-button:focus-visible::before { transform: scaleX(1); transform-origin: left; }

/* Navigation : filet or qui se trace sous l'entrée survolée ou courante */
.sgf-nav a { transition: color var(--sgf-micro) ease; }
@media (min-width: 1024px) {
	.sgf-nav__list > li > a { position: relative; }
	.sgf-nav__list > li > a::before { content: ""; position: absolute; left: .8rem; right: .8rem; bottom: .3rem; height: 1px; background: var(--or); transform: scaleX(0); transform-origin: left; transition: transform 480ms var(--sgf-ease); }
	.sgf-nav__list > li:hover > a::before, .sgf-nav__list > li:focus-within > a::before,
	.sgf-nav__list > .current-menu-item > a::before, .sgf-nav__list > .current-menu-ancestor > a::before, .sgf-nav__list > .current_page_parent > a::before { transform: scaleX(1); }
	.sgf-nav .sub-menu { transform: translateY(8px); transition: opacity .3s var(--sgf-ease), transform .45s var(--sgf-ease), visibility .3s; }
}

/* Flèches de lien */
.sgf-link-arrow::after, .sgf-card__more::after { display: inline-block; transition: transform 520ms var(--sgf-ease); }
.sgf-card__more::after { content: "→"; margin-left: .55em; }

/* Cartes : légère élévation, image qui s'approche, flèche qui avance */
.sgf-card { transition: border-color .4s var(--sgf-ease), box-shadow .7s var(--sgf-ease), transform .7s var(--sgf-ease); }
.sgf-card__media { overflow: hidden; }
.sgf-card__media img { transition: transform 1.2s var(--sgf-ease); }
.sgf-person__photo img { transition: transform 1.2s var(--sgf-ease); }
@media (hover: hover) {
	.sgf-card:hover { transform: translateY(-4px); box-shadow: 0 22px 44px -28px rgba(11, 11, 11, .45); }
	.sgf-card:hover .sgf-card__media img { transform: scale(1.05); }
	.sgf-card:hover .sgf-card__more::after, .sgf-link-arrow:hover::after { transform: translateX(6px); }
	.sgf-person:hover .sgf-person__photo img { transform: scale(1.035); }
}

/* En-tête : une ombre s'installe dès qu'on quitte le haut de page (lié au défilement, sans script) */
@supports (animation-timeline: scroll()) {
	.sgf-header { animation: sgf-entete-ombre linear both; animation-timeline: scroll(root); animation-range: 0 140px; }
	@keyframes sgf-entete-ombre { to { box-shadow: 0 14px 34px -14px rgba(0, 0, 0, .6); } }
}

@media (prefers-reduced-motion: no-preference) {

	/* ---------- 2. Entrée de page (CSS seul, une fois au chargement) ---------- */

	/* Photo : sort du noir et se pose */
	.sgf-hero__img, .sgf-hero-photo, .sgf-banner__img, .sgf-crete { animation: sgf-pose 2.6s var(--sgf-ease) both; }

	@keyframes sgf-pose { from { opacity: .3; scale: 1.1; } }

	/* Accroche : chaque mot monte derrière son masque (écho aux légendes du diaporama d'origine) */
	.sgf-mot > span { display: inline-block; animation: sgf-mot 1.25s var(--sgf-ease) both; animation-delay: calc(.3s + var(--i, 0) * 75ms); }
	@keyframes sgf-mot { from { transform: translateY(110%); } }

	/* Titres de bandeau : se découvrent de haut en bas en montant */
	.sgf-banner__title { animation: sgf-masque 1.3s var(--sgf-ease) .3s both; }
	@keyframes sgf-masque {
		from { clip-path: inset(-.5em -.5em 100% -.5em); translate: 0 .45em; }
		to { clip-path: inset(-.5em -.5em -.3em -.5em); translate: 0 0; }
	}
	.sgf-hero__kicker, .sgf-breadcrumb { animation: sgf-monte .9s var(--sgf-ease) .1s both; }
	.sgf-hero__actions { animation: sgf-monte 1s var(--sgf-ease) .75s both; }
	.sgf-stats__list > li { animation: sgf-monte 1s var(--sgf-ease) both; }
	.sgf-stats__list > li:nth-child(1) { animation-delay: .9s; }
	.sgf-stats__list > li:nth-child(2) { animation-delay: .98s; }
	.sgf-stats__list > li:nth-child(3) { animation-delay: 1.06s; }
	.sgf-stats__list > li:nth-child(4) { animation-delay: 1.14s; }
	/* Surtitre au-dessus du titre : il arrive d'abord, son filet se trace */
	.sgf-banner__sub { animation: sgf-monte 1s var(--sgf-ease) .12s both; }
	.sgf-banner__sub::before { animation: sgf-trace 1.2s var(--sgf-ease) .2s both; transform-origin: left; }
	/* La barre entre d'un bloc, en fondu seul : pas de déplacement d'éléments dans une zone qui défile */
	.sgf-section-nav__list { animation: sgf-apparait .9s ease .6s both; }
	@keyframes sgf-apparait { from { opacity: 0; } }
	@keyframes sgf-monte { from { opacity: 0; translate: 0 14px; } }
	@keyframes sgf-trace { from { transform: scaleX(0); } }

	/* ---------- 3. Profondeur au défilement (natif ; ignoré par les navigateurs qui ne le gèrent pas) ---------- */
	@supports (animation-timeline: view()) {
		/* Accueil et bandeaux : la photo reste un peu en arrière quand on descend */
		/* clip et non hidden : hidden ferait de la section un conteneur de défilement, et view() resterait figé */
		.sgf-hero, .sgf-banner { overflow: clip; }
		.sgf-hero__img, .sgf-hero-photo, .sgf-banner__img, .sgf-crete { animation: sgf-pose 2.6s var(--sgf-ease) both, sgf-recul linear both; animation-timeline: auto, view(block 0px); animation-range: normal, exit; }
		/* view(block 0px) : le recul part du haut de l’écran, pas du scroll-padding réservé à l’en-tête (sinon la photo descend sous le filet or en haut de page). */
		@keyframes sgf-recul { to { translate: 0 18%; } }

		/* Bande « Travaillons ensemble » : parallaxe douce (l'ancien site l'avait en jQuery) */
		.sgf-band { overflow: clip; }
		.sgf-band__img { inset: -12% 0; height: 124%; animation: sgf-parallaxe linear both; animation-timeline: view(); animation-range: cover; }
		@keyframes sgf-parallaxe { from { translate: 0 -9%; } to { translate: 0 9%; } }
	}

	/* ---------- 4. Apparitions au défilement (motion.js marque, observe une fois, puis retire la marque) ---------- */
	.sgf-motion [data-sgf-reveal] { opacity: 0; translate: 0 16px; }
	.sgf-motion [data-sgf-reveal].is-in { opacity: 1; translate: 0 0; transition: opacity .9s var(--sgf-ease) var(--sgf-delai, 0ms), translate 1.1s var(--sgf-ease) var(--sgf-delai, 0ms); }

	/* Filets or qui se tracent : surtitres, témoignages, bureaux */
	.sgf-motion [data-sgf-reveal] .sgf-eyebrow::before { transform: scaleX(0); }
	.sgf-motion [data-sgf-reveal].is-in .sgf-eyebrow::before { transform: none; transition: transform 1.2s var(--sgf-ease) calc(var(--sgf-delai, 0ms) + 250ms); }
	.sgf-motion [data-sgf-reveal]:is(.sgf-quote, .sgf-office) { position: relative; border-top-color: transparent; }
	.sgf-motion [data-sgf-reveal]:is(.sgf-quote, .sgf-office)::before { content: ""; position: absolute; top: -2px; left: 0; right: 0; height: 2px; background: var(--or); transform: scaleX(0); transform-origin: left; }
	.sgf-motion [data-sgf-reveal].is-in:is(.sgf-quote, .sgf-office)::before { transform: none; transition: transform 1.3s var(--sgf-ease) calc(var(--sgf-delai, 0ms) + 200ms); }

	/* Images des cartes et portraits : se posent pendant que la carte monte */
	.sgf-motion [data-sgf-reveal] :is(.sgf-card__media, .sgf-person__photo) img { scale: 1.08; }
	.sgf-motion [data-sgf-reveal].is-in :is(.sgf-card__media, .sgf-person__photo) img { scale: 1; transition: scale 1.8s var(--sgf-ease) var(--sgf-delai, 0ms); }

	/* Rideau : photo de présentation et images de contenu. Le masque est sur l'image, jamais sur l'élément
	   observé : IntersectionObserver tient compte du clip-path de sa cible et ne la verrait jamais. */
	.sgf-motion [data-sgf-reveal="rideau"] { opacity: 1; translate: none; overflow: hidden; }
	.sgf-motion [data-sgf-reveal="rideau"]::before { opacity: 0; } /* filet or des services : apparaît une fois le rideau ouvert */
	.sgf-motion [data-sgf-reveal="rideau"] img { scale: 1.14; clip-path: inset(0 100% 0 0); }
	.sgf-motion [data-sgf-reveal="rideau"].is-in img { scale: 1; clip-path: inset(0); transition: clip-path 1.4s var(--sgf-ease-io) var(--sgf-delai, 0ms), scale 2.2s var(--sgf-ease) var(--sgf-delai, 0ms); }

	/* ---------- 5. Changement de page : fondu, l'en-tête reste en place ---------- */
	@view-transition { navigation: auto; }
	.sgf-header { view-transition-name: sgf-entete; }
	/* Fondu natif du navigateur (mélange sans creux) ; seule la durée change. Des opacités maison faisaient
	   transparaître le fond à mi-parcours : la page clignotait. */
	::view-transition-old(root), ::view-transition-new(root) { animation-duration: .4s; }

	/* Arrivée par fondu (classe posée dans <head> à « pagereveal ») : la photo, la même d'une page à l'autre,
	   ne rejoue pas son entrée, sinon elle s'éteint puis se rallume sous le fondu. */
	.sgf-vt :is(.sgf-hero__img, .sgf-hero-photo, .sgf-banner__img, .sgf-crete) { animation-name: none; }
	@supports (animation-timeline: view()) {
		.sgf-vt :is(.sgf-hero__img, .sgf-hero-photo, .sgf-banner__img, .sgf-crete) { animation-name: none, sgf-recul; }
	}

	/* ---------- 6. Fiches de l'équipe : le détail se déplie au lieu d'apparaître d'un coup ---------- */
	@supports (interpolate-size: allow-keywords) {
		.sgf-person__more { interpolate-size: allow-keywords; }
		.sgf-person__more::details-content { block-size: 0; overflow: hidden; opacity: 0; transition: block-size .55s var(--sgf-ease), opacity .45s ease, content-visibility .55s allow-discrete; }
		.sgf-person__more[open]::details-content { block-size: auto; opacity: 1; }
	}
}

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

@media print {
	.sgf-motion [data-sgf-reveal] { opacity: 1 !important; translate: none !important; clip-path: none !important; }
}
