/* ============================================================
   Issam Falih — Personal academic website
   Design v2: clean minimal, white/black/blue, single sans
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- Tokens ---------- */
:root {
  --bg:          #FFFFFF;
  --bg-soft:     #F7F7F8;
  --bg-card:     #FAFAFA;
  --ink:         #111827;
  --ink-soft:    #4B5563;
  --ink-mute:    #9CA3AF;
  --line:        #E5E7EB;
  --line-soft:   #F1F2F4;
  --accent:      #2563EB;
  --accent-soft: #DBEAFE;

  --sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --maxw: 880px;
  --pad:  1.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0A0A0A;
    --bg-soft:     #141414;
    --bg-card:     #1A1A1A;
    --ink:         #FAFAFA;
    --ink-soft:    #A3A3A3;
    --ink-mute:    #6B7280;
    --line:        #262626;
    --line-soft:   #1F1F1F;
    --accent:      #60A5FA;
    --accent-soft: #1E3A8A;
  }
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  font-weight: 400;
  overflow-x: clip;
  overflow-wrap: break-word;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s ease;
}
a:hover { opacity: 0.7; }

/* ---------- Layout ---------- */
.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ---------- Header / nav ---------- */
header.site {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 1.1rem 0;
  gap: 0.5rem 1.5rem;
}
.nav-brand {
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.nav-brand:hover { opacity: 1; color: var(--accent); }
.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.25rem;
  font-size: 14px;
}
.nav-links a {
  color: var(--ink-soft);
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-links a:hover {
  opacity: 1;
  background: var(--bg-soft);
  color: var(--ink);
}
.nav-links a.current {
  color: var(--accent);
  background: var(--accent-soft);
}
@media (prefers-color-scheme: dark) {
  .nav-links a.current {
    background: rgba(96, 165, 250, 0.15);
  }
}
/* Hamburger toggle (hidden on desktop, shown on mobile) */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 36px;
  padding: 0 9px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--ink);
  border-radius: 2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-family: var(--sans);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 0;
}
h1 {
  font-size: 2.3rem;
  margin-bottom: 0.5rem;
  font-weight: 700;
}
h2 {
  font-size: 1.45rem;
  margin: 2.2rem 0 0.8rem;
  font-weight: 700;
}
h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.4rem 0 0.5rem;
}
p { margin: 0 0 1rem; color: var(--ink-soft); }
main p {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}
main p.eyebrow,
main p.axis-keys { text-align: left; hyphens: manual; }
strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; }

/* ---------- Section labels ---------- */
.eyebrow {
  font-size: 13.5px;
  color: var(--ink-mute);
  font-weight: 600;
  margin: 0 0 1rem;
  letter-spacing: 0.02em;
}

/* ---------- Hero ---------- */
.hero {
  padding: 3rem 0 2rem;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 2.2rem;
  align-items: start;
}
.hero-photo {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--line);
}
.hero-meta {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0.4rem 0 1.3rem;
}
.hero-meta .pos {
  color: var(--ink);
  font-weight: 600;
}
.hero-meta .lab {
  font-size: 13.5px;
  color: var(--ink-mute);
  display: inline-block;
  margin-top: 0.3rem;
}
.hero-bio {
  font-size: 1rem;
  color: var(--ink-soft);
  line-height: 1.65;
  margin: 1rem 0 0;
}

/* ---------- Links row ---------- */
.links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.2rem;
}
.links a {
  font-size: 13.5px;
  font-weight: 500;
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: var(--bg);
  transition: all 0.15s ease;
}
.links a:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.5rem;
  align-items: start;
  margin: 0.5rem 0 1rem;
}
.contact-block {
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.85;
}
.contact-block p { margin: 0 0 0.35rem; color: inherit; }
.contact-block .label {
  display: inline-block;
  width: 1.4rem;
  color: var(--ink-mute);
}
.map-embed {
  width: 100%;
  height: 100%;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-soft);
}
.map-embed iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
  border: 0;
  filter: grayscale(0.15);
}
@media (max-width: 640px) {
  .contact-grid { grid-template-columns: 1fr; }
}

/* ---------- News / updates ---------- */
.news { margin: 0.5rem 0 1.5rem; }
.news-item {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 1.2rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
}
.news-item:first-child { border-top: 1px solid var(--line-soft); }
.news-date {
  color: var(--ink-mute);
  font-size: 13.5px;
  padding-top: 1px;
}
.news-text { color: var(--ink-soft); }
.news-text strong { color: var(--ink); font-weight: 600; }

