/* Site de Thomas Perrin — sobre, blanc, les œuvres d'abord. Base reprise de in parvo. */
:root {
  --ink: #161616;
  --muted: #6e6e6e;
  --line: #e4e4e1;
  --paper: #fff;
  --soft: #f4f4f1;
  --gap: clamp(16px, 3vw, 32px);
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.5 var(--font); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1 { font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 400; letter-spacing: -0.01em; margin: 0 0 0.6em; }
h2 { font-size: 1.1rem; font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- En-tête : le nom, les quatre rubriques, la langue ---------- */
.site-head, .site-foot, main { max-width: 1320px; margin: 0 auto; padding: 0 var(--gap); }
.site-head { display: flex; align-items: baseline; gap: 12px clamp(20px, 4vw, 56px); flex-wrap: wrap; padding-top: clamp(20px, 4vw, 44px); padding-bottom: clamp(20px, 3vw, 36px); }
.name { font-size: clamp(1.05rem, 1.7vw, 1.3rem); letter-spacing: -0.015em; text-decoration: none; white-space: nowrap; }
.main-nav { display: flex; gap: 0.4em 1.4em; flex-wrap: wrap; flex: 1; }
.main-nav a { text-decoration: none; color: var(--muted); transition: color .2s; }
.main-nav a:hover { color: var(--ink); }
.main-nav a[aria-current="page"] { color: var(--ink); border-bottom: 1px solid currentColor; }
.lang-switch { margin: 0 0 0 auto; display: flex; gap: 10px; font-size: .8rem; letter-spacing: .06em; }
.lang-switch a { color: var(--muted); text-decoration: none; }
.lang-switch a:hover { color: var(--ink); text-decoration: underline; }
.lang-switch b { font-weight: 600; }
@media (max-width: 560px) {
  .site-head { align-items: center; }
  .main-nav { order: 3; flex-basis: 100%; }
}

main { padding-bottom: 72px; min-height: 60vh; }
.site-foot { border-top: 1px solid var(--line); padding-top: 24px; padding-bottom: 48px; display: flex; gap: 1em 3em; flex-wrap: wrap; color: var(--muted); font-size: 0.9rem; }
.site-foot p { margin: 0 0 .3em; }
.foot-name { color: var(--ink); }
.foot-contact a { color: inherit; }

/* ---------- Grille des œuvres ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: calc(var(--gap) * 1.2) var(--gap); }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr 1fr; gap: 20px 12px; } }
.card { text-decoration: none; display: block; }
.card-img { aspect-ratio: 4 / 5; background: var(--soft); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.card-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.card:hover .card-img img { transform: scale(1.02); }
.card-txt { display: flex; flex-direction: column; padding-top: 8px; font-size: 0.92rem; line-height: 1.35; }
.card-title { font-style: italic; font-size: 0.8rem; }
.card-meta { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.intro { margin: 0 0 2.4em; }

/* Cartes à plusieurs images : superposées, une seule visible, fondu entre elles (/accueil.js). */
.slides { position: relative; }
.slides img { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s ease; }
.slides img.on { opacity: 1; }
.slide-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(255,255,255,.85); color: var(--ink); font-size: 1.4rem; line-height: 1; cursor: pointer; opacity: .75; }
.slide-arrow:hover, .slide-arrow:focus-visible { opacity: 1; }
.slide-arrow.prev { left: 8px; } .slide-arrow.next { right: 8px; }
@media (hover: hover) {
  .slide-arrow { opacity: 0; transition: opacity .2s ease; }
  .slides:hover .slide-arrow { opacity: .75; }
  .slides:hover .slide-arrow:hover, .slide-arrow:focus-visible { opacity: 1; }
}
.slides[data-slides] { touch-action: pan-y pinch-zoom; }
.slide-dots { display: none; position: absolute; left: 0; right: 0; bottom: 8px; z-index: 2; justify-content: center; gap: 5px; pointer-events: none; }
.slide-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.55); box-shadow: 0 0 0 1px rgba(0,0,0,.28); transition: background .3s ease; }
.slide-dots i.on { background: var(--ink); box-shadow: 0 0 0 1px rgba(255,255,255,.85); }
@media (hover: none) {
  .slide-arrow { display: none; }
  .slide-dots { display: flex; }
}

