:root {
  --bg:#0b1220; --bg-muted:#0f1524; --card:#0f172a; --surface:#0b1220;
  --text:#e6e9ef; --muted:#9aa7bd; --line:#1e293b; --ring:#3b82f6;
  --primary:#3b82f6; --primary-600:#2563eb; --chip:#0b1f3a;
}

*{ box-sizing:border-box }
html,body{
  margin:0;
  background:radial-gradient(1200px 800px at 10% 0%, var(--bg-muted), var(--bg));
  color:var(--text);
  font-family:'Inter', ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  line-height:1.65;
}
a{ color:var(--primary); text-decoration:none }
a:hover{ text-decoration:underline }
img{ display:block; max-width:100%; height:auto }
.container{ max-width:1024px; margin-inline:auto; padding:24px }

/* Fond animé */
#bg-canvas{ position:fixed; inset:0; width:100%; height:100%; z-index:0; display:block }
#fullpage, .section{ position:relative; z-index:1 }

/* Hero */
.hero{
  display:grid; grid-template-columns:108px 1fr; gap:22px; align-items:center;
  padding:28px; border:1px solid var(--line); border-radius:20px;
  background:color-mix(in srgb, var(--card) 92%, transparent);
  box-shadow:0 10px 30px rgba(0,0,0,.28)
}
.avatar{ width:108px; height:108px; border-radius:50%; object-fit:cover; border:2px solid var(--line) }
.headline{ display:flex; flex-wrap:wrap; align-items:baseline; gap:10px }
.name{ margin:0; font-size:clamp(26px,3.6vw,36px); letter-spacing:-0.01em }
.role{ margin:0; color:var(--muted); font-weight:600 }
.summary{ margin:10px 0 0 }

/* Respecter \n depuis le JSON */
#summary, #resume, .item p { white-space: pre-line; }

/* Compétences — boutons/pills */
.tags{ display:flex; flex-wrap:wrap; gap:10px; padding:0; margin:12px 0 0; list-style:none }
.tag{ padding:7px 12px; border-radius:999px; background:var(--chip); border:1px solid var(--line); font-size:13.5px }

/* Actions */
.actions{ display:flex; gap:12px; margin-top:14px; flex-wrap:wrap }
.btn{
  display:inline-flex; align-items:center; gap:10px; border:1px solid var(--line);
  padding:10px 14px; border-radius:12px; background:var(--surface); color:inherit;
  font-weight:600; transition:transform .05s ease, box-shadow .15s ease, background .15s ease;
  box-shadow:0 1px 0 rgba(0,0,0,.05)
}
.btn:hover{ transform:translateY(-1px) }
.btn:focus-visible{ outline:2px solid var(--ring); outline-offset:2px }
.btn.primary{
  background:linear-gradient(180deg, var(--primary), var(--primary-600));
  color:#fff; border-color:transparent; box-shadow:0 6px 20px rgba(59,130,246,.35)
}

