/* ============================================================
   Galerie « Chantier » — observatoire Nunki
   Feuille de style autonome, accordée au thème du site.
   ============================================================ */

.gal {
  --gal-gap: 14px;
}

/* ---------- Barre de progression ---------- */
.gal-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: 60;
  background: linear-gradient(90deg, var(--gold), var(--gold-bright));
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}

/* ---------- Hero ---------- */
.gal-hero {
  position: relative;
  min-height: min(92vh, 900px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: clamp(90px, 14vh, 170px) 22px clamp(70px, 10vh, 120px);
  overflow: hidden;
  isolation: isolate;
}

.gal-hero__bg {
  position: absolute;
  inset: -8% 0 -8%;
  z-index: -2;
  background: url("web/72.jpg") center 35% / cover no-repeat;
  filter: saturate(.75) brightness(.62) contrast(1.05);
  transform: translate3d(0, var(--par, 0px), 0) scale(1.06);
  will-change: transform;
}

.gal-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 80% at 50% 10%, transparent 20%, rgba(7, 9, 7, .55) 72%, var(--bg) 100%),
    linear-gradient(180deg, rgba(7, 9, 7, .55), rgba(7, 9, 7, .25) 40%, rgba(7, 9, 7, .96) 92%);
}

.gal-hero__inner {
  max-width: 900px;
}

.gal-kicker {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: 'Orbitron', ui-sans-serif, sans-serif;
  font-size: .72rem;
  letter-spacing: .34em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 26px;
}
.gal-kicker::before,
.gal-kicker::after {
  content: "";
  width: clamp(24px, 6vw, 64px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(232, 201, 124, .75));
}
.gal-kicker::after {
  background: linear-gradient(90deg, rgba(232, 201, 124, .75), transparent);
}

.gal-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.4rem, 6.4vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: -.015em;
  color: var(--ivory);
  text-wrap: balance;
  margin: 0 0 26px;
  text-shadow: 0 18px 60px rgba(0, 0, 0, .55);
}

.gal-rule {
  width: 88px;
  height: 1px;
  margin: 0 auto 28px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
}

.gal-lede {
  font-size: clamp(1.02rem, 1.6vw, 1.22rem);
  line-height: 1.85;
  color: #ded6bd;
  max-width: 660px;
  margin: 0 auto 14px;
  font-style: italic;
}

.gal-intro {
  font-size: .98rem;
  line-height: 1.8;
  color: var(--muted);
  max-width: 620px;
  margin: 0 auto 14px;
}

.gal-hero__meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 26px;
  margin-top: 34px;
  font-family: 'Orbitron', ui-sans-serif, sans-serif;
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--bronze);
}
.gal-hero__meta span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.gal-hero__meta span[hidden] { display: none; }
.gal-hero__meta span + span::before {
  content: "";
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(232, 201, 124, .55);
}

.gal-actions {
  margin-top: 38px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.gal-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid rgba(232, 201, 124, .34);
  background: rgba(10, 12, 9, .5);
  color: var(--gold-bright);
  font-family: 'Quicksand', sans-serif;
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .02em;
  cursor: pointer;
  text-decoration: none;
  transition: background .25s ease, border-color .25s ease, transform .25s ease, color .25s ease;
  backdrop-filter: blur(6px);
}
.gal-btn:hover {
  background: rgba(232, 201, 124, .12);
  border-color: var(--gold);
  transform: translateY(-1px);
  color: #fff8e2;
}
.gal-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}
.gal-btn__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px rgba(232, 201, 124, .9);
}

.gal-aipill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 28px auto 0;
  padding: 7px 15px;
  border: 1px solid rgba(232, 201, 124, .3);
  border-radius: 999px;
  background: rgba(232, 201, 124, .07);
  color: var(--gold);
  font-family: 'Orbitron', sans-serif;
  font-size: .58rem;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.gal-aipill span[aria-hidden] { font-size: .8rem; color: var(--gold-bright); }
.gal-aipill[hidden],
.gal-ainote[hidden] { display: none; }

