/* library.css: sheet library pages (WEB-003 library, WEB-004 sheet in library mode, WEB-005 topic,
   WEB-023 glossary). Flag-owned (sheet_library): build_site.py copies it only into a build root
   where a library page was rendered, so build/site/ never ships it while the flag is off.
   Kept apart from site.css on purpose (31 Oct 2026: another worker was editing site.css).
   Uses the site.css custom properties; Jost 400 body, GeosansLight headings and labels. */

.lib .lede { font-size: 19px; line-height: 1.55; max-width: 42.5rem; margin: 0 0 20px; }
.lib .crumbs { font-family: var(--geo); letter-spacing: 0.08em; font-size: 15px; color: var(--ink-soft); margin: 0 0 12px; }
.lib .crumbs a { color: var(--steel); }
.sheet-num { font-family: var(--geo); letter-spacing: 0.08em; }

/* jump list and chips */
.lib .jump ul, .lib .chips, .lib .az ul { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.lib .jump a, .lib .chips li, .lib .az li > * {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 12px;
  border: 1px solid var(--ink); font-family: var(--geo); letter-spacing: 0.06em; font-size: 16px; color: var(--ink); text-decoration: none; }
.lib .chips li a { color: var(--steel); }
.lib .chips .count { font-family: var(--body); font-size: 13px; color: var(--ink-soft); }
.lib .az li > * { min-width: 44px; justify-content: center; padding: 4px 6px; }
.lib .az li > span { color: #9AA0A0; border-color: #C9CCCC; }

/* Start here: title block rows ORDER | SHEET | WHY */
.route-head, .route-row { display: grid; grid-template-columns: 64px minmax(220px, 1.2fr) 2fr; }
.route-head { border: 1px solid var(--black); border-bottom: 0; font-family: var(--geo); font-size: 11px; letter-spacing: 0.14em; color: var(--ink-soft); }
.route-head span { padding: 6px 10px; border-left: 1px solid var(--black); }
.route-head span:first-child { border-left: 0; }
.route { list-style: none; padding: 0; margin: 0 0 32px; border: 1px solid var(--black); }
.route-row { border-top: 1px solid var(--black); align-items: stretch; }
.route-row:first-child { border-top: 1px solid var(--black); }
.route-row > span { padding: 10px; border-left: 1px solid var(--black); }
.route-row > span:first-child { border-left: 0; }
.route-order { font-family: var(--geo); font-size: 28px; letter-spacing: 0.06em; color: var(--gold-dark); }
.route-sheet { display: flex; gap: 12px; align-items: center; }
.route-sheet .thumb { width: 72px; height: auto; flex: none; border: 1px solid var(--ink); }
.route-why { color: var(--ink); }

/* topic groups */
.lib .group h3 { margin-top: 28px; }
.lib .group-order { display: inline-block; min-width: 1.6em; color: var(--gold-dark); }
.lib .group p { max-width: 42.5rem; margin: 0 0 10px; }

/* sheet cards */
/* DESIGN.md library grid: 1 column under 480 px, 2 to 3 columns to 960 px, 4 above */
.cards { list-style: none; padding: 0; margin: 0 0 32px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 960px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 720px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } }
@media (max-width: 479px) { .cards { grid-template-columns: 1fr; } }
.card a, .card-nolink { display: flex; flex-direction: column; height: 100%; border: 1px solid var(--black); color: var(--ink); text-decoration: none; background: var(--paper); }
.card a:hover, .card a:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.card .thumb { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; object-fit: cover; border-bottom: 1px solid var(--black); }
.thumb-missing { display: flex; align-items: center; justify-content: center; aspect-ratio: 1 / 1; background: var(--sheet-grey);
  font-family: var(--geo); font-size: 12px; letter-spacing: 0.14em; color: var(--ink-soft); }
.route-sheet .thumb-missing { width: 72px; flex: none; }
.card-num { font-family: var(--geo); font-size: 12px; letter-spacing: 0.14em; color: var(--ink-soft); padding: 8px 10px 0; }
.card-title { font-family: var(--body); font-size: 15px; line-height: 1.35; padding: 2px 10px 10px; }
.card-note { font-size: 12px; color: var(--ink-soft); padding: 0 10px 10px; }

/* sheet page */
.lib-figure figcaption.credit { font-family: var(--body); font-size: 13px; color: var(--ink-soft); padding: 6px 10px; border-top: 1px solid var(--black); }
.credit-label, .part-label { font-family: var(--geo); letter-spacing: 0.12em; text-transform: uppercase; }
.lib .writeup { max-width: 42.5rem; }
.lib .writeup p, .lib .writeup li { line-height: 1.65; }
.lib .eq { font-size: 18px; margin: 12px 0 16px; padding: 10px 14px; border-left: 3px solid var(--gold); background: #FAF8F2; overflow-x: auto; }
.lib .eq code { font-family: var(--body); white-space: pre-wrap; }
.lib sup.ref { font-size: 0.72em; line-height: 0; }
.lib sup.ref a { color: var(--steel); text-decoration: none; }
.refs { max-width: 42.5rem; margin-top: 40px; }
.refs h2 { margin: 0 0 8px; }
.refs-label { display: inline-block; border: 1px solid var(--black); padding: 2px 10px; font-size: 13px; letter-spacing: 0.16em; }
.ref-list { list-style: none; padding: 0; margin: 0; font-size: 15px; }
.ref-list li { margin: 0 0 8px; overflow-wrap: anywhere; }
.ref-list a { color: var(--steel); }
.ref-n { font-family: var(--geo); letter-spacing: 0.06em; }

/* glossary entries: CONCEPT across the top, then AU/NZ | UK | US cells */
.term { border: 1px solid var(--black); margin: 0 0 16px; padding: 0 0 8px; max-width: 56rem; scroll-margin-top: 16px; }
.term h3 { margin: 0; padding: 8px 12px; border-bottom: 1px solid var(--black); font-size: 21px; }
.term .abbr { font-family: var(--body); font-size: 15px; color: var(--ink-soft); margin-left: 6px; }
.term-cells { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border-bottom: 1px solid var(--black); }  /* one cell per region with a sourced name */
.term-cells .term-cell { padding: 6px 12px; border-left: 1px solid var(--black); }
.term-cells .term-cell:first-child { border-left: 0; }
.term .lab { display: block; font-family: var(--geo); font-size: 11px; letter-spacing: 0.14em; color: var(--ink-soft); }
.term-sheets .lab, .term-src .lab { display: inline; margin-right: 6px; }
.term > p { margin: 8px 12px; }
.term-src { font-size: 13px; color: var(--ink-soft); }
.term-src a, .term-sheets a { color: var(--steel); }
.term:target { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (max-width: 720px) {
  .route-head { display: none; }
  .route-row { grid-template-columns: 48px 1fr; }
  .route-why { grid-column: 1 / -1; border-left: 0 !important; border-top: 1px dashed #9AA0A0; }
  .term-cells { grid-auto-flow: row; grid-template-columns: 1fr; }
  .term-cells .term-cell { border-left: 0; border-top: 1px solid var(--black); }
  .term-cells .term-cell:first-child { border-top: 0; }
}

/* parts 2 to n of a multi-part sheet: a grid under part 1 */
.lib-parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; max-width: 900px; margin: 0 0 24px; }
.lib-parts .sheet-figure { margin: 0; }

/* centred reading column (31 Oct 2026, owner review: body text left aligned again). Library pages
   get main.content-reading (site.css). The .lib wrapper and its sections pass the 42.5rem column on
   to their own children, so headings, ledes, write-ups, references and glossary entries share one
   centred column; card grids, the Start here table and the parts grid break out to the full
   drawing-window width, the sheet figure to 900 px. Phones: the column is the content width. */
main.content-reading > .lib, main.content-reading .lib > section { max-width: none; }
main.content-reading .lib > *, main.content-reading .lib > section > * { max-width: var(--measure); margin-left: auto; margin-right: auto; }
main.content-reading .lib :is(.cards, .route, .route-head) { max-width: none; }
main.content-reading .lib > :is(.lib-figure, .lib-parts) { max-width: 900px; }
