/* ── Variables ── */
:root {
  --primary: #1e6c93;
  --primary-light: #e8f3f9;
  --primary-mid: #b3d4e8;
  --text: #3c3c3c;
  --text-light: #666;
  --bg: #fff;
  --border: #dde8ef;
  --max-width: 960px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Cascadia Code", "Fira Mono", "Source Code Pro", Consolas, monospace;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; border-top: 4px solid var(--primary); display: flex; flex-direction: column; min-height: 100vh; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ── Layout ── */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 2rem; }

/* ── Site header ── */
.site-header { background: var(--primary); }
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-top: 0.65rem;
  padding-bottom: 0.65rem;
  flex-wrap: wrap;
}
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.site-logo img { border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); }
.site-logo:hover { text-decoration: none; opacity: 0.9; }

/* ── Navigation ── */
.site-nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.15rem; align-items: center; }
.site-nav > ul > li { position: relative; }
.site-nav > ul > li > a {
  display: block;
  padding: 0.4rem 0.7rem;
  color: rgba(255,255,255,0.9);
  border-radius: 4px;
  font-size: 0.875rem;
}
.site-nav > ul > li > a:hover,
.site-nav > ul > li.active > a {
  background: rgba(255,255,255,0.15);
  text-decoration: none;
  color: #fff;
}

/* Dropdown */
.site-nav .sub-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 150px;
  z-index: 100;
  padding: 0.35rem 0;
}
.site-nav .has-children:hover .sub-menu,
.site-nav .has-children:focus-within .sub-menu { display: block; }
.site-nav .sub-menu li a {
  display: block;
  padding: 0.4rem 1rem;
  color: var(--text);
  font-size: 0.85rem;
  white-space: nowrap;
}
.site-nav .sub-menu li a:hover { background: var(--primary-light); color: var(--primary); text-decoration: none; }

/* ── Page header ── */
.page-header { background: var(--primary-light); border-bottom: 2px solid var(--primary-mid); padding: 1.5rem 0; }
.page-header .container { display: flex; align-items: center; gap: 1.25rem; }
.page-header-img { width: 64px; height: 64px; object-fit: contain; flex-shrink: 0; }
.page-header h1 { font-size: 1.55rem; font-weight: 700; color: var(--primary); line-height: 1.3; }
.page-header .page-desc { font-size: 0.9rem; color: var(--text-light); margin-top: 0.2rem; }
.page-meta { font-size: 0.78rem; color: var(--text-light); margin-top: 0.2rem; }

/* ── Breadcrumb ── */
.breadcrumb { background: var(--bg); border-bottom: 1px solid var(--border); padding: 0.45rem 0; font-size: 0.78rem; }
.breadcrumb .container { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; color: var(--text-light); }
.breadcrumb a { color: var(--primary); }
.breadcrumb-sep { color: #bbb; }
.breadcrumb-current { color: var(--text); font-weight: 500; }

/* ── Main ── */
main { padding: 2.25rem 0 3rem; flex: 1; }
.main-content { max-width: var(--max-width); margin: 0 auto; padding: 0 2rem; }

/* ── Article content ── */
.article-body { line-height: 1.75; }

.article-body h1 {
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.3;
  margin-bottom: 0.35rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--primary);
}

.article-body h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.35rem;
  margin: 2rem 0 1rem;
}
.article-body h3 { font-size: 1.05rem; font-weight: 700; color: var(--text); margin: 1.5rem 0 0.65rem; }
.article-body h4 { font-size: 0.95rem; font-weight: 700; margin: 1.25rem 0 0.5rem; }
.article-body p { margin-bottom: 1rem; }
.article-body ul, .article-body ol { padding-left: 1.5rem; margin-bottom: 1rem; }
.article-body li { margin-bottom: 0.2rem; }

/* Inline code */
.article-body p code,
.article-body li code,
.article-body h2 code,
.article-body h3 code {
  font-family: var(--mono);
  font-size: 0.875em;
  background: var(--primary-light);
  border: 1px solid var(--primary-mid);
  border-radius: 3px;
  padding: 0.1rem 0.3rem;
}

/* Block code (direct child of article-body, not inside p/li/h) */
.article-body > code {
  display: block;
  font-family: var(--mono);
  font-size: 0.875em;
  white-space: pre;
  overflow-x: auto;
  background: #1e2533;
  color: #e8eaf0;
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 0.75rem 0 1.25rem;
  line-height: 1.55;
}

