/* ════════════════════════════════════════════════════════════════
   Réalisons — Base styles
   Reset léger, typographie, layout 2 colonnes générique.
   À importer après tokens.css.
   ════════════════════════════════════════════════════════════════ */

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

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

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

button {
  cursor: pointer;
  border: none;
  background: none;
}

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

ul, ol { list-style: none; }

/* ── Body ────────────────────────────────────────────────────── */
body {
  font-family: var(--r-font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--r-text-body);
  background: var(--r-bg);
  min-height: 100vh;
  /* Réserve l'espace du footer fixe en bas (voir .r-footer) */
  padding-bottom: var(--r-footer-height, 40px);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Typographie de base (réutilisable partout) ─────────────── */
.r-eyebrow {
  font-family: var(--r-font-heading);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 1.4px;
  color: var(--r-teal);
  text-transform: uppercase;
  margin-bottom: 16px;
}

.r-h1 {
  font-family: var(--r-font-heading);
  font-weight: 700;
  font-size: 52px;
  line-height: 1.1;
  color: var(--r-text-dark);
  margin-bottom: 12px;
}

.r-h1__accent { color: var(--r-teal); }
.r-dot-accent { color: var(--r-orange); }

.r-h3 {
  font-family: var(--r-font-heading);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.2;
  color: var(--r-text-dark);
}

.r-body {
  font-family: var(--r-font-body);
  font-size: 18px;
  line-height: 1.6;
  color: var(--r-text-body);
}

.r-body--sm {
  font-size: 16px;
  line-height: 1.5;
}

/* Lead — paragraphe d'intro sous le H1, partagé par toutes les pages.
   Légèrement plus petit et plus aéré que .r-body, fonte light 300. */
.r-lead {
  font-family: var(--r-font-body);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 300;
  color: var(--r-text-body);
}

.r-caption {
  font-family: var(--r-font-body);
  font-size: 14px;
  line-height: 1.4;
  color: var(--r-text-muted);
}

/* ── Layout page 2 colonnes (v2) ─────────────────────────────
   Hero gauche sticky + content droit scrollable.
   Sur tablette/mobile, stack vertical. */
.r-page {
  display: grid;
  grid-template-columns: var(--r-page-2col-hero-width) 1fr;
  gap: var(--r-page-2col-gap);
  padding: 56px var(--r-page-margin) 80px;
  align-items: start;
}

.r-page__hero {
  position: sticky;
  top: var(--r-page-2col-sticky-top);
  /* La hauteur visible est limitée par la fenêtre — utile pour les heros longs */
  max-height: calc(100vh - var(--r-page-2col-sticky-top) - 40px);
  overflow-y: auto;
  padding-right: 8px;
  /* Colonne flex : permet de pousser les CTAs en bas du hero via margin-top: auto */
  display: flex;
  flex-direction: column;
}

.r-page__content {
  min-width: 0;  /* permet aux enfants de shrink correctement dans grid */
}

/* ── Footer (sticky bas, 3 zones : copyright | groupes | actions) ─
   Footer fixé en bas du viewport, effet "application".
   Hauteur compacte (variable --r-footer-height) compensée par
   le padding-bottom du body. Liens regroupés en popovers vers le
   haut pour limiter la surface tout en gardant tout accessible. */
.r-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  /* Au-dessus du mini-player (z-index 1200) : quand un dropdown du footer
     s'ouvre vers le haut, il passe par-dessus le player au lieu d'être masqué. */
  z-index: 1250;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--r-separator);
  background: var(--r-bg);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
  font-family: var(--r-font-body);
  font-size: 14px;
  line-height: 1.4;
  color: var(--r-text-body);
}

/* Barre de liens du footer (sous la bannière de lancement). */
.r-footer__bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding: 10px var(--r-page-margin);
  min-height: var(--r-footer-bar-height, 48px);
}

.r-footer__copyright {
  font-family: var(--r-font-heading);
  font-weight: 600;
  color: var(--r-text-muted);
  flex-shrink: 0;
  white-space: nowrap;
}

.r-footer__groups {
  display: flex;
  gap: 12px;
  align-items: center;
}

.r-footer__actions {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-left: auto;
}

.r-footer__group {
  position: relative;
}

.r-footer__group-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 6px 12px;
  font-family: var(--r-font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--r-text-dark);
  cursor: pointer;
  border-radius: var(--r-radius-pill);
  transition: var(--r-transition-color), background 150ms ease-out;
}

.r-footer__group-trigger:hover,
.r-footer__group-trigger[aria-expanded="true"] {
  color: var(--r-teal);
  background: rgba(40, 168, 191, 0.08);
}

.r-footer__group-chevron {
  width: 14px;
  height: 14px;
  transition: transform 200ms ease-out;
}

.r-footer__group-trigger[aria-expanded="true"] .r-footer__group-chevron {
  transform: rotate(180deg);
}

.r-footer__group-panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 200px;
  background: var(--r-bg);
  border-radius: var(--r-radius-card);
  box-shadow: var(--neu-card);
  padding: 10px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  z-index: 40;
}

.r-footer__group-panel[hidden] {
  display: none;
}

