/* Base : reset, typographie de base, accessibilité — voir tokens.css pour les couleurs, tailles et espacements. */

/* Reset & Base Rules */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

img, svg, picture, video, canvas {
    max-width: 100%;
    height: auto;
    display: inline-block;
    vertical-align: middle;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    position: relative;
}

/* Universal text wrapping to prevent overflows */
h1, h2, h3, h4, h5, h6, p, span, a, li {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

a {
    color: inherit;
}

/* ─── Accessibilité ──────────────────────────────────────────────────── */

/* Anneau de focus bien visible pour la navigation au clavier
   (il n'apparaît pas au clic de souris grâce à :focus-visible). */
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}

/* Texte lisible uniquement par les lecteurs d'écran. */
.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;
}

/* Lien « Aller au contenu » : visible seulement quand on le focalise au clavier. */
.skip-link {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 1000;
    padding: var(--space-2) var(--space-4);
    background: var(--bg-surface);
    color: var(--text-primary);
    font-weight: var(--weight-bold);
    border-radius: var(--radius-sm);
    transform: translateY(-200%);
}

.skip-link:focus-visible {
    transform: none;
}

/* Si l'utilisateur a demandé moins d'animations à son système,
   on coupe les animations, transitions et halos. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .ambient-glow {
        display: none;
    }
}

/* L attribut HTML « hidden » doit toujours masquer, même si une classe impose un display. */
[hidden] {
    display: none !important;
}
