/* ============================================================
   CV — Bassem Ben Hamed
   Feuille de style unique, sans dépendance externe.
   ============================================================ */

/* ---------- Jetons de design ---------- */
:root {
  --accent:        #003C71;
  --accent-soft:   #E8EFF6;
  --accent-line:   #C7D6E4;
  --accent-text:   #003C71;
  --red:           #B03030;

  --bg:            #FFFFFF;
  --bg-alt:        #F6F8FA;
  --bg-card:       #FFFFFF;
  --surface:       #FFFFFF;

  --fg:            #14202B;
  --fg-muted:      #5A6978;
  --fg-faint:      #8896A4;
  --border:        #E2E8EE;
  --border-strong: #CBD5DF;

  --shadow-sm: 0 1px 2px rgba(16,32,48,.06), 0 1px 3px rgba(16,32,48,.05);
  --shadow-md: 0 2px 6px rgba(16,32,48,.06), 0 8px 24px rgba(16,32,48,.07);
  --shadow-lg: 0 4px 12px rgba(16,32,48,.08), 0 20px 48px rgba(16,32,48,.10);

  --radius:    10px;
  --radius-lg: 16px;
  --wrap:      1120px;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

html[data-theme="dark"] {
  --accent:        #4E9AE0;
  --accent-soft:   #16283A;
  --accent-line:   #2A4763;
  --accent-text:   #7FBAEC;
  --red:           #E4736B;

  --bg:            #0E141B;
  --bg-alt:        #131B24;
  --bg-card:       #172029;
  --surface:       #172029;

  --fg:            #E4EAF0;
  --fg-muted:      #9AAABA;
  --fg-faint:      #71818F;
  --border:        #26323E;
  --border-strong: #35434F;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 2px 6px rgba(0,0,0,.35), 0 8px 24px rgba(0,0,0,.30);
  --shadow-lg: 0 4px 12px rgba(0,0,0,.40), 0 20px 48px rgba(0,0,0,.35);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 84px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--fg);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { font-family: var(--serif); font-weight: 600; line-height: 1.22; margin: 0; }
p { margin: 0 0 1em; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img { max-width: 100%; display: block; }
code { font-family: var(--mono); font-size: .88em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: 24px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Barre de navigation ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  display: flex; align-items: center; gap: 20px;
  height: 60px; max-width: var(--wrap); margin-inline: auto; padding-inline: 24px;
}
.nav__brand {
  font-family: var(--serif); font-weight: 600; font-size: 1.02rem;
  color: var(--fg); white-space: nowrap; letter-spacing: -.01em;
}
.nav__brand:hover { text-decoration: none; }
.nav__links {
  display: flex; gap: 4px; margin-left: auto;
  overflow-x: auto; scrollbar-width: none;
}
.nav__links::-webkit-scrollbar { display: none; }
.nav__links a {
  padding: 6px 11px; border-radius: 7px; font-size: .875rem; font-weight: 500;
  color: var(--fg-muted); white-space: nowrap; transition: background .16s, color .16s;
}
.nav__links a:hover { background: var(--bg-alt); color: var(--fg); text-decoration: none; }
.nav__links a.is-active { color: var(--accent-text); background: var(--accent-soft); }

.nav__tools { display: flex; align-items: center; gap: 8px; margin-left: 12px; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 34px; min-width: 34px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--fg-muted);
  font-family: var(--sans); font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: background .16s, color .16s, border-color .16s;
}
.iconbtn:hover { background: var(--bg-alt); color: var(--fg); border-color: var(--accent); text-decoration: none; }
.iconbtn svg { width: 16px; height: 16px; }

/* ---------- Héros ---------- */
.hero { padding: 68px 0 52px; border-bottom: 1px solid var(--border); }
.hero__grid { display: grid; grid-template-columns: 186px 1fr; gap: 44px; align-items: center; }
.hero__photo {
  width: 186px; height: 186px; border-radius: 50%; object-fit: cover;
  border: 4px solid var(--surface); box-shadow: var(--shadow-lg);
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .78rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 16px;
}
.hero__dot { width: 6px; height: 6px; border-radius: 50%; background: #2FA84F; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.05rem); letter-spacing: -.022em; margin-bottom: 10px; }
.hero__role { font-size: clamp(1rem, 2.1vw, 1.16rem); color: var(--fg-muted); margin-bottom: 8px; font-weight: 500; }
.hero__loc { font-size: .92rem; color: var(--fg-faint); margin-bottom: 24px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 9px;
  font-size: .9rem; font-weight: 600; font-family: var(--sans);
  border: 1px solid transparent; cursor: pointer;
  transition: transform .14s, box-shadow .16s, background .16s, border-color .16s;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--shadow-sm); }
html[data-theme="dark"] .btn--primary { color: #0E141B; }
.btn--primary:hover { box-shadow: var(--shadow-md); }
.btn--red { background: var(--red); color: #fff; box-shadow: var(--shadow-sm); }
html[data-theme="dark"] .btn--red { color: #0E141B; }
.btn--red:hover { box-shadow: var(--shadow-md); }
.btn--ghost { background: var(--surface); color: var(--fg); border-color: var(--border-strong); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent-text); }

/* ---------- Chiffres clés ---------- */
.stats { background: var(--bg-alt); border-bottom: 1px solid var(--border); }
.stats__grid {
  display: grid; grid-template-columns: repeat(5, 1fr);
  padding: 30px 0;
}
.stat { text-align: center; padding: 6px 10px; border-left: 1px solid var(--border); }
.stat:first-child { border-left: 0; }
.stat__n {
  font-family: var(--serif); font-size: clamp(1.7rem, 3.6vw, 2.3rem); font-weight: 600;
  color: var(--accent-text); line-height: 1.1; font-variant-numeric: tabular-nums;
}
.stat__l { font-size: .78rem; color: var(--fg-muted); margin-top: 5px; line-height: 1.35; }

/* ---------- Sections ---------- */
.section { padding: 66px 0; border-bottom: 1px solid var(--border); }
.section--alt { background: var(--bg-alt); }
.section__head { margin-bottom: 34px; max-width: 760px; }
.section__kicker {
  font-size: .75rem; font-weight: 700; letter-spacing: .11em; text-transform: uppercase;
  color: var(--accent-text); margin-bottom: 9px;
}
.section h2 { font-size: clamp(1.5rem, 3vw, 1.95rem); letter-spacing: -.017em; margin-bottom: 10px; }
.section__lede { color: var(--fg-muted); font-size: 1.02rem; margin: 0; }

.lead { font-size: 1.09rem; line-height: 1.72; max-width: 68ch; }
.lead strong { color: var(--accent-text); }

/* ---------- Cartes ---------- */
.cards { display: grid; gap: 20px; }
.cards--3 { grid-template-columns: repeat(3, 1fr); }
.cards--2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 26px;
  box-shadow: var(--shadow-sm); transition: box-shadow .2s, transform .2s, border-color .2s;
}
.card--hover:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); border-color: var(--accent-line); }
.card__icon {
  width: 42px; height: 42px; border-radius: 11px;
  display: grid; place-items: center; margin-bottom: 15px;
  background: var(--accent-soft); color: var(--accent-text);
}
.card__icon svg { width: 21px; height: 21px; }
.card h3 { font-size: 1.12rem; margin-bottom: 9px; }
.card p { color: var(--fg-muted); font-size: .94rem; margin-bottom: 14px; }
.card__link { font-size: .88rem; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.card__link svg { width: 13px; height: 13px; transition: transform .16s; }
.card__link:hover svg { transform: translateX(3px); }

/* ---------- Entreprises ---------- */
.venture { position: relative; padding-left: 22px; }
.venture::before {
  content: ""; position: absolute; left: 0; top: 6px; bottom: 6px;
  width: 3px; border-radius: 3px; background: var(--accent);
}
.venture__role { font-size: .8rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent-text); }
.venture h3 { font-size: 1.3rem; margin: 5px 0 6px; }
.venture__meta { font-size: .85rem; color: var(--fg-faint); margin-bottom: 15px; }
.venture ul { margin: 0; padding-left: 18px; }
.venture li { margin-bottom: 9px; font-size: .94rem; color: var(--fg-muted); }
.venture li strong { color: var(--fg); font-weight: 600; }

