/* =====================================================================
   Portfolio — design « grille régulière », version sombre (fond noir, textes blancs)
   Les couleurs se règlent ici, dans :root.
   ===================================================================== */

:root {
  --fond: #000000;
  --encre: #ffffff;
  --discret: #9a9a9a;
  --filet: #ffffff;
  --filet-epaisseur: 0.5px;     /* épaisseur des filets (1px = plus épais) */
  --surface: #161616;
  --texte-taille: 17px;         /* textes de présentation (projets, À propos) */
  --texte-interligne: 1.35;
  --police: system-ui, -apple-system, "Segoe UI", sans-serif;
  --logo: 24px;
  --entete: max(40px, calc(var(--logo) + 16px));   /* suit la hauteur du logo */
  color-scheme: dark;
}

/* Polices par usage (réglées dans config.js : police, policeTitres, policeNavigation) */
.titre-page, .carte-titre, .carte-legende, .liste a { font-family: var(--police-titres, var(--police)); }
.entete, .barre, .nav-projets, .panneau, .fermer, .visionneuse, .lecture { font-family: var(--police-nav, var(--police)); }
.panneau .index-groupe a, .champ input, .champ textarea { font-family: var(--police); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--police);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 2px solid var(--encre); outline-offset: 2px; }
::selection { background: var(--encre); color: var(--fond); }

.masque {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.evitement {
  position: absolute; left: 12px; top: -80px; z-index: 100;
  background: var(--encre); color: var(--fond); padding: 10px 14px; font-size: 14px;
}
.evitement:focus { top: 8px; }

/* ---------- En-tête : 4 colonnes égales (logo, Tous les projets, À propos, Contact) ---------- */
.entete {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  height: var(--entete);
  background: var(--fond);
  border-bottom: var(--filet-epaisseur) solid var(--filet);
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase;
}
.entete > * { display: flex; align-items: center; justify-content: center; min-width: 0; }
.entete a, .entete button { text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; }
.entete .lien:hover, .entete .lien[aria-current="page"] { text-decoration: underline; text-underline-offset: 4px; }
.logo { display: inline-flex; align-items: center; height: 100%; padding: 0 8px; }
.logo img { height: var(--logo, 24px); width: auto; max-width: 100%; object-fit: contain; }
.chevron { display: none; }

/* ---------- Barre de filtres ---------- */
.barre {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  min-height: 60px; padding: 0 12px;
  border-bottom: var(--filet-epaisseur) solid var(--filet);
}
.filtres {
  display: flex; gap: 22px; align-items: center;
  overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none;
}
.filtres::-webkit-scrollbar { display: none; }
.filtre {
  flex: none; font-size: 20px; line-height: 1; padding: 12px 0; color: var(--discret);
  white-space: nowrap;
}
.filtre:hover { color: var(--encre); }
.filtre[aria-pressed="true"] {
  color: var(--encre);
  text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px;
}
.vues { display: flex; gap: 4px; flex: none; }
.vue {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; color: var(--discret);
}
.vue:hover { color: var(--encre); }
.vue[aria-pressed="true"] { background: var(--surface); color: var(--encre); }
.vue svg { width: 18px; height: 18px; }

/* ---------- Grille régulière ---------- */
.grille {
  display: grid;
  grid-template-columns: repeat(var(--colonnes, 3), minmax(0, 1fr));
  list-style: none; margin: 0; padding: 0;
}
.grille > li { min-width: 0; border-right: var(--filet-epaisseur) solid var(--filet); border-bottom: var(--filet-epaisseur) solid var(--filet); }
@media (min-width: 1000px) {
  .grille[data-colonnes="2"] > li:nth-child(2n),
  .grille[data-colonnes="3"] > li:nth-child(3n),
  .grille[data-colonnes="4"] > li:nth-child(4n) { border-right: 0; }
}
@media (min-width: 640px) and (max-width: 999px) {
  .grille { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grille > li:nth-child(2n) { border-right: 0; }
}
@media (max-width: 639px) {
  .grille { grid-template-columns: 1fr; }
  .grille > li { border-right: 0; }
}

.carte { display: block; }
.carte-media { position: relative; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface); }
.carte-media > img, .carte-media > video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: opacity 0.3s ease;
}
/* Dès que l'aperçu joue, la vignette disparaît : on ne voit plus que la preview */
.carte.apercu-pret .carte-media { background: #000000; }
.carte.apercu-pret .carte-media > img { opacity: 0; }
.carte-apercu {
  position: absolute; inset: 0; opacity: 0; transition: opacity 0.35s ease;
  pointer-events: none; overflow: hidden;
}
.carte-apercu.visible { opacity: 1; }
.carte-apercu img, .carte-apercu video { width: 100%; height: 100%; object-fit: cover; }
.carte-apercu iframe { position: absolute; border: 0; }
.carte-titre {
  position: absolute; left: 12px; top: 10px; right: 12px; z-index: 2;
  font-size: 18px; line-height: 1.2; color: #ffffff; mix-blend-mode: difference;
}
/* Réglage titre: "survol" — au passage de la souris : voile noir à 50 %
   et titre centré. Sur téléphone et tablette (pas de survol), le titre
   reste affiché en haut à gauche, sans voile. */
.carte-voile {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: rgba(0, 0, 0, 0.5); opacity: 0; transition: opacity 0.25s ease;
}
.titres-survol .carte-titre {
  inset: 0; z-index: 3; display: flex; align-items: center; justify-content: center;
  padding: 12px 24px; text-align: center; mix-blend-mode: normal;
  font-size: clamp(18px, 1.6vw, 24px); font-weight: 500;
  opacity: 0; transition: opacity 0.25s ease;
}
.titres-survol .carte:hover .carte-voile,
.titres-survol .carte:focus-visible .carte-voile,
.titres-survol .carte:hover .carte-titre,
.titres-survol .carte:focus-visible .carte-titre { opacity: 1; }
@media (hover: none) {
  .carte-voile { display: none; }
  .titres-survol .carte-titre {
    inset: auto; left: 12px; top: 10px; right: 12px; display: block; padding: 0;
    text-align: left; font-size: 18px; font-weight: 400; mix-blend-mode: difference; opacity: 1;
  }
}
.carte-legende {
  display: flex; align-items: center; min-height: 44px; padding: 8px 12px;
  border-top: var(--filet-epaisseur) solid var(--filet); font-size: 18px; line-height: 1.2;
}
.carte-repli {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--discret); font-size: 14px;
}

