
/* PAGE LAYOUT ONLY. Tokens only, no raw colours.
   Candidates for the system are marked "promote" and listed in the build report. */

/* ---- Head: title, search, and the record beside it --------------------- */
.lib-head{padding-block:clamp(1.1rem,.9rem + 1vw,1.75rem) clamp(2rem,1.5rem + 2vw,3.25rem)}
.lib-head__grid{margin-top:clamp(1.25rem,1rem + 1vw,2rem);align-items:end}
.lib-head .lead{margin-top:var(--s4)}
.lib-head .search{margin-top:var(--s6)}
.lib-try{display:flex;flex-wrap:wrap;align-items:center;gap:.5rem;margin-top:var(--s4)}
.lib-try__label{font-size:var(--t-small);color:var(--fg-3);margin-right:.25rem}
@media (max-width:599px){
  /* phones: three examples on one line, so the first result stays on the first screen */
  .lib-try__wide{display:none}
  .lib-try .chip{padding-inline:.85rem}
}
@media (min-width:900px) and (max-width:1139px){.lib-try [data-q="seizures"]{display:none}}   /* keeps the examples on one line */
@media (max-width:420px){
  .lib-head .search{padding-left:1.1rem}
  .lib-head .search>.i{display:none}                 /* the button already says "Search"; the words need the room */
}

/* The record as a dot histogram: one file of marks per year, so 21 years fit a 5-column cell.
   Phones: omitted. At 5px a mark cannot be read or pointed at, and the strip would push the first
   result off the first screen; the result count says the same thing in words. */
.lib-record{--u:clamp(8px,.32rem + .28vw,10px);--u-gap:3px;--per:1;gap:.6rem}
.lib-record .record{gap:0}
.lib-record .record__yr{visibility:hidden}
.lib-record .record__yr--show{visibility:visible}
.lib-record .record__col:first-child .record__yr{align-self:flex-start}     /* the end labels stay inside the figure */
.lib-record .record__col:last-child .record__yr{align-self:flex-end}
.lib-record .record__read{min-height:2.9em;margin-top:.4rem;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}
.lib-record .fig__cap{max-width:none}
@media not ((hover:hover) and (pointer:fine)){.lib-record .record__read{display:none}}
@media (max-width:599px){.lib-record{display:none}}
@media (min-width:600px) and (max-width:899px){.lib-record{--per:2;--u:8px}}

/* ---- Scope tabs: full width, the rule that opens the ledger ------------- */
.lib-tabs{margin-bottom:clamp(1.25rem,1rem + 1.2vw,2rem)}
.lib-tabs .tab__n:empty{display:none}
@media (max-width:999px){
  /* the strip runs to the screen edges, so a cut-off label shows there is more to the right */
  .lib-tabs{margin:0 calc(-1 * var(--gutter));padding-inline:calc(var(--gutter) - .75rem);scroll-padding-inline:var(--gutter)}
  .lib-tabs.is-clipped{-webkit-mask-image:linear-gradient(90deg,var(--ink) calc(100% - 3.5rem),transparent);mask-image:linear-gradient(90deg,var(--ink) calc(100% - 3.5rem),transparent)}
}

/* ---- Rail, results, orientation ---------------------------------------- */
.lib-list{padding-bottom:var(--section-tight)}
.lib-grid{align-items:start}
@media (max-width:999px){.lib-grid{row-gap:0}}
@media (min-width:1000px){
  .lib-grid{grid-template-rows:auto 1fr}
  .lib-rail{grid-column:1;grid-row:1;padding-top:.95rem}
  .lib-main{grid-column:2;grid-row:1/span 2}
  .lib-orient{grid-column:1;grid-row:2}
}
/* it follows the reader down the list only where the whole block fits under the header */
@media (min-width:1000px) and (min-height:760px){.lib-orient{position:sticky;top:calc(var(--header-h) + 1.5rem)}}

