/* Document library: one long page of links, by level */
body.library { overflow: auto; height: auto; min-height: 100vh; display: block; background: var(--surface-2, var(--surface)); }
body.library .topbar { position: sticky; top: 0; z-index: 5; }
#lib { max-width: 920px; margin: 0 auto; padding: 22px 22px 90px; font-size: 14px; line-height: 1.55; color: var(--ink); }
.lib-loading { color: var(--ink-3); }
.lib-lede { color: var(--ink-2); margin: 0 0 14px; }
.lib-nav { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; padding: 0 0 14px; border-bottom: 1px solid var(--line); }
.lib-nav a { padding: 3px 11px; border: 1px solid var(--line); border-radius: 99px; color: var(--ink-2); text-decoration: none; font-size: 12.5px; }
.lib-nav a:hover { color: var(--accent); border-color: var(--accent); }
.lib-nav small { color: var(--ink-3); margin-left: 4px; }
#lib details.lib-sec { border-top: 1px solid var(--line); margin: 0; scroll-margin-top: 62px; }
#lib details.lib-sec > summary { padding: 10px 2px; }
#lib details.lib-sec > summary h2 { margin: 0; }
#lib details.lib-sec[open] { padding-bottom: 14px; }
#lib h2 { font-size: 18px; margin: 34px 0 4px; }
#lib h2 .lib-count { font-weight: 400; font-size: 13px; color: var(--ink-3); margin-left: 8px; }
#lib h3 { font-size: 14px; margin: 20px 0 4px; color: var(--ink); }
#lib h4.lib-sub { margin: 12px 0 2px 2px; }
#lib h3.lib-sub, #lib h4.lib-sub { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
#lib p.lib-about { margin: 0 0 6px; font-size: 13px; color: var(--ink-2); }
#lib ul { margin: 6px 0 0; padding-left: 22px; }
#lib li { margin: 3px 0; }
#lib li .lib-meta { color: var(--ink-3); }
#lib a { color: var(--accent-2); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent-2) 40%, transparent); text-underline-offset: 2px; }
#lib a:hover { text-decoration-color: currentColor; }
#lib details { margin: 4px 0; border-top: 1px solid var(--line-2); }
#lib details > summary { cursor: pointer; padding: 7px 2px; font-weight: 500; list-style: none; display: flex; align-items: baseline; gap: 8px; }
#lib details > summary::-webkit-details-marker { display: none; }
#lib details > summary::before { content: '▸'; color: var(--ink-3); font-size: 11px; width: 10px; }
#lib details[open] > summary::before { content: '▾'; }
#lib details > summary .lib-count { font-weight: 400; font-size: 12.5px; color: var(--ink-3); }
#lib details > ul { margin-bottom: 10px; }
#lib .lib-more { font: inherit; font-size: 12px; padding: 0 7px; border: 1px solid var(--line); border-radius: 99px; background: none; color: var(--ink-3); cursor: pointer; }
#lib .lib-more:hover { color: var(--accent); border-color: var(--accent); }
.lib-collapse-row { margin-top: 16px; }
#lib .lib-collapse { padding: 2px 11px; }
.lib-foot { margin-top: 34px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-3); }
/* a little room above the first section (the intro and section links were removed) */
#lib { padding-top: 24px; }

