/* =============================================================================
   base.css
   Reset minimal + styles globaux + typographie.
   IMPORTE : tokens.css (doit être chargé avant)
   RÈGLE : pas de classes spécifiques aux composants ici.
           Uniquement les éléments HTML natifs.
   ============================================================================= */

/* ---------------------------------------------------------------------------
   Google Fonts — chargé via <link> dans base.html (non bloquant)
   NE PAS utiliser @import ici (double chargement + render-blocking).
--------------------------------------------------------------------------- */


/* ---------------------------------------------------------------------------
   Box-sizing global
--------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


/* ---------------------------------------------------------------------------
   HTML & Body
--------------------------------------------------------------------------- */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family:       var(--font-sans);
  font-size:         var(--text-base);
  font-weight:       var(--font-normal);
  line-height:       var(--leading-normal);
  color:             var(--color-text-main);
  background-color:  var(--color-bg);
  -webkit-font-smoothing:  antialiased;
  -moz-osx-font-smoothing: grayscale;
}


/* ---------------------------------------------------------------------------
   Typographie — Titres
--------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight:  var(--font-semi);
  line-height:  var(--leading-tight);
  color:        var(--color-text-main);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl);  }
h4 { font-size: var(--text-lg);  }
h5 { font-size: var(--text-base); }
h6 { font-size: var(--text-sm);  }


/* ---------------------------------------------------------------------------
   Typographie — Paragraphes & Inline
--------------------------------------------------------------------------- */
p {
  line-height:  var(--leading-normal);
  color:        var(--color-text-main);
}

p + p {
  margin-top: var(--space-4);
}

strong, b {
  font-weight: var(--font-semi);
}

small {
  font-size: var(--text-sm);
  color:     var(--color-text-muted);
}

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size:   0.9em;
}

code {
  background:    var(--color-primary-subtle);
  color:         var(--color-primary-dark);
  padding:       2px var(--space-2);
  border-radius: var(--radius-sm);
  font-size:     var(--text-sm);
}

pre {
  background:    var(--color-text-main);
  color:         #E5E7EB;
  padding:       var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  overflow-x:    auto;
  font-size:     var(--text-sm);
  line-height:   var(--leading-loose);
}

pre code {
  background:    transparent;
  color:         inherit;
  padding:       0;
  border-radius: 0;
  font-size:     inherit;
}


/* ---------------------------------------------------------------------------
   Liens
--------------------------------------------------------------------------- */
a {
  color:           var(--color-primary);
  text-decoration: none;
  transition:      color var(--transition-fast);
}

a:hover {
  color:           var(--color-primary-hover);
  text-decoration: none;
}


/* ---------------------------------------------------------------------------
   Listes
--------------------------------------------------------------------------- */
ul, ol {
  padding-left: var(--space-6);
}

li {
  line-height: var(--leading-normal);
}

ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding:    0;
}


/* ---------------------------------------------------------------------------
   Images & Media
--------------------------------------------------------------------------- */
img, svg, video {
  display:   block;
  max-width: 100%;
  height:    auto;
}

svg {
  flex-shrink: 0;
}


/* ---------------------------------------------------------------------------
   Formulaires — Reset de base
   (les styles applicatifs sont dans forms.css)
--------------------------------------------------------------------------- */
button, input, select, textarea {
  font-family: inherit;
  font-size:   inherit;
  line-height: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: transparent;
}

input, select, textarea {
  outline: none;
}

textarea {
  resize: vertical;
}

fieldset {
  border:  none;
  padding: 0;
}

label {
  cursor: pointer;
}


/* ---------------------------------------------------------------------------
   Tableaux — Reset de base
   (les styles applicatifs sont dans components.css)
--------------------------------------------------------------------------- */
table {
  border-collapse: collapse;
  width: 100%;
}

th {
  font-weight: var(--font-semi);
  text-align:  left;
}


/* ---------------------------------------------------------------------------
   HR
--------------------------------------------------------------------------- */
hr {
  border:        none;
  border-top:    var(--border-width) solid var(--color-border);
  margin:        var(--space-6) 0;
}


/* ---------------------------------------------------------------------------
   Scrollbar — Style discret (Webkit)
--------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width:  6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background:    var(--color-border-strong);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-light);
}


/* ---------------------------------------------------------------------------
   Focus visible — Accessibilité
--------------------------------------------------------------------------- */
:focus-visible {
  outline:        2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius:  var(--radius-sm);
}

:focus:not(:focus-visible) {
  outline: none;
}


/* ---------------------------------------------------------------------------
   Sélection de texte
--------------------------------------------------------------------------- */
::selection {
  background: var(--color-primary-light);
  color:      var(--color-primary-dark);
}