/* Filament FilePond: compact image gallery (visible thumbs + click-to-open). */
.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] {
  min-height: 0;
}

.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  left: 0 !important;
  right: 0 !important;
}

.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--item {
  width: 7.25rem !important;
  height: 7.25rem !important;
  margin: 0 !important;
  max-width: 7.25rem;
  position: relative;
  cursor: zoom-in;
}

.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--item > .filepond--panel {
  border-radius: 0.55rem;
}

.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--file-wrapper,
.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--image-preview-wrapper {
  height: 7.25rem !important;
  inset: 0 !important;
}

.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--image-preview {
  height: 7.25rem !important;
  background: transparent;
}

.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--image-preview-overlay,
.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--image-preview-overlay-idle {
  display: none;
}

.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--image-clip {
  inset: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  height: 100% !important;
  overflow: hidden;
  border-radius: 0.55rem;
}

/* FilePond scales preview via transform — force fill the thumb. */
.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--image-preview img,
.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--image-clip img,
.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--image-bitmap {
  object-fit: cover !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  left: 0 !important;
  top: 0 !important;
  transform: none !important;
}

.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--file-info {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  transform: none !important;
  pointer-events: none;
}

.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--file-info-main,
.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--file-info-sub {
  pointer-events: none;
  font-size: 0.7rem;
  line-height: 1.1;
}

.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--item-panel {
  background-color: rgba(15, 23, 42, 0.92);
}

.dark .fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--item-panel {
  background-color: rgba(2, 6, 23, 0.95);
}

/* Invisible full-thumb hit target (Filament openable link). */
.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--open-icon {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  opacity: 0 !important;
  z-index: 4;
  cursor: zoom-in;
  pointer-events: auto !important;
  background: transparent !important;
  box-shadow: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
}

/* Keep remove button clickable above the open overlay. */
.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] .filepond--action-remove-item,
.fi-fo-file-upload--gallery .filepond--root[data-style-panel-layout~='grid'] [data-filepond-item-action='remove'] {
  position: relative;
  z-index: 5;
  pointer-events: auto !important;
}

/* In-page lightbox for gallery thumbs. */
.fi-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(2, 6, 23, 0.86);
  cursor: zoom-out;
}

.fi-gallery-lightbox[hidden] {
  display: none !important;
}

.fi-gallery-lightbox__img {
  max-width: min(96vw, 1100px);
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  cursor: default;
}

.fi-gallery-lightbox__close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 2.5rem;
  height: 2.5rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}

.fi-gallery-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.22);
}
