/* ================================================================
   GALLERY 3D  –  Styles overlay + UI
   ================================================================ */

/* ── Overlay fullscreen ──────────────────────────────────────── */
#gallery-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: #020507;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              visibility 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

#gallery-overlay.visible {
  opacity: 1;
  visibility: visible;
}

/* ── Canvas container ────────────────────────────────────────── */
#gallery-canvas {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.25s;
}

#gallery-overlay.loaded #gallery-canvas {
  opacity: 1;
}

#gallery-canvas canvas {
  display: block;
}

/* ── Loading screen ──────────────────────────────────────────── */
.g-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 10;
  opacity: 1;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

#gallery-overlay.loaded .g-loading {
  opacity: 0;
}

.g-loading__spin {
  width: 44px;
  height: 44px;
  border: 2px solid rgba(66, 122, 224, 0.15);
  border-top-color: #427AE0;
  border-radius: 50%;
  animation: g-spin 0.75s linear infinite;
}

.g-loading__text {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.25);
}

@keyframes g-spin {
  to { transform: rotate(360deg); }
}

/* ── Top bar ─────────────────────────────────────────────────── */
.g-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  background: linear-gradient(to bottom, rgba(4, 8, 16, 0.75) 0%, transparent 100%);
  opacity: 0;
  transition: opacity 0.5s ease 0.6s;
}

#gallery-overlay.loaded .g-topbar {
  opacity: 1;
}

.g-topbar__left {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.g-topbar__eyebrow {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.22);
}

#g-section-label {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: #427AE0;
  transition: color 0.4s ease;
}

.g-topbar__center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}

.g-topbar__title {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 300;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
}

/* ── Close button ────────────────────────────────────────────── */
#gallery-close-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.6);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  backdrop-filter: blur(8px);
  flex-shrink: 0;
}

#gallery-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* ── Artwork label (current project name, center bottom) ─────── */
#g-artwork-label {
  position: absolute;
  bottom: 108px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #427AE0;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.7s,
              color 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
}

#gallery-overlay.loaded #g-artwork-label {
  opacity: 1;
}

/* ── Hint text ───────────────────────────────────────────────── */
.g-hint {
  position: absolute;
  bottom: 96px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.18);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  animation: none;
}

#gallery-overlay.loaded .g-hint {
  animation: g-hint-fade 5s ease 1.2s forwards;
}

@keyframes g-hint-fade {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── BCE gallery controls (denomination tabs + flip) ────────── */
#bce-gallery-controls {
  position: absolute;
  bottom: 104px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 22;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: rgba(4, 6, 14, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 18px;
  padding: 12px 18px;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

#bce-gallery-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.bce-gtab {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid;
  background: transparent;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: .80rem;
  font-weight: 700;
  opacity: .52;
  transition: background .2s, color .2s, opacity .2s, transform .15s;
}
.bce-gtab.active      { opacity: 1; transform: scale(1.05); color: #06080f !important; }
.bce-gtab:hover:not(.active) { opacity: .8; }

.bce-hint {
  font-family: 'Inter', sans-serif;
  font-size: .75rem;
  color: rgba(255,255,255,.28);
  letter-spacing: .04em;
  margin: 0;
  text-align: center;
}

@media (max-width: 767px) {
  #bce-gallery-controls { bottom: 96px; padding: 10px 12px; gap: 8px; }
  .bce-gtab { padding: 4px 9px; font-size: .72rem; }
}

/* ── Bottom navigation ───────────────────────────────────────── */
.g-nav {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  opacity: 0;
  transition: opacity 0.5s ease 0.7s;
}

#gallery-overlay.loaded .g-nav {
  opacity: 1;
}

.g-nav__btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.7);
  font-size: 17px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  backdrop-filter: blur(10px);
}

.g-nav__btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.28);
  transform: scale(1.06);
}

.g-nav__btn:disabled {
  opacity: 0.2;
  cursor: not-allowed;
  transform: none;
}

/* ── Floating arrows: navigate visuals within a project (zoom) ── */
.gz-arrow {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 28;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(3, 6, 16, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: rgba(255, 255, 255, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: opacity 0.35s ease, background 0.2s, border-color 0.2s;
}

.gz-arrow.show {
  opacity: 1;
  pointer-events: auto;
}

.gz-arrow:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.32);
}

/* Anchored to the centre (where the project zooms) so they hug the visual */
.gz-arrow--prev { transform: translate(calc(-50% - 410px), -50%); }
.gz-arrow--next { transform: translate(calc(-50% + 410px), -50%); }

/* gentle directional float */
.gz-arrow.show svg { animation: gz-nudge 2.2s ease-in-out infinite; }
.gz-arrow--next.show svg { animation-name: gz-nudge-next; }

@keyframes gz-nudge {
  0%, 100% { transform: translateX(0);    opacity: 0.85; }
  50%      { transform: translateX(-3px); opacity: 1;    }
}
@keyframes gz-nudge-next {
  0%, 100% { transform: translateX(0);   opacity: 0.85; }
  50%      { transform: translateX(3px); opacity: 1;    }
}

