/* libcatalog reference styles: accessible, desktop-credible, override-friendly. Every
   component is driven by the --lcat-* tokens below, so an adopter re-themes by re-setting
   those variables in their own stylesheet (loaded after this one) -- no need to shadow
   assets/lcat.css or reimplement any chrome (tasks/025). Uses system fonts and CSS grid.

   The default identity is "library-ish but modern": work titles in a zero-payload
   system serif (the bookish register), UI chrome in a clean sans, catalog-drawer
   small caps on facet labels, an index-card double rule under the work heading, and
   a curator-green accent -- the same ink the cataloging backend renders editorial
   provenance in. All of it retunes from the tokens; nothing is baked into markup. */
:root {
  --lcat-fg: #1f2421;           /* iron-gall green-black ink */
  --lcat-bg: #f7f6f2;           /* bone: warm near-white, not cream */
  --lcat-accent: #1e6b4e;       /* curator green; links, active states (>=4.5:1 on bg) */
  --lcat-accent-ink: #14523a;   /* darker accent for headings / large text */
  --lcat-muted: #5b615d;
  --lcat-border: #d9d5cb;
  --lcat-surface: #fff;         /* raised cards and the facet panel: index-card white */
  --lcat-surface-alt: #edeae2;  /* tag chips, subtle fills */
  --lcat-radius: 6px;
  --lcat-shadow: 0 1px 0 rgba(31, 36, 33, 0.07), 0 3px 10px rgba(31, 36, 33, 0.06);
  --lcat-gap: 2rem;
  --lcat-maxw: 72rem;           /* readable measure, wider than the old minimal 68rem */
  /* Type roles: display carries the bookish personality (work titles only); the
     body stays a modern sans; mono covers identifiers and call numbers. */
  --lcat-on-accent: #fff;      /* text on accent-filled controls */
  --lcat-avail-ok: #1e6b4e;
  --lcat-avail-hold: #8a5a00;
  --lcat-avail-none: #a34224;
  --lcat-display: "Charter", "Iowan Old Style", "Palatino", Georgia, serif;
  --lcat-sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --lcat-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
/* Dark mode: the closed stacks -- the light theme's ink becomes the card
   surface, bone becomes the text, and the inks brighten to hold AA. Applies
   automatically from the OS preference, or explicitly via
   data-lcat-theme="dark"/"light" on <html> (the theme-toggle partial sets
   and persists it). All pairs AA-verified. */
/* Dark mode: the closed stacks -- the light theme's ink becomes the card
   surface, bone becomes the text, and the inks brighten to hold AA. Applies
   automatically from the OS preference, or explicitly via
   data-lcat-theme="dark"/"light" on <html> (the theme-toggle partial sets
   and persists it). Values duplicated across the two selectors because a
   media query and an attribute cannot share one block in plain CSS. */
:root[data-lcat-theme="dark"] {
  --lcat-fg: #e9e7e0;
  --lcat-bg: #171b19;
  --lcat-accent: #6dbd97;
  --lcat-accent-ink: #8fd0b1;
  --lcat-muted: #a8ada4;
  --lcat-border: #3d443f;
  --lcat-surface: #212724;
  --lcat-surface-alt: #2a302c;
  --lcat-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 3px 10px rgba(0, 0, 0, 0.3);
  --lcat-on-accent: #10261c;
  --lcat-avail-ok: #6dbd97;
  --lcat-avail-hold: #d9b96a;
  --lcat-avail-none: #e09479;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-lcat-theme="light"]) {
    --lcat-fg: #e9e7e0;
    --lcat-bg: #171b19;
    --lcat-accent: #6dbd97;
    --lcat-accent-ink: #8fd0b1;
    --lcat-muted: #a8ada4;
    --lcat-border: #3d443f;
    --lcat-surface: #212724;
    --lcat-surface-alt: #2a302c;
    --lcat-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 3px 10px rgba(0, 0, 0, 0.3);
    --lcat-on-accent: #10261c;
    --lcat-avail-ok: #6dbd97;
    --lcat-avail-hold: #d9b96a;
    --lcat-avail-none: #e09479;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--lcat-fg);
  background: var(--lcat-bg);
  font: 100%/1.5 var(--lcat-sans);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
/* Underline links by default so in-text links do not rely on color alone
   (WCAG 1.4.1); chrome links with a non-color affordance (brand, facet rows,
   tag pills, pagination buttons) opt out below. */
a { color: var(--lcat-accent); text-decoration: underline; text-underline-offset: 0.12em; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible {
  outline: 3px solid var(--lcat-accent);
  outline-offset: 2px;
}
.lcat-skip {
  position: absolute;
  left: -999px;
}
.lcat-skip:focus {
  left: 0.5rem;
  top: 0.5rem;
  z-index: 10;
  background: var(--lcat-bg);
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--lcat-accent);
}
.lcat-visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}
.lcat-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem clamp(1rem, 4vw, 2rem);
  background: var(--lcat-surface);
  border-bottom: 1px solid var(--lcat-border);
}
.lcat-brand {
  font-family: var(--lcat-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--lcat-accent-ink);
  text-decoration: none;
}
/* Buttons (tasks/120): the module owns both the tokens and these pairings, so the
   AA contrast of each variant holds in light AND dark mode without per-adopter
   auditing. --solid and --ghost are made for accent-filled surfaces (a hero);
   --surface is the neutral chip that flips with the theme. Works on <a> and
   <button>; focus-visible comes from the global rule. */
