.hb-project-gallery {
  margin-top: clamp(34px, 5vw, 58px);
}

.hb-project-filter {
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid var(--hb-line, #e4e1e8);
  border-radius: 28px;
  background: #fff;
  box-shadow: 0 16px 42px rgba(29, 15, 80, .08);
}

.hb-project-filter__main,
.hb-project-filter__subgroup {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.hb-project-filter__subs:has(.hb-project-filter__subgroup:not([hidden])) {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--hb-line, #e4e1e8);
}

.hb-project-filter__button {
  min-height: 52px;
  padding: 12px 22px;
  border: 1px solid rgba(41, 22, 111, .24);
  border-radius: 999px;
  background: #fff;
  color: var(--hb-purple-dark, #1d0f50);
  font-family: Montserrat, Inter, Arial, sans-serif;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: 0 7px 18px rgba(29, 15, 80, .06);
  transition: transform .18s ease, color .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}

.hb-project-filter__button:hover,
.hb-project-filter__button:focus-visible {
  transform: translateY(-2px);
  border-color: var(--hb-orange, #ff6300);
  box-shadow: 0 10px 22px rgba(29, 15, 80, .11);
}

.hb-project-filter__button:focus-visible,
.hb-project-gallery__open:focus-visible,
.hb-project-lightbox button:focus-visible {
  outline: 3px solid rgba(255, 99, 0, .38);
  outline-offset: 3px;
}

.hb-project-filter__button.is-active {
  border-color: var(--hb-purple, #29166f);
  background: var(--hb-purple, #29166f);
  color: #fff;
  box-shadow: 0 11px 24px rgba(41, 22, 111, .22);
}

.hb-project-filter__button--sub {
  min-height: 46px;
  padding: 10px 19px;
  font-size: 14px;
}

.hb-project-gallery__status {
  margin: 22px 0 16px !important;
  color: var(--hb-muted, #6c6865);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.hb-project-gallery__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
}

.hb-project-gallery__item {
  min-width: 0;
  margin: 0 !important;
  overflow: hidden;
  border: 1px solid var(--hb-line, #e4e1e8);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(29, 15, 80, .08);
  animation: hb-project-reveal .28s ease both;
}

.hb-project-gallery__item[hidden] {
  display: none;
}

.hb-project-gallery__open {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: #efedf4;
  cursor: zoom-in;
}

.hb-project-gallery__open img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease, filter .35s ease;
}

.hb-project-gallery__zoom {
  position: absolute;
  right: 14px;
  bottom: 14px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 999px;
  background: rgba(29, 15, 80, .82);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease, transform .22s ease;
}

.hb-project-gallery__item:hover .hb-project-gallery__open img,
.hb-project-gallery__open:focus-visible img {
  transform: scale(1.035);
  filter: brightness(.9);
}

.hb-project-gallery__item:hover .hb-project-gallery__zoom,
.hb-project-gallery__open:focus-visible .hb-project-gallery__zoom {
  opacity: 1;
  transform: translateY(0);
}

.hb-project-gallery__item figcaption {
  min-height: 58px;
  padding: 17px 18px;
  color: var(--hb-purple-dark, #1d0f50);
  font-family: Montserrat, Inter, Arial, sans-serif;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.45;
}

.hb-project-gallery__empty {
  margin-top: 30px !important;
  padding: 22px;
  border-radius: 12px;
  background: var(--hb-soft, #f3f3f6);
}

body.hb-project-lightbox-open {
  overflow: hidden;
}

.hb-project-lightbox[hidden] {
  display: none;
}

.hb-project-lightbox {
  position: fixed;
  z-index: 999999;
  inset: 0;
  display: grid;
  padding: 50px 90px 34px;
  place-items: center;
  background: rgba(10, 6, 28, .95);
}

.hb-project-lightbox figure {
  display: grid;
  max-width: calc(100vw - 190px);
  max-height: calc(100vh - 90px);
  margin: 0;
  place-items: center;
}

.hb-project-lightbox img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 155px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .35);
}

.hb-project-lightbox figcaption {
  display: flex;
  gap: 14px;
  margin-top: 16px;
  align-items: baseline;
  color: #fff;
  text-align: center;
}

.hb-project-lightbox figcaption small {
  color: rgba(255, 255, 255, .62);
  white-space: nowrap;
}

.hb-project-lightbox__close,
.hb-project-lightbox__arrow {
  position: fixed;
  z-index: 2;
  display: grid;
  width: 50px;
  height: 50px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background-color .18s ease, border-color .18s ease, opacity .18s ease;
}

.hb-project-lightbox__close:hover,
.hb-project-lightbox__arrow:hover {
  border-color: rgba(255, 255, 255, .65);
  background: rgba(255, 99, 0, .9);
}

.hb-project-lightbox__close {
  top: 22px;
  right: 24px;
  font-size: 34px;
  line-height: 1;
}

.hb-project-lightbox__arrow {
  top: 50%;
  transform: translateY(-50%);
  font-size: 42px;
  line-height: .8;
}

.hb-project-lightbox__arrow--prev { left: 20px; }
.hb-project-lightbox__arrow--next { right: 20px; }

@keyframes hb-project-reveal {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 960px) {
  .hb-project-gallery__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .hb-project-filter { padding: 20px 15px; border-radius: 20px; }
  .hb-project-filter__main,
  .hb-project-filter__subgroup { gap: 9px; }
  .hb-project-filter__button { min-height: 44px; padding: 9px 15px; font-size: 13px; }
  .hb-project-filter__button--sub { min-height: 40px; padding: 8px 13px; font-size: 12px; }
  .hb-project-gallery__status { text-align: left; }
  .hb-project-gallery__grid { grid-template-columns: 1fr; gap: 18px; }
  .hb-project-gallery__open { aspect-ratio: 5 / 4; }
  .hb-project-gallery__zoom { opacity: 1; transform: none; }
  .hb-project-lightbox { padding: 68px 14px 28px; }
  .hb-project-lightbox figure { max-width: 100%; max-height: calc(100vh - 98px); }
  .hb-project-lightbox img { max-height: calc(100vh - 160px); }
  .hb-project-lightbox figcaption { flex-direction: column; gap: 3px; align-items: center; }
  .hb-project-lightbox__close { top: 12px; right: 12px; width: 44px; height: 44px; }
  .hb-project-lightbox__arrow { width: 44px; height: 44px; background: rgba(29, 15, 80, .78); }
  .hb-project-lightbox__arrow--prev { left: 8px; }
  .hb-project-lightbox__arrow--next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .hb-project-gallery__item { animation: none; }
  .hb-project-gallery__open img,
  .hb-project-gallery__zoom,
  .hb-project-filter__button { transition: none; }
}

