/* =====================================================================
   Albédo & Feux — feuille de style « presse universitaire »
   Système de design d'après kami : parchemin, encre bleu-nuit,
   serif (Source Serif 4 / Charter), sections numérotées, filets fins.
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400;8..60,500;8..60,600&display=swap');

:root {
  color-scheme: light;

  /* --- Palette kami (académique) --- */
  --parchment: #f5f4ed;   /* fond de page */
  --ivory:     #faf9f5;   /* panneau / conteneur surélevé */
  --sand:      #ece9dd;   /* surface interactive / bouton secondaire */
  --brand:     #1b365d;   /* encre bleu-nuit — unique accent */
  --brand-ink: #16395f;
  --ink:       #16150f;   /* texte principal (presque noir, chaud) */
  --ink-2:     #3d3d3a;   /* texte secondaire */
  --olive:     #504e49;   /* sous-texte / descriptions */
  --stone:     #6b6a64;   /* métadonnées / tertiaire */
  --border:    #ddd9ca;   /* filet principal (chaud) */
  --border-soft:#e6e3d6;  /* filet secondaire */
  --tag-bg:    #eef2f7;   /* fond d'étiquette (bleu très clair, solide) */

  /* --- Alias hérités : les pages avec <style> inline (validation, etc.)
         adoptent automatiquement la nouvelle palette --- */
  --bg:         var(--parchment);
  --surface:    var(--ivory);
  --surface-2:  #efece1;
  --ink-soft:   var(--olive);
  --line:       var(--border);
  --brand-navy: var(--brand);
  --accent:     var(--brand);

  /* --- Typographie --- */
  --serif: "Source Serif 4", Charter, "Charter BT", Georgia, Palatino,
           "Times New Roman", serif;
  --sans: var(--serif);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--serif);
  font-size: 1.0625rem;          /* ~17px, confort de lecture */
  line-height: 1.62;
  color: var(--ink);
  background: var(--parchment);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------------------------------------------------------------- Titres */
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  color: var(--ink);
  margin: 0 0 0.5em;
  line-height: 1.22;
  letter-spacing: 0.002em;
}

h1 { font-size: clamp(1.6rem, 2.6vw, 2.05rem); }
h2 { font-size: clamp(1.2rem, 2vw, 1.42rem); line-height: 1.28; }
h3 { font-size: 1.08rem; font-weight: 600; color: var(--ink-2); }

p, li { color: var(--ink); max-width: 74ch; }

a { color: var(--brand); text-underline-offset: 2px; text-decoration-thickness: 0.6px; }
a:hover { color: var(--brand-ink); }

strong { font-weight: 600; color: var(--ink); }

a:focus-visible, button:focus-visible {
  outline: 2px solid #8ea8c6;
  outline-offset: 2px;
}

/* --------------------------------------------------------------- En-tête */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 244, 237, 0.92);
  backdrop-filter: saturate(140%) blur(6px);
  border-bottom: 1px solid var(--border);
}

.site-header::before {
  content: "";
  display: block;
  height: 2px;
  background: var(--brand);
}

.nav-wrap {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 13px 24px 12px;
}

.brand-line {
  margin: 0 0 9px;
  color: var(--stone);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.96rem;
  font-weight: 500;
  padding: 3px 0;
  border-bottom: 1.5px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.nav a:hover { color: var(--brand); border-bottom-color: var(--border); }

.nav a[aria-current="page"] {
  color: var(--brand);
  border-bottom-color: var(--brand);
}

/* ----------------------------------------- Sélecteur de langue FR / EN */
.lang-switch {
  position: absolute;
  top: 12px;
  right: 24px;
  display: flex;
  gap: 2px;
  z-index: 30;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.lang-switch a {
  padding: 3px 8px;
  border-radius: 4px;
  color: var(--stone);
  text-decoration: none;
  border: 1px solid transparent;
}
.lang-switch a:hover { color: var(--brand); }
.lang-switch a[aria-current="true"] { background: var(--brand); color: var(--ivory); }

/* -------------------------------------------------------------- Conteneur */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px 24px 64px;
}

/* ------------------------------------------------------------ Bloc-titre */
.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(240px, 0.7fr);
  gap: 30px;
  align-items: start;
  margin-bottom: 30px;
}
.page-hero.single { grid-template-columns: 1fr; }