/* Cartes internes */
.section-card{
  padding:24px; border:1px solid var(--line); border-radius:18px; background:var(--card);
  box-shadow:0 10px 30px rgba(0,0,0,.22);
  max-height:calc(100svh - 48px - 32px);
  overflow:auto;
}
.section-card::-webkit-scrollbar{ width:8px }
.section-card::-webkit-scrollbar-thumb{ background:#94a3b8; border-radius:999px }
.section-card{ scrollbar-width: thin; scrollbar-color:#94a3b8 transparent }

/* Tête de section : titre + pager (stabilisée) */
.section-head{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  margin-bottom:8px; min-height:44px; flex-wrap:nowrap;
}
.section-head h2{
  margin:0; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}

/* Pager */
.pager{ display:flex; align-items:center; gap:10px; flex-shrink:0; white-space:nowrap }
.pager .nav{
  appearance:none; border:1px solid var(--line); background:var(--surface); color:var(--text);
  padding:10px 14px; border-radius:10px; font-weight:700; cursor:pointer;
  transition:transform .08s ease, background .15s ease;
  min-width: 44px; min-height: 44px;
}
.pager .nav:hover{ transform:translateY(-1px) }
.pager .nav:disabled{ opacity:.45; cursor:not-allowed; transform:none }
.pager .page-indicator{ font-variant-numeric: tabular-nums; color:var(--muted) }

/* Listes (Expériences / Publications / Bénévolat / Formation) */
.list{ display:grid; gap:16px }
.item{
  display:grid; gap:6px;
  border-left:3px solid var(--line);
  padding-left:12px;
}
.item header{ display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap }
.item .title{ font-weight:700 }
.item .meta{ color:var(--muted); font-size:14px }
.item .venue{ font-weight:600; color:var(--muted) }

/* Titres longs : clamp & césure */
.item .title, .item .title a{
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
  overflow:hidden; word-break:break-word; overflow-wrap:anywhere; hyphens:auto;
}

/* Animation de swap */
.anim-swap{ transition: transform .28s ease, opacity .28s ease }
.anim-swap.is-leaving{ opacity:0; transform: translateY(6px) }
.anim-swap.is-entering{ opacity:0; transform: translateY(-6px) }
.anim-swap.is-entering.anim-on{ opacity:1; transform: translateY(0) }

/* Grille de boutons finaux (ancienne version — non utilisée) */
.more-grid{
  display:grid; gap:12px;
  grid-template-columns: 1fr;
}
@media (min-width: 680px){
  .more-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Footer */
.footer{ margin:24px 0 12px; color:var(--muted); text-align:center; font-size:14px }

/* === Section "Plus" : grille 2×2 centrée, tailles identiques === */
.actions.more-actions{
  display: grid !important;            /* écrase le flex de .actions */
  grid-template-columns: repeat(2, 260px);
  grid-auto-rows: 56px;
  gap: 16px;
  justify-content: center;
  align-content: start;
  margin: 20px auto 8px;
}
.actions.more-actions .btn{
  width: 100%; height: 100%;
  display:inline-flex; justify-content:center; align-items:center; text-align:center;
  white-space: nowrap; overflow:hidden; text-overflow: ellipsis;
}
@media (max-width: 640px){
  .actions.more-actions{
    grid-template-columns: 280px;
    grid-auto-rows: 56px;
  }
}

/* Césure FR */
html{ hyphens:auto; }

.ball {
  position: absolute;
  border-radius: 100%;
  opacity: 0.7;
}

/* ===== Cartes avec logo + contenu ===== */
.item-head{
  display:grid;
  grid-template-columns: 84px 1fr;  /* logo plus petit que l'avatar 108px */
  gap: 14px;
  align-items: center;
}

.item .logo {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: contain;       /* logo entier */
  background-color: #fff;    /* fond pour combler les vides */
  padding: 6px;              /* espace interne */
  border: 2px solid var(--line);
}

/* Ligne meta (venue à gauche / date à droite) */
.item .meta-row{
  display:flex; justify-content:space-between; gap:12px; flex-wrap:wrap;
  margin:0 0 4px 0;
}
.item .venue{ font-weight:600; color:var(--muted) }

/* Titres : on garde clamp */
.item .title, .item .title a{
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
  overflow:hidden; word-break:break-word; overflow-wrap:anywhere; hyphens:auto;
  margin: 2px 0 6px 0;
}

/* Tags (compétences) centrés à l’intérieur des cartes */
.item .tags{
  justify-content:center;          /* centrage horizontal */
  margin-top: 8px;                 /* petit espace au-dessus */
}

/* ---------- Lightbox: layout robuste & scrollable ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;                    /* respiration autour sur desktop */
  background: rgba(0,0,0,.6);
  backdrop-filter: saturate(110%) blur(2px);
}

.lightbox.open { display: flex; }

.lightbox-inner {
  width: min(1000px, 94vw);
  max-height: 92dvh;                /* d(v)h = mieux sur mobile que vh */
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;                  /* masque les débords internes */
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}

/* zone média en haut (image / iframe) */
.lightbox-media,
#lb-media {
  flex: 0 0 auto;                   /* ne grandit pas à l’infini */
  max-height: clamp(240px, 60dvh, 70dvh);
  overflow: hidden;                  /* au cas d’iframe agressive */
  background: #000;                  /* fond neutre pour images letterboxed */
}

.lightbox-media img,
.lightbox-media iframe,
#lb-media img,
#lb-media iframe {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;               /* tout voir dans la fenêtre média */
  border: 0;
  border-radius: 0;
  background: #000;
}

