/* ════════════════════════════════════════════════════════════════════
   mobile-first.css — fondations partagées (chargé avant design-system)
   Objectif : aucune page individuelle ne redéfinit ces patterns.
   ════════════════════════════════════════════════════════════════════ */

/* ─── Hygiène de base ─── */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-size: 16px;       /* iOS zoom auto si <16 sur <input> — on baseline 16 partout */
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; }

/* ─── Cibles tactiles confortables ─── */
button,
.btn,
.nav-cta-signin,
.nav-cta-signup,
.lang-pill a,
.menu a,
.nav-mobile a,
.feature-card,
.lc,
.level-card,
.cta-primary,
.cta-secondary {
  min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Ancres : on compense la nav sticky pour que #section soit visible ─── */
:target,
[id] { scroll-margin-top: 84px; }

/* ─── Safe-area iPhone (notch + barre du bas) ─── */
@supports (padding: max(0px)) {
  body {
    padding-left:  max(0px, env(safe-area-inset-left));
    padding-right: max(0px, env(safe-area-inset-right));
  }
}

/* ════════════════════════════════════════════════════════════════════
   Bottom-nav mobile — affichée UNIQUEMENT pour les connectés (markup
   injecté côté PHP par layout-top.php), et UNIQUEMENT sur mobile.
   ════════════════════════════════════════════════════════════════════ */

.mb-nav {
  display: none;          /* caché par défaut ; on l'active en mobile ci-dessous */
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid rgba(0, 0, 0, .08);
  padding: 8px 4px calc(8px + env(safe-area-inset-bottom));
  align-items: center;
  justify-content: space-around;
  gap: 4px;
}
.mb-nav a {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
  text-decoration: none;
  color: var(--ink-soft, #6b7280);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .01em;
  border-radius: 12px;
  transition: color .15s, background .15s, transform .12s;
}
.mb-nav a .ico {
  width: 24px; height: 24px;
  display: block;
  stroke-width: 1.8;
}
.mb-nav a.is-current {
  color: var(--bleu-france, #002654);
  background: rgba(0, 38, 84, .07);
}
.mb-nav a:active { transform: scale(.94); }

/* On affiche en mobile, et on ajoute un padding-bottom au body pour que
   le contenu de fin de page ne soit pas masqué par la bottom-nav. */
@media (max-width: 720px) {
  body.has-mb-nav { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  body.has-mb-nav .mb-nav { display: flex; }
  /* Le menu hamburger reste utilisable, mais bottom-nav couvre 90% des cas. */
}

/* ════════════════════════════════════════════════════════════════════
   Patterns utilitaires partagés
   ════════════════════════════════════════════════════════════════════ */

/* Container standard (largeur max + padding latéral) */
.container-std {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: clamp(16px, 5vw, 32px);
  padding-right: clamp(16px, 5vw, 32px);
}

/* Bouton primaire / secondaire — pattern unifié */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn-primary {
  background: var(--bleu-france, #002654);
  color: white;
  box-shadow: 0 4px 14px rgba(0, 38, 84, .22);
}
.btn-primary:hover { transform: translateY(-1px); background: var(--rouge-france, #ef4135); }
.btn-secondary {
  background: white;
  color: var(--bleu-france, #002654);
  border: 1.5px solid rgba(0, 38, 84, .2);
}
.btn-secondary:hover { background: #f7f7f3; }

/* ════════════════════════════════════════════════════════════════════
   Avatar utilisateur (cercle initiale)
   ════════════════════════════════════════════════════════════════════ */
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 4px 4px;
  background: rgba(0, 0, 0, .04);
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink, #1a1a1a);
  font-weight: 600;
  font-size: .9rem;
  transition: background .15s;
}
.user-chip:hover { background: rgba(0, 38, 84, .08); }
.user-chip .avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--bleu-france, #002654), var(--rouge-france, #ef4135));
  color: white;
  font-weight: 800;
  font-family: 'Playfair Display', serif;
  font-size: .95rem;
  flex-shrink: 0;
}
.user-chip .name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* En mobile, on n'affiche que l'avatar du user-chip dans la navbar */
@media (max-width: 720px) {
  .user-chip { padding: 0; background: transparent; }
  .user-chip .name { display: none; }
}

/* ════════════════════════════════════════════════════════════════════
   Navbar v2 — styles complets (extraits des anciennes pages HTML
   et désormais partagés pour toutes les pages PHP via layout-top.php).
   ════════════════════════════════════════════════════════════════════ */

.navbar-v2 {
  position: sticky; top: 0; z-index: 100;
  background: rgba(254, 242, 242, .88);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid rgba(239, 65, 53, .12);
}
.navbar-v2 .inner {
  max-width: 1200px; margin: 0 auto;
  padding: 12px var(--s-6, 24px);
  display: flex; align-items: center; gap: var(--s-5, 20px);
}
.navbar-v2 .brand {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; color: var(--ink, #1a1a1a);
  font-weight: 700; font-size: 1rem; flex-shrink: 0;
}
.navbar-v2 .brand .mascot-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, #fef9e7, #fde68a);
  padding: 2px; box-shadow: 0 3px 10px rgba(212, 175, 55, .25);
  flex-shrink: 0; overflow: hidden;
}
.navbar-v2 .brand .mascot-avatar img {
  width: 100%; height: 100%; border-radius: 50%;
  object-fit: cover; object-position: center 20%;
}
.navbar-v2 .brand .wordmark { display: flex; flex-direction: column; line-height: 1.1; }
.navbar-v2 .brand .wordmark .top {
  font-family: var(--font-serif, 'Playfair Display', serif);
  font-weight: 800; letter-spacing: -.01em;
  font-size: 1.08rem; color: var(--bleu-france, #002654);
}
.navbar-v2 .brand .wordmark .sub {
  font-size: .72rem; color: var(--ink-soft, #6b7280);
  letter-spacing: .08em; text-transform: uppercase;
  font-weight: 500; margin-top: 1px;
}

.navbar-v2 .menu {
  display: flex; gap: 2px; list-style: none;
  padding: 0; margin: 0 auto 0 var(--s-6, 24px);
}
.navbar-v2 .menu li { list-style: none; }
.navbar-v2 .menu a {
  display: inline-block; padding: 7px 13px;
  color: var(--ink-mid, #4b5563); font-size: .92rem; font-weight: 500;
  text-decoration: none; border-radius: 8px;
  transition: all .15s;
}
.navbar-v2 .menu a:hover { background: rgba(0, 38, 84, .06); color: var(--bleu-france, #002654); }
.navbar-v2 .menu a.current { background: rgba(0, 38, 84, .08); color: var(--bleu-france, #002654); font-weight: 600; }

.navbar-v2 .right { display: flex; align-items: center; gap: 8px; }

.lang-pill {
  display: inline-flex; background: rgba(0, 0, 0, .04);
  border-radius: 999px; padding: 2px; font-size: .8rem;
}
.lang-pill a {
  padding: 5px 11px; border-radius: 999px;
  color: var(--ink-soft, #6b7280); text-decoration: none;
  font-weight: 600; transition: all .15s;
}
.lang-pill a.active {
  background: white; color: var(--bleu-france, #002654);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}
.lang-pill a:not(.active):hover { color: var(--ink, #1a1a1a); }

.nav-cta-signin {
  padding: 7px 16px; color: var(--ink-mid, #4b5563);
  font-size: .92rem; font-weight: 500;
  border-radius: 999px; text-decoration: none;
  transition: all .15s;
}
.nav-cta-signin:hover { color: var(--bleu-france, #002654); background: rgba(0, 38, 84, .06); }

.nav-cta-signup {
  padding: 7px 18px; background: var(--bleu-france, #002654);
  color: white; border-radius: 999px;
  font-weight: 600; font-size: .92rem;
  text-decoration: none; transition: all .15s;
  box-shadow: 0 2px 8px rgba(0, 38, 84, .2);
}
.nav-cta-signup:hover {
  background: var(--rouge-france, #ef4135); transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(239, 65, 53, .3);
}

.nav-burger {
  display: none; width: 36px; height: 36px;
  border: none; background: rgba(0, 0, 0, .04);
  border-radius: 10px; cursor: pointer;
  align-items: center; justify-content: center;
  flex-direction: column; gap: 4px;
}
.nav-burger span { display: block; width: 18px; height: 2px; background: var(--ink, #1a1a1a); border-radius: 2px; }

@media (max-width: 920px) {
  .navbar-v2 .menu { display: none; }
  .navbar-v2 .right { gap: 4px; }
  .nav-burger { display: inline-flex; }
  .navbar-v2 .brand .wordmark .sub { display: none; }
  .nav-cta-signin { display: none; }
}

.nav-mobile {
  position: fixed; inset: 0;
  background: rgba(255, 255, 255, .98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 200;
  display: none; flex-direction: column;
  padding: var(--s-6, 24px);
  overflow-y: auto;
}
.nav-mobile.open { display: flex; }
.nav-mobile .close {
  align-self: flex-end; width: 40px; height: 40px;
  background: rgba(0,0,0,.04); border: 0; border-radius: 10px;
  font-size: 1.4rem; cursor: pointer;
}
.nav-mobile a {
  font-family: var(--font-serif, 'Playfair Display', serif);
  font-size: 1.6rem;
  color: var(--ink, #1a1a1a); text-decoration: none;
  padding: 14px 0; border-bottom: 1px solid rgba(0,0,0,.06);
  display: block;
}
.nav-mobile a:last-child { border-bottom: 0; }