/* how the information is kept up to date */
.lib-updates { margin: 8px 0 0; }
#lib .lib-updates h2 { margin: 0 0 8px; font-size: 15px; }
.lib-updates table { width: 100%; border-collapse: collapse; font-size: 12.5px; line-height: 1.45; }
.lib-updates th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 0 10px 5px 0; border-bottom: 1px solid var(--line); }
.lib-updates td { padding: 6px 10px 6px 0; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.lib-updates td:first-child { font-weight: 500; width: 32%; }
.lib-updates td:nth-child(2) { color: var(--ink-2); width: 26%; }
.lib-updates p { margin: 8px 0 2px; font-size: 12px; color: var(--ink-3); }
@media (max-width: 640px) {
  .lib-updates thead { display: none; }
  .lib-updates tr { display: block; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
  .lib-updates td { display: block; width: auto !important; padding: 1px 0; border: 0; }
}

/* arranging the library: by category or by date */
.lib-views, .lib-kinds { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.lib-views { margin: 0 0 18px; }
.lib-kinds { margin: 6px 0 12px; }
.lib-kinds-h { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-right: 4px; }
#lib .lib-view, #lib .lib-kind { font: 500 12.5px var(--sans); padding: 3px 11px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); color: var(--ink-2); cursor: pointer; }
#lib .lib-view.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
#lib .lib-kind .n { margin-left: 6px; color: var(--ink-3); font-weight: 400; }
#lib .lib-kind:not(.on) { opacity: .5; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--ink-3) 60%, transparent); }
#lib .lib-view:hover, #lib .lib-kind:hover { border-color: var(--accent); }
/* the list by date: the date in its own column, then a small tag for the kind */
#lib .lib-year { border-top: 1px solid var(--line); }
#lib .lib-year > summary h3 { margin: 0; font-size: 15px; }
#lib .lib-dates ul { list-style: none; padding-left: 0; }
#lib .lib-dates li { display: grid; grid-template-columns: 92px 96px 1fr; gap: 10px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--line-2); margin: 0; }
#lib .lib-when { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#lib .lib-tag { justify-self: start; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
#lib .lib-tag.k-0 { background: #e8eefb; color: #2b4f9a; } #lib .lib-tag.k-1 { background: #eef1f6; color: #4a5875; }
#lib .lib-tag.k-2 { background: #e7f3ec; color: #1f6a3c; } #lib .lib-tag.k-3 { background: #fbeee4; color: #8a4a17; }
#lib .lib-tag.k-4 { background: #f2eafa; color: #5d3b8c; } #lib .lib-tag.k-5 { background: #fdf3d6; color: #7a5a00; } #lib .lib-tag.k-6 { background: #fbe9ec; color: #8f2d43; } #lib .lib-tag.k-7 { background: #e2f0f4; color: #1d5a6b; }
@media (prefers-color-scheme: dark) { #lib .lib-tag[class*="k-"] { background: var(--surface-2); color: var(--ink-2); } }
@media (max-width: 640px) { #lib .lib-dates li { grid-template-columns: 1fr; gap: 2px; } }
/* how the lists are ordered: the multipliers, an example chain (Level 1 → Level 2 → Level 3) and the labels */
#lib .cs-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 16px; margin: 0 0 14px; }
#lib .cs-panel > h3.lib-sub { margin: 0 0 8px; }
#lib .cs-panel > h3.lib-sub ~ h3.lib-sub { margin-top: 22px; }
#lib .cs-table { width: 100%; border-collapse: collapse; font-size: 13px; line-height: 1.45; }
#lib .cs-table th { text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); padding: 0 8px 5px 0; border-bottom: 1px solid var(--line); }
#lib .cs-table td { padding: 6px 8px 6px 0; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
#lib .cs-mult th:last-child, #lib .cs-mult td:last-child { width: 96px; padding-right: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
#lib .cs-mult tr.cs-group td { padding-top: 14px; font-size: 12px; font-weight: 600; color: var(--ink-3); text-align: left; border-bottom: 1px solid var(--line); }
#lib .cs-labels td:first-child { width: 46%; }
#lib .cs-labels td:last-child { color: var(--ink-2); }
/* the chain: three boxes and two links on one grid; under it, the "via" line from the third box's middle to the first's */
#lib .cs-chain { display: grid; grid-template-columns: minmax(0, 1fr) 150px minmax(0, 1fr) 150px minmax(0, 1fr); align-items: stretch; margin-top: 4px; }
#lib .cs-box { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 10px; text-align: center; display: flex; flex-direction: column; justify-content: center; min-height: 96px; }
#lib .cs-box b { display: block; font-size: 13.5px; font-weight: 600; margin: 2px 0; }
#lib .cs-box p { margin: 0; font-size: 12px; color: var(--ink-2); line-height: 1.4; }
#lib .cs-lv { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
#lib .cs-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; padding: 0 6px; text-align: center; }
#lib .cs-tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 3px; }
#lib .cs-line { width: 100%; height: 1px; background: var(--ink-3); position: relative; }
#lib .cs-line::after { content: ''; position: absolute; right: 0; top: -4px; border: 4px solid transparent; border-left: 6px solid var(--ink-3); border-right: 0; }
#lib .cs-score { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
#lib .cs-score b { color: var(--ink); font-weight: 600; }
#lib .cs-back { height: 18px; border-bottom: 1px dashed var(--ink-3); }
#lib .cs-back.a { width: 50%; justify-self: end; border-left: 1px dashed var(--ink-3); position: relative; }
#lib .cs-back.a::before { content: ''; position: absolute; left: -5px; top: -1px; border: 4px solid transparent; border-bottom: 6px solid var(--ink-3); border-top: 0; }
#lib .cs-back.z { width: 50%; justify-self: start; border-right: 1px dashed var(--ink-3); }
#lib .cs-via { text-align: center; margin-top: 8px; }
#lib .cs-via-score { text-align: center; margin-top: 4px; white-space: normal; }
/* (on a narrow screen the chain runs downwards, and the "via" line gives way to the label and sum under it) */
@media (max-width: 640px) {
  #lib .cs-chain { grid-template-columns: minmax(0, 1fr); }
  #lib .cs-link { padding: 8px 0; }
  #lib .cs-line { width: 1px; height: 18px; }
  #lib .cs-line::after { right: -4px; top: auto; bottom: 0; border: 4px solid transparent; border-top: 6px solid var(--ink-3); border-bottom: 0; }
  #lib .cs-back { display: none; }
  #lib .cs-labels td:first-child { width: auto; }
  #lib .cs-labels tr { display: block; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
  #lib .cs-labels td { display: block; border: 0; padding: 2px 0; }
}

/* the page's three tabs: Documents, and the two explanations as pages of their own */
.lib-tabs { display: flex; flex-wrap: wrap; gap: 4px 20px; border-bottom: 1px solid var(--line); margin: 0 0 18px; }
#lib .lib-tab { font: inherit; font-size: 13.5px; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 6px 0 8px; color: var(--ink-2); cursor: pointer; }
#lib .lib-tab:hover { color: var(--accent); }
#lib .lib-tab.on { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
#lib .lib-page > h2 { margin: 4px 0 6px; }

/* Level 3 of both authorities: each line tagged; the strip shows one authority's documents (the joint ones with either) */
