/* Albums or people to tick for one item or several, such as moving them or tagging people in them, with the item's
   thumbnail beside them where there's room and above them where there isn't */
.item-choices {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);

  > img {
    display: block;
    width: 100%;
    max-width: 180px;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: var(--radius-s);
    background-color: var(--card-bg-color);
  }

  .meta {
    margin-top: 0;
  }

  /* Albums or people fill the dialog's width in rows of 3, or 2 beside the thumbnail, and one more of each on wider
     screens */
  @media (min-width: 600px) {
    .checkbox-list {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      align-content: start;
      column-gap: var(--space-5);
    }

    &:has(> img) {
      grid-template-columns: 180px minmax(0, 1fr);
      align-items: start;

      .checkbox-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }
  }

  @media (min-width: 1000px) {
    .checkbox-list {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    &:has(> img) .checkbox-list {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
  }
}

/* Always the same height, so a dialog keeps its size whatever it shows. Past that, only the rows scroll, with half of
   the next row showing that they do. Phones have room for more rows of their single column */
.choice-list {
  --rows: 10.5;

  display: flex;
  flex-direction: column;
  height: calc(var(--rows) * (1lh + var(--space-2)));

  @media (min-width: 600px) {
    --rows: 7.5;
  }

  .checkbox-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }
}

/* Wider than other dialogs on wider screens, to fit 4 columns of albums or people */
@media (min-width: 1000px) {
  .dialog:has(.item-choices) {
    width: 960px;
  }
}

/* Doing it, at the bottom right below them */
.choice-actions {
  justify-content: flex-end;
}