.project-title {
  max-width: 26ch;
  font-size: clamp(1.9rem, 3.4vw, 2.55rem);
  line-height: 1.14;
  letter-spacing: -0.004em;
  text-wrap: balance;
  padding-bottom: 0.5em;
  border-bottom: 2px solid var(--brand);
  margin-bottom: 0.7em;
}
.page-hero.single .project-title { max-width: 30ch; }

.lead {
  margin: 0 0 0.2em;
  max-width: 68ch;
  color: var(--olive);
  font-size: 1.16rem;
  line-height: 1.5;
}

/* Bloc d'identification académique (programme / auteur / direction) */
.academic-meta {
  margin: 18px 0 16px;
  padding: 4px 0 4px 16px;
  border-left: 2.5px solid var(--brand);
}
.academic-meta p {
  margin: 3px 0;
  max-width: none;
  color: var(--olive);
  font-size: 0.95rem;
  line-height: 1.45;
}
.academic-meta strong { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------- Conteneurs/cartes */
.card {
  background: var(--ivory);
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  padding: 22px 24px;
}
.card p:last-child,
.card ul:last-child,
.card ol:last-child { margin-bottom: 0; }

.page-hero .card { background: transparent; border: none; border-radius: 0; padding: 0; }

/* Image de couverture */
.hero-photo {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: 4px;
}
.qr-wrap { text-align: center; background: transparent; }

/* ------------------------------------- Pages de contenu : sections réglées
   « filets fins au lieu de boîtes » + numérotation § auto */
.section-stack { display: grid; gap: 0; counter-reset: sec; }

.section-stack .card {
  background: transparent;
  border: none;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 28px 0 6px;
}
.section-stack .card:first-child { border-top: none; padding-top: 6px; }

.section-stack .card > h2 {
  margin-bottom: 0.5em;
}
.section-stack .card > h2::before {
  counter-increment: sec;
  content: "§ " counter(sec) "\00a0\00a0\00a0";
  color: var(--brand);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Grille de sections (accueil) : panneaux ivoire discrets */
.section-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.section-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.section-stack { /* already set */ }

/* --------------------------------------------------------------- Listes */
ol.pipeline { margin: 0; padding-left: 1.3rem; }
ol.pipeline li { margin-bottom: 0.55rem; padding-left: 0.2rem; }
ol.pipeline li::marker { color: var(--brand); font-variant-numeric: tabular-nums; }

ul.clean { margin: 0; padding-left: 1.15rem; }
ul.clean li { margin-bottom: 0.5rem; }
ul.clean li::marker { color: var(--brand); }

/* ----------------------------------------------------- Étiquettes / puces */
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  color: var(--brand);
  background: var(--ivory);
  border-radius: 3px;
  padding: 4px 9px;
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.01em;
}

.tech-chip {
  display: inline-block;
  padding: 0.5px 6px;
  border-radius: 2px;
  background: var(--tag-bg);
  color: var(--brand);
  font-size: 0.86em;
  font-weight: 500;
  white-space: nowrap;
}

/* --------------------------------------------------------------- Boutons */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 4px;
  border: 1px solid transparent;
  padding: 9px 16px;
  font-size: 0.96rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.button-primary { color: var(--ivory); background: var(--brand); border-color: var(--brand); }
.button-primary:hover { background: #14283f; }
.button-secondary { color: var(--ink-2); background: var(--sand); border-color: var(--border); }
.button-secondary:hover { background: #e3dfcf; color: var(--brand); }

.button-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* ---------------------------------------------------------------- Divers */
.section-stack-spacer, section[style] { /* keep inline-spaced sections tidy */ }

.hint { color: var(--stone); font-size: 0.95rem; }

.footer {
  margin-top: 34px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--stone);
  font-size: 0.85rem;
}

/* ---------------------------------------------------------- QR (legacy) */
img.qr {
  display: block;
  margin: 0 auto 10px;
  width: min(100%, 220px);
  height: auto;
  border: 1px solid var(--border);
  padding: 8px;
  background: var(--ivory);
}

/* --------------------------------------------------------- Responsive */
@media (max-width: 900px) {
  .container { padding: 24px 16px 48px; }
  .page-hero,
  .section-grid,
  .section-grid.two { grid-template-columns: 1fr; }
  .page-hero { gap: 20px; }
  .card { padding: 18px; }
  .section-stack .card { padding: 22px 0 4px; }
  .nav-wrap { padding-inline: 16px; }
  .nav { gap: 14px; }
  .project-title { max-width: none; }
}

@media (max-width: 640px) {
  .lang-switch { top: 10px; right: 14px; }
  .nav { gap: 11px; }
  .nav a { font-size: 0.9rem; }
}

/* ===================================================================
   GREFFE LaTeX.css / Tufte — notes en marge + environnements théorème
   (skin kami : parchemin, encre bleu-nuit, Source Serif)
   =================================================================== */
.section-stack { counter-reset: sec sidenote; }

/* appel de note dans le texte */
.sn-ref { counter-increment: sidenote; }
.sn-ref::after {
  content: counter(sidenote);
  color: var(--brand); font-weight: 600;
  font-size: 0.68em; vertical-align: super; line-height: 0;
  margin-left: 1px;
}
.sidenote { font-size: 0.82rem; line-height: 1.46; color: var(--olive); }
.sidenote::before {
  content: counter(sidenote) "  ";
  color: var(--brand); font-weight: 600;
  font-size: 0.72em; vertical-align: super; line-height: 0;
}
.sidenote strong { color: var(--ink-2); }

/* Bureau : colonne de lecture resserrée + note flottant dans la marge droite */
@media (min-width: 1000px) {
  .section-stack.has-sn { max-width: 62%; }
  .section-stack.has-sn .sidenote {
    float: right; clear: right;
    width: 56%; margin-right: -64%;
    margin-top: 0.15rem; margin-bottom: 0.55rem;
  }
}
/* Mobile : note en bloc indenté juste après l'appel */
@media (max-width: 999px) {
  .sidenote {
    display: block; margin: 0.45rem 0 0.85rem;
    padding-left: 0.9rem; border-left: 2px solid var(--border);
  }
}

/* Environnements « théorème » (hypothèses) — façon LaTeX, sans boîte */
.env { margin: 0.55rem 0; }
.env-label { font-weight: 600; color: var(--brand); margin-right: 0.4em; }
.env-body { color: var(--ink); }

/* Question de recherche mise en exergue (façon abstract) */
.research-q {
  margin: 0.3rem 0 0; padding: 14px 18px;
  background: var(--ivory); border: 1px solid var(--border-soft);
  border-left: 3px solid var(--brand); border-radius: 0 4px 4px 0;
  font-size: 1.05rem; color: var(--ink); max-width: 68ch;
}

/* ===================================================================
   SITE PERSONNEL — Accueil (à propos) + Projets
   =================================================================== */
.profile { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 30px; align-items: start; margin: 4px 0 8px; }
.avatar {
  width: 150px; height: 150px; border-radius: 50%;
  background: var(--sand); border: 1px solid var(--border);
  display: grid; place-items: center; overflow: hidden;
  font-size: 2.4rem; font-weight: 600; color: var(--brand); letter-spacing: 0.02em;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: clamp(1.7rem, 3vw, 2.3rem); margin: 0 0 0.12em; line-height: 1.12; }
.profile-tagline { color: var(--olive); font-size: 1.12rem; margin: 0 0 0.7em; max-width: 60ch; }
.profile-bio { margin: 0.4em 0; max-width: 64ch; }
.interests { display: flex; flex-wrap: wrap; gap: 7px; margin: 14px 0 4px; }
.links-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }

.lede-grid { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0,1fr)); margin-top: 8px; }
.lede-card { background: var(--ivory); border: 1px solid var(--border-soft); border-radius: 6px; padding: 18px 20px; }
.lede-card h3 { margin: 0 0 0.3em; }
.lede-card p { margin: 0 0 0.7em; color: var(--olive); font-size: 0.95rem; max-width: none; }
.lede-card a.more { font-size: 0.92rem; font-weight: 500; text-decoration: none; }
.lede-card a.more::after { content: " \2192"; }

