/* Présentation commune des pages galerie, dérivée de la homepage. */
.gallery-home-page .mobile-theme-toggle {
  display: none;
}

html.gallery-document:has(> body.gallery-home-page) {
  min-height: 100%;
  background: #fff !important;
}

body.gallery-home-page {
  --bg: #fff;
  --ink: #111;
  min-height: 100vh;
  min-height: 100svh;
  background: #fff !important;
  color: #111;
}

.gallery-home-page > .top {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  width: fit-content;
  padding: var(--pad-home);
  pointer-events: none;
}

.gallery-home-page > .top::before {
  content: none;
  display: none;
}

.gallery-home-page .home-identity {
  position: relative;
  z-index: 21;
  margin-top: 50px;
  pointer-events: none;
}

.gallery-home-page .home-logo { pointer-events: auto; }

.gallery-home-page .home-page-back {
  display: block;
  width: max-content;
  color: inherit;
  font: inherit;
  line-height: inherit;
  text-decoration: none;
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}

.gallery-home-page .home-nav {
  position: relative;
  z-index: 21;
  pointer-events: none;
}

.gallery-home-page .home-nav a {
  position: relative;
  pointer-events: auto;
}

.gallery-home-page .home-japanese {
  margin-top: var(--home-caption-gap);
  transform: translateY(9px);
}

.gallery-home-page .home-nav {
  margin-top: calc(clamp(3.4rem, 8vh, 6rem) + 40px);
}

.gallery-home-page > main {
  flex: 0 0 auto;
  width: 100%;
  margin-top: 0;
  padding: 0 0 calc(5rem + 5rem);
}

.gallery-home-column {
  --welcome-shift: min(350px, max(0px, calc(100vw - var(--pad-home) - var(--pad-home) - var(--pad-home) - 1.4em - 17em)));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 15px;
  width: min(100%, clamp(73px, 10.3vw, 113px));
  margin: 0 calc(var(--gallery-right-gap, 1.2rem) + var(--welcome-shift)) 0 auto;
  padding: 0;
  font-size: clamp(.75rem, .95vw, .875rem);
  position: relative;
  left: -40px;
}

.gallery-home-page .item,
.gallery-home-page .fragment-tile {
  position: relative;
  z-index: 3;
  width: 100%;
  aspect-ratio: 1;
  background: #fff;
  pointer-events: auto;
}

.gallery-home-page .illustration-thumb {
  position: relative;
  z-index: 3;
  width: 100%;
  aspect-ratio: 1;
  background: #fff;
  pointer-events: auto;
}

.gallery-home-page .item img,
.gallery-home-page .fragment-tile img,
.gallery-home-page .fragment-tile video {
  object-fit: cover;
  filter: grayscale(1);
  opacity: 1;
  transition: filter .24s ease;
}

.gallery-home-page .item img.has-thumb-zoom {
  position: absolute;
  top: var(--thumb-zoom-top, 0);
  left: var(--thumb-zoom-left, 0);
  width: var(--thumb-zoom-size, 100%);
  height: var(--thumb-zoom-size, 100%);
  max-width: none;
}

.gallery-home-page .illustration-thumb img {
  object-fit: cover;
  filter: grayscale(1);
  opacity: 1;
  transition: filter .24s ease;
}

.gallery-home-page .item img:not(.loaded) { opacity: .8 !important; }

.gallery-home-page .item:hover img,
.gallery-home-page .item:focus-visible img,
.gallery-home-page .fragment-tile:hover img,
.gallery-home-page .fragment-tile:focus-visible img,
.gallery-home-page .fragment-tile:hover video,
.gallery-home-page .fragment-tile:focus-visible video {
  filter: grayscale(0);
  opacity: 1;
}

.gallery-home-page .illustration-thumb:hover img,
.gallery-home-page .illustration-thumb:focus-visible img {
  filter: grayscale(0);
}

.gallery-home-page .item::after,
.gallery-home-page .fragment-tile::after,
.gallery-home-page .illustration-thumb::after,
.gallery-home-page.page-partie2::before { display: none; }

