/* ==========================================================================
   IMungro — Books Grid & Single Book Page Styles
   ========================================================================== */

/* ==========================================================================
   Books Grid Page  (/books/) — 100vh fixed, no scroll
   Book covers flex/shrink to fit however many books exist.
   ========================================================================== */

.im-books-page {
    height: 100vh;
    max-height: 100vh;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1600px;
    margin: 0 auto;
    padding: 80px 2rem 2rem; /* 80px header height + bottom margin */
}

/* Flex container — items shrink equally to fit viewport */
.im-books-flex {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    width: 100%;
    height: 100%;
    padding: 1rem 0;
}

/* Individual book card — flex item that shrinks */
.im-book-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 0 1 auto; /* can shrink, won't grow beyond content */
    max-width: 220px;
    min-width: 120px; /* won't shrink below this */
}

.im-book-card-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: inherit;
    width: 100%;
}

/* Book cover — aspect ratio 2:3, shrinks with flex */
.im-book-cover {
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
    margin-bottom: 0.75rem;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
    transition: box-shadow 0.4s ease, transform 0.4s ease;
    position: relative;
}

.im-book-cover::after {
    content: '';
    position: absolute;
    inset: -6px;
    background: radial-gradient(circle at 50% 50%, rgba(0, 210, 255, 0.08) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
    z-index: -1;
}

.im-book-card:hover .im-book-cover {
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 210, 255, 0.1);
    transform: translateY(-4px);
}

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

.im-book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.im-book-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--im-surface-container);
    color: var(--im-on-surface-variant);
    font-family: var(--im-font-display);
    font-size: 0.9rem;
    text-align: center;
    padding: 0.75rem;
}

.im-book-title {
    font-family: var(--im-font-display);
    font-size: clamp(0.8rem, 1.5vw, 1.1rem);
    font-weight: 600;
    color: var(--im-primary);
    margin: 0 0 0.75rem;
    line-height: 1.3;
    transition: color var(--im-transition-base);
}

.im-book-card:hover .im-book-title {
    color: var(--im-secondary-container);
}

/* View button — slim, centered */
.im-book-view-btn {
    padding: 0.4rem 1.5rem;
    font-size: 11px;
    letter-spacing: 0.1em;
    white-space: nowrap;
}

.im-books-empty {
    text-align: center;
    color: var(--im-on-surface-variant);
    font-style: italic;
    padding: 2rem 0;
    width: 100%;
}

/* Arrow-focus highlight (when navigating with arrows) */
.im-book-card .im-arrow-focused,
.im-book-card a.im-arrow-focused {
    outline: 2px solid var(--im-secondary-container);
    outline-offset: 4px;
}


/* ==========================================================================
   Single Book Page  (/books/book-slug/)
   ========================================================================== */

.im-single-book {
    padding: 100px 2rem 2rem;
    min-height: 100vh;
    max-width: 1600px;
    margin: 0 auto;
}

/* Volume label — small caps gold text above the grid */
.im-book-volume-label {
    font-family: var(--im-font-nav);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--im-primary);
    margin: 0 0 2rem;
}

.im-single-book-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 4rem;
    align-items: start;
}

/* LEFT side — title above cover, centered */
.im-book-left {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: sticky;
    top: 100px;
}

.im-book-title-large {
    font-family: var(--im-font-display);
    font-size: clamp(1.5rem, 3vw, 2.25rem);
    font-weight: 700;
    color: var(--im-primary-fixed-dim, var(--im-primary));
    letter-spacing: -0.02em;
    margin: 0 0 1.5rem;
    line-height: 1.15;
    text-transform: uppercase;
}

