/* ═══════════════════════════════════════════════════════════════════════════
   AFRICA POST — PWA mobile-first
   Système de design, refonte du 2026-08-26.

   Un seul jeu de composants, une seule échelle typographique, un rythme
   d'espacement constant. Les tokens sont identiques à ColisVoyage : les deux
   marques partagent le système, seule la couleur d'accent change.

   Rien ici n'est spécifique à un écran. Un écran qui a besoin d'une valeur
   qui n'est pas dans ce fichier a probablement besoin d'un composant, pas
   d'une exception.
   ═══════════════════════════════════════════════════════════════════════════ */

/* L'attribut hidden l'emporte toujours (05/12). Une classe qui pose un
   display (.ap-groupe : flex) l'ecrasait : le champ « Adresse de livraison *»
   restait affiche, obligatoire en apparence, alors que l'option n'etait pas
   cochee. Une regle de base plutot qu'une exception par composant. */
[hidden] { display: none !important; }

:root {
  /* ── Accent Africa Post ── */
  --acc: #059669;
  --acc-700: #047857;
  --acc-800: #065F46;
  --acc-tint: #F0FDF4;
  --acc-tint-bord: #CDEBD9;
  --acc-tint-txt: #3E7A63;

  /* ── Passerelle ColisVoyage — réservée aux renvois vers l'autre marque ── */
  --cv: #3B82F6;
  --cv-700: #1D4ED8;
  --cv-tint: #EFF6FF;

  /* ── Fonds et surfaces ── */
  --bg: #F1EEE8;
  --surf: #FFFFFF;
  --surf-2: #F7F5F0;
  --surf-3: #F3F1EC;
  --surf-4: #FBFAF7;

  /* ── Texte ── */
  --txt: #16181D;
  --txt-2: #5C5F68;
  --txt-3: #6B6F78;
  --txt-4: #7A7D86;
  --txt-off: #C1BFB9;

  /* ── Bordures ── */
  --bord: #E4E0D8;
  --bord-2: #E9E5DD;
  --bord-3: #EFECE6;
  --bord-4: #F2EFE9;

  /* ── États ── */
  --alerte-bg: #FFF8EE;
  --alerte-bord: #F3E2C7;
  --alerte-txt: #7A5A1F;
  --err: #B91C1C;
  --err-bg: #FEF2F2;
  --etoile: #B45309;

  /* ── Cartes sombres ── */
  --sombre: #16181D;
  --sombre-txt-2: #9CA3AF;
  --sombre-badge-bg: #0B3D2E;
  --sombre-badge-txt: #6EE7B7;

  /* ── Rythme ── */
  --r-card: 22px;
  --r-card-lg: 26px;
  --r-pill: 999px;
  --r-sm: 14px;
  --r-md: 18px;

  --ombre: 0 26px 60px rgba(20, 22, 28, .10);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font-family: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  /* La barre d'onglets est fixe : le contenu ne doit pas passer dessous. */
  padding-bottom: calc(74px + env(safe-area-inset-bottom, 0px));
}

/* La transition d'ouverture. 180 ms — assez pour être perçue, trop court pour
   être attendue. */
