/* ============================================================
   QreaLAB V01 — base.css
   ------------------------------------------------------------
   Reset, typographie, accessibilité et règles de plein écran.

   Corrections de dettes du PROTO appliquées ici :
   - 100vh → 100dvh (la barre d'adresse mobile ne coupe plus rien)
   - aucun défilement de page : le monde se déplace, la page non
   - respect de prefers-reduced-motion étendu à tout le site
   ============================================================ */

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

html,
body {
    height: 100%;
    /* Le monde est déplacé par la caméra : la PAGE ne défile jamais.
       Sans cela, un swipe vertical sur mobile ferait scroller le
       document au lieu de déplacer la scène. */
    overflow: hidden;
    overscroll-behavior: none;
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    background: var(--bg-void);
}

body {
    min-height: 100dvh;
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    font-weight: var(--fw-normal);
    line-height: var(--lh-normal);
    color: var(--text-primary);
    background: var(--bg-deep);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ──────────────────────────────────────────────────────────
   TYPOGRAPHIE
   ────────────────────────────────────────────────────────── */

h1, h2, h3, h4 {
    font-weight: var(--fw-medium);
    line-height: var(--lh-tight);
    color: var(--text-bright);
    letter-spacing: -0.01em;
}

p {
    line-height: var(--lh-relaxed);
}

/* La classe système : monospace, majuscules, interlettré.
   Réservée aux logs, identifiants et états — jamais au corps de texte. */
.sys {
    font-family: var(--font-mono);
    font-size: var(--fs-2xs);
    font-weight: var(--fw-medium);
    letter-spacing: var(--ls-label);
    text-transform: uppercase;
}

.sys--wide {
    letter-spacing: var(--ls-wide);
}

/* ──────────────────────────────────────────────────────────
   ÉLÉMENTS INTERACTIFS
   ────────────────────────────────────────────────────────── */

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    /* Supprime le délai de 300 ms et le flash bleu sur mobile. */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

button:disabled {
    cursor: not-allowed;
}

input {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
}

input:focus {
    outline: none;
}

a {
    color: var(--signal);
    text-decoration: none;
}

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

ul, ol {
    list-style: none;
}

/* ──────────────────────────────────────────────────────────
   ACCESSIBILITÉ
   ────────────────────────────────────────────────────────── */

/* Focus visible uniquement au clavier : le monde reste propre à la
   souris, mais reste entièrement navigable au clavier. */
:focus {
    outline: none;
}

:focus-visible {
    outline: 1px solid var(--signal);
    outline-offset: 3px;
    border-radius: var(--radius-xs);
}

/* Texte réservé aux 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;
}

/* Masquage utilitaire. */
.hidden {
    display: none !important;
}

[hidden] {
    display: none !important;
}

/* ──────────────────────────────────────────────────────────
   SÉLECTION
   ────────────────────────────────────────────────────────── */

::selection {
    color: var(--bg-deep);
    background: var(--signal);
}

/* ──────────────────────────────────────────────────────────
   BARRES DE DÉFILEMENT (journal, terminal)
   ────────────────────────────────────────────────────────── */

.scroll-thin {
    scrollbar-width: thin;
    scrollbar-color: var(--metal-700) transparent;
}

.scroll-thin::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scroll-thin::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-thin::-webkit-scrollbar-thumb {
    background: var(--metal-700);
    border-radius: var(--radius-full);
}

.scroll-thin::-webkit-scrollbar-thumb:hover {
    background: var(--metal-600);
}

/* ──────────────────────────────────────────────────────────
   MOUVEMENT RÉDUIT
   ──────────────────────────────────────────────────────────
   Le PROTO ne couvrait que quelques animations. Un monde avec
   caméra, parallaxe et particules doit être bien plus prudent :
   ici on neutralise tout mouvement non essentiel.
   ────────────────────────────────────────────────────────── */

@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;
    }
}