.gal-scrollcue {
  position: absolute;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  font-family: 'Orbitron', sans-serif;
  font-size: .6rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(232, 201, 124, .55);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.gal-scrollcue::after {
  content: "";
  width: 1px;
  height: 42px;
  background: linear-gradient(180deg, rgba(232, 201, 124, .7), transparent);
  animation: gal-cue 2.4s ease-in-out infinite;
}
@keyframes gal-cue {
  0%, 100% { transform: scaleY(.55); opacity: .5; transform-origin: top; }
  50% { transform: scaleY(1); opacity: 1; transform-origin: top; }
}

/* ---------- Note « textes générés par IA » ---------- */
.gal-ainote {
  position: relative;
  z-index: 3;
  width: min(900px, calc(100% - 32px));
  margin: 0 auto 48px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 18px 22px;
  border: 1px solid rgba(232, 201, 124, .26);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  background: linear-gradient(120deg, rgba(232, 201, 124, .08), rgba(9, 11, 8, .78));
  box-shadow: 0 24px 60px -40px rgba(0, 0, 0, .9);
}
.gal-ainote__mark {
  flex: 0 0 auto;
  color: var(--gold);
  font-size: 1.15rem;
  line-height: 1.3;
}
.gal-ainote__label {
  font-family: 'Orbitron', sans-serif;
  font-size: .6rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-bright);
  margin-bottom: 6px;
}
.gal-ainote__text {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.7;
  max-width: 74ch;
}
.gal-ainote__text strong { color: var(--ivory); font-weight: 700; }

@media (max-width: 520px) {
  .gal-ainote { padding: 15px 16px; gap: 12px; }
  .gal-ainote__text { font-size: .84rem; }
}

/* ---------- Chapitres (navigation) ---------- */
.gal-chapters {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 18px;
  overflow-x: auto;
  scrollbar-width: none;
  background: rgba(7, 9, 7, .78);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.1);
}
.gal-chapters::-webkit-scrollbar { display: none; }

.gal-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  font-family: 'Quicksand', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: color .2s ease, background .2s ease, border-color .2s ease;
}
.gal-chip b {
  font-family: 'Orbitron', sans-serif;
  font-size: .6rem;
  letter-spacing: .06em;
  color: rgba(232, 201, 124, .55);
  font-weight: 400;
}
.gal-chip:hover { color: var(--ivory); background: rgba(232, 201, 124, .06); }
.gal-chip[aria-current="true"] {
  color: var(--gold-bright);
  border-color: rgba(232, 201, 124, .3);
  background: rgba(232, 201, 124, .08);
}
.gal-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Corps ---------- */
.gal-body {
  padding: clamp(26px, 4.5vw, 60px) clamp(14px, 4vw, 56px) 40px;
  max-width: 1560px;
  margin: 0 auto;
}

.gal-chapter {
  position: relative;
  padding-top: 26px;
  margin-bottom: clamp(50px, 8vw, 110px);
  scroll-margin-top: 74px;
}

.gal-chapter__head {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: end;
  gap: 18px;
  padding-bottom: 20px;
  margin-bottom: 26px;
  border-bottom: 1px solid var(--line);
}

.gal-chapter__num {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: .9;
  color: rgba(232, 201, 124, .38);
  letter-spacing: .04em;
}

.gal-chapter__date {
  font-family: 'Orbitron', sans-serif;
  font-size: .66rem;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--bronze);
  margin-bottom: 8px;
}

.gal-chapter__title {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 3.6vw, 2.7rem);
  font-weight: 700;
  letter-spacing: -.015em;
  color: var(--ivory);
  margin: 0;
  line-height: 1.1;
}

.gal-chapter__count {
  font-family: 'Orbitron', sans-serif;
  font-size: .62rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: rgba(168, 162, 138, .8);
  padding-bottom: 6px;
  white-space: nowrap;
}

@media (max-width: 700px) {
  .gal-chapter__head {
    grid-template-columns: auto 1fr;
    row-gap: 2px;
    align-items: start;
  }
  .gal-chapter__num {
    grid-column: 1;
    grid-row: 1;
    align-self: start;
    margin-top: 2px;
  }
  .gal-chapter__head > div {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }
  .gal-chapter__count {
    grid-column: 1 / -1;
    grid-row: 2;
    padding: 8px 0 0;
  }
  .gal-chapter__date { white-space: nowrap; }
  .gal-chapter__title { font-size: clamp(1.5rem, 7vw, 2rem); }
}

/* ---------- Grille ---------- */
.gal-grid {
  columns: 3;
  column-gap: var(--gal-gap);
}
@media (max-width: 1180px) { .gal-grid { columns: 2; } }
@media (max-width: 640px)  { .gal-grid { columns: 1; } }

