/* Page 4 - the Library. Only what the shared parts in app.css do not give: the title cell of
   the list, the two small selects in the filter row, and the inside of a find's sheet.
   Every class here starts with lib-. Colours and sizes come from the tokens. */

/* ---------- The list ---------- */

.lib-find__title {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* One quiet line of the note under the title, on laptops only. */
.lib-find__line {
  display: block;
  overflow: hidden;
  font-size: 13px;
  line-height: 18px;
  font-weight: 400;
  color: var(--ink-3);
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* " comments" after the count on a phone row; the column heading says it on laptops. */
.lib-unit {
  display: none;
}

@media (min-width: 900px) {
  /* The title cell holds two lines, so it lines up with the other cells by its first one. */
  .dt__row .dt__c-find {
    padding: 8px 0;
  }
}

@media (max-width: 899.98px) {
  .lib-find__line {
    display: none;
  }

  .lib-unit {
    display: inline;
  }

  /* "0 comments" says nothing on a phone. */
  .lib-zero {
    display: none;
  }
}

/* The two selects in the filter row (shared by, tag): as tall as a chip. */
.lib-pick {
  width: auto;
  max-width: 12rem;
  min-height: 32px;
  height: 32px;
  padding: 0 28px 0 10px;
  font-size: 13px;
}

@media (max-width: 899.98px) {
  .lib-pick {
    flex: 1 1 8rem;
    max-width: none;
    min-height: 44px;
    height: 44px;
    font-size: 16px;
  }
}

.lib-more {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  padding: 12px 0 28px;
  font-size: 13px;
}

/* ---------- One find, in full ---------- */

.lib-count {
  font-weight: 400;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.lib-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.lib-link__text {
  flex: 1 1 100%;
  min-width: 0;
  -webkit-user-select: all;
  user-select: all;
  overflow-wrap: anywhere;
}

/* Wide enough for "Copied", so the row does not shift when the label changes. */
.lib-link .btn,
.lib-copy {
  min-width: 76px;
}

/* A very long name wraps instead of pushing the sheet wide. */
.lib-who {
  min-width: 0;
  max-width: 100%;
}

.lib-who__text,
.lib-thread .note__meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* The note as it was typed: line breaks kept, never HTML. */
.lib-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* The tags sit under the kind and the sharer, on a line of their own. */
.lib-taglist {
  display: flex;
  flex: 1 0 100%;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lib-taglist li {
  min-width: 0;
  max-width: 100%;
}

.lib-taglist .pill {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lib-marks {
  display: grid;
  gap: 12px;
}

.lib-marks__row {
  display: grid;
  grid-template-columns: minmax(120px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 4px 12px;
}

.lib-marks__row .chip {
  justify-self: start;
}

.lib-marks__label {
  margin: 0;
  font-weight: 500;
}

/* Who marked it: their marks, and their names beside them. */
.lib-marks__who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  min-width: 0;
}

.lib-marks__marks {
  display: flex;
  gap: 4px;
}

.lib-marks__names {
  min-width: 0;
  font-size: 13px;
  line-height: 18px;
  color: var(--ink-3);
  overflow-wrap: anywhere;
}

.lib-commentform {
  margin-top: 8px;
}

.lib-pull {
  margin-top: 2px;
}

/* Hints inside the Library's fields at full strength, so they pass AA on white. */
.lib-form .input::placeholder,
.lib-commentform .input::placeholder {
  opacity: 1;
}

.lib-manage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

/* ---------- Add or edit a find ---------- */

/* Tags already in use, to tap. A very long one is cut short rather than pushing the form wide. */
.lib-tagpicks {
  min-width: 0;
}

.lib-tagpicks .chip {
  max-width: 100%;
}

.lib-tagpicks__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lib-tagpicks .chip:disabled {
  opacity: 0.5;
  cursor: default;
}

/* On a phone the two selects share the whole row under the chips. */
@media (max-width: 899.98px) {
  .filters__actions:has(.lib-pick) {
    flex: 1 1 100%;
  }
}
