/* =====================================================================
   projets.css : feuille de style UNIQUE pour toutes les pages projet
   Remplace general.css + projetstest.css + menu.css

   Dans le <head> de chaque page projet :
   <link rel="stylesheet" href="styles/projets.css">

   Sommaire
   1. Polices
   2. Colonne de texte (à gauche)
   3. Logo et menu (identiques à la page d'accueil)
   4. Galerie d'images (grille commune)
   5. Éléments divers
   6. Mobile / tablette
   7. Ancien code (compatibilité) : à supprimer quand toutes les pages
      utilisent le nouvel en-tête
   ===================================================================== */


/* ============================== 1. POLICES ============================== */

@font-face {
  font-family: Mayenne;
  src: url(font/MayenneSansRegular.otf) format("opentype");
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: bluu;
  src: url(font/BluuNext-Bold.otf) format("opentype");
  font-weight: bold;
  font-style: normal;
}

@font-face {
  font-family: movment;
  src: url(font/Movement_Webfonts/Movement-IndirectBlack.woff2) format("WOFF2");
  font-weight: bold;
  font-style: normal;
}


/* ====================== 2. COLONNE DE TEXTE (GAUCHE) ====================== */

aside{
  position: fixed;
  float: left;
  width: 30%;
  background-color: #fff;
  padding-bottom: 10%;
}

#retour{
  margin: 5%;
}

#retour img{
  width: 8%;
}

#texte{
  margin: 5%;
}

h3{
  font-family: 'Mayenne';
  color: #001e75;
  font-size: 150%;
}

#texte p{
  color: #001e75;
  font-family: 'Open Sans', sans-serif;
  font-size: 150%;
  line-height: 140%;
}

h2{
  font-family: 'Mayenne';
  font-weight: bold;
  font-style: normal;
  font-size: 200%;
  margin-left: 38%;
  margin-top: 100%;
  color: #001e75;
  transform: rotate(-90deg);
}

h2 a{
  text-decoration: none;
  color: #001e75;
}

h2:hover a{
  font-style: italic;
  color: #FFFFFF;
  text-shadow: #001e75 1px 1px 1px, #001e75 -1px 1px 1px, #001e75 -1px -1px 1px, #001e75 1px -1px 1px;
}


/* =================== 3. LOGO ET MENU (comme l'accueil) =================== */

#hello{
  margin-top: 50px;
  display: flex;
}

/*LOGO*/
.title{
  margin-left: 5%;
  width: 60%;
}

.title img{
  mix-blend-mode: difference;
  position: fixed;
  z-index: 100;                /* au premier plan : au-dessus du texte, des images et du menu */
  width: 15%;
}

/*MENU (ordinateur)*/
nav{
  width: 70%;
  background-color: white;
  position: sticky;
  top: 0px;
  font-family: 'Asap',sans-serif;
  mix-blend-mode: difference;
  z-index: 2;
}

nav ul{
  list-style-type: none;
  float: right;
  position: fixed;
}

nav ul li{
  float: right;
  width: auto;
  text-align: center;
  position: relative;
  margin-top: -10px;
  padding-right: 70px;
}

nav ul::after{
  content: "";
  display: table;
  clear: both;
}

nav a{
  display: block;
  text-decoration: none;
  color: #001e75;
  border-bottom: 2px solid transparent;
  padding: 10px 0 0 0;
  font-size: 130%;
}

nav a:hover{
  color: #001e75;
  font-style: italic;
}

.sous{
  display: none;
  position: absolute;
  z-index: 1000;
  padding-left: 0;
  padding-top: 10px;
}

nav > ul li:hover .sous{
  display: block;
}

.sous li{
  float: none;
  width: 100%;
  text-align: left;
}

.sous a{
  padding-bottom: 10px;
  border-bottom: none;
}

.sous a:hover{
  border-bottom: none;
  background-color: rgba(0,0,0,0);
}

/*le texte à gauche démarre sous le logo (ordinateur)*/
@media screen and (min-width: 1201px) {
  aside{
    box-sizing: border-box;
    margin-top: 7%;
    max-height: 100vh;
    overflow-y: auto;
  }
}


/* ====================== 4. GALERIE D'IMAGES (GRILLE) ====================== */

#images{
  float: right;
  width: 70%;
  margin-top: 7%;
}

/* --- Galerie d'une page : <section id="images" class="galerie"> ---
   Petites images : même largeur, deux par ligne.
   Grandes images (.pleine) : toute la ligne = largeur de deux petites + l'écart.
   Réglages : --colonnes, --ratio (format des petites), --ratio-pleine, --marge */

#images.galerie{
  --colonnes: 2;
  --ratio: 1 / 1;                /* 1 / 1 = carré, 4 / 5 = portrait, 3 / 2 = paysage, auto = sans recadrage */
  --marge: 20px;                 /* UNE seule marge : entre les images ET autour de la galerie */
  --ratio-pleine: auto;          /* format des grandes images (auto = non recadrées) */
  display: grid;
  grid-template-columns: repeat(var(--colonnes), minmax(0,1fr));
  gap: var(--marge);
  align-items: start;
  box-sizing: border-box;
  padding: var(--marge);
}