/* Projets — vitrine GitHub */
.proj-group { margin-top: 26px; }
.proj-group > h2 { border-left: 3px solid var(--brand); padding-left: 12px; }
.proj-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.proj-card { background: var(--ivory); border: 1px solid var(--border-soft); border-radius: 6px; padding: 15px 17px; display: flex; flex-direction: column; gap: 5px; }
.proj-card h3 { margin: 0; font-size: 1.04rem; }
.proj-card h3 a { text-decoration: none; }
.proj-card h3 a:hover { text-decoration: underline; }
.proj-card p { margin: 0; color: var(--olive); font-size: 0.92rem; line-height: 1.45; max-width: none; flex: 1; }
.proj-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; font-size: 0.78rem; color: var(--stone); }
.proj-lang { display: inline-flex; align-items: center; gap: 5px; }
.proj-lang::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); display: inline-block; }
.proj-star { color: var(--brand); font-weight: 600; }

@media (max-width: 760px) {
  .profile { grid-template-columns: 1fr; gap: 16px; }
  .avatar { width: 110px; height: 110px; font-size: 1.9rem; }
  .lede-grid, .proj-grid { grid-template-columns: 1fr; }
}

/* ===================================================================
   CV — entrées avec colonne date, sections, compétences
   =================================================================== */
