/* =============================================================================
   layout.css · Ossature commune à toutes les pages :
   fond ambiant, conteneur, en-tête, pied de page, en-tête de page intérieure.
   ========================================================================== */

/* --- Racine et fond ---------------------------------------------------------- */

.site-root {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  overflow-x: clip;
  /* Trois foyers de couleur superposés : la page respire au lieu d'être
     uniformément sombre. */
  background:
    radial-gradient(ellipse 70% 50% at 12% 8%, rgba(74, 99, 255, 0.13), transparent 70%),
    radial-gradient(ellipse 60% 45% at 88% 22%, rgba(32, 213, 223, 0.08), transparent 70%),
    radial-gradient(circle at 12% 62%, rgba(14, 83, 198, 0.08), transparent 34rem),
    var(--navy-900);
}

/* Le contenu passe devant le décor ambiant. L'en-tête est volontairement exclu :
   il gère lui-même son empilement (position: sticky + --z-header) et une règle
   plus spécifique ici écraserait son z-index. */
.site-root > main,
.site-root > footer {
  position: relative;
  z-index: var(--z-content);
}

/* Trame technique discrète, posée derrière tout le contenu. */
.site-root::before {
  position: fixed;
  z-index: -2;
  inset: 0;
  content: "";
  pointer-events: none;
  opacity: 0.27;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 84px 84px;
  mask-image: linear-gradient(to bottom, black, transparent 84%);
}

/* --- Lion ambiant -----------------------------------------------------------
   Filigrane de marque piloté par le défilement (assets/js/modules/ambient.js).
   La variable --ambient-progress va de 0 (haut de page) à 1 (bas de page). */

