/* ─────────────────────────────────────────────────────────────
   CV SITE — GLOBAL STYLES
   Theme  : Light & Academic
   Fonts  : Lora (headings / body serif) + Source Sans 3 (UI)
            + JetBrains Mono (tags / code)
   Palette: Off-white background · Navy blue accents · Warm text
───────────────────────────────────────────────────────────── */

:root {
  --bg:          #f7f5f0;
  --surface:     #ffffff;
  --border:      #ddd9d0;
  --border-soft: #e8e4dc;
  --navy:        #1a2e4a;
  --navy-mid:    #2a4570;
  --navy-light:  #3d6491;
  --accent:      #1a2e4a;
  --text:        #2c2825;
  --text-mid:    #4a443d;
  --text-muted:  #7a7168;
  --text-faint:  #b0a898;
  --radius:      3px;
  --card-shadow: 0 1px 4px rgba(26,46,74,0.06), 0 4px 16px rgba(26,46,74,0.04);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Source Sans 3', 'Helvetica Neue', sans-serif;
  font-size: 1.05rem;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── LANGUAGE BAR ── */
.lang-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 2.5rem;
  background: var(--navy);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.lang-sep { color: rgba(255,255,255,0.3); font-size: 0.75rem; }

.lang-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  color: rgba(255,255,255,0.45);
  padding: 0.15rem 0.35rem;
  border-radius: 2px;
  transition: color 0.15s, background 0.15s;
}
.lang-btn:hover { color: #fff; }
.lang-btn.active {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

/* ── NAVIGATION ── */
nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 2px solid var(--navy);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2.5rem;
  height: 52px;
  box-shadow: 0 2px 8px rgba(26,46,74,0.07);
}

.nav-name {
  font-family: 'Lora', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: 0.01em;
  text-decoration: none;
  transition: color 0.15s;
}
a.nav-name:hover { color: var(--navy-light); }

nav ul {
  list-style: none;
  display: flex;
  gap: 0;
}

nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  padding: 0 1.1rem;
  line-height: 52px;
  display: block;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

/* nav-name is not a nav link, reset line-height so it doesn't blow up when wrapping */
a.nav-name {
  line-height: 1.25;
  padding: 0;
  border-bottom: none;
  margin-bottom: 0;
}

nav a:hover { color: var(--navy-mid); }
nav a.active {
  color: var(--navy);
  font-weight: 600;
  border-bottom-color: var(--navy);
}

/* ── MAIN ── */
main {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 3.5rem 2rem 6rem;
}

/* ── HERO ── */
.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3rem;
  align-items: start;
  padding-bottom: 3rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 3.5rem;
}

.hero-photo {
  width: 130px;
  height: 160px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--border-soft);
}
.hero-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

.photo-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  color: var(--text-faint);
}

.hero-text h1 {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  font-weight: 600;
  color: var(--navy);
  line-height: 1.15;
  margin-bottom: 0.35rem;
}

.tagline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--navy-light);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.bio {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  color: var(--text-mid);
  margin-bottom: 1.75rem;
  line-height: 1.75;
}
.bio strong { color: var(--navy); font-weight: 600; }

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}
.contact-links a {
  font-size: 0.82rem;
  color: var(--navy-light);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}
.contact-links a:hover {
  color: var(--navy);
  border-color: var(--navy);
}

.cv-pdf-link {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.06em;
  background: var(--navy);
  color: #fff !important;
  border: none !important;
  padding: 0.3rem 0.75rem !important;
  border-radius: var(--radius);
  transition: background 0.15s !important;
}
.cv-pdf-link:hover { background: var(--navy-mid) !important; color: #fff !important; }

/* ── HERO STATS ── */
.hero-stats {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.75rem;
  padding: 1rem 0;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.hero-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hero-stat-value {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1;
}

.hero-stat-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  text-transform: uppercase;
  margin-top: 0.2rem;
}

/* ── SECTION LABEL ── */
.section-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--navy-light);
  margin-bottom: 1.5rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* ── TIMELINE ── */
