.gallery-panel[hidden] {
  display: none;
}

.gallery-panel {
  position: fixed;
  inset: 0;
  z-index: 8000;
  overflow-y: auto;
  overscroll-behavior: contain;
  background:
    radial-gradient(circle at 18% 10%, rgba(116, 124, 145, 0.12), transparent 30rem),
    rgba(3, 4, 6, 0.94);
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 260ms ease, transform 360ms cubic-bezier(.2,.75,.25,1);
}

.gallery-panel.is-open {
  opacity: 1;
  transform: translateY(0);
}

.gallery-panel__inner {
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 70px;
}

.gallery-panel__bar {
  position: sticky;
  top: 14px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 72px;
  padding: 11px 14px 11px 18px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 18px;
  background: rgba(8, 9, 12, 0.82);
  box-shadow: 0 18px 50px rgba(0,0,0,.32);
  backdrop-filter: blur(14px);
}

.gallery-panel__brand {
  font: 600 .76rem/1 "Poppins", sans-serif;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.gallery-panel__close {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid rgba(255,255,255,.14);
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  color: rgba(255,255,255,.82);
  font: 500 .72rem/1 "Poppins", sans-serif;
  cursor: pointer;
}

.gallery-panel__heading {
  max-width: 650px;
  margin-bottom: 38px;
}

.gallery-panel__heading span {
  color: rgba(255,255,255,.52);
  font: 600 .68rem/1 "Poppins", sans-serif;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.gallery-panel__heading h2 {
  margin: 12px 0;
  font: 600 clamp(2.5rem, 7vw, 5rem)/.96 "Cinzel", serif;
}

.gallery-panel__heading p {
  margin: 0;
  color: rgba(255,255,255,.58);
  font: 400 .84rem/1.7 "Poppins", sans-serif;
}

.gallery-panel__grid {
  columns: 3 270px;
  column-gap: 15px;
}

.gallery-panel__item {
  position: relative;
  display: block;
  width: 100%;
  margin: 0 0 15px;
  padding: 0;
  overflow: hidden;
  break-inside: avoid;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 19px;
  background: #090a0d;
  cursor: zoom-in;
}

.gallery-panel__item img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 420ms cubic-bezier(.2,.75,.25,1), filter 260ms ease;
}

.gallery-panel__item:hover img {
  transform: scale(1.025);
  filter: brightness(1.06);
}

.gallery-preview {
  position: fixed;
  inset: 0;
  box-sizing: border-box;
  width: fit-content;
  max-width: calc(100vw - 32px);
  height: fit-content;
  max-height: calc(100dvh - 32px);
  margin: auto;
  padding: 12px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 22px;
  background: #08090c;
  box-shadow: 0 30px 100px rgba(0,0,0,.7);
  transform: none;
}

.gallery-preview[open] {
  display: grid;
  place-items: center;
}

.gallery-preview::backdrop {
  background: rgba(0,0,0,.84);
  backdrop-filter: blur(6px);
}

.gallery-preview img {
  display: block;
  width: auto;
  height: auto;
  max-width: calc(100vw - 56px);
  max-height: calc(100dvh - 56px);
  margin: auto;
  border-radius: 14px;
  object-fit: contain;
}

.gallery-preview__close {
  position: absolute;
  top: 20px;
  right: 20px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 50%;
  background: rgba(5,5,7,.82);
  color: #fff;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
}

html.gallery-open,
html.gallery-open body {
  overflow: hidden !important;
}

@media (max-width: 680px) {
  .gallery-panel__inner {
    width: calc(100% - 18px);
    padding-top: 9px;
  }

  .gallery-panel__bar {
    top: 8px;
    margin-bottom: 44px;
    border-radius: 15px;
    backdrop-filter: none;
  }

  .gallery-panel__close span {
    display: none;
  }

  .gallery-panel__heading {
    margin-bottom: 26px;
  }

  .gallery-panel__grid {
    columns: 2 130px;
    column-gap: 9px;
  }

  .gallery-panel__item {
    margin-bottom: 9px;
    border-radius: 14px;
  }

  .gallery-preview::backdrop {
    backdrop-filter: none;
  }

  .gallery-preview {
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding: 8px;
    border-radius: 16px;
  }

  .gallery-preview img {
    max-width: calc(100vw - 32px);
    max-height: calc(100dvh - 32px);
    border-radius: 11px;
  }

  .gallery-preview__close {
    top: 14px;
    right: 14px;
    width: 38px;
    height: 38px;
  }
}

@media (max-width: 340px) {
  .gallery-panel__grid {
    columns: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-panel,
  .gallery-panel__item img {
    transition: none !important;
  }
}
