/* The cabinet skins share a 460 × 292 painting. The ledge runs across y=104;
   the painted bookend begins at x=297. Keep the folios in that coordinate space. */
.cb-shelf.piece-cabinet {
  position: absolute;
  z-index: 4;
  background: none;
  pointer-events: none;
  container-type: inline-size;
}
body .cb-shelf .shelf-book {
  position: absolute;
  bottom: 64.38%;
  left: 51.65%;
  width: 6.1%;
  height: 23.2%;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  pointer-events: auto;
  transform: none;
  filter: none;
}
body .cb-shelf .cb-volume {
  left: 57.75%;
  width: 6.35%;
  height: 22.2%;
}
.cb-shelf .volume-spine {
  --spine-light: #994d3a;
  --spine: #672d28;
  --spine-dark: #3b201e;
  position: absolute;
  inset: 0 0 .5px;
  display: grid;
  place-items: center;
  border-radius: 2px 2px 0 0;
  border-inline: 1px solid #2c201e;
  border-top: 2px solid #ae9971;
  color: #f0d7a3;
  background: linear-gradient(90deg,var(--spine-dark),var(--spine-light) 17%,var(--spine) 51%,var(--spine-dark) 94%);
  box-shadow: inset 0 1px #cbb68770, inset -2px 0 #1f1b1d80, 1px 1px 1px #15120dde;
}
.cb-shelf .cb-volume .volume-spine {
  --spine-light: #556779;
  --spine: #354657;
  --spine-dark: #242e3c;
}
.volume-spine::before,.volume-spine::after {
  content: "";
  position: absolute;
  inset-inline: 1px;
  height: 3%;
  border-block: 1px solid #c1a177b3;
  box-shadow: 0 1px #140d0b66;
}
.volume-spine::before { top: 7%; }
.volume-spine::after { bottom: 6%; }
.volume-spine b {
  writing-mode: vertical-rl;
  font: bold clamp(5px,1.78cqw,10px)/1 Georgia,serif;
  letter-spacing: .045em;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow: 0 1px #17171d;
}
.cb-shelf .shelf-book:is(:hover,:focus-visible) { translate: none; z-index: 2; }
.cb-shelf .shelf-book:is(:hover,:focus-visible) .volume-spine { filter: brightness(1.2); }
.cb-shelf .shelf-book:focus-visible { outline: 2px solid #ecd39d; outline-offset: 2px; }

/* The blue cloth binding, warm library catalogue and ivory reading leaf. */
#dialog.cb-dialog {
  --ink: #232c35;
  --muted: #555a59;
  --blue: #273c50;
  --gold: #c7a970;
  width: min(1150px,95vw);
  height: min(840px,92dvh);
  max-width: 98vw;
  max-height: 96dvh;
  padding: 0;
  border: 1px solid #a89b78;
  border-radius: 7px 11px 10px 6px;
  background: #1f2c3c;
  color: var(--ink);
  box-shadow: 3px 4px 0 -1px #b9ae94, 5px 6px 0 -2px #5e5645, 0 22px 90px #05080cbd;
  overflow: hidden;
  color-scheme: light;
}
#dialog.cb-dialog::backdrop { background: #0b1018ac; backdrop-filter: blur(3px); }
.cb-dialog #dialog-body { height: 100%; display: flex; flex-direction: column; padding: 0; }
.cb-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  flex: none;
  padding: 13px 26px 12px;
  color: #f4ead3;
  background: radial-gradient(ellipse at 18% 15%,#35475d,transparent 62%),#202f40;
  border-bottom: 1px solid #a8926b7d;
}
.cb-head::after {
  content: "";
  position: absolute;
  inset: 5px 7px;
  border: 1px solid #c4a96a38;
  border-radius: 2px;
  pointer-events: none;
}
.cb-kicker {
  display: block;
  font: 700 .72rem/1.35 var(--sans,system-ui);
  letter-spacing: .12em;
  text-transform: uppercase;
}
.cb-head .cb-kicker { color: #d9c290; }
.cb-head h1 { margin: 0; color: #f5ead1; font: normal clamp(1.65rem,2.6vw,2.4rem)/1.12 Georgia,serif; }
.cb-glyph {
  width: 30px;
  height: 38px;
  border: 1px solid #d4bd89;
  border-inline-start: 4px double #d4bd89;
  border-radius: 1px 3px 3px 1px;
  display: grid;
  align-content: center;
  gap: 3px;
  box-shadow: 3px 2px 0 #26364a,4px 3px 0 #9a8964;
}
.cb-glyph i { display: block; height: 1px; width: 14px; margin: auto; background: #c5ac76; }
.cb-glyph i:nth-child(2) { width: 8px; }
.cb-close {
  display: inline-flex; align-items: center; gap: 9px; margin-left: auto;
  min-height: 34px; padding: 4px 12px; border: 1px solid #b7a78691; border-radius: 3px;
  background: #213044; color: #f7edda; font: 600 .87rem var(--sans,system-ui);
}
.cb-close span { font-size: 1.12rem; }
.cb-curriculum { flex: none; padding: 5px clamp(12px,2vw,26px); color: #eee4cf; background: #1c2937; }
.cb-curriculum summary { width: fit-content; color: #e1cea6; cursor: pointer; font: 600 .9rem/1.5 var(--sans,system-ui); }
.cb-curriculum summary:focus-visible { outline: 2px solid #e1cea6; outline-offset: 3px; }
.cb-curriculum p { margin: 6px 0 8px; max-width: 78ch; font: .92rem/1.45 var(--sans,system-ui); }
.cb-tabs { display: flex; flex: none; gap: 4px; align-items: stretch; padding: 8px 20px 0; background: #1c2937; }
.cb-tabs button {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 37px; padding: 4px clamp(9px,2vw,26px); border: 1px solid #566171;
  border-bottom: 0; border-radius: 5px 5px 0 0; background: #2b3948; color: #e5e2d9;
  font: 600 .94rem var(--sans,system-ui);
}
.cb-tabs .icon,.book-subjects .icon { width: 17px; height: 17px; flex: none; }
.cb-tabs button:hover { background: #394c5e; }
.cb-tabs [aria-selected=true],.cb-tabs [aria-selected=true]:hover { background: #eee5d2; color: #25394b; box-shadow: inset 0 3px #ba9e65; border-color: #c4b691; }
.cb-body { display: grid; grid-template-columns: clamp(225px,29%,320px) minmax(0,1fr); min-height: 0; flex: 1; border-top: 1px solid #bcae91; }
.cb-directory {
  display: flex; flex-direction: column; min-height: 0; padding: 14px 17px 0 20px;
  background: linear-gradient(90deg,#e9e1d1,#e8dfcd 94%,#d7ccb6); color: var(--ink);
  border-right: 1px solid #bcac8c;
}
.cb-directory label { font: 650 .86rem/1.35 var(--sans,system-ui); color: #3d463f; margin-bottom: 5px; }
.cb-directory input {
  width: 100%; min-height: 38px; padding: 6px 10px; border: 1px solid #9f9b89;
  border-radius: 3px; color: var(--ink); background: #f7f2e7; font: .95rem var(--sans,system-ui);
}
.cb-count { display: flex; align-items: center; justify-content: space-between; padding: 9px 0 6px; border-bottom: 1px solid #b7aa90; color: #575746; font: .82rem var(--sans,system-ui); }
.cb-count button { border: 0; padding: 0; color: #374b61; background: transparent; font: inherit; text-decoration: underline; }
#cb-list { min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-color: #aca18a #e6dece; padding: 3px 4px 10px 0; }
.cb-item {
  display: block; width: 100%; padding: 10px 12px; text-align: left; color: #2e322f;
  background: transparent; border: 0; border-bottom: 1px solid #cbbfa9; border-left: 3px solid transparent;
}
.cb-item span { display: block; font: 1.02rem/1.25 Georgia,serif; }
.cb-item small { display: block; margin-top: 3px; color: #53594e; font: .78rem/1.3 var(--sans,system-ui); }
.cb-item:hover { background: #f2ecdf; }
.cb-item[aria-current=page] { background: #30455a; color: #fff3d8; border-left-color: #c2a05d; }
.cb-item[aria-current=page] small { color: #e5ddcd; }
.cb-reader { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #faf6ea; }
#cb-leaf { flex: 1; overflow: auto; overscroll-behavior: contain; color: var(--ink); background: linear-gradient(90deg,#dfd4bf 0,#f3ebdc 10px,#faf6ec 31px,#faf6ec 97%,#f1eadc); scrollbar-color: #a8a08d #f6f0e5; }
.cb-pagehead,.cb-copy { box-sizing: border-box; max-width: 850px; margin: auto; padding-inline: clamp(24px,3.8vw,54px); }
.cb-pagehead { position: relative; padding-top: 24px; padding-bottom: 14px; }
.cb-pagehead::before {
  content: ""; position: absolute; right: clamp(21px,3.1vw,40px); top: 0; width: 13px; height: 24px;
  background: linear-gradient(90deg,#415b6c,#263e51 60%,#647680); clip-path: polygon(0 0,100% 0,100% 100%,50% 76%,0 100%);
}
.cb-pagehead .cb-kicker { color: #616154; padding-right: 20px; }
.cb-pagehead h2,.cb-copy h2 { color: #28394a; font: normal clamp(1.8rem,2.9vw,2.85rem)/1.07 Georgia,serif; letter-spacing: -.035em; margin: 7px 0 5px; }
.cb-cite { font: italic 1.06rem/1.35 Georgia,serif; color: #56564c; margin: 0; }
.cb-tags,.cb-links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; }
.cb-tags { margin-top: 9px; }
.cb-tags button { padding: 2px 8px; background: #eee6d5; border: 1px solid #cbbda2; border-radius: 2px; color: #495248; font: .81rem/1.35 var(--sans,system-ui); }
.cb-copy { padding-block: 0 24px; font: 1.06rem/1.52 Georgia,serif; }
.cb-copy section { margin: 17px 0; }
.cb-copy h3,.book-practice h4 { margin: 0 0 5px; color: #33485a; font: 700 .93rem/1.35 var(--sans,system-ui); }
.cb-copy p { margin: 0 0 10px; color: var(--ink); }
.cb-holding { margin: 15px 0 19px; padding: 12px 16px; border-left: 3px solid #897144; background: #eee8d9; }
.cb-holding .cb-kicker { color: #665539; }
.cb-holding p { margin: 4px 0 0; font: 1.18rem/1.37 Georgia,serif; }
.cb-margin { padding: 11px 15px; border-block: 1px solid #baaa88; background: #f1ead9; }
.cb-margin p { margin: 0; }
.cb-comparisons details { padding: 8px 0; border-bottom: 1px solid #cbbb9e; }
.cb-comparisons summary, .book-more summary { cursor: pointer; color: #394f50; font: 600 .91rem/1.5 var(--sans,system-ui); }
.cb-comparisons details[open] summary { margin-bottom: 5px; }
.cb-comparisons .cb-links { margin-bottom: 6px; }
.book-more { margin-top: 8px; }
.cb-dialog button,.cb-dialog a { cursor: pointer; }
.cb-inline { padding: 2px 0; border: 0; border-radius: 0; text-align: left; color: #2d5268; background: transparent; text-decoration: underline; text-underline-offset: 3px; font: 600 .88rem/1.45 var(--sans,system-ui); }
.cb-dialog :is(button,a,input):focus-visible,.file-books button:focus-visible { outline: 2px solid #ac751b; outline-offset: -2px; }
.cb-dialog [hidden] { display: none; }
.cb-copy .cb-play { border-top: 1px solid #beb096; padding-top: 12px; margin: 0 0 12px; }
.cb-files,.book-practice>div { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(185px,100%),1fr)); gap: 7px; }
.cb-file,.topic-file {
  position: relative; display: grid; align-content: center; gap: 3px; width: 100%; min-width: 0;
  padding: 8px 10px 8px 34px; border: 1px solid #b8ae95; border-radius: 3px;
  text-align: left; background: #f0ecdf; color: #2a3f51; cursor: pointer;
}
.cb-file::before,.topic-file::before {
  content: ""; position: absolute; top: calc(50% - 4px); left: 14px;
  border-left: 7px solid currentColor; border-block: 4px solid transparent;
}
.cb-file:hover,.topic-file:hover { border-color: #75867e; background: #e5e8db; }
.cb-file span,.topic-file span { font: bold .99rem/1.25 Georgia,serif; }
.cb-file small,.topic-file small { font: .79rem/1.25 var(--sans,system-ui); color: #565c53; }
.cb-folio { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex: none; padding: 5px 14px; border-top: 1px solid #c5b696; background: #f1ead9; color: #645e51; font: italic .86rem Georgia,serif; }
.cb-folio button { padding: 5px 8px; color: #34475a; border: 0; background: transparent; font: 600 .83rem var(--sans,system-ui); }
.cb-folio button:disabled { opacity: .42; cursor: default; }

.book-subjects button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
#book-page .book-practice { margin: 12px 0 18px; padding: 12px 0; border-block: 1px solid #cbbb9e; }
#book-page .book-practice h4 { margin: 0 0 7px; color: #6c3830; }
.topic-file { color: #58392e; }
.file-books { display: flex; flex-wrap: wrap; gap: 7px; margin: 5px 0 12px; }
.file-books button { display: inline-flex; gap: 6px; align-items: center; border: 1px solid #8b826b; border-radius: 3px; background: #efe8d5; color: #334237; padding: 5px 9px; font: 600 .88rem var(--sans,system-ui); cursor: pointer; }
.file-books button:hover { background: #e4dcc4; }
.file-books .icon { width: 16px; height: 16px; }
body:is([data-view=file],[data-view=review]) .hud-reference { display: none; }
@media(max-width:700px){
  #dialog.cb-dialog { width: 98vw; height: 95dvh; }
  .cb-head { padding: 10px 15px; gap: 10px; }
  .cb-glyph { width: 24px; height: 30px; }
  .cb-tabs { padding: 5px 5px 0; gap: 2px; }
  .cb-tabs button { flex: 1; padding: 5px 3px; font-size: .82rem; }
  .cb-tabs .icon,.book-subjects .icon { display: none; }
  .cb-body { grid-template-columns: minmax(118px,32%) minmax(0,1fr); }
  .cb-directory { padding: 9px 6px 0; }
  .cb-item { padding: 8px 5px; }
  .cb-item span { font-size: .88rem; }
  .cb-pagehead,.cb-copy { padding-inline: 15px; }
  .cb-folio { padding: 3px; }
  .cb-folio button { font-size: .76rem; padding: 4px; }
}
