/* ==========================================================================
   Peggy Bonnet Vergara — feuille de style
   Direction : galerie sobre (blanc cassé, serif élégante, grandes images)
   ========================================================================== */

/* ---------- Polices (hébergées sur le site, conformes RGPD) ---------- */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/cormorant-garamond-500.woff") format("woff"); }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 500; font-display: swap; src: url("../fonts/cormorant-garamond-500-italic.woff") format("woff"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/source-serif-4-400.woff") format("woff"); }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/source-serif-4-400-italic.woff") format("woff"); }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/source-serif-4-600.woff") format("woff"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/source-sans-3-400.woff") format("woff"); }
@font-face { font-family: "Source Sans 3"; font-style: italic; font-weight: 400; font-display: swap; src: url("../fonts/source-sans-3-400-italic.woff") format("woff"); }
@font-face { font-family: "Source Sans 3"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/source-sans-3-600.woff") format("woff"); }

/* ---------- Variables ---------- */
:root {
  --papier: #faf8f4;
  --papier-2: #f2eee6;
  --encre: #1d1b18;
  --encre-douce: #4a4640;
  --gris: #6f685e;
  --filet: #e2dcd1;
  --accent: #8a2e1e;          /* rouge terre, en écho à la palette de Lam */
  --accent-fonce: #6b2215;

  --titre: "Cormorant Garamond", "Garamond", "Times New Roman", serif;
  --texte: "Source Serif 4", Georgia, serif;
  --ui: "Source Sans 3", "Helvetica Neue", Arial, sans-serif;

  --largeur: 1180px;
  --lecture: 40rem;
  --marge: clamp(1rem, 4vw, 2.5rem);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--texte);
  font-size: 1.0625rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: var(--filet); text-underline-offset: .2em; transition: color .2s, text-decoration-color .2s; }
a:hover { color: var(--accent); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

h1, h2, h3 { font-family: var(--titre); font-weight: 500; line-height: 1.15; letter-spacing: -.005em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.4rem, 5.5vw, 4rem); }
h2 { font-size: clamp(1.8rem, 3.5vw, 2.5rem); }
h3 { font-size: 1.45rem; }
p { margin: 0 0 1.2em; }

.lien-evitement { position: absolute; left: -9999px; }
.lien-evitement:focus { left: 1rem; top: 1rem; background: var(--encre); color: #fff; padding: .5rem 1rem; z-index: 100; }

.conteneur { max-width: var(--largeur); margin: 0 auto; padding: 0 var(--marge); }
.surtitre { font-family: var(--ui); font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gris); margin: 0 0 1rem; }

/* ---------- En-tête ---------- */
.entete { border-bottom: 1px solid var(--filet); background: var(--papier); position: sticky; top: 0; z-index: 20; }
.entete .conteneur { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.5rem; }
.logo { font-family: var(--titre); font-size: 1.5rem; text-decoration: none; line-height: 1.1; }
.logo:hover { color: var(--encre); }
.logo small { display: block; font-family: var(--ui); font-size: .68rem; line-height: 1; letter-spacing: .14em; text-transform: uppercase; color: var(--gris); margin-top: .45rem; }
.nav ul { list-style: none; display: flex; gap: clamp(1rem, 2.4vw, 2rem); margin: 0; padding: 0; }
.nav a { font-family: var(--ui); font-size: .92rem; text-decoration: none; padding: .4rem 0; border-bottom: 1px solid transparent; }
.nav a[aria-current="page"] { border-bottom-color: var(--accent); }
.bouton-menu { display: none; background: none; border: 1px solid var(--filet); font-family: var(--ui); font-size: .9rem; padding: .45rem .8rem; cursor: pointer; color: var(--encre); }

@media (max-width: 820px) {
  .bouton-menu { display: block; }
  .nav { position: absolute; top: 100%; left: 0; right: 0; background: var(--papier); border-bottom: 1px solid var(--filet); display: none; }
  .nav.ouvert { display: block; }
  .nav ul { flex-direction: column; gap: 0; padding: .5rem var(--marge) 1rem; }
  .nav a { display: block; padding: .7rem 0; border-bottom: 1px solid var(--filet); }
  .nav li:last-child a { border-bottom: 0; }
}

/* ---------- Boutons ---------- */
.boutons { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.bouton { display: inline-block; font-family: var(--ui); font-size: .95rem; font-weight: 600; text-decoration: none; padding: .8rem 1.4rem; border: 1px solid var(--encre); background: var(--encre); color: var(--papier); }
.bouton:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.bouton.secondaire { background: transparent; color: var(--encre); }
.bouton.secondaire:hover { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.lien-fleche { font-family: var(--ui); font-size: .92rem; font-weight: 600; text-decoration: none; color: var(--accent); }
.lien-fleche::after { content: " →"; }

/* ---------- Accueil ---------- */
.heros { padding: clamp(3rem, 8vw, 6.5rem) 0; }
.heros .conteneur { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(2rem, 6vw, 5rem); align-items: center; }
.heros h1 { margin-bottom: .3em; }
.heros .roles { font-family: var(--ui); font-size: .95rem; letter-spacing: .04em; color: var(--accent); margin-bottom: 1.6rem; }
.heros .intro { font-size: 1.2rem; color: var(--encre-douce); max-width: 34rem; }
.heros figure { margin: 0; }
@media (max-width: 820px) { .heros .conteneur { grid-template-columns: 1fr; } .heros figure { order: -1; max-width: 22rem; } }

.section { padding: clamp(3rem, 7vw, 5.5rem) 0; border-top: 1px solid var(--filet); }
.section.teinte { background: var(--papier-2); }
.section-entete { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 2.5rem; flex-wrap: wrap; }
.section-entete h2 { margin: 0; }

.entrees { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(1.5rem, 3vw, 2.5rem); }
.entree h3 { font-size: 1.9rem; margin-bottom: .4em; }
.entree p { color: var(--encre-douce); }
.entree .numero { font-family: var(--titre); font-style: italic; font-size: 1.1rem; color: var(--accent); display: block; margin-bottom: .6rem; }
@media (max-width: 820px) { .entrees { grid-template-columns: 1fr; } }

.bandeau { text-align: center; }
.bandeau h2 { max-width: 30ch; margin-left: auto; margin-right: auto; }
.bandeau p { max-width: 38rem; margin: 0 auto; color: var(--encre-douce); }
.bandeau .boutons { justify-content: center; }

/* ---------- Visuels (avec repli si l'image manque) ---------- */
.visuel { background: var(--papier-2); position: relative; overflow: hidden; }
.visuel img { width: 100%; height: 100%; object-fit: cover; }
.visuel.portrait { aspect-ratio: 4 / 5; }
.visuel.carre { aspect-ratio: 1 / 1; }
.visuel.paysage { aspect-ratio: 3 / 2; }
.visuel.couverture img { object-fit: contain; padding: 8%; }
.image-manquante { display: none !important; }
.texte figure .visuel.vide, .galerie .visuel.vide { min-height: 14rem; }
.visuel:has(.image-manquante)::after,
.visuel.vide::after {
  content: attr(data-libelle);
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 1.5rem;
  font-family: var(--titre); font-style: italic; font-size: 1.3rem; color: var(--gris);
}

/* ---------- Cartes (listes générées depuis contenus.js) ---------- */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr)); gap: clamp(1.5rem, 3vw, 2.5rem); }
.carte { text-decoration: none; display: flex; flex-direction: column; }
.carte .visuel { margin-bottom: 1rem; transition: opacity .25s; }
.carte:hover .visuel { opacity: .88; }
.carte .categorie { font-family: var(--ui); font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--gris); margin-bottom: .35rem; }
.carte h3 { font-size: 1.5rem; margin-bottom: .35em; }
.carte:hover h3 { color: var(--accent); }
.carte p { font-size: .97rem; color: var(--encre-douce); margin: 0; }

