/* OpenWellM v36: dual workspace and editorial library. */
:root { --sidebar: 272px; --sidebar-compact: 82px; }
.home-scroll { grid-template-columns: minmax(0, 1fr); }
.home-scroll > section { min-width: 0; }
#sidebar { min-width: 0; min-height: 0; overflow: visible !important; }
#sidebar:not(.is-compact) { width: var(--sidebar) !important; height: 100svh !important; padding: 18px 14px !important; gap: 14px !important; }
#sidebar.is-compact { width: var(--sidebar-compact) !important; height: 100svh !important; padding: 18px 10px !important; gap: 14px !important; }
#sidebar > .side-top { position: static !important; width: 100% !important; height: 42px; min-height: 42px; flex-shrink: 0; gap: 10px !important; margin: 0 !important; }
#sidebar .sidebar-toggle { width: 42px !important; height: 42px !important; flex: 0 0 42px !important; }
#sidebar:not(.is-compact) .sidebar-home-brand { width: 186px !important; max-width: calc(100% - 52px) !important; height: 42px !important; padding: 5px 9px !important; font-size: 17px !important; }
#sidebar > .workspace-modes { flex-shrink: 0; margin: 0; }
#sidebar .chat-sidebar, #sidebar .library-sidebar { min-width: 0; min-height: 0; flex: 1 1 0; overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; overscroll-behavior: contain; }
#sidebar .chat-sidebar { display: flex; flex-direction: column; gap: 14px; }
#sidebar .chat-sidebar > *, #sidebar .library-sidebar > * { flex-shrink: 0; }
#sidebar > .profile { position: relative !important; inset: auto !important; display: flex !important; flex: 0 0 56px; min-height: 56px !important; height: 56px !important; margin-top: 0 !important; }
#sidebar.is-compact > .profile { align-self: center; }
.workspace-modes { display: flex; gap: 4px; padding: 4px; background: var(--soft); border: 1px solid var(--line); border-radius: 12px; flex-shrink: 0; }
.workspace-mode { display: flex; align-items: center; justify-content: center; gap: 7px; flex: 1; min-width: 0; min-height: 39px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 650; }
.workspace-mode svg, .library-search svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.workspace-mode.is-selected { background: var(--surface); color: var(--ink); box-shadow: 0 2px 5px #14394c0c; }
.workspace-mode:hover { color: var(--cyan); }
.sidebar.is-compact .workspace-modes { flex-direction: column; padding: 3px; margin: 6px 0; }
.sidebar.is-compact .workspace-mode { flex-direction: column; padding: 7px 0; gap: 3px; font-size: 10px; }
.library-sidebar { display: none; }
body[data-mode="library"] #sidebar .library-sidebar { display: flex; flex-direction: column; }
body[data-mode="library"] #sidebar .chat-sidebar { display: none !important; }
body[data-mode="library"] .main > .view,
body[data-mode="library"] .main > .answer-view { display: none !important; }
body[data-mode="library"] .top-actions #modelStatusPicker { display: none !important; }
body[data-mode="library"] .main { min-width: 0; background: var(--surface); }
.library-side-label { margin: 6px 12px 12px; color: var(--muted); font-size: 10px; letter-spacing: .12em; }
.library-navigation { display: grid; gap: 5px; }
.library-nav-section-label { margin: 16px 10px 5px; padding-top: 13px; border-top: 1px solid var(--line); color: #66828f; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.library-nav-admin { display: grid; gap: 3px; padding: 3px 12px 6px; }
.library-nav-admin a, .library-content-admin a { display: inline-flex; align-items: center; justify-content: space-between; gap: 8px; width: fit-content; min-height: 34px; color: #087f8b; font-size: 11px; font-weight: 700; text-decoration: none; }
.library-nav-admin a:hover, .library-content-admin a:hover { text-decoration: underline; text-underline-offset: 3px; }
.library-nav-admin a:focus-visible, .library-content-admin a:focus-visible { outline: 3px solid #00a6b8; outline-offset: 3px; border-radius: 3px; }
.library-nav-admin small, .library-content-admin small { color: var(--muted); font-size: 10px; line-height: 1.5; }
.library-content-admin { display: grid; gap: 2px; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.library-nav-item { width: 100%; display: flex; gap: 10px; align-items: center; min-height: 43px; padding: 9px 12px; color: #526776; background: transparent; border: 0; border-radius: 8px; font-size: 13px; text-align: left; white-space: nowrap; }
.library-nav-symbol { display: inline-flex; justify-content: center; align-items: center; flex-shrink: 0; width: 20px; font-size: 19px; font-weight: 400; }
.library-nav-item small { margin-left: auto; color: #8da0a9; font-size: 10px; font-variant-numeric: tabular-nums; }
.library-nav-item:hover { background: var(--soft); color: var(--ink); }
.library-nav-item.is-selected { color: #087b83; background: #e1f1ef; font-weight: 700; }
.library-side-divider { height: 1px; margin: 21px 12px 13px; background: var(--line); flex-shrink: 0; }
.library-source-note { margin: auto 12px 0; padding-top: 36px; }
.library-source-note > span { color: #60858c; font-size: 11px; }
.library-source-note p { color: var(--muted); font-size: 11px; line-height: 1.9; margin: 8px 0 16px; }
.sidebar.is-compact .library-side-label, .sidebar.is-compact .library-source-note, .sidebar.is-compact .library-nav-item > span:not(.library-nav-symbol), .sidebar.is-compact .library-nav-item small { display: none; }
.sidebar.is-compact .library-nav-item { justify-content: center; padding: 9px 0; }
.sidebar.is-compact .library-side-divider { margin: 12px 4px; }
.library-page { max-width: 1600px; margin: auto; padding: 29px clamp(24px, 3.5vw, 66px) 28px; color: var(--ink); }
.library-page[hidden] { display: none !important; }
.library-breadcrumb { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 11px; min-height: 28px; padding-right: 100px; }
.library-breadcrumb > span:first-child { color: var(--ink); font-weight: 700; }
.library-breadcrumb i { font-style: normal; color: #b8c8cc; }
.library-edition { margin-left: auto; font-size: 10px; letter-spacing: .07em; }
.library-masthead { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 37px 0 29px; }
.library-eyebrow { margin: 0 0 10px; color: #58848b; font-size: 9px; font-weight: 700; letter-spacing: .18em; line-height: 1.5; }
.library-masthead h1 { font-size: clamp(32px, 3.1vw, 48px); margin: 0; letter-spacing: -.05em; line-height: 1.25; font-weight: 750; }
.library-masthead h1 span { color: #11a59c; }
.library-intro { margin: 12px 0 0; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.library-search { width: 280px; max-width: 100%; margin-bottom: 4px; }
.library-search label { display: block; margin-bottom: 8px; font-size: 10px; color: var(--muted); }
.library-search > div { display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #95afb6; padding: 9px 0; color: #698690; }
.library-search input { width: 100%; min-width: 0; padding: 0; border: 0; outline: none; font-size: 12px; color: var(--ink); background: transparent; }
.library-search > div:focus-within { border-color: #078b91; box-shadow: 0 1px #078b91; }
.library-search kbd { font: inherit; font-size: 11px; border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; }
.library-fields { display: flex; align-items: center; gap: clamp(16px, 2.5vw, 36px); border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.library-fields button { flex-shrink: 0; padding: 16px 0 15px; border: 0; border-bottom: 3px solid transparent; margin-bottom: -1px; background: transparent; color: #6b7d87; font-size: 12px; }
.library-fields button.is-selected { color: #07838b; border-bottom-color: #079b9f; font-weight: 700; }
.library-fields > span { margin-left: auto; color: #95a4ab; font-size: 9px; white-space: nowrap; }
.library-spotlight { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr) minmax(155px, .66fr); gap: 28px; padding-bottom: 30px; align-items: start; }
.library-spotlight[hidden] { display: none; }
.library-feature { position: relative; min-height: 0; background: transparent; color: var(--ink); }
.library-feature > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.library-feature::after { content: ""; position: absolute; inset: 0; background: linear-gradient(0deg, #052d35fa 0%, #062e35db 25%, #062e3518 85%); pointer-events: none; }
.library-feature:not(.has-source-media)::after { display: none; }
.library-feature-copy { padding: 19px 0 0; width: 100%; }
.library-feature-tag { position: absolute; top: 18px; left: 20px; z-index: 1; font-size: 9px; font-weight: 700; letter-spacing: .14em; padding: 6px 9px; border: 1px solid #c8f6e24f; color: #d1f7ea; }
.library-feature-credit { position: absolute; right: 12px; top: 19px; font-size: 8px; color: #c5e1df; z-index: 1; }
.library-feature .library-item-meta { color: #0a858b; }
.library-feature h2 { font-size: clamp(20px, 2vw, 30px); font-weight: 650; line-height: 1.5; margin: 12px 0; letter-spacing: -.02em; }
.library-title-button { all: unset; cursor: pointer; display: inline; }
.library-title-button:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.library-feature-copy > p { margin: 0; font-size: 12px; line-height: 1.9; color: var(--muted); }
.library-feature-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; font-size: 10px; color: var(--muted); }
.library-feature-bottom button { background: none; color: #0a858b; border: 0; padding: 0; font-size: 11px; }
.library-editors { display: flex; flex-direction: column; }
.library-column-label { font-size: 10px; font-weight: 700; margin: 0 0 18px; padding-bottom: 11px; border-bottom: 1px solid var(--ink); display: flex; justify-content: space-between; }
.library-column-label > span { color: var(--muted); font-size: 9px; font-weight: 400; }
.library-editor-item { padding-bottom: 24px; }
.library-editor-item + .library-editor-item { border-top: 1px solid var(--line); padding-top: 18px; padding-bottom: 0; }
.library-item-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: #0a858b; font-size: 9px; font-weight: 600; line-height: 1.7; }
.library-item-meta i { width: 1px; height: 9px; background: currentColor; opacity: .35; }
.library-editor-item h3 { font-size: 17px; line-height: 1.65; margin: 9px 0; letter-spacing: -.02em; }
.library-editor-item p { font-size: 11px; line-height: 1.85; color: var(--muted); margin: 0 0 10px; }
.library-small-date { font-size: 9px; color: var(--muted); }
.library-journals { border-left: 1px solid var(--line); padding-left: 24px; }
.library-journal-link { display: block; color: var(--ink); text-decoration: none; padding: 13px 0; border-bottom: 1px solid var(--line); }
.library-journal-link b { display: flex; justify-content: space-between; align-items: center; font-family: Georgia, 'Times New Roman', serif; font-size: 19px; letter-spacing: -.025em; font-weight: 600; }
.library-journal-link b span { font: 12px sans-serif; color: var(--muted); }
.library-journal-link small { display: block; color: var(--muted); font-size: 9px; margin-top: 6px; }
.library-journal-link:hover b { color: #008d95; }
.library-journal-note { font-size: 10px; line-height: 1.8; color: var(--muted); margin: 18px 0 0; }
.library-body-grid { display: grid; grid-template-columns: minmax(0, 1fr) 225px; gap: 38px; border-top: 3px solid var(--ink); padding-top: 23px; }
.library-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 15px; }
.library-section-heading .library-eyebrow { margin-bottom: 5px; font-size: 8px; }
.library-section-heading h2 { margin: 0; font-size: 23px; letter-spacing: -.03em; line-height: 1.5; }
.library-sort { display: flex; align-items: center; gap: 8px; font-size: 10px; color: var(--muted); white-space: nowrap; }
.library-sort select { border: 0; background: transparent; color: var(--ink); padding: 8px 0; font-size: 10px; max-width: 130px; }
.library-sort option { color: var(--ink); background: var(--surface); }
.library-results-meta { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 2px; padding-bottom: 12px; border-bottom: 1px solid var(--ink); color: var(--muted); font-size: 10px; }
.library-results-meta button { border: 0; background: none; padding: 3px 0; font-size: 10px; color: #36878d; }
.library-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 24px; column-gap: 20px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.library-row-type { font-size: 10px; line-height: 1.7; }
.library-row-type b { display: block; font-weight: 650; margin-bottom: 7px; color: #254e61; }
.library-row-type time { font-size: 9px; color: var(--muted); }
.library-row-copy h3 { font-size: 17px; font-weight: 650; line-height: 1.6; margin: 0 0 7px; letter-spacing: -.015em; }
.library-row-copy > p { font-size: 11px; line-height: 1.8; color: var(--muted); margin: 0 0 10px; }
.library-row-copy .library-item-meta { font-size: 9px; font-weight: 400; gap: 8px; }
.library-row-copy .library-item-meta > span { color: var(--muted); }
.library-save { width: 26px; height: 30px; display: inline-grid; place-items: center; border: 0; background: none; color: #8ba1aa; padding: 3px; }
.library-save svg { width: 16px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.library-save.is-saved { color: #06878b; }
.library-save.is-saved svg { fill: #d9efec; }
.library-reading-rail { padding-top: 1px; }
.library-classics-feature { background: transparent; border-top: 1px solid var(--line); padding-top: 18px; }
.library-classics-feature > img { display: block; width: 100%; aspect-ratio: 1.55; object-fit: cover; }
.library-classics-feature > div { padding: 22px 0; }
.library-classics-feature .library-eyebrow { font-size: 7px; }
.library-classics-feature h3 { font-family: 'Noto Serif CJK SC', 'Songti SC', SimSun, serif; font-size: 23px; font-weight: 600; line-height: 1.6; margin: 8px 0 12px; }
.library-classics-feature p:not(.library-eyebrow) { color: #71817c; font-size: 10px; line-height: 1.9; }
.library-classics-feature button { display: flex; justify-content: space-between; gap: 15px; width: 100%; border: 0; border-top: 1px solid #ccd8d1; background: transparent; color: #315e58; font-size: 10px; padding: 15px 0 0; margin-top: 21px; text-align: left; }
.library-reading-note { padding: 25px 3px; margin-top: 10px; }
.library-reading-note > span { font-size: 9px; letter-spacing: .1em; color: #8aa098; }
.library-reading-note h3 { font-size: 18px; font-weight: 600; line-height: 1.65; margin: 13px 0; }
.library-reading-note p { font-size: 11px; color: var(--muted); line-height: 1.9; }
.library-reading-note a { color: #36878d; font-size: 10px; text-decoration: none; }
.library-footer { border-top: 1px solid var(--line); margin-top: 38px; padding-top: 20px; display: flex; justify-content: space-between; align-items: flex-start; gap: 28px; font-size: 10px; color: var(--muted); }
.library-footer > span { white-space: nowrap; font-size: 10px; }
.library-footer b { color: var(--ink); font-size: 12px; margin-right: 6px; }
.library-footer p { max-width: 550px; margin: 0; line-height: 1.8; }
.library-empty { padding: 70px 15px; text-align: center; }
.layout-books > .library-empty { grid-column: 1 / -1; }
.library-empty > span { font-size: 32px; color: #98bbb9; }
.library-empty h3 { font-size: 18px; font-weight: 600; margin: 17px 0 10px; }
.library-empty p { color: var(--muted); font-size: 12px; line-height: 1.8; }
.library-dialog { width: min(680px, calc(100vw - 32px)); max-height: 85svh; padding: 42px; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 25px 90px #092d3a30; }
.library-dialog::backdrop { background: #072d4266; backdrop-filter: blur(4px); }
.library-dialog-close { position: absolute; top: 12px; right: 15px; width: 30px; height: 30px; color: var(--muted); border: 0; background: transparent; font-size: 25px; }
.library-dialog h2 { font-size: 26px; line-height: 1.6; margin: 15px 0; }
.library-original-title { color: var(--muted); font: italic 15px/1.6 Georgia, serif; }
.library-detail-facts { display: grid; grid-template-columns: 70px 1fr; gap: 11px 15px; border-block: 1px solid var(--line); padding: 20px 0; margin: 24px 0; font-size: 12px; line-height: 1.65; }
.library-detail-facts dt { color: var(--muted); }
.library-detail-facts dd { margin: 0; overflow-wrap: anywhere; }
.library-detail-summary { font-size: 14px; line-height: 1.9; }
.library-detail-note { font-size: 11px; line-height: 1.8; color: var(--muted); margin-top: 20px; }
.library-detail-actions { display: flex; align-items: center; gap: 12px; margin-top: 28px; }
.library-detail-actions a, .library-detail-actions button { padding: 11px 17px; border: 1px solid var(--line); background: transparent; color: var(--ink); font-size: 12px; text-decoration: none; border-radius: 5px; }
.library-detail-actions a { color: white; background: #117f85; border-color: #117f85; }
.workspace-mode:focus-visible, .library-page button:focus-visible, .library-nav-item:focus-visible, .library-page a:focus-visible, .library-dialog button:focus-visible, .library-dialog a:focus-visible { outline: 2px solid #00a8a1; outline-offset: 4px; }
body[data-theme="dark"] #sidebar:not(.is-compact) { background: #081b28 !important; border-color: var(--line) !important; }
body[data-theme="dark"] .library-nav-item, body[data-theme="dark"] .library-fields button, body[data-theme="dark"] .library-row-type b { color: #b9d2df; }
body[data-theme="dark"] .library-nav-item.is-selected { background: #113b44; color: #8ce1d6; }
body[data-theme="dark"] .library-nav-admin a, body[data-theme="dark"] .library-content-admin a { color: #8ce1d6; }
body[data-theme="dark"] .workspace-mode.is-selected { background: #173744; color: #d2f3ee; }
body[data-theme="dark"] .library-item-meta, body[data-theme="dark"] .library-eyebrow, body[data-theme="dark"] .library-reading-note a, body[data-theme="dark"] .library-results-meta button { color: #79c9c4; }
body[data-theme="dark"] .library-classics-feature { background: #102a2e; }
body[data-theme="dark"] .library-classics-feature p:not(.library-eyebrow), body[data-theme="dark"] .library-classics-feature button { color: #a9c5be; }
body[data-theme="dark"] #sidebar:not(.is-compact) .profile { background: #0b2233 !important; }
@media (min-width: 769px) {
  .app-shell { grid-template-columns: var(--sidebar) minmax(0, 1fr) !important; }
  .app-shell:has(.sidebar.is-compact) { grid-template-columns: var(--sidebar-compact) minmax(0, 1fr) !important; }
  #sidebar { position: sticky !important; top: 0 !important; align-self: start; }
  .app-shell > .main { grid-column: 2; }
}
@media (min-width: 769px) and (max-width: 1080px) {
  :root { --sidebar: 248px; }
  #sidebar:not(.is-compact) .nav-label, #sidebar:not(.is-compact) .nav-item em { display: inline-flex; }
  #sidebar:not(.is-compact) .profile-text { display: grid; }
  #sidebar:not(.is-compact) .history { display: block; }
  #sidebar:not(.is-compact) .side-card { display: grid; }
  #sidebar:not(.is-compact) .new-chat, #sidebar:not(.is-compact) .nav-item { justify-content: flex-start; padding: 0 12px; }
}
@media (max-width: 1250px) {
  .library-page { padding-inline: 28px; }
  .library-spotlight { grid-template-columns: minmax(0,1.45fr) minmax(0,1fr); gap: 24px; }
  .library-journals { display: none; }
  .library-body-grid { grid-template-columns: minmax(0,1fr) 190px; gap: 25px; }
  .library-fields > span { display: none; }
  .library-feature { min-height: 350px; }
  .library-feature-copy { padding: 22px; }
  .library-search { width: 240px; }
}
@media (max-width: 1000px) {
  .library-body-grid { grid-template-columns: minmax(0,1fr); }
  .library-reading-rail { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; padding-top: 15px; }
  .library-classics-feature { display: flex; align-items: center; }
  .library-classics-feature > img { width: 38%; height: 100%; object-fit: cover; }
  .library-classics-feature > div { padding: 18px; }
  .library-classics-feature h3 { font-size: 18px; }
  .library-reading-note { padding: 12px 0; }
  .library-masthead { gap: 15px; }
  .library-search { width: 200px; }
  .library-fields { gap: 22px; }
}
@media (max-width: 768px) {
  #sidebar.is-compact { width: 0 !important; height: 0 !important; padding: 0 !important; border: 0 !important; z-index: 150; }
  #sidebar.is-compact > .side-top { position: fixed !important; left: 14px !important; top: 14px !important; width: 42px !important; }
  #sidebar.is-compact .workspace-modes, #sidebar.is-compact .library-sidebar, #sidebar.is-compact .chat-sidebar, #sidebar.is-compact .profile { display: none !important; }
  #sidebar:not(.is-compact) { width: min(86vw, 336px) !important; padding: 14px 14px max(14px, env(safe-area-inset-bottom)) !important; }
  #sidebar:not(.is-compact) > .profile { width: 100% !important; }
  .library-source-note { display: none; }
  .library-page { padding: 87px 20px 25px; }
  .library-breadcrumb { padding-right: 0; }
  .library-edition { font-size: 8px; }
  .library-masthead { flex-direction: column; align-items: stretch; padding-top: 25px; padding-bottom: 20px; gap: 23px; }
  .library-masthead h1 { font-size: 36px; }
  .library-search { width: 100%; }
  .library-search label, .library-search kbd { display: none; }
  .library-fields { gap: 23px; overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; }
  .library-fields button { padding-top: 14px; padding-bottom: 13px; font-size: 11px; }
  .library-spotlight { grid-template-columns: minmax(0,1fr); gap: 24px; }
  .library-feature { min-height: 360px; }
  .library-feature h2 { font-size: 25px; }
  .library-editors { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .library-editors > .library-column-label { grid-column: 1/-1; margin-bottom: 0; }
  .library-editor-item + .library-editor-item { padding-top: 0; border-top: 0; padding-left: 18px; border-left: 1px solid var(--line); }
  .library-editor-item h3 { font-size: 15px; }
  .library-editor-item p { font-size: 10px; }
  .library-section-heading h2 { font-size: 21px; }
  .library-row { grid-template-columns: 1fr 24px; gap: 6px; padding: 20px 0; }
  .library-row-type { grid-column: 1/-1; display: flex; gap: 12px; align-items: center; margin-bottom: 6px; }
  .library-row-type b { margin: 0; font-size: 9px; color: #32828a; }
  .library-row-copy h3 { font-size: 16px; }
  .library-reading-rail { display: block; }
  .library-classics-feature > img { width: 42%; }
  .library-reading-note { margin-top: 20px; }
  .library-footer { flex-direction: column; gap: 15px; }
  .library-dialog { padding: 30px 22px; }
  .library-dialog h2 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { .library-page, .workspace-modes { scroll-behavior: auto; } }

/* v37: six collections, each with its own reading format. */
.library-page { --collection-accent: #087c83; --collection-wash: #f0f7f7; }
.library-masthead h1 > span { color: inherit; }
.library-masthead h1 > em { color: var(--collection-accent); font-style: normal; }
.library-section-intro[hidden], .library-collections[hidden] { display: none; }
.library-list-controls { display: flex; gap: 18px; align-items: center; }
.library-list-controls select { max-width: 140px; text-overflow: ellipsis; }
.library-collections { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); margin: 0 0 36px; }
.library-collections button { text-align: left; padding: 20px; background: transparent; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); color: var(--ink); }
.library-collections button:hover { background: var(--collection-wash); }
.library-collections small { font-size: 9px; color: #749296; letter-spacing: .1em; }
.library-collections b { font-size: 16px; display: flex; justify-content: space-between; margin: 11px 0 7px; }
.library-collections b span { color: var(--collection-accent); font-weight: 400; }
.library-collections p { color: var(--muted); font-size: 11px; line-height: 1.7; margin: 0; }
.collection-banner { display: grid; grid-template-columns: minmax(0,1fr) 230px; margin-bottom: 24px; border: 0; border-top: 2px solid var(--collection-accent); background: transparent; gap: 28px; padding-top: 24px; }
.collection-intro-copy, .research-lead, .news-lead { padding: 0; }
.collection-banner h2, .resource-intro h2 { font-size: clamp(23px,2.3vw,31px); line-height: 1.55; letter-spacing: -.035em; margin: 10px 0 14px; font-weight: 650; }
.collection-banner p:not(.library-eyebrow), .resource-intro .collection-intro-copy > p:not(.library-eyebrow) { color: var(--muted); font-size: 12px; line-height: 1.9; max-width: 620px; }
.collection-numbers { display: grid; grid-template-columns: 1fr 1fr; align-content: center; gap: 18px; border-left: 1px solid var(--line); margin: 25px 0; padding: 12px 25px; }
.collection-numbers strong { display: block; font: 40px/1.2 Georgia,serif; color: var(--collection-accent); }
.collection-numbers span { display: block; font-size: 10px; line-height: 1.7; margin-top: 5px; color: var(--muted); }
.collection-numbers > p { grid-column: 1/-1; margin: 0; font-size: 10px !important; }
.research-banner { border-top: 2px solid var(--collection-accent); }
.research-lead .library-item-meta, .news-lead .library-item-meta { margin-top: 22px; font-size: 10px; }
.library-identifier { display: block; font-size: 9px; color: #7a929a; margin-top: 8px; overflow-wrap: anywhere; }
.collection-group-title { font-size: 17px; font-weight: 650; display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 25px 0 16px; }
.collection-group-title > span { margin-left: auto; font-size: 10px; color: var(--muted); font-weight: 400; }
.collection-read-link { padding: 0; border: 0; background: transparent; color: var(--collection-accent); font-size: 11px; text-align: left; }
.collection-reading-guide { background: var(--collection-wash); border-top: 3px solid var(--collection-accent); padding: 22px; }
.collection-reading-guide h3 { margin: 10px 0 18px; font-size: 19px; line-height: 1.65; }
.collection-reading-guide ol { margin: 0; padding-left: 16px; }
.collection-reading-guide li { color: var(--muted); font-size: 11px; line-height: 1.9; padding: 0 0 12px 4px; }
.collection-reading-guide li:last-child { padding-bottom: 0; }
.collection-source-index, .collection-related { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.collection-source-index h3, .collection-related > h3 { margin: 0 0 14px; font-size: 15px; }
.collection-source-index > button { width: 100%; display: flex; gap: 10px; align-items: baseline; justify-content: space-between; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); padding: 11px 0; text-align: left; font-size: 11px; line-height: 1.7; }
.collection-source-index > button:hover { color: var(--collection-accent); }
.collection-source-index b { font-size: 10px; color: var(--muted); font-weight: 400; }
.collection-source-index > small { display: block; color: var(--muted); font-size: 9px; margin-top: 12px; }
.collection-source-index > p { font-size: 11px; line-height: 1.8; color: var(--muted); }
.collection-related article { padding: 15px 0; border-bottom: 1px solid var(--line); }
.collection-related article > span { color: var(--collection-accent); font-size: 9px; }
.collection-related h4 { margin: 7px 0; font-size: 13px; line-height: 1.8; font-weight: 600; }
.collection-related article > small { color: var(--muted); font-size: 9px; }
.collection-related > div { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 17px; }
.collection-related > div button { padding: 6px 9px; background: transparent; color: var(--collection-accent); border: 1px solid var(--line); border-radius: 3px; font-size: 10px; }

/* Guidelines: organized by clinical field, institution and version. */
.library-page[data-category="guidelines"] { --collection-accent: #26765f; --collection-wash: #eef6f0; }
.guidelines-banner { border: 0; border-radius: 3px; }
.guideline-reading-key { display: flex; flex-wrap: wrap; gap: 20px; padding: 0 4px 25px; color: var(--collection-accent); font-size: 11px; }
.guideline-reading-key i { font-style: normal; color: #a1b8ae; }
.guideline-group + .guideline-group { margin-top: 32px; }
.guideline-cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.guideline-card { display: flex; flex-direction: column; border: 1px solid var(--line); border-top: 3px solid #94b8a8; padding: 20px; border-radius: 2px; }
.guideline-card-top { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.guideline-card-top > span { font-size: 10px; color: var(--collection-accent); line-height: 1.7; }
.guideline-card-top .library-save { flex-shrink: 0; height: 20px; }
.guideline-card h4 { font-size: 17px; line-height: 1.75; margin: 16px 0 12px; font-weight: 650; }
.guideline-card > p { font-size: 12px; line-height: 1.9; color: var(--muted); margin: 0 0 22px; }
.guideline-card-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 12px 0; border-top: 1px solid var(--line); margin-top: auto; font-size: 9px; color: var(--muted); }
.guideline-card .collection-read-link { margin-top: 7px; }

/* Books: an editorial bookshelf; covers are catalog typography, not originals. */
.library-page[data-category="books"] { --collection-accent: #526989; --collection-wash: #f2f3f4; }
.bookshelf-banner { background: transparent; color: var(--ink); overflow: hidden; grid-template-columns: minmax(0,1fr) 280px; border: none; }
.bookshelf-banner .library-eyebrow { color: var(--collection-accent); }
.bookshelf-banner .collection-intro-copy > p:not(.library-eyebrow) { color: var(--muted); }
.bookshelf-decoration { display: flex; align-items: flex-end; justify-content: center; gap: 10px; padding: 25px 32px 0; }
.bookshelf-decoration i { writing-mode: vertical-rl; font: normal 17px/1.5 'Songti SC', SimSun, serif; letter-spacing: .4em; padding: 23px 15px; height: 180px; border-left: 3px solid #fff2; color: #e4eee8; background: #68857e; box-shadow: 6px 0 12px #061c2830; }
.bookshelf-decoration i:nth-child(2) { height: 205px; background: #b4aa8c; color: #384d4d; }
.bookshelf-decoration i:nth-child(3) { height: 170px; background: #506e84; }
.bookshelf-decoration i:nth-child(4) { height: 192px; background: #92aaa4; color: #344d4b; }
.collection-caption { font-size: 10px; color: var(--muted); margin: -10px 0 26px; }
.library-page[data-category="books"] .library-body-grid { grid-template-columns: minmax(0,1fr); }
.library-page[data-category="books"] .library-reading-rail { display: grid; grid-template-columns: 1fr 1fr 1.2fr; gap: 28px; align-items: start; }
.library-page[data-category="books"] .library-reading-rail > section { margin-top: 0; }
.layout-books { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 32px 28px; padding-top: 26px; }
.library-book { display: flex; flex-direction: column; min-width: 0; }
.library-book-cover { display: flex; flex-direction: column; justify-content: space-between; text-align: left; aspect-ratio: 1.12; padding: 25px 25px 22px 35px; border: 0; border-left: 8px solid #14374444; border-radius: 2px 6px 6px 2px; color: #eaf3ef; background: #315661; box-shadow: 4px 6px 0 #cedbd655; }
.library-book-cover > span { font-size: 10px; letter-spacing: .18em; opacity: .8; }
.library-book-cover > b { font: 600 23px/1.6 'Songti SC', SimSun, serif; margin: 18px 0; }
.library-book-cover > small { font: 16px Georgia,serif; }
.library-book-cover i { display: block; font: normal 7px sans-serif; letter-spacing: .16em; margin-top: 12px; opacity: .7; }
.library-book-cover.cover-1 { background: #9a8a70; border-left-color: #66584655; }
.library-book-cover.cover-2 { background: #49627e; }
.library-book-cover.cover-3 { background: #607b70; }
.library-book-cover:hover { box-shadow: 5px 9px 0 #a7bbb555; }
.book-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 17px; color: var(--muted); font-size: 10px; }
.library-book h3 { font-size: 16px; line-height: 1.7; margin: 8px 0 10px; }
.library-book-copy > p { color: var(--muted); font-size: 11px; line-height: 1.9; margin: 0 0 12px; }
.library-book-copy > small { display: block; color: var(--muted); font-size: 10px; }
.library-book .collection-read-link { display: block; margin-top: 13px; }

/* Classics: warm paper, restrained seals and a bibliographic chronology. */
.library-page[data-category="classics"] { --collection-accent: #925c3e; --collection-wash: #f3eddf; --line: #dfd6c5; color: #403d33; background: #fffdf7; }
.library-page[data-category="classics"] .library-masthead h1, .library-page[data-category="classics"] h2, .library-page[data-category="classics"] h3 { font-family: 'Noto Serif CJK SC','Songti SC',SimSun,serif; }
.library-page[data-category="classics"] .library-eyebrow, .library-page[data-category="classics"] .library-item-meta { color: #8b6b50; }
.library-page[data-category="classics"] .library-fields button.is-selected { color: #925c3e; border-color: #925c3e; }
.archive-banner { position: relative; grid-template-columns: minmax(0,1fr) 36%; background: transparent; border: 0; border-top: 1px solid #ded2bd; }
.archive-banner > img { width: 100%; height: 100%; object-fit: cover; min-width: 0; opacity: .9; }
.archive-banner .collection-intro-copy { padding-right: 40px; }
.archive-banner .collection-intro-copy > p:not(.library-eyebrow) { color: #827766; }
.archive-seal { position: absolute; right: 36%; top: 30px; border: 1px solid #995d4b; color: #995d4b; font: 16px/1.4 SimSun,serif; padding: 4px 6px; transform: translateX(8px); }
.archive-reading-key { display: flex; flex-wrap: wrap; gap: 20px; padding: 0 0 26px; color: #877965; font-size: 11px; }
.archive-reading-key span { display: flex; align-items: center; gap: 9px; }
.archive-reading-key b { font: 18px 'Songti SC',SimSun,serif; color: #735942; }
.archive-reading-key small { flex-basis: 100%; font-size: 10px; color: #968a76; }
.archive-timeline { padding: 15px 0 0; margin: 0; list-style: none; }
.archive-timeline > li { display: grid; grid-template-columns: 94px minmax(0,1fr); gap: 25px; }
.archive-year { padding: 22px 0; text-align: right; }
.archive-year b { display: block; font: 25px/1.4 Georgia,serif; color: #8b6345; overflow-wrap: anywhere; }
.archive-year span { font-size: 8px; color: #9b8d78; }
.archive-record { padding: 24px 0 28px 26px; border-left: 1px solid #d9cdb7; position: relative; }
.archive-record::before { content: ''; position: absolute; left: -4px; top: 33px; width: 7px; height: 7px; border: 1px solid #9b7354; border-radius: 50%; background: #fffdf7; }
.archive-record .library-save { margin-left: auto; }
.archive-record h3 { margin: 10px 0; font-size: 22px; line-height: 1.65; font-weight: 600; }
.archive-record > p { color: #847b6c; font-size: 12px; line-height: 1.95; margin: 12px 0; }
.archive-record .archive-original { font: italic 12px/1.8 Georgia,serif; color: #9a8e7a; }
.archive-source { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); color: #99876e; font-size: 10px; }
.archive-source > span { flex: 1; min-width: 140px; line-height: 1.7; }
.archive-source button { background: transparent; border: 0; padding: 0; color: #8b6345; font-size: 10px; }

/* News: an editorial lead, news columns, and a separate journal room. */
.library-page[data-category="news"] { --collection-accent: #9d514d; --collection-wash: #faf3f1; }
.news-banner { border: 0; border-top: 3px solid #9d514d; background: transparent; }
.news-edition { background: #234755; color: #d7e6e7; padding: 30px; display: flex; flex-direction: column; justify-content: center; }
.news-edition > span { font-size: 10px; letter-spacing: .18em; }
.news-edition strong { font: 37px/1.08 Georgia,serif; letter-spacing: -.05em; margin: 22px 0; }
.news-edition > p { color: #b1c8cb !important; font-size: 11px !important; margin: 0; }
.news-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 25px; }
.news-card { display: flex; flex-direction: column; padding: 24px 0; border-bottom: 1px solid var(--line); }
.news-card-lead { grid-column: auto; }
.news-card-kicker { display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between; color: var(--collection-accent); font-size: 9px; }
.news-card-kicker time { color: var(--muted); }
.news-card h3 { font-size: 18px; line-height: 1.7; margin: 13px 0; letter-spacing: -.025em; }
.news-card-lead h3 { font-size: 18px; }
.news-card > p { font-size: 12px; line-height: 1.9; color: var(--muted); margin: 0 0 15px; }
.news-card-source { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: auto; color: var(--muted); font-size: 10px; }
.news-card .collection-read-link { margin-top: 10px; }
.journal-directory { margin-top: 32px; }
.journal-directory > div { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.journal-directory article { border: 1px solid var(--line); padding: 20px; }
.journal-directory article > span { font-size: 10px; color: var(--collection-accent); }
.journal-directory h4 { font: 600 19px/1.6 Georgia,'Songti SC',serif; margin: 14px 0; }
.journal-directory p { color: var(--muted); font-size: 11px; line-height: 1.8; }
.journal-directory article > div { display: flex; align-items: center; justify-content: space-between; }
.journal-directory a { color: var(--collection-accent); font-size: 10px; text-decoration: none; }

/* Resources: four stages of the research workflow. */
.library-page[data-category="tools"] { --collection-accent: #326d91; --collection-wash: #eef4f9; }
.resource-intro { background: transparent; border-top: 2px solid var(--collection-accent); }
.resource-workflow { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 1px; background: var(--line); margin: 18px 0 28px; border: 1px solid var(--line); }
.resource-workflow button { border: 0; padding: 18px; text-align: left; color: var(--ink); background: var(--surface); }
.resource-workflow span { display: block; font: 21px Georgia,serif; color: #8ca9bb; }
.resource-workflow b { display: block; margin: 10px 0 7px; font-size: 13px; }
.resource-workflow small { display: block; color: var(--muted); font-size: 10px; line-height: 1.7; }
.resource-workflow button:hover { background: var(--collection-wash); }
.resource-group { scroll-margin-top: 32px; }
.resource-group .collection-group-title > b { color: #91afbf; font: 24px Georgia,serif; }
.resource-cards { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.resource-cards article { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 7px; padding: 20px; background: var(--surface); }
.resource-card-top { display: flex; align-items: center; gap: 10px; justify-content: space-between; color: var(--collection-accent); font-size: 10px; }
.resource-cards h4 { margin: 14px 0 10px; font-size: 17px; line-height: 1.7; }
.resource-cards p { font-size: 12px; color: var(--muted); line-height: 1.9; margin: 0 0 14px; }
.resource-cards article > small { display: block; color: var(--muted); font-size: 9px; margin-top: auto; line-height: 1.8; }
.resource-card-actions { display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 16px; gap: 12px; }
.resource-card-actions button, .resource-card-actions a { background: transparent; border: 0; color: var(--collection-accent); font-size: 11px; padding: 0; text-decoration: none; }
.library-detail-subhead { font-size: 12px; letter-spacing: .08em; margin-top: 25px; }
.library-source-context { margin-top: 18px; border-left: 2px solid var(--line); padding-left: 14px; }
.library-source-context b { font-size: 11px; font-weight: 600; }
.library-source-context p { color: var(--muted); font-size: 11px; line-height: 1.85; margin: 6px 0; }
.library-correction { display: block; font-size: 11px; color: #a16c38; margin-top: 18px; }
.library-dialog[data-category="classics"] { background: #fffdf7; color: #403d33; border-color: #e0d3bf; }
.library-dialog[data-category="classics"] h2 { font-family: 'Songti SC',SimSun,serif; }
body[data-theme="dark"] .library-page { --collection-wash: #102b36; --collection-accent: #8ac9c9; }
body[data-theme="dark"] .library-page[data-category="classics"] { --line: #484738; --collection-wash: #272a23; --collection-accent: #d4b58a; background: #151d1b; color: #e0ddc9; }
body[data-theme="dark"] .library-page[data-category="classics"] .library-eyebrow,
body[data-theme="dark"] .library-page[data-category="classics"] .library-item-meta,
body[data-theme="dark"] .library-page[data-category="classics"] .library-fields button.is-selected { color: #d4b58a; border-color: #d4b58a; }
body[data-theme="dark"] .archive-seal { color: #d4a791; border-color: #d4a791; }
body[data-theme="dark"] .archive-banner { background: transparent; border-color: #4c4d3c; }
body[data-theme="dark"] .archive-banner p, body[data-theme="dark"] .archive-record p, body[data-theme="dark"] .archive-year b, body[data-theme="dark"] .archive-reading-key b, body[data-theme="dark"] .archive-source button { color: #b7ad95 !important; }
body[data-theme="dark"] .archive-record::before { background: #151d1b; }
body[data-theme="dark"] .news-banner { background: transparent; }
body[data-theme="dark"] .library-dialog[data-category="classics"] { background: #1b251f; color: #e0ddc9; }
body[data-theme="dark"] .library-book-cover { box-shadow: 4px 6px 0 #06121b; }
@media (max-width: 1250px) {
  .collection-banner { grid-template-columns: minmax(0,1fr) 180px; }
  .collection-intro-copy, .research-lead, .news-lead { padding: 26px; }
  .collection-numbers { padding-inline: 18px; gap: 10px; }
  .bookshelf-banner { grid-template-columns: minmax(0,1fr) 230px; }
  .bookshelf-decoration { padding-inline: 18px; gap: 8px; }
  .bookshelf-decoration i { padding-inline: 11px; }
  .archive-banner { grid-template-columns: minmax(0,1fr) 30%; }
  .archive-seal { right: 30%; }
  .library-list-controls { gap: 10px; }
  .library-list-controls .library-sort { flex-direction: column; align-items: flex-end; gap: 0; font-size: 9px; }
  .library-list-controls select { max-width: 115px; }
  .guideline-cards, .resource-cards { grid-template-columns: minmax(0,1fr); }
  .layout-books { gap: 24px 20px; }
  .library-book-cover { padding: 20px 17px 20px 23px; }
  .library-book-cover > b { font-size: 20px; }
}
@media (max-width: 1000px) {
  .guideline-cards, .resource-cards { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .library-page:not([data-category="books"]) .library-reading-rail { grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; }
  .library-reading-rail .collection-reading-guide { grid-column: 1/-1; }
  .library-reading-rail .collection-reading-guide ol { display: flex; gap: 30px; justify-content: space-between; }
  .library-reading-rail .collection-reading-guide li { flex: 1; }
  .library-page[data-category="books"] .library-reading-rail { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .layout-books { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .library-collections { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .collection-banner { grid-template-columns: minmax(0,1fr); }
  .collection-numbers { display: flex; justify-content: space-between; border-left: 0; border-top: 1px solid var(--line); margin: 0 26px 22px; padding: 20px 0 0; }
  .collection-numbers > p { max-width: 150px; }
  .bookshelf-banner, .archive-banner { grid-template-columns: minmax(0,1fr) 35%; }
  .archive-seal { right: 35%; }
  .bookshelf-decoration { gap: 5px; padding-inline: 12px; }
  .bookshelf-decoration i { padding-inline: 7px; font-size: 15px; }
  .news-edition { display: none; }
  .resource-workflow button { padding: 15px; }
}
@media (max-width: 768px) {
  .library-masthead h1 { font-size: 32px; }
  .library-list-controls { gap: 9px; }
  .library-list-controls select { max-width: 100px; font-size: 9px; }
  .library-section-heading { align-items: flex-end; }
  .library-section-heading h2 { font-size: 19px; }
  .collection-banner h2, .resource-intro h2 { font-size: 24px; }
  .collection-intro-copy, .research-lead, .news-lead { padding: 24px; }
  .collection-numbers { margin-inline: 24px; }
  .library-collections button { padding: 17px; }
  .library-collections b { font-size: 14px; }
  .library-collections p { font-size: 10px; }
  .guideline-cards, .resource-cards, .news-grid, .journal-directory > div { grid-template-columns: minmax(0,1fr); }
  .collection-group-title { font-size: 16px; }
  .collection-group-title > span { font-size: 9px; }
  .guideline-reading-key { gap: 8px; font-size: 9px; }
  .bookshelf-banner { grid-template-columns: minmax(0,1fr); }
  .bookshelf-decoration { display: none; }
  .layout-books { gap: 26px 17px; }
  .library-book-cover { padding: 17px 12px 17px 16px; border-left-width: 5px; aspect-ratio: .72; }
  .library-book-cover > b { font-size: 17px; margin: 15px 0; }
  .library-book-cover > span { font-size: 8px; }
  .library-book-cover > small { font-size: 11px; }
  .library-book-cover i { font-size: 6px; }
  .library-book h3 { font-size: 14px; }
  .library-page[data-category="books"] .library-reading-rail, .library-page:not([data-category="books"]) .library-reading-rail { display: block; }
  .library-reading-rail .collection-reading-guide ol { display: block; }
  .library-page[data-category="books"] .library-reading-rail > section { margin-top: 22px; }
  .archive-banner { grid-template-columns: minmax(0,1fr); }
  .archive-banner > img { display: none; }
  .archive-seal { right: 21px; top: 24px; font-size: 13px; }
  .archive-banner h2 { max-width: 230px; }
  .archive-reading-key { gap: 13px; font-size: 9px; }
  .archive-timeline > li { grid-template-columns: 57px minmax(0,1fr); gap: 12px; }
  .archive-year b { font-size: 18px; }
  .archive-year span { font-size: 7px; }
  .archive-record { padding-left: 17px; }
  .archive-record h3 { font-size: 20px; }
  .archive-record > p { font-size: 11px; }
  .news-card-lead h3 { font-size: 23px; }
  .resource-workflow { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .library-results-meta { gap: 13px; line-height: 1.8; }
  .library-results-meta > button { flex-shrink: 0; }
}

/* v38: two-level navigation and credited source imagery. */
.library-nav-parent { display: grid; grid-template-columns: minmax(0,1fr) 27px; align-items: center; gap: 2px; }
.library-nav-parent .library-nav-item { padding-right: 4px; }
.library-nav-expander { border: 0; background: transparent; border-radius: 5px; color: var(--muted); height: 32px; font-size: 16px; cursor: pointer; }
.library-nav-expander[aria-expanded="true"] { transform: rotate(180deg); color: var(--cyan); }
.library-nav-expander:hover { background: var(--soft); }
.library-subnav { margin: 3px 5px 9px 23px; padding-left: 12px; border-left: 1px solid var(--line); }
.library-subnav[hidden] { display: none; }
.library-subnav button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 6px; text-align: left; border: 0; background: transparent; padding: 9px 8px; border-radius: 5px; font-size: 11px; line-height: 1.6; color: var(--muted); }
.library-subnav button small { font-size: 9px; opacity: .7; }
.library-subnav button:hover, .library-subnav button.is-selected { color: var(--ink); background: var(--soft); }
.library-subnav button.is-selected { font-weight: 650; box-shadow: inset 2px 0 var(--cyan); }
.library-cms-subnav button[data-cms-category] { padding-left: calc(8px + var(--cms-indent, 0px)); }
.library-cms-subnav button[data-cms-category] > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-fields[hidden], .sidebar.is-compact .library-nav-section-label, .sidebar.is-compact .library-nav-admin { display: none !important; }
.sidebar.is-compact .library-nav-parent { grid-template-columns: 1fr; }
.sidebar.is-compact .library-nav-expander, .sidebar.is-compact .library-subnav { display: none !important; }
.sidebar.is-compact .library-nav-parent .library-nav-item { padding-right: 0; }
.library-source-figure { margin: 0; min-width: 0; background: transparent; }
.library-image-link { display: block; width: fit-content; max-width: 100%; color: inherit; }
.library-image-link:focus-visible { outline: 2px solid var(--cyan); outline-offset: 4px; }
.library-source-figure img { width: 100%; max-width: calc(var(--source-width, 2400px) / 2); display: block; height: auto; object-fit: contain; }
.library-source-figure figcaption { padding: 8px 0 0; display: flex; flex-direction: column; gap: 4px; font-size: 9px; line-height: 1.6; color: var(--muted); }
.library-source-figure figcaption a { color: inherit; text-decoration: none; overflow-wrap: anywhere; }
.library-source-figure figcaption a:hover { color: var(--cyan); text-decoration: underline; }
.collection-banner:has(.collection-source-image) { grid-template-columns: minmax(0,1.8fr) minmax(230px,1fr); }
.collection-source-image { display: flex; flex-direction: column; align-self: center; background: transparent; }
.source-news { align-self: start; }
.source-news img { max-height:260px; }
.collection-source-image img { height: auto; max-height: 300px; width: auto; max-width: min(100%,calc(var(--source-width,2400px)/2)); object-fit: contain; }
.source-research img, .source-guidelines img, .source-books img, .source-tools img { object-fit: contain; padding: 0; background: transparent; }
.source-classics img { max-height: 290px; object-position: center 30%; }
.source-classics figcaption { background: transparent; color: #6c624f; }
.archive-seal { z-index: 1; right: 36%; }
.resource-intro:has(.source-tools) { display: grid; grid-template-columns: minmax(0,1.6fr) minmax(240px,1fr); gap: 28px; padding: 24px 0 0; }
.resource-intro .collection-intro-copy { padding: 0; }
.library-feature.has-source-media { display: block; min-height: 0; }
.library-feature.has-source-media::after { display: none; }
.library-feature.has-source-media .library-feature-tag { background: #0b3945e8; }
.library-feature.has-source-media .library-feature-credit { top: 207px; right: 8px; left: 8px; width: fit-content; max-width: calc(100% - 16px); color: #1c505a; background: #ffffffec; border-radius: 3px; padding: 4px 7px; text-decoration: none; line-height: 1.4; }
.library-feature.has-source-media .library-feature-copy { padding: 19px 0 0; }
.library-feature > .library-column-label { font-size: 10px; line-height: 1.5; margin: 0 0 18px; letter-spacing: 0; }
.feature-source-image .library-image-link { width: 100%; }
.feature-source-image img { width: auto; max-width: 100%; height: auto; max-height: 380px; object-position: left center; }
.feature-source-image figcaption > span { display: none; }
.library-feature-credit a { color: inherit; text-decoration: none; }
.editor-source-image { margin-bottom: 12px; }
.editor-source-image img { height: auto; aspect-ratio: auto; object-fit: contain; }
.editor-source-image[data-media-type="cover"] .library-image-link { max-width: 132px; }
.library-editor-item:has([data-media-type="cover"]) { display: grid; grid-template-columns: minmax(0,.55fr) minmax(0,1fr); gap: 16px; align-items: start; }
.library-editor-item .editor-source-image[data-media-type="cover"] { width: 100%; margin: 2px 0 0; }
.library-editor-copy { min-width: 0; }
.editor-source-image figcaption > span { display: none; }
.library-collections { gap: 18px; border: 0; }
.library-collection-tile { min-width: 0; border: 0; border-top: 1px solid var(--line); padding-top: 18px; background: transparent; }
.library-collection-tile > button { display: block; width: 100%; padding: 18px 0; text-align: left; border: 0; background: transparent; color: var(--ink); }
.library-collection-tile > button small { font-size: 9px; letter-spacing: .1em; color: var(--muted); }
.library-collection-tile > button b { display: flex; justify-content: space-between; font-size: 17px; margin: 11px 0 8px; }
.library-collection-tile > button p { margin: 0; font-size: 11px; line-height: 1.8; color: var(--muted); }
.library-collection-tile > button:hover b { color: var(--cyan); }
.collection-tile-image .library-image-link { height: 190px; display: flex; align-items: flex-end; }
.collection-tile-image img { height: auto; width: auto; max-height: 190px; max-width: min(100%,calc(var(--source-width,2400px)/2)); object-fit: contain; padding: 0; }
.collection-tile-image figcaption > span { display: none; }
.row-source-image { margin-top: 12px; }
.row-source-image img { aspect-ratio: auto; object-fit: contain; background: transparent; }
.row-source-image figcaption { padding: 5px 0; font-size: 8px; background: transparent; }
.row-source-image figcaption > span { display: none; }
.guideline-source-image { margin: 12px 0 4px; }
.guideline-source-image img { height: auto; max-height: 220px; width: auto; max-width: 100%; aspect-ratio: auto; object-fit: contain; padding: 0; }
.archive-source-image { float: right; width: 150px; margin: 4px 0 15px 22px; }
.archive-source-image img { aspect-ratio: auto; object-fit: contain; }
.archive-source { clear: both; }
.archive-source-image figcaption > span { display: none; }
.news-source-image { margin: 13px 0 0; }
.news-source-image img { aspect-ratio: auto; }
.news-source-image figcaption > span { display: none; }
.tool-source-image { margin: 14px 0 0; }
.tool-source-image img { height: auto; max-height: 210px; object-fit: contain; padding: 0; }
.tool-source-image figcaption > span { display: none; }
.library-book-cover.has-source-cover { padding: 0; background: transparent; box-shadow: none; border: 0; }
.library-book-cover.has-source-cover > img { display: block; width: 100%; height: 265px; object-fit: contain; padding: 0; object-position: left center; }
.library-book-cover.has-source-cover > small { position: static; display: block; margin: 0; padding: 9px 12px; background: var(--surface); color: var(--muted); font-family: inherit; font-size: 9px; line-height: 1.6; }
.rail-source-image img { aspect-ratio: auto; object-fit: contain; }
.rail-source-image figcaption > span { display: none; }
.library-detail-more { display: flex; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.library-detail-more button { border: 1px solid var(--line); border-radius: 5px; padding: 10px 15px; background: var(--soft); color: var(--ink); font-size: 12px; }
body[data-mode="chat"] #libraryExperience { display: none !important; }
#libraryExperience[hidden] { display: none !important; }
body[data-theme="dark"] .library-source-figure figcaption { background: transparent; color: #c0d3d6; }
body[data-theme="dark"] .source-classics figcaption { background: transparent; color: #d0c5ae; }
@media (max-width: 1100px) {
  .collection-banner:has(.collection-source-image) { grid-template-columns: minmax(0,1fr) 200px; }
  .collection-source-image img { height: auto; max-height: 190px; }
  .resource-intro:has(.source-tools) { grid-template-columns: minmax(0,1fr) 200px; }
  .collection-tile-image img { height: auto; max-height: 130px; }
}
@media (max-width: 768px) {
  .collection-banner:has(.collection-source-image), .resource-intro:has(.source-tools) { grid-template-columns: minmax(0,1fr); }
  .collection-source-image img { height: auto; max-height: 240px; }
  .collection-source-image figcaption { font-size: 10px; }
  .archive-seal { right: 20px; }
  .library-feature.has-source-media > img { height: 210px; }
  .library-feature.has-source-media .library-feature-credit { top: 181px; }
  .editor-source-image img { height: auto; }
  .library-collections { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
  .library-collection-tile > button { padding: 15px 0; }
  .library-collection-tile > button b { font-size: 15px; }
  .library-collection-tile > button p { font-size: 10px; }
  .collection-tile-image .library-image-link { height: 150px; }
  .collection-tile-image img { height: auto; max-height: 150px; }
  .collection-tile-image figcaption { font-size: 8px; }
  .archive-source-image { float: none; width: 100%; margin: 14px 0; }
  .archive-source-image img { height: auto; max-height: 200px; aspect-ratio: auto; object-fit: contain; }
  .library-book-cover.has-source-cover > img { height: 220px; }
  .row-source-image { max-width: 110px; }
}

/* Production reading clarity: show catalog provenance on every result. */
body[data-production="true"] .library-record-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid #dfc8a9;
  border-radius: 4px;
  background: #fff8ee;
  color: #80582c;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0;
  white-space: nowrap;
}
body[data-production="true"] .library-record-status.is-published {
  border-color: #b9dcdb;
  background: #eff8f7;
  color: #08747d;
}
body[data-production="true"] .library-row-copy > .library-record-status,
body[data-production="true"] .guideline-card > .library-record-status,
body[data-production="true"] .library-book-copy > .library-record-status,
body[data-production="true"] .archive-record > .library-record-status,
body[data-production="true"] .news-card > .library-record-status,
body[data-production="true"] .journal-directory article > .library-record-status,
body[data-production="true"] .resource-cards article > .library-record-status {
  margin-top: 9px;
  margin-bottom: 5px;
}
body[data-production="true"] .library-page .library-item-meta,
body[data-production="true"] .library-page .library-small-date,
body[data-production="true"] .library-page .library-row-type time,
body[data-production="true"] .library-page .library-row-copy .library-item-meta,
body[data-production="true"] .library-page .guideline-card-bottom,
body[data-production="true"] .library-page .news-card-kicker,
body[data-production="true"] .library-page .news-card-source,
body[data-production="true"] .library-page .resource-cards article > small {font-size: 11px;line-height: 1.65;}
body[data-production="true"] .library-page .library-editor-item p,
body[data-production="true"] .library-page .library-row-copy > p,
body[data-production="true"] .library-page .guideline-card > p,
body[data-production="true"] .library-page .library-book-copy > p,
body[data-production="true"] .library-page .archive-record > p,
body[data-production="true"] .library-page .news-card > p,
body[data-production="true"] .library-page .journal-directory p,
body[data-production="true"] .library-page .resource-cards p {font-size: 13px;line-height: 1.8;}
body[data-production="true"] .library-page .library-results-meta,
body[data-production="true"] .library-page .library-results-meta button,
body[data-production="true"] .library-page .library-sort,
body[data-production="true"] .library-page .library-sort select,
body[data-production="true"] .library-page .library-row-type,
body[data-production="true"] .library-page .collection-read-link {font-size: 12px;}
body[data-production="true"] .library-page .library-source-figure figcaption {font-size: 10px;line-height: 1.6;}
body[data-theme="dark"][data-production="true"] .library-record-status.is-example {background:#3a3023;border-color:#725a3b;color:#f3d5a3;}
body[data-theme="dark"][data-production="true"] .library-record-status.is-published {background:#153f41;border-color:#2d7779;color:#9bdad9;}
@media (max-width: 768px) {
  body[data-production="true"] .library-page .library-fields button {font-size: 12px;}
  body[data-production="true"] .library-page .library-editor-item p,
  body[data-production="true"] .library-page .library-collection-tile > button p,
  body[data-production="true"] .library-page .archive-record > p {font-size: 12px;line-height: 1.75;}
  body[data-production="true"] .library-page .library-row-type b {font-size: 11px;}
}
