/* LOM library. The classic look of space.lom.audio (and lom.audio): grey ground, black hairlines,
   Helvetica, picture tiles with black caption bars. Each cover is drawn as a book lying on a
   grey stage (see .stage and .book).

   Layout rule: every page is a stack of bands, and every band is a row of cells on a 12-column
   grid. Cells touch; a 1px black line separates them. On small screens the cells of a band stack. */

:root {
  --bg: #ececec;
  --text: #000;
  --muted: #595959;
  --tile: #d8d8d8;
  --accent: #ffc72c;      /* the library's colour (space: red, rental: lime); always with black text */
  --free: #35c46a;        /* "available" marker */
  --edge: 16px;
  --line: 1px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-underline-offset: 0.15em; text-decoration-thickness: 1px; }
a:hover { background: var(--accent); }
a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip, .visually-hidden { position: absolute; left: -9999px; }
.skip:focus { left: var(--edge); top: 8px; z-index: 1; padding: 6px 10px; background: var(--text); color: #fff; }

/* Header */

.site-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 16px var(--edge) 14px;
  border-bottom: var(--line) solid var(--text);
}
.wordmark {
  font-family: Helvetica, Arial, sans-serif;
  font-size: clamp(42px, 12.5vw, 68px);
  font-style: italic;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: #c4c4c4;
  text-decoration: none;
  filter: url(#etch);
  padding: 0.08em 0.22em 0.08em 0.04em;
  margin: -0.08em -0.16em -0.08em -0.1em;
}
.wordmark:hover { color: #c4c4c4; background: none; }
.tagline { margin: 0; font-size: 15px; line-height: 1.3; }

.site-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 18px;
  padding: 10px var(--edge);
  border-bottom: var(--line) solid var(--text);
  font-size: 15px;
}
.site-nav a { text-decoration: none; }
.site-nav a:hover, .site-nav a[aria-current] { text-decoration: underline; background: none; }
.site-nav .gap { flex: 1 1 24px; }
.pages { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.pages .out { margin-left: 0.15em; font-size: 0.8em; }     /* leaves this site */
.lang { padding: 3px 8px 4px; border: var(--line) solid var(--text); font-size: 14px; letter-spacing: 0.04em; }
.site-nav .lang:hover { background: var(--accent); text-decoration: none; }

/* Bands and cells */

/* A short page still fills the window: the last band stretches, so the footer sits on the bottom edge. */
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
main { flex: 1 0 auto; display: flex; flex-direction: column; }
main > :last-child { flex: 1 0 auto; }

.band { border-bottom: var(--line) solid var(--text); }
.cell { min-width: 0; padding: 18px var(--edge) 24px; }
.cell + .cell { border-top: var(--line) solid var(--text); }
.cell.flush { padding: 0; }
.title { margin: 0; font-size: 22px; font-weight: 400; line-height: 1.2; }
.note { margin: 6px 0 0; font-size: 15px; line-height: 1.4; color: var(--muted); }
.empty { margin: 0; max-width: 46ch; font-size: 17px; }
.lead { margin: 0; max-width: 40ch; font-size: clamp(20px, 2.1vw, 27px); line-height: 1.3; letter-spacing: -0.005em; }

/* Filters */

.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; margin-top: 22px; font-size: 14px; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.grow { flex: 1 1 14em; }
.field input, .field select {
  min-width: 0;
  padding: 7px 9px 8px;
  font: inherit;
  font-size: 16px;            /* no zoom on focus in iOS */
  color: var(--text);
  background: #fff;
  border: var(--line) solid var(--text);
  border-radius: 0;
}
.field select { appearance: none; padding-right: 28px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right 10px center; }
.field input:focus-visible, .field select:focus-visible, .check input:focus-visible { outline: 3px solid var(--accent); outline-offset: 0; }
.check { display: flex; align-items: center; gap: 8px; padding: 8px 0; color: var(--text); font-size: 16px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--text); }
.shown { padding: 8px 0; }
.shown:empty { display: none; }
.none { padding: 22px var(--edge) 30px; }

/* The shelf: cover tiles */

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--line);
  margin: 0;
  padding: 0;
  list-style: none;
}
.grid > li { display: flex; min-width: 0; outline: var(--line) solid var(--text); }
.tile { flex: 1; display: flex; flex-direction: column; min-width: 0; color: inherit; text-decoration: none; }
.tile:hover { background: none; }
/* The book. Notion holds only the bare cover; everything that makes it look like a book lying
   on a table is drawn here, the same for every title: a 3:2 stage lit from above, the whole cover
   centred on it, a soft shadow, and a hint of spine and page edge. Sizes are in container units
   of the stage (cqh, cqw), so the book scales with its tile. */
