/* Kakapo Press - design tokens. The single source of styling truth.
   Rule (docs/DESIGN.md): no hex/rgb literals and no raw px for spacing or type
   outside this file. Feature CSS composes tokens only. */

:root {
  /* ---- Palette: paper, ink, cloth, gilt --------------------------------- */
  --paper:            #f6f1e4;   /* warm cream page */
  --paper-deep:       #ece4d2;   /* recessed panels, table stripes */
  --paper-edge:       #ded2ba;   /* hairlines on cream */
  --ink:              #241d16;   /* near-black brown body text */
  --ink-soft:         #5c5044;   /* secondary text, 6.9:1 on paper */
  --ink-faint:        #6f6353;   /* captions, meta - 5.2:1 on paper, 4.6:1 on panel */

  --leather:          #1c2620;   /* dark green-black boards: hero, footer */
  --leather-soft:     #2b3a31;   /* raised panel on leather */
  --leather-edge:     #3d5045;   /* hairlines on leather */

  /* Gilt comes in three weights because leaf behaves differently by ground:
     bright on dark boards, mid for rules and ornament on paper, and a deeper
     burnt gilt wherever it has to carry TEXT on cream and clear 4.5:1. */
  --gilt:             #b3893c;   /* rules, ornament, hairlines on paper */
  --gilt-bright:      #d9ae5f;   /* gilt on dark grounds - 7.6:1 on leather */
  --gilt-ink:         #7f5e22;   /* gilt as text/CTA on paper - 5.3:1, white on it 5.7:1 */
  --sage:             #8fb89a;   /* the holding page's green, kept for accents */
  --wine:             #7a2f33;   /* period binding red */
  --navy:             #2b3c56;   /* period binding blue */
  --ochre:            #8a6a2f;   /* period binding tan */

  /* Semantic roles ------------------------------------------------------- */
  --bg:               var(--paper);
  --bg-panel:         var(--paper-deep);
  --bg-invert:        var(--leather);
  --text:             var(--ink);
  --text-muted:       var(--ink-soft);
  --text-faint:       var(--ink-faint);
  --text-invert:      #e9e6da;
  --text-invert-muted:#b3bcae;
  --accent:           var(--gilt-ink);   /* anything that carries text or takes text on top */
  --accent-rule:      var(--gilt);       /* borders and ornament, where contrast rules do not apply */
  --accent-on-dark:   var(--gilt-bright);
  --accent-contrast:  #fffaf0;
  --border:           var(--paper-edge);
  --border-invert:    var(--leather-edge);
  --danger:           #8c2f26;
  --success:          #3f6b46;

  /* ---- Type ------------------------------------------------------------ */
  /* Self-hosted woff2 lands before launch; the stack degrades to the same
     old-style figures and generous x-height on every target platform. */
  --font-display: "Kakapo Display", "Iowan Old Style", "Palatino Linotype",
                  Palatino, "Book Antiqua", Georgia, serif;
  --font-body:    "Kakapo Text", "Iowan Old Style", Charter, Georgia,
                  "Times New Roman", serif;
  --font-mono:    ui-monospace, "SF Mono", Menlo, monospace;

  --fs-xs:   0.75rem;
  --fs-sm:   0.8125rem;
  --fs-base: 1rem;
  --fs-md:   1.0625rem;
  --fs-lg:   1.25rem;
  --fs-xl:   1.5rem;
  --fs-2xl:  2rem;
  --fs-3xl:  2.75rem;
  --fs-4xl:  3.5rem;

  --lh-tight:  1.15;
  --lh-normal: 1.45;
  --lh-loose:  1.7;

  --ls-caps:  0.18em;   /* smallcaps nav and eyebrows */
  --ls-wide:  0.08em;
  --ls-tight: -0.01em;

  /* ---- Space (4px base) ------------------------------------------------ */
  --sp-1:  0.25rem;
  --sp-2:  0.5rem;
  --sp-3:  0.75rem;
  --sp-4:  1rem;
  --sp-5:  1.5rem;
  --sp-6:  2rem;
  --sp-7:  2.5rem;
  --sp-8:  3rem;
  --sp-9:  4rem;
  --sp-10: 5rem;
  --sp-11: 6rem;
  --sp-12: 8rem;

  /* ---- Line, radius, shadow -------------------------------------------- */
  --radius-sm: 2px;      /* sharp corners are part of the look */
  --radius-md: 3px;
  --hairline: 1px;
  --rule-gilt: 2px;
  --shadow-card:  0 1px 2px rgba(36, 29, 22, 0.08), 0 8px 24px rgba(36, 29, 22, 0.07);
  --shadow-plate: 2px 3px 0 rgba(36, 29, 22, 0.13);
  --shadow-lift:  0 4px 10px rgba(36, 29, 22, 0.14), 0 18px 40px rgba(36, 29, 22, 0.12);

  /* ---- Motion ---------------------------------------------------------- */
  --dur-fast: 120ms;
  --dur-base: 220ms;
  --ease: cubic-bezier(0.2, 0.6, 0.3, 1);

  /* ---- Layout ---------------------------------------------------------- */
  --measure:      68ch;    /* reading width for prose */
  --page-max:     1220px;
  --page-gutter:  var(--sp-5);

  /* ---- Z layers -------------------------------------------------------- */
  --z-base:    0;
  --z-nav:     100;
  --z-overlay: 200;
  --z-modal:   300;
  --z-toast:   400;
}

/* Kakapo Press - element defaults and layout primitives. Tokens only. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  /* Full-height flex column so a short page (empty basket, 404) still pushes
     the footer to the bottom of the viewport instead of leaving a gap below it. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: var(--lh-normal);
  font-variant-numeric: oldstyle-num;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
#main { flex: 1 0 auto; }   /* the content grows; the footer follows it down */

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-tight);
  margin: 0 0 var(--sp-3);
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--sp-4); }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }

img { max-width: 100%; display: block; }

ul, ol { margin: 0 0 var(--sp-4); padding-left: var(--sp-5); }

/* Layout ---------------------------------------------------------------- */

.bk-page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding-inline: var(--page-gutter);
}

