/* ==========================================================================
   Mes Modèles — Design system (réutilisable entre sites de niche)
   Tokens → base → composants → sections → print
   ========================================================================== */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url('/assets/fonts/inter-variable-latin.woff2') format('woff2');
}

:root {
  /* Couleurs */
  --c-bg: #ffffff;
  --c-bg-alt: #f8fafc;
  --c-bg-dark: #0f172a;
  --c-text: #0f172a;
  --c-text-2: #475569;
  --c-text-3: #64748b;
  --c-border: #e2e8f0;
  --c-primary: #4f46e5;
  --c-primary-hover: #4338ca;
  --c-primary-soft: #eef2ff;
  --c-accent-2: #7c3aed;
  --c-success: #059669;
  --c-success-soft: #ecfdf5;
  --grad-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  /* Typo */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  /* Géométrie */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .07);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .1);
  --container: 1120px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(2rem, 4.5vw, 3.25rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.3em; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.section { padding: 72px 0; }
.section--alt { background: var(--c-bg-alt); }
.section-head { max-width: 640px; margin: 0 auto 48px; text-align: center; }
.lead { font-size: 1.125rem; color: var(--c-text-2); }
.muted { color: var(--c-text-3); }
:focus-visible { outline: 2px solid var(--c-primary); outline-offset: 2px; }

/* ---------- Eyebrow / badges ---------- */
.eyebrow {
  display: inline-block;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-primary);
  margin-bottom: 12px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .8rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--c-primary-soft);
  color: var(--c-primary);
}
.badge--success { background: var(--c-success-soft); color: var(--c-success); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: 600 1rem var(--font);
  padding: 13px 26px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .15s ease;
  text-decoration: none !important;
  white-space: nowrap;
}
.btn--primary { background: var(--grad-primary); color: #fff; box-shadow: var(--shadow-md); }
.btn--primary:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn--secondary { background: #fff; color: var(--c-text); border-color: var(--c-border); box-shadow: var(--shadow-sm); }
.btn--secondary:hover { border-color: #cbd5e1; background: var(--c-bg-alt); }
.btn--ghost { color: var(--c-primary); padding: 13px 14px; }
.btn--sm { padding: 8px 16px; font-size: .9rem; border-radius: 8px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
}
.site-header__in {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 64px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--c-text);
  text-decoration: none !important;
}
.logo svg { flex: none; }
.main-nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.main-nav a:not(.btn) {
  color: var(--c-text-2);
  font-weight: 500;
  font-size: .95rem;
  padding: 8px 14px;
  border-radius: var(--r-sm);
  text-decoration: none !important;
}
.main-nav a:not(.btn):hover, .main-nav a:not(.btn)[aria-current="page"] { color: var(--c-text); background: var(--c-bg-alt); }
.main-nav .btn { margin-left: 8px; }
.nav-toggle, .search-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--c-text-2);
}
.nav-toggle:hover, .search-toggle:hover { background: var(--c-bg-alt); color: var(--c-text); }
.nav-toggle { display: none; }

