* { box-sizing: border-box;}
html,body { height:100%; margin:0; background:#d9d9d9; color:#000000; }

#leftPanel.panel {
  position: fixed;
  left: 0; top: 0;
  width: 360px;
  height: 100vh;
  background: white;
  box-shadow: 3px 0 20px rgba(0,0,0,0.6);
  padding: 18px;
  overflow-y: auto;
  z-index: 50;
}
#leftPanel.hidden { transform: translateX(-380px); transition: transform .25s ease; }
#leftPanel:not(.hidden){ transform: translateX(0); transition: transform .25s ease; }
#leftPanel button#closePanel{
  position:absolute; right:8px; top:8px; background: #d9d9d9; color:#000000; border:0; font-size:18px; cursor:pointer;
}

#mapContainer {
  position: absolute;
  left: 0; right:0; top:0; bottom:0;
  display:block;
  overflow: hidden;
}

/* mapInner est la "toile" transformée (pan/zoom) */
#mapInner {
  position: absolute;
  left:0; top:0;
  width: 2000px; height: 1400px; /* espace de travail (modifiable) */
  transform-origin: 0 0;
  will-change: transform;
}

/* le canvas de p5 sera inséré dans mapInner et prendra tout */
#mapInner canvas {
  position: absolute;
  left:0; top:0;
  z-index: 0;
}

#mapInner object {
  position: absolute;
  top: -1700px;
  left: -3000px;
  width: 8000px; /* ou la taille de ton monde */
  height: 5600px;
  pointer-events: none; /* pour ne pas bloquer les clics */
  color:grey;
}

.marker-wrap {
  position: absolute;
  display: flex;
  flex-direction: row;      /* image + label côte à côte */
  align-items: center;      /* centre verticalement */
  gap: 10px;                /* espace entre la bulle et le label */
}

.marker {
  width: 56px;
  height: 56px;
  border-radius: 999px;
  box-shadow: 0 6px 18px rgba(96, 96, 96, 0.4);
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s;
  flex-shrink: 0;           /* empêche la bulle de rétrécir */
}

.marker img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.marker:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 30px rgba(69, 69, 69, 0.5);
}

.label {
  font-size: 14px;
  line-height: 1.2;       /* ou 18px, selon ce que tu veux */
  padding: 0px 5px;
  border-radius: 6px;
  color: #000;
  white-space: normal;      /* autorise les retours à la ligne */
  width: 15ch;
  max-width: 20ch;          /* limite largeur du texte */
  word-wrap: break-word;    /* casse les mots si trop longs */
}


#topBar {
  position: fixed;       /* Au-dessus de tout le reste */
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;          /* couvre tout l'écran */
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
  z-index: 45;          /* plus haut que le panel ou la map */
}
 #topBar .compass { position: absolute; background: rgba(255, 255, 255); padding:6px 10px; border-radius:100px; font-size:13px; color:#000000; box-shadow: 1px 1px 1px 1px rgba(40, 40, 40, 0.2);}

#drole {
  top: 2%;
  left: 50%;
  transform: translateX(-50%);
}

#serieux {
  bottom: 2%;
  left: 50%;
  transform: translateX(-50%);
}

#individuel {
  left: 2%;
  top: 50%;
  transform: translateY(-50%);
}

#leftPanel:not(.hidden) ~ #topBar #individuel {
  transform: translate(375px, -50%);
  transition: transform 0.25s ease;
}