/* ---------- Research themes ---------- */
.themes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin: 0.5rem 0 1rem;
}
.theme {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.1rem 1.1rem 1rem;
}
.theme-fig {
  margin: 0 0 0.9rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.theme-fig img {
  display: block;
  width: 100%;
  height: auto;
}
.theme-fig--uniform img {
  height: 200px;
  object-fit: cover;
}
.theme-fig figcaption {
  font-size: 12px;
  color: var(--ink-mute);
  padding: 0.45rem 0.65rem;
  border-top: 1px solid var(--line);
}
.theme-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 0.4rem;
  font-weight: 500;
}
.partner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin: 0.75rem 0 1rem;
}
.partner-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.partner-card img {
  max-height: 50px;
  width: auto;
}
/* ---------- Project cards ---------- */
.projects {
  display: grid;
  gap: 1.5rem;
  margin: 1.25rem 0 1.5rem;
}
.project {
  position: relative;
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.9rem 2rem 1.7rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.project::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.project:hover {
  border-color: var(--accent);
  box-shadow: 0 16px 34px -20px rgba(37, 99, 235, 0.5);
  transform: translateY(-3px);
}
.project:hover::before { opacity: 1; }
.project-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem 1.25rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.project-title {
  flex: 1 1 60%;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.34;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
}
.project-date {
  flex-shrink: 0;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  white-space: nowrap;
  margin-top: 0.15rem;
}
.role-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.18rem 0.5rem;
  border-radius: 5px;
  vertical-align: middle;
  margin-left: 0.45rem;
}
.project-desc {
  font-size: 0.97rem;
  line-height: 1.72;
  color: var(--ink-soft);
  margin: 0 0 1.6rem;
  text-align: left;
}
.project-logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 0.9rem;
  padding-top: 1.3rem;
  border-top: 1px solid var(--line-soft);
}
.project-logos::before {
  content: "Partenaires";
  flex-basis: 100%;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-mute);
}
.project-logos img {
  height: 54px;
  width: auto;
  max-width: 175px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem 0.6rem;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.project-logos img:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.25);
}
.theme-partners {
  margin-top: 0.8rem;
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
}
.theme-title {
  font-weight: 600;
  font-size: 0.98rem;
  margin: 0 0 0.5rem;
  color: var(--ink);
  line-height: 1.35;
}
.theme-desc {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0;
}
/* ScanR-style keyword cloud : mots inline, serrés, tailles et couleurs variées */
.word-cloud {
  display: block;
  text-align: center;
  padding: 2rem 1.4rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
  margin: 0.75rem 0 1rem;
  line-height: 1.15;
  text-wrap: balance;
}
.word-cloud span {
  display: inline-block;
  margin: 0.18em 0.5em;
  font-weight: 600;
  line-height: 1;
  vertical-align: middle;
  cursor: default;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.word-cloud span:hover {
  transform: scale(1.06);
  opacity: 0.78;
}

/* Tailles : large amplitude, à la manière d'un nuage généré */
.word-cloud .size-1 { font-size: 0.85rem; font-weight: 500; }
.word-cloud .size-2 { font-size: 1.05rem; }
.word-cloud .size-3 { font-size: 1.45rem; }
.word-cloud .size-4 { font-size: 2rem;   font-weight: 700; }
.word-cloud .size-5 { font-size: 2.7rem; font-weight: 800; }

/* Palette ScanR : dégradés de bleu / sarcelle / indigo / ardoise */
.word-cloud span:nth-of-type(6n+1) { color: #2563EB; }
.word-cloud span:nth-of-type(6n+2) { color: #0D9488; }
.word-cloud span:nth-of-type(6n+3) { color: #4F46E5; }
.word-cloud span:nth-of-type(6n+4) { color: #0EA5E9; }
.word-cloud span:nth-of-type(6n+5) { color: #64748B; }
.word-cloud span:nth-of-type(6n+6) { color: #7C3AED; }

/* ---------- Axes méthodologiques (sommaire académique) ---------- */
.axes {
  list-style: none;
  margin: 1.5rem 0 1rem;
  padding: 0;
  counter-reset: axis;
}
.axis {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 0 1.5rem;
  padding: 1.75rem 0;
  border-top: 1px solid var(--line);
}
.axis:last-child { border-bottom: 1px solid var(--line); }
.axis-num {
  font-family: var(--mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-mute);
  padding-top: 0.2rem;
  letter-spacing: 0;
}
.axis h2 {
  font-size: 1.18rem;
  line-height: 1.32;
  margin: 0 0 0.6rem;
  color: var(--ink);
}
.axis p {
  font-size: 0.96rem;
  line-height: 1.66;
  margin: 0;
  color: var(--ink-soft);
}
.axis-keys {
  margin-top: 0.85rem !important;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.01em;
  color: var(--ink-mute);
  text-transform: lowercase;
}
@media (max-width: 560px) {
  .axis { grid-template-columns: 1fr; gap: 0; }
  .axis-num { margin-bottom: 0.4rem; padding-top: 0; }
}
/* ---------- Publications ---------- */
.pub-group { margin-bottom: 2rem; }
.pub {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 15px;
  line-height: 1.55;
}
.pub:first-child { border-top: 1px solid var(--line-soft); }
.pub-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-mute);
  padding-top: 2px;
}
.pub-title {
  font-weight: 600;
  font-size: 15.5px;
  color: var(--ink);
  margin-bottom: 2px;
}
.pub-authors {
  color: var(--ink-soft);
  font-size: 14.5px;
}
.pub-authors .me {
  color: var(--ink);
  font-weight: 600;
}
.pub-venue {
  font-size: 13px;
  color: var(--ink-mute);
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
}
.pub-venue .year {
  color: var(--accent);
  font-weight: 600;
  font-family: var(--mono);
  font-size: 12.5px;
}
.pub-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 1px 7px;
  border-radius: 4px;
}
.pub-tag.q1 {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: transparent;
}
@media (prefers-color-scheme: dark) {
  .pub-tag.q1 {
    background: rgba(96, 165, 250, 0.15);
  }
}

/* ---------- Timeline ---------- */
.timeline { margin: 0.5rem 0 1rem; }
.tl-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 1.4rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line-soft);
}
.tl-item:first-child { border-top: 1px solid var(--line-soft); }
.tl-date {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-mute);
  padding-top: 3px;
}
.tl-content { font-size: 15px; }
.tl-role {
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}
.tl-org {
  color: var(--ink-soft);
  font-size: 14.5px;
  line-height: 1.55;
}
.tl-pub {
  margin-top: 0.4rem;
  font-size: 13px;
  color: var(--ink-mute);
  line-height: 1.5;
}
.tl-pub em { color: var(--ink-soft); font-style: italic; }

/* ---------- Generic lists ---------- */
ul.clean {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem;
}
ul.clean li {
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-soft);
  font-size: 15px;
}
ul.clean li:first-child { border-top: 1px solid var(--line-soft); }
ul.clean li strong { color: var(--ink); font-weight: 600; }

