/* Reset minimal */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  /* Mobile : pas de rebond/pull-to-refresh sur le mur. */
  overscroll-behavior: none;
}

body {
  background: #0e0e0e;
  /* Montserrat auto-hebergee (font.js) -> meme rendu partout ; fallback systeme si non chargee. */
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: crosshair;
  /* Mobile : pas de flash bleu au tap. */
  -webkit-tap-highlight-color: transparent;
}

/* Couche 1 - le mur de fond (mosaique infinie) */
#mosaic-background {
  position: fixed;
  top: 0;
  left: 0;
  display: flex; /* une rangee de colonnes */
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  touch-action: none; /* mobile : on gere nous-memes le tactile (relief + tap), pas de scroll natif */
}

/* La vague est appliquee a la colonne entiere (et non a chaque tuile) :
   ~15 transforms par frame au lieu de ~180 -> mouvement fluide. */
.mosaic-col {
  display: flex;
  flex-direction: column;
  will-change: transform;
}

.mosaic-tile {
  /* width / height definis par JS (dependent de la version, voir TILE_WIDTH/HEIGHT). */
  overflow: hidden;
  /* Le conteneur est en pointer-events: none, mais les tuiles doivent rester
     detectables par document.elementFromPoint pour reperer la tuile survolee. */
  pointer-events: auto;
}

/* V9 - patch du collage : positionne en absolu, deplace par transform (defilement+vague). */
.collage-patch {
  position: absolute;
  top: 0;
  left: 0;
  will-change: transform;
}

.mosaic-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* Couche 2 - la trainee */
#trail-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  overflow: hidden;
}

.trail-card {
  position: absolute;
  /* width / height definis par carte en JS (formats varies). */
  border-radius: 4px;
  overflow: hidden;
  transform-origin: center center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  will-change: transform, opacity;
}

.trail-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* V4 - focus plein cadre : fond flou + sombre derriere la photo cliquee. */
#focus-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200000;
  background: rgba(8, 8, 12, 0.66);
  backdrop-filter: blur(20px) saturate(0.85);
  -webkit-backdrop-filter: blur(20px) saturate(0.85);
  cursor: zoom-out;
}

.focus-photo {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 200001;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  cursor: zoom-out;
  will-change: transform, opacity;
}

.focus-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

/* V5 - fiche detail : photo (gauche) + panneau texte (droite), groupe centre. */
#detail-sheet {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 200001;
  display: flex;
  align-items: center;
  gap: 48px;
}

.detail-photo {
  flex: 0 0 auto;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  will-change: transform, opacity;
}

.detail-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.detail-text {
  flex: 0 0 auto;
  color: #f2f2f2;
  font-family: "Montserrat", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.detail-index {
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 14px;
}

.detail-title {
  font-size: 34px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 16px;
}

.detail-caption {
  font-size: 15px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.75);
  margin: 0 0 24px;
}

.detail-meta {
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 14px;
}

/* Bascule V1 / V2 (demo client) - discret, en bas a droite, au-dessus de tout. */
#version-toggle {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100000;
  display: flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(20, 20, 20, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

#version-toggle button {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 7px 16px;
  border-radius: 999px;
  font: 600 13px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}

#version-toggle button:hover {
  color: #fff;
}

#version-toggle button.active {
  color: #111;
  background: #fff;
}

/* ============================================================================
   Section ABOUT (apparait en fondu au clic ; le mur est floute derriere)
   ============================================================================ */
#about {
  position: fixed;
  inset: 0;
  z-index: 100000;
  /* Le fond translucide + backdrop-filter floutent/assombrissent le mur DERRIERE. */
  background: rgba(10, 10, 12, 0.55);
  backdrop-filter: blur(20px) brightness(0.4) saturate(0.9);
  -webkit-backdrop-filter: blur(20px) brightness(0.4) saturate(0.9);
  color: #f2f2f2;
  opacity: 0;
  pointer-events: none;
  /* Fermeture RAPIDE : overlay (fond floute) + texte disparaissent ensemble d'un coup. */
  transition: opacity 0.22s ease;
}

