/* The library (the books page): shelves of spines or covers, the desk of
   books being read, the notes taken from a book, the catalogue of authors,
   and the book form's search. In the house's ink: no wood, no shadows —
   a spine is a line drawing, the part read is filled in. */

.form [hidden], .lookup[hidden], .lookup__results[hidden] { display: none !important; }

/* --- Head ------------------------------------------------------------------ */
.library__actions { display: flex; align-items: baseline; gap: 26px; flex-wrap: wrap; }
.libviews { display: inline-flex; gap: 14px; flex-wrap: wrap; align-items: baseline; }
.libview {
  padding: 0; border: 0; background: none; cursor: pointer; font: inherit;
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-4);
}
.libview:hover { color: var(--ink-2); }
.libview.is-current { color: var(--ink); font-weight: 600; }

.desk { display: flex; flex-direction: column; gap: 12px; }

/* --- A shelf --------------------------------------------------------------- */
.shelf { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.shelf__head { display: flex; align-items: baseline; gap: 12px; }
.shelf__name { margin: 0; text-decoration: none; }
.shelf__count { font-size: 11px; letter-spacing: .12em; color: var(--ink-4); font-variant-numeric: tabular-nums; }

/* The board: a heavy rule under the books; a shelf longer than the screen
   slides sideways, as a real one is walked along. */
.shelf__board {
  overflow-x: auto; overflow-y: hidden; padding-top: 14px;
  border-bottom: 3px solid var(--ink);
  scrollbar-width: thin; scrollbar-color: var(--ink-4) transparent;
}
.shelf__row { display: flex; align-items: flex-end; gap: 3px; width: max-content; padding: 0 2px; }

.spine {
  --w: 36px; --h: 200px; --read: 0;
  position: relative; flex: none; width: var(--w); height: var(--h);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 12px 0 10px; overflow: hidden; text-decoration: none;
  border: 1px solid var(--ink); border-bottom: 0; background: var(--paper);
  transition: transform .35s var(--ease);
}
.spine:hover, .spine:focus-visible { transform: translateY(-10px); outline: none; }
/* The part read, from the bottom up, in ink; the words over it turn white
   where it reaches them. */
.spine__fill { position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--read) * 100%); background: var(--ink); }
.spine__title, .spine__author {
  position: relative; writing-mode: vertical-rl; color: #fff; mix-blend-mode: difference;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.spine__title { font-size: 13px; font-weight: 600; letter-spacing: .02em; max-height: calc(var(--h) - 70px); }
.spine__author { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; max-height: 64px; }
.spine--want { border-style: dashed; border-color: var(--ink-3); }
.spine--archive { border-color: var(--ink-4); }
.spine--archive .spine__fill { background: var(--ink-4); }
.spine--archive .spine__title, .spine--archive .spine__author { opacity: .55; }

/* --- Covers ------------------------------------------------------------------ */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 30px 22px; }
.tile { display: flex; flex-direction: column; gap: 8px; text-decoration: none; min-width: 0; color: var(--ink); }
.tile__cover {
  aspect-ratio: 2 / 3; width: 100%; overflow: hidden; display: grid; place-items: center;
  background: var(--paper-2); color: var(--ink-3); font-size: 18px; letter-spacing: .1em;
  border: 1px solid var(--rule); transition: transform .35s var(--ease);
}
.tile__cover img { width: 100%; height: 100%; object-fit: cover; }
.tile:hover .tile__cover { transform: translateY(-6px); }
.tile--want .tile__cover { border-style: dashed; border-color: var(--ink-4); }
.tile--archive { opacity: .55; }
.tile__bar { position: relative; height: 1px; background: var(--ink-4); }
.tile__bar::after { content: ""; position: absolute; left: 0; top: -1px; height: 3px; width: calc(var(--read, 0) * 100%); background: var(--ink); }
.tile__title { font-size: 14px; font-weight: 600; line-height: 1.25; letter-spacing: -.01em; overflow-wrap: anywhere; }
.tile__author { font-size: 12px; color: var(--ink-3); margin-top: -4px; }