/* ---------- Vue liste ---------- */
.liste { list-style: none; margin: 0; padding: 0; }
.liste a {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: center;
  min-height: 64px; border-bottom: var(--filet-epaisseur) solid var(--filet); font-size: 22px;
}
.liste a:hover span { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }
.liste span { grid-column: 1 / span 3; padding: 8px 12px; }
.liste img { justify-self: end; width: 84px; height: 48px; object-fit: cover; margin-right: 12px; background: var(--surface); }

.etat { padding: 48px 12px; font-size: 18px; color: var(--discret); border-bottom: var(--filet-epaisseur) solid var(--filet); }
.etat strong { color: var(--encre); font-weight: 500; }

/* ---------- Pages projet, à propos, contact ---------- */
.titre-page {
  margin: 0; padding: 18px 12px 26px;
  font-size: clamp(44px, 9.2vw, 132px); line-height: 0.95; font-weight: 500; letter-spacing: -0.04em;
  border-bottom: var(--filet-epaisseur) solid var(--filet);
  overflow-wrap: anywhere;
}
.cadre { border-bottom: var(--filet-epaisseur) solid var(--filet); }
.lecteur {
  position: relative; margin-inline: auto; background: var(--surface); overflow: hidden;
  width: min(100%, calc((100svh - var(--entete)) * var(--ratio, 1.7778)));
  aspect-ratio: var(--ratio, 1.7778);
}
.lecteur > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.lecteur iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.lecture {
  /* Bouton « Lecture » : grand triangle blanc au centre de l'image.
     Toute l'image est cliquable ; le mot « Lecture » reste lu par les lecteurs d'écran. */
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0); color: #ffffff;
  font-size: 0; transition: background 0.25s ease;
}
.lecture:hover { background: rgba(0, 0, 0, 0.25); }
.lecture:focus-visible { outline: 2px solid #ffffff; outline-offset: -6px; }
.lecture svg {
  width: clamp(56px, 9vw, 112px); height: clamp(56px, 9vw, 112px);
  margin-left: 0.08em;              /* recentre visuellement le triangle */
  filter: drop-shadow(0 2px 14px rgba(0, 0, 0, 0.55));
  opacity: 0.9; transition: transform 0.25s ease, opacity 0.25s ease;
}
.lecture:hover svg, .lecture:focus-visible svg { opacity: 1; transform: scale(1.08); }

.bloc { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: var(--filet-epaisseur) solid var(--filet); }
.bloc-gauche { grid-column: 1 / span 2; padding: 20px 12px 40px; }
.bloc-texte {
  grid-column: 3 / span 2; border-left: var(--filet-epaisseur) solid var(--filet);
  padding: 20px 12px 64px; font-size: 24px; line-height: 1.4;
}
.bloc-texte p { margin: 0 0 18px; max-width: 34em; }
.bloc-texte p:last-child { margin-bottom: 0; }
/* Texte de présentation (page projet, À propos) : un seul bloc ferré à gauche */
.texte-simple {
  padding: 24px 12px 48px; border-bottom: var(--filet-epaisseur) solid var(--filet);
  font-size: var(--texte-taille); line-height: var(--texte-interligne);
}
.texte-simple p { margin: 0 0 0.8em; max-width: 50em; }
.texte-simple p:last-child { margin-bottom: 0; }
.texte-simple .liens { max-width: 50em; font-size: inherit; }
/* Page projet : texte ferré à gauche, décalé de 40 px */
body[data-page="projet"] .texte-simple { padding-left: 40px; }
.texte-photo:empty { display: none; }
.texte-photo { margin-bottom: 24px; }
.legende { padding: 10px 12px; font-size: 13px; color: var(--discret); }

.photos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.photos figure { margin: 0; min-width: 0; border-bottom: var(--filet-epaisseur) solid var(--filet); }
.photos figure:nth-child(odd) { border-right: var(--filet-epaisseur) solid var(--filet); }
.photos figure.pleine { grid-column: 1 / -1; border-right: 0; }
.photos button { display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface); }
.photos img { width: 100%; height: 100%; object-fit: cover; transition: opacity 0.2s; }
.photos button:hover img { opacity: 0.9; }