/* corps scrollable (titre, meta, desc, tags, actions) */
.lightbox-body {
  flex: 1 1 auto;                    /* occupe le reste */
  min-height: 0;                     /* autorise overflow auto */
  overflow: auto;                    /* scroll interne si nécessaire */
  -webkit-overflow-scrolling: touch; /* inertie iOS */
  padding: 16px;
}

.lightbox-title { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.lightbox-meta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.lightbox-desc { margin: 0 0 10px; }
.lightbox-tags { display:flex; flex-wrap:wrap; gap:8px; list-style:none; padding:0; margin:10px 0 0; }

/* bouton fermer */
.lb-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}

/* Mobile: compacter un peu */
@media (max-width: 640px) {
  .lightbox { padding: 8px; }
  .lightbox-inner { max-height: 90dvh; width: 96vw; }
  .lightbox-media, #lb-media { max-height: 48dvh; }
  .lightbox-body { padding: 12px; }
}

/* ===================== */
/* === Galerie projets ===
   (doc.html)
   Composants: .gallery-*, .grid-portfolio, .card-portfolio, .filter-btn
   ===================== */

.gallery-wrap {
  max-width: 1200px;
  margin-inline: auto;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.gallery-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.gallery-head h1 {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
}

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 600;
  transition: transform .06s ease, background .15s ease;
}
.filter-btn:hover { transform: translateY(-1px); }
.filter-btn.active {
  background: #3b82f6;   /* var(--primary) */
  color: #fff;
  border-color: transparent;
  box-shadow: 0 0 0 2px rgba(59,130,246,.25);  /* halo pour focus */
}
.filter-btn:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

/* Grille responsive */
.grid-portfolio {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(1, minmax(0, 1fr));
}
@media (min-width: 640px) {
  .grid-portfolio { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid-portfolio { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ===================== */
/* === Carte projet === */
/* ===================== */

.card-portfolio {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
  cursor: zoom-in;
}

/* Image */
.card-media {
  aspect-ratio: 4 / 3;
  width: 100%;
  height: 220px;
  object-fit: cover;
  display: block;
  background: #111;
  transition: transform .35s ease;
  will-change: transform;
}

/* Overlay gris */
.card-portfolio::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.35);
  opacity: 0;
  transition: opacity .25s ease;
  pointer-events: none;
  z-index: 1; /* sous le texte */
}

/* Zone hover bas (dégradé) */
.card-hover {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: end;
  padding: 12px;
  background: linear-gradient(180deg, transparent 40%, rgba(0,0,0,.55));
  opacity: 0;
  transition: opacity .25s ease;
  z-index: 2; /* au-dessus du voile gris */
}

/* Contenu (titre + meta + tags) */
.card-body {
  width: 100%;
  position: relative;
  z-index: 3; /* toujours au-dessus */
}
.card-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  transition: color .2s ease;
}
.card-meta {
  color: var(--muted);
  font-size: 13px;
  transition: color .2s ease;
}
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.card-tags .tag {
  font-size: 12.5px;
  padding: 6px 10px;
  transition: color .2s ease, background .2s ease, border .2s ease;
}

/* Effets hover */
.card-portfolio:hover::after {
  opacity: 1; /* voile gris */
}
.card-portfolio:hover .card-media {
  transform: scale(1.035); /* zoom */
}
.card-portfolio:hover .card-hover {
  opacity: 1; /* dégradé bas */
}
.card-portfolio:hover .card-title,
.card-portfolio:hover .card-meta,

/* Accessibilité */
@media (min-width: 640px){ .card-media { height: 200px; } }
@media (min-width:1024px){ .card-media { height: 180px; } }
@media (prefers-reduced-motion: reduce) {
  .card-media,
  .card-portfolio::after,
  .card-hover {
    transition: none !important;
  }
}

/* Bouton retour */
.back-actions { display: flex; gap: 12px; flex-wrap: wrap; }

/* === Lightbox commune === */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: none;           /* .open active l’affichage */
  align-items: center;
  justify-content: center;
  padding: 16px;           /* respirations sur desktop */
  background: rgba(0,0,0,.6);
  backdrop-filter: saturate(110%) blur(2px);
}
.lightbox.open { display: flex; }