/* kbd — command to type */
.article-body kbd {
  display: block;
  font-family: var(--mono);
  font-size: 0.875em;
  white-space: pre;
  overflow-x: auto;
  background: #f5f7fa;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 0 6px 6px 0;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0 1.25rem;
  line-height: 1.55;
  color: var(--text);
}

/* samp — program output */
.article-body samp {
  display: block;
  font-family: var(--mono);
  font-size: 0.875em;
  white-space: pre;
  overflow-x: auto;
  background: #1e2533;
  color: #7dff9c;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0 1.25rem;
  line-height: 1.55;
}

/* pre (preformatted descriptions) */
.article-body pre {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--primary-light);
  border: 1px solid var(--primary-mid);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0 1.25rem;
  overflow-x: auto;
  line-height: 1.55;
  color: var(--text);
  white-space: pre;
}

/* Note italique en intro */
.article-body > p:first-child > em:only-child,
.article-note {
  display: block;
  background: #fffbea;
  border-left: 4px solid #f0c040;
  padding: 0.75rem 1rem;
  border-radius: 0 4px 4px 0;
  margin-bottom: 1.5rem;
  font-style: italic;
  color: #6a5a00;
}

/* ── Article list (category pages) ── */
.article-list { display: flex; flex-direction: column; gap: 1.25rem; }

.article-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.article-card:hover {
  border-color: var(--primary-mid);
  box-shadow: 0 2px 10px rgba(30,108,147,0.1);
  text-decoration: none;
}
.article-card img { width: 90px; height: 90px; object-fit: contain; border-radius: 4px; flex-shrink: 0; }
.article-card-body { flex: 1; }
.article-card-body h2 { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 0.35rem; }
.article-card-body p { font-size: 0.875rem; color: var(--text-light); line-height: 1.55; }
.article-card-meta { font-size: 0.75rem; color: var(--text-light); margin-top: 0.4rem; }

.empty-category {
  color: var(--text-light);
  font-style: italic;
  background: var(--primary-light);
  border-radius: 4px;
  padding: 1rem 1.25rem;
}

/* ── Category intro ── */
.category-intro {
  font-size: 0.95rem;
  background: var(--primary-light);
  border-left: 4px solid var(--primary);
  padding: 0.75rem 1rem;
  border-radius: 0 4px 4px 0;
  margin-bottom: 1.5rem;
  color: var(--text);
}

/* ── Sub-categories grid ── */
.subcategory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.subcategory-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  text-align: center;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.subcategory-card:hover {
  border-color: var(--primary-mid);
  box-shadow: 0 2px 8px rgba(30,108,147,0.1);
  text-decoration: none;
}
.subcategory-card img { width: 48px; height: 48px; object-fit: contain; }
.subcategory-card span { font-size: 0.875rem; font-weight: 600; color: var(--primary); }

/* ── CV ── */
.cv-tagline { font-size: 1rem; color: var(--text-light); margin-bottom: 2rem; }

/* Timeline (expériences) */
.timeline { display: flex; flex-direction: column; gap: 2rem; }
.timeline-item { display: grid; grid-template-columns: 120px 1fr; gap: 1rem; }
.timeline-date { font-size: 0.8rem; color: var(--text-light); padding-top: 0.2rem; }
.timeline-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.2rem; }
.employer { font-size: 0.875rem; font-weight: 600; color: var(--primary); margin-bottom: 0.15rem; }
.client { font-size: 0.8rem; color: var(--text-light); margin-bottom: 0.5rem; }
.timeline-body ul { padding-left: 1.25rem; margin-bottom: 0.75rem; }
.timeline-body li { font-size: 0.875rem; margin-bottom: 0.2rem; }

/* Tags (techno) */
.tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.tag { font-size: 0.75rem; background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-mid); border-radius: 3px; padding: 0.15rem 0.5rem; white-space: nowrap; }

/* Formation */
.formation-item { display: grid; grid-template-columns: 120px 1fr; gap: 1rem; }
.formation-year { font-size: 0.8rem; color: var(--text-light); padding-top: 0.2rem; }
.formation-body h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.2rem; }
.formation-body p { font-size: 0.875rem; color: var(--text-light); }

/* Compétences */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.25rem; }
.skill-group h3 { font-size: 0.875rem; font-weight: 700; margin-bottom: 0.35rem; }