.r-footer__group-panel a {
  display: block;
  padding: 8px 16px;
  font-family: var(--r-font-heading);
  font-weight: 500;
  font-size: 14px;
  color: var(--r-text-dark);
  text-decoration: none;
  border-radius: var(--r-radius-pill);
  transition: var(--r-transition-color), background 150ms ease-out;
  white-space: nowrap;
}

.r-footer__group-panel a:hover {
  color: var(--r-teal);
  background: rgba(40, 168, 191, 0.08);
}

.r-footer__group-panel a[aria-current="true"] {
  color: var(--r-teal);
  font-weight: 600;
}

.r-footer__group-panel--lang {
  min-width: 120px;
}

/* « Mon compte » / « Mon application » : liens directs sur la barre en
   desktop. Le groupe déroulant « Mon espace » ne sert qu'en responsive
   (≤ 768 px) pour ne pas faire déborder la barre. */
.r-footer__link {
  font-family: var(--r-font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--r-text-dark);
  text-decoration: none;
  padding: 6px 4px;
  transition: var(--r-transition-color);
}

.r-footer__link:hover { color: var(--r-teal); }

.r-footer__platform {
  font-family: var(--r-font-heading);
  font-weight: 600;
  font-size: 14px;
  color: var(--r-teal);
  text-decoration: none;
  padding: 6px 4px;
  transition: var(--r-transition-color);
  white-space: nowrap;
}

.r-footer__platform:hover { color: var(--r-teal-dark); }

.r-footer__group--collapse { display: none; }

/* ── Utilities ──────────────────────────────────────────────── */
.r-skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 999;
  padding: 8px 16px;
  background: var(--r-text-dark);
  color: #fff;
  border-radius: 6px;
}

.r-skip-link:focus { left: 8px; }

.is-hidden { display: none !important; }

mark {
  background: var(--r-teal-light);
  color: var(--r-text-dark);
  padding: 0 3px;
  border-radius: 3px;
  font-weight: 600;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --r-page-margin: 40px;
  }

  .r-h1 { font-size: 44px; }
  .r-h3 { font-size: 24px; }

  /* Stack vertical : hero en haut, content en bas */
  .r-page {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .r-page__hero {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  /* En stack vertical, le hero n'est plus sticky : les CTAs reviennent
     dans le flux normal sous le lead (pas de sticky ni de margin auto). */
  .r-hero-ctas {
    position: static;
    margin-top: 8px;
    padding-top: 0;
    background: transparent;
  }
}

@media (max-width: 768px) {
  :root {
    --r-page-margin: 20px;
    /* Footer peut wrap sur 2 lignes en mobile : on augmente la réserve.
       La bannière de lancement passe aussi sur 2 lignes (tag + message). */
    --r-footer-bar-height: 64px;
    --r-launch-banner-h: 62px;
  }

  .r-h1 { font-size: 34px; }
  .r-h3 { font-size: 22px; }
  .r-body { font-size: 17px; }

  .r-page { padding: 32px var(--r-page-margin) 56px; }

  .r-footer { font-size: 11px; }
  .r-footer__bar { padding: 8px 16px; gap: 6px; position: relative; }
  /* En mobile : on masque le copyright et les deux liens directs, et on
     replie « Mon compte » / « Mon application » dans le déroulant « Mon espace »
     pour que la barre tienne sans déborder. */
  .r-footer__copyright,
  .r-footer__link,
  .r-footer__platform { display: none; }
  .r-footer__group--collapse { display: block; }
  /* Les dropdowns du footer s'ouvrent en panneau pleine largeur au-dessus de
     la barre (comme le menu burger du header), au lieu d'un petit popover. */
  .r-footer__group { position: static; }
  .r-footer__group-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    transform: none;
    min-width: 0;
    width: auto;
    border-radius: 18px 18px 0 0;
    box-shadow: 0 -10px 28px rgba(45, 55, 72, 0.12);
    padding: 10px var(--r-page-margin) 14px;
    gap: 2px;
  }
  .r-footer__group-panel--lang { min-width: 0; }
  .r-footer__group-panel a {
    padding: 12px 14px;
    white-space: normal;
    font-size: 15px;
    border-radius: var(--r-radius-input);
    box-shadow: inset 0 0 0 0 var(--r-teal);
    transition: var(--r-transition-color), background 150ms ease-out, box-shadow 150ms ease-out;
  }
  .r-footer__group-panel a:hover,
  .r-footer__group-panel a:focus-visible {
    background: rgba(40, 168, 191, 0.08);
    box-shadow: inset 3px 0 0 0 var(--r-teal);
  }
  .r-footer__group-panel a[aria-current="true"] {
    box-shadow: inset 3px 0 0 0 var(--r-teal);
  }
}

/* ── Fade-in au chargement de page ──────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  @keyframes r-page-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
  }
  body { animation: r-page-fade-in 220ms ease-out; }
}

/* ── Apparition progressive au scroll (cartes-résultat) ─────────
   .r-reveal posée par initScrollReveal sur les cartes à animer ;
   IntersectionObserver bascule .is-revealed quand la carte entre
   dans le viewport. */
@media (prefers-reduced-motion: no-preference) {
  .r-reveal {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 400ms ease-out, transform 400ms ease-out;
    will-change: opacity, transform;
  }
  .r-reveal.is-revealed {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Reduced motion ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
