@layer reset {
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { font-size: 16px; -webkit-text-size-adjust: 100%; }
  body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh; min-height: 100dvh;
  }
  img, video, svg { max-width: 100%; height: auto; display: block; }
  a { color: inherit; text-decoration: none; }
  button { cursor: pointer; border: none; background: none; font-family: inherit; }
  ul, ol { list-style: none; }
  [id] { scroll-margin-top: calc(var(--header-h) + var(--space-4)); }

  /* Skip link — TOUJOURS présent */
  .skip-link {
    position: absolute; top: var(--space-4); left: var(--space-4); transform: translateY(-300%);
    background: var(--color-primary); color: var(--color-on-primary);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    font-weight: 600; z-index: var(--z-tooltip);
    transition: transform var(--duration-fast) var(--ease-out);
  }
  .skip-link:focus { transform: none; }

  /* prefers-reduced-motion — OBLIGATOIRE, jamais absent.
     Réduire sans tout supprimer : on garde les fondus d'opacité/couleur (transitions),
     on retire les mouvements (transform) et les animations @keyframes. */
  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      scroll-behavior: auto !important;
    }
    .reveal, .reveal.visible,
    .card, .btn, .nav-mobile, .nav-mobile[hidden] { transform: none !important; }
  }
}

@layer base {
  /* Finition mobile : pas de flash gris au tap ; pas de délai de tap ; champs à 16 px (pas de zoom iOS) */
  html { -webkit-tap-highlight-color: transparent; }
  a, button, [role="button"], summary { touch-action: manipulation; }
  input, textarea, select { font-size: max(16px, 1rem); }
  /* Smooth scroll conditionnel */
  @media (prefers-reduced-motion: no-preference) {
    html.smooth-scroll { scroll-behavior: smooth; }
  }

  /* Typographie */
  h1 { font-family: var(--font-display); font-weight: 800; font-size: var(--size-h1); line-height: 1.1; letter-spacing: -0.02em; }
  h2 { font-family: var(--font-display); font-weight: 700; font-size: var(--size-h2); line-height: 1.2; letter-spacing: -0.01em; }
  h3 { font-family: var(--font-display); font-weight: 600; font-size: var(--size-h3); line-height: 1.3; }
  h4 { font-family: var(--font-display); font-weight: 600; font-size: var(--size-h4); line-height: 1.4; }
  p  { font-family: var(--font-body); font-weight: 400; line-height: 1.7; max-width: 68ch; }
  p.full-width { max-width: none; }

  .text-lead, .lead { font-size: var(--size-body-lg); font-weight: 300; color: var(--color-text-muted); }
  .text-caption, .caption { font-size: var(--size-body-sm); color: var(--color-text-muted); }
  strong, b { font-weight: 700; }
  em        { font-style: italic; }

  /* Layout */
  .container { max-width: var(--container-max); margin-inline: auto; padding-inline: var(--container-pad); }
  section { padding-block: var(--section-padding-y); }

  /* Grilles mobile-first */
  .grid   { display: grid; gap: var(--space-6); }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }

  @media (min-width: 640px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
  }
  @media (min-width: 1024px) {
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
  }

  section:nth-child(even) { background-color: var(--color-surface); }

  .ratio-16-9 { aspect-ratio: 16 / 9; }
  .ratio-4-3  { aspect-ratio: 4 / 3; }
  .ratio-1-1  { aspect-ratio: 1; }
  .img-cover  { width: 100%; height: 100%; object-fit: cover; object-position: center; }

  .section-header { text-align: center; margin-bottom: var(--space-12); }
  .section-header h2 { margin-bottom: var(--space-4); }
  .section-header p  { margin-inline: auto; }

  /* Reveal — entrée de section (surface marketing, vue rarement).
     Le masquage initial n'existe que si le JS tourne (classe .js posée par main.js) :
     sans JS, le contenu reste visible. En reduced-motion : fondu seul, sans translation. */
  .js .reveal {
    opacity: 0;
    transform: translateY(16px);
    transition: opacity var(--duration-slow) var(--ease-out),
                transform var(--duration-slow) var(--ease-out);
  }
  .js .reveal.visible { opacity: 1; transform: none; }
  /* Stagger : pas de 60 ms, plafonné aux 4 premiers éléments d'une grille */
  .grid .reveal:nth-child(2) { transition-delay: 60ms; }
  .grid .reveal:nth-child(3) { transition-delay: 120ms; }
  .grid .reveal:nth-child(n+4) { transition-delay: 180ms; }
}

@layer base {
  /* Entrée du hero (rare : une fois par visite). Trois éléments, fondu + 12 px, 500 ms, décalage 0/80/160 ms.
     Une seule couche animée : jamais le conteneur ET ses enfants. Le CTA reste cliquable pendant l'entrée.
     Landing page comme site vitrine : retirer ces règles si le brief dit « aucune animation ». */
  @keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  .js .hero-title    { animation: rise 500ms var(--ease-out) both; }
  .js .hero-subtitle { animation: rise 500ms var(--ease-out) 80ms both; }
  .js .hero-actions  { animation: rise 500ms var(--ease-out) 160ms both; }
  @media (prefers-reduced-motion: reduce) {
    .js .hero-title, .js .hero-subtitle, .js .hero-actions { animation-name: fade; }
  }
}
