/* ═══════════════════════════════════════════════════════════════
   Nimbus — système de design : tokens, fond nuageux, typographie
   ═══════════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
  --font: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI Variable Display', 'Segoe UI', Roboto, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', 'SF Mono', Consolas, 'Liberation Mono', monospace;

  /* Ciel */
  --sky-1: #dcebff;
  --sky-2: #eef0ff;
  --sky-3: #f6efff;
  --cloud: rgba(255, 255, 255, 0.95);
  --cloud-shade: rgba(205, 220, 255, 0.55);
  --aurora-1: rgba(120, 170, 255, 0.45);
  --aurora-2: rgba(178, 140, 255, 0.35);

  /* Verre */
  --glass: rgba(255, 255, 255, 0.58);
  --glass-strong: rgba(255, 255, 255, 0.78);
  --glass-soft: rgba(255, 255, 255, 0.38);
  --glass-hover: rgba(255, 255, 255, 0.72);
  --glass-border: rgba(255, 255, 255, 0.85);
  --glass-edge: rgba(120, 140, 200, 0.16);
  --blur: 16px;

  /* Texte */
  --text: #17203d;
  --text-2: #4b5779;
  --text-3: #8490ad;
  --line: rgba(40, 60, 120, 0.09);
  --line-strong: rgba(40, 60, 120, 0.16);

  /* Marque */
  --blue: #4f8bff;
  --indigo: #6d7cff;
  --violet: #9b7bff;
  --sky: #38bdf8;
  --primary: #5b7fff;
  --primary-soft: rgba(91, 127, 255, 0.12);
  --primary-ring: rgba(91, 127, 255, 0.35);
  --grad: linear-gradient(135deg, #5aa2ff 0%, #6d7cff 48%, #a07bff 100%);
  --grad-soft: linear-gradient(135deg, rgba(90, 162, 255, 0.16), rgba(160, 123, 255, 0.16));

  /* États */
  --success: #16b47a;
  --success-soft: rgba(22, 180, 122, 0.13);
  --warning: #e8a317;
  --warning-soft: rgba(232, 163, 23, 0.15);
  --danger: #ef4c5a;
  --danger-soft: rgba(239, 76, 90, 0.12);
  --info: #2fa8e8;
  --info-soft: rgba(47, 168, 232, 0.13);
  --muted-soft: rgba(132, 144, 173, 0.15);

  /* Ombres & formes */
  --shadow-sm: 0 1px 2px rgba(30, 50, 110, 0.06), 0 2px 8px rgba(30, 50, 110, 0.05);
  --shadow: 0 2px 6px rgba(30, 50, 110, 0.05), 0 12px 32px -8px rgba(40, 70, 160, 0.16);
  --shadow-lg: 0 8px 24px rgba(30, 50, 110, 0.08), 0 32px 80px -16px rgba(50, 80, 180, 0.28);
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.6) inset, 0 1px 0 rgba(255, 255, 255, 0.9) inset;
  --radius-xl: 26px;
  --radius: 20px;
  --radius-sm: 14px;
  --radius-xs: 10px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --sidebar-w: 268px;
  --topbar-h: 72px;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --sky-1: #060a1c;
  --sky-2: #0d0f2b;
  --sky-3: #170f33;
  --cloud: rgba(120, 130, 220, 0.16);
  --cloud-shade: rgba(80, 60, 170, 0.18);
  --aurora-1: rgba(70, 110, 255, 0.28);
  --aurora-2: rgba(150, 90, 255, 0.24);

  --glass: rgba(24, 30, 66, 0.52);
  --glass-strong: rgba(28, 34, 74, 0.82);
  --glass-soft: rgba(30, 38, 80, 0.32);
  --glass-hover: rgba(40, 48, 96, 0.6);
  --glass-border: rgba(150, 170, 255, 0.13);
  --glass-edge: rgba(150, 170, 255, 0.1);

  --text: #e9edff;
  --text-2: #aab3d9;
  --text-3: #6f7aa6;
  --line: rgba(150, 170, 255, 0.09);
  --line-strong: rgba(150, 170, 255, 0.16);

  --primary: #7b95ff;
  --primary-soft: rgba(123, 149, 255, 0.16);
  --primary-ring: rgba(123, 149, 255, 0.4);

  --success: #34d399;
  --success-soft: rgba(52, 211, 153, 0.14);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.14);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.14);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.14);
  --muted-soft: rgba(111, 122, 166, 0.18);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow: 0 2px 6px rgba(0, 0, 0, 0.2), 0 16px 40px -12px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.35), 0 40px 90px -20px rgba(20, 10, 80, 0.7);
  --glow: 0 0 0 1px rgba(160, 180, 255, 0.05) inset, 0 1px 0 rgba(200, 210, 255, 0.07) inset;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--sky-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv11', 'ss01';
  overflow-x: hidden;
  transition: background-color 0.5s var(--ease), color 0.3s var(--ease);
}

