/* =====================================================================
   ASSOCIATIVE SEMANTICS — Refonte 2026 v2
   Style épuré, frugal, accessible (WCAG 2.1 AA)
   Police monospace type machine à écrire, sans lignes inter-lignes,
   sans bullet points, taille réduite.
   ===================================================================== */

/* ----- Variables ------------------------------------------------------- */
:root {
  /* Couleurs : noir adouci / blanc uniquement, hors puces catégorielles.
     Le noir #1a1a1a offre un contraste ~16:1 sur blanc, toujours AAA,
     mais moins agressif visuellement que le #0a0a0a. */
  --color-bg:        #ffffff;
  --color-text:      #1a1a1a;        /* noir adouci, contraste ~16:1 sur blanc */
  --color-text-soft: #2a2a2a;
  --color-line:      #2a2a2a;        /* traits, bordures */
  --color-line-soft: #7a7a7a;        /* pointillés secondaires */
  --color-muted-bg:  #f3f3f3;
  --color-link:      #1a1a1a;        /* couleur des liens (identique au texte, mis en évidence par le bold) */

  /* Puces catégorielles (publications) : couleurs d'origine conservées
     pour blue/yellow/green. Grey et red assombris pour le contraste WCAG AA. */
  --cat-blue:   #13b4ff;
  --cat-yellow: #ffff33;
  --cat-green:  #00ff7f;
  --cat-grey:   #4a4a4a;
  --cat-red:    #b71c1c;

  /* Typographie : MONOSPACE type machine à écrire (FreeMono / Noto Sans Mono) */
  --font-mono: 'Noto Sans Mono', 'JetBrains Mono', 'Roboto Mono', ui-monospace,
               'SFMono-Regular', 'Menlo', 'Consolas', 'DejaVu Sans Mono',
               'FreeMono', monospace;

  /* Largeurs */
  --max-content: 840px;
  --sidebar-w:   200px;
  --gap:          48px;

  /* Taille de base réduite */
  --font-size-base:   0.85rem;   /* ~13.6 px */
  --line-height:      1.55;
}

/* ----- Reset minimal --------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  padding: 0;

  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-mono);
  font-size: var(--font-size-base);
  line-height: var(--line-height);
  font-weight: 400;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--color-link);
  text-decoration: none;
  /* Liens mis en évidence par l'italique plutôt que par le soulignement ou le gras.
     Utilise le style italic de la même police monospace, ce qui reste cohérent
     avec le style machine à écrire et discret visuellement. */
  font-style: italic;
}
/* Au survol : inversion discrète noir/blanc (effet terminal cohérent avec le style) */
a:hover {
  background: var(--color-text);
  color: var(--color-bg);
  text-decoration: none;
  font-style: normal;
}

/* ----- Skip link (accessibilité clavier) ------------------------------ */
.skip-link {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2000;
  background: var(--color-text);
  color: var(--color-bg);
  padding: 0.4rem 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform 0.15s ease;
}
.skip-link:focus { transform: translateY(0); outline: 2px solid var(--color-text); outline-offset: 2px; }

/* ----- Visibilité du focus clavier (AAA 2.4.7) ------------------------ */
/* Comme les liens ne sont pas soulignés par défaut, on rend le focus
   très visible : outline épais + soulignement apparent */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--color-text);
  outline-offset: 2px;
  background: transparent;
  color: var(--color-text);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-style: normal;  /* reset de l'italique au focus pour meilleure lisibilité */
}

/* ----- En-tête de site ------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-line);
  padding: 0.6rem 1.25rem;
  text-align: center;
}
.site-header .site-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
}
.site-header .site-title a {
  color: var(--color-text);
  text-decoration: none;
  font-style: normal;  /* reset de l'italique global : titre du site en style normal */
}
.site-header .site-title a:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

/* Bouton hamburger (mobile uniquement) */
.nav-toggle {
  position: absolute;
  top: 0.4rem;
  left: 0.75rem;
  display: none;
  background: var(--color-bg);
  border: 1px solid var(--color-line);
  border-radius: 0;
  padding: 0.35rem 0.5rem;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-text);
}
.nav-toggle:hover { background: var(--color-text); color: var(--color-bg); }
.nav-toggle .bars {
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
}
.nav-toggle .bars span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
}

