/* =======================================================
   DISSACRAZIONE - READINGS STYLESHEET (ESTANTE GRANDE)
======================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
    background-color: #0b0b0b;
    background-image: url("../booksBG.png"); 
    background-size: cover;
    background-position: center;
    font-family: "Jacquard 12", serif;
    cursor: url("../cursor.png") 16 0, auto !important;
}

a, button, .book-item {
    cursor: url("../cursor.png") 16 0, pointer !important;
}

.back-button {
    position: absolute;
    top: 6% !important;
    left: 5% !important;
    transform: translate(-50%, -50%) !important;
    color: #fff;
    text-decoration: none;
    font-size: 1.6rem;
    z-index: 10;
    text-shadow: 1px 1px 0px #000, -1px -1px 0px #000, 1px -1px 0px #000, -1px 1px 0px #000;
}

.library-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    align-items: center;
    justify-content: center;
    gap: 60px; 
    padding: 0 5%;
    transition: filter 0.4s ease;
}

.library-container.blurred {
    filter: blur(8px) brightness(0.4);
}

/* ==================================== */
/* ESTANTE & NAVEGAÇÃO */
/* ==================================== */
.shelf-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.book-shelf {
    position: relative;
    width: 580px;  
    height: 680px; 
}

.shelf-bg {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: fill; 
}

/* CORRIGIDO: Puxa toda a fileira de livros perfeitamente para cima nas ripas */
.books-container {
    position: absolute;
    inset: 0;
    padding: 10px 50px 40px 50px; 
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 25px; 
}

.book-item {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    transition: transform 0.2s ease;
}

.book-item img {
    max-width: 100%;
    max-height: 150px; 
    object-fit: contain;
    filter: drop-shadow(2px 4px 4px rgba(0,0,0,0.6));
}

.book-item:hover {
    transform: translateY(-8px) scale(1.08); 
}

.nav-arrow {
    background: transparent !important; 
    border: none !important;            
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
    z-index: 10;
}

.nav-arrow img {
    width: 100px; 
    height: auto;
    display: block;
    opacity: 0.8;
    filter: drop-shadow(0px 2px 4px rgba(0,0,0,0.6));
    transition: opacity 0.2s ease, filter 0.2s ease;
    pointer-events: none; 
}

.nav-arrow:hover {
    transform: scale(1.1); 
}

.nav-arrow:hover img {
    opacity: 1; 
    filter: brightness(1.2) drop-shadow(0px 0px 6px rgba(255, 255, 255, 0.4)); 
}

/* Container individual de cada livro na prateleira */
.book-item {
    position: relative !important; 
    display: inline-flex !important; /* Faz a caixinha ter o tamanho EXATO da lombada */
    align-items: flex-end;
    justify-content: center;
    transition: transform 0.2s ease;
}

/* Força a estrelinha pequena a colar no topo direito da fita lilás */
.book-item .fav-star-badge {
    position: absolute !important;
    top: 2px !important;    /* Ajuste fino vertical na madeira */
    right: 2px !important;  /* Ajuste fino horizontal na madeira */
    width: 15px !important; /* Tamanho delicado pixel art */
    height: auto !important;
    z-index: 5 !important;
    filter: drop-shadow(1px 1px 1px rgba(0,0,0,0.8));
    pointer-events: none;
}

/* Caixa que envelopa e trava o tamanho exato da capa do livro grande */
.large-poster-container {
    position: relative !important; 
    display: inline-block !important; /* Encolhe o contêiner para casar com o contorno roxo */
    max-width: 100%;
    max-height: 85%;
}

/* Força a estrelinha grande a colar no canto superior direito do livro roxo */
.large-poster-container .fav-badge {
    position: absolute !important;
    top: 8px !important;    /* Puxa para dentro da quina superior do livro */
    right: 8px !important;  /* Puxa para dentro da quina lateral do livro */
    width: 28px !important; /* Tamanho nítido para o cartaz grande */
    height: auto !important;
    z-index: 6 !important;
    opacity: 0 !important; 
    transition: opacity 0.25s ease-in-out;
    filter: drop-shadow(1px 2px 2px rgba(0, 0, 0, 0.8));
    pointer-events: none;
}

/* Mantém os acendimentos estáveis */
#largePreview.active,
.large-poster-container .fav-badge.active {
    opacity: 1 !important;
}

/* ==================================== */
/* PREVIEW DA CAPA GRANDE (RESETÁVEL)   */
/* ==================================== */
.preview-wrapper {
    width: 360px; 
    height: 540px;
    display: flex;
    flex-direction: column; 
    align-items: center;
    justify-content: center;
    gap: 15px; 
}

/* Força a imagem a começar totalmente invisível */
.preview-wrapper img {
    max-width: 100%;
    max-height: 85%; /* Dá espaço para o texto respirar sem empurrar para fora */
    object-fit: contain;
    opacity: 0 !important; /* Começa oculto */
    transition: opacity 0.25s ease-in-out;
    filter: drop-shadow(4px 8px 12px rgba(0, 0, 0, 0.75));
}

/* O texto também começa totalmente invisível */
#bookInfo {
    font-family: "Jacquard 12", system-ui, serif;
    font-size: 1.4rem;
    color: #ffffff; 
    text-align: center;
    white-space: nowrap;
    opacity: 0 !important; /* Começa oculto */
    transition: opacity 0.25s ease-in-out;
    text-shadow: 1px 1px 0px #000, -1px -1px 0px #000, 1px -1px 0px #000, -1px 1px 0px #000;
    pointer-events: none;
    user-select: none;
}

/* CLASSES DE ATIVAÇÃO: Só aplicam opacidade 1 quando o JavaScript injeta o active */
.preview-wrapper img.active {
    opacity: 1 !important;
}

#bookInfo.active {
    opacity: 1 !important;
}


/* ==================================== */
/* POPUP MODAL (MINI REVIEW) */
/* ==================================== */
.review-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(0px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.review-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.review-modal {
    position: relative;
    max-width: 85vw;
    max-height: 85vh;
    background: #000;
    border: 1px solid rgba(255,255,255,0.25);
    padding: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.9);
    transform: scale(0.92);
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

.review-overlay.show .review-modal {
    transform: scale(1);
}

.review-modal img {
    display: block;
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.close-modal {
    position: absolute;
    top: -15px;
    right: -15px;
    background: #ab0000;
    color: #fff;
    border: 1px solid #fff;
    width: 32px;
    height: 32px;
    font-size: 1.1rem;
    font-family: monospace;
    z-index: 110;
}

/* Configuração do contêiner para empilhar a imagem e o texto verticalmente */
.preview-wrapper {
    width: 360px; 
    height: 540px;
    display: flex;
    flex-direction: column; /* Empilha em formato de coluna */
    align-items: center;
    justify-content: center;
    gap: 15px; /* Espaço entre a capa do livro e o texto */
}

/* Estilo do texto do título e autor */
#bookInfo {
    font-family: "Jacquard 12", system-ui, serif;
    font-size: 1.4rem;
    color: #ffffff; /* Texto em branco */
    text-align: center;
    white-space: nowrap;
    opacity: 0; /* Começa oculto */
    transition: opacity 0.3s ease-in-out;
    /* Sombra fina preta para garantir leitura perfeita sobre o fundo */
    text-shadow: 1px 1px 0px #000, -1px -1px 0px #000, 1px -1px 0px #000, -1px 1px 0px #000;
    pointer-events: none;
    user-select: none;
}

/* Mostra o texto quando estiver ativo via JS */
#bookInfo.active {
    opacity: 1 !important;
}

