/* Archives Mauboussin — feuille de style unique.
   Palette « papier ancien » en clair, « chambre noire » en sombre. */

:root {
  --papier: #f7f3ec;
  --papier-carte: #fffdf9;
  --encre: #221f1a;
  --encre-douce: #5d564c;
  --encre-tenue: #8a8175;
  --trait: #ddd4c6;
  --trait-fin: #eae3d7;
  --laiton: #96703c;
  --laiton-clair: #b18e57;
  --grenat: #7c2f31;
  --ombre: 0 1px 2px rgba(40, 30, 15, .05), 0 8px 24px -12px rgba(40, 30, 15, .18);

  --serif: 'EB Garamond', "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --largeur: 76rem;
  --largeur-texte: 40rem;
  --marge: clamp(1.25rem, 4vw, 3rem);
  --rayon: 3px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --papier: #16130f;
    --papier-carte: #1e1a15;
    --encre: #ece5d9;
    --encre-douce: #b4aa9a;
    --encre-tenue: #8b8172;
    --trait: #342d24;
    --trait-fin: #2a241d;
    --laiton: #c9a468;
    --laiton-clair: #dcbc84;
    --grenat: #d4888a;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  }
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font-family: var(--serif);
  font-size: 1.2rem;
  line-height: 1.58;
  font-variant-numeric: oldstyle-nums;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; text-underline-offset: .18em; text-decoration-thickness: .06em; }
a:hover { color: var(--grenat); }

h1, h2, h3, h4 {
  font-family: var(--serif); font-weight: 600; line-height: 1.1;
  letter-spacing: -.005em; margin: 0; font-variant-numeric: lining-nums;
}
h1 { font-size: clamp(2.3rem, 1.5rem + 3.2vw, 3.7rem); }
h2 { font-size: clamp(1.7rem, 1.3rem + 1.5vw, 2.3rem); }
h3 { font-size: 1.4rem; }

p { margin: 0 0 1em; }

:focus-visible { outline: 2px solid var(--laiton); outline-offset: 3px; border-radius: 2px; }

.visuellement-cache {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.saut {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--encre); color: var(--papier); padding: .7rem 1.1rem;
}
.saut:focus { left: .5rem; top: .5rem; }

/* ---------- en-tête ---------- */

.entete {
  border-bottom: 1px solid var(--trait);
  background: color-mix(in srgb, var(--papier) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 50;
}

.bande {
  max-width: var(--largeur); margin: 0 auto; padding: 1rem var(--marge);
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
}

.marque { text-decoration: none; display: grid; gap: .1rem; margin-right: auto; }
.marque-nom {
  font-size: 1.2rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
}
.marque-sous {
  font-family: var(--sans); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--encre-tenue);
}
.marque:hover .marque-nom { color: var(--grenat); }

.navigation { display: flex; gap: 1.6rem; font-family: var(--sans); font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; }
.navigation a { text-decoration: none; color: var(--encre-douce); padding: .2rem 0; border-bottom: 1px solid transparent; }
.navigation a:hover { color: var(--encre); border-bottom-color: var(--laiton); }
.navigation a[aria-current="page"] { color: var(--encre); border-bottom-color: var(--laiton); }

.bouton-menu {
  display: none; font-family: var(--sans); font-size: .78rem; letter-spacing: .1em;
  text-transform: uppercase; background: none; border: 1px solid var(--trait);
  color: var(--encre); padding: .45rem .8rem; border-radius: var(--rayon); cursor: pointer;
}

@media (max-width: 46rem) {
  .bouton-menu { display: block; }
  .navigation { display: none; width: 100%; flex-direction: column; gap: .2rem; padding-top: .75rem; }
  .navigation.ouvert { display: flex; }
  .navigation a { padding: .55rem 0; border-bottom: 1px solid var(--trait-fin); }
}

/* ---------- structure ---------- */

main {
  flex: 1;
  max-width: var(--largeur);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--marge) 5rem;
}

