/* ========== Base ==========
   Police & couleurs
================================ */
body {
    font-family: 'EB Garamond', serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #f8f9fa;
    color: #333;
}

/* Container */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 1px;
}

/* ========== Header sticky transparent ==========
   Fixe en haut + espace en haut du body
================================ */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    background-color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 0;
    transition: background-color 0.3s ease;
}
body {
    padding-top: 5rem; /* espace pour ne pas cacher le contenu sous le header */
}

/* Brand */
header h1 {
    margin: 0;
    font-size: 1.5rem;
    display: inline-block;
}
header h1 a {
    text-decoration: none;
    color: #212529;
}

/* ========== Navigation ==========
   Lien actif en "plastique 3D" gris
================================ */
nav {
    display: inline-block;
    float: right;
}
nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
nav li {
    display: inline-block;
    margin-left: 15px;
}
nav a {
    position: relative; /* pour le ::after glossy */
    display: inline-block;
    text-decoration: none;
    color: #212529;
    font-weight: bold;

    padding: 4px 10px;
    border-radius: 6px;
    transition: filter .2s, transform .1s, background-color .2s, color .2s;
}
nav a:hover { background-color: rgba(0,0,0,.05); }
nav a:focus-visible {
    outline: 2px solid #adb5bd;
    outline-offset: 2px;
}

/* ===== Lien actif (3D plastique gris) ===== */
nav a.active {
  /* Palette sombre cohérente avec les badges 3D */
  --g1: #8d8d8d;   /* haut (clair) */
  --g2: #666666;   /* milieu */
  --g3: #3f3f3f;   /* bas (sombre) */
  --bd1: #2f2f2f;  /* bord général */
  --bd2: #1a1a1a;  /* bord bas (ombre) */
  --txt: #ffffff;  /* texte */

  color: var(--txt) !important;
  background: linear-gradient(to bottom, var(--g1), var(--g2) 45%, var(--g3));
  border: 1px solid var(--bd1);
  border-bottom-color: var(--bd2);

  text-shadow: 0 1px 0 rgba(0,0,0,.35);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55), /* liseré haut brillant */
    inset 0 -1px 0 rgba(0,0,0,.18),      /* liseré bas sombre */
    0 1px 0 rgba(255,255,255,.35),       /* reflet externe fin */
    0 2px 3px rgba(0,0,0,.18);           /* ombre portée */
}
nav a.active::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: linear-gradient(to bottom, rgba(255,255,255,.22), rgba(255,255,255,0) 55%);
  pointer-events: none;
}
nav a.active:hover { filter: brightness(1.05); }
nav a.active:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 1px rgba(0,0,0,.18),
    0 1px 1px rgba(0,0,0,.12);
}

/* ========== Layout contenu ==========
================================ */
main {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

/* Titres */
h2 {
    border-bottom: 2px solid grey;
    padding-bottom: 5px;
    margin-top: 0;
    font-size: 1.8rem;
}
h3 {
    border-bottom: 1px solid #e9ecef;
    padding-bottom: 5px;
    margin-top: 2rem;
    font-size: 1.5rem;
    color: #333;
}

/* Bio */
.bio-text { flex-grow: 1; min-width: 300px; }
.bio { margin-bottom: 40px; overflow: auto; }
.profile-pic-sticky {
    float: right;
    width: 300px;
    height: auto;
    margin: 0 0 20px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.bio { text-align: left; }

/* ========== Footer ==========
================================ */
footer {
    text-align: center;
    padding: 1rem 0;
    border-top: 1px solid #e9ecef;
    margin-top: 2rem;
    color: #6c757d;
}
.footnote {
    margin-bottom: 0.3rem;
    font-size: 0.8rem;
    color: #6c757d;
}
.social {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 0.3rem;
}
.social a img {
    width: 40px;
    height: 40px;
    opacity: 1;
    transition: opacity 0.2s, transform 0.2s;
}
.social a img:hover {
    opacity: 1;
    transform: translateY(-1px);
}

/* ========== Badges dans le contenu ==========
   Style "plastique 3D" gris pour .surligner
================================ */
.surligner {
  /* Palette plus sombre */
  --g1: #8d8d8d;   /* haut (clair) */
  --g2: #666666;   /* milieu */
  --g3: #3f3f3f;   /* bas (sombre) */
  --bd1: #2f2f2f;  /* bord général */
  --bd2: #1a1a1a;  /* bord bas (ombre) */
  --txt: #ffffff;  /* texte */

  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: text-bottom;
  white-space: nowrap;

  color: var(--txt);
  background: linear-gradient(to bottom, var(--g1), var(--g2) 45%, var(--g3));
  padding: 3px 10px;
  border: 1px solid var(--bd1);
  border-bottom-color: var(--bd2);
  border-radius: 6px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: .02em;
  text-decoration: none; /* si utilisé sur <a> */
  font-style: normal;    /* neutralise l'italique d'un <i> parent */

  text-shadow: 0 1px 0 rgba(0,0,0,.35);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    inset 0 -1px 0 rgba(0,0,0,.18),
    0 1px 0 rgba(255,255,255,.4),
    0 2px 3px rgba(0,0,0,.2);
}
.surligner::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(to bottom, rgba(255,255,255,.22), rgba(255,255,255,0) 55%);
  pointer-events: none;
}
.surligner:hover { filter: brightness(1.05); }
.surligner:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 1px 1px rgba(0,0,0,.18),
    0 1px 1px rgba(0,0,0,.12);
}
a.surligner, a.surligner:hover {
  color: #ffffff;
  text-decoration: none;
}
a.surligner:focus-visible {
  outline: 2px solid #adb5bd;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px rgba(255,255,255,.9);
}
/* Variantes optionnelles */
.surligner--pill { border-radius: 999px; }
.surligner--sm   { padding: 2px 8px; font-size: .95em; }