/* ---------- Recherche (overlay) ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, .45);
  backdrop-filter: blur(4px);
  display: none;
  padding: 12vh 24px 0;
}
.search-overlay.is-open { display: block; }
.search-box {
  max-width: 560px;
  margin: 0 auto;
  background: #fff;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-box input {
  width: 100%;
  border: none;
  outline: none;
  font: 500 1.05rem var(--font);
  padding: 18px 20px;
  border-bottom: 1px solid var(--c-border);
}
.search-results { max-height: 320px; overflow-y: auto; padding: 8px; }
.search-results a {
  display: block;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--c-text);
  text-decoration: none !important;
}
.search-results a:hover { background: var(--c-primary-soft); }
.search-results a small { display: block; color: var(--c-text-3); }
.search-results .no-result { padding: 14px 12px; color: var(--c-text-3); }

/* ---------- Fil d'Ariane ---------- */
.breadcrumbs { padding: 16px 0 0; font-size: .875rem; color: var(--c-text-3); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: '›'; margin-right: 6px; color: #cbd5e1; }
.breadcrumbs a { color: var(--c-text-3); }
.breadcrumbs a:hover { color: var(--c-primary); }
.breadcrumbs [aria-current] { color: var(--c-text); font-weight: 500; }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 88px 0 80px;
  text-align: center;
  background:
    radial-gradient(56% 70% at 50% -10%, #eef2ff 0%, rgba(238, 242, 255, 0) 100%),
    var(--c-bg);
  overflow: hidden;
}
.hero h1 { max-width: 800px; margin: 0 auto 20px; }
.hero .lead { max-width: 620px; margin: 0 auto 32px; }
.hero__cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-bottom: 36px; }
.trust-row {
  display: flex;
  gap: 10px 28px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: .9rem;
  font-weight: 500;
  color: var(--c-text-2);
}
.trust-row span { display: inline-flex; align-items: center; gap: 7px; }
.trust-row svg { color: var(--c-success); flex: none; }
.hero--page { text-align: left; padding: 40px 0 48px; }
.hero--page h1, .hero--page .lead { margin-left: 0; }
.hero--page .hero__cta, .hero--page .trust-row { justify-content: flex-start; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 24px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: all .15s ease;
}
a.card { color: var(--c-text); text-decoration: none !important; display: block; }
a.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: #c7d2fe; }
.card__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--r-md);
  background: var(--c-primary-soft);
  color: var(--c-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.card h3 { margin-bottom: 6px; }
.card p { color: var(--c-text-2); font-size: .95rem; margin: 0; }
.card .card__more { display: inline-block; margin-top: 14px; font-weight: 600; font-size: .9rem; color: var(--c-primary); }
.card--feature { padding: 24px; }
.steps { counter-reset: step; }
.step::before {
  counter-increment: step;
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 700;
  margin-bottom: 16px;
}

/* ---------- Emplacements publicitaires (réservés, zéro CLS) ---------- */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bg-alt);
  border: 1px dashed #cbd5e1;
  border-radius: var(--r-md);
  color: #94a3b8;
  font-size: .75rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 40px auto;
  max-width: var(--container);
}
.ad-slot--top, .ad-slot--bottom { min-height: 100px; }
.ad-slot--mid, .ad-slot--content { min-height: 250px; max-width: 720px; }
.ad-slot:empty::after { content: 'Publicité'; }

