/* =============================================
   books.css — reading page styles
   Matches existing site: black bg, white text
   Typography: EB Garamond (serif display) +
               Geist Mono (labels/meta)
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;1,400&family=Geist+Mono:wght@300;400&display=swap');

header {
    justify-content: flex-end;
}

/* Hero */

.books-hero {
    padding: 100px 0 40px;
    animation: fadeUp 0.9s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.books-label {
    font-family: 'Geist Mono', monospace;
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: 16px;
}

.books-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: clamp(48px, 8vw, 90px);
    font-weight: 400;
    color: white;
    line-height: 1;
    letter-spacing: -0.01em;
}

/* Section shelf label */

.shelf-label {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 48px;
    animation: fadeUp 0.9s 0.15s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

.shelf-label span {
    font-family: 'Geist Mono', monospace;
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.35);
    white-space: nowrap;
}

.shelf-line {
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

/* Books grid */

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 40px 32px;
    animation: fadeUp 0.9s 0.25s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}

/* Book card */

.book-card {
    display: flex;
    flex-direction: column;
    gap: 14px;
    cursor: default;
}

/* Cover wrap handles the 3D lift + shadow */

.book-cover-wrap {
    position: relative;
    display: inline-block;
    transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1),
                filter 0.45s ease;
    transform-origin: center bottom;
    transform-style: preserve-3d;
}

.book-card:hover .book-cover-wrap {
    transform: translateY(-12px) rotate(-1.5deg);
    filter: drop-shadow(0 24px 32px rgba(0,0,0,0.7));
}

/* The book cover image */

.book-cover {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 2px 4px 4px 2px;
    background: #111;
}

/* Subtle spine shadow on left edge of cover */

.book-cover-wrap::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 0;
    width: 6px;
    height: calc(100% - 4px);
    background: rgba(0,0,0,0.45);
    border-radius: 2px 0 0 2px;
    z-index: 1;
    transition: opacity 0.45s ease;
}

.book-card:hover .book-cover-wrap::before {
    opacity: 0.6;
}

/* Sheen overlay on hover */

.book-cover-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 2px 4px 4px 2px;
    background: linear-gradient(
        135deg,
        rgba(255,255,255,0.06) 0%,
        transparent 50%
    );
    opacity: 0;
    transition: opacity 0.45s ease;
    pointer-events: none;
}

.book-card:hover .book-cover-wrap::after {
    opacity: 1;
}

/* Book info below cover */

.book-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.book-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 15px;
    font-weight: 400;
    color: rgba(255,255,255,0.85);
    line-height: 1.35;
    letter-spacing: 0.01em;
}

/* Progress bar — above currently reading covers */

.book-progress {
    display: flex;
    align-items: center;
    gap: 8px;
}

.book-progress-bar {
    flex: 1;
    height: 1px;
    background: rgba(255,255,255,0.1);
    position: relative;
    border-radius: 1px;
}

.book-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255,255,255,0.5);
    border-radius: 1px;
    transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.book-progress-label {
    font-family: 'Geist Mono', monospace;
    font-size: 10px;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.2);
    white-space: nowrap;
}

/* Finished date — sits above the cover */

.book-date {
    font-family: 'Geist Mono', monospace;
    font-size: 10px;
    font-weight: 300;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.2);
    text-transform: uppercase;
}

/* Loading & empty states */

.books-loading, .books-empty {
    font-family: 'Geist Mono', monospace;
    font-size: 11px;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.2);
}

/* View toggle — sits inside shelf-label */

.view-toggle {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.view-toggle-btn {
    background: none;
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.25);
    padding: 5px 8px;
    cursor: pointer;
    border-radius: 2px;
    transition: all 0.2s ease;
    font-size: 10px;
}

.view-toggle-btn:hover {
    color: white;
    border-color: rgba(255,255,255,0.3);
}

.view-toggle-btn.active {
    color: white;
    border-color: rgba(255,255,255,0.4);
}

/* Small star rating above cover */

.book-rating-small {
    display: flex;
    gap: 2px;
}

.book-rating-small span {
    font-size: 10px;
    color: rgba(255,255,255,0.5);
}

/* Books section spacing */

.books-section {
    padding-bottom: 120px;
}

/* ── MODAL ── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: #0a0a0a;
    border: 1px solid rgba(255,255,255,0.08);
    max-width: 680px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: translateY(20px);
    transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.3);
    font-size: 14px;
    cursor: pointer;
    padding: 4px;
    font-family: 'Geist Mono', monospace;
    transition: color 0.2s ease;
    z-index: 1;
}

.modal-close:hover {
    color: white;
}

.modal-inner {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 40px;
    padding: 40px;
}

.modal-cover-wrap {
    flex-shrink: 0;
}

.modal-cover {
    display: block;
    width: 100%;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 2px 4px 4px 2px;
    box-shadow: -4px 4px 20px rgba(0,0,0,0.6);
}

.modal-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 4px;
}

.modal-tag {
    font-family: 'Geist Mono', monospace;
    font-size: 10px;
    font-weight: 300;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.25);
}

.modal-title {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 28px;
    font-weight: 400;
    color: white;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.modal-author {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 16px;
    font-style: italic;
    color: rgba(255,255,255,0.4);
    line-height: 1.3;
}

.modal-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 4px;
}

.modal-stars {
    display: flex;
    gap: 3px;
}

.modal-stars span {
    font-size: 14px;
    color: rgba(255,255,255,0.25);
}

.modal-stars[data-rating="1"] span:nth-child(-n+1),
.modal-stars[data-rating="2"] span:nth-child(-n+2),
.modal-stars[data-rating="3"] span:nth-child(-n+3),
.modal-stars[data-rating="4"] span:nth-child(-n+4),
.modal-stars[data-rating="5"] span:nth-child(-n+5) {
    color: rgba(255,255,255,0.8);
}

.modal-date {
    font-family: 'Geist Mono', monospace;
    font-size: 10px;
    font-weight: 300;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.2);
}

.modal-review {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: 17px;
    color: rgba(255,255,255,0.55);
    line-height: 1.6;
    letter-spacing: 0.01em;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 16px;
    margin-top: 4px;
}

@media screen and (max-width: 600px) {
    .modal-inner {
        grid-template-columns: 1fr;
        gap: 24px;
        padding: 32px 24px;
    }

    .modal-cover-wrap {
        max-width: 140px;
    }
}

/* Responsive */

@media screen and (max-width: 768px) {
    .books-hero {
        padding: 60px 24px 30px;
    }

    .books-section .container {
        padding: 0 24px;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 32px 20px;
    }

    .book-card:hover .book-cover-wrap {
        transform: translateY(-8px) rotate(-1deg);
    }

      .modal-inner {
        grid-template-columns: 1fr;
        gap: 12px;
        padding: 32px 24px;
    }

    .modal-cover-wrap {
        max-width: 140px;
        margin: 0 auto;
    }

    .modal-content {
        text-align: center;
    }

    .modal-stars {
        justify-content: center;
    }

    .modal-review {
        text-align: left;
    }

    .books-hero .container,
    .books-title {
        text-align: center;
    }
    
    header {
        justify-content: center;
    }

}

@media (hover: none) {
    .book-card:hover .book-cover-wrap {
        transform: none;
        filter: none;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}