:root {
  --bg: #0f1724;
  --card: #0f1b2b;
  --muted: #9aa7bd;
  --accent: #7dd3fc;
  --track-bg: #262a31;
  --thumb-bg: #5a616e;
  --menu-bg: #0b1c36;
  --tick: 25%;
}

html {
  scroll-behavior: smooth;
}

#projets.card > .nav-block {
  grid-column: 1;
  grid-row: 1 / -1;
  position: sticky !important;
  top: 0;
  height: 100vh;
  align-self: start;
  padding: 14px 0;
  background: transparent;
  z-index: 1;
}

/* ========= Frise verticale ========= */
#projets.card > .nav-block::before {
  content: "";
  position: absolute;
  height: 100vh;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--muted);
  border-radius: 2px;
}

#projets.card > .nav-block > .sidebar {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
  padding-right: 6px;
}

/* Liste onglets dans la frise */
#projets.card > .nav-block > .sidebar ul {
  height: 50%;
  margin: 0;
  padding: 0;
  gap: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  list-style: none;
  align-items: flex-start;
}

/* Point sur la frise */
#projets.card > .nav-block > .sidebar li {
  position: relative;
}

#projets.card > .nav-block > .sidebar li::before {
  content: "";
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  border: 2px solid var(--track-bg);
}

/* Étiquettes */
#projets.card > .nav-block > .sidebar a {
  display: inline-block;
  margin-left: 12px;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 16px;
  line-height: 1;
}

#projets.card > .nav-block > .sidebar a:hover,
#projets.card > .nav-block > .sidebar a.active {
  background: var(--accent);
  color: var(--bg);
  transform: translateX(2px);
}




/* ========= Barre de défilement pour la frise ========= */
#projets.card > .nav-block > .sidebar::-webkit-scrollbar {
  width: 12px;
}

#projets.card > .nav-block > .sidebar::-webkit-scrollbar-thumb {
  background: var(--thumb-bg);
  border-radius: 8px;
  border: 2px solid var(--track-bg);
}

#projets.card > .nav-block > .sidebar::-webkit-scrollbar-thumb:hover {
  background: #767e8a;
}

#projets.card > .nav-block > .sidebar::-webkit-scrollbar-track {
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(125, 162, 255, .22) 0,
      rgba(125, 162, 255, .22) calc(var(--tick) - 3px),
      var(--track-bg) calc(var(--tick) - 3px),
      var(--track-bg) var(--tick)
    );
  border-radius: 8px;
}

#projets.card > .nav-block > .sidebar {
  scrollbar-width: thin;
  scrollbar-color: var(--thumb-bg) var(--track-bg);
}

.project {
  scroll-margin-top: 90px;
}

/* Alignement titre et date sur desktop */
.project .content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
}

.project .content > a {
  grid-column: 1;
  grid-row: 1;
}

.project .content > .muted {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
  white-space: nowrap;
}

.project .content > div:nth-child(n+3) {
  grid-column: 1 / -1;
}

/* ── Vignette commune à tous les projets ── */
.img-projects-station_pompage,
.img-projects-bras_robotique,
.img-projects-electrocardiographe,
.img-projects-chaine_production,
.img-projects_smartcar,
.img-projects-robot_mobile {
  flex-shrink: 0;
  width: clamp(140px, 20vw, 220px);
  margin: 0;
}

.img-projects-station_pompage img,
.img-projects-bras_robotique img,
.img-projects-electrocardiographe img,
.img-projects-chaine_production img,
.img-projects_smartcar img,
.img-projects-robot_mobile img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
  object-position: center top;
}




/* ========= Bouton retour en haut ========= */
.scroll-top-projects {
    display: none;
}




/* ========= Section PROJETS ========= */
#projets .section-title {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

#projets .section-title h2 {
  margin: 0;
  line-height: 1.1;
}

#projets .section-title .muted {
  margin: 0;
  margin-bottom: 20px;
  white-space: normal;
  font-weight: 600;
  font-size: 15px;
  opacity: .85;
}

#projets.card {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  column-gap: 32px;
  align-items: stretch;
  overflow: hidden;
  overflow: visible;
}

#projets.card .section-title {
  grid-column: 2;
  grid-row: 1;
}

#projets.card .columns {
  grid-column: 2;
  grid-row: 2;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  min-height: 0;
  overflow: visible;
}

#projets.card .columns {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.project-menu-toggle {
  display: none;
  border: 0;
  background: rgba(255, 255, 255, .08);
  padding: 8px;
  border-radius: 10px;
  cursor: pointer;
  outline-offset: 2px;
}

.project-menu-toggle .bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: #8abfff;
  margin: 4px 0;
}

.project-mobile-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 50vw;
  max-width: 380px;
  transform: translateX(-120%);
  transition: transform .28s ease-out;
  background: #0b162b;
  box-shadow: 2px 0 24px rgba(0, 0, 0, .35);
  z-index: 1000;
  padding: 18px 16px;
}

.project-mobile-sidebar .sidebar {
  position: relative;
  height: 100%;
  overflow: auto;
  padding-left: 14px;
}