.bk-section { padding-block: var(--sp-9); }
.bk-section--tight { padding-block: var(--sp-7); }

.bk-invert {
  background: var(--bg-invert);
  color: var(--text-invert);
}
.bk-invert a:hover { color: var(--accent-on-dark); }

.bk-prose { max-width: var(--measure); }
.bk-prose p { color: var(--text-muted); }

/* Section heading with the ornament rule -------------------------------- */

.bk-head {
  display: flex;
  align-items: baseline;
  gap: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.bk-head h1, .bk-head h2 { margin: 0; white-space: nowrap; }
.bk-head h1 { font-size: var(--fs-2xl); }   /* a page title in the section-head style */
.bk-head::after {
  content: "";
  flex: 1;
  height: var(--hairline);
  background: var(--border);
}
.bk-invert .bk-head::after { background: var(--border-invert); }
.bk-head .bk-head-link {
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-faint);
  white-space: nowrap;
}
.bk-head .bk-head-link:hover { color: var(--accent); }
/* Narrow screens: a long heading plus its nowrap link ("All 3,013 books")
   pushed the page wider than a 390px phone. Let the heading wrap instead. */
@media (max-width: 560px) {
  .bk-head h1, .bk-head h2 { white-space: normal; min-width: 0; }
  .bk-head::after { display: none; }
  .bk-head .bk-head-link { margin-left: auto; }
}

.bk-eyebrow {
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--sp-3);
}
.bk-invert .bk-eyebrow { color: var(--accent-on-dark); }

.bk-grid { display: grid; gap: var(--sp-5); }
.bk-grid--4 { grid-template-columns: repeat(4, 1fr); }
.bk-grid--3 { grid-template-columns: repeat(3, 1fr); }
.bk-grid--2 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 900px) {
  .bk-grid--4 { grid-template-columns: repeat(2, 1fr); }
  .bk-grid--3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .bk-grid--4, .bk-grid--3, .bk-grid--2 { grid-template-columns: 1fr; }
  :root { --fs-3xl: 2.1rem; --fs-4xl: 2.4rem; --page-gutter: var(--sp-4); }
}

/* Kakapo Press - component library. One block per component, class-prefixed.
   Tokens only: no literal colours, no raw px for type or space. */

/* ======================================================================
   Header: one row - mark + wordmark, nav, search, basket
   ====================================================================== */

.bk-header {
  border-bottom: var(--hairline) solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
}
.bk-header-inner {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding-block: var(--sp-4);
}

.bk-wordmark {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex: none;
  white-space: nowrap;
}
/* The mark is a file (static/img/logo.*): sized by height, width follows it. */
.bk-wordmark-mark {
  height: 2.75rem;
  width: auto;
  flex: none;
  object-fit: contain;
}
.bk-wordmark-name {
  display: block;
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  line-height: 1;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
}

.bk-nav {
  display: flex;
  gap: var(--sp-4);
  align-items: center;
  flex: none;
  margin-left: auto;
}
.bk-nav a, .bk-menu-panel a {
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-muted);
  padding-block: var(--sp-2);
  border-bottom: var(--rule-gilt) solid transparent;
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.bk-nav a:hover, .bk-nav a[aria-current="page"] {
  color: var(--text);
  border-bottom-color: var(--accent-rule);
}

.bk-header-tools {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  flex: 0 1 auto;
  min-width: 0;
}

/* The menu button: the same links behind a <details>, so it opens with JS off. */
.bk-menu { position: relative; display: none; }
.bk-menu > summary {
  list-style: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 2.5rem; height: 2.5rem;
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.bk-menu > summary::-webkit-details-marker { display: none; }
.bk-menu > summary:hover, .bk-menu[open] > summary { color: var(--accent); border-color: var(--accent-rule); }
.bk-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + var(--sp-2));
  min-width: 13rem;
  display: flex;
  flex-direction: column;
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg);
  border: var(--hairline) solid var(--border);
  box-shadow: var(--shadow-lift);
  z-index: var(--z-overlay);
}
.bk-menu-panel a { padding-block: var(--sp-3); border-bottom: var(--hairline) solid var(--border); }
.bk-menu-panel a:last-child { border-bottom: 0; }
.bk-menu-panel a:hover, .bk-menu-panel a[aria-current="page"] { color: var(--accent); }

/* Below this width the seven nav links no longer fit on the row with the
   wordmark, search and basket: they move behind the menu button. */
@media (max-width: 1120px) {
  .bk-nav { display: none; }
  .bk-menu { display: block; }
  .bk-header-tools { margin-left: auto; }
}
@media (max-width: 560px) {
  .bk-header-inner { gap: var(--sp-3); padding-block: var(--sp-3); }
  .bk-header-tools { gap: var(--sp-2); }
  .bk-wordmark { gap: var(--sp-2); }
  .bk-wordmark-mark { height: 2.25rem; }
  .bk-wordmark-name { font-size: var(--fs-base); letter-spacing: 0.06em; }
  .bk-basket span { display: none; }
}

/* Visually hidden, still read aloud. */
.bk-vh {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ======================================================================
   Buttons, search, badges
   ====================================================================== */

.bk-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-sm);
  border: var(--hairline) solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.bk-btn--primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}
.bk-btn--primary:hover { background: var(--ink); border-color: var(--ink); color: var(--accent-contrast); }
.bk-btn--outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.bk-btn--outline:hover { border-color: var(--accent); color: var(--accent); }
.bk-invert .bk-btn--outline { color: var(--text-invert); border-color: var(--border-invert); }
.bk-invert .bk-btn--outline:hover { border-color: var(--accent-on-dark); color: var(--accent-on-dark); }
.bk-btn--block { width: 100%; }

/* Header search. Collapsed it is a compact box; open (focus, or .is-open from
   site.js) it widens to the LEFT over the nav - it is anchored to the right
   edge of its slot and absolutely positioned, so nothing else in the row moves.
   site.js sets --bk-search-open to the room between the wordmark and the slot;
   the fallback is a sensible fixed width for when JS is off. */
