/* the column minimum keeps four covers in a 976 px container, like the dFlip-based versions */
.pdflip-gallery {
  --pdflip-gallery-column: 13rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--pdflip-gallery-column)), 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pdflip-gallery-item a {
  display: block;
  color: inherit;
  text-decoration: none;
}

.pdflip-gallery-cover-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* one format for all covers, so rows line up even when the PDFs differ */
.pdflip-gallery-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 0.707;
  object-fit: cover;
  background: #eee;
  box-shadow: 0 2px 10px rgb(0 0 0 / 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
}

.pdflip-gallery-item a:hover .pdflip-gallery-cover,
.pdflip-gallery-item a:focus-visible .pdflip-gallery-cover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.25);
}

.pdflip-gallery-title {
  overflow-wrap: anywhere;
}

/* title on the lower edge of the cover, shown while pointed at or focused */
.pdflip-gallery--title-hover .pdflip-gallery-cover-frame {
  overflow: hidden;
}

.pdflip-gallery--title-hover .pdflip-gallery-title {
  position: absolute;
  inset: auto 0 0;
  padding: 0.35rem 0.5rem;
  background: rgb(40 40 40 / 0.85);
  color: #fff;
  font-size: 0.8125rem;
  text-align: center;
  opacity: 0;
  transform: translateY(100%);
  transition: opacity 0.3s, transform 0.3s;
}

.pdflip-gallery--title-hover a:hover .pdflip-gallery-title,
.pdflip-gallery--title-hover a:focus-visible .pdflip-gallery-title {
  opacity: 1;
  transform: none;
}

.pdflip-gallery-item a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .pdflip-gallery-cover,
  .pdflip-gallery-title {
    transition: none;
  }
}