/* --- A book's page ------------------------------------------------------------ */
.book-head__authors { margin: -12px 0 0; font-size: 18px; color: var(--ink-2); }
.book-head__authors a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--ink-4); }
.book-head__authors a:hover { color: var(--ink); border-bottom-color: var(--ink); }

/* --- Notes ----------------------------------------------------------------------- */
.notes { display: flex; flex-direction: column; gap: 4px; }
.notes__head { display: flex; align-items: baseline; gap: 22px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 1px solid var(--rule); }
.notes__head .label { margin: 0; }
.notes__head .btn { margin-left: auto; }
.notes__list { display: flex; flex-direction: column; }
.notes__group { display: flex; flex-direction: column; padding-top: 22px; }
.notes__book { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); text-decoration: none; }
.notes__book:hover { color: var(--ink); }

.note-item { padding: 20px 0; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 10px; }
.note-item__text { margin: 0; font-size: 17px; line-height: 1.55; white-space: pre-wrap; max-width: 70ch; }
.note-item__text--quote { padding-left: 18px; border-left: 2px solid var(--ink); font-style: italic; }
.note-item__comment { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.5; color: var(--ink-2); white-space: pre-wrap; max-width: 70ch; }
.note-item__word { margin: 0; font-size: 17px; line-height: 1.5; }
.note-item__word span { color: var(--ink-2); }
.note-item__meta { display: flex; gap: 18px; align-items: baseline; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-4); }
.note-item__act { padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: var(--ink-4); letter-spacing: inherit; text-transform: inherit; }
.note-item__act:hover { color: var(--ink); }
.note-item__act--danger:hover { color: var(--wrong); }

.note-form { padding: 20px 0; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 16px; }
.note-form textarea { resize: vertical; font: inherit; line-height: 1.5; }
.note-form__text { font-size: 17px; }
.note-form--quote .note-form__text { font-style: italic; }
.note-form__foot { display: flex; align-items: baseline; gap: 22px; flex-wrap: wrap; }
.note-form__page { width: 90px; }
.note-form__foot .btn:first-of-type { margin-left: auto; }

/* --- The catalogue of authors ----------------------------------------------------- */
.catalogue { display: flex; flex-direction: column; gap: 34px; }
.catalogue__drawer { display: flex; flex-direction: column; }
.catalogue__letter { margin: 0 0 4px; font-size: 32px; font-weight: 700; letter-spacing: -.02em; line-height: 1; border-bottom: 3px solid var(--ink); padding-bottom: 8px; }
.catalogue__card { text-decoration: none; color: var(--ink); transition: transform .35s var(--ease); }
.catalogue__card:hover { transform: translateX(6px); }
.catalogue__card .entry__meta:last-child { white-space: nowrap; }

/* --- Find, in the book form ---------------------------------------------------------- */
.lookup { flex-direction: row; align-items: flex-end; gap: 18px; }
.lookup .field { flex: 1; }
.lookup__results { display: flex; flex-direction: column; max-height: 300px; overflow-y: auto; border-top: 1px solid var(--rule); }
.lookup__hit {
  display: flex; gap: 14px; align-items: center; padding: 10px 0; border: 0; border-bottom: 1px solid var(--rule);
  background: none; cursor: pointer; text-align: left; font: inherit; color: var(--ink);
}
.lookup__hit:hover { background: var(--paper-2); }
.lookup__cover { flex: none; width: 32px; height: 46px; overflow: hidden; background: var(--paper-2); }
.lookup__cover img { width: 100%; height: 100%; object-fit: cover; }
.lookup__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lookup__title { font-weight: 600; font-size: 15px; }
.lookup__meta { font-size: 12px; color: var(--ink-3); }
.lookup__note { margin: 10px 0; font-size: 14px; color: var(--ink-3); }

@media (max-width: 640px) {
  .library__actions { gap: 18px; }
  .spine:hover { transform: none; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 24px 16px; }
  .notes__head .btn { margin-left: 0; }
}