.timeline-section { margin-bottom: 3.5rem; }

.timeline { display: flex; flex-direction: column; }

.timeline-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.timeline-item:last-child { border-bottom: none; }

.timeline-left {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding-top: 2px;
}

.timeline-date {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

/* Logo container in timeline */
.timeline-logo {
  width: 100%;
  max-width: 140px;
  height: 56px;
  display: flex;
  align-items: center;
}

.timeline-logo img {
  max-width: 100%;
  max-height: 56px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: left center;
  filter: grayscale(20%) opacity(0.85);
}



/* Shown only when logo fails to load */
.logo-fallback {
  display: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy-mid);
}

/* Ajustements par logo */
.logo-esilv { max-height: 70px; }
.logo-ens   { max-height: 38px; }

.timeline-content h3 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.35rem;
}

.timeline-content p {
  font-size: 0.93rem;
  color: var(--text-muted);
  line-height: 1.65;
}

/* ── SKILLS ── */
.skills-section { margin-bottom: 3.5rem; }

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

/* Languages card spans full width */
.skills-grid .skill-group:last-child {
  grid-column: 1 / -1;
}

.skill-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--navy-light);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}

.skill-group h4 {
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--navy-mid);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
}

.skill-group p {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.6;
}

/* ── PAGE TITLE (inner pages) ── */
.page-title {
  font-family: 'Lora', Georgia, serif;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.page-intro {
  font-size: 0.97rem;
  color: var(--text-muted);
  max-width: 580px;
  margin-bottom: 2.5rem;
}

.section-subtitle {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--navy-light);
  margin: 2.5rem 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* ── CARDS (publications / projects) ── */
.card {
  display: grid;
  grid-template-columns: 275px 1fr;
  gap: 2rem;
  padding: 2rem 0;
  border-bottom: 1px solid var(--border-soft);
  align-items: start;
}
.card:last-child { border-bottom: none; }

/* Projects: 3-column layout  image | logo | text */
.card.card-with-logo {
  grid-template-columns: 275px 1fr 80px;
  gap: 1.5rem;
}

.card-logo-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding-top: 0.25rem;
  gap: 0.75rem;
}

.card-logo-col img {
  max-width: 100px;
  max-height: 60px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: none;
}

.card-image {
  width: 275px;
  height: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--border-soft);
  flex-shrink: 0;
}

.card-image-clickable {
  cursor: zoom-in;
  transition: opacity 0.15s, box-shadow 0.15s;
}
.card-image-clickable:hover {
  opacity: 0.88;
  box-shadow: 0 2px 12px rgba(26,46,74,0.18);
}
.card-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── IMAGE CAPTION ── */
.card-caption {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.57rem;
  line-height: 1.45;
  color: var(--text-faint);
  letter-spacing: 0.02em;
  margin-top: 0.4rem;
  max-width: 275px;
  font-style: italic;
}

/* Centre verticalement la colonne image sur desktop */
.card > div:first-child,
.card-image-col { align-self: center; }

/* ── CARD IMAGE COLUMN (image + caption wrapper) ── */
.card-image-col {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

/* ── CARD IMAGE LINK (publications — click to open PDF) ── */
.card-image-link {
  display: block;
  border-radius: var(--radius);
  transition: opacity 0.15s, box-shadow 0.15s;
}
.card-image-link:hover {
  opacity: 0.88;
  box-shadow: 0 2px 12px rgba(26,46,74,0.18);
}
.card-image-link .card-image {
  border: 1px solid var(--border);
}

/* ── PDF BUTTON ── */
.card-link-pdf {
  font-family: 'JetBrains Mono', monospace !important;
  font-size: 0.68rem !important;
  color: var(--navy-mid) !important;
  background: #e8eef5;
  border: 1px solid #c5d3e0 !important;
  border-radius: 2px;
  padding: 0.1rem 0.45rem;
  letter-spacing: 0.04em;
  transition: background 0.15s, color 0.15s !important;
}
.card-link-pdf:hover {
  background: var(--navy-light) !important;
  color: #fff !important;
  border-color: var(--navy-light) !important;
}

/* ── LIGHTBOX ── */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,16,26,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  cursor: zoom-out;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius);
  box-shadow: 0 8px 48px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.5rem;
  background: none;
  border: 1px solid rgba(255,255,255,0.3);
  color: rgba(255,255,255,0.8);
  font-size: 1rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.lightbox-close:hover { background: rgba(255,255,255,0.15); }

