/* Public site. Direction: a quiet reading room with a night-blue back room.
   Sections alternate between paper, white, tinted "stage" panels and night blue, so each block reads as its own place.
   The real book covers are the only imagery. */

:root { --gutter: clamp(20px, 4vw, 40px); }
.wrap { width: min(100% - 2 * var(--gutter), 1120px); margin-inline: auto; }

/* ---------- Header: sticky, with a real mobile menu ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--rule);
  backdrop-filter: saturate(1.4) blur(10px);
}
.site-header__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s5); padding-block: var(--s2); }
.brand { display: block; border-radius: var(--r-s); }
.brand img { height: 50px; width: auto; }

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  min-height: var(--hit);
  padding: 0 var(--s4);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-s);
  background: var(--sheet);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition-property: transform, opacity;
  transition-duration: 160ms;
  transition-timing-function: var(--ease);
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }
.site-header[data-open] .nav-toggle__bars { background: transparent; }
.site-header[data-open] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.site-header[data-open] .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

/* Mobile: the menu is a full-width panel under the bar */
.site-nav { display: none; width: 100%; padding-bottom: var(--s4); }
.site-header[data-open] .site-nav { display: block; }
.site-nav ul { display: grid; }
.site-nav li:not(.site-nav__cta) { border-top: 1px solid var(--rule-soft); }
.site-nav a:not(.btn) {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 0 var(--s2);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: 1.375rem;
  text-decoration: none;
}
.site-nav a[aria-current="page"]:not(.btn) { color: var(--cloth); font-weight: 600; }
.site-nav__cta { padding-top: var(--s3); }
.site-nav__cta .btn { width: 100%; min-height: 48px; }

@media (min-width: 820px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; width: auto; padding: 0; }
  .site-nav ul { display: flex; align-items: center; gap: var(--s1); }
  .site-nav li:not(.site-nav__cta) { border-top: 0; }
  .site-nav a:not(.btn) {
    min-height: 40px;
    padding: 0 var(--s4);
    border-radius: 999px;
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--ink-2);
    transition-property: background-color, color;
    transition-duration: 140ms;
    transition-timing-function: var(--ease);
  }
  .site-nav a[aria-current="page"]:not(.btn) { background: var(--cloth-wash); color: var(--cloth-deep); font-weight: 600; }
  .site-nav__cta { padding: 0 0 0 var(--s3); }
  .site-nav__cta .btn { width: auto; min-height: 40px; padding: 0 var(--s5); }
}
@media (min-width: 820px) and (hover: hover) {
  .site-nav a:not(.btn):hover { background: var(--sunken); color: var(--ink); }
  .site-nav a[aria-current="page"]:not(.btn):hover { background: var(--cloth-wash); }
}
.site-nav .btn[aria-current="page"] { background: var(--cloth-deep); }

/* ---------- Hero: copy on paper, the shelf on a tinted stage that bleeds to the screen edge ---------- */
.hero { position: relative; isolation: isolate; overflow-x: clip; }
.hero__grid { display: grid; }
.hero__copy { padding-block: var(--s8) var(--s7); }
.hero h1 {
  font-size: clamp(2.75rem, 1.5rem + 4vw, 4.25rem);
  line-height: 1.03;
  letter-spacing: -0.024em;
  color: var(--night);
  max-width: 13ch;
}
.lede { margin-top: var(--s5); font-size: 1.1875rem; line-height: 1.55; color: var(--ink-2); max-width: 46ch; }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s6); }

.hero__stage { position: relative; display: flex; align-items: flex-end; padding-top: var(--s8); }
.hero__stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 -100vw 0 -100vw;
  background: var(--cloth-wash);
  border-top: 1px solid var(--cloth-line);
}
@media (min-width: 900px) {
  .hero__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: var(--s8); }
  .hero__copy { padding-block: var(--s9) var(--s9); align-self: center; }
  .hero__stage { padding-top: var(--s9); }
  .hero__stage::before { inset: 0 -100vw 0 calc(var(--s5) * -1); border-top: 0; }
}

/* Books standing on a plank. The plank is the bottom edge of the stage. */
.shelf { position: relative; display: flex; align-items: flex-end; gap: var(--s3); width: 100%; padding: 0; }
.shelf::after {
  content: "";
  position: absolute;
  inset: auto -100vw 0 -100vw;
  height: 14px;
  background: var(--cloth-line);
  border-top: 1px solid rgba(18, 34, 45, 0.12);
}
.shelf__book { position: relative; z-index: 1; flex: 1 1 0; min-width: 0; margin-bottom: 14px; }
.shelf__book:nth-child(2) { flex-grow: 1.3; }
.shelf__book a { display: block; border-radius: 2px; }
.shelf__book .cover { box-shadow: 0 1px 2px rgba(18, 34, 45, 0.18), 0 14px 22px -10px rgba(18, 34, 45, 0.4); }