/* ----- Mise en page principale (centrée) ------------------------------ */
.layout {
  display: flex;
  justify-content: center;
  gap: var(--gap);
  max-width: calc(var(--sidebar-w) + var(--gap) + var(--max-content));
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.sidebar {
  flex: 0 0 var(--sidebar-w);
  font-family: var(--font-mono);
  /* Aligner le menu avec le contenu en haut : pas de sticky, alignement naturel */
}
.sidebar nav[aria-label="Navigation principale"] ul,
.sidebar nav[aria-label="Sections of the site"] ul {
  list-style: none;
  margin: 0;
  padding: 0;
  /* Plus de sticky : alignement naturel avec le contenu */
}
.sidebar nav li { margin: 0; }
.sidebar nav a {
  display: block;
  padding: 0.35rem 0;
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.95rem;  /* police du menu plus grande que le texte de contenu (0.85rem) */
  font-style: normal;  /* reset de l'italique global : navigation en style normal */
  letter-spacing: 0.02em;
}
.sidebar nav a:hover,
.sidebar nav a:focus-visible {
  background: var(--color-text);
  color: var(--color-bg);
  outline: none;
}
.sidebar nav a[aria-current="page"] {
  font-weight: 700;
}

/* ----- Logos institutionnels dans la sidebar ------------------------- */
.sidebar-logos {
  margin-top: 1.2rem;           /* espace d'environ 0.5cm (19px) entre le menu et les logos */
  padding-top: 0;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  align-items: center;
}
/* Conteneur carré fixe pour tous les logos : garantit un alignement uniforme */
.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 6rem;                  /* conteneur carré de 6rem de côté (agrandi) */
  height: 6rem;
  line-height: 0;
  font-style: normal;
  overflow: hidden;
}
/* Logo plus grand pour les logos verticaux (Unicaen, MTU) : conteneur rectangulaire
   pour que le logo s'affiche plus grand tout en restant aligné. */
.sidebar-logo-tall {
  width: 9rem;
  height: 7.5rem;               /* hauteur agrandie pour permettre au logo vertical d'être plus grand */
}
/* Logo plus petit visuellement pour le CNRS (qui remplit trop le conteneur carré) */
.sidebar-logo-small img {
  max-width: 80% !important;    /* réduit de 20% pour équilibrer visuellement */
}
.sidebar-logo:hover {
  background: transparent;
}
.sidebar-logo img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  opacity: 1;
  transition: opacity 0.15s ease;
}
.sidebar-logo:hover img {
  opacity: 0.8;
}
/* Logo sans lien (AWI) : en gris pour indiquer qu'il n'y a pas de site */
.sidebar-logo-nolink img {
  filter: grayscale(100%);
  opacity: 0.6;
}
.sidebar-logo-nolink:hover img {
  opacity: 0.6;
}

/* ----- Contenu principal --------------------------------------------- */
.main {
  flex: 1 1 auto;
  max-width: var(--max-content);
  min-width: 0;
}

.page-title {
  display: inline-block;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.62rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  margin: 0 0 0.8rem 0 !important;  /* !important pour override .main h1 qui a une spécificité supérieure */
  /* Surligné noir restauré (demande utilisateur) */
  background: var(--color-text);
  color: var(--color-bg);
}

.main h1 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.3;
  margin: 1.5rem 0 0.7rem;
}
.main h2 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 1.3rem 0 0.5rem;
}
.main h3 {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  margin: 1rem 0 0.4rem;
}

.main p {
  margin: 0 0 0.6rem;
  font-size: 0.85rem;
  line-height: var(--line-height);
  text-align: justify;
  hyphens: auto;
}

.main strong { font-weight: 700; }

/* Le texte justifié devient gauche sur petits écrans (lisibilité) */
@media (max-width: 720px) {
  .main p { text-align: left; }
}

/* ----- Listes : SANS bullet points, SANS lignes entre items ----------- */
.main ul {
  list-style: none;
  padding: 0;
  margin: 0 0 0.8rem;
}
.main ul li {
  position: relative;
  padding: 0.2rem 0;
  font-size: 0.8rem;
  line-height: 1.3;
  /* Pas de bullet point, pas de bordure */
}
/* S'assurer qu'aucun ::before ne vienne ajouter des puces */
.main ul li::before {
  content: none;
}

/* Les barres verticales | dans les listes ne doivent pas être en italique
   même si elles sont à l'intérieur d'un lien (qui lui est en italique) */
.main ul li a {
  font-style: italic;
}
.main ul li .footer-sep {
  font-style: normal;
}

/* Listes de publications (avec puces catégorielles) */
.main ul.pub-list li {
  padding-left: 0;
  padding-right: 0;
}

