/**
 * Brocante.io - Modern Minimal Reset
 * Zéro framework externe. 
 * Élimine les incohérences cross-browser et évite les Cumulative Layout Shifts (CLS).
 */

/* 1. Box sizing universel propre */
*,
*::before,
*::after {
    box-sizing: border-box;
}

/* 2. Suppression des marges par défaut des conteneurs structurels */
body,
figure,
dl,
dd {
    margin: 0;
}

/* 3. Défilement fluide & Rythme de base global */
html {
    font-size: var(--base-font-size, 16px);
    line-height: var(--line-height-base, 1.625rem);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

/* 4. Typographie de base */
body {
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: var(--font-weight-light);
    line-height: var(--line-height-base);
    color: var(--color-contrast);
    background-color: var(--color-base);
    text-rendering: optimizeSpeed;
}

/* 5. Échelle Typographique & Rythme Vertical (Nombre d'Or & Grille 26px) */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--color-contrast);
    text-wrap: balance;
}

h1 {
    font-size: clamp(2rem, 4vw, var(--font-size-h1));
    line-height: calc(var(--line-height-base) * 2);     /* 52px (ratio ~1.23) */
    font-weight: 700;
    margin-top: calc(var(--line-height-base) * 1.5);    /* 39px */
    margin-bottom: var(--line-height-base);             /* 26px */
}

h2 {
    font-size: clamp(1.4rem, 2.5vw, var(--font-size-h2));
    line-height: calc(var(--line-height-base) * 1.25);   /* 39px (ratio 1.5) */
    margin-top: calc(var(--line-height-base) * 1.5);    /* 39px */
    margin-bottom: calc(var(--line-height-base) * 0.5); /* 13px */
}

h3 {
    font-size: var(--font-size-h3);
    line-height: calc(var(--line-height-base) * 1.25);  /* 32.5px */
    font-weight: 500;
    margin-top: var(--line-height-base);                /* 26px */
    margin-bottom: calc(var(--line-height-base) * 0.5); /* 13px */
}

h4 {
    font-size: var(--font-size-h4);
    line-height: var(--line-height-base);               /* 26px */
    margin-top: var(--line-height-base);                /* 26px */
    margin-bottom: calc(var(--line-height-base) * 0.25);/* 6.5px */
}

h5 {
    font-size: 1rem;
    line-height: var(--line-height-base);
    letter-spacing: 0.5px;
    margin-top: calc(var(--line-height-base) * 0.5);
    margin-bottom: calc(var(--line-height-base) * 0.25);
}

h6 {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-base);
    font-weight: 700;
    letter-spacing: 1.2px;
    margin-top: calc(var(--line-height-base) * 0.5);
    margin-bottom: calc(var(--line-height-base) * 0.25);
}

/* 6. Paragraphes, Listes éditoriales & Citations calés sur le rythme de base
   On cible uniquement les listes de texte (sans classe ou .wp-block-list) pour ne pas
   perturber les listes de composants (galeries photos WC, vignettes, menus, grilles produits). */
p,
ul:where(:not([class]), .wp-block-list),
ol:where(:not([class]), .wp-block-list) {
    margin-top: 0;
    margin-bottom: var(--line-height-base);             /* 26px */
}

ul:where(:not([class]), .wp-block-list),
ol:where(:not([class]), .wp-block-list) {
    padding-inline-start: var(--line-height-base);      /* 26px */
}

ul:where(:not([class]), .wp-block-list) > li,
ol:where(:not([class]), .wp-block-list) > li {
    line-height: var(--line-height-base);
}

ul:where(:not([class]), .wp-block-list) > li + li,
ol:where(:not([class]), .wp-block-list) > li + li {
    margin-top: calc(var(--line-height-base) * 0.25);   /* 6.5px */
}

blockquote,
:where(.wp-block-quote) {
    margin-block: var(--line-height-base);              /* 26px haut et bas */
    padding: calc(var(--line-height-base) * 0.5) var(--line-height-base);
    border-left: 3px solid var(--color-contrast);
    /* background-color: var(--color-surface-alt); */
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--color-text-dark);
    font-size: var(--font-size-md) !important;
}

strong, b {
    font-weight: var(--font-weight-medium);
}

hr {
    border: 0;
    border-top: 1px solid var(--color-border);
    margin-block: calc(var(--line-height-base) * 1.5);
}

/* :where() ici annule le poids du pseudo-sélecteur :first-child / :last-child (reste à 0,0,1) */
:is(h1, h2, h3, h4, h5, h6):where(:first-child) {
    margin-top: 0;
}

:is(p, ul:where(:not([class]), .wp-block-list), ol:where(:not([class]), .wp-block-list), blockquote):where(:last-child) {
    margin-bottom: 0;
}

/* 7. Éléments médias fluides (spécificité 0,0,0 pour ne pas écraser les vignettes WC) */
:where(img, picture, video, canvas, svg) {
    display: block;
    max-width: 100%;
    height: auto;
}

/* 8. Formulaires & boutons héritent de la typographie (spécificité 0,0,0) */
:where(input, button, textarea, select) {
    /* font: inherit; */
    color: inherit;
}

:where(button) {
    cursor: pointer;
    background: none;
    border: none;
}

/* 9. Liens */
:where(a) {
    color: inherit;
    text-decoration: inherit;
}

/* 10. Accessibilité - Réduction des animations si demandée par l'utilisateur */
@media (prefers-reduced-motion: reduce) {
    html:focus-within {
        scroll-behavior: auto;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

