/* ============================================================
   main.css — variables, reset, base
   ============================================================ */

/* ---- Custom properties ---- */
:root {
  /* Colours — light mode */
  --clr-bg:       #F8FAFC;
  --clr-surface:  #FFFFFF;
  --clr-text:     #0F172A;
  --clr-muted:    #475569;   /* était #64748B → 4,15:1 ❌ ; #475569 → 7,25:1 ✓ */
  --clr-border:   #E2E8F0;
  --clr-accent:   #2563EB;   /* était #3B82F6 → 3,25:1 ❌ ; #2563EB → 4,95:1 ✓ */
  --clr-accent-h: #1D4ED8;   /* hover, était #2563EB */
  --clr-on-accent: #fff;     /* texte sur fond accent (blanc en mode clair) */

  /* Typography */
  --font-base: 'Inter', system-ui, -apple-system, sans-serif;
  --text-xs:   0.75rem;   /*  12px */
  --text-sm:   0.875rem;  /*  14px */
  --text-base: 1rem;      /*  16px */
  --text-lg:   1.125rem;  /*  18px */
  --text-xl:   1.25rem;   /*  20px */
  --text-2xl:  1.5rem;    /*  24px */
  --text-3xl:  1.875rem;  /*  30px */
  --text-4xl:  2.25rem;   /*  36px */
  --text-5xl:  3rem;      /*  48px */

  /* Spacing scale (multiples of 4px) */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadows */
  --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.08), 0 1px 2px -1px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.08), 0 2px 4px -2px rgb(0 0 0 / 0.06);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.06);

  /* Transitions */
  --transition: 200ms ease;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --clr-bg:        #0F172A;
    --clr-surface:   #1E293B;
    --clr-text:      #F8FAFC;
    --clr-muted:     #94A3B8;   /* 6,96:1 sur bg ✓ */
    --clr-border:    #334155;
    --clr-accent:    #60A5FA;   /* était #3B82F6 → 4,3:1 sur surface ❌ ; #60A5FA → 5,7:1 ✓ */
    --clr-accent-h:  #93C5FD;   /* hover en mode sombre */
    --clr-on-accent: #0F172A;   /* texte sombre sur fond clair (#60A5FA) → 7,0:1 ✓ */
  }
}

/* ---- Reset (modern minimal) ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--font-base);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.6;
  color: var(--clr-text);
  background-color: var(--clr-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  list-style: none;
}

button {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
textarea,
select {
  font: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.25;
}

/* ---- Accessibility ---- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  padding: var(--space-2) var(--space-4);
  background: var(--clr-accent);
  color: var(--clr-on-accent, #fff); /* était #fff → fail en dark sur #60A5FA */
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: top var(--transition);
}

.skip-link:focus {
  top: var(--space-4);
}

/* Global focus-visible */
:focus-visible {
  outline: 2px solid var(--clr-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* ---- Base typography ---- */
p {
  max-width: 65ch;
}

strong {
  font-weight: 600;
}

em {
  font-style: italic;
}

time {
  font-variant-numeric: tabular-nums;
}
