/* Custom 3D Book Layout */
.book-container {
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 2500px;
    margin: 6rem auto;
    width: 100%;
    z-index: 2;
    transition: transform 0.5s ease;
}

.book {
    position: relative;
    width: 450px;
    height: 600px;
    transform-style: preserve-3d;
    transition: transform 1s ease;
}

/* On desktop, center the book initially, and when it opens, shift to right */
@media (min-width: 993px) {
    .book {
        transform: translateX(0);
    }
    .book.open {
        transform: translateX(225px);
    }
}

.book-page {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    transform-origin: left center;
    transition: transform 1s cubic-bezier(0.645, 0.045, 0.355, 1), box-shadow 0.4s ease;
    transform-style: preserve-3d;
    cursor: grab;
}

.book-page:active {
    cursor: grabbing;
}

/* Interactive page curl hints */
.book-page:hover:not(.flipped) {
    transform: rotateY(-3deg);
    box-shadow: 0 10px 30px rgba(0, 240, 255, 0.1);
}

.book-page.flipped {
    transform: rotateY(-180deg);
}

.book-page.flipped:hover {
    transform: rotateY(-177deg);
    box-shadow: -5px 10px 30px rgba(0, 240, 255, 0.1);
}

.page-front, .page-back {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    padding: 3.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    /* Solid background behind glass to avoid text overlapping pages */
    background: var(--bg-dark) !important;
    border: 1px solid var(--glass-border);
    box-shadow: 5px 15px 45px rgba(0,0,0,0.6);
    border-radius: 10px;
    overflow: hidden;
}

/* Spine styles */
.page-front::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 25px;
    height: 100%;
    background: linear-gradient(to right, rgba(255,255,255,0.1), transparent);
    border-radius: 10px 0 0 10px;
    z-index: 10;
    pointer-events: none;
}

.page-back {
    transform: rotateY(180deg);
}
.page-back::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 25px;
    height: 100%;
    background: linear-gradient(to left, rgba(255,255,255,0.1), transparent);
    border-radius: 0 10px 10px 0;
    z-index: 10;
    pointer-events: none;
}

.page-content h3 {
    color: var(--color-primary);
    margin-bottom: 0.8rem;
    font-size: 2rem;
    line-height: 1.3;
}
.page-content h4 {
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
    font-weight: 500;
}
.page-content .date {
    display: block;
    color: var(--color-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 2rem;
}
.page-content p {
    color: var(--text-muted);
    line-height: 1.8;
    font-size: 1.1rem;
}

.page-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.turn-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    font-family: inherit;
    font-weight: 600;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    padding: 0.8rem 1.5rem;
    border-radius: 30px;
    outline: none;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}
.turn-btn:hover {
    color: var(--bg-dark);
    background: var(--gradient-1);
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0,240,255,0.4);
}

.page-num {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 800;
}

/* Compact list styles for combined book pages */
.page-content.compact {
    padding-top: 0;
}
.page-content.compact .page-title {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 0.5rem;
    color: var(--color-primary);
}
.page-content.compact .exp-item {
    margin-bottom: 1.1rem;
}
.page-content.compact .exp-item:last-child {
    margin-bottom: 0;
}
.page-content.compact .role {
    color: var(--text-main);
    font-size: 1.15rem;
    margin-bottom: 0.2rem;
    font-weight: 600;
}
.page-content.compact .company {
    color: var(--color-secondary);
    font-size: 1rem;
    font-weight: 500;
}
.page-content.compact .date {
    display: block;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}
.page-content.compact p {
    color: var(--text-muted);
    line-height: 1.5;
    font-size: 0.95rem;
}

/* Mobile Adjustments - Journey Card (Under 993px) */
@media (max-width: 992px) {
    .book-container {
        display: block;
        perspective: none;
        margin: 2rem auto;
        padding: 0;
        width: 100%;
        max-width: 500px;
        transition: all 0.5s ease;
    }

    .journey-mobile-cover {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 4rem 2rem;
        text-align: center;
        min-height: 400px;
    }

    .book {
        display: none; /* Hidden until toggled */
        width: 100%;
        height: auto;
        max-height: 70vh;
        overflow-y: auto;
        padding: 1rem;
        background: rgba(10, 10, 15, 0.4);
        border-radius: 20px;
        border: 1px solid var(--glass-border);
        scrollbar-width: thin;
        scrollbar-color: var(--color-primary) transparent;
        padding-top: 4rem; /* Space for fixed header */
        position: relative;
    }

    .book::-webkit-scrollbar {
        width: 6px;
    }
    .book::-webkit-scrollbar-thumb {
        background: var(--color-primary);
        border-radius: 10px;
    }

    /* Shown State */
    .book-container.is-open .journey-mobile-cover {
        display: none;
    }
    .book-container.is-open .book {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .mobile-journey-header {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        padding: 0.8rem;
        display: flex;
        justify-content: flex-end;
        z-index: 100;
        background: rgba(10, 10, 15, 0.9);
        backdrop-filter: blur(10px);
        border-bottom: 1px solid var(--glass-border);
        border-radius: 20px 20px 0 0;
    }

    .book-page {
        position: relative;
        width: 100%;
        height: auto;
        transform: none !important;
        margin: 0;
        z-index: 1 !important;
    }
    .page-front, .page-back {
        position: relative;
        width: 100%;
        height: auto !important;
        transform: none !important;
        backface-visibility: visible;
        padding: 2rem;
        border-radius: 15px;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        margin-bottom: 1rem;
    }
    .page-back {
        margin-top: 0;
    }
    .page-front::before, .page-back::before {
        display: none;
    }
    .turn-btn, .page-num {
        display: none;
    }
}

/* Hide mobile-specific header on desktop */
@media (min-width: 993px) {
    .journey-mobile-cover, .mobile-journey-header {
        display: none;
    }
}