.section { margin-top: clamp(3rem, 7vw, 5rem); }

.section-entete {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  border-bottom: 1px solid var(--trait); padding-bottom: .7rem; margin-bottom: 2rem;
}

.lien-suite {
  font-family: var(--sans); font-size: .78rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--encre-douce); text-decoration: none;
}
.lien-suite::after { content: " →"; }
.lien-suite:hover { color: var(--grenat); }

.entete-page { max-width: var(--largeur-texte); margin-bottom: 2.5rem; }
.entete-page h1 { margin-bottom: .6rem; }
.entete-page p { color: var(--encre-douce); font-size: 1.1rem; margin: 0; }

/* ---------- accueil ---------- */

.hero {
  max-width: 46rem;
  padding-bottom: clamp(2rem, 5vw, 3rem);
}
.hero-oeil {
  font-family: var(--sans); font-size: .72rem; letter-spacing: .18em;
  text-transform: uppercase; color: var(--laiton); margin-bottom: 1.2rem;
}
.hero h1 { margin-bottom: 1.2rem; text-wrap: balance; }
.hero-texte { font-size: 1.15rem; color: var(--encre-douce); max-width: 36rem; }
.hero-actions { display: flex; gap: .8rem; flex-wrap: wrap; margin-top: 2rem; }

.bouton {
  display: inline-block; font-family: var(--sans); font-size: .8rem;
  letter-spacing: .1em; text-transform: uppercase; text-decoration: none;
  padding: .8rem 1.4rem; border-radius: var(--rayon);
  background: var(--encre); color: var(--papier); border: 1px solid var(--encre);
  transition: opacity .15s ease;
}
.bouton:hover { opacity: .82; color: var(--papier); }
.bouton-fin { background: transparent; color: var(--encre); border-color: var(--trait); }
.bouton-fin:hover { border-color: var(--laiton); color: var(--encre); opacity: 1; }

.chiffres {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1px; background: var(--trait);
  border: 1px solid var(--trait); border-radius: var(--rayon); overflow: hidden;
}
.chiffres div { background: var(--papier-carte); padding: 1.4rem 1.5rem; display: grid; gap: .25rem; }
.chiffres strong { font-size: 1.75rem; font-weight: 600; letter-spacing: -.02em; }
.chiffres span {
  font-family: var(--sans); font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--encre-tenue);
}

/* ---------- grilles et cartes ---------- */

.grille {
  display: grid; gap: clamp(1.25rem, 3vw, 2rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}

.carte { min-width: 0; }
.carte a { text-decoration: none; display: grid; gap: .9rem; }

.carte-media {
  background: var(--papier-carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  overflow: hidden;
  aspect-ratio: 4 / 5;
  display: grid; place-items: center;
  box-shadow: var(--ombre);
}
.carte-media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .4s ease, filter .4s ease;
}
.carte a:hover .carte-media img { transform: scale(1.03); }

.sans-image {
  font-family: var(--sans); font-size: .72rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--encre-tenue);
}
.sans-image.grand {
  aspect-ratio: 4 / 3; width: 100%; display: grid; place-items: center;
  border: 1px dashed var(--trait); border-radius: var(--rayon);
}

.carte-texte h3 { margin-bottom: .35rem; text-wrap: balance; }
.carte a:hover h3 { color: var(--grenat); }

.etiquette {
  font-family: var(--sans); font-size: .7rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--laiton); margin-bottom: .45rem;
}

.carte-resume {
  font-size: .95rem; color: var(--encre-douce); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}

.grille-articles { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr)); }
.carte-article a { text-decoration: none; display: grid; gap: .9rem; }
.carte-article .carte-media { aspect-ratio: 16 / 10; }
.carte-article:hover h3 { color: var(--grenat); }

/* ---------- article à la une (accueil) ---------- */