/* ── Dots ────────────────────────────────────────────────────── */
.g-dots {
  display: flex;
  align-items: center;
  gap: 10px;
}

.g-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  cursor: pointer;
  padding: 0;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

.g-dot.active {
  transform: scale(1.25);
}

#g-counter {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 2px;
  color: rgba(255, 255, 255, 0.25);
  min-width: 36px;
  text-align: center;
}

/* ── Detail panel (slides from right) ───────────────────────── */
#gallery-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  z-index: 30;
  background: rgba(3, 6, 16, 0.94);
  border-left: 1px solid rgba(255, 255, 255, 0.055);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  transform: translateX(100%);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
}

#gallery-panel.open {
  transform: translateX(0);
}

.g-panel__close {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

.g-panel__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

/* Peek handle: mobile-only tap strip to expand the panel (hidden on desktop) */
#gp-peek { display: none; }

.g-panel__body {
  padding: 72px 32px 48px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

#gd-section {
  display: block;
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 14px;
  transition: color 0.3s;
}

#gd-title {
  font-family: 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.1;
  margin: 0 0 10px;
}

#gd-cat {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.38);
  margin: 0 0 3px;
}

#gd-year {
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.2);
  margin: 0 0 26px;
  letter-spacing: 1px;
}

.g-panel__rule {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  margin: 0 0 24px;
}

#gd-desc {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 28px;
}

#gd-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: auto;
  padding-bottom: 36px;
}

.g-tag {
  font-family: 'Inter', sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid;
  opacity: 0.8;
}

#gd-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid;
  border-radius: 999px;
  padding: 13px 24px;
  transition: background 0.25s ease, transform 0.2s ease;
  align-self: flex-start;
}

#gd-link:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

#gd-link svg {
  transition: transform 0.2s ease;
}

#gd-link:hover svg {
  transform: translateX(4px);
}

/* ── Enter gallery button (position: fixed, hors pagepiling) ─── */
#gallery-open-btn {
  position: fixed;
  bottom: 48px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8000;           /* sous l'overlay (9000) mais au-dessus de tout le reste */
  opacity: 1;
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 13px 26px;
  border-radius: 999px;
  background: rgba(66, 122, 224, 0.1);
  border: 1px solid rgba(66, 122, 224, 0.4);
  color: #427AE0;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity 0.4s ease, background 0.25s, border-color 0.25s,
              transform 0.2s, box-shadow 0.25s;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

#gallery-open-btn:hover {
  background: rgba(66, 122, 224, 0.2);
  border-color: rgba(66, 122, 224, 0.7);
  transform: translateX(-50%) translateY(-2px);
  box-shadow: 0 8px 28px rgba(66, 122, 224, 0.2);
}

.g-btn-icon {
  display: flex;
  align-items: center;
  animation: g-icon-pulse 2.6s ease-in-out infinite;
}

@keyframes g-icon-pulse {
  0%, 100% { transform: scale(1);    opacity: 1;    }
  50%       { transform: scale(1.15); opacity: 0.7; }
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 767px) {
  #gallery-open-btn {
    bottom: 24px;
    font-size: 10px;
    padding: 11px 20px;
  }

  #gallery-panel {
    width: 100%;
    top: auto;
    right: 0;
    bottom: 0;
    height: 44%;
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    transform: translateY(100%);
  }

  /* Opening on mobile only reveals a slim "peek" strip (the artwork you
     just zoomed into stays fully visible above it). Tapping the strip
     expands the panel to its full height for the complete write-up. */
  #gallery-panel.open {
    transform: translateY(calc(100% - 62px));
  }

  #gallery-panel.open.expanded {
    transform: translateY(0);
  }

  #gp-peek {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: 62px;
    flex: 0 0 62px;
    width: 100%;
    padding: 0 22px;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    background: transparent;
    color: #fff;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  #gp-peek-title {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #gp-peek svg {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.5);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }

  #gallery-panel.expanded #gp-peek svg {
    transform: rotate(180deg);
  }

  /* Close (X) only makes sense once expanded — hidden during peek so it
     doesn't visually collide with the peek strip's own controls */
  .g-panel__close {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  #gallery-panel.expanded .g-panel__close {
    opacity: 1;
    pointer-events: auto;
  }

  .g-panel__body {
    padding: 16px 24px 36px;
  }

  #gd-title {
    font-size: 22px;
  }

  .g-topbar__center {
    display: none;
  }

  .g-hint {
    display: none;
  }

  #g-artwork-label {
    bottom: 100px;
  }

  /* Panel slides up from the bottom on mobile → keep arrows in the
     visible top area, both pinned to the screen edges. Lowered a bit
     from the very top so they sit closer to natural thumb reach. */
  .gz-arrow { top: 40%; width: 46px; height: 46px; }
  .gz-arrow--prev { transform: translate(calc(-50% - 36vw), -50%); }
  .gz-arrow--next { transform: translate(calc(-50% + 36vw), -50%); }

  /* Client slider (dots + prev/next) must clear the peek bar (62px) that
     sits pinned to the very bottom of the screen, or it renders hidden
     underneath it */
  .g-nav {
    bottom: 78px;
  }
}
