/**
 * Styles globaux — reset, typographie, layout de base
 */
* , *::before, *::after { box-sizing: border-box; }

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

body {
  font-family: var(--cl-font-base);
  font-size: var(--cl-fs-base);
  line-height: var(--cl-lh-base);
  color: var(--cl-gray-800);
  background: var(--cl-surface-page);
  -webkit-font-smoothing: antialiased;
}

/* Titres légèrement plus élégants et mieux hiérarchisés. */
h1 { font-size: var(--cl-fs-xl); letter-spacing: -0.015em; }
h2 { font-size: var(--cl-fs-lg); letter-spacing: -0.01em; }

body[dir="rtl"] { text-align: right; }

h1, h2, h3, h4, h5 { margin: 0; font-weight: var(--cl-fw-semibold); line-height: var(--cl-lh-tight); color: var(--cl-gray-900); }
p { margin: 0; }
a { color: var(--cl-primary-500); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--cl-primary-100); }

:focus-visible {
  outline: none;
  box-shadow: var(--cl-shadow-focus);
  border-radius: var(--cl-radius-sm);
}

/* --- App shell --- */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.app-content {
  flex: 1;
  padding: var(--cl-space-6);
  max-width: var(--cl-content-max-width);
  width: 100%;
  margin: 0 auto;
}

@media (max-width: 900px) {
  .app-content { padding: var(--cl-space-4); }
}

/* --- Scrollbar discrète --- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--cl-gray-300); border-radius: var(--cl-radius-full); }
::-webkit-scrollbar-track { background: transparent; }

/* --- Utilitaires --- */
.u-flex { display: flex; }
.u-flex-col { display: flex; flex-direction: column; }
.u-items-center { align-items: center; }
.u-justify-between { justify-content: space-between; }
.u-gap-1 { gap: var(--cl-space-1); }
.u-gap-2 { gap: var(--cl-space-2); }
.u-gap-3 { gap: var(--cl-space-3); }
.u-gap-4 { gap: var(--cl-space-4); }
.u-text-muted { color: var(--cl-gray-500); }
.u-text-sm { font-size: var(--cl-fs-sm); }
.u-text-xs { font-size: var(--cl-fs-xs); }
.u-hidden { display: none !important; }
.u-w-full { width: 100%; }
.u-mt-4 { margin-top: var(--cl-space-4); }
.u-mb-4 { margin-bottom: var(--cl-space-4); }

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

@keyframes cl-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes cl-skeleton-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

/* --- Préférence « mouvement réduit » ---
   Respecte prefers-reduced-motion : les animations décoratives et les
   transitions sont neutralisées, sans jamais masquer d'information (les
   contenus animés restent visibles à leur état final). */
@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;
  }
}
