/* The public library page of the website. Loaded after tokens.css, app.css and
   book.css, whose shelf and reader it uses.

   The page wears the website itself: /css/main.css comes in as the cascade layer
   "site" (index.html), the navigation, the opening and the footer are the
   website's own markup (js/site-chrome.js), and /js/main.js and /js/tree.js
   move them as they move every other page. The library's rules are not in a
   layer, so they win wherever the two meet; this file settles the meeting. */

/* ---- one set of tokens: the website's typefaces, corners, paper, ink and brass ---- */
:root {
  --font-display: 'Fraunces', 'Times New Roman', Georgia, serif;
  --font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --gutter: clamp(20px, 4vw, 56px);
  --r-xs: 2px; --r-sm: 2px; --r-md: 3px; --r-lg: 4px; --r-xl: 4px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --c-canvas: #F6F2EA; --c-canvas-2: #EEE8DC;
  --c-surface: #FBF9F4; --c-surface-2: #F6F2EA; --c-surface-3: #EEE8DC;
  --c-ink: #16130F; --c-ink-2: #4A4339; --c-ink-3: #675F52;
  --c-line: rgba(22, 19, 15, 0.12); --c-line-2: rgba(22, 19, 15, 0.24);
  --c-accent: #7A5B24; --c-accent-strong: #5E4519; --c-accent-wash: rgba(160, 125, 63, 0.12);
  --c-mark: rgba(160, 125, 63, 0.28);
}
html[lang="he"] { --font-display: 'Heebo', system-ui, sans-serif; --font-ui: 'Heebo', system-ui, sans-serif; }
/* The pages of a book keep the book's own face, whatever the language of the page around them. */
.bk-flow, .cover-type { --font-display: 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Book Antiqua', Georgia, serif; }

/* ---- the website's head, opening and foot: exactly the website's, nothing of the library in them ---- */
#navbar, #libraryHero, #footer { font-family: var(--font-body); font-size: var(--fs-body); line-height: 1.72; color: var(--ink); text-align: start; }
#navbar *, #navbar *::before, #navbar *::after,
#libraryHero *, #libraryHero *::before, #libraryHero *::after,
#footer *, #footer *::before, #footer *::after { all: revert-layer; }
body.public-library { background: var(--paper); color: var(--ink); }
body.public-library:not(.is-reading) main { padding: 0; min-height: 40vh; }
/* The shelf takes the website's container, not the narrower column of the workbench. */
body.public-library:not(.is-reading) main > .view { max-width: none; margin: 0; }

/* ---- the shelf: a chapter of the page, set like the rest of the website ---- */
.library-room { padding: clamp(36px, 4vw, 56px) 0 var(--sp-2xl); }
.public-shelf { --shelf-gap: clamp(28px, 4.4vw, 72px); grid-template-columns: repeat(auto-fill, minmax(216px, 264px)); gap: 0 var(--shelf-gap); }
.public-shelf .book-stand { min-height: 0; padding: 28px 0 0; justify-content: flex-start; }
.public-shelf .book-stand .cover { max-width: 216px; }
.public-shelf .cover.has-art { aspect-ratio: var(--cover-ratio, 2 / 3); background: #14110f; }
.public-shelf .cover.has-art .cover-sheen { opacity: 0.35; }
.public-shelf .cover.has-art .cover-spine { opacity: 0.5; }
/* Every cover stands in a seat as tall as the tallest book, so that all of them rest on one line. */
.public-shelf .cover-seat { width: 100%; max-width: 216px; aspect-ratio: 1 / var(--tallest, 1.5); display: flex; align-items: flex-end; }
.public-shelf .cover-seat .cover { max-width: none; }
/* The ledge: a brass hairline over a soft shadow, not a plank of wood. */
.public-shelf .shelf-board { height: 1px; background: var(--brass); box-shadow: 0 18px 22px -16px rgba(22, 19, 15, 0.38); border-radius: 0 !important; }
/* One ledge under all the books: each board reaches across the gap to the next, the last one runs on to the edge. */
.public-shelf .book-card:not(:last-child) .shelf-board { margin-inline-end: calc(-1 * var(--shelf-gap)); }
.public-shelf .book-card:last-child .shelf-board::after { background: var(--hair-2); box-shadow: none; }
.public-shelf .book-body { gap: 0; padding: 22px 0 var(--sp-7); contain-intrinsic-size: auto 200px; }
.public-shelf .book-body .h-sub {
  font: 400 var(--fs-h3)/1.18 var(--font-display); font-variation-settings: "opsz" 144;
  letter-spacing: -0.015em; color: var(--ink); margin: 0 0 12px;
}
.public-shelf .book-body .book-meta { font: 400 0.86rem/1.5 var(--font-ui); color: var(--ink-3); }
.public-shelf .book-body .book-author { font: 500 max(0.66rem, var(--label-floor, 0.6875rem))/1.5 var(--font-ui); letter-spacing: 0.16em; text-transform: uppercase; }
.public-shelf .book-body .book-imprint { font: italic 400 0.95rem/1.45 var(--font-display); margin-top: 4px; }
.public-shelf .book-body .book-place { margin-top: 8px; color: var(--brass-ink); }
.public-shelf .chips { margin-top: 16px; }
.public-shelf .chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 0; padding: 7px 10px 6px;
  font: 600 max(0.6rem, var(--label-floor, 0.6875rem))/1 var(--font-ui); letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--ink); background: transparent; border: 1px solid var(--hair-2); border-radius: var(--r-sm);
}
.public-shelf .chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--brass); }
.public-shelf .book-card[data-status="coming_soon"] .chip::before { background: transparent; box-shadow: inset 0 0 0 1px var(--brass); }
.public-shelf .chip .icon { display: none; }
.public-shelf .book-body .book-meta.book-note { font: 400 0.8rem/1.55 var(--font-ui); letter-spacing: 0; text-transform: none; color: var(--ink-3); margin-top: 12px; max-width: 26ch; }
.book-card.is-coming .cover-type::after {
  /* A quiet band across the foot of the cover of a book that is not published yet. */
  content: ''; position: absolute; inset-inline: -40%; bottom: -14%; height: 1px; background: rgba(239, 228, 200, 0.28);
}
/* A book that does not open yet answers with a panel, wherever its card is clicked. */
.book-card.is-closed { cursor: pointer; }
.book-more {
  position: relative; display: inline-flex; align-self: flex-start; align-items: center; gap: 10px;
  margin-top: 16px; margin-inline: 0 auto; padding: 6px 0; border: 0; background: none; text-align: start;
  font: 600 max(0.7rem, var(--label-floor, 0.6875rem))/1.2 var(--font-ui); letter-spacing: 0.18em; text-transform: uppercase; color: var(--ink); cursor: pointer;
}
.book-more::after {
  content: ""; position: absolute; inset-inline: 0; bottom: 0; height: 1px; background: currentColor;
  transform: scaleX(0.28); transform-origin: left; transition: transform 0.6s var(--ease-io);
}
[dir="rtl"] .book-more::after { transform-origin: right; }
.book-card.is-closed:hover .book-more::after, .book-more:focus-visible::after { transform: scaleX(1); }
.book-more:focus-visible { outline: none; }
.book-card.is-closed:has(.book-more:focus-visible) .cover { outline: 1.5px solid var(--brass); outline-offset: 4px; transform: translateY(-10px); }
.book-card:focus-visible .cover { outline: 1.5px solid var(--brass); outline-offset: 4px; }
.library-note { margin: var(--sp-xl) 0 0; padding-top: 22px; border-top: 1px solid var(--hair); color: var(--ink-2); font-size: 0.95rem; }
.library-note a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--brass); padding-bottom: 1px; transition: color var(--t-fast); }
.library-note a:hover { color: var(--brass-ink); }
@media (prefers-reduced-motion: no-preference) {
  /* The books arrive one after the other, in place: nothing moves off its shelf line. */
  .library-room .book-card { animation: shelf-arrive 0.9s var(--ease-out) both; animation-delay: calc(0.12s + var(--i, 0) * 0.11s); }
  @keyframes shelf-arrive { from { opacity: 0; } }
}

