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

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 1rem);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--ink);
    color: var(--paper);
    font-family: var(--font-body);
    font-size: var(--size-body);
    line-height: 1.55;
    overflow-x: clip;
}

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

a {
    color: inherit;
    text-underline-offset: 0.18em;
    text-decoration-thickness: 2px;
}

button {
    font: inherit;
}

:focus-visible {
    outline: 3px solid var(--white);
    outline-offset: 3px;
}

/* Sur fond clair (papier), le focus passe en encre pour rester visible. */
.section--paper :focus-visible,
.section--light :focus-visible {
    outline-color: var(--ink);
}

::selection {
    background: var(--white);
    color: var(--ink);
}

main {
    display: block;
    overflow-x: clip; /* bandeaux inclinés et titres géants débordent volontairement */
}

main:focus {
    outline: none;
}

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

.skip-link {
    position: absolute;
    left: 1rem;
    top: -5rem;
    z-index: 200;
    padding: 0.7rem 1.2rem;
    background: var(--white);
    color: var(--ink);
    font-family: var(--font-mono);
    font-weight: 700;
    text-decoration: none;
    text-transform: uppercase;
}

.skip-link:focus {
    top: 1rem;
}

/* Étiquettes techniques (mono, capitales) */
.label {
    font-family: var(--font-mono);
    font-size: var(--size-label);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    padding: 0;
    background: none;
    color: inherit;
    font-family: var(--font-mono);
    font-size: var(--size-label);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.tag::before {
    content: '';
    flex: none;
    width: 0.7em;
    height: 1.05em;
    background: currentColor;
    -webkit-mask: var(--star) center / contain no-repeat;
    mask: var(--star) center / contain no-repeat;
}

/* Sprite SVG : présent dans le DOM, jamais affiché */
.sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---------- Fond : champ de trames N&B (WebGL) ---------- */
.nebula {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    z-index: -1;
    pointer-events: none;
    opacity: 0.32;
}

@media (max-width: 700px) {
    .nebula {
        opacity: 0.4;
    }
}

html.no-webgl-bg .nebula {
    display: none;
}

html.no-webgl-bg body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    color: color-mix(in srgb, var(--paper) 30%, transparent);
    background-image: var(--dots);
    background-size: var(--dot-step-fat) var(--dot-step-fat);
    -webkit-mask-image: radial-gradient(ellipse at 75% 20%, var(--ink), transparent 65%);
    mask-image: radial-gradient(ellipse at 75% 20%, var(--ink), transparent 65%);
}

/* ---------- Loader ---------- */
.loader {
    display: none;
}

html.js .loader {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 1rem;
    padding: var(--gutter);
    background: var(--ink);
    transition: opacity 0.45s var(--ease-out), visibility 0.45s;
}

.loader.is-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-title {
    margin: 0;
    font-family: var(--font-display);
    font-variation-settings: var(--condensed);
    font-weight: 900;
    font-size: clamp(3rem, 18vw, 14rem);
    line-height: 0.85;
    text-transform: uppercase;
    color: transparent;
    background-image: radial-gradient(circle at center, var(--paper) 0 var(--loader-dot), transparent calc(var(--loader-dot) + 0.6px));
    background-size: 9px 9px;
    -webkit-background-clip: text;
    background-clip: text;
    animation: loader-dots 0.9s var(--ease-out) both;
}

.loader-phrase {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--white);
    text-align: center;
    text-transform: uppercase;
}

@keyframes loader-dots {
    from {
        --loader-dot: 0px;
        background-size: 28px 28px;
    }

    to {
        --loader-dot: 4.3px;
        background-size: 9px 9px;
    }
}

/* ---------- Pied de page ---------- */
.site-footer {
    position: relative;
    overflow: hidden;
    padding: 3rem var(--gutter) 0;
    background: var(--ink);
}

.site-footer::before,
.site-footer::after {
    content: '';
    position: absolute;
    top: 0;
}

.site-footer::before {
    right: var(--gutter);
    left: var(--gutter);
    height: 1px;
    color: var(--grey);
    background: var(--line-fade);
}

.site-footer::after {
    left: 50%;
    width: 13px;
    height: 19px;
    translate: -50% -50%;
    background: var(--paper);
    -webkit-mask: var(--star) center / contain no-repeat;
    mask: var(--star) center / contain no-repeat;
}

.footer-text {
    margin: 0 0 1rem;
    color: var(--grey);
    font-size: 0.9rem;
}

/* Crédits à gauche, mentions légales tout à droite, sur la même ligne (passe à la ligne si étroit) */
.footer-row {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem 2rem;
    margin-bottom: 1.5rem;
}

.footer-row .footer-text {
    margin: 0;
}

/* Liens légaux : en clair (plus visibles que les crédits), soulignés, séparés par un éclat */
.footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 1.25rem;
}

.footer-links a {
    color: var(--paper);
    text-decoration-color: color-mix(in srgb, var(--paper) 45%, transparent);
    transition: color var(--dur), text-decoration-color var(--dur);
}

.footer-links a + a::before {
    content: '';
    display: inline-block;
    width: 0.55em;
    height: 0.85em;
    margin-right: 1.25rem;
    background: var(--grey);
    -webkit-mask: var(--star) center / contain no-repeat;
    mask: var(--star) center / contain no-repeat;
}

.footer-links a:focus-visible {
    text-decoration-color: currentColor;
}

@media (hover: hover) and (pointer: fine) {
    .footer-links a:hover {
        text-decoration-color: currentColor;
    }
}

.footer-giant {
    pointer-events: none; /* décor : ne doit jamais masquer les liens au-dessus */
    margin: 0 0 -0.18em;
    font-family: var(--font-display);
    font-variation-settings: var(--condensed);
    font-weight: 900;
    font-size: clamp(4rem, 26vw, 30rem);
    line-height: 0.8;
    text-transform: uppercase;
    white-space: nowrap;
    color: transparent;
    -webkit-text-stroke: 2px var(--paper);
}
