/* RÉGLAGES COMMUNS — modifiez ici les couleurs, la marge et la police. */
:root {
  --fond: #edf7fc;
  --texte: #20262a;
  --texte-legende: #44545c;
  --marge: 3mm;
  --hauteur-visible: 100vh;
  --ecart-grille: clamp(18px, 2.4vw, 38px);
  --police-legende: "Helvetica Neue", Arial, sans-serif;
  font: 400 20px/1.2 "Times New Roman", Times, serif;
  color-scheme: light;
}

@supports (height: 100svh) {
  :root { --hauteur-visible: 100svh; }
}

* { box-sizing: border-box; }

html {
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--fond);
}

body {
  display: grid;
  grid-template: auto minmax(0, 1fr) / minmax(0, 1fr);
  height: var(--hauteur-visible);
  margin: 0;
  padding: var(--marge);
  overflow: hidden;
  color: var(--texte);
}

main {
  min-width: 0;
  min-height: 0;
}

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

a:hover,
button:hover,
summary:hover,
[aria-pressed="true"],
details[open] > summary {
  text-decoration: underline;
  text-underline-offset: 4px;
}

:focus-visible { outline: 2px solid #365a70; outline-offset: -2px; }

.entete {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
}

.entete h1,
.entete p { margin: 0; font: inherit; }
.entete .signature { font-weight: 700; }
.retour { font-style: italic; }

figcaption {
  padding: 6px 2px 0;
  color: var(--texte-legende);
  font: italic 400 12px/1.4 "Times New Roman", Times, serif;
}

/* ACCUEIL — la photo et sa légende restent ancrées en bas. */
.entete-accueil {
  position: relative;
  z-index: 1;
  min-height: calc(3.6em + 4px);
}

.navigation {
  position: absolute;
  top: 1.2em;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
  max-height: calc(var(--hauteur-visible) - var(--marge) - 1.2em);
  overflow: auto;
  background: var(--fond);
}

.navigation summary {
  display: block;
  width: fit-content;
  list-style: none;
  cursor: pointer;
}

.navigation summary::-webkit-details-marker { display: none; }

.liste-projets {
  margin: 0;
  padding-left: .85em;
  list-style: none;
}

.accueil {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding-top: clamp(8px, calc(var(--hauteur-visible) * .09), 110px);
}

.photo-accueil {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(0, 4fr);
  grid-template-rows: minmax(0, 1fr);
  min-height: 0;
  gap: var(--ecart-grille);
  margin: 0;
}

.photo-accueil .cadre-photo {
  position: relative;
  grid-column: 2;
  grid-row: 1;
}

.photo-accueil img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: right bottom;
}

.photo-accueil figcaption {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
}

@media (max-width: 680px) {
  .photo-accueil {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 0;
  }

  .photo-accueil .cadre-photo { grid-column: 1; }
  .photo-accueil figcaption { grid-row: 2; }
}

/* PROJETS — dupliquez mulhouse-les-bains.html pour réutiliser cette grille. */
.entete-projet { padding-bottom: 4px; }
.entete-projet a { white-space: nowrap; }

.portfolio {
  --reserve-legendes: 24px;
  --hauteur-largeur: calc(var(--hauteur-visible) * .6);
  display: grid;
  grid-template-columns: minmax(min(26vw, 260px), 1fr) minmax(0, 4fr);
  grid-template-rows: minmax(0, min(100%, calc(var(--hauteur-largeur) + var(--reserve-legendes))));
  align-content: end;
  gap: var(--ecart-grille);
  padding-top: clamp(12px, calc(var(--hauteur-visible) * .22 - 100px), calc(var(--hauteur-visible) * .09));
}

.presentation,
.lecture {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
}

.presentation {
  font-size: 21px;
  line-height: 1.2;
}

.presentation p { max-width: 48ch; margin: 0; }
.presentation p + p { margin-top: .8em; }

.galerie {
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  container-type: size;
  min-width: 0;
  min-height: 0;
}

.bande {
  --hauteur-images: max(0px, calc(100cqh - var(--reserve-legendes)));
  display: flex;
  align-items: flex-end;
  gap: clamp(10px, 1vw, 16px);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
}

.bande,
#presentation .lecture { scrollbar-width: none; }

.bande::-webkit-scrollbar,
#presentation .lecture::-webkit-scrollbar { display: none; }

.photo {
  flex: 0 0 calc(var(--hauteur-images) * var(--ratio-photo, 15 / 22));
  min-width: 0;
  margin: 0;
}

.photo .cadre-photo { height: var(--hauteur-images); }

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

.photo figcaption {
  height: var(--reserve-legendes);
  overflow: auto;
  overflow-wrap: anywhere;
}

@media (max-width: 960px) {
  .portfolio {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, min(28%, 8rem)) minmax(0, 1fr);
  }

  .bande {
    --hauteur-images: min(
      calc(var(--hauteur-visible) * .65),
      var(--hauteur-largeur),
      max(0px, calc(100cqh - var(--reserve-legendes)))
    );
  }
}

/* À PROPOS — le CV commence sur l’axe central en mise en page à deux colonnes. */
.a-propos {
  display: grid;
  grid-template: minmax(0, 1fr) / repeat(2, minmax(0, 1fr));
  padding-top: clamp(12px, calc(var(--hauteur-visible) * .09), 88px);
  font-size: 18px;
  line-height: 1.4;
}

.choix { display: none; }

.choix button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.colonne {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  min-height: 0;
  width: min(100%, 68ch);
}

#presentation { padding-right: clamp(20px, 4vw, 56px); }

.colonne h2,
.colonne h3 {
  margin: 0;
  font: inherit;
  font-weight: 700;
}

.colonne h3 { margin-top: .85em; }

.lecture { scrollbar-width: thin; }
.lecture p { margin: 0; }
.lecture p + p { margin-top: .75em; }
.lecture > :first-child { margin-top: 0; }

@media (max-width: 760px) {
  .a-propos {
    grid-template: auto minmax(0, 1fr) / minmax(0, 1fr);
    gap: 10px;
  }

  .choix { display: flex; gap: 20px; }
  #presentation { padding-right: 0; }
  .colonne:not(.active) { display: none; }
}

@media (min-width: 961px) {
  .portfolio {
    grid-template-columns:
      max(min(39vw, 390px), calc((100% - var(--ecart-grille)) * .3))
      minmax(0, 1fr);
  }

  .portfolio .presentation p {
    max-width: 72ch;
  }
}