/* Galerie publique. */
:root {
  --gallery-ink: #080807;
  --gallery-ink-soft: #11110f;
  --gallery-panel: rgba(21, 20, 17, .82);
  --gallery-ivory: #f4eddf;
  --gallery-muted: #b9ad9a;
  --gallery-copper: #bf7a3d;
  --gallery-copper-light: #e2ae72;
  --gallery-line: rgba(226, 174, 114, .22);
  --gallery-shadow: 0 26px 70px rgba(0, 0, 0, .48);
  --wm-thumb-opacity: .35;
  --wm-lightbox-opacity: .72;
}

body.gallery-page {
  display: flex;
  min-height: 100vh;
  padding-top: 104px;
  overflow-x: hidden;
  flex-direction: column;
  color: var(--gallery-ivory);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(18px, calc(16px + .12vw), 20px);
  background-color: var(--gallery-ink);
  background-image:
    radial-gradient(circle at 12% 4%, rgba(191, 122, 61, .12), transparent 28rem),
    radial-gradient(circle at 90% 38%, rgba(244, 237, 223, .055), transparent 34rem),
    linear-gradient(180deg, #080807 0%, #10100e 44%, #070706 100%);
}

@media (max-width: 1100px) {
  body.gallery-page { padding-top: 82px; }
}

body.gallery-page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .22;
  background-image:
    repeating-linear-gradient(115deg, transparent 0, transparent 17px, rgba(255, 255, 255, .012) 18px),
    repeating-linear-gradient(25deg, transparent 0, transparent 23px, rgba(191, 122, 61, .012) 24px);
}

body.gallery-page.is-lightbox-open {
  overflow: hidden;
}

.gallery-main {
  position: relative;
  isolation: isolate;
  flex: 1 0 auto;
  width: 100%;
  max-width: 1720px;
  margin: 0 auto;
  padding: clamp(18px, 2.5vw, 42px) clamp(14px, 3.4vw, 58px) clamp(72px, 8vw, 126px);
}

.gallery-main::before {
  content: "";
  position: absolute;
  top: 1.25rem;
  left: 50%;
  z-index: -1;
  width: min(78vw, 1060px);
  height: 420px;
  border: 1px solid rgba(226, 174, 114, .08);
  border-radius: 50%;
  opacity: .65;
  transform: translateX(-50%);
  filter: blur(.2px);
  pointer-events: none;
}

.gallery-hero {
  position: relative;
  display: grid;
  isolation: isolate;
  place-items: center;
  min-height: clamp(210px, 26vw, 390px);
  padding: clamp(42px, 6vw, 90px) 18px;
  overflow: hidden;
  text-align: center;
}

.gallery-hero__mark {
  position: absolute;
  top: 54%;
  left: 50%;
  z-index: 0;
  margin: 0;
  color: rgba(226, 195, 126, .035);
  font: 600 clamp(7rem, 20vw, 20rem)/.8 Cinzel, Georgia, serif;
  letter-spacing: .045em;
  -webkit-text-stroke: 1px rgba(226, 195, 126, .17);
  transform: translate(-50%, -50%);
  white-space: nowrap;
  pointer-events: none;
}

.gallery-hero__eyebrow,
.gallery-hero__intro,
.gallery-hero h1 {
  position: relative;
  z-index: 1;
}

.gallery-hero::after {
  content: "";
  position: absolute;
  bottom: 24px;
  left: 50%;
  width: min(230px, 44vw);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gallery-copper-light), transparent);
  transform: translateX(-50%);
  box-shadow: 0 0 18px rgba(226, 174, 114, .3);
}

.gallery-hero__eyebrow,
.gallery-hero__intro,
.gallery-hero h1 {
  margin: 0;
}

.gallery-hero__eyebrow {
  align-self: end;
  color: var(--gallery-copper-light);
  font: 600 clamp(.7rem, .9vw, .82rem)/1.2 Cinzel, Georgia, serif;
  letter-spacing: .34em;
  text-transform: uppercase;
}

.gallery-hero h1 {
  color: var(--gallery-ivory);
  font: 500 clamp(3.15rem, 7.5vw, 7.4rem)/.95 Cinzel, Georgia, serif;
  letter-spacing: .055em;
  text-shadow: 0 12px 38px rgba(0, 0, 0, .7);
  text-transform: uppercase;
}

