/* =============================================================
   projet.css — modèle de page projet
   -------------------------------------------------------------
   1. Lien retour
   2. Introduction (titre + fiche projet)
   3. Image de couverture
   4. Sections de l'étude (contexte, rôle, objectifs…)
   5. Objectifs
   6. Résultats : chiffres clés + visuels
   7. Navigation projet précédent / suivant
   ============================================================= */


/* -------------------------------------------------------------
   1. Lien retour « ← Tous les projets »
   ------------------------------------------------------------- */
.retour {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--c-foret);
}

.retour__icone {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--c-ligne-forte);
  background: rgba(255, 255, 255, 0.6);
  transition: transform var(--duree) var(--ease), background-color var(--duree) var(--ease);
}

.retour:hover .retour__icone {
  transform: translateX(-4px);
  background: var(--c-blanc);
}


/* -------------------------------------------------------------
   2. Introduction : titre + fiche projet
   ------------------------------------------------------------- */
.projet-intro { padding-bottom: clamp(2.5rem, 5vw, 3.5rem); }

.projet-intro__grille {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
}

@media (min-width: 960px) {
  .projet-intro__grille {
    grid-template-columns: 7fr 5fr;
    align-items: end;
  }
}

.projet-intro .chapo {
  margin-top: 1.25rem;
  color: var(--c-texte);
}

.projet-intro .tags { margin-top: 1.5rem; }

/* Fiche : entreprise, contexte, année… */
.fiche-projet {
  display: grid;
  padding: 1.5rem 1.6rem;
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: var(--ombre-douce);
}

.fiche-projet div {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 1rem;
  padding-block: 0.7rem;
}

.fiche-projet div + div { border-top: 1px solid var(--c-ligne); }
.fiche-projet div:first-child { padding-top: 0; }
.fiche-projet div:last-child { padding-bottom: 0; }

.fiche-projet dt {
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-sauge);
  padding-top: 0.2rem;
}

.fiche-projet dd {
  margin: 0;
  font-weight: 500;
  color: var(--c-encre);
}


/* -------------------------------------------------------------
   3. Image de couverture
   ------------------------------------------------------------- */
.projet-couverture img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--r-xl);
  box-shadow: var(--ombre-forte);
}


/* -------------------------------------------------------------
   4. Sections de l'étude
   -------------------------------------------------------------
   Ordinateur : titre à gauche (reste visible au défilement),
   contenu à droite. */
.etude {
  display: grid;
  gap: 1.25rem;
  padding-block: clamp(3rem, 6vw, 4.5rem);
}

.etude + .etude { border-top: 1px solid var(--c-ligne); }

@media (min-width: 960px) {
  .etude {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: clamp(2.5rem, 5vw, 4.5rem);
  }

  .etude__titre {
    position: sticky;
    top: calc(var(--header-h) + 1.5rem);
    align-self: start;
  }
}

.etude__titre .surtitre { margin-bottom: 0.6rem; }

.etude__titre h2 { font-size: clamp(2rem, 1.6rem + 1.6vw, 3rem); }

.etude__contenu > p { max-width: 62ch; }
.etude__contenu > p + p { margin-top: 1rem; }

/* Mots importants en gras, pour une lecture en diagonale */
.etude__contenu strong { font-weight: 600; color: var(--c-encre); }

.etude__contenu .liste-etoiles { margin-top: 1.25rem; }

/* Les étapes de méthodologie : 2 colonnes max dans la zone de contenu */
.etude__contenu .etapes { margin-top: 1.5rem; }

@media (min-width: 1000px) {
  .etude__contenu .etapes { grid-template-columns: repeat(2, 1fr); }
  .etude__contenu .etape:nth-child(n) { border-left: 1px solid var(--c-ligne); border-top: 0; }
  .etude__contenu .etape:nth-child(2n + 1) { border-left: 0; }
  .etude__contenu .etape:nth-child(n + 3) { border-top: 1px solid var(--c-ligne); }
}