/* Liens auteur neutres (si utilisés ailleurs) */
.authorlink {
    color: #6c757d;
    background-color: white;
    padding: 2px 4px;
    border-radius: 3px;
}

/* ========== Bouton Back-to-top ==========
================================ */
#btn-haut {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 99;

    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;

    background-color: #9e9e9e;
    color: #fff;
    font-size: 18px;
    line-height: 45px;
    text-align: center;
    cursor: pointer;

    box-shadow: 0 2px 6px rgba(0,0,0,0.2);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;

    transition: opacity .25s ease, visibility .25s ease, transform .2s ease;
}
#btn-haut.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}
#btn-haut:hover {
    background-color: #757575;
    transform: translateY(-2px);
}
@media (prefers-reduced-motion: reduce) {
    #btn-haut { transition: none; }
    html { scroll-behavior: auto; }
}

/* ========== Publications & cartes ==========
================================ */
.publication {
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid #e9ecef;
    background-color: #ffffff;
    border-radius: 5px;
    transition: box-shadow 0.3s ease;
}
.publication:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.publication p {
    margin: 0;
    line-height: 1.6;
    color: #555;
}
.publication p:first-child {
    font-weight: bold;
    color: #212529;
}
.publication p em {
    font-style: italic;
    color: #6c757d;
}
.publication a {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background-color: #495057;
    color: white;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.9rem;
    font-weight: bold;
    transition: background-color 0.3s ease;
}
.publication a:hover { background-color: #212529; }

/* Bouton transparent */
.btn-transparent {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid #343a40;
    background-color: transparent;
    color: #343a40;
    text-decoration: none;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: bold;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.btn-transparent:hover {
    background-color: #343a40;
    color: #ffffff;
}

/* Carte "research" */
.research-item {
    margin-bottom: 25px;
    padding: 20px;
    border: 1px solid #e9ecef;
    background-color: #ffffff;
    border-radius: 5px;
    transition: box-shadow 0.3s ease;
}
.research-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
.research-item p {
    margin: 0;
    line-height: 1.5;
    color: #555;
}
.research-item p.title {
    font-weight: bold;
    color: #212529;
    font-size: 1.1em;
}
.research-item p.authors-year {
    font-size: 0.9em;
    color: #6c757d;
    margin-top: 5px;
    margin-bottom: 5px;
}
.research-item .buttons { margin-top: 15px; }
.research-item .abstract-text {
    margin-top: 15px;
    padding: 15px;
    background-color: #f8f9fa;
    border-left: 3px solid #6c757d;
    border-radius: 3px;
    line-height: 1.6;
}

/* ========== HTML viewer ==========
================================ */
.html-viewer {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.html-viewer iframe {
    width: 100%;
    min-height: 800px;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

/* ========== Titres de section page ==========
================================ */
.page-content h2 {
    font-family: 'Inter', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color, #1a1a1a);
    margin-bottom: 25px;
}

/* ========== Tables enseignement ==========
================================ */
.table-container { overflow-x: auto; }
.teaching-table {
    width: 100%;
    border-collapse: collapse;
    font-family: 'IBM Plex Mono', monospace;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 40px;
}
.teaching-table th, .teaching-table td {
    padding: 15px;
    text-align: left;
    border-right: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
}
.teaching-table th:last-child, .teaching-table td:last-child { border-right: none; }
.teaching-table th {
    background-color: #1a1a1a;
    color: #ffffff;
    font-weight: 600;
    text-transform: uppercase;
    border-right: 1px solid #333;
}
.teaching-table th:last-child { border-right: none; }
.teaching-table tr:nth-child(even) { background-color: #f8fafc; }
.teaching-table tr:hover { background-color: #eef1f5; }
.teaching-table .course-separator td { border-bottom: 2px solid #1a1a1a; }
.teaching-table a {
    color: #4b5563;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}
.teaching-table a:hover { color: #1a1a1a; text-decoration: underline; }
.teaching-table .course-name {
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
    vertical-align: middle;
}

/* ========== Sections "tools" & cartes ==========
================================ */
.tools-intro { text-align: center; padding: 60px 0 40px; }
.tools-intro h2 { font-size: 2.2rem; font-weight: 700; color: #1a1a1a; border-bottom: none; }
.tools-intro p { font-size: 1.1rem; color: #4b5563; max-width: 600px; margin: 0 auto; }
.course-section { padding: 40px 0; }
.section-header { text-align: center; margin-bottom: 30px; }
.section-header h3 { font-size: 1.8rem; font-weight: 700; color: #1a1a1a; margin-bottom: 10px; border-bottom: none; }
.section-header p { font-size: 1rem; color: #4b5563; max-width: 600px; margin: 0 auto; }
.course-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}
.course-card {
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 25px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
}
.course-card:hover { transform: translateY(-5px); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08); }
.course-card h4 { font-size: 1.3rem; font-weight: 700; color: #1a1a1a; margin-bottom: 10px; }
.course-card p { font-size: 0.9rem; color: #4b5563; margin-bottom: 15px; flex-grow: 1; }
.course-card .syllabus-link {
    display: inline-flex;
    padding: 10px 20px;
    background-color: #495057;
    color: #ffffff;
    text-decoration: none;
    border-radius: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
    align-self: flex-start;
    align-items: center;
    gap: 8px;
}
.course-card .syllabus-link:hover { background-color: #212529; }

/* ========== Modale outils (responsive) ==========
================================ */
/* Fix vh iOS : initialisé par JS (window.innerHeight * 0.01) */
:root { --vh: 1vh; }

/* Overlay */
.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(0,0,0,.6);
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  transition: opacity .2s ease;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
           env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
.modal.is-open { opacity: 1; pointer-events: auto; }

/* Boîte 16/9 (desktop) */
.modal__dialog {
  width: min(92vw, 1100px);
  aspect-ratio: 16 / 9;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(0,0,0,.35);
  overflow: hidden;
  position: relative;
}

/* Barre d’actions */
.modal__controls {
  position: absolute;
  top: max(8px, env(safe-area-inset-top, 0));
  right: max(8px, env(safe-area-inset-right, 0));
  display: flex;
  gap: 8px;
  z-index: 2;
}
.modal__btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  padding: 6px 10px;
  background: rgba(0,0,0,.6);
  color: #fff;
  cursor: pointer;
  font: 600 14px/1.1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
.modal__btn:hover { background: rgba(0,0,0,.75); }

/* iFrame interne */
.modal__frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
}

/* Mode PiP */
.modal.pip { background: transparent; pointer-events: none; padding: 0; }
.modal.pip .modal__dialog {
  position: fixed;
  right: max(12px, env(safe-area-inset-right, 0));
  bottom: max(12px, env(safe-area-inset-bottom, 0));
  width: clamp(320px, 30vw, 480px);
  height: auto;
  aspect-ratio: 16 / 9;
  pointer-events: auto;
  border: 1px solid rgba(0,0,0,.1);
  border-radius: 12px;
}

/* Mobile : plein écran */
@media (max-width: 768px) {
  .modal__dialog {
    width: 100vw;
    width: 100svw;
    height: calc(var(--vh) * 100);
    max-height: none;
    aspect-ratio: auto;
    border-radius: 0;
  }
  .modal.pip .modal__dialog {
    width: min(92vw, 480px);
    height: auto;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
  }
  @media (max-width: 380px) { #btn-pip { display: none; } }
}

/* Scroll-lock pour modale */
body.is-locked {
  position: fixed;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}
