.masonry {
  --item-width: 150px;
}



.masonry {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(min(var(--item-width, 200px), 100%), 1fr)
  );
  grid-template-rows: masonry;
  gap: 1rem;
  grid-auto-flow: dense;
  grid-auto-rows: 0;
  grid-template-rows: 1fr;

  > *,
  > astro-slot > * {
    align-self: start;
    grid-column-end: span var(--span, 1);
  }

  img {
    display: block;
    max-width: 100%;
    inset: 0;
    width: 100%;
    object-fit: cover;
    transition: transform 0.3s;
  }

  video,
  img {
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }
}

.box {
  display: flex;
  position: relative;
  overflow: hidden; /* sichert Inhalt */
  flex-flow: column;
  gap: 1rem;
  container-type: inline-size;
  overflow: hidden;
  background: #000;
  line-height: 0;
  border-radius: 0;
  padding: 0;
  transform: translate3d(0, 5rem, 0);
  will-change: transform;
  transition: opacity 0.6s ease, transform 0.6s ease;

  figcaption {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    font-size: clamp(0.8rem, 12cqw, 15cqw);
    font-weight: 100;
    line-height: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    align-content: center;
    position: absolute;
    inset: 0;
    padding: 1em;
    color: #fff;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    text-align: center;
    background: transparent;
    transition: all 0.4s ease-in-out;
    opacity: 0;
  }

  &:hover {
    transform: translate3d(0, 5rem, 0) scale3d(1.02, 1.02, 1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); /* 👈 Subtiler Hover-Effekt */

    figcaption {
      text-align: center;
      opacity: 1;
      backdrop-filter: blur(50px);
      text-shadow: hsla(0, 0%, 0%, .5) 0 0 .5em;
    }
  }
}

@supports not (container-type: inline-size) {
  .masonry {
    figcaption {
      font-size: .5rem; /* Fallback für ältere Browser */
    }
  }
}

.handwriting {
  width: 100%;
  display: flex;
  justify-content: center;
  align-content: center;
  margin-top: 8vw;
  margin-bottom: 2vw;

  img {
      width: 90vw;
  max-width: 900px;
  }

}