:root {
  --bg: #ffffff;
  --text: #1b2433;
  --muted: #5d6879;
  --blue: #1f4fd1;
  --blue-dark: #0e2a6b;
  --blue-soft: #eaf0fe;
  --blue-line: #c9d7fb;
  --link: #1f4fd1;
  --link-hover: #0e2a6b;
  --rule: #e3e7ee;
  --card-bg: #f7f9fc;
  --band-from: #0b1f4d;
  --band-to: #1f4fd1;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1420;
    --text: #e4e8f0;
    --muted: #98a2b5;
    --blue: #7aa2ff;
    --blue-dark: #b7cbff;
    --blue-soft: #18233d;
    --blue-line: #2b3d66;
    --link: #8db0ff;
    --link-hover: #c3d4ff;
    --rule: #232b3b;
    --card-bg: #141b2a;
    --band-from: #08132f;
    --band-to: #1a3a99;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3 { line-height: 1.25; }

h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2.75rem;
  margin: 0 0 .4rem;
  letter-spacing: -0.015em;
}

h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.55rem;
  margin: 0 0 1.1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
}
h2::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--rule);
}
h2::before {
  content: "";
  width: 6px;
  height: 1.1em;
  border-radius: 3px;
  background: var(--blue);
}

h3 { font-size: 1rem; font-weight: 600; margin: 0 0 .4rem; }

section { margin-top: 3rem; }

/* ---------- Header band ---------- */
.band {
  position: relative;
  background: linear-gradient(135deg, var(--band-from) 0%, var(--band-to) 100%);
  color: #fff;
  overflow: hidden;
}
.band::after {
  /* soft light in the corner */
  content: "";
  position: absolute;
  right: -120px;
  top: -160px;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.14), rgba(255,255,255,0) 70%);
  pointer-events: none;
}

.hero {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  padding: 4.5rem 1.25rem 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.subtitle {
  margin: 0 0 1.4rem;
  color: #c7d6ff;
  font-size: 1.1rem;
  font-weight: 500;
}

.links {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 500;
}
.links a {
  display: inline-block;
  color: #fff;
  padding: .3rem .85rem;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  transition: background .15s, border-color .15s;
}
.links a:hover {
  color: #fff;
  text-decoration: none;
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.7);
}

.portrait {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 4px solid rgba(255,255,255,.85);
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

/* ---------- Text ---------- */
section > p { margin: 0 0 1rem; }
em { font-style: italic; }

/* ---------- Publications ---------- */
.pubs { list-style: none; padding: 0; margin: 0; counter-reset: pub; /* set to n+1 by the script in index.html */ }
.pubs li {
  position: relative;
  margin-bottom: 1.5rem;
  padding-left: 2.6rem;
}
.pubs li::before {
  counter-increment: pub -1;
  content: counter(pub);
  position: absolute;
  left: 0;
  top: .15rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: .8rem;
  font-weight: 600;
  display: grid;
  place-items: center;
  line-height: 1;
}
.pubs p, #thesis p { margin: 0; }
.pub-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.12rem;
  line-height: 1.4;
}
.pub-authors { font-size: .95rem; }
.pub-venue { color: var(--muted); font-size: .95rem; }
.me { font-weight: 600; }

.pub-links { margin-top: .45rem !important; font-size: .78rem; font-weight: 600; }
.pub-links a {
  display: inline-block;
  margin: .1rem .3rem 0 0;
  padding: .12rem .6rem;
  border-radius: 5px;
  background: var(--blue-soft);
  color: var(--blue);
  letter-spacing: .02em;
}
.pub-links a:hover { text-decoration: none; background: var(--blue); color: #fff; }

#thesis .pub-venue { margin-bottom: .1rem; }

/* ---------- Projects ---------- */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 1rem;
}

.project {
  background: var(--card-bg);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--blue);
  border-radius: 10px;
  padding: 1.1rem 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  transition: transform .15s, box-shadow .15s;
}
.project:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(31,79,209,.12); }
.project h3 { font-family: var(--font-display); font-size: 1.15rem; }
.project p { margin: 0 0 .8rem; font-size: .9rem; line-height: 1.6; color: var(--text); }
.tags { margin-top: auto !important; margin-bottom: 0 !important; display: flex; flex-wrap: wrap; gap: .35rem; }
.tags span {
  font-size: .72rem;
  font-weight: 500;
  background: var(--blue-soft);
  color: var(--blue);
  padding: .1rem .55rem;
  border-radius: 999px;
}

/* ---------- Footer ---------- */
footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: .82rem;
}

/* ---------- Language ---------- */
html[data-lang="en"] [lang="fr"],
html[data-lang="fr"] [lang="en"] { display: none !important; }

.lang-switch {
  position: absolute;
  z-index: 2;
  top: 1rem;
  right: 1.25rem;
  display: flex;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.08);
}
.lang-switch button {
  background: transparent;
  color: #c7d6ff;
  border: 0;
  padding: .25rem .7rem;
  font: inherit;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
}
.lang-switch button:hover { color: #fff; }
.lang-switch button[aria-pressed="true"] { background: #fff; color: var(--band-from); }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .hero { flex-direction: column-reverse; align-items: flex-start; gap: 1.25rem; padding: 3.5rem 1.25rem 2.5rem; }
  .portrait { width: 104px; height: 104px; }
  h1 { font-size: 2.1rem; }
  h2 { font-size: 1.35rem; }
}

/* ---------- Skills ---------- */
.skills { margin-top: 1.1rem !important; }
.skills span { font-size: .78rem; padding: .15rem .65rem; }

/* ---------- Project links ---------- */
.project h3 a { color: var(--text); }
.project h3 a:hover { color: var(--blue); text-decoration: none; }
.project .tags { margin-bottom: .8rem !important; }
.project-link { margin: 0 !important; font-size: .82rem !important; font-weight: 600; }
.project-link a:hover { text-decoration: none; }