/* Bas de page projet : ← Prev · grille 3×3 (accueil) · Next → */
.nav-projets {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  height: 72px; border-bottom: var(--filet-epaisseur) solid var(--filet);
  font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
}
.nav-projets a { display: flex; align-items: center; gap: 12px; padding: 0 12px; }
.nav-prev { justify-self: start; }
.nav-next { justify-self: end; }
.nav-grille { justify-content: center; padding: 0 20px; }
.nav-projets svg { width: 22px; height: 22px; flex: none; }
.nav-grille svg { width: 20px; height: 20px; transition: opacity 0.2s; }
.nav-prev:hover span, .nav-next:hover span { text-decoration: underline; text-underline-offset: 4px; }
.nav-grille:hover svg { opacity: 0.55; }

.portrait { width: 100%; max-width: 420px; aspect-ratio: 4 / 5; object-fit: cover; background: var(--surface); }
.liens { list-style: none; margin: 24px 0 0; padding: 0; font-size: 18px; }
.liens li { border-top: var(--filet-epaisseur) solid var(--filet); }
.liens a { display: block; padding: 12px 0; }
.liens a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Formulaire de contact ---------- */
.formulaire { display: flex; flex-direction: column; gap: 22px; font-size: 18px; }
.champ { display: flex; flex-direction: column; gap: 6px; }
.champ label { font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--discret); }
.champ input, .champ textarea {
  width: 100%; border: 0; border-bottom: var(--filet-epaisseur) solid var(--filet); border-radius: 0;
  background: transparent; padding: 8px 0; font-size: 20px; line-height: 1.35;
}
.champ textarea { min-height: 180px; resize: vertical; }
.champ input:focus, .champ textarea:focus { outline: none; border-bottom-width: 2px; padding-bottom: 7px; }
.piege { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.envoyer {
  align-self: flex-start; height: 48px; padding: 0 24px;
  background: var(--encre); color: var(--fond);
  font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
}
.envoyer:hover { background: #cfcfcf; }
.message-etat { margin: 0; padding: 14px 16px; font-size: 17px; border: var(--filet-epaisseur) solid var(--filet); }
.message-etat.erreur { border-color: #ff8a70; color: #ff8a70; }
.message-etat ul { margin: 6px 0 0; padding-left: 18px; }
.courriel { font-size: 24px; line-height: 1.3; overflow-wrap: anywhere; }
.courriel a { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 1px; }

/* ---------- Panneau « Tous les projets » ---------- */
.panneau {
  position: fixed; inset: 0; z-index: 50; display: none;
  background: var(--fond); overflow-y: auto; overscroll-behavior: contain;
  padding: 0 12px 48px;
}
.panneau.ouvert { display: block; }
.panneau-haut {
  position: sticky; top: 0; z-index: 1; background: var(--fond);
  display: flex; justify-content: space-between; align-items: center;
  height: 60px; border-bottom: var(--filet-epaisseur) solid var(--filet); margin: 0 -12px; padding: 0 12px;
}
.panneau-haut h2 { margin: 0; font-size: 11px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; }
.panneau-haut h2 span { color: var(--discret); margin-left: 6px; }
.fermer {
  display: inline-flex; align-items: center; gap: 8px; height: 44px;
  font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--discret);
}
.fermer:hover { color: var(--encre); }
.fermer svg { width: 18px; height: 18px; }
.recherche { display: block; margin-top: 32px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--discret); }
.recherche-champ {
  display: flex; align-items: center; gap: 14px; margin-top: 8px;
  border-bottom: var(--filet-epaisseur) solid var(--encre); padding-bottom: 8px;
}
.recherche-champ svg { width: 28px; height: 28px; flex: none; }
.recherche-champ input {
  flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 0;
  font-size: clamp(28px, 4vw, 48px); line-height: 1.15;
}
.recherche-champ input::-webkit-search-cancel-button { display: none; }
.panneau .filtres { margin-top: 12px; }
.index {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 48px; row-gap: 28px;
  margin-top: 32px;
}
.index-groupe h3 { margin: 0 0 6px; font-size: 13px; font-weight: 400; color: var(--discret); }
.index-groupe ul { list-style: none; margin: 0; padding: 0; }
.index-groupe a { display: flex; align-items: center; gap: 14px; min-height: 48px; font-size: 18px; }
.index-groupe a:hover span { text-decoration: underline; text-underline-offset: 4px; }
.index-groupe img { width: 72px; height: 40px; object-fit: cover; flex: none; background: var(--surface); }
.index-vide { margin: 40px 0 0; font-size: 18px; color: var(--discret); }

/* ---------- Visionneuse photo ---------- */
.visionneuse {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: rgba(0, 0, 0, 0.97);
  grid-template-rows: 60px 1fr auto; grid-template-columns: 1fr;
}
.visionneuse.ouvert { display: grid; }
.visionneuse-haut { display: flex; justify-content: flex-end; align-items: center; padding: 0 12px; border-bottom: var(--filet-epaisseur) solid var(--filet); }
.visionneuse figure { margin: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 16px 64px; }
.visionneuse img { max-width: 100%; max-height: calc(100svh - 160px); object-fit: contain; }
.visionneuse figcaption { padding-top: 10px; font-size: 13px; color: var(--discret); }
.visionneuse .precedent, .visionneuse .suivante {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 48px; height: 48px; display: flex; align-items: center; justify-content: center;
}
.visionneuse .precedent { left: 8px; }
.visionneuse .suivante { right: 8px; }
.visionneuse .precedent svg, .visionneuse .suivante svg { width: 24px; height: 24px; }

/* ---------- Téléphone ---------- */
@media (max-width: 639px) {
  :root {
    --ligne-logo: max(48px, calc(var(--logo) * 0.8 + 12px));
    --entete: calc(var(--ligne-logo) + 48px);
  }
  .entete { grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: var(--ligne-logo) 48px; }
  .entete > .cellule-logo { grid-column: span 2; justify-content: flex-start; padding-left: 4px; }
  .entete > .cellule-tous {
    order: 4; grid-column: 1 / -1; justify-content: space-between; padding: 0 12px;
    border-top: var(--filet-epaisseur) solid var(--filet);
  }
  .entete > .cellule-tous button { width: 100%; height: 100%; display: flex; justify-content: space-between; align-items: center; }
  .chevron { display: block; width: 14px; height: 14px; }
  .logo { padding: 0 4px; }
  .logo img { height: calc(var(--logo, 24px) * 0.8); }
  .filtre { font-size: 18px; }
  .vues .vue { width: 44px; }
  .liste a { font-size: 18px; }
  .bloc-gauche { display: none; }
  .bloc-gauche.visible-mobile { display: block; grid-column: 1 / -1; border-bottom: var(--filet-epaisseur) solid var(--filet); }
  .bloc-texte { grid-column: 1 / -1; border-left: 0; font-size: 19px; padding-bottom: 40px; }
  .photos { grid-template-columns: 1fr; }
  .photos figure:nth-child(odd) { border-right: 0; }
  .index { grid-template-columns: 1fr; }
  .visionneuse figure { padding: 12px; }
}
@media (min-width: 640px) and (max-width: 999px) {
  .index { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bloc-texte { grid-column: 2 / span 3; font-size: 21px; }
  .bloc-gauche { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* ---------- Graisses (réglées dans config.js : graisse, graisseTitres, graisseNavigation) ---------- */
body { font-weight: var(--graisse-texte, 400); }
.titre-page, .titres-survol .carte-titre, .carte-titre, .carte-legende, .liste a { font-weight: var(--graisse-titres, 500); }
.entete, .barre, .nav-projets, .panneau-haut h2, .fermer { font-weight: var(--graisse-nav, 400); }

/* ---------- Barre des catégories fixée sous l'en-tête pendant le défilement ---------- */
.barre { position: sticky; top: var(--entete); z-index: 15; background: var(--fond); }

/* ---------- Panneau « Tous les projets » : sous l'en-tête, qui reste visible ---------- */
.panneau { top: var(--entete); z-index: 18; }
.entete .lien[aria-expanded="true"] { text-decoration: underline; text-underline-offset: 4px; }

/* ---------- Accueil : filets noirs entre les vignettes ---------- */
.grille > li { border-color: #000000; }
