:root {
  color-scheme: light;
  color: #29251d;
  background: #f2ece0;
  font: 16px/1.5 system-ui, sans-serif;
  --accent: #732e22;
  --line: #d1c4ae;
  --muted: #605548;
  --paper: #faf6ef;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select { color: inherit; font: inherit; }
button, select { cursor: pointer; }
:focus-visible { outline: 2px solid #922f21; outline-offset: 3px; }
.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%);
}
.skip:focus { position: absolute; z-index: 1; top: 1rem; left: 1rem; padding: .5rem; background: var(--paper); }
.site-header {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: 1.1rem clamp(1rem, 5vw, 5rem);
  border-bottom: 1px solid var(--line);
}
.site-title { font: 1.44rem Georgia, serif; text-decoration: none; }
.site-header nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .25rem 1.25rem; }
.site-header nav a { font-size: .875rem; text-underline-offset: .24em; }
main { max-width: 1500px; margin: auto; padding: 0 clamp(1rem, 5vw, 5rem) 3rem; }
.discovery { padding: clamp(2.25rem, 5vw, 4.75rem) 0 1.5rem; border-bottom: 1px solid var(--line); }
h1 { font: 400 clamp(2.25rem, 5vw, 4rem)/1.1 Georgia, serif; letter-spacing: -.045em; margin: 0 0 1.25rem; }

/* Explore is a full page here. Its controls and manuscript shelf share the earlier desk styles.
   Three voices carry all the text: the project hand names the subjects; upright serif is for titles, passages
   and controls; dim italic is for where a page comes from, how many there are, and a translation still to come. */
.explore-page {
  min-height: 100svh;
  background: #211910;
  color-scheme: dark;
}
.explore-page::before {
  content: '';
  position: fixed;
  inset: -10px;
  background:
    radial-gradient(ellipse at 48% 48%, #382e23cd 0, #21180de9 74%, #191209f2 100%),
    url('assets/worktable-pattern.svg') 50% 45% / 2048px auto;
  filter: blur(7px);
  pointer-events: none;
}
.explore-page #explore {
  --gutter: clamp(20px, 4.4vw, 72px);
  position: relative;
  width: auto;
  height: auto;
  min-height: 100svh;
  overflow: clip;
}
.explore-page #explore .explore-stage {
  min-height: 100svh;
  grid-template-rows: auto auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
}
.explore-page #explore .explore-stage:before { content: none; }
#explore .explore-top { grid-row: 1; }
#explore #explore-subjects { grid-row: 2; }
#explore .explore-results { grid-row: 3; }
#explore .explore-foot { grid-row: 4; justify-content: flex-end; }
#explore .explore-top button { display: grid; place-items: center; padding: 0; min-width: 22px; min-height: 44px; background: transparent; border: 0; }
#explore #search-form:focus-within { box-shadow: 0 1px 0 var(--amber); }
#explore #explore-close { text-decoration: none; }
#explore #explore-close:focus-visible, #explore select:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

/* Subjects, in the hand, are the way in. */
.explore-page #explore #explore-subjects button { background: transparent; border: 0; }
.explore-page #explore #explore-subjects button[aria-pressed="true"] { color: var(--cream); }
.explore-page #explore #explore-subjects button[aria-pressed="true"]:after { clip-path: inset(0); }
.explore-plain #explore #explore-subjects button { font-style: italic; }

/* The notebook is a quiet clause of the count: “3,827 pages in all notebooks”. */
#explore .result-line { display: flex; align-items: baseline; gap: .32em; min-width: 0; margin: 0 0 6px; font: italic 16px/1.5 var(--serif); color: var(--dim); }
#explore #result-status { flex: none; margin: 0; padding: 0; font: inherit; color: inherit; }
#explore #result-scope { position: relative; display: flex; align-items: baseline; gap: .32em; min-width: 0; }
#explore #collection {
  -webkit-appearance: none;
  appearance: none;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  padding: 2px 19px 2px 0;
  border: 0;
  border-bottom: 1px solid var(--faint);
  border-radius: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='m1.5 1.5 4.5 4.5 4.5-4.5' fill='none' stroke='%23bfb193' stroke-width='1.3'/%3E%3C/svg%3E") right 2px top 58% / 10px no-repeat;
  color: var(--dim);
  font: inherit;
  text-overflow: ellipsis;
  transition: color .35s var(--calm), border-color .35s var(--calm);
}
#explore #collection:hover, #explore #collection.is-set { color: var(--cream); }
#explore #collection:hover { border-color: var(--amber); }
#explore #collection option, #explore #collection optgroup { background: #302619; color: var(--cream); font-style: normal; }
#collection-size { position: absolute; visibility: hidden; white-space: pre; font: inherit; pointer-events: none; }
/* A row that runs past the edge fades there, and only there. */
#explore .more-after { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
#explore .more-before { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px); mask-image: linear-gradient(90deg, transparent, #000 32px); }
#explore .more-before.more-after { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 48px), transparent); }