#participatif {
  right: 2%;
  top: 50%;
  transform: translateY(-50%);
}
/* Panel content */
#projectDetail img { width:100%; height:180px; object-fit:cover; border-radius:6px; display:block; margin-bottom:12px; }
.detail-title { font-size:20px; margin-bottom:6px; }
.detail-row { margin-bottom:10px; }
.vote-controls { display:flex; gap:8px; align-items:center; margin-top:8px; color: #027b8b}
.vote-controls button { padding:8px 13px; border-radius:100px; border: 1px solid #027b8b; cursor:pointer; background: none; color:#027b8b; font-weight: 550;}
.comments { margin-top:12px; }
.comment { padding:8px; background: rgba(255,255,255,0.03); margin-bottom:8px; border-radius:6px; font-size:14px; }

button { padding:8px 10px; border-radius:100px; border:0; cursor:pointer; background:#d3f7ff; color:#027b8b; font-weight: 550;}


* box-sizing utile pour padding/max-width cohérents */
*, *::before, *::after { box-sizing: border-box; }

/* Typo globale */
body {
  margin: 0;
  font-family: Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

/* bouton toggle propre */
.toggle-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

/* icônes — seule l'active s'affiche */
.toggle-btn .icon { 
    display: none; width: 20px; height: 20px; 
    margin-top: 0.2rem;
}
.toggle-btn .icon.active { 
    display: inline-block; 
}

/* Menu */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: flex-end;
  padding: 1rem 2rem;
  z-index: 40;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: #222;
}

.nav-links a:hover {
  text-decoration: underline;
}

.toggle-btn {
  background: none;
  border: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}

/* Footer */
/* footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  font-size: 0.9rem;
}
 */
 footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  font-size: 0.9rem;
  z-index: 40; /* au-dessus de la map, mais sous le compass si tu veux */
}

footer a {
  color: #222;
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

.dark-mode {
  background: #0b0b0b;
  color: #eee;
}

.dark-mode a {
  color: #eeeeee;
}

.dark-mode #leftPanel.panel {
  background: #1a1a1a;
}

.dark-mode .detail-row .btn-link {
  color: #4dff7c;
}

/* Responsive : sur petits écrans, on recentre et on augmente la largeur pour être lisible */
@media (max-width: 800px) {
  .nav-links { gap: 1rem; }

  footer { 
    display: none;
  }

    #topBar {
    position: fixed;
    bottom: 0;           /* en bas de l’écran */
    top: auto;           /* on enlève le top */
    height: auto;
    width: 100%;
    display: flex;
    justify-content: space-between; /* espace entre les 4 */
    align-items: center;
    padding: 0.5rem 0.4rem;
    pointer-events: none;
    z-index: 100; /* au-dessus du reste */
  }

  /* Chaque élément du compass devient position:static pour s’aligner dans le flex */
  #topBar .compass {
    position: static;
    transform: none;
    pointer-events: auto; /* pour pouvoir cliquer/toucher si besoin */
    font-size: 11px;
    flex: 1;
    text-align: center;
    margin: 0 0.1rem;
  }

  /* On garde l’ordre demandé : individuel – drôle – sérieux – participatif */
  #individuel { order: 1; }
  #drole { order: 2; }
  #serieux { order: 3; }
  #participatif { order: 4; }

  #leftPanel:not(.hidden) ~ #topBar {
  display: none;
  }
  #leftPanel.panel {
    width: 100%;
    box-shadow: none;
  }
  #leftPanel.hidden { transform: translateX(-100%); transition: transform .25s ease; }
}

#mapContainer, #mapInner {
  touch-action: none;
}

.vote-controls input[type="range"] {
  width: 120px;
  height: 6px;
  border-radius: 3px;
  background: #d3d3d3;
  outline: none;
  cursor: pointer;
  accent-color: #027b8b;
}

hr {
  border: none;
  border-top: 0.5px solid #8d8d8d;
  margin: 20px 0;
  margin-left: -20px;
  margin-right: -20px;
}

#author {
  font-style: italic;
  color: #027b8b;
}

textarea {
  resize: vertical;
  border-radius: 6px;
  border: 1px solid #ccc;
  padding: 8px;
  font-size: 14px;
  font-family: inherit;
}

.comment small {
  color: #027b8b
}

.fab-add-project {
  position: fixed;
  right: 24px;
  bottom: 48px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
  z-index: 1000;
}

.add-project-panel {
  position: fixed;
  right: 24px;
  bottom: 114px;
  width: 280px;
  max-width: 90vw;
  background: var(--bg, #fff);
  color: var(--text, #000);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
  padding: 12px 14px;
  z-index: 1000;
}

.add-project-panel.hidden {
  display: none;
}

.add-project-panel form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-project-panel input,
.add-project-panel textarea {
  width: 100%;
  box-sizing: border-box;
}

.add-project-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

#cancelAddProject{
  background: #ffffff;
  color: #8d8d8d;
  border: 1px solid #8d8d8d;
}

.titrePanelAjouter {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
  margin-top: -5px;
  color: #027b8b;
}