/* ---- the panel of a book that is coming: a card of the website ---- */
.public-library .dialog-body { width: min(560px, calc(100vw - 32px)); padding: clamp(24px, 3vw, 36px); border-radius: var(--r-lg); background: var(--sheet); box-shadow: var(--shadow-lg); border: 1px solid var(--hair); }
.soon { display: flex; gap: clamp(20px, 3vw, 32px); align-items: flex-start; }
.soon-cover { flex: 0 0 136px; container-type: inline-size; }
.soon-cover .cover.has-art { aspect-ratio: var(--cover-ratio, 2 / 3); background: #14110f; }
.soon-text { min-width: 0; flex: 1; }
.soon-text > * { margin: 0; }
.soon-text > * + * { margin-top: 8px; }
.soon-state { display: inline-flex; align-items: center; gap: 12px; font: 600 max(0.66rem, var(--label-floor, 0.6875rem))/1.3 var(--font-ui); letter-spacing: 0.22em; text-transform: uppercase; color: var(--brass-ink); }
.soon-state::before { content: ""; width: 26px; height: 1px; background: currentColor; opacity: 0.7; }
.soon-text h2 { font: 400 calc(var(--k-display) * 1.75rem)/1.12 var(--font-display); font-variation-settings: "opsz" 144; letter-spacing: -0.02em; color: var(--ink); margin-top: 14px !important; }
.soon-text .book-meta { font: italic 400 0.98rem/1.45 var(--font-display); color: var(--ink-3); }
.soon-note { margin-top: 16px !important; color: var(--ink-2); line-height: 1.7; }
.public-library .dialog-body .actions { margin-top: 26px; display: flex; justify-content: flex-end; }
@media (max-width: 480px) { .soon { flex-direction: column; align-items: center; text-align: center; } .soon-cover { flex-basis: auto; width: 132px; } .soon-state::before { display: none; } }

/* ---- buttons: the website's where the library offers a way on; the reader's own controls keep their shape ---- */
.public-library .btn-primary { all: revert-layer; }
.public-library :is(main, dialog) .btn:not(.btn-primary) { text-transform: none; letter-spacing: normal; overflow: visible; isolation: auto; }
.public-library :is(main, dialog) .btn:not(.btn-primary)::before,
.public-library :is(main, dialog) .btn:not(.btn-primary)::after { content: none; }

/* ---- a published edition names the parts of its opening pages; this is how each is set ---- */
.bookview .bk-flow.is-title p.bk-h.bk-r-title { font-family: var(--font-display); font-size: 1.75em; font-style: normal; line-height: 1.24; letter-spacing: 0.05em; margin-bottom: calc(var(--lh) * 1.6); }
.bookview .bk-flow.is-title p.bk-h.bk-r-author { font-size: 1.12em; font-style: normal; line-height: var(--lh); margin-top: 0; margin-bottom: calc(var(--lh) * 1.8); }
.bookview .bk-flow.is-title p.bk-h.bk-r-minor { font-size: 0.82em; font-style: normal; letter-spacing: 0.1em; line-height: calc(var(--lh) * 0.95); margin-top: 0; margin-bottom: calc(var(--lh) * 2.6); }
.bookview .bk-flow.is-title p.bk-h.bk-r-minor i { letter-spacing: 0.02em; }
.bookview .bk-flow.is-title p.bk-h.bk-r-imprint { font-size: 0.84em; font-style: normal; letter-spacing: 0.12em; line-height: calc(var(--lh) * 0.95); margin-top: 0; margin-bottom: 0; }
.bookview .bk-flow.is-title p.bk-h.bk-r-dedication { font-family: var(--bk-font); font-size: 1em; font-style: normal; font-variant: small-caps; letter-spacing: 0.08em; line-height: calc(var(--lh) * 1.35); }
.bookview .bk-flow.is-foot { display: flex; flex-direction: column; justify-content: flex-end; column-width: auto; padding-bottom: var(--lh); }
.bookview .bk-flow p.bk-r-small { font-size: 0.8em; line-height: 1.5; text-indent: 0; hyphens: none; }
.bookview .bk-flow p.bk-r-center { text-align: center; margin-top: 1.1em; letter-spacing: 0.02em; }
.bookview .bk-flow p.bk-r-cont { text-indent: 0; }
.bookview .bk-flow p.bk-toc { display: flex; align-items: baseline; gap: 0.9em; text-indent: 0; text-align: start; hyphens: none; margin-bottom: calc(var(--lh) * 0.18); break-inside: avoid; }
.bookview .bk-flow p.bk-toc .s { display: contents; }
.bk-toc-mark { flex: 0 0 6.6em; white-space: nowrap; text-align: end; font-size: 0.82em; font-variant: all-small-caps; letter-spacing: 0.08em; color: var(--bk-ink-2); }
.bk-toc-title { flex: 1 1 auto; min-width: 0; }
.bk-toc-page { flex: none; font-variant-numeric: tabular-nums lining-nums; color: var(--bk-ink-2); }
/* What the website says inside a page of a book is set apart from the book: its own typeface, smaller, quieter. */
.bookview .bk-flow p.bk-ednote { font-family: var(--font-ui); font-size: 0.7em; font-style: normal; font-variant: normal; line-height: 1.5; letter-spacing: 0; text-indent: 0; text-align: center; hyphens: none; color: var(--bk-ink-2); max-width: 36ch; margin: calc(var(--lh) * 0.9) auto 0; white-space: normal; }
.bookview .bk-flow p.bk-ednote + p.bk-ednote { margin-top: calc(var(--lh) * 0.35); }
.bookview .bk-flow p.bk-ednote-head { font-family: var(--font-display); font-size: 1.3em; color: var(--bk-ink); margin-top: 0; }
@media (max-width: 560px) {
  .public-shelf { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
  .public-shelf .book-stand { min-height: 0; padding: 18px 12px 0; }
  .public-shelf .book-body { padding: 16px 6px var(--sp-6); }
  .public-shelf .book-body .h-sub { font-size: calc(var(--k-display) * 1.12rem); }
  .public-shelf .book-body .book-imprint { font-size: 0.86rem; }
}
/* In the Hebrew interface the lines under a cover start where the card starts, English titles included. */
[dir='rtl'] .public-shelf .book-body :is(h2, .book-meta) { text-align: right; }
html[lang="he"] .public-shelf .chip,
html[lang="he"] .book-more, html[lang="he"] .soon-state { letter-spacing: 0; text-transform: none; }
html[lang="he"] .public-shelf .chip { font-size: 0.78rem; font-weight: 500; }
html[lang="he"] .book-more { font-size: 0.86rem; font-weight: 500; }
html[lang="he"] .soon-state { font-size: 0.8rem; font-weight: 500; }
/* The English names of a book keep their English letters and their own shape in the Hebrew interface. */
html[lang="he"] .public-shelf .book-body [lang="en"], html[lang="he"] .soon-text [lang="en"] { font-family: 'Fraunces', Georgia, serif; }
html[lang="he"] .public-shelf .book-body .book-author[lang="en"] { font-family: 'Plus Jakarta Sans', system-ui, sans-serif; letter-spacing: 0.14em; }

/* ---- reading: the book has the whole window ---- */
body.is-reading #navbar, body.is-reading #libraryHero, body.is-reading #footer, body.is-reading .tree-rail,
body.is-reading #scroll-progress, body.is-reading .film-grain, body.is-reading #cursor-dot, body.is-reading #cursor-ring { display: none !important; }
body.is-reading { min-height: 0; }

noscript .no-js { max-width: 640px; margin: var(--sp-8) auto; padding: 0 var(--gutter); }

@media print {
  #navbar, #libraryHero, #footer, .tree-rail, #scroll-progress, .film-grain { display: none; }
}
