/* My books (SPEC-LIBRARY, L3): one stylesheet for stoareads.app and stoareads.com. Every colour, font and shadow is
   a --lib-* custom property each site maps to its own tokens; sizes are the spec's, in rem. */

.lib {
  /* At least a screen tall from the first paint, so the page's footer never shows and then gets pushed down (CLS). */
  min-height: 100svh;
  /* No cap of its own (UX-09, Juno): My books starts on the page's own gutter and its covers span the site's measure.
     Text keeps a reading measure (below), left-aligned, never centred. The top space is the other page heads' (Juno). */
  padding: 1.5rem 0 2rem;
  color: var(--lib-ink);
  font-family: var(--lib-font);
}

@media (min-width: 900px) {
  .lib {
    padding-top: 2.5rem;
  }
}

/* My books' sentences keep a reading measure inside the full-width page (UX-09): the list pages' 42rem column. */
.lib-line,
.lib-hint,
.lib-problem,
.lib-foot {
  max-width: 42rem;
}

.lib-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.lib-mut {
  color: var(--lib-mut);
}

.lib a {
  color: inherit;
}

/* ---- The heading and its "⋯" (§1, §10.1) ---- */
.lib-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.lib-h1 {
  margin: 0;
  font: 500 1.75rem / 2.125rem var(--lib-display);
}

.lib-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 5;
  min-width: 15rem;
  margin: 0.25rem 0 0;
  padding: 0.25rem 0;
  list-style: none;
  background: var(--lib-surface);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-sheet-radius);
  box-shadow: var(--lib-lift);
}

.lib-menu a,
.lib-menu-b {
  display: flex;
  align-items: center;
  min-height: 3rem;
  padding: 0 1rem;
  font: 400 1rem / 1.375rem var(--lib-font);
  text-decoration: none;
}

.lib-menu-b {
  width: 100%;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.lib-menu a:focus-visible,
.lib-menu-b:focus-visible {
  background: var(--lib-sunk);
}
@media (hover: hover) {
  .lib-menu a:hover,
  .lib-menu-b:hover {
    background: var(--lib-sunk);
  }
}

/* Find on my shelf (R3-44): a button drawn as a field, under the h1 from 24 read books. */
.lib-find-lead {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-sizing: border-box;
  width: 100%;
  max-width: 560px;
  min-height: 44px;
  margin: 0.75rem 0 0;
  padding: 0 0.875rem;
  font: 400 1rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
  text-align: left;
  background: var(--lib-bg);
  border: 1px solid var(--lib-line);
  border-radius: 8px;
  cursor: text;
}

.lib-find-lead svg {
  flex: none;
}

/* From 1000 px the Read shelf's own Find field is on the first screen, so the button would repeat it (Juno). */
@media (min-width: 1000px) {
  .lib-find-lead {
    display: none;
  }
}

/* S1 (Juno's audit): below 1000 px the lead is the one Find; Read's own field shows once the lead is tapped. */
@media (max-width: 999.98px) {
  .lib-find-shut .s3-find-l,
  .lib-find-shut .s3-find {
    display: none;
  }
}

/* ---- Sections ---- */
.lib-sec {
  margin: 2rem 0 0;
}

.lib-h {
  margin: 0 0 0.75rem;
  font: 600 1.25rem / 1.625rem var(--lib-display);
}

.lib-h-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 0.75rem;
}

.lib-h-row .lib-h {
  margin: 0;
}

.lib-all {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
}

.lib-line {
  margin: 0.5rem 0 0;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
}

.lib-line a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

.lib-foot {
  margin-top: 2rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-ink);
}

.lib-foot a {
  color: var(--lib-ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* For you's link and the public page sit together at the foot, alike (Juno on #371). */
.lib-foot + .lib-foot {
  margin-top: 0;
}

.lib-problem {
  margin: 1rem 0 0;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-error);
}

.lib-text {
  min-height: 2.75rem;
  padding: 0;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ---- Covers: the site's cover in a 2:3 box this module sizes ---- */
.lib-cv {
  position: relative;
  display: block;
  flex: none;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border-radius: var(--lib-cover-radius);
}

.lib-cv > * {
  width: 100% !important;
  height: 100% !important;
}

.lib-cv-48 {
  width: 3rem;
}

.lib-cv-96 {
  width: 6rem;
}

.lib-cv-132 {
  width: 8.25rem;
}

.lib-cv-110 {
  width: 100%;
}

/* "⋯": borderless, 44 by 44 (§G.2). */
.lib-more {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: var(--lib-mut);
  background: none;
  border: 0;
  border-radius: var(--lib-radius);
  cursor: pointer;
}

.lib-more svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: currentColor;
}

.lib-more:focus-visible {
  color: var(--lib-ink);
  background: var(--lib-sunk);
}
@media (hover: hover) {
  .lib-more:hover {
    color: var(--lib-ink);
    background: var(--lib-sunk);
  }
}

/* ---- Reading now (§2): a scroll-snap shelf on a phone, a grid of 6 on a desktop ---- */
.lib-shelf {
  display: flex;
  gap: 1rem;
  margin: 0 -1rem;
  padding: 0 1rem 0.25rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 1rem;
  list-style: none;
  scrollbar-width: none;
}

.lib-shelf::-webkit-scrollbar {
  display: none;
}

.lib-shelf-i {
  position: relative;
  flex: none;
  width: 8.25rem;
  scroll-snap-align: start;
}

/* The next cover peeks in by 24 px: the shelf's own padding leaves room for it at 390. */
.lib-shelf-a {
  display: block;
  text-decoration: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.lib-shelf-t {
  display: block;
  max-height: 2.5rem;
  margin: 0.5rem 0 0;
  overflow: hidden;
  font: 600 0.9375rem / 1.25rem var(--lib-font);
}

.lib-shelf-i > .lib-more {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  color: var(--lib-on-cover);
  background: var(--lib-scrim);
  opacity: 0;
}

/* Finished in one tap (§11): a 32 px round ✓ inset 8 px from the cover's bottom right, inside a 44 px target. */
.lib-done {
  position: absolute;
  top: calc(12.375rem - 2.875rem); /* the cover's height, less the target's reach above the circle */
  right: 0.125rem;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: var(--lib-ink);
  background: none;
  border: 0;
  cursor: pointer;
}

.lib-done-c {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  font: 600 1rem / 1 var(--lib-font);
  background: color-mix(in srgb, var(--lib-surface) 92%, transparent);
  border: 1px solid var(--lib-line);
  border-radius: 50%;
}

.lib-done:focus-visible > .lib-done-c {
  background: linear-gradient(var(--lib-sunk), var(--lib-sunk)), var(--lib-surface);
}
@media (hover: hover) {
  .lib-done:hover > .lib-done-c {
    background: linear-gradient(var(--lib-sunk), var(--lib-sunk)), var(--lib-surface);
  }
}

.lib-done:focus-visible {
  outline: none;
}

.lib-done:focus-visible > .lib-done-c {
  outline: 2px solid var(--lib-accent);
  outline-offset: 2px;
}

.lib-shelf-i:focus-within > .lib-more {
  opacity: 1;
}

/* Hover only where there is a pointer that hovers: after a tap, a touch screen keeps :hover stuck on (App builder). */
@media (hover: hover) {
  .lib-shelf-i:hover > .lib-more {
    opacity: 1;
  }
}

.lib-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 8.25rem;
  aspect-ratio: 2 / 3;
  padding: 0;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-ink);
  background: none;
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-cover-radius);
  cursor: pointer;
}