.bk-search-slot {
  position: relative;
  width: 10rem;
  flex: 0 1 auto;
  min-width: 2.5rem;
  height: 2.5rem;
  container-type: inline-size;
}
.bk-search {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  background: var(--bg);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-sm);
  padding-inline: var(--sp-3);
  z-index: 1;
  transition: width var(--dur-base) var(--ease), border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-base) var(--ease);
}
.bk-search:hover { border-color: var(--accent-rule); }
.bk-search:focus-within, .bk-search.is-open {
  width: var(--bk-search-open, 22rem);
  border-color: var(--accent-rule);
  box-shadow: var(--shadow-card);
  z-index: var(--z-overlay);
}
.bk-search-icon { display: grid; place-items: center; color: var(--text-faint); cursor: text; flex: none; }
.bk-search input {
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--text);
  width: 100%;
  min-width: 0;
  padding: 0;
  -webkit-appearance: none;
  appearance: none;
}
.bk-search input::placeholder { color: var(--text-faint); }
.bk-search:not(:focus-within):not(.is-open) input::placeholder { color: transparent; }
.bk-search:not(:focus-within):not(.is-open)::after {
  content: "Search";
  position: absolute;
  left: calc(var(--sp-3) + 16px + var(--sp-2));
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-faint);
  pointer-events: none;
}
.bk-search.has-value:not(:focus-within):not(.is-open)::after { content: none; }
.bk-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.bk-search input:focus-visible { outline: 0; }

/* Live suggestions, under the opened search. */
.bk-suggest {
  position: absolute;
  top: calc(100% + var(--sp-1));
  left: -1px;
  right: -1px;
  margin: 0;
  padding: var(--sp-1) 0;
  list-style: none;
  background: var(--bg);
  border: var(--hairline) solid var(--border);
  box-shadow: var(--shadow-lift);
  max-height: min(32rem, calc(100vh - 6rem));
  overflow-y: auto;
}
.bk-suggest[hidden] { display: none; }
.bk-suggest-item > a {
  display: grid;
  grid-template-columns: 2.25rem 1fr auto;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  color: var(--text);
}
.bk-suggest-thumb {
  width: 2.25rem;
  aspect-ratio: 2 / 3;
  background: var(--plate-cloth, var(--leather));
  box-shadow: var(--shadow-plate);
  overflow: hidden;
}
.bk-suggest-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bk-suggest-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bk-suggest-title {
  font-family: var(--font-display);
  font-size: var(--fs-base);
  line-height: var(--lh-tight);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bk-suggest-meta {
  font-size: var(--fs-sm);
  color: var(--text-faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bk-suggest-price { font-family: var(--font-display); font-size: var(--fs-base); white-space: nowrap; }
.bk-suggest-all > a {
  display: block;
  padding: var(--sp-3);
  margin-top: var(--sp-1);
  border-top: var(--hairline) solid var(--border);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-wide);
  color: var(--accent);
}
.bk-suggest-empty { padding: var(--sp-3); font-size: var(--fs-sm); color: var(--text-muted); }
.bk-suggest [aria-selected="true"] > a { background: var(--bg-panel); }
.bk-suggest [aria-selected="true"] .bk-suggest-title,
.bk-suggest-item > a:hover .bk-suggest-title { color: var(--accent); }

/* Squeezed to an icon: drop the "Search" label rather than clip it. */
@container (max-width: 7rem) {
  .bk-search:not(:focus-within):not(.is-open)::after { content: none; }
}
@media (max-width: 560px) {
  .bk-search-slot { width: 2.5rem; }
  .bk-suggest-item > a { grid-template-columns: 2rem 1fr auto; }
  .bk-suggest-thumb { width: 2rem; }
}

.bk-badge {
  display: inline-block;
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  padding: var(--sp-1) var(--sp-2);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: var(--bg-panel);
}
.bk-badge--gilt { border-color: var(--accent-rule); color: var(--accent); background: transparent; }

/* ======================================================================
   Book plate: the cover stand-in
   His listings carry no photographs, so a book is represented by a bound
   board with a gilt-ruled paper label. Deliberate, not a placeholder.
   Cloth colour comes from a period-binding set, chosen per book at render.
   ====================================================================== */

.bk-plate {
  position: relative;
  aspect-ratio: 2 / 3;
  background:
    repeating-linear-gradient(90deg,
      rgba(255,255,255,0.035) 0 1px, rgba(0,0,0,0.03) 1px 2px),
    repeating-linear-gradient(0deg,
      rgba(255,255,255,0.03) 0 1px, rgba(0,0,0,0.025) 1px 2px),
    var(--plate-cloth, var(--leather));
  box-shadow: var(--shadow-plate);
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: var(--sp-6) var(--sp-4) var(--sp-8);
  overflow: hidden;
  container-type: inline-size;   /* the label scales with the board, not the page */
  transition: transform var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
/* the spine edge */
.bk-plate::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--sp-3);
  background: linear-gradient(90deg, rgba(0,0,0,0.34), rgba(0,0,0,0.06));
}
/* the gilt double rule */
.bk-plate::after {
  content: "";
  position: absolute;
  inset: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-5);
  border: var(--hairline) solid var(--gilt-bright);
  outline: var(--hairline) solid var(--gilt-bright);
  outline-offset: 3px;
  opacity: 0.55;
  pointer-events: none;
}

.bk-plate-label {
  position: relative;
  text-align: center;
  color: var(--gilt-bright);
  padding-inline: var(--sp-3);
  margin-left: var(--sp-2);
}
.bk-plate-author {
  display: block;
  font-size: clamp(0.5rem, 5cqi, var(--fs-xs));
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  opacity: 0.85;
  margin-bottom: var(--sp-3);
}
.bk-plate-title {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(0.75rem, 11cqi, var(--fs-lg));
  line-height: var(--lh-tight);
  text-wrap: balance;
}
.bk-plate-foot {
  position: absolute;
  left: var(--sp-6);
  right: var(--sp-4);
  bottom: var(--sp-4);
  text-align: center;
  font-size: clamp(0.5rem, 4.5cqi, var(--fs-xs));
  letter-spacing: var(--ls-wide);
  color: var(--gilt-bright);
  opacity: 0.7;
}
/* In the cart line the plate is a ~72px thumbnail, too small to set the
   typographic label without the title, author and year overlapping. There it
   shows just the bound board and gilt rule; the title is printed beside it. */
