/* Library, rebuilt in the family design (docs/design/FAMILY.md). views/library.js draws it.
   One loud thing: the saved posts, with their covers. The rest is quiet: a title, two segments, a row of
   chips. A list is rows with hairlines inside one frost surface, never a stack of cards.
   Tokens only (family.css); a post's cover comes from Discover (BS_DX.cover, styled in discover.css). */

#main-content > [data-viewpanel="library"] { max-width: 860px !important; margin-left: auto; margin-right: auto; }

.lb { display: flex; flex-direction: column; gap: 22px; padding-bottom: 48px; color: var(--color-foreground); }
:where(.lb) :where(h1, h2, p, ul) { margin: 0; }
.lb ul { padding: 0; list-style: none; }

/* ── head: the title, one line, the two segments ── */
.lb-head h1 { font-size: 32px; font-weight: 600; letter-spacing: -.022em; line-height: 1.1; }
.lb-head p { margin-top: 8px; font-size: 15px; line-height: 1.5; color: var(--color-muted-foreground); }
#libTabs.lb-tabs { align-self: flex-start; margin: 0; max-width: 100%; }
#libTabs.lb-tabs [role="tab"] { gap: 7px; height: 38px; padding: 0 16px; font-size: 14px; }
#libTabs.lb-tabs [role="tab"] > i { display: none; }
#libTabs.lb-tabs [role="tab"] > span { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--color-muted-foreground); }
#libTabs.lb-tabs [role="tab"][aria-selected="true"] > span { color: var(--color-brand-ink); }

.lb-pane { display: flex; flex-direction: column; gap: 16px; }
.lb-pane.hidden, .lb-colls:empty, .lb-colls.hidden { display: none; }
.lb-follow { display: flex; flex-direction: column; gap: 32px; }

/* ── chips: what kind of post ── */
.lb-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.lb-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--frost-line); border-radius: 999px; background: var(--frost-strong); box-shadow: var(--frost-rim); font-size: 13.5px; font-weight: 500; color: var(--oryn-text-2); white-space: nowrap; transition: background-color .18s var(--ease-out), color .18s var(--ease-out), border-color .18s var(--ease-out); }
.lb-chip:hover { border-color: var(--oryn-border-hover); color: var(--color-foreground); }
.lb-chip small { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--color-muted-foreground); }
.lb-chip[aria-pressed="true"] { border-color: color-mix(in srgb, var(--color-brand) 45%, transparent); background: var(--brand-soft); box-shadow: none; color: var(--color-brand-ink); font-weight: 600; }
.lb-chip[aria-pressed="true"] small { color: color-mix(in srgb, var(--color-brand-ink) 70%, transparent); }

/* ── the list: one surface, rows, hairlines ── */
.lb-list { padding: 6px; border: 1px solid var(--frost-line); border-radius: 24px; background: var(--frost); box-shadow: var(--frost-rim), var(--frost-shadow); }
.lb-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border-radius: 18px; transition: background-color .18s var(--ease-out); }
.lb-row + .lb-row::before, .lb-person + .lb-person::before { content: ''; position: absolute; top: 0; right: 14px; height: 1px; background: var(--frost-line); transition: opacity .18s var(--ease-out); }
.lb-row + .lb-row::before { left: 122px; }
.lb-row__open { display: grid; grid-template-columns: 92px minmax(0, 1fr); align-items: center; gap: 16px; min-width: 0; padding: 12px 8px 12px 14px; border-radius: 18px; text-align: left; }
.lb-row .dx-cover { width: 92px; aspect-ratio: 4 / 3; border-radius: 12px; }
.lb-row .dx-cover__word { display: none; }
.lb-row__text { min-width: 0; }
.lb-row__title { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 15.5px; font-weight: 550; line-height: 1.32; letter-spacing: -.006em; text-wrap: pretty; }
.lb-row__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 6px; font-size: 12.5px; color: var(--color-muted-foreground); }
.lb-kind { display: inline-flex; align-items: center; gap: 5px; }
.lb-kind i { font-size: 13px; }
/* the remove button: there on hover, on focus and on any screen that has no hover */
.lb-x { display: grid; flex: none; width: 36px; height: 36px; margin: 0 12px 0 4px; place-items: center; border-radius: 50%; color: var(--color-muted-foreground); opacity: 0; transition: opacity .16s var(--ease-out), background-color .16s var(--ease-out), color .16s var(--ease-out); }
.lb-x i { font-size: 16px; }
.lb-x:hover { background: var(--frost-well); color: var(--color-foreground); }
.lb-row:has(:focus-visible) .lb-x, .lb-x--save { opacity: 1; }
.lb-x--save { border: 1px solid var(--frost-line); background: var(--frost-strong); box-shadow: var(--frost-rim); color: var(--oryn-text-2); }
.lb-x--save:hover { border-color: var(--oryn-border-hover); background: var(--frost-strong); color: var(--color-brand-ink); }
.lb-x--save i { font-size: 17px; }
@media (hover: hover) {
  .lb-row:hover { background: var(--oryn-surface-hover); }
  .lb-row:hover .lb-x { opacity: 1; }
  .lb-row:hover .dx-cover img { scale: 1.05; }
  .lb-row:hover::before, .lb-row:hover + .lb-row::before { opacity: 0; }
}
@media (hover: none) { .lb-x { opacity: 1; } }
@supports not selector(:has(*)) { .lb-row:focus-within .lb-x { opacity: 1; } }

