/* ============================================================
   SYSTÈME CSS RESPONSIVE — Desktop · iPad · iPhone
   Approche : Mobile-First + Fluid Typography + CSS Grid/Flex
   ============================================================ */

/* ─────────────────────────────────────────
   1. VARIABLES & DESIGN TOKENS
───────────────────────────────────────── */
:root {
  /* Couleurs */
  --color-bg:         #0f0f13;
  --color-surface:    #1a1a24;
  --color-border:     rgba(255,255,255,0.08);
  --color-accent:     #5b8dee;
  --color-accent-alt: #a78bfa;
  --color-text:       #e8e8f0;
  --color-muted:      #7a7a9a;

  /* Typographie fluide — clamp(min, preferred, max) */
  --text-xs:   clamp(0.70rem, 1.5vw, 0.80rem);
  --text-sm:   clamp(0.85rem, 1.8vw, 0.95rem);
  --text-base: clamp(1.00rem, 2.0vw, 1.10rem);
  --text-md:   clamp(1.15rem, 2.5vw, 1.35rem);
  --text-lg:   clamp(1.30rem, 3.0vw, 1.65rem);
  --text-xl:   clamp(1.60rem, 4.0vw, 2.20rem);
  --text-2xl:  clamp(2.00rem, 5.5vw, 3.20rem);
  --text-3xl:  clamp(2.50rem, 7.0vw, 4.50rem);

  /* Espacement fluide */
  --space-2xs: clamp(0.25rem, 0.5vw,  0.35rem);
  --space-xs:  clamp(0.50rem, 1.0vw,  0.75rem);
  --space-sm:  clamp(0.75rem, 1.5vw,  1.00rem);
  --space-md:  clamp(1.00rem, 2.5vw,  1.50rem);
  --space-lg:  clamp(1.50rem, 4.0vw,  2.50rem);
  --space-xl:  clamp(2.00rem, 6.0vw,  4.00rem);
  --space-2xl: clamp(3.00rem, 8.0vw,  6.00rem);

  /* Layout */
  --container-sm:  640px;
  --container-md:  768px;
  --container-lg:  1024px;
  --container-xl:  1280px;
  --container-2xl: 1536px;

  /* Grille */
  --grid-cols:  12;
  --grid-gap:   clamp(1rem, 2.5vw, 2rem);

  /* Rayon */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-xl: 32px;
  --radius-full: 9999px;

  /* Ombres */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);

  /* Transitions */
  --transition-fast:   150ms ease;
  --transition-base:   250ms ease;
  --transition-slow:   400ms ease;

  /* Z-index layers */
  --z-below:   -1;
  --z-base:     0;
  --z-raised:  10;
  --z-overlay: 100;
  --z-modal:   200;
  --z-toast:   300;
}

/* Mode clair (optionnel) */
@media (prefers-color-scheme: light) {
  :root {
    --color-bg:      #f4f4f8;
    --color-surface: #ffffff;
    --color-border:  rgba(0,0,0,0.08);
    --color-text:    #1a1a2e;
    --color-muted:   #6b6b8a;
  }
}


/* ─────────────────────────────────────────
   2. RESET & BASE
───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;                /* = 16px par défaut */
  -webkit-text-size-adjust: 100%;/* empêche zoom auto iOS */
  scroll-behavior: smooth;
  tab-size: 4;
}

body {
  font-family: 'Outfit', 'DM Sans', system-ui, sans-serif;
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;            /* dvh = unité dynamique (évite problème barre Safari) */
}

img, video, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

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

a {
  color: var(--color-accent);
  text-decoration: none;
}
a:hover { text-decoration: underline; }


/* ─────────────────────────────────────────
   3. TYPOGRAPHIE
───────────────────────────────────────── */
h1 { font-size: var(--text-3xl); line-height: 1.1; font-weight: 800; letter-spacing: -0.03em; }
h2 { font-size: var(--text-2xl); line-height: 1.2; font-weight: 700; letter-spacing: -0.02em; }
h3 { font-size: var(--text-xl);  line-height: 1.3; font-weight: 700; }
h4 { font-size: var(--text-lg);  line-height: 1.4; font-weight: 600; }
h5 { font-size: var(--text-md);  line-height: 1.4; font-weight: 600; }
h6 { font-size: var(--text-base);line-height: 1.5; font-weight: 600; }

p  { font-size: var(--text-base); margin-bottom: var(--space-sm); }
small { font-size: var(--text-xs); }

.text-xs   { font-size: var(--text-xs);  }
.text-sm   { font-size: var(--text-sm);  }
.text-base { font-size: var(--text-base);}
.text-md   { font-size: var(--text-md);  }
.text-lg   { font-size: var(--text-lg);  }
.text-xl   { font-size: var(--text-xl);  }
.text-2xl  { font-size: var(--text-2xl); }
.text-3xl  { font-size: var(--text-3xl); }

.text-muted  { color: var(--color-muted); }
.text-accent { color: var(--color-accent); }
.text-center { text-align: center; }
.text-right  { text-align: right;  }
.font-bold   { font-weight: 700; }
.font-medium { font-weight: 500; }