/* ---------- Section spacing ---------- */
.section { padding: 2rem 0; }
.pub-filter-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0 1.6rem;
  padding: 1rem 1rem 0.85rem;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 16px;
}
.pub-filter-panel input {
  flex: 1 1 240px;
  min-width: 220px;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--bg);
}
.pub-filter-panel input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.filter-buttons button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.filter-buttons button:hover,
.filter-buttons button.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}
.divider { height: 1px; background: var(--line); margin: 2.5rem 0; border: 0; }

/* ---------- Footer ---------- */
footer.site {
  margin-top: 4rem;
  padding: 1.8rem 0 2.5rem;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-mute);
}
footer.site .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
}

/* ---------- Utility ---------- */
.muted { color: var(--ink-mute); }

/* ---------- Page header (non-hero pages) ---------- */
.page-head {
  padding: 3rem 0 1.5rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}
.page-head h1 {
  font-size: 2rem;
  margin-bottom: 0.4rem;
}
.page-head p {
  margin: 0;
  font-size: 15.5px;
  color: var(--ink-soft);
  text-align: justify;
}

.theme-desc {
  text-align: justify;
}

/* ---------- Button ---------- */
.btn {
  display: inline-block;
  font-size: 14px;
  font-weight: 500;
  padding: 0.55rem 1rem;
  border-radius: 6px;
  background: var(--accent);
  color: white !important;
  border: 1px solid var(--accent);
}
.btn:hover { opacity: 0.85; }
.btn-outline {
  background: transparent;
  color: var(--accent) !important;
}
.btn-outline:hover { background: var(--accent-soft); opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  /* Left-align body text on narrow screens (justify looks ragged) */
  main p { text-align: left; hyphens: manual; }
  .hero {
    grid-template-columns: 1fr;
    gap: 1.3rem;
    padding: 2rem 0 1rem;
    text-align: left;
  }
  .hero-photo {
    width: 120px;
    height: 120px;
  }
  .nav {
    padding: 0.85rem 0;
    flex-wrap: wrap;
    gap: 0.6rem;
  }
  .nav-toggle { display: flex; }
  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 0.15rem;
    margin-top: 0.5rem;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 0.65rem 0.7rem; font-size: 15px; border-radius: 8px; white-space: nowrap; }
  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.25rem; }
  .themes { grid-template-columns: 1fr; }
  .tl-item, .news-item, .pub {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
  .tl-date, .news-date, .pub-num { padding-top: 0; }
  /* Scale the word cloud so the largest terms fit the viewport */
  .word-cloud { padding: 1.4rem 1rem; }
  .word-cloud span { margin: 0.15em 0.3em; }
  .word-cloud .size-1 { font-size: 0.8rem; }
  .word-cloud .size-2 { font-size: 0.95rem; }
  .word-cloud .size-3 { font-size: 1.15rem; }
  .word-cloud .size-4 { font-size: 1.4rem; }
  .word-cloud .size-5 { font-size: 1.7rem; }
}