@keyframes ap-entree { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.ap-ecran { animation: ap-entree .18s ease-out; }

@media (prefers-reduced-motion: reduce) {
  .ap-ecran { animation: none; }
  * { transition-duration: .01ms !important; }
}

/* ── Le parcours reste lisible sur grand écran ─────────────────────────────
   390 px de base ; au-delà, on centre au lieu d'étirer. Un formulaire de
   1200 px de large ne se lit pas mieux qu'un de 480. */
.ap-page { max-width: 480px; margin: 0 auto; }
.ap-page--large { max-width: 720px; }

/* ═══ EN-TÊTES ════════════════════════════════════════════════════════════ */
.ap-statut {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px 4px; font: 700 12px Figtree; color: var(--txt);
}
.ap-statut span:last-child { font: 600 11px Figtree; color: var(--txt-3); }

.ap-marque { display: flex; align-items: center; justify-content: space-between; padding: 8px 20px 14px; }
.ap-marque-nom { display: flex; align-items: center; gap: 9px; }
.ap-logo {
  width: 28px; height: 28px; border-radius: 9px; background: var(--acc);
  display: grid; place-items: center; color: #fff; font: 900 13px Figtree;
}
.ap-marque h1 { margin: 0; font: 800 17px Figtree; letter-spacing: -.4px; color: var(--txt); }

.ap-tete { display: flex; align-items: center; gap: 12px; padding: 8px 20px 14px; }
.ap-tete h1 { margin: 0; font: 800 19px Figtree; letter-spacing: -.4px; color: var(--txt); }
.ap-retour {
  background: none; border: 0; padding: 0; font-size: 16px; line-height: 1;
  color: var(--txt); cursor: pointer;
  /* 44 px de cible tactile sans 44 px de dessin. */
  width: 44px; height: 44px; margin-left: -12px;
  display: grid; place-items: center;
}
.ap-retour:active { opacity: .62; }

.ap-corps { padding: 0 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.ap-intro { margin: 0; font: 400 14px/1.55 Figtree; color: var(--txt-4); }

/* ═══ TYPOGRAPHIE ═════════════════════════════════════════════════════════ */
.ap-hero { margin: 0; font: 800 32px/1.08 Figtree; letter-spacing: -1.1px; color: var(--txt); }
.ap-chapo { margin: 0; font: 400 15px/1.55 Figtree; color: var(--txt-2); }
.ap-titre { font: 800 16px Figtree; letter-spacing: -.3px; color: var(--txt); }
.ap-label { font: 700 12px Figtree; color: var(--txt-2); }
.ap-note { font: 400 12px/1.55 Figtree; color: var(--txt-4); }

/* ═══ BOUTONS ═════════════════════════════════════════════════════════════ */
.ap-btn {
  display: block; width: 100%; border: 0; border-radius: var(--r-pill);
  padding: 15px; text-align: center; font: 800 15px Figtree;
  cursor: pointer; text-decoration: none; font-family: inherit;
  min-height: 44px;
}
.ap-btn--primaire { background: var(--acc); color: #fff; }
.ap-btn--secondaire { background: var(--surf); border: 1.5px solid #DFDBD2; color: var(--txt); font-weight: 700; padding: 14px; }
.ap-btn--sombre { background: var(--sombre); color: #fff; }
.ap-btn--petit { padding: 10px 18px; width: auto; display: inline-block; font-size: 13px; }
.ap-btn:active { opacity: .62; }
.ap-btn:focus-visible, .ap-lien:focus-visible, .ap-champ:focus-visible,
.ap-onglet:focus-visible, .ap-puce:focus-visible {
  outline: 2px solid var(--acc); outline-offset: 2px;
}

.ap-lien { color: var(--acc-700); font-weight: 700; text-decoration: none; background: none; border: 0; font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
.ap-lien--cv { color: var(--cv-700); }

/* ═══ CARTES ══════════════════════════════════════════════════════════════ */
.ap-carte { border: 1px solid var(--bord-2); border-radius: var(--r-card); padding: 16px; background: var(--surf); }
.ap-carte--accent { border: 1.5px solid var(--acc); background: #FBFDFC; }
.ap-carte--tint { background: var(--acc-tint); border: 1px solid var(--acc-tint-bord); border-radius: 24px; padding: 18px; }
.ap-carte--douce { background: var(--surf-2); border: 0; border-radius: 20px; padding: 15px; }
.ap-carte--sombre { background: var(--sombre); border: 0; border-radius: var(--r-card-lg); padding: 18px; color: #fff; }
.ap-carte--sombre .ap-note, .ap-carte--sombre p { color: var(--sombre-txt-2); }
.ap-carte--alerte { background: var(--alerte-bg); border: 1px solid var(--alerte-bord); border-radius: 20px; padding: 15px; color: var(--alerte-txt); font: 400 12px/1.55 Figtree; }
.ap-carte--tiret { border: 1px dashed #DFDBD2; border-radius: var(--r-card); padding: 16px; background: var(--surf-4); }

.ap-pile { display: flex; flex-direction: column; gap: 10px; }
.ap-rang { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ═══ PUCES / BADGES ══════════════════════════════════════════════════════ */
.ap-badge {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start;
  padding: 6px 12px; border-radius: var(--r-pill);
  background: var(--acc-tint); font: 700 11px Figtree; color: var(--acc-700);
}
.ap-badge::before { content: ""; width: 6px; height: 6px; border-radius: var(--r-pill); background: var(--acc); }
.ap-badge--nu::before { display: none; }
.ap-badge--gris { background: var(--surf-3); color: var(--txt-2); }
.ap-badge--sombre { background: var(--sombre-badge-bg); color: var(--sombre-badge-txt); }
.ap-badge--alerte { background: var(--err-bg); color: var(--err); }

.ap-puce {
  padding: 9px 14px; border-radius: var(--r-pill); border: 1.5px solid var(--bord);
  background: none; font: 600 13px Figtree; color: var(--txt-2);
  cursor: pointer; font-family: inherit; min-height: 40px;
}
.ap-puce[aria-pressed="true"], .ap-puce--on {
  background: var(--acc-tint); border-color: var(--acc); color: var(--acc-700); font-weight: 700;
}
.ap-puces { display: flex; flex-wrap: wrap; gap: 8px; }

/* ═══ CHAMPS ══════════════════════════════════════════════════════════════ */
.ap-champ {
  width: 100%; border: 1px solid var(--bord); border-radius: var(--r-pill);
  padding: 14px 18px; font: 600 14px Figtree; font-family: inherit;
  color: var(--txt); background: var(--surf); outline: none; min-height: 48px;
}
.ap-champ:focus { border-color: var(--acc); }
.ap-champ::placeholder { color: #9CA0A8; }
select.ap-champ { appearance: none; background-image: none; }
textarea.ap-champ { border-radius: var(--r-card); resize: vertical; line-height: 1.5; }

.ap-groupe { display: flex; flex-direction: column; gap: 8px; }
.ap-oblig { color: var(--err); }

/* ═══ LISTES ══════════════════════════════════════════════════════════════ */
.ap-ligne {
  display: flex; align-items: center; gap: 13px; padding: 14px;
  border: 1px solid var(--bord-2); border-radius: var(--r-card);
  background: var(--surf); text-decoration: none; color: inherit; width: 100%;
  font-family: inherit; text-align: left; cursor: pointer;
}
.ap-ligne:active { opacity: .62; }
.ap-ligne-ico { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 12px; background: var(--acc-tint); display: grid; place-items: center; font-size: 16px; }
.ap-ligne-corps { flex: 1; min-width: 0; }
.ap-ligne-titre { font: 800 14px Figtree; color: var(--txt); }
.ap-ligne-sous { font: 500 11px Figtree; color: var(--txt-3); }
.ap-ligne-prix { font: 800 13px Figtree; color: var(--acc-700); white-space: nowrap; }

.ap-menu { display: flex; flex-direction: column; }
.ap-menu-item {
  display: flex; align-items: center; gap: 13px; padding: 14px 2px;
  border: 0; border-bottom: 1px solid var(--bord-4); background: none;
  font: 600 14px Figtree; font-family: inherit; color: var(--txt);
  text-align: left; width: 100%; cursor: pointer; text-decoration: none;
  min-height: 48px;
}
.ap-menu-item:last-child { border-bottom: 0; }
.ap-menu-item span:nth-child(2) { flex: 1; }

/* ═══ STATS ═══════════════════════════════════════════════════════════════ */
.ap-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ap-stats--3 { grid-template-columns: 1fr 1fr 1fr; }
.ap-stat { background: var(--surf-2); border-radius: 20px; padding: 15px; }
.ap-stat-val { font: 900 20px Figtree; color: var(--txt); letter-spacing: -.5px; }
.ap-stat-lbl { font: 600 11px Figtree; color: var(--txt-4); }

/* ═══ ÉTAPES NUMÉROTÉES ═══════════════════════════════════════════════════ */
.ap-etape { display: flex; gap: 12px; align-items: flex-start; }
.ap-etape-num {
  width: 24px; height: 24px; flex: 0 0 24px; border-radius: var(--r-pill);
  background: var(--acc-tint); display: grid; place-items: center;
  font: 800 11px Figtree; color: var(--acc-700);
}
.ap-etape-txt { font: 700 13px Figtree; color: var(--txt); }
.ap-etape-txt em { font-style: normal; font-weight: 500; color: var(--txt-3); }

/* ═══ BARRE D'ONGLETS ═════════════════════════════════════════════════════
   Cinq destinations fixes. Elle remplace le menu burger et les 40 liens de
   pied de page — qui restent accessibles depuis le compte. */
.ap-onglets {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 10px 8px calc(18px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--bord-3); background: var(--surf);
}
.ap-onglet {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font: 600 10px Figtree; color: var(--txt-3); text-decoration: none;
  background: none; border: 0; cursor: pointer; padding: 4px 0; min-height: 44px;
}
.ap-onglet span:first-child { font-size: 17px; line-height: 1.1; }
.ap-onglet[aria-current="page"] { color: var(--acc); font-weight: 700; }
.ap-onglet:active { opacity: .62; }

/* ═══ PIED COLLANT ════════════════════════════════════════════════════════ */
.ap-pied {
  position: sticky; bottom: calc(74px + env(safe-area-inset-bottom, 0px));
  padding: 16px 20px 22px; border-top: 1px solid var(--bord-3);
  background: var(--surf-4);
  display: flex; flex-direction: column; gap: 10px;
}

/* ═══ ACCESSIBILITÉ ═══════════════════════════════════════════════════════ */
.ap-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ap-saut {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--acc); color: #fff; padding: 10px 16px; border-radius: 0 0 12px 0;
  font: 700 14px Figtree;
}
.ap-saut:focus { left: 0; }

/* ── Le focus clavier, aussi hors des composants ──────────────────────────
   Les composants ci-dessus (.ap-btn, .ap-lien, .ap-champ, .ap-onglet,
   .ap-puce) portent deja leur propre focus. Tout ce qui n'en est pas un —
   un lien nu, une carte cliquable, un element rendu focalisable — n'avait
   rien. Cette regle est le filet : meme vert d'accent, meme geste, et elle
   ne se declenche qu'au clavier. Elle reprend celle du site public, pour que
   la PWA et le site se pilotent de la meme facon. */
:focus-visible {
  outline: 2px solid var(--acc) !important;
  outline-offset: 2px !important;
}

/* ── Mouvement reduit ─────────────────────────────────────────────────────
   Meme regle que le site public : on ramene les animations a l'instantane
   plutot que de les supprimer, pour que ce qui apparait en fondu finisse
   bien visible. Les indicateurs d'attente gardent leur rotation. */
@media (prefers-reduced-motion: reduce) {
  *:not(.spinner):not(.ap-spin),
  *:not(.spinner):not(.ap-spin)::before,
  *:not(.spinner):not(.ap-spin)::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  html { scroll-behavior: auto !important; }
}
