/* Polices servies par le site lui-même (paquets @fontsource), sans appel à
   Google Fonts : aucune adresse IP de visiteur n'est transmise à un tiers. */
@import url('/fonts/space-grotesk/500.css');
@import url('/fonts/space-grotesk/600.css');
@import url('/fonts/space-grotesk/700.css');
@import url('/fonts/source-serif-4/400.css');
@import url('/fonts/source-serif-4/600.css');
@import url('/fonts/jetbrains-mono/400.css');
@import url('/fonts/jetbrains-mono/500.css');

:root {
  --paper: #EFEBE1;
  --paper-alt: #E4DFCF;
  --ink: #211D1A;
  --ink-soft: #55504A;
  --navy: #1F3A5A;
  --navy-soft: #345173;
  --amber: #B8791F;
  --line: #C7BEAA;
  --green: #4B6B4F;
  /* Ambre lisible pour du texte (contraste AA sur le papier) */
  --amber-ink: #8A5A12;
  /* Boutons pleins : fond et texte */
  --accent-bg: #1F3A5A;
  --accent-bg-hover: #345173;
  --on-accent: #FFFFFF;
  /* Champs de formulaire et état d'erreur (admin) */
  --field: #FFFFFF;
  --danger: #8A3B2F;
  --danger-bg: #F3E6E2;
  --danger-line: #C9B3AC;
  --focus: #1F3A5A;
  --radius: 3px;
  --sidebar-w: 220px;
  color-scheme: light;
}

/* --- Thème sombre : suit le système, sauf choix explicite (data-theme) --- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #16191E;
    --paper-alt: #20252C;
    --ink: #E9E5DB;
    --ink-soft: #B5B0A6;
    --navy: #93B8E2;
    --navy-soft: #ABC6E4;
    --amber: #D9A04A;
    --line: #3A414B;
    --green: #86B08B;
    --amber-ink: #E3B062;
    --accent-bg: #93B8E2;
    --accent-bg-hover: #ABC6E4;
    --on-accent: #10151B;
    --field: #1C2026;
    --danger: #EE9A8A;
    --danger-bg: #3A2522;
    --danger-line: #6B4038;
    --focus: #93B8E2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #16191E;
  --paper-alt: #20252C;
  --ink: #E9E5DB;
  --ink-soft: #B5B0A6;
  --navy: #93B8E2;
  --navy-soft: #ABC6E4;
  --amber: #D9A04A;
  --line: #3A414B;
  --green: #86B08B;
  --amber-ink: #E3B062;
  --accent-bg: #93B8E2;
  --accent-bg-hover: #ABC6E4;
  --on-accent: #10151B;
  --field: #1C2026;
  --danger: #EE9A8A;
  --danger-bg: #3A2522;
  --danger-line: #6B4038;
  --focus: #93B8E2;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 17px;
  line-height: 1.6;
}

h1, h2, h3, .nav-brand, .stamp, .chip, .tab {
  font-family: 'Space Grotesk', sans-serif;
}

a { color: var(--navy); }

/* Fond quadrillé façon plan technique, très discret */
.blueprint-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 32px 32px;
  opacity: 0.18;
}

.layout {
  display: flex;
  min-height: 100vh;
  max-width: 1180px;
  margin: 0 auto;
}

/* --- Sidebar / onglets de dossier --- */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 40px 0 40px 8px;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
}

.nav-brand {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-soft);
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}

.tabs { list-style: none; margin: 0; padding: 0; }

.tab {
  display: block;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  border-left: 3px solid transparent;
  background: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.tab:hover { background: var(--paper-alt); color: var(--ink); }

.tab.is-active {
  background: var(--paper-alt);
  border-left-color: var(--amber);
  color: var(--ink);
}

.sidebar-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 16px 0;
}

.tool-btn {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px 10px;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
}
.tool-btn:hover { color: var(--ink); border-color: var(--ink-soft); }

/* Lien d'évitement : invisible jusqu'à ce qu'il reçoive le focus clavier */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--accent-bg);
  color: var(--on-accent);
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 600;
  border-radius: var(--radius);
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