/* Nombre impair d'étapes : la dernière occupe toute la largeur */
@media (min-width: 640px) {
  .etude__contenu .etape:last-child:nth-child(odd) { grid-column: 1 / -1; }
}


/* -------------------------------------------------------------
   5. Objectifs
   ------------------------------------------------------------- */
.objectifs {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .objectifs { grid-template-columns: repeat(3, 1fr); }
}

.objectif {
  padding: 1.4rem 1.3rem;
  border-radius: var(--r-md);
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--ombre-douce);
}

.objectif .icone--etoile {
  height: 1.6rem;
  margin-bottom: 0.75rem;
  color: var(--c-foret);
}

.objectif p { font-size: var(--fs-sm); color: var(--c-texte); }


/* -------------------------------------------------------------
   6. Résultats : chiffres clés + visuels
   ------------------------------------------------------------- */
.chiffres {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .chiffres { grid-template-columns: repeat(3, 1fr); }
}

.chiffre {
  padding: 1.5rem 1.4rem;
  border-radius: var(--r-md);
  background:
    linear-gradient(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.45)),
    var(--img-degrade) var(--degrade-pos, 30% 60%) / 300% auto;
  border: 1px solid rgba(255, 255, 255, 0.85);
}

.chiffre:nth-child(2) { --degrade-pos: 80% 20%; }
.chiffre:nth-child(3) { --degrade-pos: 50% 90%; }

.chiffre__valeur {
  display: block;
  font-family: var(--f-titre);
  font-size: clamp(2.5rem, 2rem + 2vw, 3.5rem);
  line-height: 1;
  color: var(--c-foret);
}

.chiffre__label {
  display: block;
  margin-top: 0.5rem;
  font-size: var(--fs-sm);
  color: var(--c-texte);
}

/* --- Maquettes : pages complètes dans une fenêtre de navigateur ---
   La fenêtre se fait défiler à la main (molette, pavé tactile ou doigt).
   « Agrandir » ouvre l'image entière. Le premier écran occupe toute la
   largeur, tout comme le dernier s'il se retrouve seul sur sa ligne. */
.ecrans {
  display: grid;
  gap: clamp(1.25rem, 2.5vw, 1.75rem);
  margin-top: clamp(2rem, 4vw, 2.75rem);
}

@media (min-width: 700px) {
  .ecrans { grid-template-columns: repeat(2, 1fr); align-items: start; }
  .ecran:first-child,
  .ecran:nth-child(even):last-child { grid-column: 1 / -1; }
}

.ecran__cadre {
  border-radius: 16px;
  overflow: hidden;
  background: var(--c-blanc);
  border: 1px solid var(--c-ligne);
  box-shadow: var(--ombre-douce);
  transition: box-shadow 0.5s var(--ease);
}

.ecran:hover .ecran__cadre,
.ecran:focus-within .ecran__cadre { box-shadow: var(--ombre-forte); }

/* Barre du navigateur : 3 pastilles */
.ecran__barre {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding-inline: 14px;
  background: #eef0eb;
}

.ecran__barre span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e9b6a8;
}

.ecran__barre span:nth-child(2) { background: #ecd99b; }
.ecran__barre span:nth-child(3) { background: #b9d9a8; }

/* La fenêtre : la page complète, à faire défiler soi-même */
.ecran__fenetre {
  display: block;
  aspect-ratio: 16 / 10;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--c-fond);
  scrollbar-width: thin;
  scrollbar-color: rgba(36, 71, 43, 0.35) transparent;
}

.ecran__fenetre:focus-visible {
  outline: 3px solid var(--c-foret);
  outline-offset: -3px;
}

.ecran__fenetre img {
  display: block;
  width: 100%;
  height: auto;
}

/* Variante mobile : cadre de téléphone, plus étroit */
.ecran--mobile { justify-self: center; width: min(100%, 250px); }
.ecran--mobile .ecran__cadre { border-radius: 28px; padding: 10px; background: #1f2a22; border: 0; }
.ecran--mobile .ecran__barre { display: none; }
.ecran--mobile .ecran__fenetre { aspect-ratio: 9 / 18; border-radius: 20px; scrollbar-width: none; }
.ecran--mobile .ecran__fenetre::-webkit-scrollbar { display: none; }

/* Variante document (diapositive) : affichée en entier, sans barre ni défilement */
.ecran--diapo .ecran__barre { display: none; }
.ecran--diapo .ecran__fenetre { aspect-ratio: auto; overflow: visible; background: var(--c-blanc); }

/* Galerie uniquement composée de documents : deux colonnes,
   le dernier est centré s'il est seul sur sa ligne */
@media (min-width: 700px) {
  .ecrans--documents .ecran:first-child,
  .ecrans--documents .ecran:nth-child(even):last-child { grid-column: auto; }

  .ecrans--documents .ecran:last-child:nth-child(odd) {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - clamp(1.25rem, 2.5vw, 1.75rem) / 2);
  }
}

.ecran figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.7rem;
  font-size: var(--fs-sm);
  font-style: italic;
  color: var(--c-texte-doux);
}

