:root{
  --paper:#FFFFFF;
  --ink:#1d372a;
  --ink-soft:#7c8d84;
  --line:#DAD6CC;
  --gutter:clamp(1.2rem, 3.2vw, 4rem);   /* marge gauche/droite du site (en-tête, mosaïque, slideshow, pied de page) */
  --header-h:4.85rem;                    /* hauteur de l'en-tête une fois "compact" */
  --tile-gap:clamp(0.5rem, 1vw, 1rem);   /* espace entre les images de la mosaïque */
}

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

html{
  scroll-behavior:smooth;
  font-size:clamp(12px, 0.4vw + 12px, 30px);
  height: 100%; 
}

body{
  background:var(--paper);
  color:var(--ink);
  font-family:'Inter', sans-serif;
  font-weight:400;
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
  margin: 0;
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

a{color:inherit;text-decoration:none;}

img{filter:saturate(0.90) contrast(1.03);}

main.page {
  flex: 1;
}

.wrap{
  max-width:clamp(850px, 65vw, 1800px);
  margin:0 auto;
  padding:0 6vw;
}
.text-page{padding-top:3rem;}

/* ---------- en-tête (identique sur toutes les pages) ---------- */
.site-header{
  position:fixed;
  top:0; left:0; right:0;
  z-index:100;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:1.4rem var(--gutter);
  background:var(--paper);
  transition:background-color .3s ease;
}
.logo{
  font-size:2rem;
  font-weight:500;
  letter-spacing:0.2em;
  line-height:1;
  transition:font-size .35s ease;
}

/* Sur la page de garde : en-tête transparent et grand logo, tant qu'on n'a pas scrollé */
.site-header.is-cover{background:transparent;}
.site-header.is-cover .logo{font-size:clamp(2.4rem, 6vw, 6.5rem);}

/* menu déroulant */
.menu{position:relative;}
.menu-btn{
  display:flex;
  align-items:center;
  gap:0.55rem;
  font:inherit;
  font-size:1.15rem;
  line-height:1;
  color:var(--ink);
  background:none;
  border:0;
  padding:0.45rem 0;
  cursor:pointer;
}
.menu-btn::after{
  content:"";
  width:0.42em;
  height:0.42em;
  border-right:1.5px solid currentColor;
  border-bottom:1.5px solid currentColor;
  transform:rotate(45deg) translateY(-0.12em);
  transition:transform .25s ease;
}
.menu.open .menu-btn::after{transform:rotate(225deg) translateY(-0.12em);}

.menu-panel{
  position:absolute;
  right:0;
  top:calc(100% + 0.7rem);
  min-width:12rem;
  display:flex;
  flex-direction:column;
  gap:1rem;
  padding:1.4rem 1.8rem;
  background:#fff;
  box-shadow:0 10px 40px rgba(0,0,0,0.08);
  visibility:hidden;
  opacity:0;
  transform:translateY(-6px);
  transition:opacity .25s ease, transform .25s ease, visibility .25s;
}
.menu.open .menu-panel{visibility:visible;opacity:1;transform:none;}
.menu-panel a{font-size:1.15rem;line-height:1.2;transition:color .15s;}
.menu-panel a:hover{color:var(--ink-soft);}
.menu-panel a[aria-current="page"]{font-weight:500;}

/* ---------- page de garde (accueil) ---------- */
.cover{
  position:relative;
  height:100vh;
  height:100svh;
  min-height:10rem;
  overflow:hidden;
}
.cover img{
  width:100%;
  height:100%;
  object-fit:cover;
  object-position:45% 45%;   /* ajuste ici le cadrage : horizontal vertical */
  display:block;
}

@media (max-aspect-ratio: 4/5){
  .cover{height:auto;min-height:0;}
  .cover img{height:auto;aspect-ratio:4/5;}
}

/* léger voile blanc en haut pour que le logo et le menu restent lisibles */
.cover::after{
  content:"";
  position:absolute;
  top:0; left:0; right:0;
  height:35%;
  background:linear-gradient(to bottom, rgba(255,255,255,0.45), rgba(255,255,255,0));
  pointer-events:none;
}

/* ---------- mosaïque de projets (accueil) ---------- */
.mosaic-section{
  padding:clamp(1.5rem, 3vw, 3rem) var(--gutter) 0;
  scroll-margin-top:var(--header-h);
}
.mosaic{
  column-count:2;
  column-gap:var(--tile-gap);
}
@media (min-width:900px){ .mosaic{column-count:3;} }
@media (min-width:1800px){ .mosaic{column-count:4;} }

.tile{
  position:relative;
  display:block;
  overflow:hidden;
  margin-bottom:var(--tile-gap);
  break-inside:avoid;
  -webkit-column-break-inside:avoid;
}
.tile img{
  width:100%;
  height:auto;
  display:block;
}
/* nom du projet, au survol */
.tile-title{
  position:absolute;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding:1rem;
  font-size:1.1rem;
  font-weight:500;
  color:var(--ink);
  background:rgba(255,255,255,0.82);
  opacity:0;
  transition:opacity .25s ease;
}
@media (hover:hover){
  .tile:hover .tile-title{opacity:1;}
}
/* sur écran tactile (pas de survol) : le nom reste visible en légende */
.tile.touched .tile-title{opacity:1;}

/* ---------- page projet ---------- */
.page{margin-top:var(--header-h);}

.slideshow{
  height:calc(100vh - var(--header-h));
  height:calc(100svh - var(--header-h));
  min-height:22rem;
  padding:1rem var(--gutter) 0;
  display:flex;
  flex-direction:column;
}
.slides{
  position:relative;
  flex:1;
  min-height:0;
}
.slide{
  position:absolute;
  inset:0;
  margin:0;
  opacity:0;
  pointer-events:none;
  transition:opacity .45s ease;
}
.slide.active{opacity:1;pointer-events:auto;z-index:1;}
.slide img{
  width:100%;
  height:100%;
  object-fit:contain;   /* l'image s'affiche en entier (utile pour les plans et documents) */
  display:block;
}
.slideshow-controls{
  display:flex;
  justify-content:center;
  align-items:center;
  gap:1.4rem;
  padding:0.8rem 0 1.1rem;
}
.slideshow-controls button{
  background:none;
  border:0;
  color:var(--ink);
  font-size:1.8rem;
  line-height:1;
  padding:0.2rem 0.8rem;
  cursor:pointer;
}
.slideshow-controls button:hover{color:var(--ink-soft);}
.ss-count{
  min-width:4.5rem;
  text-align:center;
  font-size:0.9rem;
  color:var(--ink-soft);
  font-variant-numeric:tabular-nums;
}

.project-info{
  display:grid;
  gap:2rem 4rem;
  padding:clamp(3rem, 6vw, 6rem) var(--gutter) 1rem;
}
@media (min-width:800px){
  .project-info{grid-template-columns:minmax(0,1fr) minmax(0,1.6fr);}
}
.project-info h1{
  font-size:1.8rem;
  font-weight:500;
  line-height:1.2;
  margin-bottom:0.4rem;
}
.project-meta{color:var(--ink-soft);font-size:1.05rem;}

.project-text{max-width:56ch;margin-bottom:2rem;}
.project-text p{margin-bottom:1.1rem;color:var(--ink-soft);}

.specs-list{
  display:flex;
  flex-direction:column;
  gap:0.5rem;
  margin-bottom:1rem;
  font-size:0.92rem;
}
.specs-list div{color:var(--ink-soft);}
.specs-list b{color:var(--ink);font-weight:500;}

/* ---------- pages de texte (about, contact, blog, mentions) ---------- */
.about-text{max-width:52ch;margin-bottom:3rem;}
.about-text p{margin-bottom:1.2rem;color:var(--ink-soft);}
.about-text h1{font-size:1.8rem;font-weight:500;line-height:1.2;margin-bottom:1.2rem;}
.about-text h2,.about-text h3{font-size:1rem;font-weight:400;color:var(--ink-soft);margin-bottom:1.2rem;}

/* texte lu par les lecteurs d'écran et Google, mais invisible */
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
.specs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:1.2rem 2rem;
  padding-top:1.8rem;
  max-width:52ch;
}
.specs .k{font-size:0.78rem;color:var(--ink-soft);margin-bottom:0.2rem;}
.specs .v{font-size:0.95rem;}
.specs .v a:hover{color:var(--ink-soft);}

