/* OAKOKHO BOOKS - MAGAZINE READER CSS */

/* BASE RESET — READER ADDS OVERFLOW AND HEIGHT VIA .reader-open CLASS */
body,
html {
    margin: 0;
    padding: 0;
    background: #2a2a2a;
}

/* DISABLE SELECTION */
body {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -khtml-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* CANVAS */
#canvas {
    width: 100%;
    height: 100%;
    position: relative;
}

/* MAGAZINE VIEWPORT */
.magazine-viewport {
    width: 100%;
    height: 100%;
    position: relative;
}

.magazine-viewport .magazine-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.magazine-viewport .magazine {
    position: relative;
}

/* PAGE */
.magazine-viewport .page {
    background-color: white;
    background-repeat: no-repeat;
    background-size: 100% 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.magazine-viewport .page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    margin: 0;
    padding: 0;
}

/* PAGE SHADOWS */
.magazine .page {
    -webkit-box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    -moz-box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
}

/* GRADIENTS */
.magazine .even .gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to right, rgba(0, 0, 0, 0) 95%, rgba(0, 0, 0, 0.2) 100%);
}

.magazine .odd .gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to left, rgba(0, 0, 0, 0) 95%, rgba(0, 0, 0, 0.15) 100%);
}

/* ANIMATED TRANSITIONS */
.animated {
    -webkit-transition: margin-left 0.5s;
    -moz-transition: margin-left 0.5s;
    transition: margin-left 0.5s;
}

/* =====================================================
   BOOK DETAILS SECTION (book.php — page chrome around the
   reader, not the flipbook canvas itself)
   ===================================================== */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
}

header {
    flex-shrink: 0;
}

.book-details-wrapper {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex: 1;
    display: flex;
    align-items: center;
    padding: 20px;
}

.book-details-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    gap: 30px;
    align-items: center;
}

.book-cover-preview {
    flex-shrink: 0;
}

.book-cover-preview img {
    width: auto;
    height: 400px;
    max-height: 60vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.book-info-preview {
    flex: 1;
}

.book-info-preview h1 {
    font-size: 2.5em;
    margin: 0 0 10px 0;
    font-weight: 700;
    font-family: 'Noto Serif Bengali', serif;
}

.book-info-preview .author {
    font-size: 1.2em;
    opacity: 0.9;
    margin-bottom: 15px;
}

.book-meta-preview {
    display: flex;
    gap: 15px;
    margin: 15px 0;
    flex-wrap: wrap;
}

.book-meta-preview span {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
}

.book-info-preview p {
    margin: 15px 0;
    line-height: 1.6;
    font-size: 1.1em;
}

.book-actions-preview {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn-start-reading {
    background: white;
    color: #667eea;
    padding: 15px 40px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1.2em;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    font-family: 'Noto Serif Bengali', serif;
}

.btn-start-reading:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

.btn-book-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 25px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 1em;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s;
    border: 2px solid white;
    cursor: pointer;
    text-decoration: none;
    font-family: 'Noto Serif Bengali', serif;
}

.btn-book-secondary:hover {
    background: white;
    color: #667eea;
}

/* =====================================================
   READER OVERLAY
   ===================================================== */
/* LOCK SCROLL AND FILL VIEWPORT ONLY WHEN READER OVERLAY IS ACTIVE */
body.reader-open,
body.reader-open html {
    overflow: hidden;
    height: 100%;
}

#reader-section {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #2a2a2a;
    z-index: 9999;
}

#reader-section.active {
    display: block;
}

.hover-controls {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 10001;
    display: flex;
    gap: 10px;
    opacity: 0;
    transition: opacity 0.3s;
}

body.reader-open:hover .hover-controls {
    opacity: 1;
}

.control-btn {
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s;
}

.control-btn:hover {
    background: #667eea;
    transform: scale(1.1);
}

.control-btn.close-btn {
    background: rgba(231, 76, 60, 0.9);
}

.control-btn.close-btn:hover {
    background: #c0392b;
}

/* PAGE INDICATOR — BOTTOM RIGHT, COMPACT */
.page-info {
    position: fixed;
    bottom: 12px;
    right: 16px;
    left: auto;
    transform: none;
    background: rgba(0, 0, 0, 0.7);
    padding: 6px 14px;
    border-radius: 14px;
    color: white;
    z-index: 10000;
    font-family: 'Noto Serif Bengali', serif;
    font-size: 0.85rem;
}