/* Langues & Qualités */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.langue-item { display: flex; justify-content: space-between; font-size: 0.875rem; padding: 0.25rem 0; border-bottom: 1px solid var(--border); }
.langue-level { color: var(--text-light); }
.qualites-list { display: flex; flex-wrap: wrap; gap: 0.4rem; align-content: flex-start; }
.qualite-tag { font-size: 0.75rem; background: var(--primary-light); color: var(--primary); border: 1px solid var(--primary-mid); border-radius: 3px; padding: 0.15rem 0.5rem; }

@media (max-width: 680px) {
  .timeline-item, .formation-item { grid-template-columns: 1fr; gap: 0.25rem; }
  .two-col { grid-template-columns: 1fr; }
}

/* ── Liens page ── */
.links-section { margin-bottom: 2rem; }
.links-section h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.3rem;
  margin-bottom: 0.75rem;
}
.links-section p { font-size: 0.9rem; margin-bottom: 0.5rem; }
.links-section a { color: var(--primary); font-weight: 500; }
.links-section ul { padding-left: 1.5rem; font-size: 0.9rem; }

/* ── Honeypot anti-spam ── */
.hp-field { position: absolute; left: -9999px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ── Contact form ── */
.contact-form { max-width: 540px; margin-top: 1.5rem; }
.form-group { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1.25rem; }
.form-group label { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.form-group .required { color: var(--primary); }
.form-group input,
.form-group textarea {
  font-family: var(--font);
  font-size: 0.9rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,108,147,0.12);
}
.form-group textarea { resize: vertical; min-height: 140px; }
.btn-submit {
  font-family: var(--font);
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 4px;
  padding: 0.6rem 1.5rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-submit:hover { background: #155a7a; }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.form-status { margin-top: 0.75rem; font-size: 0.875rem; min-height: 1.4em; }
.form-status--ok    { color: #1a7a3f; font-weight: 600; }
.form-status--error { color: #c0392b; }

/* ── Footer ── */
.site-footer {
  background: var(--primary);
  color: rgba(255,255,255,0.85);
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.82rem;
}
.site-footer nav { display: flex; justify-content: center; gap: 1.5rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.site-footer nav a { color: rgba(255,255,255,0.9); font-weight: 500; }
.site-footer nav a:hover { color: #fff; text-decoration: underline; }
.site-footer p { color: rgba(255,255,255,0.75); }
.site-footer p a { color: #fff; text-decoration: underline; }

/* ── Print ── */
@media print {
  * { box-shadow: none !important; text-shadow: none !important; }
  body { border-top: none; min-height: unset; font-size: 11pt; color: #000; background: #fff; }
  .site-header, .site-footer, .breadcrumb, .page-header { display: none !important; }
  main { padding: 0; }
  .main-content { padding: 0; max-width: 100%; }
  a { color: #000; text-decoration: none; }
  .cv-tagline { color: #444; margin-bottom: 1rem; }
  .article-body h2 { color: #000; border-bottom-color: #000; margin: 1.2rem 0 0.6rem; font-size: 12pt; }
  .article-body h3 { font-size: 11pt; margin: 0.8rem 0 0.3rem; }
  .tag, .qualite-tag { border: 1px solid #999; background: none; color: #000; padding: 0.1rem 0.35rem; font-size: 9pt; }
  .tags { gap: 0.3rem; margin-top: 0.3rem; }
  .timeline { gap: 1rem; }
  .timeline-item { grid-template-columns: 100px 1fr; gap: 0.5rem; page-break-inside: avoid; }
  .timeline-date { font-size: 9pt; }
  .employer { color: #000; }
  .client { font-size: 9pt; }
  .timeline-body ul { margin-bottom: 0.4rem; }
  .timeline-body li { font-size: 10pt; margin-bottom: 0.1rem; }
  .article-body h2 { break-after: avoid; }
  .formation-item { grid-template-columns: 100px 1fr; gap: 0.5rem; break-inside: avoid; }
  .skills-grid { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
  .skill-group h3 { font-size: 10pt; }
  .langue-item { font-size: 10pt; border-bottom-color: #ccc; }
  .two-col { gap: 1rem; }
  @page { margin: 1.5cm 1.5cm 1.5cm 1.5cm; }
}

/* ── Responsive ── */
@media (max-width: 680px) {
  .container { padding: 0 1rem; }
  .site-header .container { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .page-header h1 { font-size: 1.25rem; }
  .page-header-img { width: 48px; height: 48px; }
  .article-card { grid-template-columns: 1fr; }
  .article-card img { width: 60px; height: 60px; }
  .site-nav > ul > li > a { padding: 0.3rem 0.5rem; font-size: 0.82rem; }
}