main:focus { outline: none; }

/* --- Contenu principal --- */
main { flex: 1; padding: 56px 48px 80px; min-width: 0; }

section { margin-bottom: 88px; scroll-margin-top: 24px; }

.section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 28px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

/* --- Cover / hero --- */
.cover {
  position: relative;
  padding: 12px 0 48px;
  border-bottom: 2px solid var(--ink);
  margin-bottom: 56px;
}

.cover h1 {
  font-size: 46px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}

.cover .role {
  font-size: 19px;
  color: var(--navy-soft);
  font-weight: 600;
  margin-bottom: 18px;
}

.cover .tagline {
  max-width: 60ch;
  font-size: 18px;
  color: var(--ink-soft);
}

.cover-inner { display: flex; align-items: flex-start; gap: 28px; }
.cover-text { flex: 1; min-width: 0; }

.profile-photo {
  width: 110px;
  height: 110px;
  object-fit: cover;
  border: 4px solid #fff;
  outline: 1px solid var(--line);
  border-radius: 2px;
  box-shadow: 3px 4px 0 rgba(33, 29, 26, 0.08);
  transform: rotate(-3deg);
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .cover-inner { flex-direction: column; }
  .profile-photo { width: 90px; height: 90px; }
}

.stamp {
  position: absolute;
  top: 4px;
  right: 4px;
  border: 2px solid var(--amber-ink);
  color: var(--amber-ink);
  padding: 10px 16px;
  border-radius: var(--radius);
  transform: rotate(4deg);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.5;
  text-align: center;
  white-space: nowrap;
}

.stamp .stamp-title { font-size: 11px; letter-spacing: 0.02em; }
.stamp .stamp-client { font-size: 15px; }

@media (max-width: 720px) {
  .stamp { position: static; display: inline-block; transform: rotate(-2deg); margin-top: 16px; }
}

/* --- À propos --- */
.about p { max-width: 68ch; color: var(--ink-soft); }

/* --- Compétences --- */
.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 32px;
}

.skill-cat h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--ink);
}

.skill-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.skill-name { flex: 0 0 auto; min-width: 130px; font-family: 'Source Serif 4', serif; font-size: 15px; }

.skill-bar {
  flex: 1;
  height: 6px;
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.skill-bar-fill {
  height: 100%;
  background: var(--navy);
}

.skill-dots { display: none; }

/* --- Expériences : chronologie de missions --- */
.timeline { position: relative; padding-left: 28px; }

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--line);
}

.mission {
  position: relative;
  padding-bottom: 40px;
}

.mission:last-child { padding-bottom: 0; }

.mission::before {
  content: '';
  position: absolute;
  left: -28px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--navy);
}

.mission.is-current::before { background: var(--green); border-color: var(--green); }

.mission-dates {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 4px;
}

.mission h3 { margin: 0 0 2px; font-size: 19px; }

.mission .mission-meta {
  font-size: 14.5px;
  color: var(--navy-soft);
  font-weight: 500;
  margin-bottom: 10px;
}

.mission p { color: var(--ink-soft); max-width: 68ch; margin: 0 0 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  padding: 4px 9px;
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-soft);
}

/* --- Contact --- */
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 16px;
}
.contact-list a { text-decoration: none; border-bottom: 1px solid var(--line); }
.contact-list a:hover { border-color: var(--navy); }

.contact-icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  color: var(--navy);
}

.badge-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  border: 1.5px solid var(--navy);
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  color: var(--navy);
}

.copy-btn {
  margin-left: 4px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--line);
  background: transparent;
  padding: 2px 9px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--ink-soft);
}
.copy-btn:hover { border-color: var(--navy); color: var(--navy); }
.copy-btn.is-copied { border-color: var(--green); color: var(--green); }

