/* CeibaBook v3.3.4 — shelf row geometry
   Keep each book row locked to the same wooden plank it visually sits on.
   The shelf background starts at the grid's content origin (not its border),
   and every CSS grid row uses the exact same height as the repeating shelf. */

/* Main catalog / home shelf */
.grid-books.catalog-view-shelf{
  --shelf-row-h:286px;
  grid-auto-rows:var(--shelf-row-h)!important;
  row-gap:0!important;
  background-position:0 8px!important;
}
.grid-books.catalog-view-shelf>.book,
.grid-books.catalog-view-shelf>.book-card,
.grid-books.catalog-view-shelf>.add-shelf-slot{
  align-self:end!important;
  margin-bottom:42px!important;
  transform-origin:bottom center!important;
}

/* Portal / personal library shelf */
.unified-bookcase .library-grid.view-shelf{
  --shelf-row:268px;
  grid-auto-rows:var(--shelf-row)!important;
  row-gap:0!important;
  background-position:0 8px!important;
}
.unified-bookcase .library-grid.view-shelf .book-card,
.unified-bookcase .library-grid.view-shelf .add-shelf-slot{
  align-self:end!important;
  height:205px!important;
  min-height:205px!important;
  margin:0 0 39px!important;
  transform-origin:bottom center!important;
}

/* Small screens: same geometry, scaled together so rows never drift. */
@media(max-width:760px){
  .grid-books.catalog-view-shelf{
    --shelf-row-h:226px;
    grid-auto-rows:var(--shelf-row-h)!important;
    background-position:0 8px!important;
  }
  .grid-books.catalog-view-shelf>.book,
  .grid-books.catalog-view-shelf>.book-card,
  .grid-books.catalog-view-shelf>.add-shelf-slot{
    margin-bottom:34px!important;
  }
}
@media(max-width:680px){
  .unified-bookcase .library-grid.view-shelf{
    --shelf-row:220px;
    grid-auto-rows:var(--shelf-row)!important;
    background-position:0 8px!important;
  }
  .unified-bookcase .library-grid.view-shelf .book-card,
  .unified-bookcase .library-grid.view-shelf .add-shelf-slot{
    height:168px!important;
    min-height:168px!important;
    margin:0 0 32px!important;
  }
}

/* CeibaBook v3.3.5 — mobile shelf polish.
   Keep the wooden shelf geometry synchronized with the catalog row variable,
   make the book silhouettes lighter on phones, and prevent touch-hover from
   leaving a book visually lifted after a tap. */
@media(max-width:520px){
  .grid-books.catalog-view-shelf{
    --catalog-shelf-row:210px!important;
    --shelf-row-h:210px!important;
    grid-template-columns:repeat(3,minmax(0,1fr))!important;
    grid-auto-rows:210px!important;
    width:100%!important;
    max-width:100%!important;
    min-width:0!important;
    padding:10px 8px 0!important;
    border-width:6px!important;
    border-radius:10px!important;
    column-gap:4px!important;
    overflow:hidden!important;
  }
  .grid-books.catalog-view-shelf>.book,
  .grid-books.catalog-view-shelf>.book-card,
  .grid-books.catalog-view-shelf>.add-shelf-slot{
    width:min(100%,96px)!important;
    max-width:96px!important;
    height:150px!important;
    min-height:150px!important;
    margin:0 0 35px!important;
    justify-self:center!important;
    align-self:end!important;
  }
  .grid-books.catalog-view-shelf .book-flip,
  .grid-books.catalog-view-shelf .book-face{
    width:100%!important;
    height:100%!important;
    min-height:0!important;
  }
  .grid-books.catalog-view-shelf .book-info-btn{
    width:25px!important;
    height:25px!important;
    right:5px!important;
    top:5px!important;
    padding:0!important;
    border-radius:50%!important;
    font-size:10px!important;
    display:grid!important;
    place-items:center!important;
    background:rgba(8,12,10,.72)!important;
  }
  .grid-books.catalog-view-shelf .ceiba-cover-title strong{
    font-size:8px!important;
    line-height:1.06!important;
  }
}
@media(max-width:350px){
  .grid-books.catalog-view-shelf{
    --catalog-shelf-row:226px!important;
    --shelf-row-h:226px!important;
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    grid-auto-rows:226px!important;
  }
  .grid-books.catalog-view-shelf>.book,
  .grid-books.catalog-view-shelf>.book-card,
  .grid-books.catalog-view-shelf>.add-shelf-slot{
    width:min(100%,112px)!important;
    max-width:112px!important;
    height:170px!important;
    min-height:170px!important;
    margin-bottom:39px!important;
  }
}
@media(hover:none) and (pointer:coarse){
  .grid-books.catalog-view-shelf .book:hover{
    transform:none!important;
    filter:drop-shadow(3px 9px 7px rgba(28,11,4,.38))!important;
  }
}
