/* ============================================================
   ADAVIS — Design tokens v1.0
   Source : phase2/02-design-system.md
   Date : 04/05/2026
   Conformité : WCAG 2.2 AA · règle 17 dignité éditoriale
   ============================================================ */

:root {
  /* ── Couleurs primaires (vert ADAVIS — extrait plaquette) ── */
  --color-primary-900: #1A2E26;
  --color-primary-800: #2C4A3E;   /* Vert ADAVIS principal */
  --color-primary-700: #3D5F4F;
  --color-primary-600: #486048;
  --color-primary-500: #607860;
  --color-primary-200: #C0D8C0;
  --color-primary-100: #E8F0EC;
  --color-primary-50:  #F4F8F6;

  /* ── Neutres ── */
  --color-neutral-900: #1A1A1A;
  --color-neutral-700: #333333;
  --color-neutral-500: #666666;
  --color-neutral-300: #CCCCCC;
  --color-neutral-100: #F0F0F0;
  --color-neutral-50:  #FAFAFA;
  --color-white: #FFFFFF;

  /* ── Sémantiques ── */
  --color-error-700:   #9A2A2A;
  --color-error-100:   #F8E0E0;
  --color-warning-700: #A86B12;
  --color-warning-100: #FFF1D6;
  --color-success-700: #2C6E3D;
  --color-success-100: #DDEFE0;
  --color-info-700:    #1F4F7A;
  --color-info-100:    #E0EBF5;

  /* ── Fonts ── */
  --font-display: 'Lora', 'Georgia', 'Times New Roman', serif;
  --font-body:    'Inter', -apple-system, 'Segoe UI', system-ui, sans-serif;
  --font-mono:    ui-monospace, 'Menlo', 'Monaco', monospace;

  /* ── Type scale ── */
  --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:  2rem;       /* 32px */
  --text-4xl:  2.5rem;     /* 40px */
  --text-5xl:  3.5rem;     /* 56px */

  /* ── Spacing (8pt grid) ── */
  --space-0:  0;
  --space-1:  0.25rem;   /* 4px */
  --space-2:  0.5rem;    /* 8px */
  --space-3:  0.75rem;   /* 12px */
  --space-4:  1rem;      /* 16px */
  --space-6:  1.5rem;    /* 24px */
  --space-8:  2rem;      /* 32px */
  --space-12: 3rem;      /* 48px */
  --space-16: 4rem;      /* 64px */
  --space-24: 6rem;      /* 96px */

  /* ── Layout ── */
  --container-max: 1200px;
  --reading-max:    680px;
  --bp-mobile:      480px;
  --bp-tablet:      768px;
  --bp-desktop:    1024px;
  --bp-wide:       1440px;

  /* ── Borders & rayons ── */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  /* ── Ombres ── */
  --shadow-sm: 0 1px 3px rgba(26, 46, 38, 0.06);
  --shadow-md: 0 2px 8px rgba(26, 46, 38, 0.08);
  --shadow-lg: 0 8px 24px rgba(26, 46, 38, 0.10);
  --shadow-xl: 0 16px 48px rgba(26, 46, 38, 0.14);

  /* ── Motion ── */
  --ease-out:   cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in:    cubic-bezier(0.4, 0, 1, 1);
  --duration-fast: 150ms;
  --duration-base: 250ms;
  --duration-slow: 400ms;
}

/* ── Base reset & body ── */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 100%;          /* base 16px */
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--color-neutral-900);
  background: var(--color-neutral-100);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Headings ── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--color-primary-900);
  font-weight: 600;
  margin: 0 0 var(--space-4);
  line-height: 1.25;
}
h1 { font-size: var(--text-5xl); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); font-family: var(--font-body); font-weight: 600; }

@media (max-width: 768px) {
  h1 { font-size: var(--text-4xl); }
  h2 { font-size: var(--text-2xl); }
}

/* ── Liens ── */
a {
  color: var(--color-primary-700);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--color-primary-800); }