/* ---------- Missions (accordéon) ---------- */
.eng { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); margin-bottom: 12px; overflow: hidden; }
.eng[open] { border-color: var(--accent-line); box-shadow: var(--shadow-sm); }
.eng__sum {
  display: grid; grid-template-columns: 40px 1fr auto auto; gap: 16px; align-items: center;
  padding: 17px 20px; cursor: pointer; list-style: none;
}
.eng__sum::-webkit-details-marker { display: none; }
.eng__sum:hover { background: var(--bg-alt); }
.eng__ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
            background: var(--accent-soft); font-size: 1.2rem; }
.eng__t { display: block; font-family: var(--serif); font-weight: 600; font-size: 1.04rem; line-height: 1.35; }
.eng__c { display: block; font-size: .85rem; color: var(--fg-muted); margin-top: 2px; }
.eng__y { font-size: .84rem; font-weight: 600; color: var(--fg-faint); font-variant-numeric: tabular-nums; }
.eng__chev { width: 18px; height: 18px; color: var(--fg-faint); transition: transform .2s; }
.eng[open] .eng__chev { transform: rotate(180deg); }
.eng__body { padding: 4px 20px 22px 76px; border-top: 1px solid var(--border); margin-top: -1px; }
.eng__body > p { color: var(--fg-muted); font-size: .95rem; margin-top: 16px; }
.eng__body ul { margin: 14px 0 0; padding-left: 18px; }
.eng__body li { font-size: .93rem; color: var(--fg-muted); margin-bottom: 8px; }
.eng__body li strong { color: var(--fg); }

