/* ══════════════════════════════════════════════════════════════════════
   IMPIA — Design System
   Aesthetic : Linear / Vercel / Raycast — dark natif, minimal, typé.
   Règles : borders 0.5px, spacing généreux, anim opacity/transform 200ms,
   zéro gradient flashy, zéro shadow gratuite, mobile-first.
   Ce fichier = fondation. Les pages consomment ces tokens/composants.
   ══════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   1. FONTS — Inter auto-hébergée (aucun CDN)
   ───────────────────────────────────────────── */
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 300;
  font-display: swap; src: url('/fonts/Inter-Light.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 400;
  font-display: swap; src: url('/fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 500;
  font-display: swap; src: url('/fonts/Inter-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter'; font-style: normal; font-weight: 600;
  font-display: swap; src: url('/fonts/Inter-SemiBold.woff2') format('woff2');
}

/* ─────────────────────────────────────────────
   2. TOKENS
   ───────────────────────────────────────────── */
:root {
  /* — Couleurs : surfaces (du plus profond au plus élevé) — */
  --bg:            #080808;   /* fond de page */
  --surface:       #111111;   /* cartes, panneaux */
  --surface-2:     #171717;   /* éléments imbriqués, hover de surface */
  --surface-3:     #1e1e1e;   /* inputs, états actifs */

  /* — Bordures (toujours ≤ 0.5px, subtiles) — */
  --border:        rgba(255,255,255,0.07);
  --border-strong: rgba(255,255,255,0.12);
  --border-accent: rgba(108,59,255,0.40);

  /* — Texte — */
  --text:          #EFEFEF;   /* primaire */
  --text-2:        #A0A0A0;   /* secondaire */
  --muted:         #8A8A8A;   /* tertiaire / hints — AA (≥4.5:1) sur --bg, --surface ET --surface-3 (inputs) */
  --text-on-accent:#FFFFFF;

  /* — Accent & sémantique — */
  --accent:        #6C3BFF;   /* fills, bordures, logo (usage non-texte) */
  --accent-hover:  #7d51ff;
  --accent-soft:   rgba(108,59,255,0.12);
  --accent-line:   rgba(108,59,255,0.28);
  --accent-text:   #8F72FF;   /* accent LISIBLE en petit texte sur fond sombre (WCAG AA ~5:1) */
  --green:         #22C57A;
  --green-soft:    rgba(34,197,122,0.12);
  --amber:         #F0A030;
  --red:           #F05252;
  --red-soft:      rgba(240,82,82,0.12);

  /* — Rayons — */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;
  --r-full: 999px;

  /* — Espacement (échelle 4px) — */
  --sp-1: 4px;   --sp-2: 8px;   --sp-3: 12px;  --sp-4: 16px;
  --sp-5: 20px;  --sp-6: 24px;  --sp-8: 32px;  --sp-10: 40px;
  --sp-12: 48px; --sp-16: 64px; --sp-20: 80px; --sp-24: 96px;

  /* — Typo — */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --fs-12: 12px; --fs-13: 13px; --fs-14: 14px; --fs-16: 16px;
  --fs-18: 18px; --fs-20: 20px; --fs-24: 24px; --fs-32: 32px;
  --fs-40: 40px; --fs-56: 56px;

  /* — Élévation (rare, popovers/modales seulement) — */
  --shadow-pop: 0 8px 30px rgba(0,0,0,0.55);

  /* — Transitions (opacity + transform uniquement) — */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 200ms;
  --dur-slow: 500ms;   /* révélations au scroll, jauges — anims plus lentes */

  /* — Layout — */
  --max-w: 1080px;
  --nav-h: 60px;
}

/* ─────────────────────────────────────────────
   3. RESET
   ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: var(--fs-14);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
svg { display: block; }
::selection { background: var(--accent-soft); color: var(--text); }
img, svg { max-width: 100%; }

/* Barre de défilement discrète (WebKit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-full); border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2a2a2a; }

/* Anneau de focus cohérent (accessibilité) */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

/* ─────────────────────────────────────────────
   4. TYPOGRAPHIE
   ───────────────────────────────────────────── */
.t-display { font-size: var(--fs-56); font-weight: 600; letter-spacing: -0.03em; line-height: 1.02; }
.t-h1 { font-size: var(--fs-40); font-weight: 600; letter-spacing: -0.025em; line-height: 1.08; }
.t-h2 { font-size: var(--fs-32); font-weight: 600; letter-spacing: -0.02em; line-height: 1.12; }
.t-h3 { font-size: var(--fs-24); font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.t-h4 { font-size: var(--fs-20); font-weight: 500; letter-spacing: -0.01em; line-height: 1.3; }
.t-lg { font-size: var(--fs-18); font-weight: 400; line-height: 1.55; }
.t-body { font-size: var(--fs-14); font-weight: 400; line-height: 1.6; }
.t-sm { font-size: var(--fs-13); font-weight: 400; line-height: 1.5; }
.t-xs { font-size: var(--fs-12); font-weight: 400; line-height: 1.45; }
.t-mono { font-variant-numeric: tabular-nums; }

/* Rôles couleur */
.c-text { color: var(--text); }
.c-2 { color: var(--text-2); }
.c-muted { color: var(--muted); }
.c-accent { color: var(--accent-text); }
.c-green { color: var(--green); }

/* Overline / eyebrow (petits labels majuscules) */
.overline {
  font-size: var(--fs-12); font-weight: 500; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}

/* ─────────────────────────────────────────────
   5. LAYOUT
   ───────────────────────────────────────────── */
.container { width: 100%; max-width: var(--max-w); margin-inline: auto; padding-inline: var(--sp-6); }
.stack > * + * { margin-top: var(--sp-4); }   /* pile verticale */
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.grid { display: grid; gap: var(--sp-4); }
.divider { height: 0.5px; background: var(--border); border: 0; }

/* ─────────────────────────────────────────────
   6. BOUTONS
   ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 38px; padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-14); font-weight: 500; white-space: nowrap;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; }

/* Primaire — accent violet */
.btn--primary { background: var(--accent); color: var(--text-on-accent); }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); }

/* Secondaire — surface + bordure */
.btn--secondary { background: var(--surface-2); color: var(--text); border: 0.5px solid var(--border-strong); }
.btn--secondary:hover:not(:disabled) { background: var(--surface-3); border-color: var(--border-accent); }

/* Ghost — transparent */
.btn--ghost { background: transparent; color: var(--text-2); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

/* Danger */
.btn--danger { background: transparent; color: var(--red); border: 0.5px solid var(--red-soft); }
.btn--danger:hover:not(:disabled) { background: var(--red-soft); }

/* Tailles */
.btn--sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-13); border-radius: var(--r-sm); }
.btn--lg { height: 44px; padding: 0 var(--sp-5); font-size: var(--fs-16); }
.btn--block { width: 100%; }
.btn--icon { width: 38px; padding: 0; }