.liste-textes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--filet); }
.liste-textes li { border-bottom: 1px solid var(--filet); }
.liste-textes a { display: grid; grid-template-columns: 5.5rem 1fr auto; gap: 1.5rem; align-items: baseline; padding: 1.4rem 0; text-decoration: none; }
.liste-textes .annee { font-family: var(--ui); font-size: .85rem; color: var(--gris); }
.liste-textes .titre { font-family: var(--titre); font-size: 1.6rem; line-height: 1.2; }
.liste-textes .titre small { display: block; font-family: var(--texte); font-size: .95rem; color: var(--encre-douce); margin-top: .3rem; }
.liste-textes .fleche { font-family: var(--ui); color: var(--accent); }
@media (max-width: 640px) { .liste-textes a { grid-template-columns: 1fr; gap: .2rem; } .liste-textes .fleche { display: none; } }

.filtres { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.filtres button { font-family: var(--ui); font-size: .88rem; padding: .45rem 1rem; border: 1px solid var(--filet); background: transparent; color: var(--encre); cursor: pointer; }
.filtres button[aria-pressed="true"] { background: var(--encre); color: var(--papier); border-color: var(--encre); }

/* ---------- En-tête de page ---------- */
.page-entete { padding: clamp(3rem, 7vw, 5rem) 0 clamp(2rem, 4vw, 3rem); }
.page-entete .chapo { font-size: 1.2rem; color: var(--encre-douce); max-width: 44rem; }

.fil-ariane { font-family: var(--ui); font-size: .85rem; color: var(--gris); margin-bottom: 1.5rem; }
.fil-ariane ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem; }
.fil-ariane li + li::before { content: "/"; margin-right: .4rem; color: var(--filet); }
.fil-ariane a { text-decoration: none; }