/* --- Responsive --- */
@media (max-width: 860px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 20px 0;
  }
  .tabs { display: flex; overflow-x: auto; padding: 0 12px; }
  .tab { border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; }
  .tab.is-active { border-left-color: transparent; border-bottom-color: var(--amber); }
  .sidebar-tools { margin: 12px 12px 0; }
  .btn-pdf { display: inline-block; margin: 12px 0 0 12px; }
  main { padding: 32px 20px 60px; }
  .cover h1 { font-size: 34px; }
}

/* Accessibilité : focus clavier toujours visible */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.file-label:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* --- Bouton PDF --- */
.btn-pdf {
  display: block;
  margin: 20px 16px 0;
  padding: 9px 14px;
  font-family: 'Space Grotesk', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-accent);
  background: var(--accent-bg);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}
.btn-pdf:hover { background: var(--accent-bg-hover); }

/* --- Impression / export PDF ---
   Le bouton "Télécharger en PDF" déclenche l'impression du navigateur ;
   ces règles nettoient la mise en page pour un rendu "document" propre. */
@media print {
  /* Toujours imprimer en thème clair, même si l'écran est en sombre
     (sélecteur renforcé pour primer sur les règles du thème sombre) */
  :root:root:root {
    --paper: #FFFFFF;
    --paper-alt: #F2F0EA;
    --ink: #000000;
    --ink-soft: #333333;
    --navy: #1F3A5A;
    --navy-soft: #345173;
    --line: #BBBBBB;
    --green: #4B6B4F;
    color-scheme: light;
  }
  .no-print, .blueprint-bg, .stamp, .skip-link { display: none !important; }
  body { font-size: 12.5pt; background: #fff; }
  .layout { display: block; max-width: none; }
  main { padding: 0; }
  section { margin-bottom: 28px; page-break-inside: avoid; }
  .cover { border-bottom: 1px solid #000; }
  .profile-photo { transform: none; box-shadow: none; }
  .copy-btn { display: none; }
  a { color: inherit; text-decoration: none; }
  .timeline::before { background: #999; }
  .mission::before { border-color: #000; background: #fff; }

  /* Barres de compétences : remplacées par des points (le remplissage en
     couleur ne s'imprime pas par défaut dans la plupart des navigateurs) */
  .skill-bar { display: none; }
  .skill-dots {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 3px;
    color: #000;
  }
  .skill-row[data-niveau="1"] .skill-dots::after { content: "\25CF\25CB\25CB\25CB\25CB"; }
  .skill-row[data-niveau="2"] .skill-dots::after { content: "\25CF\25CF\25CB\25CB\25CB"; }
  .skill-row[data-niveau="3"] .skill-dots::after { content: "\25CF\25CF\25CF\25CB\25CB"; }
  .skill-row[data-niveau="4"] .skill-dots::after { content: "\25CF\25CF\25CF\25CF\25CB"; }
  .skill-row[data-niveau="5"] .skill-dots::after { content: "\25CF\25CF\25CF\25CF\25CF"; }
}

/* --- Projets & réalisations --- */
.projets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.projet {
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.projet h3 { margin: 0; font-size: 18px; }
.projet p { margin: 0; color: var(--ink-soft); }
.projet-resultats {
  font-size: 15px;
  border-left: 3px solid var(--green);
  padding-left: 10px;
}
.projet-lien { font-family: 'Space Grotesk', sans-serif; font-size: 14px; font-weight: 500; margin-top: auto; }

/* --- Pied de page, mentions légales, aperçu --- */
.site-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.site-footer a { color: var(--ink-soft); }

.legal-page { max-width: 760px; margin: 0 auto; padding: 48px 20px 80px; }
.legal-page h1 { font-size: 32px; margin: 8px 0 24px; }
.legal-text p { color: var(--ink-soft); }
.legal-text p::first-line { color: var(--ink); font-weight: 600; }
.legal-tools { margin: 32px 0 0; }

.preview-banner {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 10px 16px;
  background: var(--amber-ink);
  color: var(--paper);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}
.preview-banner a { color: inherit; margin-left: 8px; }

/* Garantit que l'attribut hidden l'emporte sur les display des composants */
[hidden] { display: none !important; }

/* Masqué visuellement mais toujours accessible (clavier, lecteurs d'écran) */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