/* la mosaïque fait au moins un écran de haut (nécessaire pour que la descente automatique puisse l'atteindre) */
.mosaic-section{min-height:calc(100vh - var(--header-h));min-height:calc(100svh - var(--header-h));}

/* slideshow : le glissement horizontal est réservé aux images, le défilement vertical reste libre */
.slides{touch-action:pan-y;}

/* pas d'animation de défilement pour les personnes qui l'ont désactivée dans leur système */
@media (prefers-reduced-motion: reduce){
  html{scroll-behavior:auto;}
}

/* page About : photo carrée à côté de la présentation */
.about-layout{display:grid;gap:2.5rem 4rem;align-items:start;}
@media (min-width:800px){
  .about-layout{grid-template-columns:minmax(0,1fr) minmax(0,1.3fr);}
}
@media (max-width:799px){
  .portrait{max-width:26rem;}
}
.portrait{aspect-ratio:2/3;overflow:hidden;background:var(--line);}
.portrait img{width:100%;height:100%;object-fit:cover;display:block;}

/* page Blog : photo format original */

.gallery {
  width: 100%;
  max-width: 44rem; 
  margin: 0 auto 2rem auto; 
  overflow: hidden;
  background: var(--line);
}

.gallery img {
  width: 100%;
  height: auto; 
  object-fit: contain; 
  display: block;
}

/* texte centré sur la page de garde */
.cover-text {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  
  /* 1. Aligne les blocs de texte (h1, p) au centre horizontalement */
  align-items: center; 
  
  justify-content: flex-start;
  
  /* 2. Centre le texte lui-même à l'intérieur de ses blocs */
  text-align: center;
  
  /* 3. Espace autour du texte (visible au scroll sous l'image) */
  padding: 12rem calc(var(--gutter) * 2) 12rem;   /* identique à l'ancien rendu (la classe était posée deux fois) */
  
  color: var(--ink);
  box-sizing: border-box;
}

/* On s'assure que les marges internes automatiques ne viennent pas bloquer le centrage */
.cover-text h1,
.cover-text p {
  max-width: 44rem;
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.65;
  margin-left: auto;
  margin-right: auto;
}
.cover-text h1 {
  margin-bottom: 0.2rem;
}

/* ---------- pied de page ---------- */
footer{
  width: 100%;
  box-sizing: border-box;
  
  padding: 2.5rem var(--gutter);
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  font-size: clamp(0.7rem, 2vw, 0.85rem);
  color: var(--ink-soft);
}
footer a:hover { color: var(--ink); }
