/* Portfolio — Dan Greisner · afk.lu
 *
 * One grotesque, set very large and very tight; four colours; no ornament
 * beyond the dotted rule and the spaced small cap. Reference: jozue.fr.
 *
 * Page geometry derives from the images: every visual is measured by
 * tools/measure-media.js and rendered at its exact ratio. No crop, no device
 * frame, no caption claiming what the image is not.
 */

:root {
  --encre: #111319;
  --papier: #f3f2f0;
  --blanc: #ffffff;
  --creme: #f7f2e7;
  --accent: #f73326;
  --trait: rgba(17, 19, 25, 0.22);
  /* Image backdrop: paper in light, neutral grey in dark */
  --fond-image: #ffffff;
  --ombre: rgba(17, 19, 25, 0.16);
  --attenue: 0.6;
  --attenue-plus: 0.72;
  color-scheme: light;

  --police: 'Inter Tight', 'Helvetica Neue', Helvetica, Arial, system-ui, sans-serif;

  --marge: clamp(1.25rem, 4vw, 4rem);
  --max: 108rem;
}

/* System preference first, explicit choice wins through data-theme */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --encre: #f1f0ee;
    --papier: #111319;
    --blanc: #1b1d24;
    --creme: #1e1f26;
    --accent: #ff5a4d;
    --trait: rgba(241, 240, 238, 0.24);
    --fond-image: #1b1d24;
    --ombre: rgba(0, 0, 0, 0.5);
    --attenue: 0.62;
    --attenue-plus: 0.72;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --encre: #f1f0ee;
  --papier: #111319;
  --blanc: #1b1d24;
  --creme: #1e1f26;
  --accent: #ff5a4d;
  --trait: rgba(241, 240, 238, 0.24);
  --fond-image: #1b1d24;
  --ombre: rgba(0, 0, 0, 0.5);
  --attenue: 0.62;
  --attenue-plus: 0.72;
  color-scheme: dark;
}

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

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

body {
  margin: 0;
  background: var(--papier);
  color: var(--encre);
  font: 400 clamp(0.95rem, 0.9rem + 0.2vw, 1.05rem)/1.5 var(--police);
  overflow-wrap: break-word;
}

img { display: block; max-width: 100%; }
a { color: inherit; }

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

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: var(--marge);
  top: 0.75rem;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  background: var(--blanc);
  padding: 0 1rem;
  border: 1px solid var(--encre);
}

/* Vocabulary: spaced small caps, dotted rule, middot. No pills, no buttons */
.petite {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ---- Header bar -------------------------------------------------------- */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem var(--marge);
  background: color-mix(in srgb, var(--papier) 88%, transparent);
  backdrop-filter: blur(10px);
}

.ident { margin: 0; display: flex; gap: 0.6rem; align-items: baseline; }
.ident strong { font-weight: 700; letter-spacing: -0.02em; font-size: 1rem; }
.ident span { font-size: 0.68rem; font-weight: 500; letter-spacing: 0.1em; text-transform: uppercase; opacity: var(--attenue-plus); }

.ident a {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  min-height: 44px;
  align-content: center;
  flex-wrap: wrap;
  text-decoration: none;
}

.top-nav { display: flex; gap: 0.1rem; }
.top-nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 0.7rem;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
}
.top-nav a:hover { color: var(--accent); }
.pdf { font-size: 0.6rem; letter-spacing: 0.08em; opacity: var(--attenue); }

/* ---- Light / dark toggle ----------------------------------------------- */

/* Filled half-circle: legible in both themes */
.theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin-left: 0.15rem;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
  opacity: var(--attenue-plus);
  transition: opacity 0.18s ease, transform 0.3s ease;
}
.theme:hover { opacity: 1; color: var(--accent); }
.theme svg { display: block; }
:root[data-theme='dark'] .theme svg,
.theme[aria-pressed='true'] svg { transform: rotate(180deg); }

/* Screen-reader label */
.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- Menu button ------------------------------------------------------- */