.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 2;
  container-type: size;
  overflow: hidden;
  background: radial-gradient(ellipse 75% 80% at 50% 42%, #f3f3f3 0%, #e9e9e9 55%, #e0e0e0 100%);
}
.book {
  position: relative;
  display: block;
  line-height: 0;
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.07),
    1px 1px 2px rgba(0, 0, 0, 0.12),
    2px 5px 9px rgba(0, 0, 0, 0.11),
    6px 13px 26px rgba(0, 0, 0, 0.12),
    12px 26px 52px rgba(0, 0, 0, 0.08);
  transition: transform 0.25s, box-shadow 0.25s, opacity 0.2s, filter 0.2s;
}
.book img { display: block; }
.book.tall img, .book.tall.blank { height: 76cqh; width: auto; }
.book.wide img { width: 70cqw; height: auto; }
/* Spine fold on the left, a thin page edge on the right, light falling across the cover. */
.book::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.16) 0, rgba(255, 255, 255, 0.24) 0.9%, rgba(0, 0, 0, 0.09) 1.9%, rgba(0, 0, 0, 0) 4.5%),
    linear-gradient(270deg, rgba(0, 0, 0, 0.07) 0, rgba(0, 0, 0, 0) 1.2%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.10) 0, rgba(255, 255, 255, 0) 45%, rgba(0, 0, 0, 0) 75%, rgba(0, 0, 0, 0.05) 100%);
}
/* No cover yet: a plain paper book with the title and author on it. */
.book.blank {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  aspect-ratio: 2 / 3;
  padding: 9cqh 7cqh 7cqh 8cqh;
  background: #f6f4ef;
  color: #1a1a1a;
  line-height: 1.15;
  overflow: hidden;
}
.blank-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 7;
  overflow: hidden;
  font-size: 5.6cqh;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}
