/* ==========================================================================
   BASE — remise à zéro, typographie, accessibilité, texture.
   ========================================================================== */

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

* {
    margin: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background-color: var(--fond);
    color: var(--texte);
    scroll-padding-top: calc(var(--hauteur-entete) + var(--esp-s));
}

/* Défilement natif fluide uniquement sans Lenis et sans préférence de mouvement réduit. */
@media (prefers-reduced-motion: no-preference) {
    html:not(.lenis) {
        scroll-behavior: smooth;
    }
}

body {
    min-height: 100vh;
    min-height: 100svh;
    font-family: var(--f-texte);
    font-size: var(--fs-texte);
    line-height: var(--lh-texte);
    font-weight: 400;
    font-kerning: normal;
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: clip;
}

[data-decor] {
    background-color: var(--fond);
    color: var(--texte);
}

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

img,
video {
    height: auto;
}

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

button {
    cursor: pointer;
    background: none;
    border: 0;
    padding: 0;
}

a {
    color: inherit;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

/* :where() = spécificité nulle : les composants peuvent redéfinir leurs marges internes. */
:where(ul[role="list"], ol[role="list"]) {
    list-style: none;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: inherit;
    font-size: inherit;
    line-height: inherit;
}

p,
li,
figcaption {
    overflow-wrap: break-word;
    text-wrap: pretty;
}

::selection {
    background-color: var(--c-jaune);
    color: var(--c-encre);
}

[data-decor="jaune"] ::selection,
[data-decor="jaune"]::selection {
    background-color: var(--c-encre);
    color: var(--c-jaune);
}

[hidden] {
    display: none !important;
}

/* --- Focus : toujours visible au clavier, couleur du décor ---------------- */
:focus-visible {
    outline: var(--trait) solid var(--accent);
    outline-offset: 4px;
}

main:focus,
section:focus {
    outline: none;
}

/* --- Accessibilité --------------------------------------------------------- */
.insecable {
    white-space: nowrap;
}

.sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.evitement {
    position: fixed;
    top: var(--esp-s);
    left: var(--esp-s);
    z-index: calc(var(--z-rideau) + 1);
    padding: var(--esp-xs) var(--esp-s);
    background: var(--c-jaune);
    color: var(--c-encre);
    font-family: var(--f-mono);
    font-size: var(--fs-mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    text-decoration: none;
    transform: translateY(-200%);
}

.evitement:focus-visible {
    transform: none;
    outline-color: var(--c-encre);
}

/* --- Échelle typographique -------------------------------------------------- */
.titre-monumental,
.titre-page,
.titre-section,
.titre-carte {
    font-family: var(--f-display);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.005em;
    text-wrap: balance;
    font-synthesis: none;
}

.titre-monumental {
    font-size: var(--fs-monumental);
    line-height: var(--lh-monumental);
    font-weight: 900;
}

.titre-page {
    font-size: var(--fs-titre);
    line-height: var(--lh-titre);
}

.titre-section {
    font-size: var(--fs-titre-section);
    line-height: var(--lh-titre);
}

.titre-carte {
    font-size: var(--fs-sous-titre);
    line-height: 1;
}

/* Mélange romain / italique : la partie en <em> passe en Instrument Serif. */
.titre-monumental em,
.titre-page em,
.titre-section em,
.titre-carte em,
.italique {
    font-family: var(--f-italique);
    font-style: italic;
    font-weight: 400;
    text-transform: none;
    letter-spacing: -0.02em;
}

.titre-monumental em,
.titre-page em,
.titre-section em {
    font-size: 0.94em;
    line-height: 0.9;
}

.sous-titre {
    font-family: var(--f-texte);
    font-size: var(--fs-sous-titre);
    line-height: var(--lh-sous-titre);
    font-weight: 600;
    letter-spacing: -0.015em;
    text-wrap: balance;
}

.chapo {
    font-size: var(--fs-chapo);
    line-height: 1.4;
    max-width: 40ch;
    text-wrap: pretty;
}

.texte {
    max-width: var(--mesure);
}

.texte > * + * {
    margin-top: 1em;
}

.legende {
    font-size: var(--fs-legende);
    line-height: 1.4;
    color: var(--discret);
}

.mono {
    font-family: var(--f-mono);
    font-size: var(--fs-mono);
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-variant-numeric: tabular-nums;
}

/* --- Texture : grain très léger sur toute la page ------------------------ */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-curseur) - 1);
    pointer-events: none;
    opacity: 0.07;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}

@media print {
    body::after {
        display: none;
    }
}