.gallery-home-page .item:focus-visible,
.gallery-home-page .fragment-tile:focus-visible {
  outline: 1px solid #111;
  outline-offset: 5px;
}

.gallery-home-page .illustration-thumb:focus-visible {
  outline: 1px solid #111;
  outline-offset: 5px;
}

.gallery-home-page > .home-footer {
  position: fixed;
  z-index: 10;
  right: var(--pad-home);
  bottom: var(--pad-home);
  left: var(--pad-home);
  width: auto;
  margin: 0;
  padding: 0;
  color: #111;
  pointer-events: none;
}

/* Le mode noir change les couleurs, sans modifier la géométrie de la galerie. */
.gallery-home-page.home-dark > .home-footer {
  position: fixed;
  z-index: 10;
  right: var(--pad-home);
  bottom: var(--pad-home);
  left: var(--pad-home);
  width: auto;
  margin: 0;
}

.gallery-home-page.home-dark > .top { z-index: 20; }

.gallery-home-page .home-contact { pointer-events: auto; }

.gallery-home-page .home-place,
.gallery-home-page .home-description,
.gallery-home-page .home-contact,
.gallery-home-page .home-copyright { color: #111; }

.gallery-home-page .home-place {
  position: fixed;
  left: calc(var(--pad-home) + var(--pad-home) + .75rem + 3px);
  bottom: calc(var(--pad-home) + var(--pad-home) + 2rem);
}

.gallery-home-page .home-nav a[aria-current="page"] {
  font-weight: 400;
  text-decoration: line-through;
  text-decoration-color: currentColor;
  text-decoration-thickness: 1px;
}

@media (max-width: 600px) {
  .gallery-home-page .home-nav { margin-top: calc(3.2rem + 40px); }
  .gallery-home-page > main { padding-top: 0; }
  .gallery-home-column {
    --welcome-shift: min(350px, max(0px, calc(100vw - var(--pad-home) - var(--pad-home) - var(--pad-home) - 1.4em - 17em)));
    width: min(100%, clamp(73px, 10.3vw, 113px));
    margin-right: calc(var(--gallery-right-gap, 1.2rem) + var(--welcome-shift));
    font-size: .7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-home-page .item img,
  .gallery-home-page .fragment-tile img,
  .gallery-home-page .fragment-tile video { transition: none; }
  .gallery-home-page .illustration-thumb img { transition: none; }
}



.gallery-home-page.home-dark,
html.gallery-document:has(> body.gallery-home-page.home-dark) {
  background: #000 !important;
}

body.gallery-home-page.home-dark {
  color: #00ff00 !important;
}

/* Le sous-titre du mode noir reste légèrement plus bas que celui du mode blanc. */
body.gallery-home-page.home-dark .home-japanese {
  transform: translateY(12px);
}

.gallery-home-page.home-dark > .top *,
.gallery-home-page.home-dark > main *,
.gallery-home-page.home-dark > .home-footer * {
  color: #00ff00 !important;
}


.gallery-home-page.home-dark dialog .nav,
.gallery-home-page.home-dark dialog .close {
  color: #00ff00;
}

.gallery-home-page.home-dark dialog .viewer-thumb:focus-visible {
  outline-color: #00ff00;
}

@media (max-width: 768px) {
  body.gallery-home-page {
    gap: 1rem;
  }

  .gallery-home-page > .top {
    position: sticky;
    z-index: 20;
    top: var(--mobile-top-edge);
    left: auto;
    width: 100%;
    padding: 0;
    background: transparent !important;
    pointer-events: auto;
  }

  .gallery-home-page .home-identity {
    margin-top: 0;
  }

  .gallery-home-page .home-identity::before {
    display: none;
  }

  .gallery-home-page .music-control {
    top: calc(var(--mobile-top-edge) - 12px);
  }

  .gallery-home-page .mobile-theme-toggle {
    position: fixed;
    z-index: 32;
    top: var(--mobile-top-edge);
    left: var(--pad-home);
    display: block;
    width: 24px;
    height: 24px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: #111;
    cursor: pointer;
    touch-action: manipulation;
  }

  .gallery-home-page.home-dark .mobile-theme-toggle {
    background: #00ff00;
  }

  .gallery-home-page .mobile-theme-toggle:focus-visible {
    outline: 1px solid currentColor;
    outline-offset: 3px;
  }

  .gallery-home-page .home-nav {
    display: none !important;
  }

  .gallery-home-page > main {
    display: block !important;
    flex: 1 0 auto;
    width: 100%;
    margin: 0 !important;
    padding: 1rem 0 calc(10rem + env(safe-area-inset-bottom));
  }

  .gallery-home-page > .top {
    flex: 0 0 auto;
  }

  .gallery-home-page .gallery-home-column {
    position: relative;
    left: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(12px, 3vw, 20px);
    width: min(100%, 600px);
    margin: 0 auto;
    padding: 0;
  }

  .gallery-home-page .fragment-field,
  .gallery-home-page .illustration-track {
    width: min(100%, 600px);
    margin: 0 auto;
    padding: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: clamp(12px, 3vw, 20px);
  }

  .gallery-home-page > .home-footer {
    position: fixed;
    z-index: 10;
    right: var(--pad-home);
    bottom: max(12px, env(safe-area-inset-bottom));
    left: var(--pad-home);
    width: auto;
    margin: 0;
    padding: 0;
  }

  .gallery-home-page .home-nav {
    position: static;
    z-index: 22;
    top: auto;
    left: auto;
    width: 100%;
    margin: 1.5rem 0 0 !important;
    transform: none;
    pointer-events: auto;
  }

  .gallery-home-page .home-identity {
    pointer-events: auto;
  }

  .gallery-home-page .home-nav a {
    position: relative;
    z-index: 23;
    pointer-events: auto;
    touch-action: manipulation;
  }
}
/* Pages galerie : style.css applique « .top p » (grand, blanc, gras) à WELCOME.
   On rétablit ici le style de la homepage. */
.gallery-home-page .top p.home-welcome {
  align-self: auto;
  margin: 0;
  padding: 0;
  font-size: clamp(.75rem, .95vw, .875rem);
  font-weight: 400;
  line-height: 1.2;
  text-align: right;
  color: #111;
  text-box: normal;
  transition: none;
}
/* Changement de mode sur les galeries : le calque noir passe sous l'en-tête et le pied de page
   pendant l'effet, puis disparaît une fois le mode noir installé (le fond de la page est déjà noir). */
.gallery-home-page .home-blackout { z-index: 19; }
.gallery-home-page.home-dark .home-blackout { visibility: hidden !important; }
.gallery-home-page.home-transitioning > .top,
.gallery-home-page.home-transitioning > .home-footer { z-index: 21; }
/* Mode noir : vignettes assombries (au lieu du noir et blanc), couleur d'origine au survol */
body.gallery-home-page.home-dark .item img,
body.gallery-home-page.home-dark .fragment-tile img,
body.gallery-home-page.home-dark .fragment-tile video,
body.gallery-home-page.home-dark .illustration-thumb img {
  filter: brightness(.3);
}

body.gallery-home-page.home-dark .item:hover img,
body.gallery-home-page.home-dark .item:focus-visible img,
body.gallery-home-page.home-dark .fragment-tile:hover img,
body.gallery-home-page.home-dark .fragment-tile:focus-visible img,
body.gallery-home-page.home-dark .fragment-tile:hover video,
body.gallery-home-page.home-dark .fragment-tile:focus-visible video,
body.gallery-home-page.home-dark .illustration-thumb:hover img,
body.gallery-home-page.home-dark .illustration-thumb:focus-visible img {
  filter: none;
}
/* Vignettes : plus de fond blanc sous les images (il transparaissait au chargement) */
.gallery-home-page .item,
.gallery-home-page .fragment-tile,
.gallery-home-page .illustration-thumb {
  background: transparent;
}

.gallery-home-page .item::after,
.gallery-home-page .fragment-tile::after,
.gallery-home-page .illustration-thumb::after {
  display: none !important;
}
/* Colonnes de vignettes : décalées de 19px vers la droite (desktop), en blanc et en noir */
@media (min-width: 769px) {
  .gallery-home-page .gallery-home-column {
    left: -21px;
  }
}