/* AceBase figure photo wall — TinyBox sc-wall + lightbox */

.sc-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  grid-auto-rows: 6.5rem;
  grid-auto-flow: dense;
  gap: 0.55rem;
  margin: 1rem 0 2rem;
}

.sc-wall__tile {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 0.4rem;
  background: #1a1625;
  grid-row: span 2;
  text-decoration: none;
  color: inherit;
}

.sc-wall__tile--sm {
  grid-row: span 2;
}

.sc-wall__tile--md {
  grid-row: span 3;
}

.sc-wall__tile--lg {
  grid-column: span 2;
  grid-row: span 3;
}

.md-typeset .sc-wall__tile img {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  object-fit: cover;
  display: block !important;
  margin: 0 !important;
  transition: transform 0.35s ease;
}

.sc-wall__tile:hover img {
  transform: scale(1.04);
}

.sc-wall__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.4rem 0.55rem 0.45rem;
  font-size: 0.72rem;
  line-height: 1.25;
  color: #fff;
  background: linear-gradient(transparent, rgba(15, 23, 42, 0.78));
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sc-wall__count {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 0.68rem;
  line-height: 1.35rem;
  text-align: center;
  pointer-events: none;
}

body.sc-lightbox-open {
  overflow: hidden;
}

.sc-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.25rem;
  background: rgba(15, 23, 42, 0.88);
  box-sizing: border-box;
}

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

.sc-lightbox__stage {
  margin: 0;
  max-width: min(92vw, 42rem);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.sc-lightbox__media {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}

.sc-lightbox__img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 3.5rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.35rem;
  margin: 0;
  background: #0f172a;
}

.sc-lightbox__cap {
  margin: 0;
  max-width: 100%;
  color: #e2e8f0;
  font-size: 0.85rem;
  line-height: 1.35;
  text-align: center;
}

.sc-lightbox__buy {
  position: relative;
  z-index: 2;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 0.35rem;
  background: #25d366;
  color: #fff !important;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  text-decoration: none !important;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  box-sizing: border-box;
}

.sc-lightbox__buy-wrap {
  position: absolute;
  left: 50%;
  bottom: 0.85rem;
  top: auto;
  transform: translateX(-50%);
  z-index: 2;
  line-height: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.sc-lightbox__buy-wrap.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.sc-lightbox__buy-wrap[hidden] {
  display: none !important;
}

.sc-lightbox__buy:hover {
  background: #1ebe57;
  color: #fff !important;
}

.sc-lightbox__buy-dismiss {
  position: absolute;
  top: -0.28rem;
  right: -0.28rem;
  z-index: 3;
  width: 1rem;
  height: 1rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  font-size: 0.72rem;
  line-height: 1rem;
  text-align: center;
  cursor: pointer;
}

.sc-lightbox__buy-icon {
  width: 1.05rem;
  height: 1.05rem;
  flex: 0 0 auto;
  display: block;
}

.sc-lightbox__close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  width: 2.4rem;
  height: 2.4rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.sc-lightbox__nav {
  flex: 0 0 auto;
  width: 2.6rem;
  height: 2.6rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.7rem;
  line-height: 1;
  cursor: pointer;
}

.sc-lightbox__close:hover,
.sc-lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.24);
}

@media (max-width: 600px) {
  .sc-wall {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 5.5rem;
  }

  .sc-wall__tile--lg {
    grid-column: span 2;
  }

  .sc-lightbox {
    padding: 3.2rem 0.4rem 1rem;
  }

  .sc-lightbox__nav {
    position: absolute;
    bottom: 1rem;
  }

  .sc-lightbox__nav--prev {
    left: 0.75rem;
  }

  .sc-lightbox__nav--next {
    right: 0.75rem;
  }

  .sc-lightbox__stage {
    max-width: 96vw;
  }
}
