/* THE BOOKSHELF (@ovi 2026-10-28). Library only. Robin: "This should not be a modified
   dressing room." It is not: no x, no y, no overlap, no free positioning. A sequence of
   books standing on ledges. */
#ovi-shelf {
  position: relative; width: 100%;
  padding: 2px 0 6px;
  /* How tall a book stands. This was 152 and the books came out 22px wide, which is
     honestly proportioned and completely unreadable — and reading the bindings is the
     entire point of a shelf. Taller books are wider books. */
  --shelfH: 236px;
  --ledge: 13px;
}
#ovi-shelf * { box-sizing: border-box; }

/* a row of books, and the plank they stand on */
.ovi-row {
  position: relative; width: 100%;
  display: flex; align-items: flex-end; gap: 3px;
  padding: 0 12px var(--ledge);
  min-height: calc(var(--shelfH) + var(--ledge));
}
.ovi-row::after {
  content: ""; position: absolute; left: 6px; right: 6px; bottom: 0; height: var(--ledge);
  border-radius: 2px;
  background: linear-gradient(180deg, #6b4e32 0%, #4a351f 42%, #33240f 100%);
  box-shadow: 0 3px 7px rgba(0,0,0,.42), inset 0 1px 0 rgba(255,255,255,.18);
}

/* one book: the spine you see, the cover behind it waiting */
.ovi-book {
  position: relative; flex: 0 0 auto;
  height: var(--shelfH);
  cursor: grab; touch-action: pan-y;   /* ovi-native-scroll */
  transition: width .32s cubic-bezier(.2,.8,.25,1),
              transform .32s cubic-bezier(.2,.8,.25,1),
              filter .2s ease;
  transform-origin: 50% 100%;
  box-shadow: 0 3px 5px rgba(0,0,0,.35);
}
.ovi-book img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: fill; display: block; border-radius: 1px 2px 2px 1px;
  transition: opacity .24s ease;
  pointer-events: none; -webkit-user-drag: none;
}
.ovi-book .ovi-cover { opacity: 0; object-fit: contain; }

/* pulled off the shelf: it widens to the cover, stands proud, and the two faces swap.
   The widening is what shoves its neighbours aside, which is the whole illusion. */
.ovi-book.ovi-out {
  transform: translateY(-16px);
  z-index: 30;
  filter: drop-shadow(0 14px 22px rgba(0,0,0,.6));
}
.ovi-book.ovi-out .ovi-spine { opacity: 0; }
.ovi-book.ovi-out .ovi-cover { opacity: 1; }

/* being dragged to a new place in the line */
.ovi-book.ovi-lift {
  cursor: grabbing; z-index: 60;
  transform: translateY(-22px) scale(1.04);
  filter: drop-shadow(0 18px 26px rgba(0,0,0,.65));
  transition: transform .14s ease, filter .14s ease;
}
/* the gap that opens where it would land */
.ovi-slot {
  flex: 0 0 auto; height: var(--shelfH);
  border-radius: 2px;
  background: rgba(255,255,255,.14);
  outline: 1px dashed rgba(255,255,255,.4);
  transition: width .16s ease;
}

/* Taking a book off the shelf. There is no hanger here and there is deliberately no
   cart — Robin's library lends, it does not sell, and a cart on a bookshelf would be
   telling the visitor something untrue. The way off is on the book you have already
   pulled out, which is the only moment it makes sense to offer. */
.ovi-book .ovi-off {
  position: absolute; top: 4px; right: 4px; z-index: 2;
  width: 26px; height: 26px; border-radius: 50%;
  border: 0; padding: 0; cursor: pointer;
  background: rgba(0,0,0,.62); color: #fff;
  font: 600 15px/26px system-ui, sans-serif; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.ovi-book.ovi-out .ovi-off { opacity: 1; pointer-events: auto; }

.ovi-book.ovi-gone { opacity: 0; transform: scale(.7); transition: all .26s ease; }

#ovi-shelf-empty {
  padding: 26px 18px; text-align: center; opacity: .5; font-size: 13.5px;
}
#ovi-shelf-empty[hidden] { display: none; }

@media (max-width: 560px) {
  #ovi-shelf { --shelfH: 206px; }
}
@media (prefers-reduced-motion: reduce) {
  .ovi-book, .ovi-book img, .ovi-slot { transition: none !important; }
}
/* WHICH KIND OF BOOK IS THIS (@ovi 2026-10-29)
   Robin: "could it seperate the books by ebooks and books i want to buy borrow from
   physical library some how visually." On a real shelf you tell them apart by looking at
   the spine, so the difference is on the spine: a head band across the top, bright and
   lettered for an ebook, plain cloth for a hard copy. */
