/* ===================================================================
   CV Print Stylesheet - Optimisé pour conversion PDF via navigateur
   Compatible avec Pandoc Markdown
   Version écran couleur + impression N&B
   =================================================================== */

/* === Variables CSS === */
:root {
  --primary-color: RoyalBlue;
  --secondary-color: forestgreen;
  --tertiary-color: deeppink;
  --accent-color: steelblue;
  --text-color: #2c3e50;
  --light-gray: floralwhite;
  --spacing-unit: 1rem;
}

@import url('https://fonts.googleapis.com/css2?family=Gurajada&family=Lato:ital,wght@0,100;0,300;0,400;0,700;0,900;1,100;1,300;1,400;1,700;1,900&display=swap');

/* === Reset et base === */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@page {
  size: A4;
  margin: 1.5cm 2cm;
}

html {
  font-size: 10pt;
}

body {
  font-family: 'Lato', sans-serif;
  line-height: 1.5;
  color: var(--text-color);
  max-width: 100%;
  background: white;
}

/* === Typographie === */
h1 {
  font-size: 1.8rem;
  font-family: 'Georgia', serif;
  font-weight: 700;
  color: var(--text-color);
  margin-bottom: 0.7rem;
  border-bottom: 3px solid var(--accent-color);
  padding-bottom: 0rem;
}

h2 {
  font-family: 'Georgia', serif;
  letter-spacing: .1rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-top: 1.4rem;
  margin-bottom: 0.8rem;
  padding-top: 0.2rem;
  padding-left: 0.6rem;
  border-bottom: 2px solid var(--primary-color);
  border-top-right-radius: 8px;
  background-color: mistyrose;
  page-break-after: avoid;

}

h3 {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--secondary-color);
  margin-top: 1rem;
  margin-bottom: 0.5rem;
  border-bottom: 2px solid var(--secondary-color);
  page-break-after: avoid;
}

h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--tertiary-color);
  margin-top: 0.7rem;
  margin-bottom: 0.4rem;
  page-break-after: avoid;
}

h5 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary-color);
  margin-top: 0.5rem;
  margin-bottom: 0.3rem;
  page-break-after: avoid;
}

p {
  margin-bottom: 0.5rem;
  text-align: justify;
  hyphens: auto;
}

strong, b {
  font-weight: 600;
  color: var(--text-color);
}

em, i {
  font-style: italic;
}

/* === En-tête document === */
header.title {
  text-align: left;
  margin-bottom: 0.5rem;
  page-break-after: avoid;
}

.title { display: none; }
.author { display: none; }

.date {
  font-size: 0.85rem;
  color: #7f8c8d;
  font-style: italic;
}

/* === Section contact === */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 0.8rem 0 1rem 0;
  padding: 0.7rem;
  background: var(--light-gray);
  border-radius: 4px;
  page-break-inside: avoid;
}

.contact-item {
  font-size: 0.9rem;
  line-height: 1.2;
}

.contact-item strong {
  display: inline-block;
  font-weight: 700;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-color);
  margin-bottom: 0.4rem;
  line-height: 1;
}

/* === Listes === */
ul, ol {
  margin-left: 1.5rem;
  margin-bottom: 0.8rem;
}

li {
  margin-bottom: 0.3rem;
  line-height: 1.5;
}

/* === Liens === */
a {
  color: var(--accent-color);
  text-decoration: none;
}

a[href^="http"]:after { content: ""; }

/* === Séparateurs === */
hr {
  border: none;
  margin: 0rem auto 0rem auto;
  border-top: 3px solid var(--accent-color);
  page-break-after: avoid;
}

/* === Code === */
code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
  background: var(--light-gray);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

/* === Pagination === */
h1, h2, h3, h4, h5 {
  page-break-after: avoid;
}

ul, ol, p {
  orphans: 3;
  widows: 3;
}

.contact-grid,
.contact-item {
  page-break-inside: avoid;
}

/* ============================================================
   ==================== MODE IMPRESSION =======================
   ============================================================ */

@media print {

  body {
    background: white;
    color: #000;
  }

  /* Neutraliser toutes les couleurs des titres */
  h1 {
    color: #000;
    border-bottom: 2px solid #000;
  }

  /* h2 : blanc sur fond gris */
  h2 {
    color: #ffffff !important;
    background-color: #555555 !important;
    border: none !important;
    padding: 0.4rem 0.6rem;
  }

  /* h3 : gris foncé */
  h3 {
    color: #222222 !important;
    border-bottom: 1px solid #888888 !important;
  }

  /* h4 : gris moyen */
  h4 {
    color: #444444 !important;
  }

  /* h5 : gris clair */
  h5 {
    color: #666666 !important;
  }

  /* Section contact en gris léger */
  .contact-grid {
    background: #f2f2f2 !important;
  }

  /* Liens en noir */
  a {
    color: #000 !important;
  }

  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  .contact-item a[href^="http"]:after,
  .contact-item a[href^="mailto"]:after {
    content: "";
  }

  hr {
    border-top: 2px solid #000 !important;
  }

  blockquote {
    border-left: 3px solid #888;
    color: #444;
  }

  /* Forcer la conservation des fonds gris */
  h2,
  .contact-grid {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* === Responsive écran === */
@media screen {
  body {
    max-width: 21cm;
    margin: 2rem auto;
    padding: 2rem;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
  }
}