.gallery-hero__intro {
  align-self: start;
  color: var(--gallery-muted);
  font: italic 400 clamp(1rem, 1.5vw, 1.3rem)/1.5 "Playfair Display", Georgia, serif;
  letter-spacing: .035em;
}

.gallery-collection {
  margin-top: clamp(42px, 6vw, 84px);
}

.gallery-collection__heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 0 clamp(20px, 3vw, 34px);
  padding-bottom: 17px;
  border-bottom: 1px solid var(--gallery-line);
}

.gallery-collection__heading h2,
.gallery-collection__heading p {
  margin: 0;
}

.gallery-collection__heading h2 {
  color: var(--gallery-ivory);
  font: 500 clamp(1.4rem, 2.2vw, 2rem)/1.2 Cinzel, Georgia, serif;
  letter-spacing: .04em;
}

.gallery-collection__heading p {
  flex: 0 0 auto;
  color: var(--gallery-copper-light);
  font: 500 .73rem/1.2 Cinzel, Georgia, serif;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.grid {
  position: relative;
  column-count: 4;
  column-gap: clamp(12px, 1.2vw, 20px);
  width: 100%;
  margin: 0 auto;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.grid-item {
  position: relative;
  display: block;
  width: 100%;
  min-height: 100px;
  margin: 0 0 clamp(12px, 1.2vw, 20px);
  overflow: hidden;
  break-inside: avoid;
  border: 1px solid rgba(226, 174, 114, .13);
  border-radius: clamp(12px, .75vw, 18px);
  color: var(--gallery-ivory);
  background: linear-gradient(110deg, #11110f 8%, #27231e 18%, #11110f 33%);
  background-size: 220% 100%;
  box-shadow: 0 13px 34px rgba(0, 0, 0, .26);
  text-decoration: none;
  animation: gallery-skeleton 1.35s linear infinite;
  transform: translateZ(0);
  transition: border-color .35s ease, box-shadow .35s ease, transform .35s ease;
}

/* Le script répartit les formats naturels en colonnes équilibrées puis
   prolonge uniquement la dernière carte de chaque colonne pour une base pleine. */
.grid.is-balanced {
  display: block;
  column-count: initial;
}

.grid.is-balanced .grid-item {
  position: absolute;
  top: var(--gallery-y, 0);
  left: var(--gallery-x, 0);
  width: var(--gallery-width, 100%);
  height: var(--gallery-height, auto);
  margin: 0;
  aspect-ratio: auto !important;
}

.grid.is-balanced .grid-item img {
  height: 100%;
  object-fit: cover;
}

.grid-item::before {
  content: "© Tatouage-Mika.fr";
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  color: #fff;
  font: 600 clamp(.58rem, .72vw, .77rem)/1 Cinzel, Georgia, serif;
  letter-spacing: .14em;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 0, 0, .92);
  pointer-events: none;
  transition: opacity .42s ease;
}

.grid-item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: .72;
  background: linear-gradient(180deg, transparent 45%, rgba(5, 5, 4, .7) 100%);
  pointer-events: none;
  transition: opacity .35s ease;
}

.grid-item.is-loaded {
  background: var(--gallery-ink-soft);
  animation: none;
}

.grid-item.is-loaded::before {
  opacity: var(--wm-thumb-opacity);
}

.grid-item img {
  position: relative;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: inherit;
  object-fit: cover;
  box-shadow: none;
  -webkit-user-drag: none;
  transition: opacity .4s ease, filter .48s ease, transform .65s cubic-bezier(.2, .7, .2, 1);
}

.grid-item img.lazy {
  content-visibility: auto;
  contain-intrinsic-size: 400px 520px;
  opacity: 0;
  filter: blur(9px) saturate(.7);
  background: #11110f;
}

.grid-item img.lazy.loaded {
  opacity: 1;
  filter: none;
}

.grid-item__action {
  position: absolute;
  right: 14px;
  bottom: 13px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  color: var(--gallery-ivory);
  font: 500 .69rem/1 Cinzel, Georgia, serif;
  letter-spacing: .1em;
  text-transform: uppercase;
  transform: translateY(7px);
  transition: opacity .3s ease, transform .3s ease;
}

.grid-item__action > span {
  display: grid;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(226, 174, 114, .55);
  border-radius: 50%;
  place-items: center;
  color: var(--gallery-copper-light);
  font-size: .8rem;
}

.grid-item:focus-visible {
  z-index: 4;
  outline: 2px solid var(--gallery-copper-light);
  outline-offset: 4px;
}

.gallery-empty {
  max-width: 680px;
  margin: clamp(44px, 7vw, 90px) auto 0;
  padding: 32px;
  border: 1px solid var(--gallery-line);
  border-radius: 8px;
  color: var(--gallery-muted);
  background: var(--gallery-panel);
  font: italic 400 1.08rem/1.6 "Playfair Display", Georgia, serif;
  text-align: center;
  box-shadow: var(--gallery-shadow);
}

@media (hover: hover) and (pointer: fine) {
  .grid-item:hover {
    border-color: rgba(226, 174, 114, .5);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .55), 0 0 0 1px rgba(226, 174, 114, .08);
    transform: translateY(-4px);
  }

  .grid-item:hover img {
    transform: scale(1.035);
  }

  .grid-item:hover::after {
    opacity: 1;
  }

  .grid-item:hover .grid-item__action {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes gallery-skeleton {
  to { background-position-x: -220%; }
}

/* Lightbox */
.lightbox[hidden] {
  display: none !important;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  padding: clamp(10px, 2vw, 28px);
  place-items: center;
  opacity: 0;
  visibility: hidden;
  color: var(--gallery-ivory);
  background: rgba(3, 3, 3, .93);
  backdrop-filter: blur(16px) saturate(.7);
  -webkit-backdrop-filter: blur(16px) saturate(.7);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  transition: opacity .22s ease, visibility .22s ease;
}

.lightbox.active {
  opacity: 1;
  visibility: visible;
}

.lightbox__dialog {
  position: relative;
  display: grid;
  grid-template-columns: clamp(44px, 5vw, 72px) minmax(0, 1fr) clamp(44px, 5vw, 72px);
  grid-template-rows: auto minmax(0, 1fr);
  width: min(96vw, 1540px);
  height: min(94dvh, 1020px);
  overflow: hidden;
  border: 1px solid var(--gallery-line);
  border-radius: clamp(7px, 1vw, 14px);
  background: #080807;
  box-shadow: 0 40px 120px rgba(0, 0, 0, .78);
  transform: scale(.985) translateY(8px);
  transition: transform .25s cubic-bezier(.2, .75, .2, 1);
}

.lightbox.active .lightbox__dialog {
  transform: scale(1) translateY(0);
}

.lightbox__topbar {
  z-index: 5;
  display: grid;
  grid-column: 1 / -1;
  grid-row: 1;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: 62px;
  padding: 10px 12px 10px clamp(18px, 2vw, 28px);
  border-bottom: 1px solid rgba(226, 174, 114, .15);
  background: rgba(13, 13, 11, .94);
}

.lightbox__title,
.lightbox__counter {
  margin: 0;
  font-family: Cinzel, Georgia, serif;
  text-transform: uppercase;
}

.lightbox__title {
  overflow: hidden;
  color: var(--gallery-muted);
  font-size: clamp(.6rem, .75vw, .72rem);
  letter-spacing: .2em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox__counter {
  color: var(--gallery-copper-light);
  font-size: .68rem;
  letter-spacing: .18em;
}

.lightbox button {
  appearance: none;
  display: grid;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(226, 174, 114, .32);
  border-radius: 50%;
  place-items: center;
  color: var(--gallery-ivory);
  background: rgba(22, 21, 18, .86);
  font-family: Arial, sans-serif;
  line-height: 1;
  cursor: pointer;
  transition: color .2s ease, border-color .2s ease, background .2s ease, transform .2s ease;
}

.lightbox button:hover {
  border-color: var(--gallery-copper-light);
  color: #090908;
  background: var(--gallery-copper-light);
}

.lightbox button:focus-visible {
  outline: 2px solid var(--gallery-copper-light);
  outline-offset: 3px;
}

.lightbox__close {
  justify-self: end;
  width: 40px;
  height: 40px;
  font-size: 1.7rem;
}

.lightbox__nav {
  z-index: 4;
  align-self: center;
  width: clamp(38px, 3.5vw, 50px);
  height: clamp(38px, 3.5vw, 50px);
  font-size: 1.25rem;
}

.lightbox__nav[hidden] {
  display: none;
}

.lightbox__nav--previous {
  grid-column: 1;
  grid-row: 2;
  justify-self: center;
}

.lightbox__nav--next {
  grid-column: 3;
  grid-row: 2;
  justify-self: center;
}

.lightbox__figure {
  position: relative;
  display: grid;
  grid-column: 2;
  grid-row: 2;
  grid-template-rows: minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: clamp(12px, 2vw, 26px) 0 clamp(12px, 1.6vw, 20px);
  place-items: center;
}

.lightbox__figure::after {
  content: "© Tatouage-Mika.fr";
  position: absolute;
  top: 48%;
  left: 50%;
  z-index: 2;
  opacity: var(--wm-lightbox-opacity);
  color: #fff;
  font: 600 clamp(.72rem, 1.15vw, 1rem)/1 Cinzel, Georgia, serif;
  letter-spacing: .16em;
  text-align: center;
  text-shadow: 0 2px 8px #000;
  transform: translate(-50%, -50%);
  white-space: nowrap;
  pointer-events: none;
}

.lightbox__figure img {
  display: block;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 22px 70px rgba(0, 0, 0, .55);
  -webkit-user-drag: none;
  transition: opacity .2s ease;
}

.lightbox__dialog.is-loading .lightbox__figure img {
  opacity: .25;
}

.lightbox__dialog.is-loading .lightbox__figure::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 4;
  width: 34px;
  height: 34px;
  border: 2px solid rgba(226, 174, 114, .18);
  border-top-color: var(--gallery-copper-light);
  border-radius: 50%;
  animation: gallery-spinner .8s linear infinite;
}

.lightbox__figure figcaption {
  max-width: min(720px, 88vw);
  margin-top: 12px;
  overflow: hidden;
  color: var(--gallery-muted);
  font: italic 400 clamp(.82rem, 1.1vw, 1rem)/1.3 "Playfair Display", Georgia, serif;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@keyframes gallery-spinner {
  to { transform: rotate(360deg); }
}

#privacy-veil {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: none;
  background: #fff;
}

@media screen and (min-width: 2400px) {
  .gallery-main { max-width: 2200px; }
  .grid { column-count: 6; }
}

@media screen and (max-width: 1180px) {
  .grid { column-count: 3; }
}

@media screen and (max-width: 760px) {
  .gallery-main {
    padding-right: 12px;
    padding-left: 12px;
  }

  .gallery-main::before {
    width: 94vw;
    height: 280px;
  }

  .gallery-hero {
    min-height: 220px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .gallery-hero__eyebrow { letter-spacing: .25em; }

  .gallery-hero__intro {
    max-width: 290px;
    font-size: .95rem;
  }

  .gallery-collection {
    margin-top: 48px;
  }

  .gallery-collection__heading {
    align-items: center;
  }

  .gallery-collection__heading h2 {
    font-size: 1.2rem;
  }

  .grid {
    column-count: 2;
    column-gap: 10px;
  }

  .grid-item {
    margin-bottom: 10px;
  }

  .grid-item img.lazy {
    contain-intrinsic-size: 240px 320px;
  }

  .grid-item__action {
    display: none;
  }

  .lightbox {
    padding: 0;
  }

  .lightbox__dialog {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    width: 100vw;
    height: 100dvh;
    border: 0;
    border-radius: 0;
  }

  .lightbox__topbar {
    min-height: 58px;
    padding-left: 14px;
  }

  .lightbox__title {
    max-width: 29vw;
    letter-spacing: .12em;
  }

  .lightbox__figure {
    grid-column: 1 / -1;
    padding: 12px 10px 16px;
  }

  .lightbox__nav {
    width: 38px;
    height: 38px;
    background: rgba(8, 8, 7, .78);
    box-shadow: 0 4px 18px rgba(0, 0, 0, .45);
  }

  .lightbox__figure img {
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 112px);
  }
}

@media screen and (max-width: 390px) {
  .gallery-collection__heading p {
    font-size: .62rem;
    letter-spacing: .11em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .grid-item,
  .grid-item img,
  .grid-item__action,
  .lightbox,
  .lightbox__dialog,
  .lightbox button {
    animation: none;
    transition: none;
  }

  .grid-item img.lazy {
    filter: none;
  }
}

/* Lightbox classique : image centrée, fond noir, fermeture simple */
.lightbox--classic {
  padding: clamp(14px, 3vw, 34px);
  background:
    radial-gradient(circle at 50% 38%, rgba(169, 111, 64, .12), transparent 34rem),
    rgba(0, 0, 0, .94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.lightbox--classic .lightbox__dialog {
  position: relative;
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - clamp(28px, 6vw, 68px));
  max-height: calc(100dvh - clamp(28px, 6vw, 68px));
  overflow: hidden;
  border: 1px solid rgba(239, 195, 145, .28);
  border-radius: clamp(18px, 2vw, 30px);
  background: #080706;
  box-shadow:
    0 36px 120px rgba(0, 0, 0, .86),
    0 0 0 1px rgba(255, 255, 255, .04),
    0 0 80px rgba(169, 111, 64, .13);
  transform: translateY(10px) scale(.965);
}

.lightbox--classic.active .lightbox__dialog {
  transform: translateY(0) scale(1);
}

.lightbox--classic .lightbox__close {
  position: absolute;
  top: clamp(12px, 1.4vw, 18px);
  right: clamp(12px, 1.4vw, 18px);
  z-index: 8;
  width: 50px;
  height: 50px;
  border-color: rgba(255, 255, 255, .42);
  border-radius: 50%;
  color: #fff;
  background: rgba(8, 7, 6, .78);
  box-shadow: 0 12px 36px rgba(0, 0, 0, .45);
  font-size: 2rem;
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.lightbox--classic .lightbox__figure {
  display: grid;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: inherit;
  place-items: center;
}

.lightbox--classic .lightbox__figure img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 70px);
  border-radius: inherit;
  box-shadow: none;
}

.lightbox--classic .lightbox__figure::after {
  opacity: .58;
}

@media screen and (max-width: 760px) {
  .lightbox--classic {
    padding: 10px;
  }

  .lightbox--classic .lightbox__dialog {
    width: calc(100vw - 20px);
    height: auto;
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .lightbox--classic .lightbox__figure {
    padding: 0;
  }

  .lightbox--classic .lightbox__figure img {
    max-width: 100%;
    max-height: calc(100dvh - 20px);
  }

  .lightbox--classic .lightbox__close {
    top: 10px;
    right: 10px;
    width: 46px;
    height: 46px;
  }
}
/* Bandeaux noir et or : les styles restent limités à l'introduction. */
html body.gallery-page .gallery-main::before { display: none; }
html body.gallery-page .gallery-intro {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  padding: 38px 26px;
  border: 1px solid #d6b75e66;
  border-radius: 24px;
  background:
    url("gallery-lines.svg") center / 100% 100% no-repeat,
    radial-gradient(ellipse at 0% 100%, #e6c76c24, transparent 47%),
    radial-gradient(ellipse at 100% 0%, #e6c76c21, transparent 47%),
    linear-gradient(110deg, #11110e, #090909 35%, #10100f 70%, #181711);
  box-shadow: inset 0 1px 0 #f1d88912, 0 12px 40px #0003;
  text-align: center;
}
html body.gallery-page .gallery-intro::before {
  content: "";
  position: absolute;
  top: 0;
  left: 12%;
  right: 12%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #e6c875b3 35%, #fff0bc 50%, #e6c875b3 65%, transparent);
  pointer-events: none;
}
html body.gallery-page .gallery-intro::after {
  content: "";
  position: absolute;
  bottom: 18px;
  left: calc(50% - 38px);
  width: 76px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #dfc273, transparent);
  pointer-events: none;
}
html body.gallery-page .gallery-intro h1 {
  position: relative;
  margin: 0;
  color: #faf5e9;
  font: 500 clamp(34px, 4.3vw, 62px)/1.2 "Playfair Display", Georgia, serif;
  letter-spacing: -.02em;
  text-transform: none;
  font-variant: normal;
  text-shadow: 0 3px 18px #0008;
}
html body.gallery-page .gallery-intro h1 em {
  color: #edce78;
  font-weight: 500;
  font-style: italic;
}
html body.gallery-page .gallery-intro p {
  max-width: 620px;
  margin: 14px auto 0;
  color: #d6d0c2;
  font: 400 clamp(15px, 1.2vw, 17px)/1.65 "Manrope", Arial, sans-serif;
  letter-spacing: 0;
}
@media (max-width: 760px) {
  html body.gallery-page .gallery-intro {
    min-height: 154px;
    padding: 30px 18px;
    border-radius: 20px;
    background-size: 100% 100%, auto, auto, auto;
  }
  html body.gallery-page .gallery-intro h1 { font-size: clamp(29px, 7.6vw, 42px); }
  html body.gallery-page .gallery-intro p { max-width: 290px; margin-top: 12px; font-size: 14px; }
}