.une {
  display: block; text-decoration: none;
  border: 1px solid var(--trait); border-left: 3px solid var(--laiton);
  border-radius: var(--rayon); background: var(--papier-carte);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  box-shadow: var(--ombre);
  transition: border-color .18s ease;
}
.une:hover { border-color: var(--laiton); }
.une h3 {
  font-size: clamp(1.4rem, 1.1rem + 1.4vw, 2rem);
  margin-bottom: .7rem; text-wrap: balance;
}
.une:hover h3 { color: var(--grenat); }
.une-resume {
  color: var(--encre-douce); max-width: 46rem; font-size: 1.05rem; margin-bottom: 1.2rem;
}
.une-lire {
  font-family: var(--sans); font-size: .76rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--laiton);
}
.une-lire::after { content: " →"; }

.liste-articles { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.liste-articles li { border-bottom: 1px solid var(--trait-fin); }
.liste-articles li:first-child { border-top: 1px solid var(--trait-fin); }
.liste-articles a {
  display: grid; gap: .2rem .5rem; text-decoration: none;
  grid-template-columns: 10rem 1fr; align-items: baseline;
  padding: 1.1rem .3rem;
}
.liste-articles a:hover { background: var(--papier-carte); }
.liste-date {
  font-family: var(--sans); font-size: .72rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--encre-tenue);
}
.liste-titre { font-size: 1.12rem; font-weight: 600; }
.liste-articles a:hover .liste-titre { color: var(--grenat); }
.liste-resume {
  grid-column: 2; color: var(--encre-douce); font-size: .95rem;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 40rem) {
  .liste-articles a { grid-template-columns: 1fr; }
  .liste-resume { grid-column: 1; }
}

/* ---------- barre d'outils des archives ---------- */

.barre-outils {
  display: flex; gap: 1rem; flex-wrap: wrap; align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--trait); border-bottom: 1px solid var(--trait);
  padding: .9rem 0; margin-bottom: 2.5rem;
}

.filtres { display: flex; gap: .4rem; flex-wrap: wrap; }
.filtre {
  font-family: var(--sans); font-size: .74rem; letter-spacing: .08em;
  text-transform: uppercase; cursor: pointer;
  background: transparent; color: var(--encre-douce);
  border: 1px solid var(--trait); border-radius: 100px; padding: .4rem .85rem;
  transition: all .15s ease;
}
.filtre:hover { border-color: var(--laiton); color: var(--encre); }
.filtre[aria-pressed="true"] { background: var(--encre); border-color: var(--encre); color: var(--papier); }

.recherche input {
  font-family: var(--sans); font-size: .9rem; color: var(--encre);
  background: var(--papier-carte); border: 1px solid var(--trait);
  border-radius: 100px; padding: .5rem 1rem; min-width: 14rem;
}
.recherche input::placeholder { color: var(--encre-tenue); }

.vide {
  color: var(--encre-tenue); font-style: italic;
  padding: 3rem 0; text-align: center;
}

/* ---------- fiche de pièce ---------- */

.fil {
  font-family: var(--sans); font-size: .75rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--encre-tenue); margin-bottom: 2rem;
}
.fil a { color: var(--encre-douce); text-decoration: none; }
.fil a:hover { color: var(--grenat); }
.fil span { margin: 0 .4rem 0 .1rem; }

.piece {
  display: grid; gap: clamp(2rem, 5vw, 3.5rem);
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  align-items: start;
}
@media (max-width: 54rem) { .piece { grid-template-columns: 1fr; } }

.piece-visuel figure { margin: 0; }
.piece-visuel img {
  width: 100%; border: 1px solid var(--trait); border-radius: var(--rayon);
  background: var(--papier-carte); box-shadow: var(--ombre); cursor: zoom-in;
}
.piece-visuel figcaption {
  font-family: var(--sans); font-size: .8rem; color: var(--encre-tenue);
  margin-top: .8rem; line-height: 1.5;
}