/* ─────────────────────────────────────────
   4. CONTENEUR
───────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--container-xl);
  margin-inline: auto;
  padding-inline: clamp(1rem, 5vw, 2.5rem);
}
.container-sm  { max-width: var(--container-sm);  }
.container-md  { max-width: var(--container-md);  }
.container-lg  { max-width: var(--container-lg);  }
.container-2xl { max-width: var(--container-2xl); }


/* ─────────────────────────────────────────
   5. GRILLE CSS (12 colonnes fluides)
───────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  gap: var(--grid-gap);
}

/* Colonnes : col-{n} sur mobile, col-{bp}-{n} sur breakpoint */
.col-1  { grid-column: span 1;  }
.col-2  { grid-column: span 2;  }
.col-3  { grid-column: span 3;  }
.col-4  { grid-column: span 4;  }
.col-5  { grid-column: span 5;  }
.col-6  { grid-column: span 6;  }
.col-7  { grid-column: span 7;  }
.col-8  { grid-column: span 8;  }
.col-9  { grid-column: span 9;  }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }
.col-full { grid-column: 1 / -1; }

/* Grilles utilitaires */
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto-fit { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.grid-auto-fill { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }


/* ─────────────────────────────────────────
   6. FLEXBOX UTILITAIRES
───────────────────────────────────────── */
.flex         { display: flex; }
.inline-flex  { display: inline-flex; }
.flex-col     { flex-direction: column; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.flex-none    { flex: none; }

.items-start    { align-items: flex-start; }
.items-center   { align-items: center; }
.items-end      { align-items: flex-end; }
.items-stretch  { align-items: stretch; }

.justify-start   { justify-content: flex-start; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.justify-around  { justify-content: space-around; }
.justify-evenly  { justify-content: space-evenly; }

.gap-2xs { gap: var(--space-2xs); }
.gap-xs  { gap: var(--space-xs);  }
.gap-sm  { gap: var(--space-sm);  }
.gap-md  { gap: var(--space-md);  }
.gap-lg  { gap: var(--space-lg);  }
.gap-xl  { gap: var(--space-xl);  }


/* ─────────────────────────────────────────
   7. ESPACEMENT (margin / padding)
───────────────────────────────────────── */
/* Margin */
.m-auto  { margin: auto; }
.mx-auto { margin-inline: auto; }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* Padding */
.p-xs  { padding: var(--space-xs);  }
.p-sm  { padding: var(--space-sm);  }
.p-md  { padding: var(--space-md);  }
.p-lg  { padding: var(--space-lg);  }
.p-xl  { padding: var(--space-xl);  }
.px-sm { padding-inline: var(--space-sm); }
.px-md { padding-inline: var(--space-md); }
.px-lg { padding-inline: var(--space-lg); }
.py-sm { padding-block: var(--space-sm);  }
.py-md { padding-block: var(--space-md);  }
.py-lg { padding-block: var(--space-lg);  }
.py-xl { padding-block: var(--space-xl);  }


/* ─────────────────────────────────────────
   8. COMPOSANTS DE BASE
───────────────────────────────────────── */

/* Carte */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}
.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

/* Boutons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: 0.65em 1.4em;
  font-size: var(--text-sm);
  font-weight: 600;
  border-radius: var(--radius-full);
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent; /* retire le flash bleu iOS */
  touch-action: manipulation;
}
.btn-primary {
  background: var(--color-accent);
  color: #fff;
}
.btn-primary:hover { filter: brightness(1.15); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
}
.btn-outline:hover { background: var(--color-accent); color: #fff; }

.btn-ghost {
  background: transparent;
  color: var(--color-text);
}
.btn-ghost:hover { background: var(--color-border); }

/* Taille des boutons */
.btn-sm  { font-size: var(--text-xs);  padding: 0.5em 1.1em; }
.btn-lg  { font-size: var(--text-md);  padding: 0.75em 1.8em; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  padding: 0.2em 0.7em;
  font-size: var(--text-xs);
  font-weight: 600;
  border-radius: var(--radius-full);
  background: var(--color-border);
  color: var(--color-muted);
}
.badge-accent {
  background: color-mix(in srgb, var(--color-accent) 20%, transparent);
  color: var(--color-accent);
}

/* Input */
.input {
  width: 100%;
  padding: 0.6em 1em;
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  appearance: none;
  -webkit-appearance: none;
}
.input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 20%, transparent);
}

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-md);
}


/* ─────────────────────────────────────────
   9. NAVIGATION RESPONSIVE
───────────────────────────────────────── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) clamp(1rem, 5vw, 2.5rem);
  background: color-mix(in srgb, var(--color-bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: var(--z-overlay);
  border-bottom: 1px solid var(--color-border);
}

.nav-links {
  display: flex;
  gap: var(--space-md);
  list-style: none;
}

/* Burger menu (mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  background: none;
  border: none;
  padding: var(--space-xs);
}
.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: all var(--transition-base);
}


/* ─────────────────────────────────────────
   10. SECTIONS & HERO
───────────────────────────────────────── */
.section {
  padding-block: var(--space-2xl);
}

