/* ============================================================
 * mobile-friendly.css — Pass mobile global pour pages HTML statiques.
 * Inject\u00e9 via scripts/inject-gamification.mjs (v4) + GamificationHUD.tsx.
 *
 * Objectifs : moins encombr\u00e9, navigation plus respirable, cibles
 * tactiles >= 44px, scroll horizontal fluide, opacit\u00e9 contr\u00f4l\u00e9e,
 * meilleure lisibilit\u00e9 mobile.
 * ============================================================ */

/* Viewport et reset doux */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { -webkit-tap-highlight-color: transparent; }

/* Cibles tactiles minimum 44x44 (Apple HIG) */
@media (max-width: 768px) {
  a, button, .btn, [role="button"], input[type="submit"], input[type="button"] {
    min-height: 44px;
    touch-action: manipulation;
  }
  input, textarea, select {
    min-height: 44px;
    font-size: 16px; /* \u00e9vite le zoom auto iOS */
  }

  /* Typographie respirable */
  body { line-height: 1.55; }
  h1 { font-size: clamp(1.5rem, 5vw, 2rem); line-height: 1.2; }
  h2 { font-size: clamp(1.25rem, 4vw, 1.5rem); line-height: 1.25; }
  h3 { font-size: clamp(1.1rem, 3.5vw, 1.25rem); line-height: 1.3; }
  p, li { font-size: clamp(0.95rem, 2.6vw, 1rem); }

  /* Conteneurs : padding lat\u00e9ral coh\u00e9rent */
  main, .container, .wrap, .content, section, article {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
    box-sizing: border-box;
  }

  /* Images & m\u00e9dias responsive par d\u00e9faut */
  img, video, iframe, canvas, svg { max-width: 100%; height: auto; }

  /* Tableaux scrollables sans casser le layout */
  table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Padding bas pour ne pas \u00eatre cach\u00e9 par bottom nav React (h-16 = 64px) */
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }

  /* Navigations natives HTML : compactage */
  nav ul, nav ol { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0; list-style: none; }
  nav a { padding: 10px 12px; border-radius: 10px; }

  /* R\u00e9duction encombrement visuel : opacit\u00e9 douce sur d\u00e9corations */
  .decoration, .ornament, .deco, .bg-decoration { opacity: 0.6; }
}

/* Carrousels & sliders : scroll horizontal natif tactile */
@media (max-width: 768px) {
  .scroll-x, .horizontal-scroll, .h-scroll {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }
  .scroll-x > *, .horizontal-scroll > *, .h-scroll > * {
    scroll-snap-align: start;
    flex-shrink: 0;
  }
}

/* Skeleton g\u00e9n\u00e9rique r\u00e9utilisable */
.dp-skeleton {
  display: inline-block;
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 0%,
    rgba(255,255,255,0.10) 50%,
    rgba(255,255,255,0.04) 100%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: dp-skeleton-shimmer 1.4s ease-in-out infinite;
}
.dp-skeleton-line { height: 12px; width: 100%; margin: 6px 0; }
.dp-skeleton-square { width: 56px; height: 56px; border-radius: 10px; }
.dp-skeleton-card { height: 120px; border-radius: 12px; width: 100%; }
@keyframes dp-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Loading squares (4 carr\u00e9s pulse) — wrapper class .dp-loading-squares */
.dp-loading-squares {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.dp-loading-squares > i {
  display: block;
  width: 8px; height: 8px;
  background: var(--game-blue, #5aa9ff);
  border-radius: 2px;
  opacity: 0.6;
  animation: dp-square-pulse 0.9s ease-in-out infinite;
}
.dp-loading-squares > i:nth-child(2) { animation-delay: .12s; }
.dp-loading-squares > i:nth-child(3) { animation-delay: .24s; }
.dp-loading-squares > i:nth-child(4) { animation-delay: .36s; }
@keyframes dp-square-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.4); opacity: 1; }
}

/* Notifications inline standardis\u00e9es */
.dp-alert {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.5;
}
.dp-alert--error   { border-color: rgba(255,107,107,0.45); background: rgba(255,107,107,0.10); color: #ffb3b3; }
.dp-alert--warning { border-color: rgba(255,181,71,0.45);  background: rgba(255,181,71,0.10);  color: #ffd58a; }
.dp-alert--success { border-color: rgba(93,211,158,0.45);  background: rgba(93,211,158,0.10);  color: #b8eed3; }
.dp-alert--info    { border-color: rgba(90,169,255,0.45);  background: rgba(90,169,255,0.10);  color: #b8d8ff; }

/* R\u00e9duction d\u00e9clutter : masquer \u00e9l\u00e9ments lourds purement d\u00e9coratifs sur tr\u00e8s petits \u00e9crans */
@media (max-width: 480px) {
  .desktop-only, .hide-mobile { display: none !important; }
  .ornamental, .background-pattern { display: none !important; }
}

/* Respect motion preferences */
@media (prefers-reduced-motion: reduce) {
  .dp-skeleton, .dp-loading-squares > i { animation: none; }
  .dp-skeleton { background: rgba(255,255,255,0.06); }
}

/* Focus visible accessible */
:focus-visible {
  outline: 2px solid var(--game-blue, #5aa9ff);
  outline-offset: 2px;
  border-radius: 4px;
}