.galerie { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .9rem; }
.galerie-vignette {
  width: 5.5rem; height: 5.5rem; padding: 0; cursor: pointer;
  background: var(--papier-carte); border: 1px solid var(--trait);
  border-radius: var(--rayon); overflow: hidden; opacity: .62;
  transition: opacity .15s ease, border-color .15s ease;
}
.galerie-vignette img { width: 100%; height: 100%; object-fit: cover; }
.galerie-vignette:hover { opacity: 1; }
.galerie-vignette.actif { opacity: 1; border-color: var(--laiton); }

.piece-fiche { position: sticky; top: 6rem; }
@media (max-width: 54rem) { .piece-fiche { position: static; } }
.piece-fiche h1 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.4rem); margin-bottom: .8rem; text-wrap: balance; }

.chapeau { font-size: 1.1rem; color: var(--encre-douce); margin-bottom: 1.8rem; }

.fiche {
  display: grid; grid-template-columns: auto 1fr; gap: 0;
  border-top: 1px solid var(--trait); margin: 0;
}
.fiche dt {
  font-family: var(--sans); font-size: .7rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--encre-tenue);
  padding: .8rem 1.5rem .8rem 0; border-bottom: 1px solid var(--trait-fin);
  white-space: nowrap;
}
.fiche dd {
  margin: 0; padding: .8rem 0; border-bottom: 1px solid var(--trait-fin);
  font-size: .98rem;
}

/* ---------- texte long ---------- */

.prose {
  max-width: var(--largeur-texte);
  margin-top: clamp(2.5rem, 6vw, 4rem);
  font-size: 1.08rem;
}
.prose > *:first-child { margin-top: 0; }
.prose h2 { margin: 2.5rem 0 .8rem; }
.prose h3 { margin: 2rem 0 .6rem; }
.prose ul, .prose ol { padding-left: 1.3rem; margin: 0 0 1.2em; }
.prose li { margin-bottom: .4em; }
.prose img { border: 1px solid var(--trait); border-radius: var(--rayon); margin: 2rem 0; }
.prose blockquote {
  margin: 1.8rem 0; padding: .2rem 0 .2rem 1.4rem;
  border-left: 2px solid var(--laiton); color: var(--encre-douce); font-style: italic;
}
.prose hr { border: 0; border-top: 1px solid var(--trait); margin: 2.5rem 0; }
.prose code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em;
  background: var(--trait-fin); padding: .12em .35em; border-radius: 2px;
}
.prose table { width: 100%; border-collapse: collapse; margin: 1.8rem 0; font-size: .96rem; }
.prose th, .prose td { text-align: left; padding: .6rem .8rem; border-bottom: 1px solid var(--trait-fin); }
.prose th { font-family: var(--sans); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--encre-tenue); }

.article { max-width: var(--largeur-texte); margin: 0 auto; }
.article-entete { margin-bottom: 2.5rem; }
.article-entete h1 { margin-bottom: .8rem; text-wrap: balance; }
.article-image { margin: 0 0 2rem; }
.article-image img { width: 100%; border: 1px solid var(--trait); border-radius: var(--rayon); }
.article-image figcaption { font-family: var(--sans); font-size: .8rem; color: var(--encre-tenue); margin-top: .7rem; }
.article .prose { margin-top: 0; }

/* ---------- pagination ---------- */

.pagination {
  display: flex; justify-content: space-between; gap: 1.5rem;
  margin-top: clamp(3rem, 7vw, 5rem); padding-top: 1.5rem;
  border-top: 1px solid var(--trait);
}
.pagination a { text-decoration: none; display: grid; gap: .2rem; max-width: 20rem; }
.pagination-suiv { text-align: right; }
.pagination a span {
  font-family: var(--sans); font-size: .7rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--encre-tenue);
}
.pagination a:hover { color: var(--grenat); }

/* ---------- visionneuse ---------- */

.visionneuse {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(18, 15, 11, .93);
  display: grid; place-items: center; padding: 2rem; cursor: zoom-out;
}
.visionneuse img { max-width: 100%; max-height: 90vh; width: auto; object-fit: contain; border-radius: 2px; }
.visionneuse-fermer {
  position: absolute; top: 1rem; right: 1.2rem; background: none; border: 0;
  color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; padding: .3rem .6rem;
}