.lcat-btn {
  display: inline-block;
  padding: 0.55rem 1.05rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.lcat-btn:hover { text-decoration: underline; }
.lcat-btn--solid { background: var(--lcat-accent); color: var(--lcat-on-accent); border-color: var(--lcat-accent); }
.lcat-btn--surface { background: var(--lcat-surface); color: var(--lcat-accent); border-color: var(--lcat-border); }
.lcat-btn--ghost { background: transparent; color: var(--lcat-on-accent); border-color: var(--lcat-on-accent); }

/* Primary nav (tasks/118): configuration-driven from [[menu.main]]; sits in the
   header flex between brand and search, wrapping on narrow viewports. */
.lcat-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.lcat-nav a {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  text-decoration: none;
  font-weight: 600;
  color: var(--lcat-accent-ink);
}
.lcat-nav a:hover { background: var(--lcat-surface-alt); text-decoration: underline; }
.lcat-nav a[aria-current="page"] { color: var(--lcat-accent); box-shadow: inset 0 -3px 0 var(--lcat-accent); }
.lcat-search { display: flex; gap: 0.5rem; }
.lcat-search input {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--lcat-border);
  border-radius: 4px;
  min-width: 16rem;
}
.lcat-search button {
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--lcat-accent);
  background: var(--lcat-accent);
  color: var(--lcat-on-accent);
  border-radius: 4px;
  cursor: pointer;
}
/* Optional Pagefind search UI (tasks/017): themed to the module accent and sized to
   sit in the header. Pagefind ships its own pagefind-ui.css; these custom properties
   just align it with lcat.css. Only present when [params.search] engine = "pagefind". */
.lcat-search-pagefind {
  --pagefind-ui-primary: var(--lcat-accent);
  --pagefind-ui-text: var(--lcat-fg);
  --pagefind-ui-background: var(--lcat-bg);
  --pagefind-ui-border: var(--lcat-border);
  --pagefind-ui-font: inherit;
  --pagefind-ui-border-radius: 4px;
  min-width: 18rem;
  flex: 1 1 22rem;
  max-width: 32rem;
}
.lcat-layout {
  display: grid;
  grid-template-columns: 16rem 1fr;
  gap: var(--lcat-gap);
  max-width: var(--lcat-maxw);
  margin: 0 auto;
  padding: 1.75rem clamp(1rem, 4vw, 2rem);
}
@media (max-width: 48rem) {
  .lcat-layout { grid-template-columns: 1fr; }
}
/* Work detail (page.html) defines no sidebar block, so <main> is the layout's only
   child; span it across both tracks instead of stranding it in the 16rem column. */
.lcat-layout > .lcat-main:only-child { grid-column: 1 / -1; }
.lcat-main:focus { outline: none; }
/* Facet sidebar as a raised panel so it reads as a distinct filter surface. */
.lcat-sidebar {
  background: var(--lcat-surface);
  border: 1px solid var(--lcat-border);
  border-radius: var(--lcat-radius);
  padding: 1rem 1.1rem;
  align-self: start;
  box-shadow: var(--lcat-shadow);
}
.lcat-facet { margin-bottom: 1rem; border-bottom: 1px solid var(--lcat-border); padding-bottom: 0.5rem; }
/* Facet group labels read like catalog-drawer labels: small caps, tracked out. */
.lcat-facet summary {
  cursor: pointer;
  font-weight: 650;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--lcat-accent-ink);
}
.lcat-facet-total, .lcat-count { color: var(--lcat-muted); font-size: 0.85em; }
.lcat-facets ul { list-style: none; margin: 0.5rem 0 0; padding: 0; }
.lcat-facets li a {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.15rem 0;
  text-decoration: none;
}
.lcat-facets li a:hover .lcat-facet-value { text-decoration: underline; }
.lcat-results { list-style: none; margin: 0; padding: 0; }
.lcat-results > li { padding: 0.9rem 0; border-bottom: 1px solid var(--lcat-border); }
/* Card is a flex row so an optional cover sits beside the text block; with covers off
   the body is the lone flex child and fills the width (tasks/025). */