/* ─────────────────────────────────────────────
   7. CHAMPS DE FORMULAIRE
   ───────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: var(--sp-2); }
.label { font-size: var(--fs-13); font-weight: 500; color: var(--text-2); }
.hint { font-size: var(--fs-12); color: var(--muted); }

.input, .textarea, .select {
  width: 100%;
  background: var(--surface-3);
  border: 0.5px solid var(--border-strong);
  border-radius: var(--r-md);
  color: var(--text);
  padding: 0 var(--sp-3);
  height: 40px;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.textarea { height: auto; min-height: 96px; padding: var(--sp-3); resize: vertical; line-height: 1.6; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5L6 7.5L9 4.5' stroke='%23666' stroke-width='1.3' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--sp-3) center; padding-right: var(--sp-8);
}

/* ─────────────────────────────────────────────
   8. SURFACES / CARTES
   ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
}
.card--hover { transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.card--hover:hover { border-color: var(--border-strong); background: var(--surface-2); }
.card__title { font-size: var(--fs-16); font-weight: 500; }
.card__desc { font-size: var(--fs-13); color: var(--text-2); }

/* ─────────────────────────────────────────────
   9. BADGES / PILLS
   ───────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 22px; padding: 0 var(--sp-3);
  border-radius: var(--r-full);
  font-size: var(--fs-12); font-weight: 500;
  border: 0.5px solid var(--border);
}
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge--accent  { color: var(--accent-text); background: var(--accent-soft); border-color: var(--accent-line); }
.badge--success { color: var(--green);  background: var(--green-soft);  border-color: rgba(34,197,122,0.25); }
.badge--muted   { color: var(--text-2); background: var(--surface-2); }
.badge--danger  { color: var(--red);    background: var(--red-soft);   border-color: rgba(240,82,82,0.25); }
.badge--dot-blink::before { animation: blink 1.2s var(--ease) infinite; }

/* ─────────────────────────────────────────────
   10. CHIPS (sélectionnables)
   ───────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  height: 34px; padding: 0 var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface); border: 0.5px solid var(--border);
  color: var(--text-2); font-size: var(--fs-13);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip[aria-pressed="true"], .chip.is-active {
  background: var(--accent-soft); border-color: var(--accent-line); color: var(--text);
}

/* ─────────────────────────────────────────────
   11. TOGGLE (switch)
   ───────────────────────────────────────────── */
.toggle {
  position: relative; width: 38px; height: 22px; flex-shrink: 0;
  border-radius: var(--r-full); background: var(--surface-3);
  border: 0.5px solid var(--border-strong);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%; background: var(--text-2);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.toggle[aria-pressed="true"], .toggle.is-on { background: var(--accent); border-color: var(--accent); }
.toggle[aria-pressed="true"]::after, .toggle.is-on::after { transform: translateX(16px); background: #fff; }

/* ─────────────────────────────────────────────
   12. LOADER / SPINNER
   ───────────────────────────────────────────── */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--surface-3); border-top-color: var(--accent);
  animation: spin 0.7s linear infinite;
}
.spinner--lg { width: 28px; height: 28px; border-width: 3px; }

/* ─────────────────────────────────────────────
   13. NAV / TOPBAR
   ───────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50; height: var(--nav-h);
  display: flex; align-items: center;
  background: rgba(8,8,8,0.72); backdrop-filter: blur(12px);
  border-bottom: 0.5px solid var(--border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.logo { font-size: var(--fs-16); font-weight: 600; letter-spacing: -0.02em; }
.logo em { font-style: normal; color: var(--accent); }
.nav__links { display: flex; align-items: center; gap: var(--sp-5); }
.nav__link { font-size: var(--fs-13); color: var(--text-2); transition: color var(--dur) var(--ease); }
.nav__link:hover { color: var(--text); }

/* ─────────────────────────────────────────────
   14. UTILITAIRES
   ───────────────────────────────────────────── */
.kbd {
  font-size: var(--fs-12); padding: 2px 6px; border-radius: var(--r-sm);
  background: var(--surface-3); border: 0.5px solid var(--border-strong); color: var(--text-2);
}
.link { color: var(--accent-text); transition: opacity var(--dur) var(--ease); }
.link:hover { opacity: 0.8; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ─────────────────────────────────────────────
   15. ANIMATIONS (opacity + transform seulement)
   ───────────────────────────────────────────── */
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes rise  { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.animate-rise { animation: rise var(--dur) var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