.lib-add:focus-visible {
  background: var(--lib-sunk);
}
@media (hover: hover) {
  .lib-add:hover {
    background: var(--lib-sunk);
  }
}

.lib-add-plus {
  font: 300 2rem / 2rem var(--lib-font);
}

.lib-empty-line {
  position: absolute;
  top: 0;
  left: calc(100% + 1rem);
  width: min(10rem, calc(100vw - 12.25rem));
  margin: 0;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
}

@media (min-width: 721px) {
  .lib-shelf:not(.lib-rail) {
    display: grid;
    grid-template-columns: repeat(6, 8.25rem);
    justify-content: space-between;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  .lib-rail {
    margin: 0;
    padding: 0;
  }
}

/* ---- Next up (§3): a list you drag ---- */
.lib-hint {
  margin: -0.25rem 0 0.75rem;
  font: 400 0.875rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

/* The page's one column (Juno on .com #361, WS-54): Next up runs its full width, so every heading, count and filter
   lines up with it. */
.lib-next {
  position: relative;
  margin: 0;
  padding: 0;
  list-style: none;
  touch-action: pan-y;
}

/* The grip (M1): six dots in --mut, right of "⋯", in a 44 by 44 target. Dragging starts here at once on touch. */
.lib-grip {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  margin-left: -0.5rem;
  padding: 0;
  color: var(--lib-mut);
  background: none;
  border: 0;
  border-radius: var(--lib-radius);
  cursor: grab;
  touch-action: none;
}

.lib-grip-g {
  width: 0.625rem;
  height: 1.0625rem;
  fill: currentColor;
}

.lib-hint .lib-grip-g {
  width: 0.5rem;
  height: 0.8125rem;
  margin: 0 0.125rem;
  vertical-align: -0.0625rem;
}

.lib-grip:focus-visible,
.lib-dragging .lib-grip,
.lib-lifted .lib-grip {
  color: var(--lib-ink);
}
@media (hover: hover) {
  .lib-grip:hover {
    color: var(--lib-ink);
  }
}

.lib-dragging .lib-grip {
  cursor: grabbing;
}

/* Where the dragged row will land: a 2 px --accent line (M1). */
.lib-drop {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 4;
  height: 2px;
  background: var(--lib-accent);
  pointer-events: none;
}

.lib-drop[hidden] {
  display: none;
}

/* The one-time nudge: the first row lifts 8 px and settles, once, 800 ms after it shows (M1). */
.lib-nudge > .lib-row:first-child > .lib-row-in {
  animation: lib-nudge 600ms ease-in-out 800ms 1;
}

@keyframes lib-nudge {
  0%,
  100% {
    transform: none;
  }

  50% {
    transform: translateY(-8px);
  }
}

.lib-row {
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--lib-line);
  outline-offset: -2px;
  -webkit-touch-callout: none;
  user-select: none;
  touch-action: pan-y;
  transition: transform 150ms ease;
}

.lib-row:first-child {
  border-top: 1px solid var(--lib-line);
}

.lib-row-in {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 5.5rem;
  padding: 0.5rem 0;
  background: var(--lib-bg);
  cursor: grab;
}

.lib-row-c {
  flex: none;
}

.lib-row-b {
  flex: 1;
  min-width: 0;
}

/* A 44 px target around the title without moving it: padding out, the same margin back (audit P1 #7). */
.lib-row-t {
  display: block;
  padding-block: calc((2.75rem - 1lh) / 2);
  margin-block: calc((1lh - 2.75rem) / 2);
  font: 600 1rem / 1.375rem var(--lib-font);
  text-decoration: none;
}

.lib-row-by,
.lib-row-pr {
  margin: 0.125rem 0 0;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

.lib-row-pr {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

/* "⋯" on a row is always there in --mut, left of the grip, with a mouse as on touch: no hidden controls (M1, Juno). */

.lib-dragging {
  z-index: 3;
  overflow: visible;
  /* All four sides: in dark there is no shadow, so the --rule border is what lifts it (§3.2, Juno on M1). */
  box-shadow: var(--lib-lift), 0 0 0 1px var(--lib-lift-border);
  border-color: var(--lib-lift-border);
  transition: none;
}

/* A thumb beside its own title shows its tone only: a typeset title can't fit at 48 px without a cut (Juno on M1). */
:is(.lib, .lib-sheet, .lib-as) :is(.lib-row-c, .lib-sheet-book, .lib-as-c) .cv-box .cv-none :is(b, i) {
  visibility: hidden;
}

/* The sheet's cover is 96 wide, room for the typeset title and surname. */
.lib-sheet-book .lib-cv-96 .cv-box .cv-none :is(b, i) {
  visibility: visible;
}

.lib-dragging .lib-row-in {
  cursor: grabbing;
}

.lib-lifted .lib-row-in {
  box-shadow: inset 0 0 0 2px var(--lib-ink);
}

/* The swipe's label, revealed under the row as it slides: --ink on --sunk, no colour, no icon (§3.4). */
.lib-swipe-l,
.lib-swipe-r {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  padding: 0 1rem;
  font: 600 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-ink);
  background: var(--lib-sunk);
}

.lib-swipe-r {
  justify-content: flex-end;
}

.lib-swiping[data-dir='start'] .lib-swipe-l,
.lib-swiping[data-dir='remove'] .lib-swipe-r {
  display: flex;
}

/* ---- Read (§5): a wall of covers by year ---- */
.lib-segs {
  display: flex;
  gap: 1rem;
}

.lib-seg {
  min-height: 2.75rem;
  /* 8px of hit area each side, with the text where it was: Year is 44 wide, not 31 (Vera, #376) */
  padding: 0 0.5rem;
  margin-inline: -0.5rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
  background: none;
  border: 0;
  cursor: pointer;
}

.lib-seg[aria-checked='true'] {
  font-weight: 600;
  color: var(--lib-ink);
  text-decoration: underline 2px;
  text-underline-offset: 0.35em;
}

.lib-year + .lib-year {
  margin-top: 1.5rem;
}

.lib-year-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 0 0 0.75rem;
  font: 400 1.25rem / 1.625rem var(--lib-display);
}

.lib-year-h .lib-mut {
  font: 400 0.875rem / 1.25rem var(--lib-font);
}

.lib-wall {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 768px) {
  .lib-wall {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .lib-wall {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

.lib-tile {
  position: relative;
  min-width: 0;
  container-type: inline-size; /* the laurels under it size by the tile, not the window (Juno, #606) */
}

.lib-tile-a {
  display: block;
  -webkit-touch-callout: none;
  user-select: none;
}

.lib-tile > .lib-more {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  color: var(--lib-on-cover);
  background: var(--lib-scrim);
  opacity: 0;
}

.lib-tile:focus-within > .lib-more {
  opacity: 1;
}

/* Hover only where there is a pointer that hovers: after a tap, a touch screen keeps :hover stuck on (App builder). */
@media (hover: hover) {
  .lib-tile:hover > .lib-more {
    opacity: 1;
  }
}

@media (hover: none) {
  .lib-tile > .lib-more,
  .lib-shelf-i > .lib-more {
    display: none; /* touch opens the sheet with a long-press */
  }
}

.lib-under {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 1.25rem;
  margin: 0.375rem 0 0;
}

/* A stored rating under a tile: five small laurels, drawn by onboarding.css. 3px apart at every size, never closer, or
   they merge into a chain. 18px on a tile at least 124px wide, 14px below that (82px fits a 320 screen's 87px tile).
   Keyed on the tile, so a narrow column on a wide screen gets 14 too (Juno, #606). */
.lib-glyphs {
  display: inline-flex;
  gap: 3px;
}

.lib-glyphs .ob-glyph svg {
  width: 14px;
  height: 14px;
}

@container (min-width: 124px) {
  .lib-glyphs .ob-glyph svg {
    width: 18px;
    height: 18px;
  }
}

/* Under 124px the heart always takes its own line under the laurels, and both lines are kept even when empty, so every
   tile in a row is the same height and the shelf lines up (Juno, #606). */
@container (max-width: 123.98px) {
  .lib-under {
    display: grid;
    grid-template-rows: 1.25rem 1.25rem;
    row-gap: 0.25rem;
    justify-items: start;
    align-items: center;
  }

  .lib-under > .lib-fav {
    grid-row: 2;
  }
}

.lib-fav {
  display: inline-flex;
  color: var(--lib-ink);
}

.lib-fav svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: currentColor;
}

.lib-rate {
  min-height: 2.75rem;
  /* Rate is 46 wide, not 30, and its text does not move (Vera, #376) */
  margin: -0.75rem -0.5rem;
  padding: 0 0.5rem;
  font: 400 0.875rem / 1.25rem var(--lib-font);
  color: var(--lib-ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  background: none;
  border: 0;
  cursor: pointer;
}

/* Didn't finish (R3-35): Read's head, the h2's own type, the count inline and muted, then the caret. The button fills
   the h2, so the whole line opens it, at least 44 px tall. */
.lib-dnf {
  display: inline-flex;
  align-items: baseline;
  min-height: 44px;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

/* The caret on the count's x-height: its box stands on the baseline, lifted so the V's middle meets the x-height's. */
.lib-dnf .lib-chev {
  align-self: baseline;
  margin: 0 0 3px 0.625rem;
}

.lib-dnf-sec > .lib-h + div {
  margin-top: 0.75rem;
}

/* ---- The quick sheet (§4): a bottom sheet on a phone, a popover by "⋯" on a desktop ---- */
.lib-sheet {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  max-height: 85vh;
  margin: auto 0 0;
  padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  color: var(--lib-ink);
  background: var(--lib-surface);
  border: 0;
  border-radius: var(--lib-sheet-radius) var(--lib-sheet-radius) 0 0;
}

.lib-sheet::backdrop {
  background: var(--lib-backdrop);
}

.lib-sheet.lib-pop {
  position: fixed;
  top: var(--lib-pop-top);
  left: var(--lib-pop-left);
  width: 22.5rem;
  max-height: calc(100vh - 1rem);
  margin: 0;
  padding: 1rem;
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-sheet-radius);
  box-shadow: var(--lib-lift);
}

.lib-sheet.lib-pop::backdrop {
  background: transparent;
}

/* A pulled book (SPEC-SHELF-v3 slice 3): no dim, so its cover reads beside the sheet; the backdrop still takes the
   click outside. On phones a hairline and a soft upward shadow keep the sheet a layer, in dark mode too (Juno). */
.lib-sheet.lib-pulled::backdrop {
  background: transparent;
}

.lib-sheet.lib-pulled:not(.lib-side) {
  border-top: 1px solid var(--lib-line);
  box-shadow: 0 -8px 24px rgb(0 0 0 / 0.18);
}

/* A pulled book at 1024 and up (SPEC-SHELF-v3 §8a): the sheet stands on the side away from it, so the cover stays clear. */
@media (min-width: 1024px) {
  .lib-sheet.lib-side {
    position: fixed;
    inset: 0 auto;
    width: 22.5rem;
    height: fit-content;
    max-height: calc(100vh - 2rem);
    margin: auto 0;
    padding: 1rem;
    border: 1px solid var(--lib-line);
    border-radius: var(--lib-sheet-radius);
    box-shadow: var(--lib-lift);
  }
  .lib-sheet.lib-side-r {
    right: 1.5rem;
  }
  .lib-sheet.lib-side-l {
    left: 1.5rem;
  }
  .lib-side .lib-grab {
    display: none;
  }
}

.lib-grab {
  display: block;
  width: 2.5rem;
  height: 4px;
  margin: 0 auto 0.75rem;
  background: var(--lib-line);
  border-radius: 2px;
  touch-action: none;
}

.lib-pop .lib-grab {
  display: none;
}

.lib-sheet-x {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 2.75rem;
  height: 2.75rem;
  font: 400 1.5rem / 1 var(--lib-font);
  color: var(--lib-mut);
  background: none;
  border: 0;
  cursor: pointer;
}

.lib-sheet-book {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding-right: 2.5rem;
}

.lib-sheet-t {
  font: 600 1rem / 1.375rem var(--lib-font);
  color: var(--lib-ink);
  text-decoration: none;
}

@media (hover: hover) {
  .lib-sheet-t:hover {
    text-decoration: underline;
  }
}

.lib-sheet-by {
  margin: 0.125rem 0 0;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

.lib-sheet-stars {
  margin: 1rem 0 0;
}

.lib-sheet-when {
  margin: 0.25rem 0 0;
}

.lib-date {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem 0;
}

.lib-month {
  min-height: 2.75rem;
  padding: 0 0.5rem;
  font: 400 max(16px, 1rem) / 1.375rem var(--lib-font);
  color: var(--lib-ink);
  background: var(--lib-bg);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-radius);
}

.lib-check {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2.75rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
}

.lib-save {
  min-height: 2.75rem;
  padding: 0 1rem;
  font: 600 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-on-accent);
  background: var(--lib-accent);
  border: 0;
  border-radius: var(--lib-radius);
  cursor: pointer;
}

.lib-acts {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--lib-line);
}

.lib-acts li.lib-gap {
  border-top: 1px solid var(--lib-line);
}

.lib-act {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 3rem;
  padding: 0;
  font: 400 1rem / 1.375rem var(--lib-font);
  color: var(--lib-ink);
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

.lib-act:focus-visible {
  background: var(--lib-sunk);
}
@media (hover: hover) {
  .lib-act:hover {
    background: var(--lib-sunk);
  }
}

/* ---- Undo (§H.3, §12a): one bar at a time, above the phone's tabs ---- */
.lib-undo {
  position: fixed;
  left: 50%;
  bottom: calc(var(--lib-bottom, 1rem) + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-sizing: border-box;
  width: max-content;
  max-width: calc(100vw - 2rem);
  padding: 0.25rem 0.25rem 0.25rem 1rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-bg);
  background: var(--lib-ink);
  border-radius: var(--lib-radius);
  transform: translateX(-50%);
}

.lib-undo[hidden] {
  display: none;
}

.lib-undo-b {
  min-height: 2.75rem;
  padding: 0 0.75rem;
  font: 600 0.9375rem / 1.25rem var(--lib-font);
  color: inherit;
  text-decoration: underline;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ---- Motion: 150 to 220 ms, none under reduced motion (§12) ---- */
::view-transition-group(*) {
  animation-duration: 200ms;
}

@media (prefers-reduced-motion: reduce) {
  .lib-row {
    transition: none;
  }

  .lib-nudge > .lib-row:first-child > .lib-row-in {
    animation: none;
  }

  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none;
  }
}

/* ---- For you (§10.5): covers only ---- */
.lib-rail-i {
  width: 6rem;
}

.lib-rail-a {
  display: block;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
}

.lib-fine {
  margin: 0;
  font: 400 0.875rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

/* For you says in one line how it's ranked (M5): Stoa's engine, from the reader's own books and subjects. */
.lib-for-line {
  margin: 0 0 0.75rem;
  font-size: 0.9375rem;
}

/* The sheet's title takes focus on open, quietly (a touch never sees a box on an action). */
.lib-sheet-h {
  margin: 0;
  font: inherit;
  outline: none;
}

.lib-chev {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin: 0 0 0.2em 0.5rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 180ms ease;
}

.lib-dnf[aria-expanded='true'] .lib-chev {
  transform: translateY(0.2em) rotate(-135deg);
}

@media (prefers-reduced-motion: reduce) {
  .lib-chev {
    transition: none;
  }
}

/* ---- Add a book (M6): the search sheet in add mode. Full screen on a phone, 560 px and 80vh on a desktop; one field,
   Cancel, and rows with one action. No ✕ and no second heading. ---- */
.lib-as {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  color: var(--lib-ink);
  background: var(--lib-bg);
  border: 0;
  overflow: hidden;
}

.lib-as[open] {
  display: flex;
  flex-direction: column;
}

.lib-as::backdrop {
  background: var(--lib-backdrop);
}

.lib-as-f {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  border-bottom: 1px solid var(--lib-line);
}

.lib-as-q {
  flex: 1;
  min-width: 0;
  height: 3rem;
  padding: 0 0.75rem;
  font: 400 1.0625rem / 1.5rem var(--lib-font);
  color: var(--lib-ink);
  background: var(--lib-bg);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-radius);
  -webkit-appearance: none;
  appearance: none;
}

.lib-as-q:focus {
  border-color: var(--lib-ink);
  outline: none;
}

.lib-as-q::-webkit-search-cancel-button {
  display: none;
}

.lib-as-q::placeholder {
  color: var(--lib-mut);
  opacity: 1;
}

.lib-as-x {
  flex: none;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 0.5rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-ink);
  background: none;
  border: 0;
  cursor: pointer;
}

.lib-as-b {
  flex: 1;
  min-height: 0;
  padding: 0 1rem 2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.lib-as-g {
  margin-top: 1.25rem;
}

.lib-as-gh {
  margin: 0 0 0.25rem;
  font: 600 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

.lib-as-l {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lib-as-r {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--lib-line);
}

.lib-as-c {
  flex: none;
}

.lib-as-tx {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.lib-as-t {
  font: 600 1rem / 1.375rem var(--lib-font);
  overflow-wrap: break-word;
}

.lib-as-by {
  margin-top: 0.125rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
  overflow-wrap: break-word;
}

.lib-as-add,
.lib-as-on {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font: 600 0.9375rem / 1.25rem var(--lib-font);
}

.lib-as-add {
  /* 44 wide, the word where it was: at the row's right end (Vera and App builder, app #265). */
  justify-content: flex-end;
  min-width: 2.75rem;
  padding: 0 0.25rem;
  color: var(--lib-ink);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

.lib-as-on {
  font-weight: 400;
  color: var(--lib-mut);
}

.lib-as-none {
  margin: 1.25rem 0 0;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

.lib-as-x:focus-visible,
.lib-as-add:focus-visible {
  outline: 2px solid var(--lib-ink);
  outline-offset: 2px;
}

/* "Add" by the Next up and Read headings, beside the Read filter. */
.lib-h-tools {
  display: flex;
  align-items: baseline;
  gap: 1.25rem;
}

.lib-add-l {
  min-width: 2.75rem; /* a 44 px target; the word stays flush right with the heading row's edge */
  padding: 0;
  justify-content: flex-end; /* the button is laid out as flex, so this (not text-align) puts the word at the end */
  text-align: right;
  color: var(--lib-ink);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  cursor: pointer;
}

@media (min-width: 640px) {
  .lib-as {
    inset: 10vh 0 auto;
    width: min(560px, calc(100vw - 32px));
    height: 80vh;
    margin: 0 auto;
    border: 1px solid var(--lib-line);
    border-radius: var(--lib-sheet-radius);
  }
}

/* ---- Read as a library shelf (M2): a sticky head with the count, search and sort; covers stand on planks ---- */
/* From 640 px the whole head is pinned: line 1, then the sorts with All / Favourites at their right, then the view
   toggle. Under 640 only line 1 and the sorts are (Juno, 04:16): the head steps aside and its first block is pinned. */
.lib-read-head {
  position: sticky;
  top: var(--lib-sticky-top, 0);
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin: 0 0 0.75rem;
  padding-top: 0.25rem;
  background: var(--lib-bg);
}

.lib-read-pin {
  display: contents;
}

.lib-read-top,
.lib-read-head .lib-views {
  grid-column: 1 / -1;
}

.lib-read-head .lib-sorts {
  grid-column: 1;
}

.lib-filter {
  display: flex;
  grid-column: 2;
  grid-row: 2;
  padding-left: 2rem; /* at least 32 px between the sorts and the filter, so they read as two groups (Juno, 02:03) */
  border-bottom: 1px solid var(--lib-line);
}

@media (max-width: 639.98px) {
  .lib-read-head {
    display: contents;
  }

  /* R3-44: while Find has focus on a phone, it stays pinned under Read's head (library.js sets --read-pin-h). */
  .lib-read .s3-tools:focus-within {
    position: sticky;
    top: calc(var(--lib-sticky-top, 0px) + var(--read-pin-h, 0px));
    z-index: 2;
    background: var(--lib-bg);
  }

  .lib-read-pin {
    position: sticky;
    top: var(--lib-sticky-top, 0);
    z-index: 2;
    display: block;
    padding-top: 0.25rem;
    background: var(--lib-bg);
  }

  .lib-filter {
    padding-left: 0;
    border-bottom: 0;
  }

  .lib-read-head > :last-child {
    margin-bottom: 0.75rem;
  }
}

.lib-read-top {
  flex-wrap: wrap;
  align-items: center;
  margin: 0;
}

/* Searching, the field takes the line under the heading, so nothing pushes past a 320 px screen. */
.lib-read-top .lib-h-tools:has(.lib-shelf-search) {
  flex: 1 1 100%;
}

.lib-count {
  margin-left: 0.5rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

.lib-shelf-find,
.lib-shelf-x {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  color: var(--lib-ink);
  background: none;
  border: 0;
  border-radius: var(--lib-radius);
  cursor: pointer;
}

.lib-shelf-find svg,
.lib-find-lead svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}

.lib-shelf-find:focus-visible,
.lib-shelf-x:focus-visible {
  background: var(--lib-sunk);
}
@media (hover: hover) {
  .lib-shelf-find:hover,
  .lib-shelf-x:hover {
    background: var(--lib-sunk);
  }
}

.lib-shelf-search {
  display: flex;
  flex: 1;
  align-items: center;
  min-width: 0;
}

.lib-shelf-q {
  flex: 1;
  width: auto;
  min-width: 0;
  height: 2.5rem;
  padding: 0 0.625rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-ink);
  background: var(--lib-bg);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-radius);
  -webkit-appearance: none;
  appearance: none;
}

.lib-shelf-q:focus {
  border-color: var(--lib-ink);
  outline: none;
}

.lib-shelf-q::-webkit-search-cancel-button {
  display: none;
}

.lib-sorts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  border-bottom: 1px solid var(--lib-line);
}

/* 16 px gaps keep the sort line and All / Favourites on one line at 390; at 320 the filter wraps to its own line,
   left-aligned (Juno, 01:54). */
/* As the spec has it, the choice is --ink and underlined, not bold, so the line keeps its width as you pick. */
.lib-sorts .lib-segs {
  gap: 1rem;
}

.lib-sorts .lib-seg[aria-checked='true'] {
  font-weight: 400;
}

.lib-read .lib-wall {
  --lib-gap: 0.75rem;
  gap: 1.25rem var(--lib-gap);
  overflow-x: clip;
}

/* The plank: a 1 px --rule shelf line and a 6 px --sunk band under each cover, run on across the gaps, so a row of
   covers reads as books standing on one shelf. */
/* The plank is the shelf's stone ledge (SPEC-SHELF §4): 10 px of --stone over a 1 px --stone-edge front line. */
.lib-plank {
  display: block;
  height: 10px;
  margin: 0 calc(var(--lib-gap, 0.75rem) / -2);
  background: var(--lib-stone);
  box-shadow: inset 0 -1px 0 var(--lib-stone-edge);
}

/* The strip ends with the covers (Juno on #591): no half-gap past the first or the last book. */
.lib-wall > .lib-tile:first-child .lib-plank {
  margin-left: 0;
}

.lib-wall > .lib-tile:last-child .lib-plank {
  margin-right: 0;
}

/* Spines or Covers (SPEC-SHELF §2): line 3 of Read's head, right-aligned, the chosen one in ink and underlined. */
.lib-read-head .lib-views {
  justify-content: flex-end;
}

.lib-read-head .lib-views .lib-seg[aria-checked='true'] {
  font-weight: 400;
}

.lib-read .lib-tile .lib-cv {
  width: 100%;
}

.lib-shelf-none {
  margin: 0.5rem 0 0;
}

/* R3-73 (Juno): an empty Read shelf is one ghost, a cover's size, on the plank: the top shelf's dashed card, and its
   caption on the line where a book's stars would be. */
.lib-ghost {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 2 / 3;
  padding: 0 0.5rem;
  border: 1px dashed var(--lib-line);
  border-radius: 12px;
  color: var(--lib-ink);
  background: none;
  text-align: center;
  cursor: pointer;
  font: 400 0.875rem / 1.125rem var(--lib-font);
}

.lib-ghost span {
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: break-word;
}

.lib-ghost-cap {
  font: 400 0.75rem / 0.9375rem var(--lib-font);
  color: var(--lib-mut);
  white-space: nowrap;
}

.lib-shelf-none .lib-text,
.lib-read-add .lib-text {
  font: inherit;
}

/* R3-36: under a short Read shelf, the way to add to it. */
.lib-read-add {
  margin: 0.75rem 0 0;
}

/* A place kept for a cover not drawn yet: the cover's 2:3 box, the plank and the line under it, so the page is its
   full height from the first draw and nothing below the shelf moves as covers arrive. */
.lib-tile-ph::before {
  display: block;
  aspect-ratio: 2 / 3;
  content: '';
}

.lib-tile-ph::after {
  display: block;
  height: 10px;
  margin: 0 calc(var(--lib-gap, 0.75rem) / -2) 1.625rem;
  background: var(--lib-stone);
  box-shadow: inset 0 -1px 0 var(--lib-stone-edge);
  content: '';
}

@media (max-width: 359.98px) {
  .lib-read .lib-wall {
    --lib-gap: 0.625rem;
  }
}

@media (min-width: 768px) {
  .lib-read .lib-wall {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    --lib-gap: 1rem;
  }
}

@media (min-width: 1200px) {
  .lib-read .lib-wall {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

/* The rating strip follows the shelf (or the empty line), 32 px below it (SPEC-SHELF §7). */
.lib-read .lib-shelf-books + .ob-strip {
  margin-top: 2rem;
}

/* Read's line 3 (Juno, PR 390): "Rate books you've read" flush left, Spines or Covers flush right; when both don't
   fit, the link wraps to its own line above the toggle, whole. */
.lib-line3 {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1rem;
  grid-column: 1 / -1;
}

.lib-line3 .lib-views {
  margin-left: auto;
}

.lib-rate {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- Suggest to a club (club-suggest.js; Juno's spec, Nov 24) ---- */
.lib-act:disabled {
  color: var(--lib-mut);
  cursor: default;
}
@media (hover: hover) {
  .lib-act:disabled:hover {
    background: none;
  }
}

.lib-club-line:empty {
  display: none;
}

.lib-club-line {
  margin: -0.5rem 0 0.25rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

.lib-club-head {
  display: grid;
  justify-items: start;
  gap: 0.25rem;
}

.lib-club-for {
  margin: 0.25rem 0 0;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

.lib-club-list {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--lib-line);
}

.lib-club-list li + li {
  border-top: 1px solid var(--lib-line);
}

.lib-club-pick {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.375rem 0;
  font: 400 1rem / 1.375rem var(--lib-font);
  color: var(--lib-ink);
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

.lib-club-pick:focus-visible {
  background: var(--lib-sunk);
}
@media (hover: hover) {
  .lib-club-pick:not(:disabled):hover {
    background: var(--lib-sunk);
  }
}

.lib-club-pick:disabled {
  cursor: default;
}

.lib-club-tile {
  display: grid;
  flex: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  font: 600 0.875rem / 1 var(--lib-font);
  color: var(--lib-ink);
  background: var(--lib-sunk);
  border-radius: var(--lib-radius);
  object-fit: cover;
}

.lib-club-text {
  display: grid;
  flex: 1 1 auto;
  min-width: 0;
}

.lib-club-name {
  overflow-wrap: break-word;
}

.lib-club-has {
  display: inline-flex;
  /* The check sits on the first line of a wrapped label (Vera, #721). */
  align-items: flex-start;
  gap: 0.25rem;
  font: 400 0.875rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

.lib-club-pick:disabled .lib-club-name {
  color: var(--lib-mut);
}

.lib-club-check {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 1.25rem;
}

/* Every club already holds the book: the row says so, muted, with its check, and opens nothing (Juno, #721). */
.lib-club-act.lib-club-held:disabled {
  display: inline-flex;
  gap: 0.375rem;
  align-items: center;
  color: var(--lib-mut);
  opacity: 1;
}

/* ---- Reading now and Want to read: rows of covers (UX audit Nov 28 row 6) ----
   One line of covers each (3 on a phone, 4 from 640 px, 6 from 1024 px, 8 from 1280 px; library.js ROW_COLS), "All n" opens the rest in
   the same grid. Every cell is the same size before any image comes, so nothing moves as covers load. */
.lib-cr-l {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem 0.875rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .lib-cr-l {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem 1.25rem;
  }
}

@media (min-width: 1024px) {
  .lib-cr-l {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1.75rem 1.5rem;
  }
}

@media (min-width: 1280px) {
  .lib-cr-l {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}

.lib-cr-i {
  position: relative;
  min-width: 0;
}

.lib-cr-a {
  display: block;
  text-decoration: none;
  -webkit-touch-callout: none;
  user-select: none;
}

.lib-cr-i .lib-cv {
  width: 100%;
  box-shadow: var(--lib-lift);
}

.lib-cr-t {
  display: -webkit-box;
  margin: 0.5rem 0 0;
  overflow: hidden;
  font: 600 0.9375rem / 1.25rem var(--lib-font);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  max-height: 2.5rem;
  overflow-wrap: anywhere;
}

.lib-cr-tools {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.lib-cr-all,
.lib-cr .lib-add-l {
  padding: 0;
  color: var(--lib-ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  background: none;
  border: 0;
  cursor: pointer;
}

.lib-cr-empty {
  margin: 0;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
}

.lib-cr-i > .lib-more {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  color: var(--lib-on-cover);
  background: var(--lib-scrim);
  opacity: 0;
}

.lib-cr-i:focus-within > .lib-more {
  opacity: 1;
}
@media (hover: hover) {
  .lib-cr-i:hover > .lib-more {
    opacity: 1;
  }
}

/* Want to read opened in full, for long lists (Seph, Nov 29): a filter, a sort and Covers or List. */
.lib-cr-tools-b {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin: 0 0 1.25rem;
}

.lib-cr-qw {
  display: flex;
  flex: 1 1 16rem;
  align-items: center;
  gap: 0.5rem;
  max-width: 28rem;
  min-height: 2.75rem;
  padding: 0 0.75rem;
  color: var(--lib-mut);
  background: var(--lib-surface);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-radius);
}

.lib-cr-qw:focus-within {
  border-color: var(--lib-accent);
}

.lib-cr-qw svg {
  flex: none;
  width: 1.125rem;
  height: 1.125rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
}

.lib-cr-q {
  flex: 1;
  min-width: 0;
  padding: 0;
  font: 400 1rem / 1.375rem var(--lib-font);
  color: var(--lib-ink);
  background: none;
  border: 0;
  outline: none;
}

.lib-cr-q::-webkit-search-cancel-button {
  -webkit-appearance: none;
}

.lib-cr-opts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.lib-cr-sort {
  min-height: 2.75rem;
  padding: 0 0.5rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-ink);
  background: var(--lib-surface);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-radius);
}

.lib-cr-vs {
  display: inline-flex;
  padding: 0.1875rem;
  background: var(--lib-sunk);
  border-radius: var(--lib-radius);
}

.lib-cr-v {
  min-height: 2.375rem;
  padding: 0 0.875rem;
  font: 500 0.875rem / 1 var(--lib-font);
  color: var(--lib-mut);
  background: none;
  border: 0;
  border-radius: calc(var(--lib-radius) - 2px);
  cursor: pointer;
}

/* 320 px: the sort and Covers/List stay on one line inside the gutter (Vera on #735). */
@media (max-width: 359px) {
  .lib-cr-v {
    padding: 0 0.625rem;
  }
}

.lib-cr-v[aria-pressed='true'] {
  color: var(--lib-ink);
  background: var(--lib-surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}

.lib-cr-sort:focus-visible,
.lib-cr-v:focus-visible {
  outline: 2px solid var(--lib-accent);
  outline-offset: 2px;
}

.lib-cr-n {
  margin: 0 0 0.75rem;
  font: 400 0.875rem / 1.25rem var(--lib-font);
}

.lib-cl {
  max-width: 42rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.lib-cl-i {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 1px solid var(--lib-line);
}

.lib-cl-a {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.875rem;
  min-width: 0;
  padding: 0.5rem 0;
  text-decoration: none;
}

.lib-cl-tx {
  display: grid;
  min-width: 0;
}

.lib-cl-t {
  overflow: hidden;
  font: 600 0.9375rem / 1.25rem var(--lib-font);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lib-cl-by {
  overflow: hidden;
  font: 400 0.875rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lib-cr-next {
  max-width: 42rem;
}

/* Progress (row 7), when the reader gave one: a thin line and the percent under the title. */
.lib-pg {
  display: block;
  margin-top: 0.375rem;
}

.lib-pg-t {
  display: block;
  height: 4px;
  overflow: hidden;
  background: var(--lib-line);
  border-radius: 2px;
}

.lib-pg-f {
  display: block;
  width: calc(var(--p, 0) * 100%);
  height: 100%;
  background: var(--lib-accent);
}

.lib-pg-n {
  display: block;
  margin-top: 0.25rem;
  font: 400 0.8125rem / 1rem var(--lib-font);
  color: var(--lib-mut);
}

/* ---- The yearly reading goal (UX audit Nov 28 row 5) ---- */
.lib-goal {
  box-sizing: border-box;
  max-width: 42rem;
  margin: 1rem 0 2rem;
  padding: 1rem 1.125rem;
  background: var(--lib-surface);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-sheet-radius);
}

.lib-goal-none {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.lib-goal-top,
.lib-goal-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.lib-goal-h {
  margin: 0;
  font: 600 1rem / 1.375rem var(--lib-font);
}

.lib-goal-n {
  flex: none;
  margin: 0;
  font: 400 0.9375rem / 1 var(--lib-font);
  color: var(--lib-mut);
}

.lib-goal-n strong {
  font: 500 1.625rem / 1 var(--lib-display);
  color: var(--lib-ink);
}

.lib-goal-marks {
  display: grid;
  grid-template-columns: repeat(var(--n, 12), minmax(0, 1fr));
  gap: 3px;
  margin-top: 0.75rem;
}

.lib-goal-marks > span {
  height: 10px;
  background: var(--lib-line);
  border-radius: 3px;
}

.lib-goal-marks > span.on {
  background: var(--lib-accent);
}

.lib-goal-bar {
  display: block;
  height: 10px;
  margin-top: 0.75rem;
  overflow: hidden;
  background: var(--lib-line);
  border-radius: 5px;
}

.lib-goal-fill {
  display: block;
  width: calc(var(--p, 0) * 100%);
  height: 100%;
  background: var(--lib-accent);
}

.lib-goal-line {
  margin: 0.25rem 0 0;
  font: 400 0.875rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

.lib-goal-foot .lib-goal-line {
  margin-top: 0.5rem;
}

.lib-goal-edit {
  flex: none;
  min-height: 2.75rem;
  font-size: 0.875rem;
}

.lib-goal-set,
.lib-gs-go {
  flex: none;
  min-height: 2.75rem;
  padding: 0 1.125rem;
  font: 600 0.9375rem / 1 var(--lib-font);
  color: var(--lib-on-accent);
  background: var(--lib-accent);
  border: 0;
  border-radius: var(--lib-radius);
  cursor: pointer;
}

/* The goal sheet: the quick sheet's bottom sheet on a phone, a centred 420 px card from 640 px. */
.lib-gs {
  padding-top: 0.5rem;
}

.lib-gs-grab {
  display: block;
  width: 2.25rem;
  height: 4px;
  margin: 0 auto 1rem;
  background: var(--lib-line);
  border-radius: 2px;
}

.lib-gs-h {
  margin: 0;
  font: 500 1.375rem / 1.75rem var(--lib-display);
}

.lib-gs-sub,
.lib-gs-note {
  margin: 0.5rem 0 0;
  font: 400 0.9375rem / 1.375rem var(--lib-font);
  color: var(--lib-mut);
}

.lib-gs-pick {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin: 1.5rem 0 1rem;
}

.lib-gs-n {
  min-width: 4ch;
  font: 500 3rem / 1 var(--lib-display);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.lib-gs-step {
  width: 3rem;
  height: 3rem;
  font: 400 1.5rem / 1 var(--lib-font);
  color: var(--lib-ink);
  background: var(--lib-surface);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-radius);
  cursor: pointer;
}

.lib-gs-ps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.25rem;
  padding: 0.25rem;
  background: var(--lib-sunk);
  border-radius: var(--lib-radius);
}

.lib-gs-p {
  min-height: 2.75rem;
  font: 500 0.9375rem / 1 var(--lib-font);
  color: var(--lib-mut);
  background: none;
  border: 0;
  border-radius: calc(var(--lib-radius) - 2px);
  cursor: pointer;
}

.lib-gs-p[aria-pressed='true'] {
  color: var(--lib-ink);
  background: var(--lib-surface);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.08);
}

.lib-gs-who {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--lib-line);
}

.lib-gs-who p {
  margin: 0;
}

.lib-gs-wl {
  display: block;
  font: 500 0.9375rem / 1.375rem var(--lib-font);
}

.lib-gs-wv {
  display: block;
  font: 400 0.875rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}

.lib-gs-who a {
  flex: none;
  font: 400 0.9375rem / 2.75rem var(--lib-font);
}

.lib-gs-status {
  min-height: 1.25rem;
  margin: 0.5rem 0 0;
  font: 400 0.875rem / 1.25rem var(--lib-font);
  color: var(--lib-error);
}

.lib-gs-go {
  width: 100%;
  min-height: 3rem;
  margin-top: 0.5rem;
}

.lib-gs-rm {
  display: block;
  margin: 0.25rem auto 0;
}

.lib-goal-set:focus-visible,
.lib-gs-go:focus-visible,
.lib-gs-step:focus-visible,
.lib-gs-p:focus-visible {
  outline: 2px solid var(--lib-accent);
  outline-offset: 2px;
}

@media (min-width: 640px) {
  .lib-gs {
    width: 26.25rem;
    margin: auto;
    border-radius: var(--lib-sheet-radius);
  }

  .lib-gs-grab {
    display: none;
  }
}

/* Year in review (Nov 29): December 1 to January 15, under the goal card; the same card, one quiet Share. */
.lib-yr {
  box-sizing: border-box;
  max-width: 42rem;
  margin: 1rem 0 2rem;
  padding: 1rem 1.125rem;
  background: var(--lib-surface);
  border: 1px solid var(--lib-line);
  border-radius: var(--lib-sheet-radius);
}
.lib-goal + .lib-yr {
  margin-top: -1rem;
}
.lib-yr-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.lib-yr-h {
  margin: 0;
  font: 600 1rem / 1.375rem var(--lib-font);
}
.lib-yr-share {
  flex: none;
  min-height: 2.75rem;
  padding: 0;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-ink);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.lib-yr-n {
  margin: 0.25rem 0 0.25rem;
  font: 400 0.9375rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}
.lib-yr-n strong {
  font: 500 1.625rem / 1 var(--lib-display);
  color: var(--lib-ink);
}
.lib-yr-l {
  margin: 0.25rem 0 0;
  font: 400 0.875rem / 1.25rem var(--lib-font);
  color: var(--lib-mut);
}
.lib-yr-l em {
  font-style: italic;
  color: var(--lib-ink);
}
.lib-yr-img {
  display: block;
  width: 100%;
  max-width: 18rem;
  height: auto;
  aspect-ratio: 4 / 5;
  margin: 1rem auto 0;
  border: 1px solid var(--lib-line);
  border-radius: 4px;
}
.lib-yr-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-top: 1rem;
  min-height: 2.75rem;
  font: 400 0.9375rem / 1.375rem var(--lib-font);
  cursor: pointer;
}
.lib-yr-opt small {
  display: block;
  font-size: 0.8125rem;
  color: var(--lib-mut);
}
.lib-yr-cb {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0.0625rem 0 0;
  accent-color: var(--lib-accent);
}
.lib-yr-acts {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-top: 1rem;
}
.lib-yr-acts .lib-gs-go {
  flex: 1;
}

/* A header control held in place while its section is empty (library.js hold()). */
.lib-hold{visibility:hidden}