.project-mobile-sidebar .sidebar::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: #5a616e;
  border-radius: 2px;
}

.project-mobile-sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.project-mobile-sidebar li {
  position: relative;
}

.project-mobile-sidebar li::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #60666f;
  border: 2px solid #2a2d33;
}

.project-mobile-sidebar a {
  color: #f1f4f8;
  text-decoration: none;
  font-weight: 700;
  border-radius: 6px;
  padding: 6px 8px;
  display: inline-block;
}

.project-mobile-sidebar a:hover {
  background: #5a606b;
  transform: translateX(2px);
}

.project-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .45);
  z-index: 990;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

body.projectmenu-open .project-mobile-sidebar {
  transform: translateX(0);
}

body.projectmenu-open .project-overlay {
  opacity: 1;
  pointer-events: auto;
}

#projets .project a {
  color: inherit;
  position: relative;
  z-index: 5;
}


/* ========= Station de Pompage ========= */
#station_pompage .h3 {
  font-size: 20px;
}

#station_pompage .robot-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
}

#station_pompage .robot-right {
  flex: 1;
  min-width: 0;
}

#station_pompage .robot-right p {
  margin: 0 0 10px;
}


/* ========= Bras Robotique ========= */
#bras_robotique .h3 {
  font-size: 20px;
}

#bras_robotique .robot-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
}

#bras_robotique .robot-right {
  flex: 1;
  min-width: 0;
}

#bras_robotique .robot-right p {
  margin: 0 0 10px;
}


/* ========= Electrocardiographe ========= */
#electrocardiographe .h3 {
  font-size: 20px;
}

#electrocardiographe .robot-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
}

#electrocardiographe .robot-right {
  flex: 1;
  min-width: 0;
}

#electrocardiographe .robot-right p {
  margin: 0 0 10px;
}

/* ========= Chaîne de Production ========= */
#chaine_production .h3 {
  font-size: 20px;
}

#chaine_production .stations {
  display: block;
  margin: 0;
  padding: 0;
  grid-column: 1 / -1;
}

/* chaine_production img handled by common class */

#chaine_production .li-svg {
  display: grid;
  grid-template-columns: 24px 1fr;
  column-gap: 10px;
  row-gap: 2px;
  margin: 10px 0;
  align-items: start;
}

#chaine_production .li-svg svg {
  grid-row: 1 / span 2;
  fill: #F1F5F9;
}

#chaine_production .li-svg b {
  display: block;
}

#chaine_production .robot-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
  grid-column: 1 / -1;
}

#chaine_production .content > p:last-of-type {
  clear: both;
  margin-top: 14px;
}




/* ========= SmartCar ========= */
#smartcar .h3 {
  font-size: 20px;
}

#smartcar .content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
}

#smartcar .content > a {
  grid-column: 1;
  grid-row: 1;
}

#smartcar .content > .muted {
  grid-column: 2;
  grid-row: 1;
  text-align: right;
  white-space: nowrap;
}

#smartcar .smartcar-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
  grid-column: 1 / -1;
}

#smartcar .smartcar-right {
  flex: 1;
  min-width: 0;
}

#smartcar .smartcar-features {
  display: block;
  margin: 0;
  padding: 0;
}

#smartcar .img-projects_smartcar {
  margin: 0;
}

/* smartcar img handled by common class */

#smartcar .li-svg {
  display: grid;
  grid-template-columns: 24px 1fr;
  column-gap: 10px;
  row-gap: 2px;
  margin: 10px 0;
  align-items: start;
}

#smartcar .li-svg svg {
  grid-row: 1 / span 2;
  fill: #F1F5F9;
}

#smartcar .li-svg b {
  display: block;
}

#smartcar .content > p:last-of-type {
  clear: both;
  margin-top: 14px;
}




/* ========= Robot Mobile ========= */
#robot_mobile .h3 {
  font-size: 20px;
}

#robot_mobile .robot-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 24px;
}

#robot_mobile .img-projects-robot_mobile {
  margin: 0;
}

#robot_mobile .robot-right {
  flex: 1;
  min-width: 0;
}

#robot_mobile .robot-right p {
  margin: 0 0 10px;
}




