/* =============================================================================
   Geneviève Réal — feuille de style
   Le parti pris : la page disparaît, les tableaux restent.
   ========================================================================== */

:root {
  --fond: #faf9f7;
  --encre: #1c1a18;
  --discret: #8a8480;
  --trait: #e4e0da;
  --actif: #1c1a18;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --marge: clamp(1.25rem, 5vw, 5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #121110;
    --encre: #ece8e2;
    --discret: #8f8a84;
    --trait: #2b2926;
    --actif: #ece8e2;
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }   /* prime sur les display: flex ci-dessous */

/* Lisible par les moteurs de recherche et les lecteurs d'écran, invisible à l'œil.
   Sert aux titres de section que le design ne montre pas. */
.hors-ecran {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* --- En-tête ------------------------------------------------------------- */

.entete {
  padding: clamp(3rem, 9vh, 6.5rem) var(--marge) clamp(1.75rem, 5vh, 3.25rem);
  text-align: center;
}

.entete h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 8vw, 4.75rem);
  letter-spacing: 0.005em;
  line-height: 1.05;
}

.sous-titre {
  margin: 1.1rem 0 0;
  font-size: clamp(0.72rem, 1.6vw, 0.82rem);
  text-transform: uppercase;
  letter-spacing: 0.42em;
  text-indent: 0.42em;      /* compense l'interlettrage final */
  color: var(--discret);
}

/* --- Bandeau ------------------------------------------------------------- */

.bandeau {
  margin-bottom: clamp(2.5rem, 7vh, 5rem);
  background: var(--trait);
}

.bandeau img {
  display: block;
  width: 100%;
  height: clamp(180px, 33vh, 420px);
  object-fit: cover;
  object-position: center 42%;
}

/* --- Filtres ------------------------------------------------------------- */

.filtres {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.35rem 1.5rem;
  padding-bottom: clamp(2rem, 5vh, 3.25rem);
  border-bottom: 1px solid var(--trait);
  margin: 0 var(--marge) clamp(2rem, 5vh, 3.5rem);
}

.groupe {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.4rem;
}

.groupe-titre {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--discret);
  margin-right: 0.35rem;
}

.filtres button {
  appearance: none;
  border: 0;
  background: none;
  padding: 0.3rem 0.1rem;
  margin: 0;
  font: inherit;
  font-size: 0.92rem;
  color: var(--discret);
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.filtres button:hover { color: var(--encre); }

.filtres button[aria-pressed="true"] {
  color: var(--actif);
  border-bottom-color: currentColor;
}

.filtres button:focus-visible {
  outline: 1px solid var(--encre);
  outline-offset: 3px;
}

/* --- Galerie (mosaïque) -------------------------------------------------- */

.galerie {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  grid-auto-rows: 6px;                     /* trame ; le JS calcule les hauteurs */
  gap: 0 clamp(1rem, 2.5vw, 2.25rem);
  padding: 0 var(--marge);
  margin: 0 auto;
  max-width: 1680px;
}

.oeuvre {
  display: block;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: zoom-in;
  opacity: 0;
  animation: apparait 0.7s ease forwards;
}

@keyframes apparait { to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .oeuvre { animation: none; opacity: 1; }
}

.oeuvre img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--trait);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 0.7, 0.3, 1);
}

@media (hover: hover) {
  .oeuvre:hover img { transform: scale(1.014); }
  .oeuvre:hover .legende { opacity: 1; }
}

.oeuvre:focus-visible { outline: 1px solid var(--encre); outline-offset: 6px; }

.legende {
  margin: 0.7rem 0 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--discret);
  opacity: 0.72;
  transition: opacity 0.3s;
}

.legende .titre {
  display: block;
  color: var(--encre);
  font-family: var(--serif);
  font-size: 1rem;
}

.vide {
  text-align: center;
  color: var(--discret);
  padding: 4rem var(--marge);
}

/* --- L'artiste ----------------------------------------------------------- */

.artiste {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 46ch);
  gap: clamp(1.75rem, 5vw, 4rem);
  align-items: start;
  justify-content: center;
  margin: clamp(5rem, 14vh, 10rem) var(--marge) 0;
  padding-top: clamp(3rem, 9vh, 6rem);
  border-top: 1px solid var(--trait);
}

.portrait {
  margin: 0;
  grid-column: 1;
}

.portrait img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--trait);
  filter: saturate(0.94);
}

.notice h2 {
  margin: 0 0 1.1rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.35rem, 3.4vw, 1.9rem);
  line-height: 1.15;
}

.notice .chapeau {
  font-family: var(--serif);
  font-size: clamp(1.05rem, 2.4vw, 1.25rem);
  line-height: 1.55;
  color: var(--encre);
  margin-bottom: 1.3em;
}

