/* ============================================================
   RESET & BASE
   ============================================================ */
.wp-block-post-title,
.entry-title,
.grid-timer,
.wp-block-heading { display: none !important; }
.wp-block-paragraph:not(.project-desc) { display: none !important; }
.project-desc { display: none; }
header, footer, nav,
.wp-site-blocks > header,
.wp-site-blocks > footer { display: none !important; }
.wp-block-gallery, .wp-block-image { display: none !important; }

* { caret-color: transparent !important; }

html, body {
  margin: 0 !important;
  padding: 0 !important;
  background: #fff !important;
  width: 100vw !important;
  overflow-x: hidden !important;
}


/* ============================================================
   VIEWER PRINCIPAL (GALERIE)
   ============================================================ */
#mainViewer {
  position: fixed;
  inset: 0;
  background: #fff;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

#imgDisplay {
  width: auto !important;
  height: calc(100vh - 60px) !important;
  max-width: calc(76vw - 20px) !important; /* Empêche débordement images larges et panoramiques */
  margin-left: 20vw !important;
  object-fit: contain;
  opacity: 1;
  transition: opacity 0.10s ease-in;
  pointer-events: auto;
  cursor: e-resize;
}


/* ============================================================
   BACK LINK & INFO PANEL (BAS GAUCHE)
   ============================================================ */
.back-link,
.info-panel {
  position: fixed;
  z-index: 9000;
  color: #000 !important;
  text-decoration: none;
}

.back-link {
  top: 30px;
  left: 30px;
  font-size: 14px;
  font-weight: bold;
  text-transform: none;
}

.info-panel {
  bottom: 30px; /* Aligné avec la marge basse de l'image */
  left: 30px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 18vw; /* Reste dans la marge gauche, ne chevauche jamais l'image */
  pointer-events: none;
}

#pageTitle {
  font-weight: 700;
  font-size: 14px;
  line-height: 1.3;
  white-space: normal;
  overflow-wrap: break-word;
  color: #000;
}

#caption {
  font-weight: 400;
  font-size: 14px;
  line-height: 1.4;
  color: #555;
  white-space: normal;
  overflow-wrap: break-word;
  margin-bottom: 6px;
}

#nav-toggle {
  font-weight: 500;
  pointer-events: auto;
}

#nav-toggle a {
  color: #000;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

#nav-toggle a:hover {
  opacity: 0.5;
  color: #000 !important;
}

#gallery-link { font-weight: normal; cursor: pointer; }
#index-link   { font-weight: normal; cursor: pointer; }

.nav-active {
  color: #b1925d !important;
  font-weight: 700 !important;
  opacity: 1 !important;
}

/* Verrouille l'état orange au survol */
#nav-toggle a.nav-active:hover,
.grid-nav-active:hover {
  color: #b1925d !important;
  opacity: 1 !important;
  cursor: default !important;
}


/* ============================================================
   TYPOGRAPHIE UNIFIÉE (info-panel + grid-nav)
   ============================================================ */
.info-panel,
.grid-nav {
  font-family: "Inter Tight", sans-serif !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
  letter-spacing: 0.045em !important;
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

.info-panel a,
.grid-nav a {
  display: inline-block !important;
  line-height: 1.2 !important;
  margin: 0 !important;
  padding: 0 !important;
  vertical-align: baseline !important;
}


.project-link {
  color: #000 !important;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-size: 14px;
  font-family: "Inter Tight", sans-serif !important;
}

.project-link:hover {
  color: #b1925d !important;
  text-decoration: none;
}

/* ============================================================
   NAVIGATION GRILLE
   ============================================================ */
.grid-nav {
  color: #000 !important;
  font-weight: 500;
}

.grid-nav-link {
  cursor: pointer !important;
  color: #000 !important;
  text-decoration: none !important;
  transition: opacity 0.2s;
}

.grid-nav-link:hover { opacity: 0.6; }

.grid-nav-active {
  color: #b1925d !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  cursor: default !important;
}


/* ============================================================
   TEXTE PROJET (vue texte)
   ============================================================ */
#projectText {
  position: fixed;
  top: 15vh;
  left: 30px;
  width: 22vw;
  font-size: 14px;
  line-height: 1.6;
  max-height: 70vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  z-index: 9000;
  display: none;
}

#projectText::-webkit-scrollbar { display: none; }

/* Navigation en bas à gauche, fixe, dans la vue texte */
#projectText .grid-nav {
  position: fixed;
  bottom: 30px;
  left: 30px;
  margin: 0;
  z-index: 9999;
}


/* ============================================================
   VUE GRILLE (INDEX)
   ============================================================ */
#gridView {
  position: absolute;
  top: 0;
  left: 0;
  width: 100vw;
  background: #fff;
  z-index: 2000;
  display: none;
}

.grid-inner {
  column-count: 3;
  column-gap: 30px;
  margin-left: 30vw !important;
  width: 65vw !important;
  padding: 15vh 0;
}

.grid-inner img {
  width: 100%;
  margin-bottom: 20px;
  display: block;
  cursor: pointer;
}

.grid-inner img:hover { opacity: 0.6; }


/* ============================================================
   PORTRAIT MOBILE  (max 768px)
   ============================================================ */
@media (max-width: 768px) and (orientation: portrait) {
  .back-link {
    top: 20px;
    left: 10px;
  }

  .info-panel {
    max-width: 90vw !important;
    bottom: 20px;
    left: 10px;
  }

  #mainViewer {
    justify-content: center;
    align-items: center;
    padding-bottom: 10vh;
  }

  #imgDisplay {
    width: auto !important;
    height: auto !important;
    max-width: calc(100vw - 20px) !important;
    max-height: calc(80vh - 80px) !important;
    margin-left: 0 !important;
  }

  .grid-inner {
    margin: 0 auto !important;
    column-count: 2;
    column-gap: 10px;
    width: calc(100vw - 20px) !important;
    max-width: 100%;
    padding-top: 100px;
    padding-bottom: 60px;
    padding-left: 0;
    padding-right: 0;
  }

  #projectText {
    position: relative;
    top: auto;
    left: auto;
    width: calc(100vw - 40px);
    padding: 20px;
    font-size: 15px;
  }

  #projectText .grid-nav {
    position: relative;
    bottom: auto;
    left: auto;
    margin-top: 20px;
  }

  #gridView.open {
    display: flex !important;
    flex-direction: column;
  }
}


/* ============================================================
   LANDSCAPE MOBILE  (max 1200px, paysage)
   ============================================================ */
@media (max-width: 1200px) and (orientation: landscape) {
  .back-link {
    top: 10px !important;
    left: 10px !important;
  }

  #mainViewer {
    justify-content: center;
    align-items: center;
  }

  #imgDisplay {
    width: auto !important;
    max-width: 72vw !important;
    height: auto !important;
    max-height: 75vh !important;
    margin-left: 25vw !important;
  }

  .info-panel {
    max-width: 22vw;
    bottom: 2vh;
    left: 10px;
  }

  #projectText {
    position: relative;
    top: auto;
    left: auto;
    width: calc(100vw - 40px);
    padding: 20px;
    font-size: 15px;
  }

  #projectText .grid-nav {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    margin-top: 15px;
  }

  .grid-inner {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-left: 0 !important;
    width: calc(100vw - 20px) !important;
    padding: 50px 10px 10px 10px;
  }

  #gridView.open {
    display: flex !important;
    flex-direction: column;
  }
}