/* ── a section inside a pane ── */
.lb-sec > header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.lb-sec h2 { font-size: 19px; font-weight: 600; letter-spacing: -.012em; }
.lb-sec > header span { font-size: 13px; color: var(--color-muted-foreground); }
.lb-empty + .lb-sec { margin-top: 16px; }
.lb-line { font-size: 14.5px; line-height: 1.55; color: var(--color-muted-foreground); }
.lb-link { display: inline-block; color: var(--color-foreground); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--color-foreground) 30%, transparent); text-underline-offset: 3px; border-radius: 4px; transition: text-decoration-color .15s var(--ease-out); }
.lb-link:hover { text-decoration-color: currentColor; }

/* ── topics: the name, the days it was written on, a way out ── */
.lb-topics { display: flex; flex-wrap: wrap; gap: 10px; }
.lb-topic { display: inline-flex; align-items: stretch; max-width: 100%; border: 1px solid var(--frost-line); border-radius: 14px; background: var(--frost-strong); box-shadow: var(--frost-rim); white-space: nowrap; transition: border-color .18s var(--ease-out); }
.lb-topic:hover { border-color: var(--oryn-border-hover); }
.lb-topic__open { display: inline-flex; align-items: center; gap: 12px; min-width: 0; height: 44px; padding: 0 6px 0 16px; border-radius: 13px 0 0 13px; font-size: 14px; font-weight: 550; }
.lb-topic__open small { font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; color: var(--color-muted-foreground); }
.lb-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 18px; }
.lb-bars i { width: 3px; min-height: 2px; border-radius: 2px; background: color-mix(in srgb, var(--color-foreground) 22%, transparent); }
.lb-bars i.on { background: var(--color-brand); }
.lb-topic__x { display: grid; width: 40px; place-items: center; border-radius: 0 13px 13px 0; color: var(--color-muted-foreground); transition: color .15s var(--ease-out), background-color .15s var(--ease-out); }
.lb-topic__x i { font-size: 14px; }
.lb-topic__x:hover { background: var(--oryn-surface-hover); color: var(--color-foreground); }

/* ── people: rows with the app's follow button ── */
.lb-person { position: relative; display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 18px; }
.lb-person + .lb-person::before { left: 72px; }
.lb-face { display: block; width: 44px; height: 44px; border-radius: 50%; }
.lb-face > *, .lb-pic { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.lb-ini { font-size: 14px; }
.lb-face--none { display: grid; place-items: center; background: var(--color-muted); box-shadow: inset 0 0 0 1px var(--frost-line); font-size: 14px; font-weight: 600; color: var(--color-muted-foreground); }
.lb-person__who { min-width: 0; border-radius: 8px; text-align: left; }
.lb-person__who b { display: block; overflow: hidden; font-size: 15px; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.lb-person__who span { display: block; overflow: hidden; margin-top: 2px; font-size: 12.5px; color: var(--color-muted-foreground); text-overflow: ellipsis; white-space: nowrap; }
.lb-person__who:hover b { text-decoration: underline; text-underline-offset: 3px; }

/* ── the empty library: one sentence and the way to Discover ── */
.lb-empty { display: grid; justify-items: center; gap: 18px; padding: 64px 24px; border: 1px dashed var(--frost-line); border-radius: 24px; text-align: center; }
.lb-empty p { max-width: 44ch; font-size: 15px; line-height: 1.55; color: var(--color-muted-foreground); text-wrap: pretty; }

/* ── while the posts arrive ── */
.lb-row--sk { grid-template-columns: 92px minmax(0, 1fr); gap: 16px; padding: 12px 14px; }
.lb-sk { display: block; border-radius: 8px; }
.lb-sk--pic { width: 92px; aspect-ratio: 4 / 3; border-radius: 12px; }
.lb-sk__lines { display: grid; gap: 10px; }
.lb-sk--a { width: min(380px, 80%); height: 14px; }
.lb-sk--b { width: 140px; height: 10px; }

/* ── phones ── */
@media (max-width: 899.98px) {
  .lb { gap: 18px; }
  .lb-head h1 { font-size: 27px; }
  .lb-list { padding: 4px; border-radius: 20px; }
  .lb-row__open { grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 10px 4px 10px 10px; }
  .lb-row .dx-cover { width: 76px; border-radius: 10px; }
  .lb-row + .lb-row::before { left: 98px; }
  .lb-row__title { font-size: 15px; -webkit-line-clamp: 3; }
  .lb-x { width: 44px; height: 44px; margin: 0 4px 0 0; }
  .lb-person { gap: 12px; padding: 10px; }
  .lb-person__who span { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.4; white-space: normal; }
  .lb-person + .lb-person::before { left: 66px; }
  .lb-empty { padding: 48px 20px; }
  .lb-sec > header { flex-wrap: wrap; gap: 2px 16px; }
  .lb-topic__open { padding-left: 14px; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .lb-row, .lb-x, .lb-chip, .lb-topic, .lb-row .dx-cover img { transition: none; }
}
html.a11y-reduce-motion .lb-row, html.a11y-reduce-motion .lb-x, html.a11y-reduce-motion .lb-chip, html.a11y-reduce-motion .lb-topic, html.a11y-reduce-motion .lb-row .dx-cover img { transition: none; }
