/* Catalogue — one product per screen. Black, off-white, no accent colour. */
:root {
  --bg: #0a0a0a;
  --fg: #ededed;
  --soft: #cfcfcf;
  --muted: #8d8d8d;
  --line: rgba(255, 255, 255, .13);
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-snap-type: y proximity; background: var(--bg); }
body.catalogue, body.page {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--serif); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 3px; }

/* ---------- header ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px clamp(20px, 3vw, 40px);
  background: linear-gradient(to bottom, rgba(10, 10, 10, .94), rgba(10, 10, 10, 0));
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand img { display: block; height: 36px; width: auto; }
.top nav { display: flex; align-items: center; gap: 28px; font: 500 11.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; }
.top nav a { text-decoration: none; color: var(--muted); transition: color .2s; }
.top nav a:hover, .top nav a[aria-current] { color: var(--fg); }
.langs { display: flex; gap: 16px; }
.langs a[aria-current] { border-bottom: 1px solid var(--fg); padding-bottom: 3px; }

/* ---------- product ---------- */
.product {
  display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr);
  min-height: 100vh; min-height: 100svh; scroll-snap-align: start;
}
.product + .product { background: linear-gradient(var(--line), var(--line)) 0 0 / 100% 1px no-repeat; }

.stage {
  position: sticky; top: 0; align-self: start;
  height: 100vh; height: 100svh;
  display: grid; place-items: center;
  padding: 88px clamp(20px, 4vw, 64px) 40px;
}
.cover { display: block; max-width: 82%; height: min(100%, 60svh); width: auto; object-fit: contain;
  filter: drop-shadow(0 28px 36px rgba(0, 0, 0, .55)); }

