/* ============================================
   BASE — design tokens (AI Native Dark Aurora), reset, effets globaux
   ============================================ */

:root {
    color-scheme: dark;

    /* Surfaces : gris neutres, du noir au gris clair */
    --surface: #111111;
    --surface-bright: #3a3a3a;
    --surface-lowest: #0a0a0a;
    --surface-low: #171717;
    --surface-container: #1c1c1c;
    --surface-high: #262626;
    --surface-highest: #323232;

    /* Texte & contours */
    --on-surface: #ececec;
    --on-surface-variant: #c6c6c6;
    --outline: #a9a9a9;  /* texte secondaire : 4.5:1 même au pic de l'aurore */
    --outline-variant: #474747;

    /* Accents */
    --primary: #f2f2f2;
    --on-primary: #111111;
    --primary-container: #d9d9d9;
    --on-primary-container: #111111;
    --secondary: #bdbdbd;
    --secondary-container: #8f8f8f;
    --on-secondary-container: #111111;
    --tertiary: #e0e0e0;
    --tertiary-container: #7a7a7a;
    --error: #ffb4ab;

    /* Verre & halos */
    --border-glass: rgba(255, 255, 255, 0.08);
    --primary-soft: rgba(255, 255, 255, 0.18);
    --secondary-soft: rgba(189, 189, 189, 0.14);
    --tertiary-soft: rgba(224, 224, 224, 0.14);

    /* Aurore : dégradés lumineux du thème */
    --aurora-magenta: #9e9e9e;
    --aurora-gradient: linear-gradient(120deg, var(--primary), var(--secondary), var(--tertiary), var(--secondary), var(--primary));
    --aurora-button: linear-gradient(120deg, var(--primary-container), #b0b0b0, var(--secondary-container), #b0b0b0, var(--primary-container));
    --aurora-border: linear-gradient(135deg, rgba(242, 242, 242, 0.35), rgba(189, 189, 189, 0.12) 50%, rgba(224, 224, 224, 0.3));
    --aurora-duration: 12s;

    /* Typographie */
    /* Unbounded partout (titres, interface, texte) ; la mono reste pour le
       code et les étiquettes techniques. L'intro garde ses propres polices
       (Instrument Serif + IBM Plex Mono, controllers/intro.js). */
    --font-display: 'Unbounded', system-ui, sans-serif;
    --font-body: 'Unbounded', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'Cascadia Code', monospace;
    --font-label: var(--font-body);

    /* Tailles de texte : en rem pour suivre la taille de police choisie dans le
       navigateur. 12px est le plancher (badges, labels mono), 16px le corps. */
    --text-xs: 0.75rem;
    --text-sm: 0.875rem;
    --text-base: 1rem;

    /* Espacements */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 4rem;
    --margin: 1rem;

    /* Rayons */
    --radius-sm: 0.25rem;
    --radius: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;

    --nav-height: 64px;
    --max-width: 80rem;
}

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

html {
    /* Pas de gras synthétisé pour une police qui n'a pas la graisse demandée :
       le navigateur l'épaissirait et la rendrait floue. */
    font-synthesis-weight: none;
    scroll-behavior: smooth;
    /* Les ancres s'arrêtent sous l'en-tête fixe au lieu d'être masquées par lui. */
    scroll-padding-top: var(--nav-height);
    scrollbar-width: thin;
    scrollbar-color: var(--surface-highest) var(--surface);
    scrollbar-gutter: stable;
}

body {
    font-family: var(--font-body);
    /* Unbounded est large et dense : le texte courant en graisse légère. */
    font-weight: 300;
    font-size: var(--text-base);
    line-height: 1.6;
    background: var(--surface);
    color: var(--on-surface);
    min-height: 100vh;
    overflow-x: clip;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; }

[hidden] { display: none !important; }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--surface); }
::-webkit-scrollbar-thumb { background: var(--surface-highest); border-radius: 3px; }

::selection {
    background: var(--primary);
    color: var(--on-primary);
}

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

/* ============================================
   UTILITAIRES
   ============================================ */
.icon {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 18px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    direction: ltr;
    display: inline-block;
    flex-shrink: 0;
    -webkit-font-smoothing: antialiased;
    font-feature-settings: 'liga';
    user-select: none;
}

.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-tertiary { color: var(--tertiary); }
.text-outline { color: var(--outline); }

.mono { font-family: var(--font-mono); }

/* Masqué à l'écran, lu par les lecteurs d'écran. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.label-sm {
    font-family: var(--font-label);
    font-size: var(--text-xs);
    line-height: 14px;
}

.label-md {
    font-family: var(--font-label);
    font-size: var(--text-xs);
    line-height: 16px;
    font-weight: 500;
}

/* Le dégradé fait l'aller-retour (violet → cyan → vert → cyan → violet) :
   en glissant, il ondule comme une aurore sans jamais sauter. */
.gradient-text {
    background: var(--aurora-gradient);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: aurora-shift var(--aurora-duration) ease-in-out infinite alternate;
}

@keyframes aurora-shift {
    from { background-position: 0% 50%; }
    to { background-position: 100% 50%; }
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--tertiary);
    flex-shrink: 0;
}

.dot-sm { width: 6px; height: 6px; }
.dot-secondary { background: var(--secondary); }

.dot-pulse { animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite; }
.dot-ping { animation: ping-glow 1.6s ease-out infinite; }

@keyframes pulse {
    50% { opacity: 0.4; }
}

@keyframes ping-glow {
    0% { box-shadow: 0 0 0 0 rgba(189, 189, 189, 0.6); }
    100% { box-shadow: 0 0 0 8px rgba(189, 189, 189, 0); }
}

/* ============================================
   APPARITION AU SCROLL
   ============================================
   Animation plutôt que transition : une transition sur .reveal écraserait
   celles des cartes au survol. Le fill-mode "backwards" rend la main aux
   styles normaux à la fin. Le délai de cascade est posé par initReveal().
   Courbe exponentielle : l'élément arrive vite puis se pose, sans traîner.
   Le contenu n'est masqué qu'une fois initReveal() lancé (classe .reveal-ready) :
   si un script plante avant, les sections restent visibles. */
.reveal-ready .reveal { opacity: 0; }

.reveal.visible {
    opacity: 1;
    animation: reveal-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) backwards;
    animation-delay: var(--reveal-delay, 0s);
}

/* Passé sans être vu (saut d'ancre) : affiché tel quel. */
.reveal.visible.instant { animation: none; }

@keyframes reveal-in {
    from { opacity: 0; transform: translate3d(0, 28px, 0); filter: blur(6px); }
    55% { filter: blur(0); }
    to { opacity: 1; transform: none; filter: none; }
}

@keyframes reveal-fade {
    from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    /* Sans déplacement ni flou : un simple fondu garde le repère d'arrivée. */
    .reveal.visible { animation: reveal-fade 0.4s ease backwards; }
    .dot-pulse, .dot-ping { animation: none; }
    /* L'aurore reste visible, mais figée. */
    .gradient-text, .aurora-blob, .btn-primary, .nav-link.active { animation: none; }
}