/* Book cover with atmospheric glow behind it */
.im-book-cover-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.im-book-cover-glow {
    position: absolute;
    inset: -40px;
    background: radial-gradient(circle at 50% 50%, rgba(0, 210, 255, 0.06) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.im-book-cover-large {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 300px;
    aspect-ratio: 2/3;
    overflow: hidden;
    filter: drop-shadow(0 25px 50px rgba(0, 0, 0, 0.8));
    transition: filter 0.5s ease;
}

.im-book-cover-large:hover {
    filter: drop-shadow(0 30px 60px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 30px rgba(0, 210, 255, 0.1));
}

.im-book-cover-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* RIGHT side — description + testimonials + buttons */
.im-book-right {
    display: flex;
    flex-direction: column;
}

.im-book-description {
    font-family: var(--im-font-body);
    font-size: 16px;
    line-height: 1.7;
    color: var(--im-on-surface);
    margin-bottom: 2.5rem;
    max-width: 540px;
}

.im-book-description p {
    margin-bottom: 1.25rem;
}

/* Quote-styled divider with testimonials */
.im-book-testimonials {
    margin-bottom: 3rem;
}

.im-quote-top,
.im-quote-bottom {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.im-quote-top {
    margin-bottom: 1.5rem;
}

.im-quote-bottom {
    margin-top: 1.5rem;
}

/* Opening quote mark — left side, above the line */
.im-quote-mark-open {
    font-family: var(--im-font-display);
    font-size: 1.75rem;
    color: var(--im-primary);
    line-height: 1;
    opacity: 0.7;
    flex-shrink: 0;
}

/* Horizontal line — extends right from the opening mark */
.im-quote-line-h {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--im-outline-variant), transparent);
}

/* Bottom line — extends left toward the closing mark */
.im-quote-bottom .im-quote-line-h {
    background: linear-gradient(90deg, transparent, var(--im-outline-variant));
}

/* Closing quote mark — right side, below the line */
.im-quote-mark-close {
    font-family: var(--im-font-display);
    font-size: 1.75rem;
    color: var(--im-primary);
    line-height: 1;
    opacity: 0.7;
    flex-shrink: 0;
}

/* Testimonial rotator — fades in/out automatically */
.im-testimonial-rotator {
    position: relative;
    min-height: 120px;
    text-align: center;
    padding: 0 1rem;
}

.im-testimonial-item {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    transition: opacity 1s ease-in-out;
    pointer-events: none;
}

.im-testimonial-item.active {
    opacity: 1;
    pointer-events: auto;
    position: relative;
}

.im-testimonial-text {
    font-family: var(--im-font-body);
    font-size: 1.0625rem;
    font-style: italic;
    color: var(--im-on-surface-variant);
    line-height: 1.7;
    margin: 0 0 1rem;
}

.im-testimonial-author {
    font-family: var(--im-font-nav);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--im-primary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin: 0;
}

/* Action buttons */
.im-book-actions {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Outline button variant for "Read Sample" */
.im-btn--outline {
    background: transparent;
    border: 1px solid var(--im-outline-variant);
    color: var(--im-on-surface);
}

.im-btn--outline:hover {
    border-color: var(--im-primary);
    color: var(--im-primary);
    box-shadow: none;
}


/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
    .im-single-book-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .im-book-left {
        position: static;
    }

    .im-book-cover-large {
        max-width: 280px;
    }

    /* Books grid on tablet — smaller covers, tighter gap */
    .im-books-flex {
        gap: 1.5rem;
    }

    .im-book-card {
        max-width: 180px;
        min-width: 100px;
    }
}

@media (max-width: 600px) {
    .im-books-page {
        padding: 70px 1rem 1rem;
    }

    .im-books-flex {
        gap: 1rem;
    }

    .im-book-card {
        max-width: 150px;
        min-width: 90px;
    }

    .im-book-title {
        font-size: 0.75rem;
    }

    .im-book-view-btn {
        padding: 0.35rem 1rem;
        font-size: 10px;
    }

    .im-book-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .im-book-actions .im-btn {
        text-align: center;
    }

    .im-book-title-large {
        font-size: 1.5rem;
    }

    .im-book-cover-large {
        max-width: 220px;
    }
}