/* ---------- Fiche (article, livre, exposition) ---------- */
.fiche { padding-bottom: clamp(3rem, 7vw, 5rem); }
.fiche-entete { max-width: 52rem; padding: clamp(2.5rem, 6vw, 4.5rem) 0 2rem; }
.fiche-entete h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); }
.fiche-entete .auteur { font-family: var(--ui); font-size: .95rem; color: var(--gris); }
.fiche-mise-en-page { display: grid; grid-template-columns: minmax(0, var(--lecture)) 17rem; gap: clamp(2rem, 6vw, 5rem); align-items: start; }
@media (max-width: 960px) { .fiche-mise-en-page { grid-template-columns: 1fr; } }

.texte { max-width: var(--lecture); }
.texte h2 { font-size: 1.9rem; margin-top: 2.2em; }
.texte h3 { margin-top: 1.8em; }
.texte > p:first-of-type { font-size: 1.15rem; }
.texte blockquote { margin: 2rem 0; padding: 0 0 0 1.5rem; border-left: 2px solid var(--accent); font-style: italic; color: var(--encre-douce); }
.texte ul { padding-left: 1.2rem; }
.texte li { margin-bottom: .35em; }
.texte figure { margin: 2.5rem 0; }
.texte figure.large { margin-left: calc(-1 * min(6vw, 4rem)); margin-right: calc(-1 * min(6vw, 4rem)); }
.texte figcaption, .legende { font-family: var(--ui); font-size: .85rem; line-height: 1.5; color: var(--gris); margin-top: .7rem; }
.texte .note-source { font-family: var(--ui); font-size: .9rem; color: var(--gris); border-top: 1px solid var(--filet); padding-top: 1rem; margin-top: 3rem; }
.texte .droits { font-family: var(--ui); font-size: .85rem; color: var(--gris); }

.encart { position: sticky; top: 6rem; font-family: var(--ui); font-size: .92rem; line-height: 1.55; }
.encart .visuel { margin-bottom: 1.5rem; }
.encart h2 { font-family: var(--ui); font-size: .78rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--gris); margin: 0 0 .8rem; }
.encart dl { margin: 0 0 1.5rem; }
.encart dt { color: var(--gris); font-size: .82rem; }
.encart dd { margin: 0 0 .7rem; }
@media (max-width: 960px) { .encart { position: static; border-top: 1px solid var(--filet); padding-top: 2rem; } }

.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: 1rem; margin: 2.5rem 0; }
.galerie figure { margin: 0; }

.appel { margin-top: 3.5rem; padding: 2rem; background: var(--papier-2); border-left: 3px solid var(--accent); }
.appel p { margin: 0; font-size: 1.05rem; }
.appel a { font-weight: 600; color: var(--accent); }