/* Lien « Agrandir » sous chaque maquette */
.ecran__agrandir {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  min-height: 44px;
  font-style: normal;
  font-weight: 600;
  color: var(--c-foret);
}

.ecran__agrandir .icone { transition: transform var(--duree) var(--ease); }
.ecran__agrandir:hover .icone { transform: translate(2px, -2px); }

/* Indice « Faire défiler » : petite flèche qui ondule, masquée dès que
   l'on a fait défiler la maquette (classe .a-defile, ajoutée par main.js) */
.ecran__cadre { position: relative; }

.ecran__indice {
  position: absolute;
  left: 50%;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.85rem 0.4rem 0.7rem;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  white-space: nowrap;
  color: var(--c-foret);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 18px rgba(20, 40, 25, 0.18);
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.ecran__indice .icone {
  width: 13px;
  height: 13px;
  animation: indice-defilement 1.5s ease-in-out infinite;
}

@keyframes indice-defilement {
  0%, 100% { transform: rotate(180deg) translateY(0); }
  50% { transform: rotate(180deg) translateY(-4px); }
}

.ecran--mobile .ecran__indice { bottom: 24px; }

.ecran.a-defile .ecran__indice,
.ecran.sans-defilement .ecran__indice {
  opacity: 0;
  transform: translate(-50%, 6px);
}

@media (prefers-reduced-motion: reduce) {
  .ecran__indice .icone { animation: none; transform: rotate(180deg); }
}

/* Curseur « agrandir » au survol d'un visuel (sauf avec le curseur étoile, qui grandit déjà) */
html:not(.curseur-actif) .ecran__fenetre[data-agrandir] { cursor: zoom-in; }

/* --- Visionneuse : le visuel agrandi, sur la page ---
   Fermeture : croix, Échap ou clic à côté de l'image. */
.visionneuse-ouverte { overflow: hidden; }

.visionneuse {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 4.5rem 16px 2.5rem;
  border: 0;
  background: transparent;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.visionneuse[open] {
  display: flex;
  flex-direction: column;
}

.visionneuse::backdrop {
  background: rgba(14, 26, 18, 0.84);
  backdrop-filter: blur(4px);
}

/* margin: auto centre le visuel s'il est court, et le cale en haut s'il est long */
.visionneuse__figure {
  width: min(100%, 1200px);
  margin: auto;
}

.visionneuse--mobile .visionneuse__figure { width: min(100%, 430px); }
.visionneuse--document .visionneuse__figure { width: min(100%, 1400px); }

.visionneuse__image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  background: var(--c-blanc);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}

.visionneuse__legende {
  margin-top: 0.9rem;
  font-size: var(--fs-sm);
  font-style: italic;
  text-align: center;
  color: var(--c-fond);
}

.visionneuse__fermer {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--c-foret);
  background: var(--c-fond);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
  transition: transform var(--duree) var(--ease);
}

.visionneuse__fermer:hover { transform: rotate(90deg); }
.visionneuse__fermer .icone { width: 18px; height: 18px; }

