/* -------------------------------- 

File#: _2_gallery-v2
Title: Gallery v2
Descr: A gallery of card components with an additional text element
Usage: codyhouse.co/license

-------------------------------- */
:root {
  --gallery-v2-offset: 100px; /* grid items offset value */
}

.gallery-v2 {
  position: relative;
  z-index: 1;
}

.gallery-v2__content {
  padding-bottom: var(--gallery-v2-offset);
}

.gallery-v2__gallery {
  margin-top: calc(-1 * var(--gallery-v2-offset));
  padding-bottom: 1px; /* fix issue with collapsing margins */
}

.gallery-v2__img-wrapper {
  display: block;
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.gallery-v2__img-wrapper::after { /* inner glow */
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: var(--inner-glow);
  border-radius: inherit;
  z-index: 2;
}
@media (hover: hover) {
  .gallery-v2__img-wrapper:hover .gallery-v2__overlay {
    opacity: 1;
    background: hsla(var(--color-contrast-higher-h), var(--color-contrast-higher-s), var(--color-contrast-higher-l), 0.95);
  }
  .gallery-v2__img-wrapper:hover .gallery-v2__icon-bg {
    opacity: 1;
    transform: scale(1);
  }
  .gallery-v2__img-wrapper:hover .gallery-v2__icon {
    opacity: 1;
    transform: translateX(0px) rotate(0deg);
  }
  .gallery-v2__img-wrapper:hover .gallery-v2__icon-group > *:nth-child(2) {
    transform: rotate(0deg);
  }
  .gallery-v2__img-wrapper:hover .gallery-v2__icon-group > *:nth-child(3) {
    transform: rotate(0deg);
  }
}

.gallery-v2__img {
  width: 100%;
}

.gallery-v2__overlay { /* overlay layers */
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: var(--space-sm);
  background: hsla(var(--color-contrast-higher-h), var(--color-contrast-higher-s), var(--color-contrast-higher-l), 0);
  border-radius: inherit;
  opacity: 0;
  transition-duration: 0.3s;
  transition-property: opacity, background;
}

.gallery-v2__icon-bg {
  --size: 72px;
  position: absolute;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  top: calc(50% - var(--size) / 2);
  left: calc(50% - var(--size) / 2);
  background-color: var(--color-contrast-high);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s, transform 0.3s var(--ease-out);
}

.gallery-v2__icon {
  --size: 48px;
  position: absolute;
  top: calc(50% - var(--size) / 2);
  left: calc(50% - var(--size) / 2);
  color: var(--color-bg);
  opacity: 0;
  transform: translateX(-5px) rotate(-10deg);
  transition: opacity 0.3s, transform 0.3s var(--ease-out);
}

.gallery-v2__icon-group > *:is(:nth-child(2), :nth-child(3)) {
  transform-origin: 43px 24px;
  transition: transform 0.3s var(--ease-out);
}

.gallery-v2__icon-group > *:nth-child(2) {
  transform: rotate(-45deg);
}

.gallery-v2__icon-group > *:nth-child(3) {
  transform: rotate(45deg);
}

@media (min-width: 48rem) {
  .gallery-v2__gallery {
    padding-bottom: calc(0.5 * var(--gallery-v2-offset));
  }
  .gallery-v2__item:nth-child(2n) {
    position: relative;
    top: calc(0.5 * var(--gallery-v2-offset));
  }
}