/* ---------- Générateur ---------- */
.generator {
  background: #fff;
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.generator__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 20px 28px;
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg-alt);
}
.generator__head h2, .generator__head h3 { margin: 0; font-size: 1.1rem; }
.generator__head-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.gen-switch { font-size: .9rem; font-weight: 600; white-space: nowrap; }
.generator__body { display: grid; grid-template-columns: 380px 1fr; }
.gen-form { padding: 24px 28px; border-right: 1px solid var(--c-border); }
.gen-form fieldset { border: none; padding: 0; margin: 0 0 22px; }
.gen-form legend {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-text-3);
  margin-bottom: 10px;
  padding: 0;
}
.gen-form label { display: block; font-size: .85rem; font-weight: 500; margin-bottom: 4px; color: var(--c-text-2); }
.gen-form input, .gen-form select, .gen-form textarea {
  width: 100%;
  font: 400 .95rem var(--font);
  padding: 9px 12px;
  border: 1px solid var(--c-border);
  border-radius: var(--r-sm);
  margin-bottom: 12px;
  background: #fff;
  color: var(--c-text);
}
.gen-form input:focus, .gen-form select:focus, .gen-form textarea:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.gen-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.gen-items .gen-item { display: grid; grid-template-columns: 1fr 64px 88px 32px; gap: 8px; align-items: start; }
.gen-item button {
  border: none;
  background: none;
  color: #94a3b8;
  font-size: 1.2rem;
  cursor: pointer;
  padding: 8px 4px;
  line-height: 1;
}
.gen-item button:hover { color: #dc2626; }
.gen-add { background: none; border: 1px dashed #cbd5e1; color: var(--c-text-2); width: 100%; padding: 9px; border-radius: var(--r-sm); font: 500 .9rem var(--font); cursor: pointer; }
.gen-add:hover { border-color: var(--c-primary); color: var(--c-primary); }
.gen-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* Aperçu type "feuille" */
.gen-preview-wrap { padding: 28px; background: #f1f5f9; display: flex; align-items: flex-start; justify-content: center; }
.doc-paper {
  background: #fff;
  width: 100%;
  max-width: 640px;
  min-height: 760px;
  padding: 44px 48px;
  box-shadow: var(--shadow-lg);
  border-radius: 4px;
  font-size: .85rem;
  line-height: 1.55;
  color: #1e293b;
}
.doc-paper__top { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 32px; }
.doc-paper__type { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; color: var(--c-primary); margin: 0 0 4px; }
.doc-paper__meta { font-size: .8rem; color: #475569; }
.doc-paper__parties { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.doc-paper__parties h4 { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #94a3b8; margin: 0 0 6px; }
.doc-paper table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.doc-paper th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: #64748b; border-bottom: 2px solid #e2e8f0; padding: 8px 6px; }
.doc-paper td { padding: 9px 6px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.doc-paper .num { text-align: right; white-space: nowrap; }
.doc-totals { margin-left: auto; width: 240px; }
.doc-totals div { display: flex; justify-content: space-between; padding: 4px 6px; }
.doc-totals .doc-total { font-weight: 800; font-size: 1rem; border-top: 2px solid var(--c-text); margin-top: 4px; padding-top: 8px; }
.doc-mentions { margin-top: 28px; padding-top: 16px; border-top: 1px solid #e2e8f0; font-size: .72rem; color: #64748b; }
.doc-credit { margin-top: 14px; font-size: .68rem; color: #94a3b8; }
.doc-credit a { color: #64748b; text-decoration: underline; }

/* ---------- Téléchargements ---------- */
.dl-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.dl-card { text-align: center; }
.dl-card .card__icon { margin: 0 auto 14px; }
.dl-card .btn { margin-top: 14px; width: 100%; }

/* ---------- Contenu éditorial ---------- */
.prose { max-width: 720px; margin: 0 auto; }
.prose h2 { margin-top: 2em; }
.prose h3 { margin-top: 1.6em; }
.prose ul li, .prose ol li { margin-bottom: .4em; }
.prose .callout {
  background: var(--c-primary-soft);
  border-left: 3px solid var(--c-primary);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: 16px 20px;
  margin: 1.5em 0;
}
.prose .callout p:last-child { margin: 0; }
table.table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: .95rem; }
table.table th { text-align: left; background: var(--c-bg-alt); padding: 10px 14px; border-bottom: 2px solid var(--c-border); }
table.table td { padding: 10px 14px; border-bottom: 1px solid var(--c-border); }

/* ---------- FAQ ---------- */
.faq { max-width: 720px; margin: 0 auto; }
.faq details {
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  margin-bottom: 12px;
  background: #fff;
}
.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 18px 22px;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; font-size: 1.3rem; font-weight: 400; color: var(--c-text-3); transition: transform .15s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > div { padding: 0 22px 18px; color: var(--c-text-2); }

/* ---------- CTA final ---------- */
.cta-band {
  background: var(--grad-primary);
  border-radius: var(--r-lg);
  color: #fff;
  text-align: center;
  padding: 56px 32px;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, .85); max-width: 540px; margin: 0 auto 28px; }
.cta-band .btn--primary { background: #fff; color: var(--c-primary); }

/* ---------- Footer ---------- */
.site-footer { background: var(--c-bg-dark); color: #94a3b8; margin-top: 72px; font-size: .92rem; }
.site-footer__main {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px;
  padding: 56px 0 40px;
}
.site-footer .logo { color: #fff; margin-bottom: 14px; }
.site-footer h4 { color: #e2e8f0; font-size: .85rem; text-transform: uppercase; letter-spacing: .07em; margin: 0 0 16px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li { margin-bottom: 9px; }
.site-footer a { color: #94a3b8; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.site-footer__bottom {
  border-top: 1px solid #1e293b;
  padding: 20px 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: .85rem;
}

/* ---------- Pages liées ---------- */
.related h2 { text-align: center; margin-bottom: 36px; }

/* ---------- 404 ---------- */
.page-404 { text-align: center; padding: 96px 24px; }
.page-404 .code { font-size: 5rem; font-weight: 800; background: var(--grad-primary); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; margin-bottom: 16px; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .generator__body { grid-template-columns: 1fr; }
  .gen-form { border-right: none; border-bottom: 1px solid var(--c-border); }
  .site-footer__main { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .section { padding: 52px 0; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .main-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: #fff;
    border-bottom: 1px solid var(--c-border);
    padding: 12px 16px;
    box-shadow: var(--shadow-md);
  }
  .main-nav.is-open { display: flex; }
  .nav-toggle { display: inline-flex; margin-left: auto; }
  .search-toggle { margin-left: 0; }
  .site-header__in { gap: 8px; }
  .hero { padding: 56px 0; }
  .dl-grid { grid-template-columns: 1fr; }
  .doc-paper { padding: 28px 22px; min-height: auto; }
  .gen-preview-wrap { padding: 14px; }
}

/* ---------- Impression : seule la feuille du document sort ---------- */
@media print {
  body * { visibility: hidden; }
  .doc-paper, .doc-paper * { visibility: visible; }
  .doc-paper {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: none;
    min-height: auto;
    box-shadow: none;
    border-radius: 0;
    padding: 24px;
  }
  .site-header, .site-footer, .ad-slot { display: none !important; }
}
