Floor-to-ceiling bookshelf before or after carpet?
Before.   I have done both and you can certainly do it either way but it is easier (and cheaper) more sturdy to fasten and shim the bottom to the floor without carpet in the way and because of the carpet you may need to shim more.
The only argument for doing it after is &quot;I may hate these bookshelves in a few years and when I tear them down I don't want to have a flooring issue&quot;.   To add to the &quot;pro-carpet&quot; argument.   I have torn down many a bookshelf next to a fireplace.   The carpet has compression marks but this goes away after a few weeks and this carpet is basically brand-new.   Which means it probably looks out of place next to worn carpet if the area was used a lot.