.ovi-book { position: relative; }
.ovi-band {
  position: absolute; top: 0; left: 0; right: 0; height: 13px; z-index: 4;
  display: flex; align-items: center; justify-content: center;
  font: 700 9px/1 var(--ovi-body, inherit); letter-spacing: .06em;
  text-transform: lowercase; pointer-events: none;
}
.ovi-book.ovi-ebook  .ovi-band { background: #46d6c0; color: #04221d; }
.ovi-book.ovi-shop   .ovi-band { background: #8a6a43; color: transparent; }
/* pulled out, the band would sit over the cover, so it steps aside */
.ovi-book.ovi-out .ovi-band { opacity: 0; transition: opacity .18s ease; }

/* the legend, because a colour nobody explained is decoration rather than information */
#ovi-shelf-key {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  padding: 2px 4px 8px;
  font: 500 11.5px/1.2 var(--ovi-body, inherit); opacity: .72;
}
#ovi-shelf-key span { display: inline-flex; align-items: center; gap: 6px; }
#ovi-shelf-key i { width: 16px; height: 9px; border-radius: 2px; display: inline-block; }
#ovi-shelf-key i.e { background: #46d6c0; }
#ovi-shelf-key i.p { background: #8a6a43; }
/* A MADE BINDING (@ovi 2026-10-29), for ebooks, which have no photograph of one.
   The title runs up the board the way it does on a real spine. */
.ovi-book .ovi-spine-made {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between;
  padding: 18px 2px 7px; overflow: hidden; border-radius: 1px;
  /* the rounded shoulder and the shadow in the gutter, which is what makes a flat
     rectangle read as a board with thickness */
  background-image: linear-gradient(90deg,
    rgba(0,0,0,.42) 0%, rgba(255,255,255,.10) 18%,
    rgba(255,255,255,.03) 72%, rgba(0,0,0,.45) 100%);
  background-blend-mode: overlay;
}
.ovi-spine-made .ovi-spine-title {
  flex: 1 1 auto; min-height: 0;
  writing-mode: vertical-rl; text-orientation: mixed;
  font: 600 11px/1 var(--ovi-heading, Georgia, serif);
  letter-spacing: .02em; text-align: left; line-height: 1.08;
  overflow: hidden; white-space: normal; overflow-wrap: anywhere;   /* ovi-spine-fit: wraps into more columns instead of cutting off */
}
.ovi-spine-made .ovi-spine-by {
  flex: 0 0 auto; max-width: 100%;
  font: 500 8px/1 var(--ovi-body, inherit); opacity: .72;
  writing-mode: vertical-rl; text-orientation: mixed;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-height: 46px;
}
/* pulled out, the made board steps aside for the real cover, same as a photographed one */
.ovi-book.ovi-out .ovi-spine-made { opacity: 0; }
/* A SKETCHBOOK ON THE SHELF (@ovi 2026-10-29)
   Robin: "Why cant u put the sketchbooks into the shelf in the window... Male them black
   canvas like a moleskine." Black cloth, the weave drawn rather than imaged, and the
   elastic down the fore edge that makes a moleskine a moleskine. */
.ovi-book .ovi-spine-nb {
  position: absolute; inset: 0; border-radius: 1px 3px 3px 1px;
  background: #17161a; overflow: hidden;
  box-shadow: inset -3px 0 6px rgba(0,0,0,.55), inset 3px 0 5px rgba(255,255,255,.05);
}
.ovi-book .ovi-spine-nb[data-cloth="claret"] { background: #3b1118; }
.ovi-book .ovi-spine-nb[data-cloth="forest"] { background: #16281d; }
.ovi-book .ovi-spine-nb[data-cloth="navy"]   { background: #141d2c; }
.ovi-book .ovi-spine-nb[data-cloth="tan"]    { background: #3a2c1c; }
.ovi-book .ovi-spine-nb[data-cloth="plum"]   { background: #241a33; }
.ovi-book .ovi-spine-nb::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg,  rgba(0,0,0,.26) 0 1px, transparent 1px 3px);
}
/* the elastic */
.ovi-book .ovi-spine-nb::after {
  content: ""; position: absolute; right: 4px; top: -2px; bottom: -2px; width: 3px;
  background: rgba(0,0,0,.7); box-shadow: 0 0 3px rgba(0,0,0,.6);
}
.ovi-book .ovi-nb-title {
  position: absolute; left: 50%; top: 16px; transform: translateX(-50%);
  writing-mode: vertical-rl; text-orientation: mixed;
  max-height: calc(100% - 30px); overflow: hidden; white-space: nowrap;
  text-overflow: ellipsis;
  font: 600 10px/1 var(--ovi-heading, Georgia, serif); letter-spacing: .03em;
  color: rgba(255,255,255,.76);
}
/* its head band says what it is, the way the others do */
.ovi-book.ovi-sketch .ovi-band { background: #d8d2c4; color: #1b1a18; }
/* and the legend's third swatch, which was in the markup as <i class="n"> with no
   colour ever defined for it, so the line read "your sketchbooks" with a blank where
   the other two have a chip and looked like a stray phrase rather than a key */
#ovi-shelf-key i.n { background: #d8d2c4; }
/* ovi-nb-face: a sketchbook taken off the shelf is the black cloth with its title across
   the front. It used to be hidden here, to make room for a cover picture it does not have,
   which left an empty rectangle. */
.ovi-book.ovi-sketch.ovi-out .ovi-spine-nb { opacity: 1; }
.ovi-book.ovi-sketch.ovi-out .ovi-nb-title {
  writing-mode: horizontal-tb; text-orientation: mixed;
  left: 15%; right: 15%; top: 17%; transform: none; max-height: 62%;
  white-space: normal; text-align: center; text-overflow: clip;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 6;
  font: 700 17px/1.28 var(--ovi-heading, Georgia, serif); letter-spacing: .02em;
  color: #ece6d6; text-shadow: 0 1px 0 rgba(0,0,0,.5);
}
/* a small rule under it, the way a notebook's title is set off */
.ovi-book.ovi-sketch.ovi-out .ovi-nb-title::after {
  content: ""; display: block; width: 30px; height: 1px; margin: 12px auto 0;
  background: rgba(236,230,214,.45);
}
/* and a page chosen for the cover replaces the cloth */
.ovi-book.ovi-sketch.ovi-has-cover.ovi-out .ovi-spine-nb { opacity: 0; }
.ovi-book.ovi-sketch .ovi-cover {
  object-fit: cover; border-radius: 1px 4px 4px 1px;
  box-shadow: inset 4px 0 6px rgba(0,0,0,.35), 0 0 0 1px rgba(0,0,0,.55);
}
.ovi-book.ovi-sketch:not(.ovi-has-cover) .ovi-cover { display: none; }
/* the cross means take it off my shelf; for a sketchbook that would mean destroy it */
.ovi-book.ovi-sketch .ovi-off { display: none; }

/* ovi-loan-flow: a requested or borrowed book */
.ovi-book[data-loan] .ovi-band { color: #fff; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.ovi-book[data-loan="requested"] .ovi-band { background: #b8860b; }
.ovi-book[data-loan="ready"] .ovi-band { background: #1c8c4a; }
.ovi-book[data-loan="out"] .ovi-band { background: #4a6fa5; }
.ovi-loan { position: absolute; left: 0; right: 0; bottom: 0; padding: 7px 8px; font: 600 11px/1.3 system-ui, sans-serif;
  background: rgba(0,0,0,.78); color: #fff; opacity: 0; transition: opacity .18s ease; pointer-events: none; text-align: center; }
.ovi-book.ovi-out .ovi-loan { opacity: 1; }

/* ovi-pull-center: the nudge that centres a pulled-out book rides on the transform it already has */
.ovi-book.ovi-out { transform: translate(var(--out-dx, 0px), -16px); }

/* ovi-ios-scroll: the cost of will-change and a filter is paid only by the book that is out */
.ovi-book.ovi-out { will-change: width, transform; }

/* ovi-shelf-add: the blank slot that makes a sketchbook */
.ovi-add { position: relative; flex: 0 0 auto; height: var(--shelfH); display: flex; flex-direction: column;
  align-items: center; justify-content: space-between; padding: 14px 0 16px; cursor: pointer;
  border: 2px dashed rgba(60,48,30,.6); border-radius: 3px; background: rgba(0,0,0,.07); color: #2a2418;
  -webkit-tap-highlight-color: transparent; touch-action: pan-y; }
.ovi-add:active, .ovi-add:focus-visible { background: rgba(0,0,0,.16); outline: none; }
.ovi-add-plus { font: 700 34px/1 system-ui, sans-serif; }
.ovi-add-txt { writing-mode: vertical-rl; white-space: nowrap; font: 700 14px/1 Georgia, serif; letter-spacing: .06em; }

/* ovi-poetry-book-css: the Godberd Book of Poetry is plum cloth with a gold band */
.ovi-book.ovi-poetry .ovi-band { background: #f0cf7a; color: #3d1f4d; font-weight: 700; }