.lightbox-inner {
  width: min(1000px, 94vw);
  max-height: 92dvh;       /* mieux que vh sur mobile */
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,.4);
}

/* Zone média en haut (image/iframe) */
.lightbox-media,
#lb-media {
  flex: 0 0 auto;
  max-height: clamp(240px, 60dvh, 70dvh);
  overflow: hidden;
  background: #000;
}
.lightbox-media img,
.lightbox-media iframe,
#lb-media img,
#lb-media iframe {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;     /* tout voir sans crop */
  border: 0;
  border-radius: 0;
  background: #000;
}

/* Corps scrollable (titre, meta, desc, tags, actions) */
.lightbox-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}
.lightbox-title { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.lightbox-meta  { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.lightbox-desc  { margin: 0 0 10px; }
.lightbox-tags  {
  display: flex; flex-wrap: wrap; gap: 8px;
  list-style: none; padding: 0; margin: 10px 0 0;
}
.lightbox-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

/* Bouton fermer */
.lb-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text);
  font-weight: 700;
}


/* ====   MOBILE   ==== */
@media (max-width: 640px){
  .lightbox { padding: 8px; }
  .lightbox-inner { max-height: 90dvh; width: 96vw; }
  .lightbox-media, #lb-media { max-height: 48dvh; }
  .lightbox-body { padding: 12px; }

  /* Conteneur : un peu plus d’air, largeur fluide */
  .container { padding: 16px; }

  /* Hero -> pile tout en colonne + centrage */
  .hero{
    grid-template-columns: 1fr;      /* plus de 2 colonnes */
    text-align: center;
    gap: 16px;
    padding: 20px;
  }
  .avatar{
    margin-inline: auto;
    width: 96px; height: 96px;
  }
  .headline{ justify-content: center; }
  .summary{ margin-top: 8px; }

  /* Compétences & actions centrées dans le hero */
  .hero .tags{ justify-content: center; }
  .actions{ justify-content: center; }

  /* Section-card : pas de hauteur fixe sur mobile -> tout en vertical, la page scrolle */
  .section-card{
    max-height: none;
    overflow: visible;
    padding: 18px;
  }

  /* En-tête de section : titre au-dessus, pager en-dessous */
  .section-head{
    flex-direction: column;
    align-items: stretch;     /* le pager prend la largeur */
    gap: 10px;
    min-height: 0;
  }
  .section-head h2{
    text-align: left;         /* ou center si tu préfères */
    white-space: normal;
  }

  /* Pager : largeur pleine + boutons plus larges pour le pouce */
  .pager{
    justify-content: space-between;
    width: 100%;
  }
  .pager .nav{
    padding: 10px 14px;
    border-radius: 12px;
  }
  .pager .page-indicator{ margin-inline: 8px; }

  /* Cartes: logo au-dessus, texte en dessous -> tout vertical */
  .item-head{
    grid-template-columns: 1fr;   /* plus de colonne logo + contenu */
    gap: 10px;
    align-items: start;
  }
  .item .logo{
    width: 54px; height: 54px;
    margin-inline: auto;          /* centre le logo */
  }
  .item .meta-row{
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .item .venue{ order: 1; }
  .item .meta { order: 2; }

  /* Titres longs : autoriser 3 lignes */
  .item .title, .item .title a{
    -webkit-line-clamp: 3;
    color: var(--text);
    transition: color .2s ease;
  }

  /* Tags dans les cartes : centrés */
  .item .tags{ justify-content: center; }

  /* Section "Plus" : grille mono-colonne centrée */
  .actions.more-actions{
    grid-template-columns: 1fr;
    grid-auto-rows: 52px;
    max-width: 420px;
    margin-inline: auto;
  }
  .actions.more-actions .btn{
    width: 100%;
    justify-content: center;
  }
}

/* ====   TABLETTE    ==== */
@media (min-width: 641px) and (max-width: 900px){
  .hero{
    grid-template-columns: 84px 1fr;
    gap: 16px;
  }
  .avatar{ width: 84px; height: 84px; }
  .section-card{ max-height: none; overflow: visible; } /* évite les scrolls internes */
  .section-head{ gap: 12px; }
  .item .logo{ width: 56px; height: 56px; }
}

.fp-watermark {
  display: none !important;
}
