/* Card Border Radius Update */
.book-card {
    border-radius: 24px;
}

/* ========== NAVIGATION ========== */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
    transition: all 0.4s ease;
    background: rgba(5, 7, 10, 0.8);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: var(--text-accent);
    text-shadow: 0 0 10px var(--text-accent-glow);
    letter-spacing: 2px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-links {
    display: flex;
    gap: 3rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links a:hover {
    color: var(--text-accent);
}

/* ========== HERO SECTION ========== */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 8rem 2rem 4rem;
    position: relative;
}

.hero-content {
    max-width: 900px;
}

.hero-title {
    font-size: clamp(3rem, 6vw, 5rem);
    background: linear-gradient(135deg, #fff 0%, #ffd700 50%, #a5a5a5 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: 1px;
}

.hero-subtitle {
    font-size: 1.3rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-style: italic;
    font-family: var(--font-heading);
    line-height: 1.9;
}

.stats-container {
    display: flex;
    justify-content: center;
    gap: 4rem;
    margin-top: 3rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-accent);
    font-family: var(--font-heading);
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
}

.scroll-indicator {
    position: absolute;
    bottom: 4rem;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll-bounce 2.5s ease-in-out infinite;
    cursor: pointer;
}

.scroll-indicator i {
    font-size: 2rem;
    color: var(--text-accent);
    filter: drop-shadow(0 0 8px var(--text-accent-glow));
}

@keyframes scroll-bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }

    40% {
        transform: translateX(-50%) translateY(-15px);
        opacity: 0.7;
    }

    60% {
        transform: translateX(-50%) translateY(-8px);
        opacity: 0.85;
    }
}

/* ========== SECTIONS ========== */
section {
    min-height: 100vh;
    padding: 6rem 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.section-content {
    max-width: 1400px;
    width: 100%;
}

.section-label {
    display: block;
    text-align: center;
    color: var(--text-accent);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 1rem;
    font-weight: 600;
}

.section-title {
    text-align: center;
    font-size: 3.5rem;
    margin-bottom: 4rem;
    color: #fff;
    font-weight: 600;
    letter-spacing: 1px;
    font-family: var(--font-heading);
}

/* ========== BOOKS GRID ========== */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 3rem;
    margin-top: 3rem;
}

.book-card {
    background: var(--glass-bg);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: var(--shadow-soft);
    position: relative;
    z-index: 1;
}

.book-card.is-open {
    z-index: 100 !important;
}

.book-cover-container {
    position: relative;
    width: 100%;
    height: 450px;
    perspective: 2000px;
    background: transparent;
    display: flex;
    justify-content: center;
    align-items: center;
}

.book-3d-object {
    position: relative;
    width: 260px;
    height: 380px;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.23, 1, 0.32, 1);
    transform: rotateY(-20deg) rotateX(5deg);
    cursor: pointer;
}

.book-card.is-open .book-3d-object {
    transform: rotateY(0deg) rotateX(0deg) scale(1.1);
}

/* COVER GROUP */
.book-3d-cover {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(0.645, 0.045, 0.355, 1);
    transform-origin: left;
    z-index: 10;
}

.book-card.is-open .book-3d-cover {
    transform: rotateY(-160deg);
    pointer-events: none;
    /* Let touches pass through to the pages */
}

.book-3d-front,
.book-3d-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 2px 5px 5px 2px;
}

.book-3d-front {
    background: #222;
    z-index: 2;
}

.book-3d-back {
    background: #f0f0f0;
    transform: rotateY(180deg);
    box-shadow: inset 10px 0 30px rgba(0, 0, 0, 0.1);
    border-left: 1px solid #ddd;
}

/* INNER PAGES */
.book-3d-pages {
    position: absolute;
    width: 98%;
    height: 98%;
    top: 1%;
    left: 1%;
    background: #fff;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.2);
    transform: translateZ(-2px);
    z-index: 1;
    overflow: hidden;
    /* Changed to allow inner content scroll to be visible */
    border-radius: 0 3px 3px 0;
}

.book-inner-content {
    padding: 2.5rem 2rem;
    color: #333;
    opacity: 0;
    transition: opacity 0.5s ease 0.4s;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;

    /* Mobile-specific scroll improvements */
    -webkit-overflow-scrolling: touch;
    /* Kinetic scrolling for iOS */
    overscroll-behavior: contain;
    /* Prevent scrolling the body when reaching ends */
    touch-action: pan-y;
    /* Allow vertical panning, prevent page moves */

    scrollbar-width: thin;
    scrollbar-color: var(--text-accent) transparent;
}

