/* Version mobile : espace « Contacts » (cartes à glisser) et boutons rapides de la fiche contact. Toutes les règles sont préfixées :root[data-mobile] ; aucune couleur en dur (var(--…) seulement).
   Mouvement : le retour élastique n'existe que si les animations ne sont pas réduites (système ou profil) ; sinon pas de glissement (mobile_contacts.js) et les boutons restent sur la carte. */

:root[data-mobile] {
  --ct-m-avatar: 44px;
  --ct-m-action-l: 76px;
}

/* ── Recherche ── */
:root[data-mobile] .ct-m-champ {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin: 0 0 var(--s-3);
  padding: 0 var(--s-3);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--e-2);
  color: var(--muted);
}
:root[data-mobile] .ct-m-champ .mb-i { width: 20px; height: 20px; }
:root[data-mobile] .ct-m-champ .ct-m-recherche {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  outline: 0;
  background: none !important;
  box-shadow: none !important;
  color: var(--fg);
  margin: 0 !important;
}
:root[data-mobile] .ct-m-champ:focus-within { border-color: var(--accent); }

:root[data-mobile] .ct-m-groupe { margin: var(--s-4) var(--s-1) var(--s-2); font: 500 11px var(--font-mono); letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
:root[data-mobile] .ct-m-groupe:first-child { margin-top: var(--s-1); }
:root[data-mobile] .ct-m-vide { padding: var(--s-6) 0; text-align: center; color: var(--muted); }
:root[data-mobile] .ct-m-pied { display: grid; justify-items: center; margin-top: var(--s-3); }
:root[data-mobile] .ct-m-suite { min-height: var(--mb-cible); }

/* ── Carte ── */
:root[data-mobile] .ct-m-rang {
  position: relative;
  margin-bottom: var(--s-2);
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface2);
  box-shadow: var(--e-2);
}
:root[data-mobile] .ct-m-carte {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: calc(var(--mb-cible) + var(--s-5));
  padding: var(--s-3);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  touch-action: pan-y;      /* le défilement vertical reste au navigateur ; le glissement horizontal est lu par mobile_contacts.js */
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
:root[data-mobile] .ct-m-carte:active { background: var(--surface2); }
:root[data-mobile] .ct-m-carte:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
:root[data-mobile] .ct-m-av {
  flex: none;
  width: var(--ct-m-avatar);
  height: var(--ct-m-avatar);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-d);
  color: var(--accent);
  font-size: 15px;
  font-weight: 700;
}
:root[data-mobile] .ct-m-corps { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
:root[data-mobile] .ct-m-nom { font-size: 16px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
:root[data-mobile] .ct-m-fonction,
:root[data-mobile] .ct-m-lieux { font-size: 13px; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere; }
:root[data-mobile] .ct-m-lieux { color: var(--fg); opacity: .8; }
:root[data-mobile] .ct-m-refs { display: flex; flex-wrap: wrap; gap: var(--s-1); margin-top: 2px; }
:root[data-mobile] .ct-m-ref,
:root[data-mobile] .ct-m-plus {
  padding: 1px var(--s-2);
  border-radius: var(--r-sm);
  background: var(--surface2);
  color: var(--muted);
  font: 500 11px var(--font-mono);
}
:root[data-mobile] .ct-m-ref.ct-m-mien { background: var(--accent-d); color: var(--accent); }

/* ── Fonds révélés par le glissement ── */
:root[data-mobile] .ct-m-fond { position: absolute; top: 0; bottom: 0; display: flex; visibility: hidden; }
:root[data-mobile] .ct-m-fond-g { left: 0; right: 0; background: var(--surface2); }
:root[data-mobile] .ct-m-fond-d { right: 0; background: var(--surface2); }
:root[data-mobile] .ct-m-rang.ct-m-droite .ct-m-fond-g,
:root[data-mobile] .ct-m-rang.ct-m-gauche .ct-m-fond-d { visibility: visible; }
:root[data-mobile] .ct-m-act {
  flex: none;
  width: var(--ct-m-action-l);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: var(--fg);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
}
:root[data-mobile] .ct-m-act .mb-i { width: 22px; height: 22px; }
:root[data-mobile] .ct-m-appel { background: var(--success); color: var(--bg); }
:root[data-mobile] .ct-m-fond-g .ct-m-act { flex: 1; width: auto; flex-direction: row; justify-content: flex-start; gap: var(--s-2); padding-left: var(--s-5); font-size: 14px; }
:root[data-mobile] .ct-m-sms { background: var(--accent); color: var(--accent-text); }
:root[data-mobile] .ct-m-mel { background: var(--accent-d); color: var(--accent); }
:root[data-mobile] .ct-m-act.ct-m-grise { background: var(--surface2); color: var(--muted); opacity: .7; }
:root[data-mobile] .ct-m-rang.ct-m-pret .ct-m-appel { box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--bg) 55%, transparent); }

/* ── Boutons directs sur la carte : seulement quand le glissement est désactivé (animations réduites) ── */
:root[data-mobile] .ct-m-boutons { display: none; flex: none; gap: var(--s-1); }
:root[data-mobile] .ct-m-bt {
  width: var(--mb-cible);
  height: var(--mb-cible);
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--accent-d);
  color: var(--accent);
  text-decoration: none;
}
@media (prefers-reduced-motion: reduce) {
  :root[data-mobile] .ct-m-boutons { display: flex; }
}
:root[data-mobile][data-mouvement="reduit"] .ct-m-boutons { display: flex; }

/* ── Retour élastique ── */
@media (prefers-reduced-motion: no-preference) {
  :root[data-mobile]:not([data-mouvement="reduit"]) .ct-m-carte { transition: transform .34s cubic-bezier(.3, 1.35, .5, 1); }
}

/* ── Fiche contact : Appeler / SMS / E-mail / Copier ── */
:root[data-mobile] .ct-rapides { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-2); }
:root[data-mobile] .ct-rapide {
  min-height: calc(var(--mb-cible) + var(--s-3));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: var(--s-2) var(--s-1);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
  background: var(--accent-d);
  border: 0;
}
:root[data-mobile] .ct-rapide .mb-i { width: 22px; height: 22px; }
:root[data-mobile] .ct-rapide span { line-height: 1.2; }
:root[data-mobile] button.ct-rapide { font-family: inherit; line-height: 1.2; vertical-align: top; }
:root[data-mobile] .ct-rapide:disabled { color: var(--muted); background: var(--surface2); opacity: .7; }
