/* ==========================================================================
   EXIGENCES GROUPE — BASE STYLES
   ========================================================================== */
@import url('tokens.css');

/* --- RESET / BASE --------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-padding-top: 100px; /* compensate sticky header */
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background: var(--color-bg);
  overflow-x: hidden;
}

img, video, svg, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, textarea, select {
  font: inherit;
  color: inherit;
  border: none;
  background: none;
}

ul, ol { list-style: none; }

::selection {
  background: var(--eg-gold-300);
  color: var(--eg-ink-900);
}

:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* --- SKIP LINK (accessibility) -------------------------------------------- */
.skip-link {
  position: fixed;
  top: -100%;
  left: var(--gutter);
  background: var(--color-accent);
  color: var(--eg-white);
  padding: var(--space-2) var(--space-4);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  z-index: var(--z-overlay);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus {
  top: 0;
}

/* --- CONTAINER ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide {
  max-width: var(--container-wide);
}
.container--text {
  max-width: var(--container-text);
}

/* --- TYPOGRAPHY ----------------------------------------------------------- */
.heading-serif,
.heading-display {
  font-family: var(--font-display);
  color: var(--color-text);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

h1, .h1 { font-size: var(--text-6xl); }
h2, .h2 { font-size: var(--text-4xl); }
h3, .h3 { font-size: var(--text-2xl); }
h4, .h4 { font-size: var(--text-xl);  }
h5, .h5 { font-size: var(--text-lg);  }
h6, .h6 { font-size: var(--text-base); font-weight: var(--weight-semibold); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
}

.text-muted { color: var(--color-text-muted); }
.text-gold  { color: var(--color-accent); }
.text-sm    { font-size: var(--text-sm); }
.text-xs    { font-size: var(--text-xs); }
.text-lg    { font-size: var(--text-lg); }

/* L'attribut [hidden] vient de la feuille de style du navigateur : toute règle
   `display` d'auteur (.notice { display:flex }, .filters, etc.) le neutralise.
   On le rétablit une fois pour toutes. */
[hidden] { display: none !important; }

.eyebrow {
  display: block;
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--space-4);
}

/* --- SECTION -------------------------------------------------------------- */
.section {
  padding-block: var(--section-y);
}
.section--alt {
  background: var(--color-bg-alt);
}
.section--dark {
  background: var(--color-bg-inverse);
  color: var(--color-text-inverse);
}
.section--dark .text-muted {
  color: var(--color-text-inverse-muted);
}
.section--dark .eyebrow {
  color: var(--eg-gold-400);
}
.section-header {
  text-align: center;
  margin-bottom: var(--space-7);
}
.section-header h2 {
  margin-bottom: var(--space-4);
}
.section-header p {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  max-width: 60ch;
  margin-inline: auto;
}

/* --- BUTTONS -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.85em 1.7em;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  cursor: pointer;
  transition: background var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.97);
}
.btn svg {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

/* primary */
.btn-primary {
  background: var(--color-accent);
  color: var(--eg-white);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 4px 20px rgba(201, 153, 47, .3);
}

/* secondary — remplissage encre, pas or */
.btn-secondary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
}
.btn-secondary:hover {
  background: var(--color-primary-hover);
}

/* outline */
.btn-outline {
  border: 1.5px solid var(--color-border-strong);
  color: var(--color-text);
  background: transparent;
}
.btn-outline:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
  background: var(--eg-gold-50);
}

/* ghost — sur fond sombre */
.btn-ghost {
  border: 1.5px solid var(--color-border-inverse);
  color: var(--color-text-inverse);
  background: transparent;
}
.btn-ghost:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* icon-only */
.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius-full);
}

/* arrow direction */
.btn .arrow {
  transition: transform var(--dur-base) var(--ease-out);
}
.btn:hover .arrow {
  transform: translateX(4px);
}