#about.open {
  opacity: 1;
  pointer-events: auto;
  /* Ouverture plus douce que la fermeture. */
  transition: opacity 0.6s ease;
}

#about-scroll {
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 32px 96px;
  box-sizing: border-box;
}

#about-close {
  position: fixed;
  top: 20px;
  right: 24px;
  z-index: 1;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}
#about-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* En-tete : logo constellation + tagline */
.about-head {
  text-align: center;
  margin: 24px 0 64px;
}
#about-logo {
  display: block;
  width: 100%;
  max-width: 620px;
  height: 200px;
  margin: 0 auto;
}
.about-tagline {
  margin-top: 8px;
  font-size: 15px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

/* Blocs de texte */
.about-block {
  margin: 0 auto 56px;
  max-width: 620px;
}
.about-block h2 {
  font-size: 13px;
  font-weight: 600; /* graisse embarquee (evite un faux-gras 700 non charge) */
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}
.about-block p {
  font-size: 17px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
  margin: 0 0 14px;
}
.about-block .about-lead {
  font-size: 20px;
  color: #fff;
  letter-spacing: 0.02em;
}

/* Competences : 3 colonnes */
.about-skills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}
.about-skills h3 {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  margin: 0 0 12px;
}
.about-skills ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.about-skills li {
  font-size: 14px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.7);
  padding: 4px 0;
}

/* Contact */
.about-contact {
  max-width: 620px;
  margin: 8px auto 0;
  padding-top: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
}
.about-contact a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 15px;
  letter-spacing: 0.04em;
  transition: color 0.15s ease;
}
.about-contact a:hover {
  color: #fff;
}
/* Email a gauche, pastilles reseaux poussees a droite. */
.about-contact a:first-child {
  margin-right: auto;
}
/* Pastilles reseaux (LinkedIn + Instagram) : meme style pilule. */
.about-contact .about-social {
  padding: 8px 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
}
.about-contact .about-social:hover {
  border-color: rgba(255, 255, 255, 0.5);
}

/* Responsive : competences en 1 colonne sur mobile */
@media (max-width: 640px) {
  .about-skills {
    grid-template-columns: 1fr;
  }
  #about-scroll {
    padding: 56px 20px 80px;
  }
}

/* ============================================================================
   Selecteur de versions (demo) : boutons fixes en bas a droite pour comparer les
   propositions About. Present sur toutes les versions ; le bouton courant est surligne.
   ============================================================================ */
.version-switch {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100010; /* au-dessus du mur ET de la modale About */
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 9px;
  background: rgba(18, 18, 22, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  font-family: "Montserrat", -apple-system, "Segoe UI", Roboto, sans-serif;
}
.version-switch__label {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding: 0 6px 0 4px;
}
.version-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 30px;
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.version-switch a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.version-switch a.is-current {
  background: #fff;
  color: #111;
}

/* Sur mobile, on reduit un peu le selecteur. */
@media (max-width: 640px) {
  .version-switch__label { display: none; }
  .version-switch a { width: 30px; height: 28px; font-size: 12px; }
}

/* Logo S (marque) fixe en haut a gauche du mur. Blanc pour l'instant.
   Au-dessus des tuiles du mur, mais sous la modale About (donc masque quand About est ouvert). */
.wall-logo {
  position: fixed;
  top: 26px;
  left: 30px;
  height: 92px;
  width: auto;
  z-index: 9000;
  pointer-events: none; /* clic traverse vers le mur (ouverture About) */
}
@media (max-width: 640px) {
  .wall-logo { height: 64px; top: 18px; left: 20px; }
}

/* Titre H1 pour les moteurs / lecteurs d'ecran, sans impact visuel (le logo est un canvas). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