::selection {
  background: rgba(109, 124, 255, 0.28);
}

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

h1,
h2,
h3,
h4 {
  margin: 0;
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-weight: 650;
}

p {
  margin: 0;
}

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

code,
kbd,
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}

img,
svg {
  display: block;
}

[hidden] {
  display: none !important;
}

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

/* Barres de défilement discrètes */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: padding-box;
}

/* ───────────── Ciel animé ───────────── */

.sky {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background:
    radial-gradient(1200px 700px at 12% -10%, var(--aurora-1), transparent 60%),
    radial-gradient(1000px 700px at 100% 0%, var(--aurora-2), transparent 55%),
    linear-gradient(180deg, var(--sky-1) 0%, var(--sky-2) 55%, var(--sky-3) 100%);
  transition: background 0.6s var(--ease);
}

.sky .cloud {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--cloud), transparent);
  filter: blur(18px);
  opacity: 0.9;
  animation: drift linear infinite;
}
.sky .cloud::before,
.sky .cloud::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--cloud), transparent);
}
.sky .cloud::before {
  width: 70%;
  height: 120%;
  left: 12%;
  top: -45%;
}
.sky .cloud::after {
  width: 55%;
  height: 95%;
  right: 6%;
  top: -25%;
  background: radial-gradient(closest-side, var(--cloud-shade), transparent);
}

.sky .c1 { width: 520px; height: 170px; top: 8%;  left: -10%; animation-duration: 140s; }
.sky .c2 { width: 380px; height: 130px; top: 34%; left: 60%;  animation-duration: 180s; animation-delay: -60s; opacity: 0.7; }
.sky .c3 { width: 640px; height: 200px; top: 70%; left: 10%;  animation-duration: 220s; animation-delay: -120s; opacity: 0.6; }
.sky .c4 { width: 300px; height: 110px; top: 18%; left: 78%;  animation-duration: 160s; animation-delay: -30s; opacity: 0.75; }
.sky .c5 { width: 460px; height: 150px; top: 52%; left: -20%; animation-duration: 200s; animation-delay: -90s; opacity: 0.55; }

@keyframes drift {
  from { transform: translateX(-30vw); }
  to   { transform: translateX(130vw); }
}

.sky .stars {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1s var(--ease);
  background-image:
    radial-gradient(1.2px 1.2px at 10% 20%, #fff, transparent),
    radial-gradient(1px 1px at 30% 70%, #cfd8ff, transparent),
    radial-gradient(1.4px 1.4px at 55% 15%, #fff, transparent),
    radial-gradient(1px 1px at 70% 45%, #e0d4ff, transparent),
    radial-gradient(1.2px 1.2px at 85% 80%, #fff, transparent),
    radial-gradient(1px 1px at 20% 90%, #cfd8ff, transparent),
    radial-gradient(1px 1px at 92% 12%, #fff, transparent),
    radial-gradient(1.3px 1.3px at 44% 52%, #fff, transparent);
  background-size: 420px 420px;
  animation: twinkle 6s ease-in-out infinite alternate;
}
html.in-app .sky .cloud,
html.in-app .sky .stars { animation-play-state: paused; }
:root[data-theme='dark'] .sky .stars {
  opacity: 0.7;
}
@keyframes twinkle {
  from { opacity: 0.45; }
  to   { opacity: 0.8; }
}

/* ───────────── Utilitaires ───────────── */

.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: 12.5px; }
.tiny { font-size: 11.5px; }
.strong { font-weight: 600; }
.center { text-align: center; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.gap-sm { gap: 6px; } .gap-lg { gap: 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); }
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

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