/* derekjperna.com — gamified hero gallery (v1 drag · v2 zoom · v3 search @ 50+) */

.hero-gallery {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  pointer-events: auto;
}

.hero-gallery-pile {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-gallery-pile--dimmed .hero-gallery-card:not(.hero-gallery-card--zoomed) {
  opacity: 0.28;
  filter: blur(1px);
}

.hero-gallery-card {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--card-w, 100px);
  margin-left: calc(var(--card-w, 100px) / -2);
  margin-top: calc(var(--card-h, 150px) / -2);
  transform: translate(var(--tx, 0px), var(--ty, 0px)) rotate(var(--rot, 0deg));
  transition: opacity 0.25s ease, filter 0.25s ease, transform 0.2s ease;
  cursor: grab;
  z-index: var(--z, 1);
  will-change: transform;
}

.hero-gallery-card:active {
  cursor: grabbing;
}

.hero-gallery-card img {
  width: 100%;
  height: auto;
  display: block;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.65);
  pointer-events: none;
  border-radius: 2px;
}

.hero-gallery-card--dragging {
  z-index: 50 !important;
  transition: none;
}

.hero-gallery-card--bump {
  transition: transform 0.14s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.hero-gallery-card--bump:not(.hero-gallery-card--dragging) {
  transform: translate(var(--tx, 0px), var(--ty, 0px)) rotate(var(--rot, 0deg)) scale(1.04);
}

.hero-gallery-card--hidden {
  opacity: 0.08 !important;
  pointer-events: none !important;
  filter: blur(2px);
}

.hero-gallery-card--match {
  opacity: 1 !important;
  z-index: 20 !important;
}

.hero-gallery-card--zoomed {
  z-index: 100 !important;
  cursor: zoom-out;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.25s ease;
}

.hero-gallery--v2 .hero-gallery-card--zoomed,
.hero-gallery--v3 .hero-gallery-card--zoomed {
  transform: translate(var(--tx, 0px), var(--ty, 0px)) rotate(0deg) scale(3);
}

.hero-gallery--v3 .hero-gallery-card {
  width: var(--card-w, 56px);
  margin-left: calc(var(--card-w, 56px) / -2);
}

.hero-gallery--v3.hero-gallery--dense-mid .hero-gallery-card {
  --card-w: 72px;
}

.hero-gallery-search {
  position: absolute;
  top: 5.5rem;
  right: 1.25rem;
  left: 1.25rem;
  z-index: 30;
  display: flex;
  justify-content: flex-end;
  pointer-events: none;
}

.hero-gallery-search input {
  pointer-events: auto;
  width: min(220px, 100%);
  padding: 0.45rem 0.75rem;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--parchment, #f5f0e8);
  background: rgba(14, 13, 11, 0.82);
  border: 1px solid rgba(184, 151, 58, 0.35);
  border-radius: 4px;
  outline: none;
}

.hero-gallery-search input::placeholder {
  color: rgba(245, 240, 232, 0.45);
}

.hero-gallery-search input:focus {
  border-color: var(--gold-light, #d4af5a);
}

.hero-gallery-hint {
  position: absolute;
  bottom: 1rem;
  left: 0;
  right: 0;
  z-index: 25;
  text-align: center;
  font-family: var(--sans, system-ui, sans-serif);
  font-size: 0.58rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(245, 240, 232, 0.42);
  pointer-events: none;
}

.hero-gallery--v1 .hero-gallery-hint {
  content: "Drag the covers";
}

@media (max-width: 768px) {
  .hero-gallery-search {
    top: 4.5rem;
    justify-content: center;
  }

  .hero-gallery-hint {
    font-size: 0.52rem;
    padding: 0 1rem;
  }

  .hero-gallery--v2 .hero-gallery-card--zoomed,
  .hero-gallery--v3 .hero-gallery-card--zoomed {
    transform: translate(var(--tx, 0px), var(--ty, 0px)) rotate(0deg) scale(2.2);
  }
}