/* One staged entrance on load: copy chunks and books rise 100ms apart (opacity, 12px, 4px blur, 300ms ease-out). */
@keyframes rise {
  from { opacity: 0; transform: translateY(12px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .hero h1, .hero .lede, .hero__actions, .shelf__book { animation: rise 300ms ease-out both; }
  .hero .lede { animation-delay: 100ms; }
  .hero__actions { animation-delay: 200ms; }
  .shelf__book:nth-child(1) { animation-delay: 250ms; }
  .shelf__book:nth-child(2) { animation-delay: 350ms; }
  .shelf__book:nth-child(3) { animation-delay: 450ms; }
}
@media (prefers-reduced-motion: reduce) {
  .hero h1, .hero .lede, .hero__actions, .shelf__book { animation: fade 200ms ease-out both; }
}

/* ---------- Facts band ---------- */
.facts-band { background: var(--sheet); border-bottom: 1px solid var(--rule); }
.facts-band__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin-block: 0; }
.facts-band__list > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: var(--s1); padding: var(--s5) var(--s3); }
.facts-band__list > div + div { border-left: 1px solid var(--rule); }
.facts-band dt { color: var(--ink-3); font-size: 0.8125rem; line-height: 1.3; }
.facts-band dd { margin: 0; font-family: var(--font-serif); font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem); font-weight: 500; line-height: 1; color: var(--night); font-variant-numeric: tabular-nums; }
@media (min-width: 700px) {
  .facts-band__list > div { flex-direction: row-reverse; justify-content: flex-end; align-items: baseline; gap: var(--s3); padding: var(--s6) var(--s5); }
  .facts-band dt { font-size: 0.9375rem; }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--s8); }
.section--sheet { background: var(--sheet); }
.section--tight { padding-block: var(--s7) var(--s8); }
.section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--s2) var(--s5); margin-bottom: var(--s6); }
.section__link { font-size: 0.9375rem; font-weight: 500; }
h2 { font-size: clamp(1.75rem, 1.2rem + 1.9vw, 2.5rem); color: var(--night); }

/* Page heads (catalogue, about, contact, errors) sit on the tinted band */
.page-head { padding-block: var(--s7) var(--s7); background: var(--cloth-wash); border-bottom: 1px solid var(--cloth-line); }
.page-head h1 { font-size: clamp(2.25rem, 1.4rem + 3.4vw, 3.5rem); line-height: 1.08; max-width: 20ch; color: var(--night); }
.page-head .lede { max-width: 56ch; }
.page-head__count { margin-top: var(--s3); color: var(--ink-2); font-size: 0.9375rem; font-variant-numeric: tabular-nums; }

/* ---------- Night band ---------- */
.band--night { background: var(--night); color: var(--on-night); }
.band--night h2, .band--night h3 { color: var(--on-night); }
.band--night :where(a, button):focus-visible { box-shadow: 0 0 0 2px var(--night), 0 0 0 4px var(--foil); }
.btn--foil { background: var(--foil); color: var(--night); }
@media (hover: hover) {
  .btn--foil:hover { background: var(--foil-deep); color: var(--night); }
}

.split { display: grid; gap: var(--s7); padding-block: var(--s9); }
.split__intro { display: grid; gap: var(--s4); justify-items: start; align-content: start; }
.split__intro p { color: var(--on-night-soft); font-size: 1.125rem; max-width: 34ch; }
.split__intro h2 { font-size: clamp(2.25rem, 1.4rem + 3vw, 3.5rem); line-height: 1.05; }
@media (min-width: 900px) {
  .split { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--s9); }
  .split__intro { position: sticky; top: var(--s9); align-self: start; }
}

/* ---------- Services (definition rows: the rule encodes "one service per row") ---------- */
.services { border-bottom: 1px solid var(--rule); }
.service { display: grid; gap: var(--s2); padding-block: var(--s5); border-top: 1px solid var(--rule); }
.service h3 { font-size: 1.3125rem; }
.service p { color: var(--ink-2); max-width: 62ch; }
@media (min-width: 760px) {
  .prose-grid .service { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); gap: var(--s6); }
}
.band--night .services, .band--night .service { border-color: var(--night-line); }
.band--night .service p { color: var(--on-night-soft); }
.prose-grid > h2 { margin-top: var(--s8); margin-bottom: var(--s5); font-size: clamp(1.5rem, 1.1rem + 1.2vw, 2rem); }
.prose-grid > h2:first-child { margin-top: 0; }
.plain-list { display: grid; gap: var(--s3); max-width: 62ch; padding-left: var(--s5); list-style: disc; color: var(--ink-2); }

.cta__inner { display: grid; gap: var(--s3); justify-items: start; padding-block: var(--s9); }
.cta h2 { max-width: 20ch; font-size: clamp(2rem, 1.3rem + 2.6vw, 3rem); line-height: 1.08; }
.cta p { color: var(--on-night-soft); font-size: 1.0625rem; max-width: 46ch; margin-bottom: var(--s3); }