/* ----- Séparateurs (uniquement là où l'utilisateur les place explicitement) */
.hr {
  width: 100%;
  height: 1px;
  border: 0;
  border-bottom: 1px dotted var(--color-line-soft);
  margin: 0.5rem 0 0.7rem;
}

/* ----- Image d'entête de page ---------------------------------------- */
.hero-image {
  margin: 0 0 1.2rem;
  text-align: center;
}
.hero-image img {
  margin: 0 auto;
  max-width: 100%;
  border: 1px solid var(--color-line-soft);
}

/* ----- Bloc contact / infos ------------------------------------------ */
.info-block {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: var(--line-height);
}
.info-block .label {
  font-weight: 700;
  letter-spacing: 0.04em;
}

/* Contenu principal hérité (anciens <h1> de mise en forme) -> conteneur neutre */
.content-body {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: var(--line-height);
  margin: 0;
  text-align: justify;
}
.content-body b { font-weight: 700; }

/* ----- Obfuscation d'email (anti-spam) ------------------------------- */
/* La classe .fj insère "gael.d" + zero-width space après le texte du span.
   Le zero-width space (\200B) est invisible à l'écran mais permet de
   reconstituer l'email "gael.dias@..." sans espace visible entre "d" et "ias".
   L'espace entre "Email |" et "gael.dias" vient du contenu du span qui
   contient "Email | " (avec un espace en fin). */
.fj:after {
  content: "gael.d\200B";
}

/* ----- Liens CV en bas de page --------------------------------------- */
.cv-link {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-style: normal;  /* reset de l'italique global des liens : les cv-link sont déjà des badges */
  padding: 0.3rem 0.6rem;
  background: var(--color-muted-bg);
  border: 1px solid var(--color-line);
  color: var(--color-text);
  text-decoration: none;
  margin: 0.2rem 0;
}
.cv-link + .cv-link { margin-left: 0.3rem; }
.cv-link:hover {
  background: var(--color-text);
  color: var(--color-bg);
}

.cv-link-wrapper {
  text-align: right;
  margin: 0.8rem 0;
  line-height: 1;
}

/* ----- Légende sous image -------------------------------------------- */
.caption {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-text-soft);
  text-align: left;
  margin: 0.3rem 0 1.2rem;
  font-style: italic;
}

/* ----- Vidéos (youtube/vimeo responsives) ---------------------------- */
.video-embed {
  position: relative;
  padding-bottom: 56.25%;      /* 16:9 */
  height: 0;
  overflow: hidden;
  margin: 0.7rem 0;
  background: var(--color-muted-bg);
  border: 1px solid var(--color-line-soft);
}
.video-embed a {
  display: block;
  position: relative;
  text-decoration: none;
}
.video-embed img {
  display: block;
  width: 100%;
  height: auto;
}
.video-embed a span {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ff0000;
  color: #fff;
  font-size: 1.5rem;
  padding: 0.3rem 0.8rem;
  border-radius: 0.3rem;
  font-family: sans-serif;
}
.video-embed a:hover span {
  background: #cc0000;
}
.video-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-align: right;
  margin: 0.3rem 0 1.2rem;
  line-height: 1.45;
}

/* ----- Bloc puces catégorielles (publications) ----------------------- */
.legend {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  margin: 0 0 1.2rem;
  line-height: 1.6;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0;
}

/* Marqueur catégoriel : carré de couleur + étiquette texte
   (conservation des couleurs + label texte pour l'accessibilité)
   Taille réduite pour moins de lourdeur visuelle. */
.cat-marker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  font-family: var(--font-mono);
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  border: 1.5px solid var(--color-line);
  color: var(--color-text);
  background: var(--color-bg);
  vertical-align: middle;
  flex-shrink: 0;
  line-height: 1;
}
.cat-blue   { background: var(--cat-blue);   }
.cat-yellow { background: var(--cat-yellow); }
.cat-green  { background: var(--cat-green);  }
.cat-grey   { background: var(--cat-grey);   color: var(--color-bg); }
.cat-red    { background: var(--cat-red);    color: var(--color-bg); }

/* Variante compacte : dans les listes de publications */
.pub-list .cat-marker {
  width: 1.1rem;
  height: 1.1rem;
  font-size: 0.46rem;
  margin-right: 0.35rem;
}

.pub-list li b { font-family: var(--font-mono); }

/* ----- Bouton retour en haut ---------------------------------------- */
.back-to-top {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--color-text);
  text-decoration: underline;
  margin-top: 1.5rem;
  padding: 0.2rem 0;
}
.back-to-top:hover {
  background: var(--color-text);
  color: var(--color-bg);
  text-decoration: none;
}

