.ekm-home-gallery-wrap {
  margin: 2rem 0 3rem;
}

.ekm-home-gallery__head {
  text-align: center;
  margin-bottom: 1rem;
}

.ekm-home-gallery__head h3 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  font-weight: 300;
  letter-spacing: 0.01em;
}

.ekm-home-gallery__head p {
  margin: 0;
  color: #6b7280;
  font-size: 0.95rem;
}

.ekm-home-gallery--layout-masonry .ekm-home-gallery__grid {
  column-count: 5;
  column-gap: 10px;
}

.ekm-home-gallery__item {
  display: block;
  width: 100%;
  margin: 0 0 10px;
  border: 0;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
  background: #e5e7eb;
  break-inside: avoid;
  position: relative;
}

.ekm-home-gallery__item::after {
  content: "⤢";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 12px;
  line-height: 20px;
  text-align: center;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.22s ease, transform 0.22s ease;
  pointer-events: none;
}

.ekm-home-gallery__item:hover::after,
.ekm-home-gallery__item:focus-visible::after {
  opacity: 1;
  transform: translateY(0);
}

.ekm-home-gallery__item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.28s ease;
}

.ekm-home-gallery__item:hover img {
  transform: scale(1.04);
}

.ekm-home-gallery__item:focus-visible {
  outline: 2px solid #84cc16;
  outline-offset: 2px;
}

.ekm-home-gallery--layout-liquid .ekm-home-gallery__grid {
  position: relative;
  width: min(100%, 1536px);
  aspect-ratio: 1536 / 1024;
  margin-inline: auto;
  overflow: hidden;
  pointer-events: none;
}

.ekm-home-gallery--layout-liquid .ekm-home-gallery__item {
  position: absolute;
  margin: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #d9d9d9;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: 100% 100%;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: 100% 100%;
  pointer-events: auto;
}

.ekm-home-gallery--layout-liquid .ekm-home-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.28s ease;
}

.ekm-home-gallery--layout-liquid .ekm-home-gallery__item::after {
  display: none;
}

.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:hover img {
  transform: scale(1.04);
}

