/* ===========================================================================
   z311 — Base : reset, typo, éléments natifs
   =========================================================================== */

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

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-mono);
    font-size: var(--font-size-base);
    line-height: var(--line-height);
    -webkit-text-size-adjust: 100%;
    text-rendering: optimizeLegibility;
    /* `overflow-x: clip` au lieu de `hidden` : empêche le pan horizontal
       SANS créer de contexte de scroll. Crucial sur iOS Safari, où
       `overflow-x: hidden` sur <body> casse `position: fixed` (la tabbar
       ne s'affichait correctement que quand la page devenait scrollable). */
    overflow-x: clip;
    overscroll-behavior: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
    /* Couleur de fond appliquée AUSSI au html : sur iOS PWA standalone, la
       zone du home indicator (34pt) reprend cette couleur, ce qui évite
       toute "bande noire" perçue comme inutilisée. */
    height: 100%;
}

body {
    /* 100svh = small viewport height (sans toolbar mobile, plus stable que vh).
       100dvh = dynamic viewport (suit la chrome). On donne plusieurs valeurs
       pour la compatibilité : la dernière prise en charge gagne. */
    min-height: 100vh;
    min-height: 100svh;
    min-height: 100dvh;
    /* Sur mobile : on autorise UNIQUEMENT le pan vertical (scroll classique).
       Bloque le pinch-zoom et le pan horizontal. */
    touch-action: pan-y;
}

/* Évite tout débordement horizontal d'enfants imprévus. */
img, svg, video, canvas, iframe { max-width: 100%; }

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 600;
    color: var(--fg-strong);
    letter-spacing: -0.01em;
}
h1 { font-size: 20px; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }

p { margin: 0; }

a {
    color: var(--fg-strong);
    text-decoration: none;
    border-bottom: 1px solid var(--border-strong);
    transition: border-color var(--transition);
}
a:hover { border-bottom-color: var(--fg-strong); }
a.plain { border-bottom: 0; }

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

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

::selection {
    background: var(--fg-strong);
    color: var(--bg);
}

/* Scrollbar minimaliste */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover { background: var(--fg-dim); }

/* Helpers généralistes */
.hidden       { display: none !important; }
.text-muted   { color: var(--fg-muted); }
.text-dim     { color: var(--fg-dim); }
.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }

.row     { display: flex; gap: var(--space-2); align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap    { flex-wrap: wrap; }
.stack    { display: flex; flex-direction: column; gap: var(--space-3); }

.mono-small {
    font-size: 11px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--fg-muted);
}