/* --- CARDS ---------------------------------------------------------------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--color-border);
  transition: box-shadow var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out);
}
.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
  transform: translateY(-4px);
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--color-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-5);
  color: var(--color-accent);
  flex-shrink: 0;
}
.card-icon svg {
  width: 26px;
  height: 26px;
}

.card h3 {
  font-size: var(--text-xl);
  margin-bottom: var(--space-3);
}

.card p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
}

.card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--color-accent);
  margin-top: var(--space-5);
  transition: gap var(--dur-base) var(--ease-out);
}
.card-link:hover {
  gap: var(--space-3);
}

/* --- SCROLL REVEAL -------------------------------------------------------- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--dur-reveal) var(--ease-out),
              transform var(--dur-reveal) var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
/* Variante clip-path : masque qui se révèle par le bas */
.reveal-mask {
  clip-path: inset(100% 0 0 0);
  transition: clip-path 1.1s var(--ease-out);
}
.reveal-mask.visible {
  clip-path: inset(0 0 0 0);
}
/* Stagger pour les enfants */
.stagger > * {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--dur-reveal) var(--ease-out),
              transform var(--dur-reveal) var(--ease-out);
}
.stagger.visible > *:nth-child(1) { transition-delay: 0ms;   opacity: 1; transform: none; }
.stagger.visible > *:nth-child(2) { transition-delay: 100ms; opacity: 1; transform: none; }
.stagger.visible > *:nth-child(3) { transition-delay: 200ms; opacity: 1; transform: none; }
.stagger.visible > *:nth-child(4) { transition-delay: 300ms; opacity: 1; transform: none; }
.stagger.visible > *:nth-child(5) { transition-delay: 400ms; opacity: 1; transform: none; }
.stagger.visible > *:nth-child(6) { transition-delay: 500ms; opacity: 1; transform: none; }

/* --- COUNTER ANIMATION ---------------------------------------------------- */
.counter {
  font-variant-numeric: tabular-nums;
}

/* --- CUSTOM CURSOR -------------------------------------------------------- */
.cursor {
  position: fixed;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--color-accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition: width var(--dur-base) var(--ease-out),
              height var(--dur-base) var(--ease-out),
              background var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out),
              opacity var(--dur-base) var(--ease-out);
  opacity: 0;
  mix-blend-mode: exclusion;
}
.cursor.active {
  opacity: 1;
}
.cursor.hover {
  width: 56px;
  height: 56px;
  background: rgba(201, 153, 47, .1);
  border-color: var(--eg-gold-300);
}
@media (pointer: coarse) {
  .cursor { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .cursor { display: none !important; }
}

/* --- PROGRESS BAR (scroll) ----------------------------------------------- */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--color-accent);
  z-index: var(--z-overlay);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 100ms linear;
}

/* --- BACK TO TOP ---------------------------------------------------------- */
.back-to-top {
  position: fixed;
  bottom: var(--space-6);
  right: var(--gutter);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: var(--z-sticky);
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out),
              background var(--dur-base) var(--ease-out);
  box-shadow: var(--shadow-md);
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
}
.back-to-top:hover {
  background: var(--color-accent);
}
.back-to-top svg {
  width: 20px;
  height: 20px;
}

/* ==========================================================================
   HEADER
   ========================================================================== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  padding: var(--space-4) 0;
  transition: background var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out),
              padding var(--dur-base) var(--ease-out);
}
.header.scrolled {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  padding: var(--space-3) 0;
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
}

.header__logo img {
  height: 42px;
  width: auto;
}
.header.scrolled .header__logo img {
  height: 36px;
}
.header__logo--white {
  display: block;
}
.header.scrolled .header__logo--white {
  display: none;
}
.header__logo--dark {
  display: none;
}
.header.scrolled .header__logo--dark {
  display: block;
}

/* --- NAVIGATION ----------------------------------------------------------- */
.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.header__menu {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}
.header__menu a {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-inverse);
  padding: var(--space-2) 0;
  position: relative;
  transition: color var(--dur-base) var(--ease-out);
}
.header.scrolled .header__menu a {
  color: var(--color-text);
}
.header__menu a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 2px;
  background: var(--color-accent);
  transition: width var(--dur-base) var(--ease-out);
}
.header__menu a:hover::after,
.header__menu a[aria-current="page"]::after {
  width: 100%;
}

/* Mega menu */
.has-mega {
  position: relative;
}
.mega-menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border);
  padding: var(--space-6);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
  min-width: 520px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out),
              transform var(--dur-base) var(--ease-out);
  z-index: var(--z-menu);
}
.has-mega:hover .mega-menu,
.has-mega:focus-within .mega-menu,
.has-mega.open .mega-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
/* Retour visuel quand le menu est ouvert par clic */
.has-mega.open > a {
  color: var(--color-accent);
}
.mega-menu__item {
  display: block;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  transition: background var(--dur-fast) var(--ease-out);
}
.mega-menu__item:hover {
  background: var(--color-bg-alt);
}
.mega-menu__item h4 {
  font-size: var(--text-base);
  margin-bottom: var(--space-1);
  font-weight: var(--weight-semibold);
}
.mega-menu__item p {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* CTA header */
.header__cta .btn {
  padding: 0.6em 1.3em;
  font-size: var(--text-xs);
}

/* --- HAMBURGER (mobile) --------------------------------------------------- */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: var(--space-2);
  z-index: var(--z-menu);
}
.hamburger span {
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform var(--dur-base) var(--ease-out),
              opacity var(--dur-base) var(--ease-out);
}
.header:not(.scrolled) .hamburger span {
  background: var(--color-text-inverse);
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(4px, 5px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -5px); }