.burger {
  display: none;
  align-items: center;
  gap: 0.55rem;
  min-height: 44px;
  min-width: 44px;
  padding: 0 0.25rem 0 0.7rem;
  background: none;
  border: 0;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
}
.burger-mot {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.burger-traits {
  display: grid;
  gap: 5px;
  width: 22px;
}
.burger-traits i {
  display: block;
  height: 2px;
  background: currentColor;
  transition: transform 0.2s ease;
}
.burger-traits.croix i:first-child { transform: translateY(3.5px) rotate(45deg); }
.burger-traits.croix i:last-child { transform: translateY(-3.5px) rotate(-45deg); }

@media (max-width: 54rem) {
  .top-nav { display: none; }
  .burger { display: inline-flex; }
}

/* The site header is hidden inside a project: the menu stays on the bar */
.burger-projet { display: inline-flex; margin-left: 0.4rem; }

/* ---- Full-screen menu -------------------------------------------------- */

.menu {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--papier);
  color: var(--encre);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.menu::backdrop { background: rgba(17, 19, 25, 0.4); }

.menu-barre {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem var(--marge);
  background: var(--papier);
}
.menu-barre .burger { display: inline-flex; }

.menu-corps {
  display: grid;
  gap: clamp(2rem, 6vw, 4rem);
  grid-template-columns: repeat(auto-fit, minmax(min(18rem, 100%), 1fr));
  padding: clamp(1rem, 4vw, 3rem) var(--marge) 0;
}

.menu-primaire { margin: 0; padding: 0; list-style: none; }
.menu-primaire a {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.1em 0;
  font-weight: 700;
  font-size: clamp(2.2rem, 9vw, 4.5rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
  text-decoration: none;
}
.menu-primaire a:hover { color: var(--accent); }

/* Under the CV link: what the link is about to do */
.menu-note {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 1.25rem;
  align-items: center;
  margin: 0.25rem 0 1.25rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.menu-note span { opacity: var(--attenue); }

.menu-projets .petite { margin: 0 0 0.75rem; opacity: var(--attenue-plus); }
.menu-projets ul {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 2rem;
}
.menu-projets li { break-inside: avoid; }
.menu-projets a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  min-height: 44px;
  padding: 0.35rem 0;
  border-bottom: 1px dotted var(--trait);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.menu-projets a:hover { color: var(--teinte, var(--accent)); }
.menu-projets .annee { opacity: var(--attenue); font-size: 0.72rem; font-variant-numeric: tabular-nums; }

.menu-pied {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  align-items: center;
  margin-top: clamp(2rem, 6vw, 4rem);
  padding: 1.25rem var(--marge) 2.5rem;
  border-top: 1px solid var(--trait);
  font-size: 0.85rem;
}
.menu-pied a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
}
.menu-pied a:hover { color: var(--accent); }
.menu-pied span { opacity: var(--attenue-plus); }

@media (min-width: 54.01rem) {
  .menu-projets ul { columns: 2; }
}
@media (max-width: 30rem) {
  .menu-projets ul { columns: 1; }
}

/* ---- Hero -------------------------------------------------------------- */

.lede {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2rem, 6vw, 5rem) var(--marge) clamp(2.5rem, 7vw, 5rem);
}

h1 {
  margin: 0;
  font-weight: 700;
  font-size: clamp(2.6rem, 11.5vw, 10.5rem);
  line-height: 0.88;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
h1 .plus { color: var(--accent); }

.lede > p {
  margin: 2rem 0 0;
  max-width: 46ch;
  font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.1rem);
  line-height: 1.45;
  text-wrap: pretty;
}

/* Hero facts: small caps separated by middots, on a rule */
.faits {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0;
  margin: 2rem 0 0;
  padding: 0.9rem 0 0;
  border-top: 1px solid var(--trait);
  list-style: none;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.faits li { opacity: 0.6; }
.faits li + li::before {
  content: '·';
  margin: 0 0.75em;
  opacity: 0.6;
}

/* ---- Project index ----------------------------------------------------- */

.regle {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.25rem;
  align-items: baseline;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem var(--marge);
  scroll-margin-top: 4.5rem;
  border-top: 1px solid var(--trait);
}
.regle em { font-style: normal; font-weight: 400; font-size: 0.85rem; opacity: 0.6; }

.index {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--marge) clamp(3rem, 8vw, 6rem);
}

.ligne {
  position: relative;
  border-bottom: 1px dotted var(--trait);
}

.ligne a {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: baseline;
  padding: clamp(0.6rem, 1.6vw, 1.1rem) 0;
  text-decoration: none;
}

.nom {
  font-weight: 700;
  font-size: clamp(1.9rem, 6.2vw, 5rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  transition: color 0.18s ease;
}

.etiquettes {
  align-self: center;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: var(--attenue);
}

.annee {
  margin-left: auto;
  align-self: center;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  opacity: var(--attenue-plus);
  font-variant-numeric: tabular-nums;
}

/* Preview on intent only, at its real ratio */
.apercu {
  position: absolute;
  top: 50%;
  right: 0;
  z-index: 2;
  width: min(30vw, 22rem);
  margin: 0;
  transform: translate(0, -50%) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.apercu img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--r);
  object-fit: contain;
  background: var(--fond-image);
  box-shadow: 0 1rem 3rem var(--ombre);
}

/* Keyboard reaches the preview everywhere, hover only where it exists */
@media (min-width: 48rem) {
  .ligne:focus-within .nom { color: var(--teinte, var(--accent)); }
  .ligne:focus-within .apercu { opacity: 1; transform: translate(0, -50%) scale(1); }
}

/* (hover) only describes the primary pointer: a hybrid machine — touch
 * screen plus mouse — answers "no hover" while it does hover. data-tactile,
 * set by the head script on the first real touch, is what counts. */
@media (min-width: 48rem) {
  html:not([data-tactile]) .ligne:hover .nom { color: var(--teinte, var(--accent)); }
  html:not([data-tactile]) .ligne:hover .apercu { opacity: 1; transform: translate(0, -50%) scale(1); }
}

/* Narrow screen: the thumbnail drops into the line, which goes column */
@media (max-width: 47.99rem) {
  .apercu {
    position: static;
    width: 100%;
    max-width: 22rem;
    opacity: 1;
    transform: none;
    margin-bottom: 0.75rem;
    order: -1;
  }
  .ligne a { flex-direction: column; align-items: flex-start; }
  /* Back to flush left once the line is a column */
  .etiquettes, .annee { align-self: flex-start; margin-left: 0; }
}

/* Wide screen driven by touch. The thumbnail shrinks to a marker so the
 * line stays a line. Above 60rem only: below, it costs too much width. */
@media (min-width: 60rem) {
  html[data-tactile] .apercu {
    position: static;
    width: clamp(4.5rem, 8vw, 7rem);
    max-width: 7rem;
    flex: 0 0 auto;
    align-self: center;
    margin-right: 0.25rem;
    opacity: 1;
    transform: none;
    order: -1;
  }
  html[data-tactile] .apercu img { box-shadow: 0 0.25rem 0.9rem var(--ombre); }
}

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

.atelier, .contact {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--marge);
  border-top: 1px solid var(--trait);
  scroll-margin-top: 4.5rem;
}

