.gallery,
.folder-image-grid {
  align-content: start;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(205px, 1fr));
  gap: 12px;
  min-width: 0;
}

.content-grid.has-selection .gallery,
.content-grid.has-selection .folder-image-grid {
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
}

.gallery.is-folder-view {
  display: block;
}

.folder-group + .folder-group {
  margin-top: 28px;
}

.folder-group-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  margin-bottom: 10px;
  padding: 0 2px;
  border-bottom: 1px solid var(--line);
}

.folder-group-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-group-header span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.gallery-empty {
  grid-column: 1 / -1;
  min-height: 360px;
  display: grid;
  place-items: center;
  padding: 32px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.image-card {
  align-self: start;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 140ms ease, background-color 140ms ease;
}

.image-card:hover,
.image-card:focus-within {
  background: var(--surface-2);
  border-color: var(--line-strong);
}

.image-card.is-selected,
.image-card.is-marked {
  border-color: var(--primary);
}

.image-card.is-marked {
  background: #1d2824;
}

.image-button {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.thumb-wrap {
  position: relative;
  display: grid;
  aspect-ratio: 4 / 3;
  place-items: center;
  overflow: hidden;
  background: #0b0b0b;
  border-bottom: 1px solid var(--line);
}

.thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.selection-check {
  position: absolute;
  z-index: 1;
  top: 9px;
  left: 9px;
  display: grid;
  width: 23px;
  height: 23px;
  place-items: center;
  background: #151515;
  border: 1px solid #77776f;
  border-radius: 5px;
  color: #091713;
  font-size: 15px;
  font-weight: 800;
}

.image-card.is-marked .selection-check {
  background: var(--primary);
  border-color: var(--primary);
}

.image-state {
  position: absolute;
  top: 9px;
  right: 9px;
  padding: 3px 6px;
  background: rgba(15, 15, 15, 0.9);
  border: 1px solid #4a4a46;
  border-radius: 5px;
  color: #d8d8d4;
  font-size: 11px;
}

.image-state.is-error {
  border-color: #84445a;
  color: #f0a0b7;
}

.image-meta {
  display: grid;
  gap: 5px;
  padding: 10px 11px 11px;
}

.image-name,
.image-category,
.image-foot span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-name {
  color: var(--text);
  font-weight: 650;
}

.image-category {
  color: var(--muted);
  font-size: 12px;
}

.image-foot {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--faint);
  font-size: 11px;
}

.image-foot span:last-child {
  text-align: right;
}
