/* ============ Réglages faciles à changer ============ */
:root {
  --fond: #f6f3ee;
  --texte: #1c1b19;
  --gris: #7a756c;
  --trait: #d9d3c8;
  --accent: #b5452b;
  --colonnes: 4;            /* nombre de colonnes sur grand écran */
  --espace: 28px;           /* espace entre les images */
  --titre: "Fraunces", Georgia, serif;
  --corps: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--corps);
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- En-tête ---------- */
.entete {
  display: flex;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
  padding: 48px 5vw 24px;
}
.nom {
  font-family: var(--titre);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--texte);
  text-decoration: none;
}
.metier { margin: 0; color: var(--gris); flex: 1; }
.contact {
  color: var(--texte);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.contact:hover { color: var(--accent); }

/* ---------- Onglets ---------- */
.onglets {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  gap: 4px 26px;
  flex-wrap: wrap;
  padding: 16px 5vw;
  background: color-mix(in srgb, var(--fond) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--trait);
}
.onglets button {
  appearance: none;
  background: none;
  border: 0;
  padding: 6px 0;
  font: inherit;
  font-weight: 500;
  color: var(--gris);
  cursor: pointer;
  position: relative;
}
.onglets button::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform .25s ease;
}
.onglets button:hover { color: var(--texte); }
.onglets button.actif { color: var(--texte); }
.onglets button.actif::after { transform: scaleX(1); }
.onglets .nombre { font-size: 11px; color: var(--gris); margin-left: 3px; vertical-align: super; }

/* ---------- Grille (en colonnes, respecte les proportions des images) ---------- */
main { padding: 40px 5vw 80px; }
.grille {
  list-style: none;
  margin: 0; padding: 0;
  columns: var(--colonnes);
  column-gap: var(--espace);
}
.carte {
  break-inside: avoid;
  margin-bottom: var(--espace);
  animation: apparition .45s ease both;
}
.carte button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
  text-align: left;
  font: inherit;
  color: inherit;
}
.carte img {
  display: block;
  width: 100%;
  height: auto;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.06);
  transition: transform .35s ease, box-shadow .35s ease;
}
.carte button:hover img,
.carte button:focus-visible img {
  transform: translateY(-4px);
  box-shadow: 0 2px 4px rgba(0,0,0,.08), 0 16px 36px rgba(0,0,0,.12);
}
.carte .legende {
  display: block;
  margin-top: 10px;
  font-size: 13px;
  color: var(--gris);
}
.carte .legende strong { color: var(--texte); font-weight: 500; }

@keyframes apparition {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

.vide { color: var(--gris); text-align: center; padding: 60px 0; }

.pied {
  padding: 32px 5vw;
  border-top: 1px solid var(--trait);
  color: var(--gris);
  font-size: 12px;
}

/* ---------- Visionneuse ---------- */
.visionneuse {
  width: min(1200px, 94vw);
  max-height: 92vh;
  padding: 0;
  border: 0;
  background: var(--fond);
  color: var(--texte);
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
.visionneuse::backdrop { background: rgba(20, 18, 15, .78); }
.visionneuse[open] { animation: ouverture .3s ease; }
@keyframes ouverture { from { opacity: 0; transform: scale(.97); } }

.visionneuse figure {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 1fr);
  max-height: 92vh;
}
.v-image {
  position: relative;
  background: #e9e4dc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  min-height: 0;
}
.v-image img {
  max-width: 100%;
  max-height: calc(92vh - 80px);
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(0,0,0,.18);
}
.visionneuse figcaption {
  padding: 56px 40px 40px;
  overflow-y: auto;
}
.visionneuse h2 {
  font-family: var(--titre);
  font-weight: 600;
  font-size: 28px;
  line-height: 1.15;
  margin: 0 0 6px;
}
.v-annee { color: var(--gris); margin: 0 0 28px; }
.credits { margin: 0; }
.credits div {
  padding: 12px 0;
  border-top: 1px solid var(--trait);
}
.credits dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--gris);
}
.credits dd { margin: 2px 0 0; font-size: 16px; }

.fermer, .fleche {
  position: absolute;
  z-index: 2;
  border: 0;
  background: rgba(255,255,255,.85);
  color: var(--texte);
  width: 42px; height: 42px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}
.fermer { top: 12px; right: 12px; }
.fleche { top: 50%; transform: translateY(-50%); }
.precedent { left: 12px; }
.suivant { right: 12px; }
.fermer:hover, .fleche:hover { background: #fff; color: var(--accent); }

/* ---------- Écrans plus petits ---------- */
@media (max-width: 1100px) { :root { --colonnes: 3; } }
@media (max-width: 760px) {
  :root { --colonnes: 2; --espace: 16px; }
  .entete { padding-top: 28px; }
  .visionneuse figure { grid-template-columns: 1fr; overflow-y: auto; }
  .v-image { padding: 24px; }
  .v-image img { max-height: 60vh; }
  .visionneuse figcaption { padding: 24px; }
}
@media (max-width: 420px) { :root { --colonnes: 1; } }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