.atelier h2, .contact h2 {
  margin: 0 0 1.75rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: var(--attenue-plus);
}

.atelier-corps {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(21rem, 100%), 1fr));
}
.atelier-corps p {
  margin: 0 0 1rem;
  font-size: clamp(1.05rem, 1rem + 0.5vw, 1.45rem);
  line-height: 1.32;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}
.atelier-corps dl { margin: 0; font-size: 0.95rem; }
.atelier-corps dt {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  opacity: var(--attenue-plus);
  margin-bottom: 0.15rem;
}
.atelier-corps dd { margin: 0 0 1rem; padding-bottom: 1rem; border-bottom: 1px dotted var(--trait); }

.coord { display: flex; flex-wrap: wrap; gap: 0.5rem 2.5rem; margin: 0; padding: 0; list-style: none; }
.coord a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 700;
  font-size: clamp(1.3rem, 1rem + 2vw, 3rem);
  letter-spacing: -0.03em;
  text-decoration: none;
}
.coord a:hover { color: var(--accent); }

/* ---- Project page ------------------------------------------------------ */

.projet {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--papier);
}
.projet[hidden] { display: none; }

.projet-barre {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem var(--marge);
  background: color-mix(in srgb, var(--papier) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px dotted var(--trait);
}

.paire { display: flex; gap: 0.1rem; }

.lien {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0 0.7rem;
  background: none;
  border: 0;
  color: inherit;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
}
.lien:hover:not(:disabled) { color: var(--teinte, var(--accent)); }

/* Project name centred in the bar, position beside it */
.projet-fil {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  margin: 0;
  min-width: 0;
}
.projet-nom {
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.position { opacity: var(--attenue); font-size: 0.7rem; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* On phone the bar holds one line: back, counter, arrows, menu */
@media (max-width: 40rem) {
  .projet-barre { flex-wrap: nowrap; gap: 0.15rem; padding: 0.5rem 0.75rem; }
  .projet-fil { flex: 1 1 auto; justify-content: center; min-width: 0; }
  .projet-nom { display: none; }
  .lien .long, .burger-mot { display: none; }
  .lien, .burger-projet {
    min-width: 44px;
    justify-content: center;
    padding: 0;
    font-size: 1rem;
  }
  .burger-projet { margin-left: 0.15rem; }
  .burger-traits { width: 20px; }
}

.fiche {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--marge) clamp(3rem, 8vw, 6rem);
}

/* ---- Project cover ----------------------------------------------------- */

/* Browsing with Next must keep the title at the same height: the block is
 * top-aligned and the image sits in a band of constant height. The ratio is
 * untouched — contain floats it whole inside the band. */
.couv {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
  padding: clamp(2rem, 6vw, 5rem) 0 clamp(2rem, 5vw, 3.5rem);
  border-bottom: 1px solid var(--trait);
  margin-bottom: clamp(2rem, 5vw, 4rem);
}

@media (min-width: 60rem) {
  .couv { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
}

/* The role always fits one line: wrapping would shift the title between pages */
.couv-kicker {
  margin: 0 0 1rem;
  color: var(--teinte, var(--accent));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.couv h2 {
  margin: 0 0 1.25rem;
  font-weight: 700;
  font-size: clamp(2.4rem, 8.5vw, 7rem);
  line-height: 0.9;
  letter-spacing: -0.038em;
  text-wrap: balance;
}

.couv .sous {
  margin: 0;
  max-width: 46ch;
  font-size: clamp(1.05rem, 1rem + 0.5vw, 1.4rem);
  line-height: 1.3;
  letter-spacing: -0.015em;
  text-wrap: pretty;
}

/* Site link: the domain itself, underlined by a thickening rule */
.couv-lien { display: grid; gap: 0.15rem; justify-items: start; margin: 1.5rem 0 0; }
.couv-lien .petite { opacity: var(--attenue); }
.couv-lien a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  font-weight: 700;
  font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.5rem);
  letter-spacing: -0.025em;
  text-decoration: none;
  box-shadow: inset 0 -1px 0 0 var(--trait);
  transition: box-shadow 0.18s ease, color 0.18s ease;
}
.couv-lien a:hover {
  color: var(--teinte, var(--accent));
  box-shadow: inset 0 -2px 0 0 currentColor;
}
.couv-lien .fleche { font-weight: 400; opacity: 0.6; }

/* Colophon: label above, value below, dotted rule */
.colophon {
  display: grid;
  gap: 0 clamp(1.25rem, 3vw, 2.5rem);
  grid-template-columns: repeat(auto-fit, minmax(min(9rem, 100%), 1fr));
  margin: clamp(1.75rem, 4vw, 2.5rem) 0 0;
  border-top: 1px solid var(--trait);
}
.colophon > div { padding: 0.85rem 0; border-bottom: 1px dotted var(--trait); }
.colophon dt {
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: var(--attenue);
  margin-bottom: 0.3rem;
}
.colophon dd {
  margin: 0;
  /* Two lines reserved, so the colophon keeps its height across projects */
  min-height: 2.6em;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

.couv-image { margin: 0; }
.couv-image img {
  width: 100%;
  height: clamp(13rem, 42vh, 26rem);
  aspect-ratio: auto;
  object-fit: contain;
  object-position: center;
  background: none;
}
.couv-image figcaption {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dotted var(--trait);
}

/* ---- Chapters · one visual facing each block --------------------------- */

.chapitres {
  display: grid;
  gap: clamp(2.5rem, 7vw, 5.5rem);
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.rang-chap { display: grid; gap: clamp(1.5rem, 4vw, 2.5rem); }

/* Small screen: DOM order does the work — chapter, image, chapter */
@media (min-width: 60rem) {
  .rang-chap {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
  }
  .rang-chap .chap { grid-column: 1; }
  /* The image holds the right column, facing the text block */
  .rang-chap .rang-image {
    grid-column: 2;
    grid-row: 1 / -1;
    position: sticky;
    top: 5.5rem;
  }
  .rang-seul .chap { grid-column: 1 / -1; max-width: 58ch; }
}

.chap + .chap { margin-top: clamp(1.5rem, 4vw, 2.5rem); }

.rang-image { margin: 0; }
.rang-image img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--r);
  object-fit: contain;
  background: var(--fond-image);
}
.rang-image figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  align-items: baseline;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dotted var(--trait);
}
.rang-image .rang {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--teinte, var(--accent));
  font-variant-numeric: tabular-nums;
}
.rang-image .dit { font-size: 0.95rem; max-width: 52ch; }
.rang-image .meta { opacity: var(--attenue); margin-left: auto; font-size: 0.72rem; font-variant-numeric: tabular-nums; }

