/* ============================================================
 * MOBILE UX FIXES — sprint 1 (audit 2026-05-13)
 * 80% du trafic est mobile. Ce fichier est chargé en DERNIER
 * sur toutes les pages pour override le CSS inline existant.
 * ============================================================ */

/* Tue les débordements horizontaux (hero blobs, marquees, etc.) */
html { overflow-x: clip; scroll-padding-top: 80px; }
body { overflow-x: clip; min-height: 100dvh; overflow-wrap: break-word; }

/* Focus clavier visible (WCAG 2.2 AA) */
*:focus { outline: none; }
*:focus-visible {
  outline: 3px solid var(--fuchsia, #EF426F) !important;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip link — accessibilité clavier */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink, #0A0A0A);
  color: var(--bg, #FBF7F0);
  padding: 12px 18px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  text-decoration: none;
  z-index: 9999;
  border-radius: 0 0 4px 0;
}
.skip-link:focus { left: 0; top: 0; }

/* Sélection + tap highlight Fiesta */
::selection { background: var(--fuchsia, #EF426F); color: #fff; }
html { -webkit-tap-highlight-color: rgba(239,66,111,.25); }

/* Inputs — bloque le zoom iOS (font-size < 16px déclenche un zoom auto) */
input, textarea, select { font-size: 16px; }
input[type="email"],
input[type="text"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="password"],
.newsletter-form input,
.freebie-download-form input,
.cta-form input,
.newsletter-unified-submit input[type="email"],
.prefs-email {
  font-size: 16px !important;
  min-height: 48px;
}

/* Tables des articles : scrollables horizontalement sur mobile */
.article-body table,
article table,
main table {
  display: block !important;
  overflow-x: auto !important;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
@media (max-width: 640px) {
  .article-body table,
  article table,
  main table { font-size: 13px; }
  .article-body th, .article-body td,
  article th, article td,
  main th, main td { padding: 10px 12px; }
  .article-body pre, article pre, main pre { font-size: 12.5px; }
}

/* Touch targets — passer les éléments interactifs à >=44px */
.theme-toggle { width: 44px; height: 44px; }
.mini-nav .theme-toggle-v2 { width: 44px; height: 44px; }
.article-pill,
.learn-filter,
a.story-tag,
button.story-tag {
  min-height: 44px;
  padding: 12px 18px;
  display: inline-flex;
  align-items: center;
}
.article-body a,
article p a {
  padding: 1px 2px;
  border-radius: 3px;
}

/* Lecture article mobile : largeur de ligne + corps plus généreux */
@media (max-width: 640px) {
  .container { padding: 0 18px; }
  .article-body p, article p {
    font-size: 17.5px;
    line-height: 1.7;
  }
}

/* Safe area iPhone */
@supports (padding: env(safe-area-inset-top)) {
  .mini-nav {
    padding-top: calc(18px + env(safe-area-inset-top));
    padding-left: calc(48px + env(safe-area-inset-left));
    padding-right: calc(48px + env(safe-area-inset-right));
  }
  @media (max-width: 960px) {
    .mini-nav {
      padding-top: calc(14px + env(safe-area-inset-top));
      padding-left: calc(20px + env(safe-area-inset-left));
      padding-right: calc(20px + env(safe-area-inset-right));
    }
  }
  .site-footer, footer.footer {
    padding-bottom: calc(40px + env(safe-area-inset-bottom));
  }
}

/* SR-only — labels accessibles invisibles */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