.hero {
  min-height: clamp(400px, 80dvh, 800px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-block: var(--space-2xl);
  padding-inline: clamp(1rem, 5vw, 3rem);
}


/* ─────────────────────────────────────────
   11. AFFICHAGE / VISIBILITÉ
───────────────────────────────────────── */
.hidden       { display: none !important; }
.block        { display: block; }
.inline-block { display: inline-block; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.aspect-video { aspect-ratio: 16 / 9; }
.aspect-square { aspect-ratio: 1; }
.object-cover { object-fit: cover; }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: var(--radius-full); }


/* ─────────────────────────────────────────
   12. BREAKPOINTS
   xs  : 0–479px       (iPhone SE, portrait)
   sm  : 480–767px     (iPhone Pro/Max, paysage)
   md  : 768–1023px    (iPad portrait)
   lg  : 1024–1279px   (iPad paysage / petits laptops)
   xl  : 1280–1535px   (Desktop)
   2xl : 1536px+       (Grands écrans)
───────────────────────────────────────── */

/* ── SM : 480px+ ── */
@media (min-width: 480px) {
  .sm\:col-6  { grid-column: span 6; }
  .sm\:col-12 { grid-column: span 12; }
  .sm\:grid-2 { grid-template-columns: repeat(2, 1fr); }
  .sm\:hidden { display: none !important; }
  .sm\:block  { display: block !important; }
  .sm\:flex   { display: flex !important; }
  .sm\:flex-row { flex-direction: row !important; }
  .sm\:text-center { text-align: center; }
}

/* ── MD : 768px+ (iPad portrait) ── */
@media (min-width: 768px) {
  .nav-links { display: flex; }
  .nav-toggle { display: none; }

  .md\:col-4  { grid-column: span 4; }
  .md\:col-6  { grid-column: span 6; }
  .md\:col-8  { grid-column: span 8; }
  .md\:col-12 { grid-column: span 12; }
  .md\:grid-2 { grid-template-columns: repeat(2, 1fr); }
  .md\:grid-3 { grid-template-columns: repeat(3, 1fr); }
  .md\:hidden { display: none !important; }
  .md\:block  { display: block !important; }
  .md\:flex   { display: flex !important; }
  .md\:flex-row { flex-direction: row !important; }
  .md\:text-left { text-align: left; }
}

/* ── LG : 1024px+ (iPad paysage / laptop) ── */
@media (min-width: 1024px) {
  .lg\:col-3  { grid-column: span 3; }
  .lg\:col-4  { grid-column: span 4; }
  .lg\:col-6  { grid-column: span 6; }
  .lg\:col-8  { grid-column: span 8; }
  .lg\:col-9  { grid-column: span 9; }
  .lg\:grid-3 { grid-template-columns: repeat(3, 1fr); }
  .lg\:grid-4 { grid-template-columns: repeat(4, 1fr); }
  .lg\:hidden { display: none !important; }
  .lg\:block  { display: block !important; }
  .lg\:flex   { display: flex !important; }
}

/* ── XL : 1280px+ (Desktop) ── */
@media (min-width: 1280px) {
  .xl\:col-3   { grid-column: span 3;  }
  .xl\:col-4   { grid-column: span 4;  }
  .xl\:col-6   { grid-column: span 6;  }
  .xl\:grid-4  { grid-template-columns: repeat(4, 1fr); }
  .xl\:hidden  { display: none !important; }
  .xl\:block   { display: block !important; }
}

/* ── Uniquement Mobile : max 767px ── */
@media (max-width: 767px) {
  /* Grille : toutes les colonnes passent en pleine largeur */
  [class*="col-"] { grid-column: span 12; }
  .grid { grid-template-columns: 1fr; }

  /* Navigation burger */
  .nav-links {
    display: none;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: flex; }

  .mobile\:hidden { display: none !important; }
  .mobile\:full   { width: 100% !important; }
  .mobile\:col    { flex-direction: column !important; }
  .mobile\:text-center { text-align: center !important; }
}

/* ── iPad uniquement (portrait + paysage) ── */
@media (min-width: 768px) and (max-width: 1024px) {
  .tablet\:hidden { display: none !important; }
  .tablet\:col-6  { grid-column: span 6; }
}

/* ── Orientation paysage sur petits écrans ── */
@media (max-width: 896px) and (orientation: landscape) {
  .hero { min-height: 100dvh; padding-block: var(--space-lg); }
  h1 { font-size: var(--text-xl); }
}


/* ─────────────────────────────────────────
   13. ACCESSIBILITÉ & TOUCHES FINALES
───────────────────────────────────────── */

/* Focus visible (clavier + touch) */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Réduit les animations si l'utilisateur le 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;
  }
}

/* Cibles tactiles minimales — 44×44px (Apple HIG) */
button, a, input, select, textarea, [role="button"] {
  min-height: 20px;
  min-width: 20px;
}

/* Sélection du texte */
::selection {
  background: color-mix(in srgb, var(--color-accent) 30%, transparent);
  color: var(--color-text);
}

/* Scrollbar personnalisée (Webkit) */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--color-muted); }