/* =========================================================
   Passe de finition — texture, ornements, lecture, impression
   ========================================================= */

/* Grain de papier : très léger, uniquement en thème clair.
   Rend la surface moins « écran » sans gêner la lecture. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E");
}
@media (prefers-color-scheme: dark) { body::before { opacity: .022; } }
.entete, main, .visionneuse { position: relative; z-index: 1; }

/* Marque : petites capitales et filet, plutôt que du gras */
.marque-nom { font-weight: 500; font-size: 1.35rem; letter-spacing: .06em; }

/* Hero : ornement typographique entre l'accroche et le texte */
.hero h1 { letter-spacing: -.015em; }
.hero-texte { position: relative; padding-top: 1.6rem; }
.hero-texte::before {
  content: ""; position: absolute; top: 0; left: 0;
  width: 3.5rem; height: 1px; background: var(--laiton);
}

/* Titres de section : filet plus fin, capitales du sur-titre alignées */
.section-entete { border-bottom-width: 1px; }
.section-entete h2 { letter-spacing: -.01em; }

/* Chiffres : les nombres en chiffres alignés, la légende en petites capitales */
.chiffres strong { font-size: 2.1rem; font-variant-numeric: lining-nums; }

/* Cartes : ombre plus discrète, la photo respire */
.carte-media { box-shadow: none; transition: box-shadow .25s ease, border-color .25s ease; }
.carte a:hover .carte-media { box-shadow: var(--ombre); border-color: var(--laiton); }

/* Lettrine sur le premier paragraphe d'un article */
.article .prose > p:first-of-type::first-letter {
  float: left; font-size: 3.6em; line-height: .82; font-weight: 500;
  padding: .06em .09em 0 0; color: var(--laiton);
}
.article .prose > p:first-of-type::first-line { font-variant-caps: small-caps; letter-spacing: .02em; }

/* Confort de lecture */
.prose { font-size: 1.16rem; line-height: 1.62; }
.prose p { margin-bottom: 1.15em; }
.prose h2 { margin: 2.8rem 0 .7rem; }
.prose blockquote {
  background: var(--papier-carte); border-left-width: 2px;
  padding: 1.1rem 1.3rem; margin: 2rem 0; font-style: normal;
  border-radius: 0 var(--rayon) var(--rayon) 0;
}
.prose blockquote p:last-child { margin-bottom: 0; }

/* Tableaux : lisibles sur mobile, sans casser la page */
.prose table { display: block; overflow-x: auto; white-space: nowrap; }
@media (min-width: 34rem) { .prose table { display: table; white-space: normal; } }
.prose tbody tr:hover { background: var(--papier-carte); }

/* Fiche de pièce : les valeurs en chiffres elzéviriens, alignement soigné */
.fiche dd { font-variant-numeric: oldstyle-nums; }

/* Liens du corps de texte : soulignement fin qui s'épaissit au survol */
.prose a, .une-resume a {
  text-decoration-color: var(--laiton);
  text-decoration-thickness: .05em;
  transition: text-decoration-thickness .15s ease;
}
.prose a:hover { text-decoration-thickness: .12em; }

/* Sélection */
::selection { background: var(--laiton); color: var(--papier); }

/* Impression : une archive doit pouvoir sortir sur papier proprement */
@media print {
  body::before, .entete, .barre-outils, .pagination, .fil, .une-lire { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  main { max-width: none; padding: 0; }
  .piece { grid-template-columns: 1fr; }
  .piece-fiche { position: static; }
  .prose, .article { max-width: none; }
  a { text-decoration: none; color: #000; }
  .prose a::after { content: " (" attr(href) ")"; font-size: .85em; color: #555; }
  h1, h2, h3 { break-after: avoid; }
  figure, .carte, .fiche { break-inside: avoid; }
}

/* Respect des préférences de mouvement */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .carte a:hover .carte-media img { transform: none; }
}