#images.galerie img{
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--ratio);
  object-fit: cover;             /* recadrage au centre, jamais de déformation */
  margin: 0;
}

#images.galerie img.pleine{
  grid-column: 1 / -1;
  aspect-ratio: var(--ratio-pleine);
}

/* --- Pages à l'ancienne structure (blocs #verybig-photo, #moyen-photo-carre, #small-photo…) :
   mêmes principes, sans modifier leur HTML --- */

@media screen and (min-width: 981px) {

  #images{
    --colonnes: 2;
    --marge: 20px;
    display: grid;
    grid-template-columns: repeat(var(--colonnes), minmax(0,1fr));
    gap: var(--marge);
    align-items: start;
    box-sizing: border-box;
    padding: var(--marge);
  }

  /* les anciens blocs disparaissent de la mise en page : leurs images deviennent des cases de la grille */
  #images > div,
  #images > section{
    display: contents;
  }

  #images img,
  #images div img,
  #images section img,
  #images div video,
  #images section video{
    display: block;
    float: none;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0;
  }

  /* grandes images : toute la ligne */
  #verybig-photo img,
  #big-photo img,
  #moyenbig-photo img{
    grid-column: 1 / -1;
  }
}


/* ========================== 5. ÉLÉMENTS DIVERS ========================== */

#info{
  display: grid;
  float: right;
}

#dessin-main{
  text-align: center;
  margin-bottom: 50px;
}

.image-logo img{
  width: 15%;
}

.boutontop{
  display: none;
}

#plante{
  position: fixed;
  bottom: 0;
  margin-left: 30px;
  z-index: 6;
}

#plante img{
  display: none;
}


/* ========================== 6. MOBILE / TABLETTE ========================== */

/* --- Logo et menu : jusqu'à 1200px --- */
@media screen and (max-width: 1200px) {

  /*LOGO : dans le flux de la page, au-dessus du contenu*/
  :root{
    --logo-w: clamp(110px, 34vw, 190px);
  }

  #hello{
    margin-top: 0;
  }

  .title{
    margin-left: 0;
  }

  .title img{
    position: relative;        /* nécessaire pour que le z-index s'applique */
    z-index: 100;              /* au premier plan */
    display: block;
    width: var(--logo-w);
    height: auto;
    margin: 16px 0 0 5vw;
    mix-blend-mode: normal;
  }

  /*MENU : barre fixe en bas, items sur une seule ligne*/
  nav{
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background-color: #ffffff;
    mix-blend-mode: normal;
    z-index: 10;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -1px 6px rgba(0,30,117,0.15);
  }

  nav > ul{
    position: static;
    float: none;
    display: flex;
    flex-direction: row-reverse;   /* même ordre qu'en version ordinateur : projets / personnel / recherches / à propos */
    flex-wrap: nowrap;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  nav ul li{
    float: none;
    margin: 0;
    padding: 0;
    flex: 1 1 auto;
    text-align: center;
  }

  nav a{
    padding: 14px 4px;
    font-size: 100%;
    color: #001e75;
    white-space: nowrap;
  }

  /*sous-menu "projets" : s'ouvre vers le haut*/
  nav .sous{
    display: none;
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    padding: 0;
    background-color: #ffffff;
    box-shadow: 0 -2px 8px rgba(0,30,117,0.15);
  }

  nav > ul li:hover .sous,
  nav > ul li:focus-within .sous{
    display: block;
  }

  nav .sous li{
    text-align: center;
  }

  nav .sous a{
    padding: 12px 20px;
  }

  /*évite que la barre cache le bas de la page*/
  body{
    padding-bottom: 60px;
  }
}