.visionneuse[open] .visionneuse__figure { animation: visionneuse-entree 0.4s var(--ease); }
.visionneuse[open]::backdrop { animation: visionneuse-fondu 0.3s ease; }

@keyframes visionneuse-entree {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
}

@keyframes visionneuse-fondu {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .visionneuse[open] .visionneuse__figure,
  .visionneuse[open]::backdrop { animation: none; }
}

.galerie-aide {
  margin-top: 0.9rem;
  font-size: var(--fs-sm);
  font-style: italic;
  color: var(--c-texte-doux);
}

/* Projets clients : origine des visuels, droits, lien vers le site en ligne */
.ecrans-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 0.5rem 0.9rem;
  margin-top: 1.5rem;
  padding: 1rem 1.25rem;
  border-radius: var(--r-md);
  background: var(--c-pastel-sauge);
}

.ecrans-note .icone--etoile {
  flex-shrink: 0;
  height: 1.3rem;
  margin-top: 0.1rem;
  color: var(--c-foret);
}

.ecrans-note__texte {
  font-size: var(--fs-sm);
  color: var(--c-texte);
}

.ecrans-note__droits {
  margin-top: 0.4rem;
  font-size: var(--fs-xs);
  font-style: italic;
  color: var(--c-texte-doux);
}

/* Mobile : le lien passe sous le texte ; ordinateur : à droite */
.ecrans-note .btn {
  grid-column: 2;
  justify-self: start;
  font-size: var(--fs-sm);
}

@media (min-width: 700px) {
  .ecrans-note { grid-template-columns: auto minmax(0, 1fr) auto; }
  .ecrans-note .btn { grid-column: auto; align-self: center; }
}


/* -------------------------------------------------------------
   7. Navigation projet précédent / suivant
   ------------------------------------------------------------- */
.projets-nav {
  display: grid;
  gap: 1rem;
}

/* Côte à côte seulement sur grand écran : sur tablette, les vignettes
   prendraient trop de place à côté des noms de projet */
@media (min-width: 960px) {
  .projets-nav { grid-template-columns: 1fr 1fr; }
}

.projets-nav a {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 100%;
  padding: 1.4rem 1.5rem;
  border-radius: var(--r-lg);
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--ombre-douce);
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease), background-color 0.5s var(--ease);
}

.projets-nav a:hover,
.projets-nav a.is-actif {
  transform: translateY(-4px);
  background: var(--c-blanc);
  box-shadow: var(--ombre-forte);
}

.projets-nav__suivant { justify-content: flex-end; text-align: right; }

.projets-nav__label {
  display: block;
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--c-sauge);
}

.projets-nav__nom {
  display: block;
  margin-top: 0.25rem;
  font-family: var(--f-titre);
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.85rem);
  line-height: 1.1;
  color: var(--c-encre);
}

.projets-nav__fleche {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--c-ligne-forte);
  color: var(--c-foret);
  transition: transform var(--duree) var(--ease), background-color var(--duree) var(--ease), color var(--duree) var(--ease);
}

.projets-nav a:hover .projets-nav__fleche,
.projets-nav a.is-actif .projets-nav__fleche {
  background: var(--c-foret);
  border-color: var(--c-foret);
  color: var(--c-blanc);
}

.projets-nav__precedent:hover .projets-nav__fleche { transform: translateX(-4px); }
.projets-nav__suivant:hover .projets-nav__fleche { transform: translateX(4px); }

/* Aperçu du projet : la couverture, en vignette */
.projets-nav__image {
  flex-shrink: 0;
  width: 6.5rem;
  height: auto;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: var(--r-md);
  box-shadow: 0 8px 18px -12px rgba(20, 45, 26, 0.5);
  transition: transform 0.5s var(--ease);
}

@media (min-width: 640px) {
  .projets-nav__image { width: 9rem; }
}

@media (min-width: 960px) {
  .projets-nav__image { width: 11rem; }
}

.projets-nav a:hover .projets-nav__image,
.projets-nav a.is-actif .projets-nav__image { transform: scale(1.04); }