.gal-item {
  display: block;
  width: 100%;
  margin: 0 0 var(--gal-gap);
  padding: 0;
  border: 0;
  background: none;
  break-inside: avoid;
  cursor: zoom-in;
  text-align: left;
  color: inherit;
  font: inherit;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .7s ease, transform .7s cubic-bezier(.22, .7, .25, 1);
}
.gal-item.is-in {
  opacity: 1;
  transform: none;
}
@media (prefers-reduced-motion: reduce) {
  .gal-item { opacity: 1; transform: none; transition: none; }
}

.gal-frame {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: #0c0f0a;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 18px 44px -28px rgba(0, 0, 0, .9);
}

.gal-frame img {
  display: block;
  width: 100%;
  height: auto;
  opacity: 0;
  filter: saturate(.94) contrast(1.02);
  transition: opacity .6s ease, transform .9s cubic-bezier(.2, .75, .25, 1), filter .5s ease;
}
.gal-frame img.is-loaded { opacity: 1; }

.gal-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(232, 201, 124, .1);
  transition: border-color .35s ease, box-shadow .35s ease;
  pointer-events: none;
}

.gal-item:hover .gal-frame img,
.gal-item:focus-visible .gal-frame img {
  transform: scale(1.035);
  filter: saturate(1.02) contrast(1.03);
}
.gal-item:hover .gal-frame::after,
.gal-item:focus-visible .gal-frame::after {
  border-color: rgba(232, 201, 124, .45);
  box-shadow: inset 0 0 40px rgba(232, 201, 124, .08);
}
.gal-item:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
  border-radius: 4px;
}

.gal-cap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 9px;
  padding: 9px 2px 0;
}
.gal-cap__ai {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid rgba(232, 201, 124, .32);
  border-radius: 4px;
  color: var(--gold);
  font-family: 'Orbitron', sans-serif;
  font-size: .5rem;
  letter-spacing: .1em;
  line-height: 1.2;
  transform: translateY(-1px);
}
.gal-cap::before {
  content: "";
  flex: 0 0 auto;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(232, 201, 124, .55);
  transform: translateY(-3px);
}
.gal-cap__t {
  font-family: 'Quicksand', sans-serif;
  font-size: .82rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1.35;
  transition: color .25s ease;
}
.gal-item:hover .gal-cap__t { color: var(--gold-bright); }

.gal-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(7, 9, 7, .55);
  border: 1px solid rgba(232, 201, 124, .28);
  color: var(--gold-bright);
  font-size: .95rem;
  line-height: 1;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity .3s ease, transform .3s ease, background .3s ease;
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.gal-item:hover .gal-zoom,
.gal-item:focus-visible .gal-zoom {
  opacity: 1;
  transform: none;
  background: rgba(232, 201, 124, .16);
}

/* ---------- Pied ---------- */
.gal-foot {
  border-top: 1px solid var(--line);
  padding: 44px 20px 50px;
  text-align: center;
  color: var(--muted);
  font-size: .86rem;
}
.gal-foot a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px dashed rgba(232, 201, 124, .4);
}
.gal-foot a:hover { color: var(--gold-bright); }
.gal-foot p + p { margin-top: 8px; }
.gal-foot .gal-foot__credit { color: var(--bronze); font-style: italic; }

/* ---------- Visionneuse ---------- */
.gal-lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  background: rgba(5, 6, 5, .985);
  opacity: 0;
  transition: opacity .28s ease;
}
.gal-lb[hidden] { display: none; }
.gal-lb.is-open { opacity: 1; }

.gal-lb__stage {
  position: relative;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 44px);
  min-width: 0;
  overflow: hidden;
}

.gal-lb__img {
  max-width: 100%;
  max-height: calc(100vh - clamp(32px, 6vw, 88px));
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 40px 120px -40px rgba(0, 0, 0, 1);
  background: #0a0c08;
}

.gal-lb__aside {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  padding: clamp(22px, 3vw, 40px) clamp(22px, 3vw, 34px);
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(11, 13, 9, .6), rgba(7, 9, 7, .95));
  overflow-y: auto;
}

.gal-lb__chapter {
  font-family: 'Orbitron', sans-serif;
  font-size: .6rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--bronze);
}
.gal-lb__chapter b { color: var(--gold); font-weight: 400; }