/* ---------- Book grid ---------- */
.books { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s6) var(--s4); }
@media (min-width: 700px) { .books { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s7) var(--s5); } }
@media (min-width: 1000px) { .books { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.book-item a { display: block; color: inherit; text-decoration: none; border-radius: var(--r-s); }
.book-item h2, .book-item h3 {
  margin-top: var(--s4);
  font-size: 1.0625rem;
  line-height: 1.28;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-item__authors { margin-top: var(--s2); color: var(--ink-3); font-size: 0.875rem; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-item__date { margin-top: var(--s1); color: var(--ink-4); font-size: 0.8125rem; }
@media (hover: hover) {
  .book-item a:hover h2, .book-item a:hover h3 { color: var(--cloth); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
  .book-item a:hover .cover { box-shadow: 0 1px 2px rgba(18, 34, 45, 0.18), 0 14px 24px -8px rgba(18, 34, 45, 0.38); }
}
.empty { padding-block: var(--s6); color: var(--ink-2); display: grid; gap: var(--s2); max-width: 52ch; }

/* ---------- Search + pager ---------- */
.search { display: flex; flex-wrap: wrap; gap: var(--s3); margin-top: var(--s5); max-width: 640px; }
.search .input { flex: 1 1 240px; width: auto; background: var(--sheet); }
.pager { margin-top: var(--s8); }

/* ---------- Book page ---------- */
.book-detail { display: grid; gap: var(--s6); padding-block: var(--s6) var(--s9); }
.book-detail__cover { width: min(100%, 360px); }
.stage { padding: var(--s6) var(--s6) 0; background: var(--cloth-wash); border: 1px solid var(--cloth-line); border-radius: var(--r-l); }
.stage .cover { box-shadow: 0 1px 2px rgba(18, 34, 45, 0.18), 0 18px 28px -12px rgba(18, 34, 45, 0.45); margin-bottom: var(--s6); }
.crumbs { font-size: 0.875rem; margin-bottom: var(--s3); }
.book-detail h1 { font-size: clamp(1.875rem, 1.2rem + 2.6vw, 3rem); line-height: 1.1; color: var(--night); }
.byline { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin-top: var(--s4); font-family: var(--font-serif); font-size: 1.1875rem; color: var(--ink-2); }
.synopsis { margin-top: var(--s6); display: grid; gap: var(--s4); max-width: 64ch; font-size: 1.0625rem; line-height: 1.7; color: var(--ink-2); }
.facts { display: grid; gap: var(--s3); margin: var(--s6) 0 0; padding-top: var(--s5); border-top: 1px solid var(--rule); max-width: 64ch; font-size: 0.9375rem; }
.facts > div { display: grid; grid-template-columns: 7rem 1fr; gap: var(--s3); }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.book-detail__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s6); }
.btn__meta { font-weight: 400; opacity: 0.85; }
@media (min-width: 800px) {
  .book-detail { grid-template-columns: minmax(240px, 360px) minmax(0, 1fr); gap: var(--s8); align-items: start; padding-top: var(--s7); }
  .book-detail__cover { position: sticky; top: calc(var(--s9) - var(--s2)); }
}

/* ---------- Contact ---------- */
.contact-list { display: grid; border-top: 1px solid var(--rule); max-width: 720px; }
.contact-list li { border-bottom: 1px solid var(--rule); }
.contact-list a { display: grid; gap: var(--s1); padding-block: var(--s5); text-decoration: none; color: var(--ink); transition: padding-left 200ms var(--ease); }
.contact-list__label { color: var(--ink-3); font-size: 0.875rem; }
.contact-list__value { font-family: var(--font-serif); font-size: clamp(1.375rem, 1rem + 1.4vw, 1.875rem); overflow-wrap: anywhere; }
@media (hover: hover) {
  .contact-list a:hover { padding-left: var(--s2); }
  .contact-list a:hover .contact-list__value { color: var(--cloth); }
}

/* ---------- Footer: the deepest night ---------- */
.site-footer { background: var(--night-deep); color: var(--on-night-soft); }
.site-footer__grid { display: grid; gap: var(--s6); padding-block: var(--s8) var(--s6); }
.site-footer__logo { height: 48px; width: auto; }
.site-footer__note { margin-top: var(--s4); font-size: 0.9375rem; max-width: 34ch; }
.site-footer__cta { display: inline-block; margin-top: var(--s4); padding-block: var(--s1); color: var(--foil); font-weight: 600; font-size: 0.9375rem; text-decoration-thickness: 1px; }
.site-footer ul { display: grid; align-content: start; gap: var(--s1); }
.site-footer a { display: inline-block; padding-block: var(--s1); color: var(--on-night-soft); font-size: 0.9375rem; text-decoration: none; }
.site-footer address { display: grid; align-content: start; gap: var(--s1); font-style: normal; }
.site-footer :where(a):focus-visible { box-shadow: 0 0 0 2px var(--night-deep), 0 0 0 4px var(--foil); }
@media (hover: hover) {
  .site-footer a:hover { color: var(--on-night); text-decoration: underline; }
  .site-footer a.site-footer__cta:hover { color: var(--foil-deep); }
}
.site-footer__legal { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s5); padding-block: var(--s4) var(--s6); border-top: 1px solid var(--night-line); font-size: 0.8125rem; }
.site-footer a.site-footer__admin { font-size: 0.8125rem; text-decoration: underline; text-underline-offset: 0.2em; }
@media (min-width: 760px) { .site-footer__grid { grid-template-columns: 1.4fr 1fr 1fr; } }
