:root {
  --bg: #ffffff;            /* Fond principal en blanc */
  --card: #BDD1FF;          /* Fond des cartes (gris très clair) */
  --card-alt: #A1BCFF;      /* Fond secondaire (boutons/tags) */
  --text: #111827;          /* Texte principal (sombre pour la lisibilité) */
  --text-dim: #474747;      /* Texte secondaire (gris moyen) */
  --border: #e5e7eb;        /* Bordures légères */
  --accent: #0038B5;        /* Couleur d'accentuation (bleu) */
  --dark-panel: #f9fafb;    /* Fond des aperçus d'images */
  --radius: 20px;
  --gap: 16px;
}

body.dark {
  --bg: #0b0b0d;
  --card: #1a1a1e;
  --card-alt: #202024;
  --text: #f1f1f3;
  --text-dim: #9a9aa2;
  --border: #2c2c31;
  --accent: #0038B5;
  --dark-panel: #101014;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  transition: background .3s ease, color .3s ease;
}

a { color: inherit; }

.wrap {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* ---------- Sticky nav ---------- */
.nav {
  position: sticky;
  top: 16px;
  z-index: 50;
  display: flex;
  justify-content: center;
  margin-bottom: 24px;
}
.nav-inner {
  display: flex;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.nav-inner a {
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 8px 16px;
  border-radius: 999px;
  transition: background .2s, color .2s;
  white-space: nowrap;
}
.nav-inner a:hover,
.nav-inner a.back {
  color: var(--text);
}
.nav-inner a.active { background: var(--card-alt); color: var(--text); }

section { scroll-margin-top: 90px; }
.section-gap { margin-top: 40px; }

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--gap);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  transition: background .3s ease, border-color .3s ease;
}

/* ---------- Header / About ---------- */
.profile-card { grid-column: span 4; display: flex; flex-direction: column; gap: 14px; }
.profile-top { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  overflow: hidden; /* Empêche l'image de dépasser du cercle */
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Recadre proprement l'image sans la déformer */
  display: block;
}
.profile-top h1 { margin: 0; font-size: 22px; font-weight: 700; }
.profile-card p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.5; }

.marquee-card {
  grid-column: span 4;
  overflow: hidden;
  position: relative;
  display: flex;
  align-items: center;
  background: var(--card-alt);
}
.marquee-track {
  display: flex;
  gap: 28px;
  white-space: nowrap;
  animation: scroll 14s linear infinite;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
  color: var(--text-dim);
}
.marquee-track span::after { content: '•'; margin-left: 28px; color: var(--border); }
@keyframes scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.resume-row { grid-column: span 4; display: flex; flex-direction: column; gap: 12px; }
.resume-card, .theme-toggle {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; display: flex; align-items: center; justify-content: space-between;
}
.resume-card .label { font-size: 11px; color: var(--text-dim); letter-spacing: .05em; }
.resume-card .title { font-weight: 700; font-size: 15px; margin-top: 2px; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--card-alt); color: var(--text); text-decoration: none;
}
.icon-btn:hover { border-color: var(--accent); }

.theme-toggle { gap: 8px; padding: 8px; }
.theme-toggle button {
  flex: 1; border: none; border-radius: 12px; padding: 10px; cursor: pointer;
  font-size: 16px; background: transparent; color: var(--text-dim);
}
.theme-toggle button.active { background: var(--card-alt); color: var(--text); box-shadow: 0 0 0 1px var(--border); }

/* ---------- Skills ---------- */
.socials { grid-column: span 2; display: grid; grid-template-columns: 1fr; gap: var(--gap); }
.social-icon {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 22px; text-decoration: none;
}

.tech-card { grid-column: span 5; display: flex; flex-direction: column; gap: 14px; }
.tech-icons { display: flex; gap: 10px; flex-wrap: wrap; }
.tech-chip {
  width: 46px; height: 46px; border-radius: 12px; background: var(--card-alt);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.tech-card .label { font-size: 11px; color: var(--text-dim); letter-spacing: .05em; }
.tech-card .title { font-weight: 700; font-size: 16px; }

.skills-list-card { grid-column: span 5; }
.skills-list-card h2 { margin: 0 0 16px; font-size: 20px; }
.skill-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--border); }
.skill-row:first-of-type { border-top: none; }
.skill-row .name { font-weight: 600; font-size: 14px; width: 110px; flex-shrink: 0; }
.bar-track { flex: 1; height: 6px; border-radius: 999px; background: var(--card-alt); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--accent); }