.placeholder {
  width: min(340px, 62%); aspect-ratio: 5 / 7.3; padding: 10% 9%;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center;
  background: linear-gradient(150deg, #1c1c1c, #0e0e0e); border: 1px solid var(--line); border-radius: 3px;
  box-shadow: 0 28px 36px rgba(0, 0, 0, .5), inset 4px 0 0 rgba(255, 255, 255, .04);
}
.ph-author { font: 500 10px/1.4 var(--sans); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.ph-title { font: 500 clamp(1.5rem, 2.4vw, 2.2rem)/1.1 var(--serif); }
.ph-coll { font: italic 400 .85rem/1 var(--serif); color: var(--muted); }

.info {
  display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  padding: 104px clamp(24px, 6vw, 96px) 56px clamp(16px, 3vw, 48px); max-width: 720px;
}
.eyebrow { margin: 0 0 14px; font: 500 12px/1.4 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
h2 { margin: 0; font: 500 clamp(2.5rem, 4.4vw, 4.2rem)/1.04 var(--serif); letter-spacing: -.005em; }
.sub { margin: 14px 0 0; font: italic 400 clamp(1.15rem, 1.6vw, 1.45rem)/1.35 var(--serif); color: var(--soft); }
.specs { margin: 18px 0 0; font: 400 12.5px/1.4 var(--sans); letter-spacing: .04em; color: var(--muted); }

.desc { margin-top: 30px; font: 400 clamp(1.1rem, 1.35vw, 1.28rem)/1.58 var(--serif); color: var(--soft); }
.desc p { margin: 0 0 1em; }
.desc p:last-child { margin-bottom: 0; }
.desc b, .desc strong { font-weight: 600; color: var(--fg); }
.desc.clamped { max-height: 8em; overflow: hidden; position: relative;
  -webkit-mask-image: linear-gradient(#000 62%, transparent); mask-image: linear-gradient(#000 62%, transparent); }
.more { margin-top: 12px; padding: 0; background: none; border: 0; cursor: pointer; color: var(--fg);
  font: 500 12px/1 var(--sans); letter-spacing: .1em; text-transform: uppercase;
  border-bottom: 1px solid var(--fg); padding-bottom: 4px; }
.more:hover { color: var(--muted); border-color: var(--muted); }

/* ---------- where to buy ---------- */
.buy { width: 100%; margin-top: 32px; }
.label { margin: 0 0 14px; font: 500 11px/1 var(--sans); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); }
.tabs button {
  margin: 0 0 -1px; padding: 0 0 12px; background: none; border: 0; border-bottom: 1px solid transparent; cursor: pointer;
  font: 500 13px/1 var(--sans); letter-spacing: .04em; color: var(--muted); transition: color .2s;
}
.tabs button:hover { color: var(--soft); }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--fg); }
.stores { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 18px 10px; padding-top: 22px; }
.stores[hidden] { display: none; }
.store { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; text-align: center; }
.store[hidden] { display: none; }
.store img, .store .noicon { width: 44px; height: 44px; border-radius: 11px; object-fit: cover; display: block; }
.store .noicon { background: #1c1c1c; }
.store span { max-width: 100%; font: 400 11px/1.25 var(--sans); color: var(--muted); transition: color .2s;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store:hover span, .store:focus-visible span { color: var(--fg); }

.biblio { margin-top: 28px; width: 100%; border-top: 1px solid var(--line); padding-top: 18px; }
.biblio p { margin: 0; font: 400 13px/1.65 var(--sans); color: var(--muted); }

/* ---------- colophon ---------- */
.colophon { border-top: 1px solid var(--line); padding: 96px clamp(24px, 6vw, 96px) 40px; text-align: center; scroll-snap-align: end; }
.colophon .intro { max-width: 46ch; margin: 0 auto 72px; font: italic 400 clamp(1.25rem, 1.9vw, 1.6rem)/1.5 var(--serif); color: var(--soft); }
.site-footer { max-width: 560px; margin: 0 auto; font: 400 11.5px/1.6 var(--sans); color: var(--muted); }
.site-footer p { margin: 0 0 10px; }
.site-footer a { color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.site-footer a:hover { color: var(--fg); border-color: var(--fg); }
.site-footer .footer-dedication { font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: var(--soft); margin: 18px 0; }
.site-footer .footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; margin: 20px 0; }
.site-footer .footer-copyright { margin-top: 24px; opacity: .7; }

/* ---------- small screens ---------- */
@media (max-width: 899px) {
  html { scroll-snap-type: none; }
  .top nav { gap: 18px; }
  .product { display: block; min-height: 0; }
  .stage { position: static; height: auto; padding: 84px 24px 12px; }
  .cover { height: auto; max-height: 52svh; margin: 0 auto; }
  .placeholder { margin: 0 auto; }
  .info { max-width: none; padding: 20px 24px 64px; }
    .colophon { padding-top: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; scroll-snap-type: none; }
  * { transition: none !important; }
}

/* ---------- page transition ---------- */
/* cross-fade between pages (Chromium / Safari); the header stays put while the page changes beneath it */
@media (prefers-reduced-motion: no-preference) { @view-transition { navigation: auto; } }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .4s; animation-timing-function: var(--ease); }
.top { view-transition-name: site-header; }

/* ---------- members (sign-in, account, per-book document) ---------- */
.top-left { display: flex; align-items: center; gap: clamp(16px, 2.4vw, 28px); }
.top nav button, .top-left button {
  appearance: none; background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--muted); transition: color .2s;
}
.top-left button { font: 500 11.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; }
.top nav button:hover, .top nav button:focus-visible, .top-left button:hover, .top-left button:focus-visible { color: var(--fg); }
.top nav button[hidden], .top-left button[hidden] { display: none; }

.acct-panel {
  position: fixed; top: 60px; left: clamp(20px, 3vw, 40px); z-index: 30; min-width: 220px; max-width: min(320px, calc(100vw - 40px));
  padding: 16px 18px; background: #111; border: 1px solid var(--line); border-radius: 3px;
  font: 400 13px/1.5 var(--sans); color: var(--soft);
}
.acct-panel p { margin: 0 0 12px; word-break: break-all; }
.acct-panel strong { color: var(--fg); font-weight: 500; }
.acct-panel .acct-item { appearance: none; display: block; width: 100%; text-align: left; background: none; border: 0;
  border-top: 1px solid var(--line); padding: 12px 0 0; margin-top: 12px; cursor: pointer;
  font: 500 11.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--soft); }
.acct-panel .acct-item:hover, .acct-panel .acct-item:focus-visible { color: var(--fg); }
.acct-panel p + .acct-item { margin-top: 0; }

/* down-pointing arrow on the account button; flips while the menu is open */
#account-btn::after { content: ''; display: inline-block; width: 5px; height: 5px; margin: 0 0 3px 9px;
  border: solid currentColor; border-width: 0 1px 1px 0; transform: rotate(45deg); transition: transform .2s; }
#account-btn[aria-expanded="true"]::after { transform: rotate(225deg) translate(-1px, -1px); }

.auth-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 40; max-width: calc(100vw - 40px);
  padding: 12px 18px; background: #111; border: 1px solid var(--line); border-radius: 3px;
  font: 400 13px/1.4 var(--sans); color: var(--fg);
}

