/* ==========================================================================
   Base : reset léger, typographie, accessibilité
   Pas de « width: 100vw » (cause de débordement horizontal dans Stitch),
   pas de masquage global des barres de défilement, zoom autorisé.
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--ds-header-h) + var(--ds-space-4));
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ds-bg);
  color: var(--ds-text);
  font-family: var(--ds-font);
  font-size: var(--ds-fs-md);
  line-height: var(--ds-lh-body);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

body.ds-has-bottomnav {
  padding-bottom: calc(var(--ds-bottomnav-h) + var(--ds-safe-bottom));
}

@media (min-width: 64em) {
  body.ds-has-bottomnav { padding-bottom: 0; }
}

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

img {
  height: auto;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  color: var(--ds-text-strong);
  line-height: var(--ds-lh-tight);
  font-weight: var(--ds-fw-bold);
  letter-spacing: -0.01em;
  text-wrap: balance;
}

p, ul, ol, dl, figure, blockquote {
  margin: 0;
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}

a {
  color: var(--ds-brand-text);
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--ds-rose-700);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
[aria-disabled="true"] {
  cursor: not-allowed;
}

/* Focus visible net et homogène (clavier), jamais supprimé */
:focus-visible {
  outline: 3px solid var(--ds-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

:focus:not(:focus-visible) {
  outline: none;
}

::selection {
  background: var(--ds-rose-100);
  color: var(--ds-text-strong);
}

[hidden] {
  display: none !important; /* seule exception volontaire : l'attribut hidden doit toujours gagner */
}

/* --- Utilitaires d'accessibilité ------------------------------------------ */
.ds-sr-only,
.screen-reader-text { /* .screen-reader-text = classe WordPress native */
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.ds-skip-link {
  position: absolute;
  left: var(--ds-space-4);
  top: -100px;
  z-index: 100;
  padding: var(--ds-space-3) var(--ds-space-4);
  background: var(--ds-gray-900);
  color: var(--ds-white);
  border-radius: var(--ds-radius);
  font-weight: var(--ds-fw-semibold);
  text-decoration: none;
}

.ds-skip-link:focus {
  top: var(--ds-space-2);
  color: var(--ds-white);
}

/* --- Contenu éditorial (the_content, descriptions produit/catégorie) ------ */
.ds-prose {
  max-width: 70ch;
  color: var(--ds-text);
}

.ds-prose > * + * {
  margin-top: var(--ds-space-4);
}

.ds-prose h2 { font-size: var(--ds-fs-xl); margin-top: var(--ds-space-8); }
.ds-prose h3 { font-size: var(--ds-fs-lg); margin-top: var(--ds-space-6); }
.ds-prose ul,
.ds-prose ol { padding-left: 1.25rem; }
.ds-prose li + li { margin-top: var(--ds-space-1); }
.ds-prose img { border-radius: var(--ds-radius-md); }

.ds-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ds-fs-sm);
  display: block;
  overflow-x: auto; /* tableaux larges : défilement local, jamais de la page */
}

.ds-prose th,
.ds-prose td {
  padding: var(--ds-space-2) var(--ds-space-3);
  border-bottom: 1px solid var(--ds-border);
  text-align: left;
  vertical-align: top;
}

.ds-prose th { background: var(--ds-surface-muted); font-weight: var(--ds-fw-semibold); }

/* Chiffres tabulaires pour les montants */
.ds-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Titres/zones rendus focalisables par script (tabindex="-1") : le focus sert
   à l'annonce vocale et au repositionnement, pas à une interaction. */
h1[tabindex="-1"]:focus,
h2[tabindex="-1"]:focus,
h3[tabindex="-1"]:focus,
main[tabindex="-1"]:focus {
  outline: none;
}

/* Les fieldset ont min-inline-size: min-content par défaut : source de débordement */
fieldset { min-width: 0; }