/* ----- Responsive ----- */
@media (max-width: 768px) {

  #projets .section-title {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  #projets .section-title .muted {
    white-space: normal;
    margin: 0;
    font-size: 14px;
  }

  /* Sur mobile, titre et date empilés */
  .project .content {
    grid-template-columns: 1fr;
  }

  .project .content > .muted {
    grid-column: 1;
    grid-row: auto;
    text-align: left;
    white-space: normal;
  }

  .project .content > div:nth-child(n+3) {
    grid-column: 1;
  }

  #projets.card {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    column-gap: 0;
  }

  #projets.card .section-title {
    grid-column: 1;
    grid-row: 1;
  }

  #projets.card .mobile-list-wrap {
    grid-column: 1;
    grid-row: 2;
  }

  #projets.card .columns {
    grid-column: 1;
    grid-row: 3;
  }

  #projets.card > .nav-block {
    grid-column: 1;
  }

  #projets.card > .nav-block::before,
  .desktop-sidebar {
    display: none;
  }

  #projets.card .columns {
    gap: 20px;
  }

  /* Bouton rond "remonter en haut" */
  .scroll-top-projects {
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 46px;
    height: 46px;
    border-radius: 999px;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(138, 191, 255, .10);
    border: 1px solid rgba(138, 191, 255, .45);
    color: #8abfff;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .7);
    cursor: pointer;
    z-index: 50;
    transition: background .2s, border-color .2s, transform .2s, opacity .2s;
    opacity: 0;
    transform: translateY(8px);
  }

  .scroll-top-projects svg {
    display: block;
  }

  .scroll-top-projects.is-visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
  }

  .scroll-top-projects:hover {
    background: rgba(138, 191, 255, .16);
    border-color: rgba(138, 191, 255, .65);
  }

  /* ========= Tous les layouts projets — mobile ========= */
  /* Texte au-dessus, image en dessous — spécificité renforcée avec !important */
  #station_pompage .robot-layout,
  #bras_robotique .robot-layout,
  #electrocardiographe .robot-layout,
  #chaine_production .robot-layout,
  #smartcar .smartcar-layout,
  #robot_mobile .robot-layout {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
  }

  /* Les figures prennent toute la largeur disponible */
  .img-projects-station_pompage,
  .img-projects-bras_robotique,
  .img-projects-electrocardiographe,
  .img-projects-chaine_production,
  .img-projects_smartcar,
  .img-projects-robot_mobile {
    width: 100% !important;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
  }

  /* Images entières pleine largeur, hauteur auto */
  .img-projects-station_pompage img,
  .img-projects-bras_robotique img,
  .img-projects-electrocardiographe img,
  .img-projects-chaine_production img,
  .img-projects_smartcar img,
  .img-projects-robot_mobile img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    object-position: center top;
    border-radius: 0;
  }

  /* Le texte prend toute la largeur + justifié comme desktop */
  .robot-right,
  .smartcar-right {
    width: 100% !important;
    flex: unset !important;
    min-width: 0;
    text-align: justify;
  }

  .robot-right p,
  .smartcar-right p {
    text-align: justify;
  }

  #bras_robotique .h3,
  #electrocardiographe .h3,
  #chaine_production .h3,
  #smartcar .h3,
  #robot_mobile .h3 {
    font-size: 18px;
  }

  #chaine_production .content,
  #smartcar .content {
    grid-template-columns: 1fr;
  }

  #chaine_production .content > .muted,
  #smartcar .content > .muted {
    grid-column: 1;
    grid-row: auto;
    text-align: left;
    white-space: normal;
  }

  #chaine_production .li-svg,
  #smartcar .li-svg {
    grid-template-columns: 20px 1fr;
    column-gap: 8px;
    margin: 8px 0;
  }

  .mobile-list-wrap {
    display: block;
    position: relative;
    margin-top: 6px;
    z-index: 10;
  }

  .mobile-list-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 10px;
    color: #8abfff;
    background: rgba(138, 191, 255, .10);
    border: 1px solid rgba(138, 191, 255, .45);
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s, border-color .2s;
  }

  .mobile-list-toggle:hover {
    background: rgba(138, 191, 255, .16);
    border-color: rgba(138, 191, 255, .65);
  }

  .mobile-list-toggle .chev {
    transition: transform .2s;
  }

  .mobile-list-toggle[aria-expanded="true"] .chev {
    transform: rotate(180deg);
  }

  .mobile-project-list {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100%);
    max-height: 80vh;
    background: var(--menu-bg);
    border-radius: 12px;
    overflow-y: auto;
    transform-origin: top;
    transform: scaleY(1);
    opacity: 0;
    pointer-events: none;
    transition: transform .22s ease, opacity .22s ease;
    z-index: 60;
  }

  .mobile-project-list.open {
    transform: scaleY(1);
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-project-list nav {
    padding: 5px 5px 5px;
  }

  .mobile-project-list nav::before {
    display: none;
  }

  .mobile-project-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 12px;
  }

  .mobile-project-list li {
    padding-left: 0;
  }

  .mobile-project-list li::before {
    display: none;
  }

  .mobile-project-list a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 700;
    border-radius: 6px;
    padding: 4px 6px;
    display: inline-block;
  }

  .mobile-project-list a:hover {
    background: var(--accent);
    color: var(--bg);
    transform: translateX(2px);
  }

  .mobile-projetsOverlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, .45);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
    z-index: 30;
  }

  .mobile-projetsOverlay.show {
    opacity: 1;
    pointer-events: auto;
  }

  body.mlist-open {
    overflow: hidden;
  }
}

@media (min-width: 769px) {

  #projets.card .mobile-list-toggle,
  #projets.card .mobile-project-list {
    grid-column: 2;
    grid-row: 2;
  }

  .mobile-list-toggle,
  .mobile-project-list {
    display: none;
  }
}