.bk-line-plate .bk-plate-label,
.bk-line-plate .bk-plate-foot { display: none; }

/* period binding cloths */
.bk-plate--leather { --plate-cloth: var(--leather); }
.bk-plate--wine    { --plate-cloth: var(--wine); }
.bk-plate--navy    { --plate-cloth: var(--navy); }
.bk-plate--ochre   { --plate-cloth: var(--ochre); }
.bk-plate--sage    { --plate-cloth: #4a6b55; }
.bk-plate--slate   { --plate-cloth: #3f4750; }

/* when a real photograph exists it simply replaces the label */
.bk-plate--photo { padding: 0; background: var(--bg-panel); }
.bk-plate--photo img { width: 100%; height: 100%; object-fit: cover; }
.bk-plate--photo::after { display: none; }
.bk-plate--photo img { display: block; }

/* Further photographs of a photographed copy, under the cover on the book page. */
/* One row, never wrapping: it scrolls sideways (snapping to a thumbnail), with
   arrow buttons at the ends when it overflows (see .bk-stepper). */
.bk-gallery {
  display: flex;
  flex-wrap: nowrap;
  gap: var(--sp-2);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: var(--sp-1);
  scroll-behavior: smooth;
  scrollbar-width: none;
  padding: var(--sp-1);           /* room for the active thumbnail's outline */
  min-width: 0;
  flex: 1 1 auto;
}
.bk-gallery::-webkit-scrollbar { display: none; }
.bk-gallery a {
  display: block;
  flex: none;
  width: 3.25rem;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--bg-panel);
  box-shadow: var(--shadow-plate);
  scroll-snap-align: start;
}
.bk-gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ======================================================================
   Book card
   ====================================================================== */

/* cards in a grid run to equal height so the price rules line up across a row */
.bk-card { display: flex; flex-direction: column; height: 100%; }

/* Hovering a book lifts it off the shelf: it rises, tilts a touch toward you,
   the gilt frame catches the light, and a soft shadow floats beneath.
   Pure CSS, no script. */
.bk-card:hover .bk-plate {
  transform: perspective(900px) translateY(-8px) rotateX(4.5deg) scale(1.018);
  box-shadow: 0 20px 38px -16px rgba(20, 28, 22, 0.5), var(--shadow-plate);
}
.bk-card:hover .bk-plate::after { opacity: 0.92; }   /* the gilt double rule brightens */
.bk-card:hover .bk-card-title { color: var(--accent); }

/* Books settle onto the shelf as they scroll into view. Uses scroll-driven CSS
   (animation-timeline: view()) so there is still zero JavaScript; browsers
   without it simply show the books, and reduced-motion users get no movement. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .bk-card {
      animation: bk-shelf-rise linear both;
      animation-timeline: view();
      animation-range: entry 8% entry 55%;
    }
    @keyframes bk-shelf-rise {
      from { opacity: 0; transform: translateY(1.75rem); }
      to   { opacity: 1; transform: translateY(0); }
    }
  }
}

.bk-card-body { padding-top: var(--sp-4); display: flex; flex-direction: column; flex: 1; }
.bk-card-author {
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: var(--sp-2);
}
.bk-card-title {
  font-family: var(--font-display);
  font-size: var(--fs-base);
  line-height: var(--lh-tight);
  margin-bottom: var(--sp-2);
  transition: color var(--dur-fast) var(--ease);
}
.bk-card-meta {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-bottom: var(--sp-3);
  flex: 1;
}
.bk-card-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-top: auto;
  border-top: var(--hairline) solid var(--border);
  padding-top: var(--sp-3);
}
.bk-price {
  font-family: var(--font-display);
  font-size: var(--fs-lg);
  font-variant-numeric: lining-nums;
}
.bk-price--lg { font-size: var(--fs-2xl); }

/* ======================================================================
   Hero
   ====================================================================== */

.bk-hero { padding-block: var(--sp-10) var(--sp-9); }
.bk-hero-inner {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: var(--sp-9);
  align-items: center;
}
.bk-hero h1 {
  font-size: var(--fs-4xl);
  color: var(--text-invert);
  margin-bottom: var(--sp-5);
  text-wrap: balance;
}
.bk-hero-lede {
  font-size: var(--fs-lg);
  color: var(--text-invert-muted);
  line-height: var(--lh-loose);
  max-width: 46ch;
}
.bk-hero-actions { display: flex; gap: var(--sp-4); flex-wrap: wrap; margin-top: var(--sp-6); }

.bk-hero-feature {
  background: var(--leather-soft);
  border: var(--hairline) solid var(--border-invert);
  padding: var(--sp-6);
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: var(--sp-5);
  align-items: start;
}
.bk-hero-feature h3 { color: var(--text-invert); font-size: var(--fs-lg); }
.bk-hero-feature p {
  color: var(--text-invert-muted);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
}
@media (max-width: 980px) {
  .bk-hero-inner { grid-template-columns: 1fr; gap: var(--sp-7); }
}

/* ======================================================================
   Trust strip
   ====================================================================== */

.bk-trust {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
  border-block: var(--hairline) solid var(--border);
  padding-block: var(--sp-5);
}
.bk-trust-item { display: flex; gap: var(--sp-3); align-items: flex-start; }
.bk-trust-item svg { color: var(--accent); flex: none; margin-top: var(--sp-1); }
.bk-trust-title {
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  margin-bottom: var(--sp-1);
}
.bk-trust-note { font-size: var(--fs-sm); color: var(--text-faint); line-height: var(--lh-normal); }
@media (max-width: 900px) { .bk-trust { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .bk-trust { grid-template-columns: 1fr; } }

/* ======================================================================
   Case card: the attribution work, published
   ====================================================================== */

.bk-case {
  border: var(--hairline) solid var(--border);
  background: var(--bg);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.bk-case:hover { border-color: var(--accent-rule); box-shadow: var(--shadow-card); }
/* on a leather ground the card keeps its shape but changes its cloth */
.bk-invert .bk-case {
  background: var(--leather-soft);
  border-color: var(--border-invert);
}
.bk-invert .bk-case:hover { border-color: var(--accent-on-dark); box-shadow: none; }
.bk-invert .bk-case h3 { color: var(--text-invert); }
.bk-invert .bk-case p { color: var(--text-invert-muted); }
.bk-invert .bk-case-foot { color: var(--accent-on-dark); }

.bk-case-status {
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--success);
}
.bk-case-status--open { color: var(--wine); }
.bk-invert .bk-case-status { color: var(--sage); }
.bk-invert .bk-case-status--open { color: var(--accent-on-dark); }
.bk-case h3 { margin: 0; }
.bk-case p { color: var(--text-muted); font-size: var(--fs-sm); margin: 0; }
.bk-case-foot {
  margin-top: auto;
  padding-top: var(--sp-4);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-wide);
  color: var(--accent);
}

/* ======================================================================
   Collection tile
   ====================================================================== */

.bk-tile {
  position: relative;
  border: var(--hairline) solid var(--border);
  background: var(--bg-panel);
  padding: var(--sp-6);
  min-height: 9rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  transition: background var(--dur-base) var(--ease), border-color var(--dur-base) var(--ease);
}
.bk-tile:hover { border-color: var(--accent-rule); background: var(--bg); }
.bk-tile h3 { font-size: var(--fs-lg); margin-bottom: var(--sp-1); }
.bk-tile span { font-size: var(--fs-sm); color: var(--text-faint); }

/* ======================================================================
   Video card
   ====================================================================== */

.bk-video { display: block; }
.bk-video-frame {
  aspect-ratio: 16 / 9;
  background: var(--leather-soft);
  border: var(--hairline) solid var(--border-invert);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.bk-video-frame img { width: 100%; height: 100%; object-fit: cover; }
.bk-video-play {
  position: absolute;
  width: 3.25rem; height: 3.25rem;
  border-radius: 50%;
  background: rgba(28, 38, 32, 0.78);
  border: var(--hairline) solid var(--gilt-bright);
  display: grid;
  place-items: center;
  color: var(--gilt-bright);
}
.bk-video h3 { font-size: var(--fs-base); margin: var(--sp-4) 0 var(--sp-1); }
.bk-video span { font-size: var(--fs-sm); color: var(--text-faint); }

/* ======================================================================
   Biblio table (book detail)
   ====================================================================== */

.bk-biblio { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.bk-biblio th, .bk-biblio td {
  text-align: left;
  padding: var(--sp-3) var(--sp-3);
  border-bottom: var(--hairline) solid var(--border);
  vertical-align: top;
}
.bk-biblio th {
  width: 12rem;
  font-weight: 400;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  font-size: var(--fs-xs);
  color: var(--text-faint);
}

/* ======================================================================
   Footer
   ====================================================================== */

.bk-footer { padding-block: var(--sp-9) var(--sp-7); }
.bk-footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--sp-7);
}
.bk-footer h2 {
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--accent-on-dark);
  margin-bottom: var(--sp-4);
}
.bk-footer ul { list-style: none; margin: 0; padding: 0; }
.bk-footer li { margin-bottom: var(--sp-3); }
.bk-footer a, .bk-footer p { color: var(--text-invert-muted); font-size: var(--fs-sm); }
.bk-footer-legal {
  margin-top: var(--sp-8);
  padding-top: var(--sp-5);
  border-top: var(--hairline) solid var(--border-invert);
  display: flex;
  justify-content: space-between;
  gap: var(--sp-5);
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--text-invert-muted);
}
@media (max-width: 900px) { .bk-footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .bk-footer-grid { grid-template-columns: 1fr; } }