a:focus-visible {
  outline: 3px solid var(--color-primary-500);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Boutons ── */
.btn {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-base);
  padding: 14px 28px;
  min-height: 48px;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  transition: all var(--duration-base) var(--ease-out);
  text-decoration: none;
}
.btn-primary {
  background: var(--color-primary-800);
  color: var(--color-white);
}
.btn-primary:hover { background: var(--color-primary-700); }
.btn-secondary {
  background: transparent;
  color: var(--color-primary-800);
  border-color: var(--color-primary-800);
}
.btn-secondary:hover { background: var(--color-primary-100); }
.btn-urgent {
  background: var(--color-warning-700);
  color: var(--color-white);
  font-weight: 700;
}
.btn-urgent:hover { background: #8B5810; }
.btn:focus-visible {
  outline: 3px solid var(--color-primary-500);
  outline-offset: 3px;
}

/* ── Cards ── */
.card {
  background: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-base) var(--ease-out),
              box-shadow var(--duration-base) var(--ease-out);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* ── Forms ── */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}
.field label {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--color-neutral-700);
}
.field input,
.field textarea,
.field select {
  padding: 12px 16px;
  font-size: var(--text-base);
  font-family: var(--font-body);
  border: 2px solid var(--color-neutral-300);
  border-radius: var(--radius-md);
  background: var(--color-white);
  color: var(--color-neutral-900);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--color-primary-800);
  box-shadow: 0 0 0 3px var(--color-primary-100);
}

/* ── Containers ── */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--space-4);
}
.reading {
  max-width: var(--reading-max);
  margin: 0 auto;
}

/* ── Sections ── */
section {
  padding: var(--space-12) 0;
}
@media (min-width: 1024px) {
  section { padding: var(--space-16) 0; }
}

/* ── Reduced motion ── */
@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;
  }
}

/* ── Utilities ── */
.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;
}
.text-center { text-align: center; }
.text-lead {
  font-size: var(--text-lg);
  line-height: 1.65;
  color: var(--color-neutral-700);
}

/* ════════════════════════════════════════════════════════════════════
   PLACEHOLDER OFFICIEL — zones réservées au bureau ADAVIS
   Utilisé pour marquer les blocs qui NE sont PAS dans le DOCX officiel
   et attendent validation du bureau.
   ════════════════════════════════════════════════════════════════════ */
.placeholder-officiel {
  background: repeating-linear-gradient(
    45deg,
    var(--color-neutral-50),
    var(--color-neutral-50) 12px,
    var(--color-neutral-100) 12px,
    var(--color-neutral-100) 24px
  );
  border: 2px dashed var(--color-neutral-300);
  border-radius: var(--radius-md);
  padding: var(--space-8);
  margin: var(--space-6) 0;
  text-align: center;
  color: var(--color-neutral-500);
  font-style: italic;
  font-size: var(--text-sm);
}
.placeholder-officiel::before {
  content: '📝 Espace réservé au bureau ADAVIS';
  display: block;
  font-weight: 600;
  font-style: normal;
  color: var(--color-neutral-700);
  margin-bottom: var(--space-2);
  font-size: var(--text-xs);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.placeholder-officiel strong { color: var(--color-primary-800); }

/* ════════════════════════════════════════════════════════════════════
   RESPONSIVE OVERRIDES — couche globale appliquée aux 14 maquettes
   ════════════════════════════════════════════════════════════════════ */

/* ── Garde-fou overflow horizontal ── */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}
img, video, iframe, table {
  max-width: 100%;
  height: auto;
}