.blank-who { font-size: 3.6cqh; color: #555; overflow-wrap: anywhere; }
a.tile:hover .book, a.tile:focus-visible .book {
  transform: translateY(-1.5%);
  box-shadow:
    0 0 0 0.5px rgba(0, 0, 0, 0.07),
    1px 2px 3px rgba(0, 0, 0, 0.12),
    3px 8px 13px rgba(0, 0, 0, 0.11),
    8px 18px 34px rgba(0, 0, 0, 0.13),
    16px 34px 64px rgba(0, 0, 0, 0.09);
}
.tile.out .book { opacity: 0.5; filter: grayscale(1); }
.cap {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px var(--edge) 11px;
  background: var(--text);
  color: #fff;
  font-size: 15px;
  line-height: 1.3;
  transition: background-color 0.15s;
  flex: 1 0 auto;
}
.label { min-width: 0; }
.when { display: block; color: #a8a8a8; font-size: 13px; }
.what { display: block; overflow-wrap: anywhere; }
.state { flex: 0 0 auto; font-size: 13px; white-space: nowrap; }
.state::before { content: ""; display: inline-block; width: 0.6em; height: 0.6em; margin-right: 0.4em; background: var(--free); vertical-align: 0.05em; }
.tile.out .state { color: #a8a8a8; }
.tile.out .state::before, .entry.out .state::before { background: transparent; outline: 1px solid currentColor; outline-offset: -1px; }

/* The list view (#books.list, switched by static/catalogue.js): one row per title with all its
   details. Each title carries both its tile and its row; only one of them is shown. */
.entry { display: none; }
.books.list { display: block; margin: 0; padding: 0; list-style: none; }
.books.list > li > .tile { display: none; }
.books.list > li + li { border-top: var(--line) solid var(--text); }
.books.list .entry {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  grid-template-areas: "thumb main state" "thumb meta meta" "thumb tags tags";
  gap: 5px 14px;
  align-items: start;
  padding: 12px var(--edge) 13px;
}
.entry-thumb { grid-area: thumb; display: block; line-height: 0; }
.entry-thumb:hover { background: none; }
.entry-thumb img, .thumb-blank {
  display: block;
  width: 44px;
  height: auto;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.08), 1px 1px 2px rgba(0, 0, 0, 0.14), 2px 4px 8px rgba(0, 0, 0, 0.12);
}
.thumb-blank { aspect-ratio: 2 / 3; background: #f6f4ef; }
.entry.out .entry-thumb { opacity: 0.5; filter: grayscale(1); }
.entry-main { grid-area: main; min-width: 0; }
.entry-title { display: block; font-size: 17px; line-height: 1.25; text-decoration: none; overflow-wrap: anywhere; }
.entry-title:hover { text-decoration: underline; background: none; }
.entry-who { display: block; margin-top: 2px; font-size: 15px; line-height: 1.3; color: var(--muted); }
.entry-meta { grid-area: meta; font-size: 14px; line-height: 1.4; color: var(--muted); }
.entry-meta span + span::before { content: " · "; }
.tags { grid-area: tags; display: flex; flex-wrap: wrap; gap: 5px; }
.tags:empty { display: none; }
.tag { padding: 1px 7px 2px; border: var(--line) solid var(--text); font-size: 13px; line-height: 1.35; text-decoration: none; white-space: nowrap; }
.tag:hover, .tag:focus-visible { background: var(--accent); }
.entry .state { grid-area: state; padding-top: 2px; font-size: 14px; }
.entry.out .state { color: var(--muted); }

/* Covers | List */
.views { display: flex; margin: 0; padding: 0; border: 0; }
.views label { position: relative; cursor: pointer; }
.views input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.views span { display: block; padding: 7px 12px 8px; border: var(--line) solid var(--text); background: #fff; color: var(--text); font-size: 16px; }
.views label + label span { border-left: 0; }
.views input:checked + span { background: var(--text); color: #fff; }
.views input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 0; }
a.tile:hover .cap, a.tile:focus-visible .cap { background: var(--accent); color: #000; }
a.tile:hover .when, a.tile:focus-visible .when, a.tile:hover .state, a.tile:focus-visible .state { color: #000; }
a.tile:hover .state::before, a.tile:focus-visible .state::before { outline-color: #000; }
a.tile:hover .book, a.tile:focus-visible .book { opacity: 1; filter: none; }
a.tile:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* Title page */

.event { border-bottom: var(--line) solid var(--text); }
.event-poster { display: block; border-bottom: var(--line) solid var(--text); }
.event-info { padding: 20px var(--edge) 30px; }
.event-info > * { max-width: 44rem; }
.event h1 { margin: 0 0 14px; font-size: clamp(28px, 4vw, 46px); font-weight: 400; line-height: 1.08; letter-spacing: -0.015em; overflow-wrap: anywhere; }
.event-who { margin: -4px 0 18px; font-size: clamp(18px, 2vw, 24px); line-height: 1.25; color: var(--muted); }
.status { display: inline-block; margin: 0 0 16px; padding: 3px 10px 4px; background: var(--text); color: #fff; font-size: 15px; }
.status::before { content: ""; display: inline-block; width: 0.6em; height: 0.6em; margin-right: 0.5em; background: var(--free); vertical-align: 0.05em; }
.status.out { background: transparent; color: var(--text); outline: var(--line) solid var(--text); outline-offset: -1px; }
.status.out::before { background: transparent; outline: 1px solid currentColor; outline-offset: -1px; }
.description { font-size: 17px; }
.description .source { font-size: 15px; }
.source .out { margin-left: 0.15em; font-size: 0.8em; }
.description p { margin: 0 0 0.85em; max-width: 66ch; }
.lang-note { font-size: 14px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 16px; margin: 22px 0 26px; font-size: 15px; line-height: 1.4; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.actions { margin: 0 0 6px; }
.btn {
  display: inline-block;
  padding: 11px 18px 12px;
  background: var(--text);
  color: #fff;
  font-size: 17px;
  line-height: 1.2;
  text-decoration: none;
  border: var(--line) solid var(--text);
  transition: background-color 0.15s;
}
.btn.quiet { background: transparent; color: var(--text); }
.btn:hover, .btn:focus-visible { background: var(--accent); color: #000; }
.back { margin: 14px 0 0; font-size: 15px; }

/* How to borrow */

.rules .lead { margin-bottom: 22px; }
.rules ol { margin: 0 0 1.2em; padding-left: 1.4em; max-width: 66ch; }
.rules li { margin-bottom: 0.7em; padding-left: 0.2em; }

/* Footer */

.site-footer { font-size: 14px; line-height: 1.5; color: var(--muted); border-bottom: 0; }
.site-footer p { margin: 0; }
.site-footer strong { color: var(--text); font-weight: 400; }
.site-footer ul { margin: 0; padding: 0; list-style: none; }

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 720px) {
  :root { --edge: 20px; }
  .site-header { padding-top: 28px; padding-bottom: 18px; gap: 10px; }
  .wordmark { font-size: clamp(84px, 8vw, 124px); }
  .tagline { font-size: clamp(16px, 1.4vw, 20px); }
  .site-nav { font-size: 17px; }
  .title { font-size: clamp(22px, 2vw, 28px); }
  .cap { font-size: 16px; padding-top: 11px; padding-bottom: 12px; }
}

/* Phones: the pages become a row of tabs (the current one filled in); the language switch
   sits in the top-right corner. */
@media (max-width: 719px) {
  .tagline { display: none; }
  body { position: relative; }
  .lang { position: absolute; top: 14px; right: var(--edge); background: var(--bg); }
  .site-nav { display: block; padding: 0; }
  .pages { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
  .pages a { padding: 11px 4px 12px; text-align: center; border-left: var(--line) solid var(--text); }
  .pages a:nth-child(2n+1) { border-left: 0; }
  .pages a:nth-child(n+3) { border-top: var(--line) solid var(--text); }
  .site-nav .pages a[aria-current] { background: var(--text); color: #fff; text-decoration: none; }
  .site-nav .gap { display: none; }
}

@media (max-width: 899px) {
  /* Stacked bands: a heavy line starts a section, its heading follows with a small square marker. */
  main > .band, main > .event { border-bottom-width: 3px; }
  .band > .cell:first-child .title::before {
    content: ""; display: inline-block; width: 0.5em; height: 0.5em; margin-right: 0.45em;
    background: var(--text); vertical-align: 0.08em;
  }
  .band > .cell:first-child:has(> .title) + .cell { padding-top: 0; border-top: 0; }
  .filters .field:not(.grow) { flex: 1 1 10em; }
  .filters select { width: 100%; }
}

@media (min-width: 900px) {
  .books.list .entry {
    grid-template-columns: 44px minmax(0, 2.2fr) minmax(0, 1.7fr) minmax(0, 1.5fr) 7em;
    grid-template-areas: "thumb main meta tags state";
    gap: 0 20px;
    padding-top: 11px;
    padding-bottom: 12px;
  }
  .entry-meta { padding-top: 2px; }
  .band { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); }
  .cell { padding: 22px var(--edge) 30px; }
  .cell + .cell { border-top: 0; border-left: var(--line) solid var(--text); }
  .c3 { grid-column: span 3; } .c9 { grid-column: span 9; } .c12 { grid-column: span 12; }
  .cell.flush { padding: 0; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .event { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); align-items: start; }
  .event-poster { position: sticky; top: 0; border-bottom: 0; }
  .event-info { padding: 26px var(--edge) 40px; }
  .event .event-info { border-left: var(--line) solid var(--text); min-height: 100%; }
}

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

@media (prefers-reduced-motion: reduce) {
  .cap, .btn, .book { transition: none; }
}