.img-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--border-soft) 0%, var(--border) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-placeholder::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 1px solid var(--text-faint);
  border-radius: 2px;
  opacity: 0.4;
}

/* ── VIDEO CARDS ── */
.card-video {
  position: relative;
  background: #0a0a0a; /* dark bg suits most simulation outputs */
}

.card-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}

/* Subtle "▶ video" badge */
.card-video::after {
  content: '▶ mp4';
  position: absolute;
  bottom: 6px;
  right: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.6rem;
  color: rgba(255,255,255,0.55);
  letter-spacing: 0.06em;
  pointer-events: none;
}

/* ── CARD LOGOS ── */
.card-logos {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.6rem;
}

.card-logos img {
  max-height: 32px;
  max-width: 100px;
  width: auto;
  height: auto;
  object-fit: contain;
  filter: none;
}

/* ── TECH PILLS ── */
.tech-pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 0.75rem;
}

.tech-pills li {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--navy-mid);
  background: #e8eef5;
  border: 1px solid #c5d3e0;
  border-radius: 2px;
  padding: 0.18rem 0.55rem;
  white-space: nowrap;
  line-height: 1.6;
}

.card-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--navy-light);
  display: block;
  margin-bottom: 0.45rem;
}

.card-title {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.35;
  margin-bottom: 0.3rem;
}

.card-authors {
  font-size: 0.85rem;
  color: var(--text-faint);
  font-style: italic;
  margin-bottom: 0.65rem;
}

.card-desc {
  font-size: 0.93rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 0.9rem;
}

.card-links { display: flex; gap: 1rem; }
.card-links a {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--navy-light);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}
.card-links a:hover { color: var(--navy); border-color: var(--navy); }

/* ── TEACHING GRID ── */
.teaching-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.teaching-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
}

.teaching-icon {
  font-family: 'JetBrains Mono', monospace;
  font-size: 1rem;
  color: var(--navy-light);
  margin-bottom: 0.65rem;
  opacity: 0.75;
}

.teaching-card h3 {
  font-family: 'Lora', Georgia, serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.2rem;
}

.teaching-meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.5rem;
  color: var(--text-faint);
  letter-spacing: 0.05em;
  margin-bottom: 0.6rem;
}

.teaching-card p { font-size: 0.88rem; color: var(--text-muted); }

.teaching-card-media {
  position: relative;
  margin-bottom: 1rem;
}

.teaching-card-media .img-placeholder,
.teaching-card-media .teaching-card-img {
  width: 100%;
  height: 130px;
  border-radius: calc(var(--radius) - 2px);
  object-fit: cover;
  display: block;
}

.teaching-card-school-logo {
  position: absolute;
  bottom: 8px;
  right: 8px;
  height: 28px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  background: white;
  padding: 3px 6px;
  border-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.teaching-card-school-logo-esilv {
  height: 50px;
  max-width: 120px;
}

/* ── FOOTER ── */
footer {
  border-top: 1px solid var(--border);
  text-align: center;
  padding: 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-faint);
  letter-spacing: 0.08em;
  background: var(--surface);
}

