/* Galeries photo : mêmes jetons que la one page (index.html), grille justifiée sans recadrage, visionneuse plein écran. */
:root {
  --bg: #f5f7f8; --fg: #111417; --muted: #5a6670; --line: #d6dce1; --accent: #1b98d6; --chip: #e8edf0;
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0c0e10; --fg: #eef1f3; --muted: #98a3ac; --line: #242a2f; --accent: #3db3ee; --chip: #171b1f; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0c0e10; --fg: #eef1f3; --muted: #98a3ac; --line: #242a2f; --accent: #3db3ee; --chip: #171b1f; color-scheme: dark; }

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 1.125rem; line-height: 1.6; -webkit-font-smoothing: antialiased; }
img { max-width: 100%; }
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
.wrap { max-width: 80rem; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-block: 1.25rem; font-family: var(--mono); font-size: .8rem; letter-spacing: .04em; color: var(--muted); }
.brand { display: flex; align-items: center; gap: .7rem; text-decoration: none; color: var(--fg); }
.brand img { width: 2.25rem; height: 2.25rem; border-radius: .45rem; display: block; }
.back { text-decoration: none; }
.back:hover { color: var(--accent); }

.head { padding-block: clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 3vw, 2.5rem); max-width: 52rem; }
.eyebrow { font-family: var(--mono); font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin: 0 0 1.1rem; }
h1 { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 8vw, 5.5rem); line-height: .95; letter-spacing: -.035em; margin: 0 0 1.1rem; text-wrap: balance; }
.sub { font-size: clamp(1.1rem, 2vw, 1.3rem); font-style: italic; color: var(--muted); margin: 0; max-width: 46ch; }

/* Grille justifiée : chaque vignette grandit selon son format (--r = largeur / hauteur) */
.grid { display: flex; flex-wrap: wrap; gap: .5rem; padding-bottom: clamp(2.5rem, 6vw, 4rem); }
.grid::after { content: ""; flex: 999 1 0; }
.g-item { flex: var(--r) 1 calc(var(--r) * 15rem); display: block; border-radius: .2rem; overflow: hidden; background: var(--chip); }
.g-item img { display: block; width: 100%; height: auto; aspect-ratio: var(--r); object-fit: cover; transition: transform .35s ease, opacity .2s ease; }
.g-item:hover img, .g-item:focus-visible img { transform: scale(1.03); }
@media (max-width: 760px) { .g-item { flex-basis: calc(var(--r) * 9rem); } .grid { gap: .35rem; } }

section { border-top: 1px solid var(--line); }
.next { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding-block: 2rem; }
.textlink { font-family: var(--mono); font-size: .85rem; letter-spacing: .02em; text-decoration: none; border-bottom: 1px solid var(--accent); padding-bottom: 1px; }
.textlink:hover { color: var(--accent); }

footer { border-top: 1px solid var(--line); }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .75rem 2rem; padding-block: 1.75rem 2.5rem; font-family: var(--mono); font-size: .78rem; color: var(--muted); }
.foot p { margin: 0; }
.foot a { color: inherit; text-underline-offset: 3px; }
.foot a:hover { color: var(--accent); }

/* Visionneuse : toujours sombre, quel que soit le thème */
.lb {
  --lb-fg: #eef1f3; --lb-muted: #98a3ac; --lb-line: #2a3036; --lb-accent: #3db3ee;
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: #07080a; color: var(--lb-fg);
  display: none; flex-direction: column;
}
.lb[open] { display: flex; }
.lb::backdrop { background: #07080a; }
/* L'image est contenue dans la zone au-dessus de la légende : elle ne peut jamais la recouvrir */
.lb-stage { --px: clamp(.75rem, 6vw, 5rem); --pt: clamp(.75rem, 3vw, 2rem); --pb: .75rem; position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.lb-img {
  position: absolute; top: var(--pt); left: var(--px);
  width: calc(100% - 2 * var(--px)); height: calc(100% - var(--pt) - var(--pb));
  max-width: none; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none;
}
.lb-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 3rem; height: 3rem; border-radius: 50%; border: 1px solid var(--lb-line);
  background: rgba(7, 8, 10, .55); color: var(--lb-fg); font-family: var(--mono); font-size: 1.6rem; line-height: 1; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.lb-btn:hover { border-color: var(--lb-accent); color: var(--lb-accent); }
.lb-prev { left: clamp(.5rem, 1.5vw, 1.25rem); }
.lb-next { right: clamp(.5rem, 1.5vw, 1.25rem); }
.lb-bar {
  flex: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  padding: .75rem max(16px, 2rem) max(1rem, env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--lb-line); background: #07080a; position: relative; z-index: 1;
}
.lb-cap { min-width: 0; }
.lb-title { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.2rem; letter-spacing: -.01em; line-height: 1.25; }
.lb-meta { margin: .15rem 0 0; font-family: var(--mono); font-size: .75rem; color: var(--lb-muted); }
.lb-tools { display: flex; align-items: center; gap: .5rem; flex: none; }
.lb-count { font-family: var(--mono); font-size: .75rem; color: var(--lb-muted); margin-right: .35rem; font-variant-numeric: tabular-nums; }
.lb-tool {
  min-width: 2.4rem; height: 2.4rem; padding: 0 .6rem; border-radius: 999px; border: 1px solid var(--lb-line);
  background: transparent; color: var(--lb-fg); font-family: var(--mono); font-size: .85rem; cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.lb-tool:hover, .lb-tool[aria-expanded="true"] { border-color: var(--lb-accent); color: var(--lb-accent); }
#lb-close { font-size: 1.25rem; }
.lb-exif {
  position: absolute; right: max(16px, 2rem); bottom: 4.75rem; width: min(26rem, calc(100% - 32px)); max-height: calc(100% - 7rem); overflow: auto;
  margin: 0; padding: 1rem 1.15rem; border: 1px solid var(--lb-line); border-radius: .4rem;
  background: rgba(14, 16, 19, .94); color: var(--lb-fg);
  font-family: var(--mono); font-size: .78rem; line-height: 1.65; white-space: pre-wrap;
}
.lb-exif[hidden] { display: none; }
.lb-exif .k { color: var(--lb-accent); }
.lb-exif .s { color: #c9d3da; }
.lb-exif .p { color: var(--lb-muted); }
@media (max-width: 760px) {
  .lb-btn { width: 2.5rem; height: 2.5rem; font-size: 1.3rem; top: auto; bottom: .5rem; transform: none; }
  .lb-stage { --px: 0px; --pt: .5rem; --pb: 3.75rem; }
  .lb-bar { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