/* Custom scrollbar for book pages */
.book-inner-content::-webkit-scrollbar {
    width: 4px;
}

.book-inner-content::-webkit-scrollbar-track {
    background: transparent;
}

.book-inner-content::-webkit-scrollbar-thumb {
    background: var(--text-accent);
    border-radius: 10px;
    opacity: 0.5;
}

.book-inner-content::-webkit-scrollbar-thumb:hover {
    background: #b8860b;
}

.book-card.is-open .book-inner-content {
    opacity: 1;
}

.book-inner-content .book-title {
    font-size: 1.6rem !important;
    margin-bottom: 0.5rem;
    color: #111 !important;
    font-family: var(--font-heading);
    border-bottom: 2px solid var(--text-accent);
    padding-bottom: 0.5rem;
}

.book-inner-content .book-author {
    font-size: 1rem;
    color: var(--text-accent);
    font-style: italic;
    margin-bottom: 1.5rem;
}

.book-inner-content .book-description {
    font-size: 0.95rem;
    line-height: 1.6;
    color: #444;
    margin-bottom: 2rem;
    text-align: left;
}

.book-inner-content .book-meta {
    margin-top: auto;
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #777;
}

.book-instruction {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: #999;
    margin-top: 1rem;
    text-align: center;
    border-top: 1px solid #eee;
    padding-top: 1rem;
}

.book-3d-side {
    position: absolute;
    width: 20px;
    height: 100%;
    background: #111;
    left: 0;
    transform: rotateY(-90deg);
    transform-origin: left;
}

.book-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    align-items: flex-end;
    padding: 1.5rem;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.book-card:hover:not(.is-open) .book-overlay {
    opacity: 1;
}

.book-rating {
    color: var(--text-accent);
    font-size: 1.2rem;
}

.book-rating i {
    margin-right: 0.25rem;
}

.book-info {
    padding: 2rem;
}

.book-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
}

.book-author {
    font-size: 1.1rem;
    color: var(--text-accent);
    margin-bottom: 1rem;
    font-style: italic;
}

.book-meta {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.book-genre,
.book-pages {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.book-description {
    color: var(--text-secondary);
    line-height: 1.9;
    margin-bottom: 1.5rem;
    text-align: justify;
}

.book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.tag {
    padding: 0.5rem 1rem;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    font-size: 0.85rem;
    color: var(--text-accent);
    transition: all 0.3s ease;
}

.tag:hover {
    background: rgba(255, 215, 0, 0.2);
    transform: translateY(-2px);
}

/* ========== QUOTE SECTION ========== */
#quote-section {
    min-height: 60vh;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.05) 0%, transparent 100%);
}

.quote-container {
    max-width: 800px;
    text-align: center;
    padding: 4rem 2rem;
    position: relative;
}

.quote-icon {
    font-size: 4rem;
    color: var(--text-accent);
    opacity: 0.3;
    margin-bottom: 2rem;
}

.quote-text {
    font-size: 2rem;
    font-family: var(--font-heading);
    font-style: italic;
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 2rem;
    white-space: normal;
    text-align: center;
    max-width: 85%;
    margin-left: auto;
    margin-right: auto;
    text-wrap: balance;
}

@media (max-width: 768px) {
    .quote-text {
        font-size: 1.35rem;
        line-height: 1.5;
        max-width: 100%;
    }
}

.quote-author {
    font-size: 1.2rem;
    color: var(--text-accent);
    font-weight: 600;
}

/* ========== FOOTER ========== */
footer {
    padding: 3rem 2rem;
    text-align: center;
    border-top: 1px solid var(--glass-border);
    background: rgba(0, 0, 0, 0.5);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.footer-content p {
    color: var(--text-secondary);
}

.footer-content i {
    color: var(--text-accent);
}

.back-home {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 2rem;
    background: linear-gradient(45deg, #d4af37, #f7d767);
    color: #000;
    font-weight: 600;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

.back-home:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.4);
}

/* ========== CLICK HINTS & INSTRUCTIONS ========== */
.click-instruction {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: var(--text-accent);
    letter-spacing: 2px;
    text-transform: uppercase;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.click-instruction i {
    font-size: 1rem;
    animation: pulseMouse 2s infinite;
}

@keyframes pulseMouse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.click-hint {
    background: var(--text-accent);
    color: #000;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1rem;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.book-card:hover:not(.is-open) .click-hint {
    transform: translateY(0);
    opacity: 1;
}

.click-hint i {
    animation: bounceRight 0.8s infinite alternate;
}

@keyframes bounceRight {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(5px);
    }
}

/* ========== RESPONSIVE CLEANUP ========== */
@media (max-width: 768px) {
    .books-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        padding: 0 0.5rem;
    }

    .book-card {
        max-width: 100%;
        margin: 0;
    }

    .book-cover-container {
        height: 350px;
    }

    .book-3d-object {
        width: 180px;
        height: 270px;
    }

    .book-inner-content {
        padding: 1.25rem;
    }

    .book-inner-content .book-title {
        font-size: 1.2rem !important;
        line-height: 1.3;
    }

    .book-inner-content .book-description {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    .hero-content {
        padding: 0 1rem;
    }
}

/* ========== MIND BOX CSS ========== */
.mind-box-section {
    padding: 0 1.5rem 4rem;
    display: flex;
    justify-content: center;
    align-items: center;
    background: transparent;
}

#mind-box-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 100%;
    max-width: 600px;
}

