/* Modal */
.epub-modal{
  position:fixed;
  inset:0;
  display:none;
  z-index:9999;
}
.epub-modal.is-open{ display:block; }

.epub-modal__backdrop{
  position:absolute;
  inset:0;
  background:rgba(0,0,0,.55);
}

.epub-modal__dialog{
  position:relative;
  width: 100vw;
  height: 100dvh;
  background:#fff;
  overflow:hidden;
  display:flex;
  flex-direction:column;
}

.epub-toolbar{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  padding:12px 14px;
  border-bottom:1px solid #eee;
}
.epub-toolbar__title{
  font-size:14px;
  font-weight:600;
  color:#000;
  flex:0 0 100%;
  width:100%;
  display:block;
  margin:0 0 6px 0;
  line-height:1.2;
}
.epub-toolbar__close{
  margin-left:auto;
}
.epub-toolbar button{
  padding:8px 12px;
  border:1px solid #ddd;
  background:#fff;
  border-radius:12px;
  cursor:pointer;
}
.epub-toolbar button:hover{ background:#f6f6f6; }

#epub-viewer{
  flex:1;
  min-height:0;
}

html.epub-modal-open,
body.epub-modal-open{
  overflow:hidden;
}

.epub-loading{
  position:absolute;
  inset:0;
  display:none;
  align-items:center;
  justify-content:center;
  background:#fff;
  z-index:5;
}
.epub-loading.is-visible{ display:flex; }

.epub-spinner{
  width:40px;
  height:40px;
  border:4px solid #eee;
  border-top-color:var(--primary-color);
  border-radius:50%;
  animation:epub-spin .8s linear infinite;
}

@keyframes epub-spin{
  to{ transform:rotate(360deg); }
}


.pub-books-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}

.pub-book-card {
  width: 100%;
  color: var(--primary-color);
  padding: 10px;
  /* border: 1px solid rgba(30, 28, 22, 0.1); */
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.pub-book-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.pub-book-desc {
  line-clamp: 5;
  font-size: 0.8rem;
  -webkit-line-clamp: 5;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 10px 0;
}

.pub-book-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pub-book-actions {
  margin-top: auto;
}

.pub-book-actions button:hover {
  box-shadow: none !important;
}

.epub-toolbar {
  margin-bottom: 0;
}

.pub-book-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.pub-book-card button {
  border: none;
  width: 100%;
  cursor: pointer;
}

.pub-book-title {
  font-size: 16px;
  font-weight: bold;
  margin-top: 10px;
  text-align: center;
}

.epub-modal__body{
  display:flex;
  flex:1 1 auto;
  min-height:0;
  position:relative;
}

.epub-toc{
  width: 280px;
  border-right:1px solid #eee;
  background:#fff;
  display:none;
  position:absolute;
  left:0;
  top:0;
  bottom:0;
  z-index:2;
  overflow:auto;
  box-shadow: 0 10px 30px rgba(0,0,0,.2);
}

.epub-toc.is-open{ display:block; height: 100%; }

.epub-toc__header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  color: var(--primary-color);
  border-bottom:1px solid #eee;
  position: sticky;
  top: 0;
  z-index: 1;
  background-color: #fff;
}

.epub-toc__list{
  padding:10px 14px;
}

.epub-toc__list a{
  display:block;
  padding:8px 6px;
  border-radius:10px;
  text-decoration:none;
  color:var(--primary-color);
}

.epub-reader-area{
  display:flex;
  flex-direction:column;
  flex:1 1 auto;
  min-width:0;
  min-height:0;
}

#epub-viewer{
  flex:1 1 auto;
  min-height:0;
  width:100%;
}

.pub-books-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:16px;
}


.pub-book-cover {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: white;
    overflow: hidden;
    padding: 12px;
    aspect-ratio: 3 / 4;
    border-radius: 6px;
}

.pub-book-cover img {
    object-fit: cover;
    object-position: center;
    height: 100%;
    max-height: 100%;
    display: block;
    width: 100%
}

.pub-book-card{
  overflow:hidden;
  background:#fff;
}

.pub-book-link{
  display:block;
  text-decoration:none;
  color:inherit;
}

.pub-book-cover-placeholder{
  width:100%;
  aspect-ratio: 3 / 4;
  display:flex;
  align-items:center;
  justify-content:center;
  background:#f5f5f5;
  border-radius:12px;
  color:#666;
  font-size:14px;
}

.pub-book-title{
  margin:12px 0 6px;
  font-size:16px;
  line-height:1.25;
  color: var(--primary-color);
  text-align: center;
}

.pub-book-desc{
  margin:0;
  /* font-size:14px; */
  line-height:1.35;
  color:#555;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  text-overflow: ellipsis;
  text-align: center    ;

}

.pub-book-inner{
  display:flex;
  flex-direction:column;
  height:100%;
  padding-bottom: 15px;
}

.pub-book-link{
  flex:1;
}

.pub-book-actions{
  display: flex;
    padding: 12px;
    margin-top: auto;
    font-family: inherit !important;
}

.pub-book-read-btn{
    margin: 0 auto;
    width: 100%;
    text-align: center;
    border-style: none !important;
    cursor: pointer;
    font-family: inherit;
}
@media (min-width: 520px){
    .pub-books-grid{
    grid-template-columns:repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 700px){

  .epub-modal__dialog{ position:relative; }
  .pub-book-cover {
    padding: 20px;
  }
}

@media screen and (min-width: 1024px) {
  .pub-books-grid {
    grid-template-columns:repeat(4, minmax(0, 1fr));
  }

}

@media (min-width: 1100px){
  .pub-books-grid{
    gap: 25px;
  }
}