.cv-section { margin-top: 30px; }
.cv-section > h2 { border-left: 3px solid var(--brand); padding-left: 12px; margin-bottom: 14px; }
.cv-entry { display: grid; grid-template-columns: 168px minmax(0,1fr); gap: 22px; padding: 12px 0; border-top: 1px solid var(--border-soft); }
.cv-entry:first-of-type { border-top: none; }
.cv-date { color: var(--stone); font-size: 0.88rem; font-variant-numeric: tabular-nums; padding-top: 2px; }
.cv-body h3 { margin: 0 0 0.12em; font-size: 1.05rem; }
.cv-org { color: var(--olive); font-size: 0.95rem; margin: 0 0 0.35em; }
.cv-body p { margin: 0.25em 0; max-width: 70ch; }
.cv-body ul.clean { margin-top: 0.3em; }

.todo { color: #9a6a00; background: #fbf3db; border: 1px solid #ecd9a0; border-radius: 3px; padding: 0 6px; font-size: 0.85em; font-weight: 500; }
.todo-line { color: #9a6a00; font-style: normal; }

.skill-block { margin: 4px 0 14px; }
.skill-block h3 { margin: 0 0 0.3em; font-size: 0.95rem; color: var(--ink-2); }
.skill-list { display: flex; flex-wrap: wrap; gap: 7px; }

.award-card { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 20px; padding: 16px 0; border-top: 1px solid var(--border-soft); }
.award-card:first-of-type { border-top: none; }
.award-year { color: var(--brand); font-weight: 600; font-size: 1.0rem; font-variant-numeric: tabular-nums; }
.award-body h3 { margin: 0 0 0.15em; font-size: 1.06rem; }
.award-body .cv-org { margin-bottom: 0.3em; }
.status-pill { display:inline-block; font-size:0.74rem; font-weight:600; letter-spacing:0.03em; text-transform:uppercase; padding:2px 8px; border-radius:9999px; }
.status-ok { background:#e7f0e7; color:#2f6b34; border:1px solid #cfe3cf; }
.status-pending { background:#fbf3db; color:#8a5d00; border:1px solid #ecd9a0; }

@media (max-width: 760px) {
  .cv-entry, .award-card { grid-template-columns: 1fr; gap: 4px; }
  .cv-date { padding-top: 0; }
}

/* ===================================================================
   ACCUEIL façon al-folio (dans la palette kami)
   profil + photo droite · icônes sociales · actualités · travaux
   =================================================================== */
.al-profile {
  display: grid;
  grid-template-columns: minmax(0,1fr) 250px;
  gap: 40px;
  align-items: start;
  margin: 6px 0 8px;
}
.al-intro .profile-name { font-size: clamp(1.9rem, 3.2vw, 2.5rem); margin-bottom: 0.1em; }
.al-intro .profile-tagline { color: var(--olive); font-size: 1.12rem; margin: 0 0 0.8em; }
.al-photo-wrap { position: relative; }
.al-photo {
  width: 250px; height: 300px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border);
  background: var(--sand);
  display: grid; place-items: center; color: var(--brand);
  font-size: 3.4rem; font-weight: 600; letter-spacing: 0.02em;
}
.al-photo-cap { margin-top: 8px; font-size: 0.82rem; color: var(--stone); line-height: 1.4; text-align: center; }

/* Icônes sociales */
.socials { display: flex; flex-wrap: wrap; gap: 16px; margin: 16px 0 2px; }
.socials a { color: var(--stone); display: inline-flex; transition: color 0.15s, transform 0.15s; }
.socials a:hover { color: var(--brand); transform: translateY(-1px); }
.socials svg { width: 22px; height: 22px; fill: currentColor; display: block; }

/* Fil Actualités */
.news-list { margin: 6px 0 0; }
.news-item {
  display: grid; grid-template-columns: 132px minmax(0,1fr); gap: 18px;
  padding: 11px 0; border-top: 1px solid var(--border-soft);
}
.news-item:first-child { border-top: none; }
.news-date { color: var(--stone); font-size: 0.9rem; font-variant-numeric: tabular-nums; padding-top: 1px; }
.news-body { margin: 0; max-width: none; }
.news-body .tag-new { color: var(--brand); font-weight: 600; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em; margin-right: 6px; }

/* Travaux choisis (selected work) */
.work-list { display: grid; gap: 0; margin-top: 6px; }
.work-item {
  display: grid; grid-template-columns: 64px minmax(0,1fr) auto; gap: 18px; align-items: center;
  padding: 14px 0; border-top: 1px solid var(--border-soft);
}
.work-item:first-child { border-top: none; }
.work-thumb {
  width: 64px; height: 64px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface-2); display: grid; place-items: center;
  color: var(--brand); font-weight: 600; font-size: 0.8rem; text-align: center; line-height: 1.1;
}
.work-main h3 { margin: 0 0 0.15em; font-size: 1.04rem; }
.work-main h3 a { text-decoration: none; }
.work-main h3 a:hover { text-decoration: underline; }
.work-main p { margin: 0; color: var(--olive); font-size: 0.92rem; max-width: 64ch; }
.work-tag { color: var(--stone); font-size: 0.8rem; white-space: nowrap; }
.work-star { color: var(--brand); font-weight: 600; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 32px 0 10px; }
.section-head h2 { margin: 0; border-left: 3px solid var(--brand); padding-left: 12px; }
.section-head a { font-size: 0.92rem; text-decoration: none; white-space: nowrap; }
.section-head a::after { content: " \2192"; }

@media (max-width: 820px) {
  .al-profile { grid-template-columns: 1fr; gap: 22px; }
  .al-photo-wrap { max-width: 220px; }
  .al-photo { width: 100%; height: 250px; }
  .news-item { grid-template-columns: 1fr; gap: 2px; }
  .work-item { grid-template-columns: 48px minmax(0,1fr); }
  .work-item .work-tag { grid-column: 2; }
  .work-thumb { width: 48px; height: 48px; font-size: 0.68rem; }
}