.mind-box {
    width: 100%;
    min-height: 250px;
    background: rgba(20, 20, 30, 0.6);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2.5rem;
    text-align: center;
    transform-style: preserve-3d;
}

.box-lid {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    background: radial-gradient(circle at center, rgba(255, 215, 0, 0.1), transparent 70%);
    transition: 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.lid-icon {
    font-size: 3.5rem;
    color: var(--text-accent);
    margin-bottom: 1.5rem;
    filter: drop-shadow(0 0 15px rgba(255, 215, 0, 0.4));
    animation: pulse 3s infinite ease-in-out;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        opacity: 0.8;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.lid-text {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: var(--text-primary);
    margin-bottom: 0.8rem;
    letter-spacing: 1px;
}

.lid-sub {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* OPEN STATE */
.mind-box.open {
    border-color: var(--text-accent);
    box-shadow: 0 0 50px rgba(255, 215, 0, 0.15);
}

.mind-box.open .box-lid {
    opacity: 0;
    transform: translate(-50%, -200%) scale(0.5);
    pointer-events: none;
}

.box-content {
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
    width: 100%;
    z-index: 5;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.mind-box.open .box-content {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.quote-display {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-style: italic;
    color: #fff;
    margin-bottom: 1.5rem;
    line-height: 1.6;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
    max-width: 90%;
}

.quote-source-display {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text-accent);
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.my-thought {
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: #ddd;
    background: linear-gradient(90deg, rgba(255, 215, 0, 0.05), transparent);
    padding: 1.2rem;
    border-radius: 8px;
    border-left: 3px solid var(--text-accent);
    text-align: left;
    width: 100%;
    line-height: 1.6;
}

.thought-label {
    display: block;
    font-weight: 700;
    color: var(--text-accent);
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* Button */
.mind-btn {
    background: transparent;
    border: 1px solid var(--text-accent);
    color: var(--text-accent);
    padding: 1rem 2.5rem;
    border-radius: 50px;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.9rem;
    position: relative;
    overflow: hidden;
    margin-top: 1rem;
}

.mind-btn:hover {
    background: var(--text-accent);
    color: #000;
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.4);
    transform: translateY(-2px);
}

/* Particles */
.box-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.box-particles span {
    position: absolute;
    bottom: 20%;
    width: 4px;
    height: 4px;
    background: var(--text-accent);
    border-radius: 50%;
    opacity: 0;
    animation: particleUp 2s ease-out forwards;
}

@keyframes particleUp {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.8;
    }

    100% {
        transform: translateY(-150px) scale(0);
        opacity: 0;
    }
}

/* ========== PERSONA SWITCHER ========== */
.persona-switch-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 1rem;
    margin-right: auto;
}

.switch-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}

.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: #fff;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: #ff0055;
    box-shadow: 0 0 10px rgba(255, 0, 85, 0.5);
    border-color: #ff0055;
}

input:checked+.slider:before {
    transform: translateX(20px);
    background-color: #fff;
}

/* MAD PERSONA STYLES */
body.mode-crazy {
    --text-accent: #ff0055;
    --font-heading: 'Patrick Hand', cursive;
    --font-body: 'Patrick Hand', cursive;
}

@media (max-width: 768px) {
    #navbar {
        padding: 0.7rem 1rem;
        justify-content: space-between;
        height: 60px;
    }

    .logo {
        font-size: 1.1rem;
        white-space: nowrap;
        max-width: 40%;
    }

    .persona-switch-container {
        margin: 0 auto 0 10px;
        gap: 0;
    }

    .switch-label {
        display: none !important;
    }

    .switch {
        transform: scale(0.8);
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: rgba(5, 7, 10, 0.98);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 1001;
    }

    .menu-toggle {
        display: block;
    }
}