.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(1)  { left: 4.362%; top: 8.6914%; width: 28.4505%; height: 21.4844%; -webkit-mask-image: url("./masks/slot-01.png"); mask-image: url("./masks/slot-01.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(2)  { left: 41.6667%; top: 8.6914%; width: 24.0885%; height: 10.5469%; -webkit-mask-image: url("./masks/slot-02.png"); mask-image: url("./masks/slot-02.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(3)  { left: 66.4062%; top: 8.6914%; width: 14.6484%; height: 34.082%; -webkit-mask-image: url("./masks/slot-03.png"); mask-image: url("./masks/slot-03.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(4)  { left: 33.3984%; top: 8.7891%; width: 15.9505%; height: 33.9844%; -webkit-mask-image: url("./masks/slot-04.png"); mask-image: url("./masks/slot-04.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(5)  { left: 81.6406%; top: 8.7891%; width: 13.6068%; height: 33.9844%; -webkit-mask-image: url("./masks/slot-05.png"); mask-image: url("./masks/slot-05.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(6)  { left: 11.9141%; top: 20.2148%; width: 20.8984%; height: 22.5586%; -webkit-mask-image: url("./masks/slot-06.png"); mask-image: url("./masks/slot-06.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(7)  { left: 50%; top: 20.2148%; width: 15.7552%; height: 22.5586%; -webkit-mask-image: url("./masks/slot-07.png"); mask-image: url("./masks/slot-07.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(8)  { left: 66.3411%; top: 20.5078%; width: 6.8359%; height: 34.9609%; -webkit-mask-image: url("./masks/slot-08.png"); mask-image: url("./masks/slot-08.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(9)  { left: 4.362%; top: 31.25%; width: 6.901%; height: 36.1328%; -webkit-mask-image: url("./masks/slot-09.png"); mask-image: url("./masks/slot-09.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(10) { left: 57.8125%; top: 31.6406%; width: 7.9427%; height: 23.8281%; -webkit-mask-image: url("./masks/slot-10.png"); mask-image: url("./masks/slot-10.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(11) { left: 4.2969%; top: 43.75%; width: 14.6484%; height: 38.6719%; -webkit-mask-image: url("./masks/slot-11.png"); mask-image: url("./masks/slot-11.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(12) { left: 19.5312%; top: 43.75%; width: 13.2812%; height: 38.6719%; -webkit-mask-image: url("./masks/slot-12.png"); mask-image: url("./masks/slot-12.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(13) { left: 33.3984%; top: 43.75%; width: 23.8281%; height: 23.6328%; -webkit-mask-image: url("./masks/slot-13.png"); mask-image: url("./masks/slot-13.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(14) { left: 73.763%; top: 43.75%; width: 14.7786%; height: 23.6328%; -webkit-mask-image: url("./masks/slot-14.png"); mask-image: url("./masks/slot-14.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(15) { left: 80.7943%; top: 43.75%; width: 14.4531%; height: 38.6719%; -webkit-mask-image: url("./masks/slot-15.png"); mask-image: url("./masks/slot-15.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(16) { left: 33.3984%; top: 56.543%; width: 15.9505%; height: 25.8789%; -webkit-mask-image: url("./masks/slot-16.png"); mask-image: url("./masks/slot-16.png"); }
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(17) { left: 50%; top: 56.543%; width: 30.1432%; height: 25.8789%; -webkit-mask-image: url("./masks/slot-17.png"); mask-image: url("./masks/slot-17.png"); }

.ekm-home-gallery--layout-liquid .ekm-home-gallery__item::before {
  content: none !important;
}

.ekm-home-gallery--layout-liquid .ekm-home-gallery__item {
  z-index: 1;
}

.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(1),
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(2),
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(3),
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(4),
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(5),
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(6),
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(7),
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(8),
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(9),
.ekm-home-gallery--layout-liquid .ekm-home-gallery__item:nth-child(10) {
  z-index: 3;
}

.ekm-home-gallery__lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 20, 0.92);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.ekm-home-gallery__inner {
  position: relative;
  width: min(1200px, 96vw);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ekm-home-gallery__lightbox[hidden] {
  display: none !important;
}

.ekm-home-gallery__viewport {
  width: 100%;
  height: min(88vh, 900px);
  overflow: hidden;
  border-radius: 12px;
  touch-action: pan-y pinch-zoom;
}

.ekm-home-gallery__track {
  display: flex;
  height: 100%;
  transition: transform 0.3s ease;
  will-change: transform;
}

.ekm-home-gallery__slide {
  min-width: 100%;
  height: 100%;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ekm-home-gallery__slide img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
}

.ekm-home-gallery__close,
.ekm-home-gallery__nav {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.58);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.ekm-home-gallery__close {
  top: 18px;
  right: 18px;
}

.ekm-home-gallery__nav--prev {
  left: 18px;
}

.ekm-home-gallery__nav--next {
  right: 18px;
}

@media (max-width: 1199px) {
  .ekm-home-gallery--layout-masonry .ekm-home-gallery__grid {
    column-count: 4;
  }

  .ekm-home-gallery--layout-liquid .ekm-home-gallery__grid {
    width: 100%;
  }
}

@media (max-width: 1100px) {
  .ekm-home-gallery--layout-masonry .ekm-home-gallery__grid {
    column-count: 3;
  }

  .ekm-home-gallery--layout-liquid .ekm-home-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 10px;
    display: grid;
    aspect-ratio: auto;
  }

  .ekm-home-gallery--layout-liquid .ekm-home-gallery__item {
    position: static !important;
    inset: auto !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 10;
    grid-column: span 1 !important;
    grid-row: span 1 !important;
    border-radius: 16px !important;
    border: 0 !important;
    -webkit-mask-image: none !important;
    mask-image: none !important;
    -webkit-mask-size: auto !important;
    mask-size: auto !important;
  }

  .ekm-home-gallery--layout-liquid .ekm-home-gallery__item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 1;
    filter: none;
  }

  .ekm-home-gallery--layout-liquid .ekm-home-gallery__item::before {
    display: none !important;
  }

  .ekm-home-gallery__nav {
    display: none !important;
  }

  .ekm-home-gallery__close {
    top: max(12px, env(safe-area-inset-top));
    right: max(12px, env(safe-area-inset-right));
    width: 42px;
    height: 42px;
    font-size: 24px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(0, 0, 0, 0.72);
    z-index: 10020;
  }
}

@media (max-width: 640px) {
  .ekm-home-gallery--layout-masonry .ekm-home-gallery__grid {
    column-count: 2;
    column-gap: 8px;
  }

  .ekm-home-gallery__item {
    margin-bottom: 8px;
    border-radius: 8px;
  }

  .ekm-home-gallery__viewport {
    width: 100%;
    height: 82vh;
  }

  .ekm-home-gallery__nav {
    width: 28px;
    height: 28px;
    font-size: 17px;
  }

  .ekm-home-gallery--layout-liquid .ekm-home-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 8px;
  }

  .ekm-home-gallery--layout-liquid .ekm-home-gallery__item {
    border-width: 0;
    border-radius: 14px !important;
    grid-column: span 1 !important;
    grid-row: span 1 !important;
    aspect-ratio: 16 / 10;
  }

  .ekm-home-gallery--layout-liquid .ekm-home-gallery__head h3 {
    font-size: clamp(1.9rem, 8vw, 2.4rem);
  }
}