/* ── RESPONSIVE ── */
@media (max-width: 720px) {
  .hide-mobile { display: none; }

  nav { padding: 0 1.25rem; height: auto; min-height: 52px; flex-wrap: wrap; align-items: center; }
  nav ul { gap: 0; }
  nav a { padding: 0 0.6rem; font-size: 0.78rem; }
  .nav-name { line-height: 1.2; padding: 0.4rem 0; white-space: normal; max-width: 7rem; }
  main { padding: 2rem 1.25rem 4rem; }

  .hero { grid-template-columns: 1fr; }
  .hero-photo { display: none; }
  /* ── TIMELINE : date + logo en ligne, logo 24px ── */
  .timeline-item { grid-template-columns: 1fr; gap: 0.3rem; }
  .timeline-left {
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
  }
  .timeline-logo {
    height: 24px;
    max-width: 72px;
    flex-shrink: 0;
  }
  .timeline-logo img {
    max-height: 24px;
    max-width: 72px;
  }
  .logo-esilv { max-height: 24px; }
  .logo-ens   { max-height: 20px; }
  .logo-fallback {
    font-size: 0.7rem;
  }

  /* ── PROJECT CARDS : colonne logo cachée, logos inline avec pills ── */
  .card,
  .card.card-with-logo { grid-template-columns: 1fr; }
  .card-image { width: 100%; height: 180px; }

  /* Image après le texte sur mobile */
  .card > div:first-child,
  .card-image-col { order: 2; width: 100%; }
  .card-body { order: 1; }
  .card-logo-col { order: 3; }
  .card > .card-links { order: 4; }
  .card-caption { max-width: 100%; }

  .card-logo-col { display: none; }

  /* Logos déplacés dans les pills via JS sur mobile */
  .tech-pills .mobile-logo {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 0.4rem;
    padding-left: 0.5rem;
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    padding-top: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
  }
  .tech-pills .mobile-logo img {
    max-height: 18px;
    max-width: 52px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(15%) opacity(0.7);
  }

  .skills-grid { grid-template-columns: 1fr; }
  .skills-grid .skill-group:last-child { grid-column: 1; }

  .lang-bar { padding: 0.35rem 1.25rem; }
}

/* ══ RESEARCH THREAD GRAPH ══════════════════════════════════ */
.research-thread {
  margin: 0 0 3rem;
}

.thread-intro {
  font-size: 0.97rem;
  color: var(--text-muted);
  line-height: 1.65;
  margin-bottom: 1.75rem;
  max-width: 680px;
  font-style: italic;
}

.thread-graph-wrap {
  width: 100%;
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.thread-svg {
  display: block;
  width: 72%;
  min-width: 500px;
  height: auto;
}

.thread-divider {
  border: none;
  border-top: 2px solid var(--navy);
  margin: 2rem 0 2.5rem;
}

/* Nodes */
.thread-box {
  fill: var(--bg);
  stroke: var(--navy);
  stroke-width: 1.5;
}
.thread-box-prep {
  stroke: #4a7a5a;
  stroke-dasharray: 5 3;
}
.thread-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  fill: var(--navy);
}
.thread-title-prep {
  fill: #4a7a5a;
}
.thread-sub {
  font-family: 'Source Sans 3', sans-serif;
  font-size: 10px;
  fill: var(--muted);
}

/* Edges */
.thread-edge {
  fill: none;
  stroke: var(--navy);
  stroke-width: 1.5;
  marker-end: url(#arr);
}
.thread-edge-prep {
  fill: none;
  stroke: #4a7a5a;
  stroke-width: 1.5;
  stroke-dasharray: 5 3;
  marker-end: url(#arr-prep);
}
.thread-edge-prep-noarrow {
  fill: none;
  stroke: #4a7a5a;
  stroke-width: 1.5;
  stroke-dasharray: 5 3;
}
.thread-edge-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10.5px;
  fill: var(--muted);
}

.publications-subtitle {
  font-family: 'Lora', Georgia, serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 1.5rem;
}

/* Scroll offset for anchor links (sticky nav = 52px + margin) */
article[id] {
  scroll-margin-top: 72px;
}