.lcat-card { display: flex; gap: 1rem; align-items: flex-start; }
.lcat-card-body { flex: 1 1 auto; min-width: 0; }
.lcat-card-title {
  margin: 0 0 0.25rem;
  font-family: var(--lcat-display);
  font-size: 1.3rem;
  line-height: 1.25;
  letter-spacing: 0.005em;
}
.lcat-subtitle { font-weight: 400; color: var(--lcat-muted); }
.lcat-contribs { margin: 0.15rem 0; color: var(--lcat-muted); }
.lcat-role { font-style: italic; }
/* Work summary (bf:summary, tasks/124): measure-capped prose so a long blurb reads
   comfortably next to full-width sections. */
.lcat-summary { max-width: 65ch; }
.lcat-summary p { margin: 0.6rem 0; }
.lcat-tags { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.35rem 0 0; padding: 0; }
.lcat-tags li {
  font-size: 0.8rem;
  background: var(--lcat-surface-alt);
  border: 1px solid var(--lcat-border);
  border-radius: 999px;
  padding: 0.1rem 0.6rem;
}
/* Pills read as distinct shapes, not in-text links, so they skip the default underline. */
.lcat-tags li a { text-decoration: none; }
.lcat-tags li a:hover { text-decoration: underline; }
.lcat-terms { list-style: none; padding: 0; columns: 2; }
.lcat-editions { list-style: none; padding: 0; }
.lcat-edition { padding: 0.5rem 0; border-bottom: 1px dashed var(--lcat-border); }
.lcat-format { font-weight: 600; text-transform: capitalize; margin-right: 0.5rem; }
.lcat-isbn { color: var(--lcat-muted, #667); font-family: var(--lcat-mono); font-size: 0.85em; }
/* Live availability (tasks/004): color by resolved data-status; empty (unknown or
   not-yet-fetched) stays invisible so it never shows a misleading state. */
.lcat-availability { margin-left: 0.5rem; font-size: 0.9em; }
.lcat-availability:empty { display: none; }
.lcat-availability[data-status="available"] { color: var(--lcat-avail-ok); }
.lcat-availability[data-status="holdable"] { color: var(--lcat-avail-hold); }
.lcat-availability[data-status="unavailable"] { color: var(--lcat-avail-none); }
.lcat-meta dt { font-weight: 600; }
/* Optional cover art (tasks/025): rendered by lcat-cover.html only when the site sets
   [params] covers = true. Set BOTH width and height in CSS per variant -- the <img>
   carries width/height HTML hints for CLS, and without an explicit CSS height that hint
   would win and distort the box, so object-fit would crop to a thin slice. */
.lcat-cover {
  display: block;
  flex: none;
  object-fit: cover;
  border-radius: 4px;
  background: var(--lcat-surface-alt);
  border: 1px solid var(--lcat-border);
  box-shadow: var(--lcat-shadow);
}
.lcat-cover--card { width: 3.5rem; height: 5.25rem; }        /* true 2:3 portrait */
.lcat-cover--detail { width: 8.5rem; height: 12.75rem; float: right; margin: 0 0 1rem 1.25rem; }
.lcat-cover--placeholder {
  display: grid;
  place-items: center;
  color: var(--lcat-muted);
  font-weight: 700;
  font-size: 1.1rem;
}
/* Hugo's _internal/pagination.html emits .pagination > .page-item > .page-link. Size the
   links as >=44px button targets (WCAG 2.5.8) rather than bare text links. */
.pagination { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 1.5rem 0; }
.pagination .page-item { display: flex; }
.pagination .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--lcat-border);
  border-radius: 4px;
  text-decoration: none;
  color: var(--lcat-accent);
}
.pagination .page-link:hover { border-color: var(--lcat-accent); }
.pagination .active .page-link { background: var(--lcat-accent); border-color: var(--lcat-accent); color: var(--lcat-on-accent); }
.pagination .disabled .page-link { color: var(--lcat-muted); border-color: var(--lcat-border); pointer-events: none; }

/* Work detail heading: the display serif over an index-card double rule --
   the theme's one structural flourish, and it encodes the page's job (this is
   the record's title line). */
.lcat-main h1 {
  font-family: var(--lcat-display);
  font-size: clamp(1.6rem, 3.5vw, 2.1rem);
  line-height: 1.2;
  margin: 0.25rem 0 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px double var(--lcat-border);
}
/* Record metadata labels echo the facet drawer register. */
.lcat-meta dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--lcat-muted);
}

/* Theme toggle (theme-toggle.html): hidden until its script runs, so a
   no-JS page shows no dead control. */
.lcat-theme-toggle {
  border: 1px solid var(--lcat-border);
  background: var(--lcat-surface);
  color: var(--lcat-fg);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
}
.lcat-theme-toggle[hidden] { display: none; }