/* =====================================================
   MOBILE
   ===================================================== */
@media (max-width: 768px) {
    /* COMPRESS PADDING AND ALIGN TO TOP ON MOBILE */
    .book-details-wrapper {
        padding: clamp(8px, 2vw, 20px);
        align-items: flex-start;
    }

    /* TIGHTEN GAP BETWEEN COVER AND INFO ON MOBILE */
    .book-details-container {
        flex-direction: column;
        text-align: center;
        gap: clamp(10px, 2vw, 30px);
    }

    /* SHRINK COVER IMAGE ON SMALL VIEWPORTS */
    .book-cover-preview img {
        height: clamp(140px, 28vh, 300px);
        max-height: 28vh;
    }

    /* SCALE ASSAMESE TITLE DOWN ON MOBILE */
    .book-info-preview h1 {
        font-size: clamp(1.2rem, 5vw, 1.8em);
        margin: 0 0 clamp(4px, 1vw, 10px) 0;
    }

    /* SCALE SECONDARY TEXT */
    .book-info-preview .title-en,
    .book-info-preview .author {
        font-size: clamp(0.8rem, 3vw, 1.2em);
        margin-bottom: clamp(4px, 1vw, 15px);
    }

    /* TIGHTEN META BADGES ROW */
    .book-meta-preview {
        gap: clamp(6px, 1.5vw, 15px);
        margin: clamp(6px, 1.5vw, 15px) 0;
    }

    /* SHRINK BADGE PADDING AND TEXT */
    .book-meta-preview span {
        font-size: clamp(0.7rem, 2.5vw, 0.9em);
        padding: clamp(4px, 1vw, 8px) clamp(8px, 2vw, 15px);
    }

    /* DESCRIPTION IS THE BIGGEST OFFENDER — COMPRESS HARD */
    .book-info-preview p {
        font-size: clamp(0.75rem, 2.5vw, 1.1em);
        margin: clamp(4px, 1vw, 15px) 0;
        /* LIMIT TO 3 LINES ON MOBILE WITH ELLIPSIS TO PREVENT OVERFLOW */
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    /* ICON ROW — CENTERED, FIXED GAP, NO WRAP */
    .book-actions-preview {
        justify-content: center;
        margin-top: clamp(8px, 2vw, 20px);
        gap: 12px;
        flex-wrap: nowrap;
    }

    /* ICON-ONLY BUTTONS ON MOBILE — HIDE TEXT VIA font-size: 0, RESTORE ON ICON */
    .book-actions-preview .btn-start-reading,
    .book-actions-preview .btn-book-secondary {
        flex: 0 0 auto;
        justify-content: center;
        min-width: 44px;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        padding: 0;
        font-size: 0;
        gap: 0;
    }

    /* RESTORE ICON SIZE INSIDE THE ZERO-FONT BUTTON */
    .book-actions-preview .btn-start-reading i,
    .book-actions-preview .btn-book-secondary i {
        font-size: 1.1rem;
    }

    /* SMALLER CONTROL BUTTONS ON MOBILE — LESS INTRUSIVE */
    .hover-controls {
        top: clamp(8px, 2vh, 20px);
        left: clamp(8px, 2vw, 20px);
        gap: clamp(6px, 1.5vw, 10px);
    }

    .control-btn {
        width: clamp(36px, 8vw, 44px);
        height: clamp(36px, 8vw, 44px);
        font-size: clamp(14px, 3.5vw, 18px);
        border-width: 1.5px;
    }

    /* REMOVE DARK GAP ABOVE BOOK — CONTROLS ARE FIXED SO CANVAS CAN START AT TOP */
    #reader-section {
        background: #000;
    }

    /* MAKE HOVER CONTROLS ALWAYS VISIBLE ON MOBILE — NO HOVER STATE ON TOUCH */
    body.reader-open .hover-controls {
        opacity: 1;
    }

    /* ALIGN BOOK TO TOP ON MOBILE — ELIMINATES DARK BAR ABOVE */
    .magazine-viewport .magazine-container {
        top: clamp(44px, 9vh, 60px);
        transform: translateX(-50%);
    }

}