/* ---------- Page d'une œuvre ---------- */
.work { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: calc(var(--gap) * 1.5); }
.work-photos { display: flex; flex-direction: column; gap: calc(var(--gap) * 1.2); }
.work-photos figure { margin: 0; }
.work-photos img { background: var(--soft); width: 100%; }
.work-photos figcaption { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.video { position: relative; aspect-ratio: 16 / 9; background: #000; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.work-info { position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 48px); overflow-y: auto; padding-right: 4px; }
.work-info h1 { font-style: italic; font-size: 1rem; line-height: 1.35; letter-spacing: 0; margin-bottom: .6em; }
.facts { list-style: none; padding: 0; margin: 0 0 1.4em; color: var(--muted); }
.work-text { line-height: 1.6; }
.work-text p, .work-exhibitions p { margin: 0 0 .9em; }
.work-exhibitions { margin-top: 1.8em; font-size: .92rem; }
.work-exhibitions h2, .text-page h2 { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; border-top: 1px solid var(--ink); padding-top: 8px; margin: 0 0 1em; }
.credits { color: var(--muted); font-size: .85rem; margin-top: 1.8em; }
.pager { display: flex; justify-content: space-between; gap: 1em; margin-top: 4em; padding-top: 14px; border-top: 1px solid var(--line); font-size: .92rem; }
.pager a { text-decoration: none; color: var(--muted); }
.pager a:hover { color: var(--ink); text-decoration: underline; }
.pager > :last-child { text-align: right; }
@media (max-width: 800px) {
  .work { grid-template-columns: 1fr; }
  .work-info { position: static; max-height: none; overflow: visible; order: -1; }
  .pager { flex-wrap: wrap; }
}

/* ---------- Pages de texte (à propos, MAT) ---------- */
.prose { max-width: 42em; }
.text-page { line-height: 1.6; }
.text-page h2 { margin-top: 3em; }
.text-page h3 { font-size: 1.1rem; font-weight: 400; font-style: italic; margin: 2em 0 .4em; }
.text-page ul { padding-left: 1.1em; }
.text-page li { margin: 0.35em 0; }
.text-page li::marker { color: var(--muted); }
.text-page figure { margin: 2em 0; }
.text-page figcaption { color: var(--muted); font-size: .85rem; margin-top: 6px; }
.text-page img { background: var(--soft); }
.text-page p img { display: inline-block; vertical-align: top; max-width: min(100%, 320px); margin: 0 8px 8px 0; }
body:not(.admin) main h1.page-title { font-size: clamp(2rem, 5vw, 3rem); line-height: 1.05; margin: 1em 0 0.8em; }

/* ---------- Formulaires (administration) ---------- */
select, input, textarea, button { font: inherit; color: inherit; }
input { line-height: normal !important; }
select, input:not([type=checkbox]):not([type=radio]), textarea { border: 1px solid var(--line); border-radius: 2px; padding: 8px 10px; background: #fff; max-width: 100%; }
button, .btn { border: 1px solid var(--ink); background: var(--ink); color: #fff; padding: 8px 16px; border-radius: 2px; cursor: pointer; text-decoration: none; display: inline-block; }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); }
button.link { background: none; border: none; color: inherit; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
button:disabled { opacity: .45; cursor: not-allowed; }
.check { display: inline-flex; gap: 6px; align-items: center; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 1em; font-size: .85rem; }
.filters select, .filters input:not([type=checkbox]):not([type=radio]) { padding: 4px 8px; line-height: 1.4; }
.filters button, .filters .btn { padding: 4px 12px; line-height: 1.4; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack label { display: flex; flex-direction: column; gap: 4px; }
.stack label.check { flex-direction: row; }
.stack input:not([type=checkbox]):not([type=radio]), .stack textarea, .stack select { width: 100%; }
.form fieldset { border: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 14px; margin: 0 0 16px; min-width: 0; }
.form legend { padding: 0 6px; color: var(--muted); font-size: .9rem; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cols > label { min-width: 0; }
@media (max-width: 600px) { .cols { grid-template-columns: 1fr; } }
.error { background: #fbe9e7; padding: 8px 12px; }
.flash { background: #e9f5ea; padding: 8px 12px; }
.warn { color: #a33; }
.rows { list-style: none; padding: 0; margin: 0; }
.rows li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.thumb { width: 56px; height: 56px; flex: none; background: var(--soft); padding: 0; border: 0; }
.thumb img, .thumb span { width: 56px; height: 56px; object-fit: cover; display: block; }
.grow { flex: 1; min-width: 0; }
.actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin: 1.2em 0; }
.actions.tight { gap: 8px; margin: -.4em 0 0; }
.actions form { margin: 0; }
.uploading { opacity: .5; pointer-events: none; }
code { background: var(--soft); padding: 0 4px; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: .88rem; line-height: 1.5; }

/* ---------- Grille en mosaïque : chaque image entière, rangées justifiées à la largeur ----------
   Chaque carte grandit en proportion de son image (--r = largeur / hauteur) : toutes les images d'une rangée
   ont la même hauteur, la rangée remplit la largeur. La dernière rangée garde la hauteur de base (::after). */
.grid.mosaique { display: flex; flex-wrap: wrap; align-items: flex-start; gap: calc(var(--gap) * 1.1) var(--gap); --row: clamp(140px, 20vw, 290px); }
.grid.mosaique::after { content: ""; flex: 1000 1 0; }
.grid.mosaique .card { flex: var(--r) 1 calc(var(--r) * var(--row)); min-width: 0; max-width: 100%; }
.grid.mosaique .card-img { aspect-ratio: var(--r); background: none; }
.grid.mosaique .card-img img { object-fit: contain; }
.grid.mosaique .card:hover .card-img img { transform: none; }
.grid.mosaique .card:hover .card-title { text-decoration: underline; text-underline-offset: 3px; }
.card-more { color: var(--muted); font-size: 0.8rem; margin-top: 1px; }
@media (max-width: 520px) { .grid.mosaique { --row: 120px; gap: 22px 12px; } }

/* ---------- Publications : une rubrique par titre, puis sa grille ---------- */
.pub-section + .pub-section { margin-top: calc(var(--gap) * 2.4); }
.section-title { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; border-top: 1px solid var(--ink); padding-top: 8px; margin: 0 0 1.2em; font-weight: 400; }

/* Vignettes des publications : petites, étroites (186 × 296 comme sur l'ancien site), recadrées serré ;
   le titre n'apparaît qu'au survol (sur écran tactile, il reste visible, en petit). */
.grid.vignettes { grid-template-columns: repeat(auto-fill, minmax(120px, 186px)); gap: 22px 28px; max-width: calc(4 * 186px + 3 * 28px); }
.grid.vignettes .card { position: relative; }
.grid.vignettes .card-img { aspect-ratio: 186 / 296; position: relative; }
.grid.vignettes .card-img img { filter: grayscale(.15); transition: filter .4s ease, transform .4s ease; }
.grid.vignettes .card:hover .card-img img { filter: none; transform: none; }
.grid.vignettes .card-txt { padding-top: 6px; font-size: .78rem; }
.grid.vignettes .card-title { font-size: .78rem; }
@media (hover: hover) {
  .grid.vignettes .card-txt { opacity: 0; transition: opacity .25s ease; }
  .grid.vignettes .card:hover .card-txt, .grid.vignettes .card:focus-visible .card-txt { opacity: 1; }
}
@media (max-width: 520px) { .grid.vignettes { grid-template-columns: repeat(3, 1fr); gap: 16px 10px; } }