/* Storefront-only additions: listings, forms, detail layout, pagination.
   Tokens only, same rules as components.css. */

.bk-skip {
  position: absolute;
  left: -9999px;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: var(--sp-3) var(--sp-4);
  z-index: var(--z-toast);
}
.bk-skip:focus { left: var(--sp-4); top: var(--sp-2); }

:where(a, button, input, select, textarea):focus-visible {
  outline: var(--rule-gilt) solid var(--accent);
  outline-offset: 2px;
}

.bk-panel { background: var(--bg-panel); }
.bk-lede { font-size: var(--fs-lg); color: var(--text-muted); }
.bk-lede-invert { color: var(--text-invert-muted); line-height: var(--lh-loose); }
.bk-price--gilt { color: var(--accent-on-dark); }

/* Listing bar ----------------------------------------------------------- */

.bk-listing-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  flex-wrap: wrap;
  border-bottom: var(--hairline) solid var(--border);
  padding-bottom: var(--sp-4);
  margin-bottom: var(--sp-6);
}
.bk-listing-count {
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-wide);
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}
.bk-sortbar { margin: 0; display: flex; gap: var(--sp-3); align-items: center; }

.bk-empty {
  border: var(--hairline) solid var(--border);
  background: var(--bg-panel);
  padding: var(--sp-6);
  color: var(--text-muted);
  max-width: var(--measure);
}

/* Pagination ------------------------------------------------------------ */

.bk-pagination {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--sp-8);
  font-variant-numeric: tabular-nums;
}
.bk-page-link {
  display: inline-block;
  min-width: 2.4rem;
  text-align: center;
  padding: var(--sp-2) var(--sp-3);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}