.fiche-texte, .chap { max-width: 58ch; }
.fiche-texte h2, .chap h2 {
  margin: 2rem 0 0.4rem;
  font-weight: 700;
  font-size: clamp(1.3rem, 1.1rem + 1vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.025em;
}
.fiche-texte h3, .chap h3 {
  margin: 2.5rem 0 0.75rem;
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: var(--attenue-plus);
}
.fiche-texte p, .chap p { margin: 0 0 0.9rem; text-wrap: pretty; }

/* Wide objects span the measure, others pair up. Measured, not chosen */
.objets { display: grid; gap: clamp(2rem, 5vw, 4rem); }
.objets-tete { margin: 0; opacity: var(--attenue); }

.bloc { display: grid; gap: clamp(1.25rem, 3vw, 2.5rem); }
.bloc-paire { grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); }

.objet { margin: 0; }
.objet img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--r);
  object-fit: contain;
  background: var(--fond-image);
}
.objet figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.9rem;
  align-items: baseline;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px dotted var(--trait);
}
.objet .rang {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--teinte, var(--accent));
  font-variant-numeric: tabular-nums;
}
.objet .dit { font-size: 0.95rem; max-width: 58ch; }
.objet .meta { opacity: var(--attenue); margin-left: auto; font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.couv-image .rang { font-size: 0.7rem; font-weight: 500; letter-spacing: 0.08em; color: var(--teinte, var(--accent)); }
.couv-image .dit { font-size: 0.86rem; max-width: 62ch; }
.couv-image .meta { opacity: var(--attenue); margin-left: auto; font-size: 0.72rem; font-variant-numeric: tabular-nums; }

/* ---- Dual width · source, ratio and caption switch together ------------ */
.objet picture,
.rang-image picture,
.couv-image picture { display: block; }

@media (min-width: 48rem) {
  .sur-mob { display: none; }
}

@media (max-width: 47.99rem) {
  .sur-desk { display: none; }
  .objet img,
  .rang-image img { aspect-ratio: var(--rm, var(--r)); }
}

.suite {
  display: grid;
  gap: 1.5rem;
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 3.5rem) var(--marge) clamp(3rem, 7vw, 5rem);
  border-top: 1px solid var(--trait);
}
@media (min-width: 48rem) {
  .suite { grid-template-columns: 1fr 1fr; }
}

.suite-lien {
  display: grid;
  gap: 0.35rem;
  padding: 1rem 0;
  text-decoration: none;
  border-top: 1px dotted var(--trait);
}
.suite-lien .petite { opacity: var(--attenue); }
.suite-droite { text-align: right; }
.suite-nom {
  font-weight: 700;
  font-size: clamp(1.3rem, 0.9rem + 2vw, 2.8rem);
  line-height: 1;
  letter-spacing: -0.035em;
}
.suite-lien:hover .suite-nom { color: var(--accent); }

/* ---- Footer ------------------------------------------------------------ */

.pied {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  justify-content: space-between;
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem var(--marge) 2.5rem;
  border-top: 1px solid var(--trait);
  font-size: 0.8rem;
  opacity: 0.6;
}
.pied p { margin: 0; }
.pied a { display: inline-flex; align-items: center; min-height: 44px; }

body:has(.projet:not([hidden])) { overflow: hidden; }

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