/* --- MOBILE NAV ----------------------------------------------------------- */
.mobile-nav {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: var(--z-menu);
  padding: 100px var(--gutter) var(--space-4);
  display: flex;
  flex-direction: column;
  /* interlignes serrés : les 7 entrées + le sous-menu des pôles + le bloc de
     contact doivent tenir sur un écran de 812 px sans défilement */
  gap: var(--space-2);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-out);
  overflow-y: auto;
}
.mobile-nav.open {
  opacity: 1;
  pointer-events: auto;
}
.mobile-nav a {
  font-size: var(--text-2xl);
  font-family: var(--font-display);
  font-weight: var(--weight-semibold);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
  transition: color var(--dur-fast);
}
.mobile-nav a:hover {
  color: var(--color-accent);
}
/* Libellé de section non cliquable (« Expertises » = pont vers les pôles) */
.mobile-nav__label {
  font-size: var(--text-xs);
  font-family: var(--font-body);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--color-text-muted);
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--color-border);
}

/* ==========================================================================
   HERO
   ========================================================================== */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  /* haut : dégage l'en-tête fixe (+ bandeau de recette).
     bas : laisse respirer l'indicateur de défilement sans faire déborder
     le héros hors du premier écran sur un portable 1440 × 900. */
  padding: var(--space-10) 0 var(--space-8);
  background: var(--color-bg-inverse);
  color: var(--color-text-inverse);
  overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 75% 30%, rgba(201, 153, 47, .15), transparent),
    radial-gradient(ellipse 60% 80% at 20% 80%, rgba(13, 21, 35, .4), transparent);
  pointer-events: none;
}
.hero__grid {
  position: relative;
  z-index: var(--z-base);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-8);
  align-items: center;
}
.hero__content {
  max-width: 580px;
}
.hero__eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--eg-gold-400);
  margin-bottom: var(--space-4);
}
.hero h1 {
  font-size: var(--text-6xl);
  color: var(--eg-white);
  margin-bottom: var(--space-5);
  line-height: var(--leading-tight);
}
.hero h1 span {
  color: var(--eg-gold-400);
}
.hero__desc {
  font-size: var(--text-lg);
  color: var(--eg-ink-300);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
  max-width: 48ch;
}
.hero__actions {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.hero__visual {
  position: relative;
  aspect-ratio: 4/3;
  border-radius: var(--radius-xl);
  overflow: hidden;
}
.hero__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Fallback si pas d'image */
.hero__visual::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(201,153,47,.2), rgba(13,21,35,.4));
  border-radius: inherit;
}

/* ==========================================================================
   HEADER BANNER (fictif, à masquer après correction)
   ========================================================================== */
.header-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: calc(var(--z-header) + 1);
  background: var(--eg-ink-900);
  color: var(--eg-ink-300);
  text-align: center;
  padding: var(--space-2) var(--gutter);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
}
.header-banner a {
  color: var(--eg-gold-400);
  text-decoration: underline;
}
.header.has-banner {
  top: 36px;
}
/* le panneau mobile démarre sous l'en-tête ; avec le bandeau de recette celui-ci
   descend de 36 px, le rembourrage haut du panneau doit suivre sinon la première
   entrée passe sous la barre. Règle à supprimer avec le bandeau. */
.header.has-banner ~ .mobile-nav {
  padding-top: 124px;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1024px) {
  .hero__grid {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .hero__content {
    max-width: 100%;
  }
  .hero__actions {
    justify-content: center;
  }
  .hero__visual {
    max-width: 560px;
    margin-inline: auto;
  }
  .mega-menu {
    min-width: 420px;
  }
}

@media (max-width: 768px) {
  .hamburger { display: flex; }
  .header__menu, .header__cta { display: none; }

  .hero {
    min-height: auto;
    padding-top: calc(var(--space-10) + 20px);
    padding-bottom: var(--section-y-tight);
  }
  .hero h1 {
    font-size: var(--text-4xl);
  }
  .hero__desc {
    font-size: var(--text-base);
  }

  .card {
    padding: var(--space-5);
  }

  .section {
    padding-block: var(--section-y-tight);
  }
}

@media (max-width: 480px) {
  .hero__actions {
    flex-direction: column;
  }
  .hero__actions .btn {
    width: 100%;
  }
}

/* ==========================================================================
   PREFERS REDUCED MOTION
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
  .stagger > * { opacity: 1; transform: none; }
}