/* Skip link that appears in place when focused (the system .skip is pinned to the top of the page). promote */
.lib-skip{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.lib-skip:focus{position:static;display:inline-flex;align-items:center;width:auto;height:auto;min-height:2.75rem;overflow:visible;clip-path:none;margin-bottom:var(--s3);color:var(--link);font-weight:600;text-decoration:underline;text-underline-offset:.2em}

/* Filters: one disclosure on phones (closed, labelled with the number active), an open rail on desktop. promote */
.lib-filters>summary .lib-filters__label{display:inline-flex;align-items:center;gap:.6rem}
.lib-filters>summary .lib-filters__label .i{transform:none;color:var(--fg)}
.lib-filters__n{font-weight:500;font-size:var(--t-small);color:var(--fg-3);font-variant-numeric:tabular-nums}
.lib-filters__n.is-on{padding:.1rem .5rem;border-radius:var(--r-content);background:var(--btn-bg);color:var(--btn-fg);font-weight:600}
.lib-filters .acc__body{max-width:none;color:var(--fg);padding-bottom:var(--s5)}
@media (max-width:999px){.lib-filters{border-top:0}}
@media (min-width:1000px){
  .js .lib-filters{border:0}
  .js .lib-filters>summary{display:none}
  .js .lib-filters .acc__body{padding:0}
  .js .lib-apply{display:none}
}
.lib-group+.lib-group{margin-top:var(--s4);padding-top:var(--s5);border-top:1px solid var(--rule)}
.lib-group>h3{margin-bottom:var(--s2)}
.lib-group .check{padding-block:.5rem}
.lib-group .check:has(input:disabled){color:var(--fg-3);cursor:default}
.lib-group .check input:disabled{background:var(--bg-sunk);border-color:var(--rule)}
.lib-group .field__hint{display:block;margin:-.15rem 0 0 1.95rem}
.lib-years{display:grid;grid-template-columns:1fr 1fr;gap:.75rem;margin-top:var(--s2)}
.lib-apply{margin-top:var(--s5)}
@media (min-width:560px) and (max-width:999px){
  /* tablets: the open disclosure uses the width instead of one long stack */
  .lib-filters .acc__body{display:grid;grid-template-columns:1fr 1fr;gap:0 var(--gap);align-items:start}
  .lib-filters .lib-group:first-child{grid-row:span 6}
  .lib-filters .lib-group:nth-child(2){margin-top:0;padding-top:0;border-top:0}
  .lib-apply{grid-column:1/-1}
}

/* Results bar: the count, the sort, then one removable chip per active filter. promote */
.lib-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:.25rem 1.5rem;min-height:3rem}
.lib-count{color:var(--fg-2);font-size:1.0625rem;line-height:1.35}
.lib-count b{color:var(--fg);font-variant-numeric:tabular-nums}
.lib-count:focus-visible{outline-offset:6px}
.lib-sort{display:flex;align-items:center;gap:.6rem}
.lib-sort .field__label{color:var(--fg-2);font-weight:500;white-space:nowrap}
.lib-sort .select{width:auto;min-width:10.5rem;min-height:2.75rem;padding-block:.4rem;font-size:var(--t-small);font-weight:600}
@media (max-width:767px){.lib-sort .select{font-size:1rem}}   /* iOS zooms into fields under 16px */
.lib-chips{display:flex;flex-wrap:wrap;align-items:center;gap:.7rem .5rem;margin-top:.4rem}
.lib-chips .chip{position:relative;gap:.35em;padding-right:.5rem}
.lib-chips .chip::after{content:"";position:absolute;inset:-.4rem 0}      /* a 32px chip with a 44px target */
.lib-chips .chip .i{width:1em;height:1em;color:var(--fg-3)}
.lib-chips .chip:hover .i{color:var(--fg)}
.lib-clear{min-height:2.75rem;padding-inline:.35rem;font-size:var(--t-small);font-weight:600}
.lib-nojs{margin-top:var(--s3);padding:.7rem .9rem;border-left:3px solid var(--fg);background:var(--bg-sunk);font-size:var(--t-small);line-height:1.5}
.lib-ledger{margin-top:var(--s4)}
/* One aside track for every row, so titles wrap at the same measure whether or not a row has an aside. promote */
@media (min-width:1000px){.lib-ledger .row{grid-template-columns:minmax(0,1fr) 10.5rem}}

/* A topic that matches the search sits above the rows as the system's topic line. */
.lib-best__k{padding-block:var(--s4) var(--s3);border-top:1px solid var(--rule)}
.lib-best .topics{border-top:0}
.lib-best .topic{grid-template-columns:minmax(0,1fr) auto;padding-top:0}
.lib-best .topic+.topic{padding-top:1.15rem}
.lib-best .topic::before{content:none}
.lib-best .topic__name{grid-column:1}
.lib-best .topic__n{grid-column:2}
.lib-best__act{grid-column:1;position:relative;z-index:1;margin-top:.15rem}
.lib-best__act .link{min-height:2.75rem;font-size:var(--t-small);font-weight:600}
.lib-best:not([hidden])+#lib-rows .rows{border-top:0}
.lib-why{color:var(--fg-2)}

.lib-empty{margin-top:var(--s5);padding-inline:clamp(1.25rem,1rem + 2vw,3rem)}
.lib-empty>p{max-width:34rem;margin-inline:auto}
.lib-empty .cluster{justify-content:center}
.lib-empty__acts{margin-top:var(--s5)}
.lib-empty__topics{margin-top:var(--s3)}
.lib-empty .kicker{margin-top:var(--s6)}
.lib-empty .go{margin-top:var(--s4)}

/* Pager: every page on desktop, first · current · last on phones. promote */
.lib-pager{margin-top:var(--s6)}
.lib-pager .pager__step{display:inline-flex;align-items:center;gap:.45em;padding-inline:.85rem}
.lib-pager .pager__step--prev .i{transform:scaleX(-1)}
.lib-pager .pager__gap{min-width:1.5rem;padding-inline:0;color:var(--fg-3)}
.lib-pager [aria-disabled="true"]{color:var(--fg-3);opacity:.55}
@media (max-width:559px){
  .lib-pager>:not(.pg-n):not(.pager__step){display:none}
  .lib-pager .pager__step{padding-inline:.6rem}
  .lib-pager .pager__step span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
}
@media (min-width:560px){.lib-pager>:not(.pg-w):not(.pager__step){display:none}}

/* Orientation: in the rail beside the list on desktop, after it on phones. */
.lib-orient{margin-top:var(--s7);padding-top:var(--s5);border-top:2px solid var(--rule-strong)}
.lib-orient__tools{display:grid;gap:.75rem;margin-top:var(--s4)}
@media (min-width:640px) and (max-width:999px){.lib-orient__tools{grid-template-columns:1fr 1fr}}
@media (min-width:1000px){.lib-orient{margin-top:var(--s6)}.lib-orient .tool__title{font-size:1.25rem}}