.ambient {
  --ambient-progress: 0;
  position: fixed;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient__lion {
  position: absolute;
  width: min(44vw, 680px);
  top: calc(8vh + var(--ambient-progress) * 34vh);
  right: calc(-14vw + var(--ambient-progress) * 6vw);
  opacity: 0.035;
  filter: blur(5px) saturate(1.2) drop-shadow(0 0 90px rgba(23, 104, 255, 0.42));
  transform: rotate(calc(-8deg + var(--ambient-progress) * 20deg))
    scale(calc(1 + var(--ambient-progress) * 0.18));
}

.ambient__orb {
  position: absolute;
  display: block;
  border-radius: 50%;
  filter: blur(100px);
  mix-blend-mode: screen;
  opacity: 0.13;
  will-change: transform;
}

.ambient__orb--blue {
  width: 42vw;
  height: 42vw;
  top: 5%;
  right: -18%;
  background: var(--blue);
  transform: translate3d(calc(var(--ambient-progress) * -9vw), calc(var(--ambient-progress) * 28vh), 0);
  animation: ambient-drift-a 14s ease-in-out infinite alternate;
}

.ambient__orb--cyan {
  width: 31vw;
  height: 31vw;
  top: 46%;
  left: -16%;
  background: var(--cyan);
  transform: translate3d(calc(var(--ambient-progress) * 11vw), calc(var(--ambient-progress) * -18vh), 0);
  animation: ambient-drift-b 18s ease-in-out infinite alternate;
}

.ambient__orb--indigo {
  width: 38vw;
  height: 38vw;
  top: 68%;
  right: -6%;
  background: var(--indigo);
  opacity: 0.1;
  transform: translate3d(calc(var(--ambient-progress) * -6vw), calc(var(--ambient-progress) * -22vh), 0);
  animation: ambient-drift-a 21s ease-in-out infinite alternate;
}

/* La dérive utilise « translate », propriété indépendante qui se compose avec
   le « transform » du défilement. Animer des marges, comme c'était le cas,
   obligeait le navigateur à refaire la mise en page à chaque image. */
@keyframes ambient-drift-a { to { translate: -7vw 9vh; } }
@keyframes ambient-drift-b { to { translate: 8vw -7vh; } }

@media (prefers-reduced-motion: reduce) {
  .ambient { display: none; }
}

/* --- Conteneur ---------------------------------------------------------------
   Une seule largeur de référence : en-tête, contenu et pied de page sont
   alignés sur la même colonne. */

.shell {
  width: min(var(--shell-max), 100% - var(--shell-gutter) * 2);
  margin-inline: auto;
}

/* --- En-tête ------------------------------------------------------------------ */

/* Barre de navigation flottante : une pilule posée sur la page, plutôt qu'un
   bandeau collé au bord. Le voile en dégradé évite que le texte de la page
   apparaisse crûment dans les quelques pixels au-dessus. */
.site-header {
  position: sticky;
  z-index: var(--z-header);
  top: 14px;
  margin-top: 14px;
}

.site-header::before {
  position: absolute;
  z-index: -1;
  inset: -22px 0 auto;
  height: 104px;
  content: "";
  pointer-events: none;
  background: linear-gradient(var(--navy-900) 35%, transparent);
}

.site-header__inner {
  height: 74px;
  padding: 0 14px 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: rgba(6, 14, 32, 0.74);
  backdrop-filter: blur(22px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
}

.brand {
  --logo-w: 168px;
  width: var(--logo-w);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand img {
  width: 100%;
  height: auto;
  display: block;
}

.nav {
  display: flex;
  align-items: center;
  gap: 34px;
  font-size: var(--fs-small);
  font-weight: 530;
}

.nav a {
  position: relative;
  padding: 12px 0;
  color: var(--ink-strong);
  transition: color var(--dur-fast) var(--ease);
}

.nav a:hover { color: var(--ink); }

/* Trait dégradé animé sous l'onglet survolé ou actif. */
.nav a::after {
  position: absolute;
  right: 0;
  bottom: 4px;
  left: 0;
  height: 1px;
  content: "";
  background: var(--gradient-brand);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-fast) var(--ease);
}

.nav a:hover::after,
.nav a:focus-visible::after,
.nav a[aria-current="page"]::after {
  transform: scaleX(1);
}

.nav a[aria-current="page"] { color: var(--ink); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-cta {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  min-height: 46px;
  padding: 0 18px 0 22px;
  color: var(--ink-strong);
  border: 1px solid rgba(112, 165, 255, 0.35);
  border-radius: var(--radius-pill);
  font-size: var(--fs-tiny);
  font-weight: 560;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease),
    background var(--dur-fast) var(--ease);
}

.header-cta:hover {
  border-color: var(--cyan);
  background: rgba(32, 213, 223, 0.08);
}

.header-cta span { color: var(--cyan); }

/* --- Menu mobile ------------------------------------------------------------
   Construit avec <details> : il fonctionne même si le JavaScript est bloqué.
   nav.js n’ajoute que le confort (fermeture par Échap ou clic extérieur). */

.nav-drawer { display: none; position: relative; }

.nav-drawer > summary {
  width: 48px;
  height: 48px;
  display: grid;
  place-content: center;
  gap: 6px;
  list-style: none;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 50%;
}

.nav-drawer > summary::-webkit-details-marker { display: none; }

.nav-drawer > summary span {
  width: 18px;
  height: 1.5px;
  display: block;
  background: var(--ink-strong);
  border-radius: 2px;
  transform-origin: center;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-mid) var(--ease);
}

.nav-drawer[open] > summary span:nth-child(1) { transform: translateY(7.5px) rotate(45deg); }
.nav-drawer[open] > summary span:nth-child(2) { opacity: 0; }
.nav-drawer[open] > summary span:nth-child(3) { transform: translateY(-7.5px) rotate(-45deg); }

.nav-drawer__panel {
  position: absolute;
  top: 62px;
  right: 0;
  width: min(330px, calc(100vw - 40px));
  max-height: calc(100vh - 120px);
  padding: 10px;
  overflow-y: auto;
  display: grid;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(4, 11, 27, 0.98);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.nav-drawer__brand {
  min-height: auto;
  margin-bottom: 4px;
  padding: 2px 0 12px;
  display: flex;
  align-items: center;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
}

.nav-drawer__brand > img {
  width: min(224px, 72vw);
  height: auto;
  display: block;
}

.nav-drawer__panel > a:not(.nav-drawer__brand) {
  min-height: 56px;
  padding: 0 15px;
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--ink-strong);
  border-bottom: 1px solid var(--line);
  font-size: 17px;
}

.nav-drawer__panel > a:not(.nav-drawer__brand):last-child { border-bottom: 0; }
.nav-drawer__panel > a:not(.nav-drawer__brand):hover { color: var(--cyan); }
.nav-drawer__panel > a:not(.nav-drawer__brand) > span { color: var(--cyan); font: var(--fs-mono) var(--font-mono); }

/* --- En-tête de page intérieure ---------------------------------------------- */

.page-hero {
  position: relative;
  padding: clamp(90px, 12vw, 150px) 0 clamp(64px, 8vw, 110px);
  overflow: hidden;
  display: flex;
  justify-content: center;
  flex-direction: column;
  border-bottom: 1px solid var(--line);
}

.page-hero__lion {
  position: absolute;
  z-index: 0;
  right: 0;
  top: 45px;
  width: min(43vw, 560px);
  opacity: 0.075;
  filter: drop-shadow(0 0 55px rgba(32, 124, 255, 0.5));
}

.page-hero > *:not(.page-hero__lion) { position: relative; z-index: 2; }

.page-hero h1 { max-width: 16ch; }

.page-hero h1 span,
.gradient-text {
  color: transparent;
  background: linear-gradient(90deg, #e5efff, var(--blue-soft) 55%, var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
}

.page-hero__lead {
  max-width: 62ch;
  margin: 36px 0 0;
  color: var(--ink-muted);
  font-size: var(--fs-lead);
  line-height: 1.66;
}

.page-hero__index {
  margin-top: 56px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.page-hero__index a {
  min-height: 44px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  color: var(--ink-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font: 12px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.page-hero__index a:hover {
  color: var(--cyan);
  border-color: rgba(32, 213, 223, 0.35);
}

/* --- Pied de page --------------------------------------------------------------- */

.site-footer {
  padding: var(--section-y-sm) 0 28px;
  border-top: 1px solid var(--line);
  background: #020612;
}

.footer-grid {
  padding-bottom: 64px;
  display: grid;
  grid-template-columns: 1.8fr repeat(3, 1fr);
  gap: 64px;
}

.footer-brand a {
  --logo-w: 180px;
  width: var(--logo-w);
  display: flex;
  flex-direction: column;
}

.footer-brand a > img { width: 100%; height: auto; display: block; }

.footer-brand p {
  max-width: 40ch;
  margin: 22px 0 0;
  color: var(--ink-subtle);
  font-size: 14px;
  line-height: 1.7;
}

.footer-column {
  display: flex;
  align-items: flex-start;
  flex-direction: column;
  gap: 13px;
}

.footer-column a,
.footer-column p:not(.footer-column__label) {
  color: var(--ink-subtle);
  font-size: 14px;
}

.footer-column a:hover { color: var(--cyan); }

/* Lien social du pied de page : l'icône s'aligne sur la ligne de base du texte
   et prend sa couleur, y compris au survol. */
.footer-social {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.footer-social__icon {
  flex-shrink: 0;
  display: block;
}

.footer-column__label {
  margin-bottom: 8px;
  color: var(--ink-faint);
  font: var(--fs-mono) var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.footer-bottom {
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  font: var(--fs-mono) var(--font-mono);
  line-height: 1.6;
  text-transform: uppercase;
}

.footer-bottom__legal {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-bottom__legal a { padding: 5px 0; }
.footer-bottom__legal a:hover { color: var(--cyan); }

/* --- Adaptations ------------------------------------------------------------------ */

@media (max-width: 1080px) {
  .nav { display: none; }
  .nav-drawer { display: block; }
  .header-actions { margin-left: auto; }
  .footer-grid { gap: 40px; }
}

@media (max-width: 820px) {
  .site-header__inner { height: 66px; padding: 0 10px 0 18px; }
  .brand { --logo-w: 148px; }
  .header-cta { display: none; }
  .page-hero__lion { right: -26%; width: 80vw; }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
  .footer-grid .footer-column:last-child { display: none; }
}

@media (max-width: 560px) {
  .page-hero__index { display: grid; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .footer-bottom { flex-direction: column; }
}