/* Bouton de fermeture du menu mobile : caché sur desktop */
.nav-close {
  display: none;
}

/* ----- Masquage accessible (lecteurs d'écran uniquement) ------------- */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ----- Réduction des animations pour utilisateurs sensibles ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ====================================================================
   MISE EN PAGE RESPONSIVE
   ==================================================================== */

/* Tablette et dessous : navigation passe en hamburger offcanvas */
@media (max-width: 991px) {
  .nav-toggle { display: inline-flex; align-items: center; gap: 0.3rem; }

  /* Bouton de fermeture visible uniquement sur mobile */
  .nav-close {
    display: block;
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: var(--color-bg);
    border: 1px solid var(--color-line);
    width: 1.8rem;
    height: 1.8rem;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text);
    font-family: var(--font-mono);
  }
  .nav-close:hover { background: var(--color-text); color: var(--color-bg); }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(260px, 80vw);
    background: var(--color-bg);
    border-right: 1px solid var(--color-line);
    padding: 3.5rem 1.2rem 1.5rem;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 1100;
    overflow-y: auto;
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar nav[aria-label="Navigation principale"] ul,
  .sidebar nav[aria-label="Sections of the site"] ul { position: static; }

  /* Overlay sombre derrière le menu mobile */
  .nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
  }
  .nav-backdrop.is-open { opacity: 1; visibility: visible; }

  .layout { padding: 1.2rem 1rem 2.5rem; }
}

/* Mobile étroit : on resserre encore */
@media (max-width: 540px) {
  :root { --max-content: 100%; }
  .layout { padding: 0.8rem 0.75rem 2rem; gap: 0; }
  .site-header { padding: 0.5rem 1rem; }
  .site-header .site-title { font-size: 0.7rem; letter-spacing: 0.1em; }
  .main h1 { font-size: 0.9rem; }
  .page-title { font-size: 0.58rem; letter-spacing: 0.15em; padding: 0.2rem 0; }
  .main p,
  .info-block,
  .content-body { font-size: 0.78rem; }
  .main ul li { font-size: 0.75rem; }
}

/* Impression */
@media print {
  .site-header, .sidebar, .skip-link, .nav-toggle, .back-to-top, .site-footer { display: none !important; }
  .layout { display: block; max-width: 100%; }
  .main { max-width: 100%; }
  a { color: #000; text-decoration: underline; }
  a[href]::after { content: " (" attr(href) ")"; font-size: 0.85em; color: #333; }
}

/* ====================================================================
   PIED DE PAGE (style Maurel adapté au style du site)
   Le footer est sticky (toujours visible en bas) comme le header est sticky en haut.
   Le padding-bottom de .layout garantit que le contenu n'est pas masqué.
   ==================================================================== */
.site-footer {
  position: sticky;
  bottom: 0;
  z-index: 900;
  width: 100%;
  padding: 0.7rem 1.5rem 0.8rem;
  background: var(--color-bg);
  border-top: 1px solid var(--color-line);
  text-align: center;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.8fr 1.5fr 2fr 1.1fr 0.7fr;  /* Address élargie (position 1) */
  gap: 1.2rem;
  align-items: start;
  justify-content: center;
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
}

.footer-col {
  text-align: left;            /* le texte reste aligné à gauche dans chaque colonne */
}

.footer-title {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.6rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--color-text);
  margin: 0 0 0.35rem 0;
  padding: 0;
  background: transparent;
}

.footer-col p {
  font-family: var(--font-mono);
  font-size: 0.62rem;            /* taille réduite pour tenir sur 2 lignes avec 5 colonnes */
  line-height: 1.4;
  margin: 0 0 0.15rem 0;
  padding: 0;
  color: var(--color-text);
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Tous les liens du footer sont en style normal (pas d'italique) */
.site-footer a {
  font-style: normal;
}

/* Liens du footer sans italique (pour les liens séparés par barre verticale) */
.footer-link-normal {
  font-style: normal;
}

/* Séparateur non oblique entre éléments (ex: entre Unicaen et CNRS GREYC) */
.footer-sep {
  font-style: normal;
  font-weight: 400;
}

/* Responsive */
@media (max-width: 991px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
  }
}

@media (max-width: 540px) {
  .site-footer {
    padding: 0.6rem 0.75rem 0.7rem;
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
  .footer-col p {
    font-size: 0.62rem;
  }
  .footer-title {
    font-size: 0.55rem;
  }
}
