/**
 * Base Styles
 * ===========
 * Reset moderne + styles de base
 */

/* ========================================
   RESET MODERNE (inspired by Josh Comeau)
   ======================================== */

*, *::before, *::after {
  box-sizing: border-box;
}

* {
  margin: 0;
  padding: 0;
}

html {
  /* Permet le smooth scroll */
  scroll-behavior: smooth;
  /* Améliore le rendu des fonts */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-bg);
  /* Prévient le horizontal scroll */
  overflow-x: hidden;
  /* Améliore le rendu du texte */
  text-rendering: optimizeLegibility;
}

/* ========================================
   TYPOGRAPHIE
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--font-semibold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text);
}

h1 {
  font-size: var(--text-5xl);
  margin-bottom: var(--space-md);
}

h2 {
  font-size: var(--text-4xl);
  margin-bottom: var(--space-md);
}

h3 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-sm);
}

h4 {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-sm);
}

p {
  margin-bottom: var(--space-sm);
  color: var(--color-text-light);
}

/* Améliore le wrapping du texte */
p, h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  hyphens: auto;
}

/* ========================================
   LIENS
   ======================================== */

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition-base) var(--ease-default);
}

a:hover {
  color: var(--color-primary);
}

a:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ========================================
   IMAGES & MEDIAS
   ======================================== */

img, picture, video, canvas, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

img {
  /* Prévient le layout shift */
  font-style: italic;
  /* Alt text style si image ne charge pas */
  color: var(--color-text-light);
}

/* ========================================
   FORMULAIRES
   ======================================== */

input, button, textarea, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

button:disabled {
  cursor: not-allowed;
  opacity: var(--opacity-disabled);
}

/* ========================================
   LISTES
   ======================================== */

ul, ol {
  list-style: none;
}

/* ========================================
   TABLES
   ======================================== */

table {
  border-collapse: collapse;
  width: 100%;
}

/* ========================================
   SECTIONS
   ======================================== */

section {
  padding-block: var(--section-padding);
}

/* ========================================
   ACCESSIBILITÉ
   ======================================== */

/* Enlève les animations si l'utilisateur préfère */
@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;
  }
}

/* Focus visible pour navigation clavier */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Skip to content (pour screen readers) */
.skip-to-content {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-accent);
  color: var(--color-white);
  text-decoration: none;
  border-radius: var(--radius-md);
  z-index: var(--z-tooltip);
  transform: translateY(-120%);
  transition: transform var(--transition-base) var(--ease-out);
}

.skip-to-content:focus {
  transform: translateY(0);
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  img {
    page-break-inside: avoid;
  }

  p,
  h2,
  h3 {
    orphans: 3;
    widows: 3;
  }

  h2,
  h3 {
    page-break-after: avoid;
  }
}