/* --- Mise en page : jusqu'à 980px --- */
@media screen and (max-width: 980px) {

  .bigbox{
    display: none;
  }

  h2{
    display: none;
  }

  aside{
    position: relative;
    width: 100%;
  padding-bottom: 0%;}

  #texte{
    width: 90%;
  }

  /*galerie d'une page (.galerie) : une colonne, les images gardent leurs proportions*/
  #images.galerie{
    --colonnes: 1;
    --ratio: auto;
    --marge: 5vw;                /* identique à la marge du texte (5%) */
  }

  /*toutes les pages projet : toutes les images ont la même largeur et les mêmes bords gauche/droite*/
  #images{
    width: 100%;
    box-sizing: border-box;
    padding-left: 5%;
    padding-right: 5%;
  }

  #images > div,
  #images > section{
    float: none;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  #images img,
  #images div img,
  #images section img,
  #images div video,
  #images section video{
    display: block;
    float: none;
    width: 100%;
    max-width: 100%;
    height: auto;
    margin: 0 0 5vw 0;           /* même espace vertical que la marge latérale */
  }

  #inf{
    width: 88%;
    margin-left: 6%;
  }

  #info{
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-top: 5%;
    position: relative;
    margin-bottom: 20px;
  }

  #info p{
    color: #282829;
    font-size: 20px;
    line-height: 25px;
    font-family: 'Open Sans', sans-serif;
  }

  #info a{
    text-decoration: none;
    color: #282829;
  }

  #photos{
    width: 100%;
    margin-left: auto;
  }

  #photos img{
    width: 80%;
    margin-right: 10%;
    margin-left: 10%;
  }

  .boutontop{
    width: 55px;
    display: block;
    margin-left: auto;
    margin-right: auto;
  }

  .back{
    width: 25px;
  }

  /* ---- Ordre sur mobile : titre > PREMIÈRE IMAGE > texte d'explication > autres images ----
     Les conteneurs deviennent "transparents" (display: contents) pour que le titre, le texte et
     les images puissent être réordonnés entre eux sans modifier le HTML. */
  body{
    display: flex;
    flex-direction: column;
  }

  #blabla,
  aside,
  #texte,
  #images,
  #images.galerie,                            /* sinon la grille .galerie reste un bloc unique */
  #images > div,
  #images > section{
    display: contents;
  }

  header{ order: 0; }
  aside > *:not(#texte){ order: 1; }          /* bouton retour */
  #texte > h3{ order: 2; }                    /* titre */
  #texte > *:not(h3){ order: 4; }             /* texte d'explication */

  /* toutes les images après le texte… (mêmes sélecteurs que plus haut, pour prendre le dessus) */
  #images img,
  #images div img,
  #images section img,
  #images div video,
  #images section video,
  #images.galerie img{
    order: 5;
    width: calc(100% - 10vw);                 /* mêmes marges (5vw) que le texte */
    margin: 0 5vw 5vw;
  }

  /* …sauf la première, placée entre le titre et le texte (structure à plat ou à blocs) */
  #images > img:first-child,
  #images > :first-child > img:first-child{
    order: 3;
  }

  /* le titre et le texte gardent leurs marges latérales, même sans le conteneur #texte */
  #texte > *{
    margin-left: 5vw;
    margin-right: 5vw;
    width: auto;
  }
}


/* ==================== 7. ANCIEN CODE (COMPATIBILITÉ) ====================
   Ancien menu en bas / à droite, ancien titre vertical, etc.
   À SUPPRIMER une fois que toutes les pages utilisent le nouvel en-tête
   (logo + <nav>) et ne contiennent plus de <div class="categories">. */

#explication{
  position: absolute;
  z-index: 2;
}

#explication h1 a{
  text-decoration: underline;
  color: #282829;
}

#explication a:hover{
  color: #FFFFFF;
  text-shadow: #001e75 1px 1px 1px, #001e75 -1px 1px 1px, #001e75 -1px -1px 1px, #001e75 1px -1px 1px;
  text-decoration: none;
  font-style: normal;
}

#gauche{
  float: left;
  width: 100px;
  position: fixed;
  top: 7%;
  z-index: 29;
}

#imgoeil{
  top: 2%;
  right: -6%;
  width: 17%;
  position: fixed;
  z-index: 34;
}

#imgoeil img{
  width: 55%;
}

.categories{
  right: 0;
  width: 35%;
  bottom: 3%;
  float: right;
  margin-right: 3%;
  position: fixed;
  z-index: 6;
}

.categories li a{
  text-decoration: none;
  font-size: 180%;
  font-family: 'Mayenne';
  color: #001e75;
  padding-left: 4px;
  padding-right: 4px;
}

.categories ul{
  text-align-last: right;
}

.categories li{
  list-style: none;
  z-index: 40;
}

.categories a:hover{
  padding-left: 4px;
  padding-right: 4px;
  z-index: 40;
  font-style: italic;
  color: #FFFFFF;
  text-shadow: #001e75 1px 1px 1px, #001e75 -1px 1px 1px, #001e75 -1px -1px 1px, #001e75 1px -1px 1px;
}

@media screen and (max-width: 980px) {

  h1{
    margin-top: 5%;
    margin-left: 15%;
    margin-bottom: 7%;
    font-family: 'Mayenne';
    font-weight: bold;
    font-style: normal;
    font-size: 3vh;
    color: #001e75;
    top: 0;
    position: absolute;
  }

  #explication{
    z-index: 2;
  }

  .categories{
    width: 100%;
    background-color: #ffffff;
    position: fixed;
    bottom: 0;
    z-index: 1;
  }

  .categories li a{
    text-decoration: none;
    font-size: 3vh;
    font-family: 'Asap',sans-serif;
    color: #052278;
    padding-left: 4px;
    padding-right: 4px;
    z-index: 40;
  }

  .categories ul{
    z-index: 2;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-around;
    position: relative;
    width: 100%;
  }

  .categories a:hover{
    color: #ffffff;
    background: #282829;
    padding-left: 4px;
    padding-right: 4px;
    z-index: 40;
  }
}