/* ── Mobile (< 768px) ── */
@media (max-width: 767px) {
  /* Body + containers */
  body { font-size: var(--text-base); }
  .container {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
    max-width: 100%;
  }

  /* Typographie réduite pour éviter coupures + max-width 100% qui override les .h1{max-width:14ch} des pages */
  h1, h2, h3, h4, h5, h6 { max-width: 100% !important; }
  h1 {
    font-size: clamp(1.6rem, 6.5vw, 2.1rem) !important;
    line-height: 1.2 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    -webkit-hyphens: auto;
  }
  h2 {
    font-size: clamp(1.3rem, 5.2vw, 1.65rem) !important;
    line-height: 1.25 !important;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
  h3 { font-size: clamp(1.1rem, 4.2vw, 1.3rem) !important; word-wrap: break-word; }
  h4 { font-size: 1rem !important; word-wrap: break-word; }
  p, li, label, span, a, blockquote, cite, em, strong, small {
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;
  }
  /* Bandeau urgence — wrap natif */
  .urgent-banner {
    padding: var(--space-2) var(--space-3) !important;
    font-size: 12px !important;
    line-height: 1.4 !important;
    text-align: center;
    white-space: normal !important;
  }
  .urgent-banner a { display: inline-block; word-break: break-word; }

  /* Sections — paddings verticaux réduits */
  section { padding: var(--space-8) 0 !important; }

  /* Hero — réduire le padding excessif */
  .hero,
  .page-hero,
  .article-hero,
  .member-hero,
  .doubt-hero,
  .oath-banner {
    padding-top: var(--space-8) !important;
    padding-bottom: var(--space-8) !important;
  }
  .oath-quote p { font-size: var(--text-lg) !important; }

  /* Header — éviter le débordement du logo + texte ADAVIS */
  .site-header .container { gap: var(--space-2); }
  .logo span:not(.logo-mark) { font-size: 18px; }
  .logo-img { width: 32px !important; }
  .logo-mark { width: 32px !important; height: 32px !important; font-size: 13px !important; }

  /* Bandeau urgence — wrap clean */
  .urgent-banner {
    padding: var(--space-2) var(--space-3);
    font-size: 12px;
    line-height: 1.4;
  }

  /* Breadcrumb — clamp à 1 ligne avec ellipsis pour éviter wrap fou */
  .breadcrumb { font-size: 12px; }
  .breadcrumb a, .breadcrumb span { word-break: keep-all; }

  /* Boutons — pleine largeur sur mobile pour easy-tap */
  .hero-ctas .btn,
  .member-cta-row .btn,
  .cta-stripe .btn,
  .final-cta .btn,
  .blog-cta .btn { width: 100%; justify-content: center; }
  .hero-ctas { flex-direction: column; align-items: stretch; gap: var(--space-3); }

  /* Cards & grids — 1 colonne forcée + padding réduit */
  .card,
  .service-card,
  .member-card,
  .bureau-card,
  .blog-card,
  .testimonial,
  .institution-badge,
  .condition-card,
  .hub-card,
  .partner-card,
  .stat-card,
  .help-card,
  .tool-card,
  .related-tile,
  .reassurance-card,
  .form-card,
  .charte-card,
  .legal-card,
  .contact-card,
  .related-card,
  .commitment-callout,
  .citation-block,
  .legend,
  .reminder { padding: var(--space-5) !important; }

  .form-card { padding: var(--space-6) !important; }
  .charte-card { padding: var(--space-6) !important; }

  /* Forcer 1 colonne sur tous les grids horizontaux > 1fr */
  .services-grid,
  .why-grid,
  .blog-grid,
  .bureau-grid,
  .institutions-grid,
  .testimonials-grid,
  .conditions-grid,
  .hubs-grid,
  .partners-grid,
  .stats-grid,
  .help-grid,
  .tools-grid,
  .related-grid,
  .split-grid,
  .domain-grid,
  .field-row,
  .form-grid.two-cols,
  .emergency-grid,
  .signs-grid,
  .stats-row,
  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-4) !important;
  }

  /* Layouts 2-col (article + sidebar) → empilé */
  .article-layout,
  .about-layout,
  .member-content,
  .annuaire-layout,
  .form-layout { grid-template-columns: 1fr !important; gap: var(--space-8) !important; }

  /* Sidebars sticky → désactivées en mobile (laissent place en flux) */
  .toc,
  .member-sidebar,
  .filters,
  .legal-card,
  .contact-card { position: static !important; top: auto !important; }

  /* Hero homepage — illustration prend toute la largeur */
  .hero-grid,
  .hero-section,
  .member-hero-grid { grid-template-columns: 1fr !important; gap: var(--space-6) !important; }
  .hero-illustration { aspect-ratio: 5 / 4 !important; max-width: 100%; }

  /* Footer — empilé proprement */
  .footer-grid { gap: var(--space-8) !important; }

  /* Tableaux scrollables */
  table { display: block; overflow-x: auto; white-space: nowrap; }

  /* Inputs / textarea — full width sans débordement */
  input, textarea, select { max-width: 100%; box-sizing: border-box; }
}

/* ── Très petit mobile (< 480px) ── */
@media (max-width: 479px) {
  .container { padding-left: var(--space-3); padding-right: var(--space-3); }
  h1 { font-size: clamp(1.5rem, 7vw, 1.9rem) !important; }
  .oath-quote p { font-size: var(--text-base) !important; }
  .step-num,
  .mission-num,
  .why-item .num,
  .emergency-num,
  .stat-num,
  .stat-circle .num { font-size: var(--text-3xl) !important; }
  .emergency-num { font-size: 48px !important; }
}
