@keyframes cardFadeIn {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: scale(calc(var(--scale, 1) * 1.03));
  }
}

.card-gallery {
  text-align: center;
  padding: 3rem 2rem;
  color: #c8b7f0;
}

.card-grid {
  display: grid;
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
  -webkit-user-select: none;
  user-select: none;

  &[type="small"] {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  }
}

.card {
  position: relative;
  background-color: rgba(26, 10, 40, 0.5);
  border: .1rem solid;
  border-color: var(--md-primary-fg-color);
  corner-shape: squircle;
  border-radius: calc(2rem * var(--br-mult));
  padding: 0 2rem;
  text-decoration: none;
  transition: all 0.25s ease;
  box-shadow: 0 0 10px rgba(150, 100, 255, 0.1);
  text-shadow: 0 0 8px #00000050;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 300px;
  transition: all 200ms ease !important;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: var(--image);
    background-size: cover;
    background-repeat: repeat;
    background-position: center;
    opacity: 0;
    will-change: opacity, filter, transform;
    transform: scale(var(--scale, 1));
    border-radius: inherit;
    filter: blur(6px);
    
    transition: opacity 250ms ease, filter 250ms ease, transform 200ms ease !important;
  }

  &.loaded::before {
    opacity: 0.175;
    animation: cardFadeIn 750ms ease;
  }

  h2 {
    margin-top: 0;
    margin-bottom: 0;
    color: #dcc0ff;
    font-size: 1.25rem;
    font-variation-settings: 'wght' 500;
    text-shadow: 0 0 8px #00000050;
    transition: all 200ms ease !important;
  }

  .date {
    color: #816da5ff;
    font-size: 0.8rem;
    margin-top: 0;
    margin-bottom: 0;
    text-shadow: 0 0 8px #00000050;
  }

  p {
    margin-bottom: 0.1rem;
    color: #b298e2;
    font-size: 0.9rem;
    font-variation-settings: 'wght' 350;
    text-shadow: 0 0 8px #00000050;
    transition: all 200ms ease !important;
  }

  &:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 24px rgba(123, 0, 255, 0.69);
    color: #ffffff;
    text-shadow: 0 0 8px #000000aa;

    h2 {
      color: #ffffff;
      text-shadow: 0 0 8px #000000aa;
    }

    p {
      color: #ffffff;
      text-shadow: 0 0 8px #000000aa;
    }

    &::before {
      opacity: 0.22;
      /*filter: blur(5px);*/
      /*transform: scale(calc(var(--scale, 1) * 1.025));*/
    }
  }

  &.hidden {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .card-gallery {
    padding: 2rem 1rem;
  }

  .card {
    padding: 1.5rem;

    h2 {
      font-size: 1.05rem;
    }
    .date {
      font-size: 0.65rem;
    }
    p {
      font-size: 0.75rem;
    }
  }
}