/* ---------- À propos ---------- */
.cv h2 { border-top: 1px solid var(--filet); padding-top: 2.5rem; margin-top: 3rem; }
.cv ul { list-style: none; padding: 0; margin: 0; }
.cv li { display: grid; grid-template-columns: 7.5rem 1fr; gap: 1.5rem; padding: .8rem 0; border-bottom: 1px solid var(--filet); }
.cv li .date { font-family: var(--ui); font-size: .88rem; color: var(--gris); padding-top: .15rem; }
@media (max-width: 640px) { .cv li { grid-template-columns: 1fr; gap: .1rem; } }

.prestations { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; margin: 2rem 0; }
.prestations h3 { font-size: 1.5rem; }
.prestations p { color: var(--encre-douce); margin: 0; }
@media (max-width: 640px) { .prestations { grid-template-columns: 1fr; } }

/* ---------- Contact ---------- */
.contact-bloc { font-family: var(--ui); }
.contact-bloc .courriel { font-family: var(--titre); font-size: clamp(1.6rem, 4vw, 2.4rem); text-decoration: none; display: inline-block; margin: .5rem 0 2rem; }

/* ---------- Pied de page ---------- */
.pied { border-top: 1px solid var(--filet); padding: 3rem 0 2rem; font-family: var(--ui); font-size: .9rem; color: var(--gris); }
.pied .conteneur { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 2rem; }
.pied .nom { font-family: var(--titre); font-size: 1.4rem; color: var(--encre); margin-bottom: .3rem; }
.pied ul { list-style: none; margin: 0; padding: 0; }
.pied li { margin-bottom: .4rem; }
.pied a { text-decoration: none; }
.pied .bas { grid-column: 1 / -1; border-top: 1px solid var(--filet); padding-top: 1.5rem; margin-top: 1rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; font-size: .82rem; }
@media (max-width: 720px) { .pied .conteneur { grid-template-columns: 1fr; } }

/* ---------- Divers ---------- */
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; } }
@media print { .entete, .pied, .appel, .encart .visuel { display: none; } body { background: #fff; } }

/* Ajustements */
.texte > h2:first-child { margin-top: 0; }
.section.teinte .visuel { background: var(--papier); }
@media print {
  .encart .bouton, #interventions .boutons, .filtres { display: none; }
  .fiche-mise-en-page { grid-template-columns: 1fr; }
  .encart { position: static; }
  a { text-decoration: none; }
  .cv li { break-inside: avoid; }
}

/* Images dans le texte : jamais agrandies au-delà de leur taille réelle */
.texte figure .visuel, .galerie .visuel { background: transparent; }
.texte figure img { width: auto; max-width: 100%; margin: 0 auto; }
.texte figure figcaption { text-align: center; }
.galerie figure img { width: 100%; }
.presse { display: grid; grid-template-columns: 9rem 1fr; gap: 1.5rem; align-items: start; margin: 1.5rem 0; padding: 1.5rem 0; border-top: 1px solid var(--filet); border-bottom: 1px solid var(--filet); }
.presse a.vignette img { width: 100%; border: 1px solid var(--filet); }
.presse blockquote { margin: 0 0 .6rem; }
@media (max-width: 560px) { .presse { grid-template-columns: 6rem 1fr; gap: 1rem; } }
.texte figure .visuel img, .galerie .visuel img { height: auto; object-fit: contain; }
.galerie { align-items: start; }

/* Visionneuse d'images */
.visionneuse { border: 0; padding: 0; background: transparent; max-width: 94vw; max-height: 94vh; overflow: visible; }
.visionneuse::backdrop { background: rgba(20, 18, 16, .88); }
.visionneuse img { max-width: 94vw; max-height: 86vh; width: auto; height: auto; margin: 0 auto; cursor: zoom-out; }
.visionneuse .legende { color: #e9e4da; text-align: center; margin-top: .8rem; }
.visionneuse .fermer { position: fixed; top: 1rem; right: 1.2rem; background: none; border: 0; color: #fff; font-size: 2.4rem; line-height: 1; cursor: pointer; }