.gal-lb__title {
  font-family: var(--serif);
  font-size: clamp(1.4rem, 2.4vw, 1.85rem);
  line-height: 1.2;
  color: var(--ivory);
  margin: 0;
}

.gal-lb__date {
  font-family: 'Quicksand', sans-serif;
  font-size: .84rem;
  color: var(--muted);
  letter-spacing: .02em;
}

.gal-lb__ai {
  display: inline-block;
  margin-left: 8px;
  padding: 3px 7px;
  border: 1px solid rgba(232, 201, 124, .35);
  border-radius: 5px;
  color: var(--gold);
  font-family: 'Orbitron', sans-serif;
  font-size: .55rem;
  letter-spacing: .1em;
  vertical-align: middle;
  transform: translateY(-3px);
}
.gal-lb__ainote {
  margin-top: -8px;
  color: rgba(232, 201, 124, .72);
  font-size: .74rem;
  font-style: italic;
}

.gal-lb__desc {
  color: #cfc8b2;
  font-size: .95rem;
  line-height: 1.85;
}
.gal-lb__desc p + p { margin-top: .8em; }
.gal-lb__desc em { color: var(--ivory); }
.gal-lb__desc strong { color: var(--gold-bright); font-weight: 700; }

.gal-lb__orig {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  align-self: flex-start;
  margin-top: 4px;
  padding: 11px 16px;
  border-radius: 9px;
  border: 1px solid rgba(232, 201, 124, .3);
  color: var(--gold-bright);
  font-family: 'Orbitron', sans-serif;
  font-size: .62rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background .25s ease, border-color .25s ease;
}
.gal-lb__orig:hover {
  background: rgba(232, 201, 124, .12);
  border-color: var(--gold);
}
.gal-lb__orig svg { width: 13px; height: 13px; }

.gal-lb__nav {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.gal-lb__count {
  margin: 0;
  text-align: center;
  font-family: 'Orbitron', sans-serif;
  font-size: .7rem;
  letter-spacing: .16em;
  color: var(--bronze);
}
.gal-lb__hint {
  margin: 0;
  text-align: center;
  font-size: .66rem;
  letter-spacing: .12em;
  color: rgba(168, 162, 138, .5);
  font-family: 'Quicksand', sans-serif;
}

.gal-lb__btn {
  appearance: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(232, 201, 124, .28);
  background: rgba(10, 12, 9, .6);
  color: var(--gold-bright);
  font-size: 1.15rem;
  cursor: pointer;
  transition: background .22s ease, border-color .22s ease, transform .22s ease;
}
.gal-lb__btn:hover:not(:disabled) {
  background: rgba(232, 201, 124, .14);
  border-color: var(--gold);
  transform: translateY(-1px);
}
.gal-lb__btn:disabled {
  opacity: .3;
  cursor: default;
}
.gal-lb__btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

.gal-lb__close {
  position: absolute;
  top: clamp(12px, 2vw, 22px);
  right: clamp(12px, 2vw, 22px);
  z-index: 3;
}

.gal-lb__side {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}
.gal-lb__side--prev { left: clamp(8px, 1.6vw, 20px); }
.gal-lb__side--next { right: clamp(8px, 1.6vw, 20px); }

/* Mobile : légende sous l'image */
@media (max-width: 520px) {
  .gal-hero__meta { gap: 6px 14px; }
  .gal-hero__meta span + span::before { display: none; }
}

@media (max-width: 820px) {
  .gal-lb {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }
  .gal-lb__stage {
    padding: 54px 12px 8px;
  }
  .gal-lb__img {
    max-height: calc(100vh - 320px);
  }
  .gal-lb__aside {
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 44vh;
    gap: 10px;
    padding: 16px 18px 22px;
  }
  .gal-lb__hint { display: none; }
  .gal-lb__side { display: none; }
  .gal-lb__nav .gal-lb__btn { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .gal-hero__bg { transform: none !important; }
  .gal-scrollcue::after { animation: none; }
  .gal-frame img { transition: none; }
  .gal-lb { transition: none; }
}

/* ---------- Impression ---------- */
@media print {
  .gal-hero__bg, .gal-chapters, .gal-progress, .gal-lb, .gal-scrollcue, .gal-actions { display: none !important; }
  .gal-hero { min-height: auto; }
  .gal-item { opacity: 1 !important; transform: none !important; break-inside: avoid; }
  body { background: #fff; color: #111; }
  .gal-title, .gal-chapter__title { color: #111; }
}