.explore-results { position: relative; min-width: 0; }
#explore #pages:focus { outline: none; }
#explore #result-list { list-style: none; margin: 0; padding: 0; }
.explore-results:not(.is-browsing) { max-width: 860px; }
#explore .result-meta { margin: 0; font: italic 15px/1.4 var(--serif); color: var(--dim); }
#explore #clear-filters { background: none; border: 0; cursor: pointer; }
#explore #no-results { max-width: 56ch; padding-top: 4px; }
#explore #no-results-hint { margin: 0 0 6px; font: 17px/1.6 var(--serif); color: #e4d8be; }
#explore #clear-filters { min-height: 44px; padding: 10px 0; font: 17px/1.4 var(--serif); color: var(--cream); text-decoration: underline; text-decoration-color: var(--amber); text-decoration-thickness: 1px; text-underline-offset: 6px; }

.is-browsing { display: grid; align-content: center; grid-template-columns: minmax(0, 1fr) auto; column-gap: 20px; }
#explore .is-browsing .result-line { grid-area: 2 / 1; align-self: center; margin: 0; }
.is-browsing .shelf-foot { grid-area: 2 / 2; margin-top: 0; }
/* The scale is as long as the whole shelf from the first moment; its marks spread to fill a fixed width. */
#explore #shelf-scale { justify-content: space-between; gap: 0; width: min(calc(var(--marks) * 6px), max(0px, calc(100vw - 2 * var(--gutter) - 470px))); }
#explore #result-list.shelf {
  grid-area: 1 / 1 / 2 / -1;
  gap: clamp(20px, 3vw, 46px);
  margin: 0 calc(-1 * var(--gutter));
  padding: 32px var(--gutter) 18px;
  align-items: start;
}
#explore .shelf .result-card { --sheet-w: clamp(205px, max(23vw, min(34vw, calc(var(--sheet-h) * .72))), 360px); width: var(--sheet-w); }
#explore #result-list.shelf .result-card { border: 0; }
#explore .sheet-art { height: var(--sheet-h); aspect-ratio: auto; display: grid; align-items: end; }
#explore .sheet-art img { display: block; width: 100%; height: var(--sheet-h); object-fit: contain; object-position: left bottom; }
#explore .shelf .result-text { width: var(--sheet-w); padding-bottom: 4px; }
/* A new subject or a longer caption loaded during a turn must keep the shelf and its controls in place. */
#explore .sheet-title { margin: 19px 0 0; min-block-size: 3lh; }
#explore .sheet .result-source { display: none; }
#explore .sheet .result-mark { display: block; }

@media (max-width: 760px) {
  #explore .explore-top { gap: 12px; }
  .explore-page #explore #explore-subjects { -webkit-mask-image: none; mask-image: none; }
  .explore-page #explore #explore-subjects.more-after { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
  .explore-page #explore #explore-subjects.more-before { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px); mask-image: linear-gradient(90deg, transparent, #000 32px); }
  .explore-page #explore #explore-subjects.more-before.more-after { -webkit-mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, transparent, #000 32px, #000 calc(100% - 48px), transparent); }
  /* Narrow screens give the scale its own line across the page, above the count and the turns. */
  #explore .is-browsing .shelf-foot { display: contents; }
  #explore .is-browsing #shelf-scale { display: flex; grid-area: 2 / 1 / 3 / -1; width: min(calc(var(--marks) * 7px), 100%); margin: 2px 0 10px; }
  #explore .is-browsing .result-line { grid-area: 3 / 1; }
  #explore .is-browsing .shelf-turn { grid-area: 3 / 2; }
  #explore .shelf .result-card { --sheet-w: min(71vw, 315px); }
  /* Keep the scale's space for notebook filters with just one page. */
  .is-browsing { column-gap: 12px; grid-template-rows: auto minmax(28px, max-content) auto; }
}
@media (max-width: 760px) and (max-height: 640px) {
  #explore #result-list.shelf { padding-top: 12px; }
}
@media (pointer: coarse) {
  #explore #collection { min-height: 44px; }
  #explore .explore-foot a { padding: 11px 0; }
}