.bk-page-link:hover { border-color: var(--accent); color: var(--accent); }
.bk-page-link--current {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.bk-page-gap { color: var(--text-faint); padding-inline: var(--sp-1); }

/* Breadcrumbs ----------------------------------------------------------- */

.bk-crumbs {
  font-size: var(--fs-sm);
  color: var(--text-faint);
  padding-block: var(--sp-5) 0;
}
.bk-crumbs a:hover { color: var(--accent); }

/* Book detail ----------------------------------------------------------- */

.bk-detail {
  display: grid;
  grid-template-columns: 22rem minmax(0, 1fr);
  gap: var(--sp-9);
  align-items: start;
}
/* The header's height, kept current by site.js; the fallback matches the
   desktop header so the sticky columns sit right with JS off too. */
:root { --bk-header-h: 4.8rem; }

/* The buying column stays pinned at the top, and always fits the window: the
   main photo/plate is capped at the height left over once caption, price and
   buttons are counted (site.js measures that into --bk-buy-img-max; the
   fallback here is a fair estimate). Width follows the 2:3 box. */
.bk-detail-buy {
  position: sticky;
  top: calc(var(--bk-header-h) + var(--sp-5));
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  --bk-buy-img-max: calc(100vh - var(--bk-header-h) - 23rem);
}
.bk-detail-buy .bk-plate {
  width: min(100%, max(8rem, calc(var(--bk-buy-img-max) * 2 / 3)));
  margin-inline: auto;
}
.bk-detail-buy .bk-plate--photo img { object-fit: contain; }
.bk-detail-buy .bk-trust-note { margin: 0; }
.bk-detail-buy .bk-price--lg { line-height: 1.1; }
.bk-detail-actions { display: flex; flex-direction: column; gap: var(--sp-3); }
.bk-detail-actions-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.bk-detail-actions-row .bk-btn { padding-inline: var(--sp-3); }

/* Thumbnail stepper under the main photo. */
.bk-stepper { display: flex; align-items: center; gap: var(--sp-1); margin-top: var(--sp-2); }
.bk-stepper-btn {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  background: var(--bg);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
}
.bk-stepper-btn:hover:not(:disabled) { color: var(--accent); border-color: var(--accent-rule); }
.bk-stepper-btn:disabled { opacity: 0.35; cursor: default; }
.bk-stepper-btn[hidden] { display: none; }

/* The scan offer sits in the reading column, after the enquiry. */
.bk-detail-body .bk-scan { margin-top: var(--sp-6); }
.bk-detail-body .bk-scan .bk-btn--block { width: auto; }
.bk-detail-imprint {
  font-size: var(--fs-lg);
  color: var(--text-muted);
  margin: 0;
}
.bk-detail-imprint > span { display: block; }

/* The right column's head (eyebrow, title, author, imprint) sticks under the
   site header while the description and bibliographic detail scroll beneath
   it. The sticky range ends with .bk-detail-body, so the related-books shelf
   below scrolls normally. site.js adds .is-stuck (via a sentinel just above the
   head) to tighten it while pinned. */
.bk-detail-body { position: relative; }
.bk-detail-sentinel { display: block; height: 0; }
.bk-detail-head {
  position: sticky;
  top: var(--bk-header-h);
  z-index: 2;
  background: var(--bg);
  padding-block: var(--sp-5) var(--sp-5);
  margin-top: calc(-1 * var(--sp-5));
  margin-bottom: var(--sp-4);
  border-bottom: var(--hairline) solid transparent;
  /* Only paint properties animate: size changes snap, so the text below never
     slides (site.js pads the difference back as margin). */
  transition: border-color var(--dur-base) var(--ease), box-shadow var(--dur-base) var(--ease);
}
.bk-detail-head.is-stuck {
  padding-block: var(--sp-3);
  border-bottom-color: var(--border);
  box-shadow: 0 10px 12px -12px rgba(36, 29, 22, 0.18);
}
.bk-detail-head.is-stuck .bk-eyebrow { margin-bottom: var(--sp-1); }
.bk-detail-head.is-stuck h1 { font-size: var(--fs-xl); margin-bottom: var(--sp-1); }
.bk-detail-head.is-stuck .bk-detail-imprint { font-size: var(--fs-sm); }
.bk-detail-head.is-stuck .bk-detail-imprint > span { display: inline; }
.bk-detail-head.is-stuck .bk-detail-imprint > span + span::before { content: " · "; }

/* "Reserve, offer, or ask": a disclosure the width of the description. A real
   <details>, so it opens with JS off; site.js animates the height. */
.bk-disclosure {
  max-width: none;   /* the full reading column, as wide as the bibliographic table */
  margin-top: var(--sp-8);
  border: var(--hairline) solid var(--border);
  background: var(--bg-panel);
  scroll-margin-top: calc(var(--bk-header-h) + var(--sp-5));
}
.bk-disclosure-summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  padding: var(--sp-4) var(--sp-5);
}
.bk-disclosure-summary::-webkit-details-marker { display: none; }
.bk-disclosure-title { font-size: var(--fs-lg); margin: 0; }
.bk-disclosure-summary:hover .bk-disclosure-title { color: var(--accent); }
.bk-disclosure-chevron {
  flex: none;
  color: var(--accent);
  transition: transform var(--dur-base) var(--ease);
}
.bk-disclosure[open] > .bk-disclosure-summary .bk-disclosure-chevron { transform: rotate(180deg); }
.bk-disclosure.is-closing > .bk-disclosure-summary .bk-disclosure-chevron { transform: none; }
.bk-disclosure-body { overflow: hidden; }
.bk-disclosure-body .bk-form {
  max-width: none;
  border: 0;
  border-top: var(--hairline) solid var(--border);
  padding: var(--sp-5);
}
.bk-scan {
  border: var(--hairline) solid var(--border);
  background: var(--bg-panel);
  padding: var(--sp-5);
}
.bk-scan h3 { font-size: var(--fs-base); margin-bottom: var(--sp-2); }
.bk-scan p { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-3); }
.bk-note {
  border-left: var(--rule-gilt) solid var(--accent-rule);
  padding: var(--sp-3) var(--sp-5);
  margin: var(--sp-6) 0;
  background: var(--bg-panel);
}
.bk-note p { margin: 0; font-size: var(--fs-sm); color: var(--text-muted); }
.bk-enquire { margin-top: var(--sp-9); }
.bk-detail-main > .bk-head { margin-top: var(--sp-9); }

@media (max-width: 900px) {
  .bk-detail { grid-template-columns: minmax(0, 1fr); }
  .bk-detail-buy { position: static; }
  .bk-detail-buy .bk-plate { width: 100%; }
  .bk-detail-head { position: static; padding-block: 0; margin-top: 0; }
}

/* The search results page's own field (the header one is compact). */
.bk-search-page {
  display: flex;
  gap: var(--sp-3);
  max-width: 40rem;
  margin-bottom: var(--sp-5);
}
.bk-search-page input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-body);
  font-size: var(--fs-md);
  color: var(--text);
  background: var(--bg);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-3) var(--sp-4);
}
.bk-search-page input:focus { border-color: var(--accent-rule); outline: 0; }