/* ---------- Experience / Formation ---------- */
.exp-card { grid-column: span 6; }
.exp-card .eyebrow { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.exp-card h2 { margin: 0 0 18px; font-size: 20px; }
.exp-item {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: 10px 0; border-top: 1px solid var(--border);
}
.exp-item:first-of-type { border-top: none; }
.exp-item .role { font-weight: 700; font-size: 16px; }
.exp-item.current .role { color: var(--text); }
.exp-item:not(.current) .role { color: var(--text-dim); text-decoration: line-through; text-decoration-color: var(--border); font-weight: 500; }
.exp-item .meta { text-align: right; font-size: 12px; color: var(--text-dim); }
.exp-item .meta .company { font-weight: 600; color: var(--text); display: block; }
.exp-item:not(.current) .meta .company { color: var(--text-dim); font-weight: 500; }

/* ---------- Project cards ---------- */
.project-card {
  grid-column: span 6;
  display: flex; flex-direction: column; gap: 14px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
}
.project-card:hover { border-color: var(--accent); }
.project-preview {
  border-radius: 14px; overflow: hidden; background: var(--dark-panel);
  aspect-ratio: 16/10; display: flex; align-items: center; justify-content: center;
  color: #6b6b76; font-size: 13px; border: 1px solid var(--border);
}
.project-meta .eyebrow { font-size: 11px; color: var(--accent); font-weight: 600; margin-bottom: 4px; }
.project-meta h3 { margin: 4px 0 10px; font-size: 18px; display: flex; align-items: center; gap: 8px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  font-size: 11px; padding: 5px 10px; border-radius: 999px;
  background: var(--card-alt); border: 1px solid var(--border); color: var(--text-dim);
}

/* ---------- Contact ---------- */
.contact-card { grid-column: span 8; display: flex; flex-direction: column; gap: 16px; }
.contact-card h2 { margin: 0; font-size: 22px; }
.contact-card p { margin: 0; color: var(--text-dim); font-size: 14px; line-height: 1.5; }
.contact-btn {
  display: inline-flex; align-items: center; gap: 8px; width: fit-content;
  background: var(--accent); color: #fff; text-decoration: none;
  padding: 12px 22px; border-radius: 999px; font-weight: 600; font-size: 14px;
}
.contact-socials { grid-column: span 4; display: flex; flex-direction: column; gap: var(--gap); }

/* ---------- Section titles ---------- */
.section-title { grid-column: span 12; display: flex; align-items: baseline; gap: 10px; margin: 8px 0 -2px; }
.section-title h2 { font-size: 15px; margin: 0; color: var(--text-dim); font-weight: 600; }

/* ---------- Project detail page ---------- */
.detail-hero {
  grid-column: span 12;
  aspect-ratio: 21/9;
  border-radius: var(--radius);
  background: var(--dark-panel);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: #6b6b76; font-size: 14px;
}
.detail-header { grid-column: span 12; display: flex; flex-direction: column; gap: 10px; }
.detail-header .eyebrow { font-size: 12px; color: var(--accent); font-weight: 600; }
.detail-header h1 { margin: 0; font-size: 30px; }
.detail-body { grid-column: span 8; display: flex; flex-direction: column; gap: 16px; }
.detail-body h3 { margin: 0 0 4px; font-size: 15px; }
.detail-body p, .detail-body li { color: var(--text-dim); font-size: 14px; line-height: 1.6; }
.detail-body ul { margin: 0; padding-left: 18px; }
.detail-side { grid-column: span 4; display: flex; flex-direction: column; gap: var(--gap); }
.detail-side .card h3 { margin: 0 0 10px; font-size: 13px; color: var(--text-dim); }
.detail-cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--accent); color: #fff; text-decoration: none;
  padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
}

.project-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* Choisis la zone à privilégier : */
  object-position: center center; /* Par défaut : centre l'image */
  /* Alternatives selon ton besoin : */
  /* object-position: top center;    -> Cadre sur le haut */
  /* object-position: bottom center; -> Cadre sur le bas */
  /* object-position: 50% 20%;       -> Alignement précis en % (X Y) */
  display: block;
}

/* ---------- Responsive Mobile ---------- */
@media (max-width: 900px) {
  .profile-card, .marquee-card, .resume-row, .socials, .tech-card, .skills-list-card,
  .exp-card, .project-card, .contact-card, .contact-socials,
  .detail-body, .detail-side {
    grid-column: span 12 !important;
  }

  /* Ajustement spécifique pour la section Compétences & Personnalité */
  #skills .grid {
    display: flex;
    flex-direction: column;
    gap: var(--gap);
  }

  /* Force le conteneur parent des puces et passions à occuper toute la largeur */
  #skills .grid > div {
    grid-column: span 12 !important;
    width: 100%;
  }

  /* Réinitialise la hauteur forcée du Niveau de maîtrise sur mobile */
  .skills-list-card {
    height: auto !important;
  }
}