/* Free Reference Library (registry 9695). One screen: the page never scrolls; the list and the reader scroll inside
   their own panels with hidden scrollbars. Type 13/15/20/28, weights 400/600, 16 px cards, ivory, ink, gold. */
html:has(body.pg-library), body.pg-library { overflow: hidden; height: 100%; }
body.pg-library main { padding: 0; margin: 0; }
.lib { --ivory: #fbf8f1; --ink: #1d1c18; --ink2: #5b584f; --rule: rgba(29,28,24,.12); --gold: #b8892b;
  position: fixed; left: 0; right: 0; top: var(--lib-top, 78px); bottom: var(--cfc-fp-h, 32px); z-index: 2;
  display: grid; grid-template-columns: minmax(320px, 420px) 1fr; gap: 16px; padding: 8px 16px 8px;
  font-size: 15px; line-height: 1.45; color: var(--ink); }
.lib *, .lib *::before { box-sizing: border-box; }
.lib-list, .lib-reader { min-height: 0; display: flex; flex-direction: column; background: rgba(255,255,255,.86);
  border: 1px solid var(--rule); border-radius: 16px; box-shadow: 0 2px 12px rgba(29,28,24,.06); overflow: hidden; }
.lib-head { padding: 16px 16px 8px; border-bottom: 1px solid var(--rule); }
.lib-head h1 { font-size: 28px; line-height: 1.15; font-weight: 600; margin: 0 0 8px; letter-spacing: -.01em; }
.lib-intro { font-size: 13px; color: var(--ink2); margin: 0 0 4px; max-width: 68ch; }
.lib-count { font-size: 13px; font-weight: 600; color: var(--gold); margin: 0 0 8px; }
.lib-pills { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
.lib-pills::-webkit-scrollbar, .lib-scroll::-webkit-scrollbar, .rd-view::-webkit-scrollbar { display: none; }
.lib .pill { flex: none; height: 32px; padding: 0 12px; border-radius: 16px; border: 1px solid var(--rule); background: #fff;
  font: inherit; font-size: 13px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.lib .pill span { color: var(--ink2); }
.lib .pill.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.lib .pill.on span { color: #e8d3a3; }
.lib-scroll { flex: 1; min-height: 0; overflow: auto; scrollbar-width: none; padding: 8px 16px 16px; }
.lib-group h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink2); margin: 16px 0 8px; }
.lib-group ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lib .doc { border: 1px solid var(--rule); border-radius: 12px; background: #fff; padding: 8px 12px; }
.lib .doc.on { border-color: var(--gold); box-shadow: inset 3px 0 0 var(--gold); }
.lib .doc-open { display: block; width: 100%; text-align: start; background: none; border: 0; padding: 0; font: inherit; color: inherit; }
.lib button.doc-open { cursor: pointer; }
.lib .doc-t { display: block; font-weight: 600; font-size: 15px; }
.lib .doc-m, .lib .doc-s { display: block; font-size: 13px; color: var(--ink2); }
.lib .tag { font-weight: 600; color: var(--ink2); }
.lib .tag-in { color: #2f7d4f; }
.lib .doc-l, .lib .doc-x { font-size: 13px; color: var(--ink2); margin: 4px 0 0; }
.lib .doc a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 2px; }
.lib .doc-x a + a { margin-inline-start: 12px; }
.rd-bar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--rule); }
.rd-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rd-title b { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-title small { font-size: 13px; color: var(--ink2); }
.rd-ctl { display: flex; align-items: center; gap: 4px; flex: none; }
.lib .ib { width: 36px; height: 36px; display: inline-grid; place-items: center; border: 1px solid var(--rule); border-radius: 10px;
  background: #fff; color: var(--ink); cursor: pointer; padding: 0; }
.lib .ib svg { width: 16px; height: 16px; }
.lib .ib:disabled { opacity: .35; cursor: default; }
.lib .ib:focus-visible, .lib .pill:focus-visible, .lib .doc-open:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[dir=rtl] .lib .ib svg { transform: scaleX(-1); }
.rd-back { display: none !important; }
.rd-pg { font-size: 13px; color: var(--ink2); display: inline-flex; align-items: center; gap: 4px; margin: 0 4px; }
.rd-pg input { width: 52px; height: 32px; border: 0; border-bottom: 1px solid var(--rule); background: #f6f3ea; border-radius: 6px 6px 0 0;
  text-align: center; font: inherit; font-size: 13px; color: var(--ink); -moz-appearance: textfield; }
.rd-pg input::-webkit-inner-spin-button { -webkit-appearance: none; }
.rd-lic { font-size: 13px; color: var(--ink2); margin: 0; padding: 4px 12px; border-bottom: 1px solid var(--rule); min-height: 0; }
.rd-lic:empty { display: none; }
.rd-lic a { color: var(--ink); text-decoration-color: var(--gold); }
.rd-view { flex: 1; min-height: 0; overflow: auto; scrollbar-width: none; background: #eeeae0; display: flex; justify-content: center;
  align-items: flex-start; padding: 12px; }
.rd-view canvas { display: block; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); max-width: none; }
.rd-empty { margin: auto; font-size: 15px; color: var(--ink2); text-align: center; max-width: 40ch; }
@media (max-width: 860px) {
  .lib { grid-template-columns: 1fr; padding: 8px; }
  .lib-head h1 { font-size: 24px; }
  .lib-reader { display: none; }
  .lib.reading .lib-list { display: none; }
  .lib.reading .lib-reader { display: flex; }
  .rd-back { display: inline-grid !important; }
  .rd-bar { flex-wrap: wrap; }
  .rd-ctl { width: 100%; justify-content: space-between; }
  #rd-fit { display: none; }
}
@media (prefers-reduced-motion: no-preference) { .lib .doc, .lib .pill { transition: border-color .15s, background .15s; } }