.notice p {
  margin: 0 0 1.05em;
  line-height: 1.75;
  color: color-mix(in srgb, var(--encre) 86%, var(--fond));
}

.notice p:last-child { margin-bottom: 0; }

@media (max-width: 720px) {
  .artiste {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: left;
  }
  .portrait { max-width: 220px; }
}

/* --- Contact ------------------------------------------------------------- */

.contact {
  margin-top: clamp(4rem, 12vh, 9rem);
  padding: clamp(3rem, 9vh, 6rem) var(--marge) clamp(2.5rem, 7vh, 4rem);
  border-top: 1px solid var(--trait);
  text-align: center;
}

.accroche {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 3vw, 1.6rem);
  line-height: 1.45;
  max-width: 30ch;
  margin: 0 auto 1.8rem;
}

.coordonnees {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 0.4rem 2rem;
  font-size: clamp(1rem, 2.4vw, 1.15rem);
}

.coordonnees a {
  color: var(--encre);
  text-decoration: none;
  border-bottom: 1px solid var(--trait);
  padding-bottom: 2px;
  transition: border-color 0.25s;
}

.coordonnees a:hover { border-bottom-color: var(--encre); }

.coordonnees .lieu { color: var(--discret); }

.mentions {
  margin: clamp(2.5rem, 7vh, 4rem) 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--discret);
}

/* --- Visionneuse --------------------------------------------------------- */

.visionneuse {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--fond) 96%, var(--encre));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  animation: fondu 0.25s ease;
}

.visionneuse:focus { outline: none; }

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

.v-scene {
  margin: 0;
  /* Trois rangées : l'œuvre (ou la pièce), la légende, le bouton.
     La première prend ce qui reste — la légende et le bouton passent d'abord.
     C'est ce qui garantit que le bouton reste visible sur un écran peu haut. */
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  justify-items: center;
  gap: 0.9rem;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.v-scene img {
  min-height: 0;
  max-width: min(100%, 1400px);
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.45);
}

.v-scene figcaption {
  font-size: 0.9rem;
  color: var(--discret);
  text-align: center;
}

/* Vue en situation : une pièce dessinée à l'échelle */

.v-situation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;   /* la pièce se cale sur la légende, pas de vide entre les deux */
  gap: 0.8rem;
  min-height: 0;
  max-height: 100%;
  height: 100%;
}

.piece {
  display: block;
  width: min(92vw, 1100px);
  height: auto;
  min-height: 0;
  max-height: 100%;
  flex: 0 1 auto;
}

.piece .p-mur { fill: color-mix(in srgb, var(--encre) 5%, var(--fond)); }
.piece .p-sol { fill: color-mix(in srgb, var(--encre) 12%, var(--fond)); }
.piece .p-plinthe { fill: color-mix(in srgb, var(--encre) 9%, var(--fond)); }
.piece .p-meuble { fill: color-mix(in srgb, var(--encre) 17%, var(--fond)); }
.piece .p-ombre { fill: rgba(0, 0, 0, 0.22); }

.v-repere {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  color: var(--discret);
}

.v-bascule {
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--trait);
  background: none;
  margin: 0.2rem 0 0;
  padding: 0.25rem 0.1rem;
  font: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--discret);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.v-bascule:hover { color: var(--encre); border-bottom-color: var(--encre); }
.v-bascule:focus-visible { outline: 1px solid var(--encre); outline-offset: 3px; }

.v-scene figcaption .titre {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--encre);
  display: block;
}

.v-fermer, .v-nav {
  position: absolute;
  appearance: none;
  border: 0;
  background: none;
  color: var(--discret);
  cursor: pointer;
  line-height: 1;
  padding: 0.5rem 0.9rem;
  transition: color 0.2s;
}

.v-fermer:hover, .v-nav:hover { color: var(--encre); }
.v-fermer:focus-visible, .v-nav:focus-visible { outline: 1px solid var(--encre); outline-offset: 2px; }

.v-fermer { top: clamp(0.5rem, 2vw, 1.5rem); right: clamp(0.5rem, 2vw, 1.5rem); font-size: 2.2rem; }

.v-nav { top: 50%; transform: translateY(-50%); font-size: clamp(2.5rem, 6vw, 3.5rem); }
.v-prec { left: clamp(0.15rem, 1.5vw, 1.5rem); }
.v-suiv { right: clamp(0.15rem, 1.5vw, 1.5rem); }

body.fige { overflow: hidden; }

@media (max-width: 640px) {
  .filtres { gap: 0.6rem 1.1rem; }
  .piece { width: 100%; }
}