/* Author index ---------------------------------------------------------- */

.bk-author-list {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 3;
  column-gap: var(--sp-7);
}
.bk-author-list li {
  break-inside: avoid;
  padding-block: var(--sp-2);
  border-bottom: var(--hairline) solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
}
.bk-author-list span { color: var(--text-faint); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .bk-author-list { columns: 2; } }
@media (max-width: 560px) { .bk-author-list { columns: 1; } }

.bk-tile--sm { min-height: 0; padding: var(--sp-4) var(--sp-5); }
.bk-tile--sm h3 { font-size: var(--fs-base); }

/* Forms ----------------------------------------------------------------- */

.bk-form {
  border: var(--hairline) solid var(--border);
  background: var(--bg-panel);
  padding: var(--sp-6);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  max-width: 34rem;
}
.bk-form h3 { margin: 0; }
.bk-form-note { font-size: var(--fs-sm); color: var(--text-muted); margin: 0; }
.bk-form-hp { position: absolute; left: -9999px; }
.bk-field { display: flex; flex-direction: column; gap: var(--sp-2); }
.bk-field > span {
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-faint);
}
.bk-field--inline { flex-direction: row; align-items: center; gap: var(--sp-3); }
.bk-field input,
.bk-field textarea,
.bk-field select {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--bg);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--sp-3);
}
.bk-field textarea { resize: vertical; }
.bk-form .bk-btn { align-self: flex-start; }

/* Book enquiry: "Make an offer" / "Ask a question" tabs. The tabs are the
   form's kind radios. Offer-only parts (.bk-for-offer) hide in question mode
   and vice versa: site.js sets .is-offer/.is-question; :has() does the same
   without JS. A browser with neither shows both sets, which still submits. */
.bk-mode {
  display: flex;
  gap: var(--sp-5);
  margin: 0;
  padding: 0;
  border: 0;
  border-bottom: var(--hairline) solid var(--border);
}
.bk-mode-legend {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.bk-mode-tab { position: relative; cursor: pointer; }
.bk-mode-tab input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.bk-mode-tab span {
  display: block;
  padding: var(--sp-2) 0;
  margin-bottom: calc(-1 * var(--hairline));
  border-bottom: var(--rule-gilt) solid transparent;
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}
.bk-mode-tab:hover span { color: var(--accent); }
.bk-mode-tab input:checked + span { color: var(--text); border-bottom-color: var(--accent-rule); }
.bk-mode-tab input:focus-visible + span { outline: var(--rule-gilt) solid var(--accent); outline-offset: 2px; }

.bk-enquiry:not(:has(input[name="kind"][value="offer"]:checked)) .bk-for-offer { display: none; }
.bk-enquiry:has(input[name="kind"][value="offer"]:checked) .bk-for-question { display: none; }
.bk-enquiry.is-question .bk-for-offer,
.bk-enquiry.is-offer .bk-for-question { display: none; }

.bk-field > label {
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-faint);
}
.bk-offer-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-4); }
.bk-money {
  display: inline-flex;
  align-items: stretch;
  background: var(--bg);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-sm);
}
.bk-money:focus-within { outline: var(--rule-gilt) solid var(--accent); outline-offset: 2px; }
.bk-money-sign {
  display: flex;
  align-items: center;
  padding: 0 0 0 var(--sp-3);
  font-size: var(--fs-md);
  color: var(--text-muted);
}
.bk-field .bk-money input {
  width: 9em;
  border: 0;
  background: transparent;
  padding-left: var(--sp-2);
  font-size: var(--fs-md);
  font-variant-numeric: tabular-nums;
}
.bk-field .bk-money input:focus-visible { outline: none; }
.bk-offer-hint { font-size: var(--fs-sm); color: var(--text-muted); }
.bk-form-error { margin: 0; font-size: var(--fs-sm); color: var(--danger); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Model withdrawal form: quoted statutory text, set apart from our own prose */
.bk-form-model {
  border: var(--hairline) solid var(--border);
  background: var(--bg-panel);
  padding: var(--sp-5);
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
  max-width: var(--measure);
}
.bk-prose table.bk-biblio { margin-bottom: var(--sp-6); }

/* Basket, cart and checkout ---------------------------------------------- */

.bk-basket {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  flex: none;
}
.bk-basket:hover { color: var(--accent); }

.bk-lines { width: 100%; border-collapse: collapse; }
.bk-lines td {
  padding: var(--sp-4) var(--sp-3);
  border-bottom: var(--hairline) solid var(--border);
  vertical-align: top;
}
.bk-line-plate { width: 5.5rem; }
.bk-line-plate .bk-plate { width: 4.5rem; }
.bk-line-title { font-family: var(--font-display); font-size: var(--fs-lg); }
.bk-line-title:hover { color: var(--accent); }
.bk-line-price { text-align: right; font-family: var(--font-display); white-space: nowrap; }
.bk-line-remove { text-align: right; width: 5rem; }
.bk-line-gone { color: var(--danger); font-size: var(--fs-sm); margin-top: var(--sp-2); }

.bk-linkish {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  color: var(--text-faint);
  text-decoration: underline;
}
.bk-linkish:hover { color: var(--accent); }

.bk-cart-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-5);
  flex-wrap: wrap;
  margin-top: var(--sp-6);
}

.bk-checkout {
  display: grid;
  grid-template-columns: 1fr 20rem;
  gap: var(--sp-8);
  align-items: start;
}
.bk-form--wide { max-width: none; }