.members { width: 100%; margin-top: 8px; }
.members .pw { margin: 12px 0 0; font: 400 13px/1.4 var(--sans); color: var(--muted); }
.members .pw code { font: 500 13px/1 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; color: var(--fg); user-select: all; }
.members .pw button { appearance: none; background: none; border: 0; margin-left: 12px; padding: 0; cursor: pointer; font: 500 11px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.members .pw button:hover, .members .pw button:focus-visible { color: var(--fg); }

/* ---------- "my books" overlay (members) ---------- */
body.books-open { overflow: hidden; }
.books-overlay {
  position: fixed; inset: 0; z-index: 50; overflow-y: auto; overscroll-behavior: contain;
  background: rgba(10, 10, 10, .96); padding: clamp(16px, 4vw, 56px);
}
.books-dialog { max-width: 1040px; margin: 0 auto; }
.books-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
  padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.books-head h2 { font-size: clamp(1.8rem, 3vw, 2.6rem); }
.books-langs { display: flex; gap: 16px; margin: 0 auto 0 28px; font: 500 11.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; }
.books-langs button { appearance: none; background: none; border: 0; border-bottom: 1px solid transparent; padding: 0 0 3px; cursor: pointer;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--muted); transition: color .2s; }
.books-langs button:hover, .books-langs button:focus-visible { color: var(--fg); }
.books-langs button[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--fg); }
.books-list[aria-busy="true"] { opacity: .5; transition: opacity .2s; }
.books-close { appearance: none; background: none; border: 0; padding: 0 4px; cursor: pointer;
  font: 300 34px/1 var(--sans); color: var(--muted); transition: color .2s; }
.books-close:hover, .books-close:focus-visible { color: var(--fg); }

.books-grid { list-style: none; margin: 28px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 16px; }
.book-card { display: flex; gap: 16px; align-items: flex-start; padding: 16px;
  border: 1px solid var(--line); border-radius: 3px; background: #0f0f0f; }
.mini-cover { flex: none; width: 76px; height: 108px; object-fit: contain; object-position: top center;
  filter: drop-shadow(0 8px 10px rgba(0, 0, 0, .5)); }
.mini-ph { background: linear-gradient(150deg, #1c1c1c, #0e0e0e); border: 1px solid var(--line); border-radius: 2px; filter: none; }
.book-body { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.book-title { margin: 0; font: 500 1.2rem/1.2 var(--serif); color: var(--fg); }
.book-author { margin: 5px 0 0; font: 500 10.5px/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.book-link { margin-top: 14px; font: 500 11px/1 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; color: var(--fg); border-bottom: 1px solid var(--fg); padding-bottom: 4px; }
.book-link:hover, .book-link:focus-visible { color: var(--muted); border-color: var(--muted); }
.book-body .members { margin-top: 4px; }
.books-empty { margin: 32px 0 0; font: 400 14px/1.5 var(--sans); color: var(--muted); }

/* ---------- 404 ---------- */
.notfound { min-height: 100vh; min-height: 100svh; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 96px 24px 48px; text-align: center; }
.notfound h1 { margin: 0; font: 500 clamp(3rem, 8vw, 5.5rem)/1 var(--serif); }
.notfound p { margin: 0; font: 400 1.15rem/1.5 var(--serif); color: var(--soft); }
.notfound nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; margin-top: 18px; font: 500 11.5px/1 var(--sans); letter-spacing: .14em; text-transform: uppercase; }
.notfound nav a { color: var(--soft); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 4px; transition: color .2s; }
.notfound nav a:hover, .notfound nav a:focus-visible { color: var(--fg); }

/* ---------- catalogue title links, book pages ---------- */
h2 a { color: inherit; text-decoration: none; }
h2 a:hover, h2 a:focus-visible { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
h1 { margin: 0; font: 500 clamp(2.5rem, 4.4vw, 4.2rem)/1.04 var(--serif); letter-spacing: -.005em; }
.sr-only { margin: 0; }

.crumbs { margin: 0 0 22px; font: 500 11px/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.crumbs a { color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; }
.crumbs a:hover, .crumbs a:focus-visible { color: var(--fg); border-color: var(--fg); }
.crumbs [aria-current] { color: var(--soft); }

.more-books { border-top: 1px solid var(--line); padding: 72px clamp(24px, 6vw, 96px); }
.more-books h2 { margin: 0 0 28px; font: 500 clamp(1.6rem, 2.6vw, 2.2rem)/1.1 var(--serif); }
.more-books ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 44px 32px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.more-books a { display: flex; flex-direction: column; align-items: flex-start; text-decoration: none; }
.more-books .c { display: block; width: 100%; margin-bottom: 16px; }
.more-books .c img { display: block; width: 100%; max-width: 200px; height: auto;
  filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .55)); transition: transform .35s var(--ease); }
.more-books .c .ph { display: block; width: 100%; max-width: 200px; aspect-ratio: 5 / 7.3; background: linear-gradient(150deg, #1c1c1c, #0e0e0e); border: 1px solid var(--line); border-radius: 3px; }
.more-books a:hover .c img, .more-books a:focus-visible .c img { transform: translateY(-6px); }
.more-books .t { display: block; font: 500 1.15rem/1.25 var(--serif); color: var(--fg); }
.more-books .a { display: block; margin-top: 6px; font: 500 10.5px/1.4 var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.more-books a:hover .t, .more-books a:focus-visible .t { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; }