/* ---------- Puces techniques ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  font-size: .8rem; font-weight: 500; padding: 4px 11px; border-radius: 999px;
  background: var(--bg-alt); border: 1px solid var(--border); color: var(--fg-muted);
  white-space: nowrap;
}
.chip--accent { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-text); font-weight: 600; }

.skillgroup { margin-bottom: 22px; }
.skillgroup__t {
  font-size: .76rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--fg-faint); margin-bottom: 10px;
}

/* ---------- Histogramme des formations ---------- */
.chart { display: grid; grid-template-columns: repeat(9, 1fr); gap: 10px; align-items: end; height: 168px; margin-bottom: 12px; }
.chart__col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 7px; }
.chart__bar {
  width: 100%; border-radius: 6px 6px 2px 2px; background: var(--accent);
  opacity: .30; min-height: 5px; transition: opacity .2s;
}
.chart__col:hover .chart__bar { opacity: 1; }
.chart__col:nth-child(n+7) .chart__bar { opacity: .62; }
.chart__col:nth-child(8) .chart__bar { opacity: 1; }
.chart__n { font-size: .82rem; font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; }
.chart__y { font-size: .74rem; color: var(--fg-faint); font-variant-numeric: tabular-nums; }

/* ---------- Tableaux ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th {
  text-align: left; font-family: var(--sans); font-size: .74rem; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase; color: var(--fg-faint);
  padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--bg-alt);
  position: sticky; top: 0; z-index: 1;
}
tbody td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-alt); }
td.num, th.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.t-scroll { max-height: 460px; overflow-y: auto; }

/* ---------- Filtres ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-bottom: 16px; }
.search {
  flex: 1 1 220px; min-width: 180px; max-width: 340px;
  padding: 8px 13px; border: 1px solid var(--border-strong); border-radius: 8px;
  background: var(--surface); color: var(--fg); font-family: var(--sans); font-size: .88rem;
}
.search::placeholder { color: var(--fg-faint); }
.pill {
  padding: 6px 13px; border: 1px solid var(--border-strong); border-radius: 999px;
  background: var(--surface); color: var(--fg-muted);
  font-family: var(--sans); font-size: .82rem; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.pill:hover { border-color: var(--accent); color: var(--accent-text); }
.pill.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
html[data-theme="dark"] .pill.is-on { color: #0E141B; }
.count { font-size: .82rem; color: var(--fg-faint); margin-left: auto; font-variant-numeric: tabular-nums; }

/* ---------- Publications ---------- */
.pub { display: grid; grid-template-columns: 52px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.pub:last-child { border-bottom: 0; }
.pub__tag {
  font-family: var(--mono); font-size: .74rem; font-weight: 600;
  color: var(--accent-text); background: var(--accent-soft);
  padding: 3px 0; border-radius: 5px; text-align: center; height: fit-content;
}
.pub__txt { font-size: .92rem; line-height: 1.55; }
.pub__meta { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 6px; align-items: center; }
.rank {
  font-size: .7rem; font-weight: 700; letter-spacing: .04em;
  padding: 2px 8px; border-radius: 999px; border: 1px solid;
}
.rank--Q1 { color: #1C7A3E; border-color: #A8D8BC; background: #EAF7EF; }
.rank--Q2 { color: #1F6FA8; border-color: #AACEE6; background: #EAF3F9; }
.rank--Q3 { color: #8A6116; border-color: #E2CC96; background: #FBF4E3; }
.rank--Q4 { color: #7A4A4A; border-color: #DBBDBD; background: #F8EFEF; }
.rank--other { color: var(--fg-muted); border-color: var(--border-strong); background: var(--bg-alt); }
html[data-theme="dark"] .rank--Q1 { color:#7ED9A2; border-color:#245C3C; background:#13251B; }
html[data-theme="dark"] .rank--Q2 { color:#8CC6EE; border-color:#22496A; background:#111F2C; }
html[data-theme="dark"] .rank--Q3 { color:#E2C77E; border-color:#5D4A22; background:#241E12; }
html[data-theme="dark"] .rank--Q4 { color:#E5AFAF; border-color:#5E3737; background:#241717; }
.doi { font-size: .78rem; font-family: var(--mono); color: var(--fg-faint); }

/* ---------- Frise ---------- */
.tl { position: relative; padding-left: 30px; }
.tl::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: 8px; width: 2px; background: var(--border); }
.tl__item { position: relative; padding-bottom: 30px; }
.tl__item:last-child { padding-bottom: 0; }
.tl__item::before {
  content: ""; position: absolute; left: -30px; top: 7px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--bg); border: 3px solid var(--accent);
}
.tl__when { font-size: .8rem; font-weight: 600; color: var(--accent-text); letter-spacing: .02em; }
.tl__what { font-family: var(--serif); font-size: 1.16rem; font-weight: 600; margin: 3px 0 3px; }
.tl__where { font-size: .88rem; color: var(--fg-faint); margin-bottom: 11px; }
.tl__item ul { margin: 0; padding-left: 18px; }
.tl__item li { font-size: .93rem; color: var(--fg-muted); margin-bottom: 7px; }
.tl__item li strong { color: var(--fg); }

/* ---------- Listes deux colonnes ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 34px; }
.deflist { margin: 0; }
.deflist__row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.deflist__row:last-child { border-bottom: 0; }
.deflist__t { font-weight: 600; font-size: .94rem; }
.deflist__s { font-size: .84rem; color: var(--fg-faint); }
.deflist__d { font-size: .82rem; color: var(--fg-faint); font-variant-numeric: tabular-nums; white-space: nowrap; }

.thesis { padding: 11px 0; border-bottom: 1px solid var(--border); font-size: .91rem; display: grid; grid-template-columns: 44px 1fr; gap: 12px; }
.thesis:last-child { border-bottom: 0; }
.thesis__tag { font-family: var(--mono); font-size: .73rem; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); padding: 2px 0; border-radius: 5px; text-align: center; height: fit-content; }

/* ---------- Pied de page ---------- */
.foot { background: var(--accent); color: #fff; padding: 56px 0 30px; }
html[data-theme="dark"] .foot { background: var(--bg-alt); border-top: 1px solid var(--border); color: var(--fg); }
.foot h2 { color: inherit; font-size: 1.6rem; margin-bottom: 10px; }
.foot p { color: rgba(255,255,255,.78); }
html[data-theme="dark"] .foot p { color: var(--fg-muted); }
.foot a { color: #fff; }
html[data-theme="dark"] .foot a { color: var(--accent-text); }
.foot__grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 40px; align-items: start; }
.foot__links { display: flex; flex-direction: column; gap: 11px; }
.foot__link { display: inline-flex; align-items: center; gap: 10px; font-size: .93rem; }
.foot__link svg { width: 17px; height: 17px; flex: none; opacity: .85; }
.foot__bottom {
  margin-top: 40px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,.18);
  font-size: .8rem; color: rgba(255,255,255,.6);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
}
html[data-theme="dark"] .foot__bottom { border-top-color: var(--border); color: var(--fg-faint); }

/* ---------- Apparition au défilement ---------- */
/* Sans JavaScript, aucun contenu n'est masqué : .js n'est posé que par le script. */
.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
.js .reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .js .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- Adaptatif ---------- */
@media (max-width: 900px) {
  .cards--3 { grid-template-columns: 1fr; }
  .cards--2, .split { grid-template-columns: 1fr; }
  .hero__grid { grid-template-columns: 1fr; gap: 26px; text-align: center; }
  .hero__photo { margin-inline: auto; width: 148px; height: 148px; }
  .hero__cta { justify-content: center; }
  .stats__grid { grid-template-columns: repeat(2, 1fr); gap: 18px 0; }
  .stat { border-left: 0; }
  .foot__grid { grid-template-columns: 1fr; gap: 30px; }
}
@media (max-width: 680px) {
  .nav__links { display: none; }
  .section { padding: 46px 0; }
  .hero { padding: 44px 0 36px; }
  .eng__sum { grid-template-columns: 34px 1fr auto; gap: 12px; padding: 14px; }
  .eng__ico { width: 34px; height: 34px; font-size: 1rem; }
  .eng__y { display: none; }
  .eng__body { padding: 4px 14px 18px; }
  .chart { grid-template-columns: repeat(9, 1fr); gap: 5px; height: 132px; }
  .chart__y { font-size: .62rem; }
  .chart__n { font-size: .7rem; }
  .stats__grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(5) { grid-column: 1 / -1; }
}

/* ---------- Impression ---------- */
@media print {
  .nav, .foot__links, .filters, .hero__cta, .card__link { display: none !important; }
  body { font-size: 11pt; }
  .section { padding: 14pt 0; border: 0; page-break-inside: avoid; }
  .eng__body { display: block !important; }
  .t-scroll { max-height: none; }
  a { color: inherit; text-decoration: none; }
  .reveal { opacity: 1 !important; transform: none !important; }
}