/* Shipping-method chooser on the checkout form */
.bk-ship-options { display: grid; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.bk-ship-option {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}
.bk-ship-option:has(input:checked) { border-color: var(--accent); background: var(--bg-panel); }
.bk-ship-option input { accent-color: var(--accent); flex: none; }
.bk-ship-desc { flex: 1; }
.bk-ship-price { font-weight: 600; white-space: nowrap; color: var(--text); }
.bk-ship-price:empty::before { content: ''; }
.bk-summary {
  border: var(--hairline) solid var(--border);
  background: var(--bg-panel);
  padding: var(--sp-5);
  position: sticky;
  top: 7rem;
}
.bk-summary h3 { font-size: var(--fs-base); margin-bottom: var(--sp-4); }
.bk-summary-line {
  display: flex;
  justify-content: space-between;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  padding-block: var(--sp-2);
  border-bottom: var(--hairline) solid var(--border);
}
.bk-summary-line--total { font-weight: 600; border-bottom: 0; }

.bk-alert {
  border-left: var(--rule-gilt) solid var(--danger);
  background: var(--bg-panel);
  color: var(--text);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-6);
  max-width: var(--measure);
}

@media (max-width: 900px) {
  .bk-checkout { grid-template-columns: 1fr; }
  .bk-summary { position: static; }
  .bk-line-plate { display: none; }
}

/* ---- Consent notice (only rendered when a Google tag is configured) ------- */
.bk-consent {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: var(--z-toast);
  background: var(--bg-invert);
  color: var(--text-invert);
  border-top: var(--rule-gilt) solid var(--accent-rule);
  padding-block: var(--sp-4);
  box-shadow: var(--shadow-lift);
}
.bk-consent[hidden] { display: none; }
.bk-consent-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}
.bk-consent p { margin: 0; max-width: var(--measure); font-size: var(--fs-sm); }
.bk-consent a { color: var(--accent-on-dark); }
.bk-consent .bk-btn--outline { color: var(--text-invert); border-color: var(--border-invert); }
.bk-consent .bk-btn--outline:hover,
.bk-consent .bk-btn--outline:focus-visible { border-color: var(--accent-on-dark); color: var(--accent-on-dark); }
.bk-consent-actions { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.bk-consent-text { display: grid; gap: var(--sp-2); max-width: var(--measure); }
.bk-consent-cats { list-style: none; margin: 0; padding: 0; font-size: var(--fs-sm); display: grid; gap: var(--sp-1); }
.bk-consent-cats label { cursor: pointer; }
.bk-consent-cats input { accent-color: var(--accent-on-dark); margin-inline-end: var(--sp-1); }
.bk-note .bk-consent-cats { margin-top: var(--sp-3); }
.bk-note .bk-consent-cats input { accent-color: auto; }
.bk-note .bk-consent-actions { margin-top: var(--sp-3); }

/* State/province: with JS, only the field that applies to the chosen country shows. */
.bk-field[hidden] { display: none; }

/* ---- Book photographs: the big photo, the strip, the full-screen gallery -- */
.bk-photo-main { display: block; cursor: zoom-in; }
.bk-photo-main:hover .bk-plate { box-shadow: var(--shadow-lift); }
.bk-gallery a { transition: outline-color var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease); }
.bk-gallery a[aria-current="true"] { outline: var(--rule-gilt) solid var(--accent-rule); outline-offset: 2px; }
.bk-gallery a:not([aria-current="true"]) { opacity: 0.78; }
.bk-gallery a:hover { opacity: 1; }

html.bk-lb-open { overflow: hidden; }
.bk-lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(20, 24, 21, 0.94);
  color: var(--text-invert);
  z-index: var(--z-modal);
  display: none;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.bk-lightbox[open] { display: grid; }
.bk-lightbox::backdrop { background: rgba(20, 24, 21, 0.6); }
.bk-lb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-5);
}
.bk-lb-count {
  font-size: var(--fs-sm);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--text-invert-muted);
  font-variant-numeric: tabular-nums;
}
.bk-lightbox button {
  background: transparent;
  border: var(--hairline) solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-invert);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.bk-lightbox button:hover { color: var(--accent-on-dark); }
.bk-lightbox button:focus-visible { outline: var(--rule-gilt) solid var(--accent-on-dark); outline-offset: 2px; }
.bk-lb-close { width: 2.75rem; height: 2.75rem; }
.bk-lb-stage {
  --lb-side: var(--sp-10);
  position: relative;
  min-height: 0;
  touch-action: pan-y;
}
/* Absolutely centred so the photo is bounded by the stage, whatever its size. */
.bk-lb-img {
  position: absolute;
  inset: 0;
  margin: auto;
  max-width: calc(100% - 2 * var(--lb-side));
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
  user-select: none;
}
.bk-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3.25rem;
  height: 3.25rem;
  background: rgba(20, 24, 21, 0.55) !important;
}
.bk-lb-prev { left: var(--sp-4); }
.bk-lb-next { right: var(--sp-4); }
.bk-lb-strip {
  display: flex;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-5);
  overflow-x: auto;
}
.bk-lb-thumb {
  flex: none;
  width: 3.5rem;
  aspect-ratio: 2 / 3;
  padding: 0;
  overflow: hidden;
  opacity: 0.6;
}
.bk-lb-thumb img { width: 100%; height: 100%; object-fit: cover; }
.bk-lb-thumb:hover { opacity: 0.9; }
.bk-lb-thumb[aria-current="true"] { opacity: 1; border-color: var(--accent-on-dark) !important; }

@media (max-width: 560px) {
  .bk-lb-stage { --lb-side: var(--sp-2); }
  .bk-lb-nav { width: 2.5rem; height: 2.5rem; }
  .bk-lb-prev { left: var(--sp-1); }
  .bk-lb-next { right: var(--sp-1); }
  .bk-lb-strip { justify-content: flex-start; }
}

/* Footer lockup: the same mark file as the header, used as a mask so it takes
   the footer's gold (the heading colour), with the wordmark to its right. */
.bk-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-5);
  margin-bottom: var(--sp-4);
  color: var(--text-invert);
}
.bk-footer .bk-footer-brand .bk-wordmark-name { color: var(--text-invert); font-size: var(--fs-xl); }
.bk-footer-mark {
  display: block;
  flex: none;
  width: 2.4rem;
  height: 2.9rem;
  background-color: var(--accent-on-dark);
  -webkit-mask: var(--bk-mark) center / contain no-repeat;
  mask: var(--bk-mark) center / contain no-repeat;
}

/* site.js hides the sort bar's Apply button (the select submits itself). */
.bk-sortbar .bk-btn[hidden] { display: none; }
