/* Global Reset & Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500&family=Playfair+Display:wght@400;700&display=swap');

:root {
    --bg-color: #1a1a1a;
    --text-color: #e5e5e5;
    --accent-color: #ff4500;
    /* Orange-red for accents like the logo in the reference */
    --spine-width: 60px;
    --expanded-width: 300px;
    --shelf-height: 500px;
}

body {
    font-family: 'Inter', sans-serif;
    /* Monospace/Clean sans for UI */
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Prevent body scroll, handle internally */
}

/* Typography */
h1,
h2,
h3 {
    font-family: 'Playfair Display', serif;
    /* Serif for titles */
    font-weight: 400;
}

.mono-text {
    font-family: 'Courier New', Courier, monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.8rem;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 40px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 100;
    background: var(--bg-color);
}

.header-left,
.header-right {
    flex: 1;
}

.header-center {
    text-align: center;
}

.logo-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    color: var(--accent-color);
    letter-spacing: 2px;
}

.logo-sub {
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    color: white;
    margin-left: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--text-color);
    padding: 5px 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: white;
    color: black;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    justify-content: center;
    padding: 15px 0;
    gap: 10px;
}

.filter-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.6);
    padding: 5px 15px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.3s;
}

.filter-btn.active,
.filter-btn:hover {
    background: white;
    color: black;
    border-color: white;
}

/* Main Shelf Area */
.shelf-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 40px;
    perspective: 1000px;
}

.shelf {
    display: flex;
    height: var(--shelf-height);
    align-items: center;
    gap: 5px;
}

/* Spine / Book Item */
.book-item {
    position: relative;
    height: 100%;
    width: var(--spine-width);
    transition: width 0.5s cubic-bezier(0.25, 1, 0.5, 1), transform 0.3s;
    cursor: pointer;
    overflow: hidden;
    /* Base spine color fallback */
    background-color: #222;
    /* Realistic Spine Borders */
    border-left: 2px solid rgba(255, 255, 255, 0.15);
    /* Highlight edge */
    border-right: 1px solid rgba(0, 0, 0, 0.8);
    /* Shadow edge */
    box-shadow:
        inset 2px 0 5px rgba(255, 255, 255, 0.1),
        /* Inner highlight */
        inset -2px 0 10px rgba(0, 0, 0, 0.5),
        /* Inner shadow for roundness */
        5px 0 15px rgba(0, 0, 0, 0.6);
    /* Drop shadow */
}

/* Texture Overlay */
.book-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    /* Noise texture for "paper/cloth" feel + Spine lighting gradient */
    background:
        linear-gradient(90deg,
            rgba(255, 255, 255, 0.1) 0%,
            rgba(255, 255, 255, 0) 20%,
            rgba(0, 0, 0, 0) 50%,
            rgba(0, 0, 0, 0.4) 85%,
            rgba(0, 0, 0, 0.6) 100%),
        url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSI1MDAiIGhlaWdodD0iNTAwIj48ZmlsdGVyIGlkPSJub2lzZSI+PGZlVHVyYnVsZW5jZSB0eXBlPSJmcmFjdGFsTm9pc2UiIGJhc2VGcmVxdWVuY3k9IjAuNjUiIG51bW9jdGF2ZXM9IjMiIHN0aXRjaFRpbGVzPSJzdGl0Y2giLz48L2ZpbHRlcj48cmVjdCB3aWR0aD0iMTAwJSIgaGVpZ2h0PSIxMDAlIiBmaWx0ZXI9InVybCgjbm9pc2UpIiBvcGFjaXR5PSIwLjEiLz48L3N2Zz4=');
    background-blend-mode: overlay;
    opacity: 0.6;
}

/* Worn Edges (Top/Bottom) */
.book-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    box-shadow:
        inset 0 2px 4px rgba(255, 255, 255, 0.2),
        /* Top wear */
        inset 0 -2px 4px rgba(0, 0, 0, 0.5);
    /* Bottom shadow */
}

.book-item.active {
    width: var(--expanded-width);
    z-index: 10;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.9);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(0, 0, 0, 0.5);
}

/* Remove spine effects when active (show full cover) */
.book-item.active::before {
    opacity: 0.1;
    /* Subtle texture remains */
    background: none;
    /* Remove spine gradient */
}

/* The Image inside the item */
.book-item img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    /* Default: show a slice from the center-left which often has text */
    object-position: 20% center;
    opacity: 0.7;
    transition: all 0.5s;
    filter: grayscale(60%);
}

.book-item.active img {
    object-position: center;
    opacity: 1;
    filter: grayscale(0%);
}

/* Spine Text (Vertical) - Visible only when inactive */
.spine-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    letter-spacing: 2px;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    width: var(--shelf-height);
    /* Ensure enough width for rotation */
    text-align: center;
}

.book-item.active .spine-text {
    opacity: 0;
}

/* Footer Details */
.details-footer {
    height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding-bottom: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background: var(--bg-color);
    z-index: 100;
}

.details-title {
    font-family: 'Playfair Display', serif;
    font-size: 2.5rem;
    margin: 0;
    color: white;
}

.details-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--accent-color);
    margin-top: 5px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.details-year {
    font-family: 'Courier New', Courier, monospace;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 5px;
}

.play-btn {
    margin-top: 15px;
    background: white;
    color: black;
    border: none;
    padding: 8px 24px;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.2s;
    opacity: 0;
    transform: translateY(10px);
    animation: fadeInUp 0.5s forwards 0.2s;
}

.play-btn:hover {
    transform: translateY(-2px);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal (Minimalist) */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    justify-content: center;
    align-items: center;
}

.modal-content {
    width: 90%;
    max-width: 1000px;
    position: relative;
}

.close-button {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    cursor: pointer;
    font-family: 'Courier New', Courier, monospace;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: black;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .shelf-container {
        overflow-x: auto;
        justify-content: flex-start;
        /* Allow scrolling */
        padding: 0 20px;
    }

    .shelf {
        width: max-content;
        /* Allow shelf to grow horizontally */
    }

    .book-item {
        width: 50px;
    }

    .book-item.active {
        width: 250px;
    }

    .details-title {
        font-size: 1.5rem;
    }

    header {
        padding: 15px 20px;
    }

    .logo-text {
        font-size: 1.2rem;
    }
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    z-index: 3000;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-overlay.open {
    display: flex;
    opacity: 1;
}

.search-input {
    background: transparent;
    border: none;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    text-align: center;
    width: 80%;
    max-width: 800px;
    padding: 20px;
    outline: none;
    transition: border-color 0.3s;
}

.search-input:focus {
    border-bottom-color: white;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
    font-style: italic;
}

.search-close-btn {
    position: absolute;
    top: 40px;
    right: 40px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s;
}

.search-close-btn:hover {
    color: white;
}

.search-info {
    margin-top: 20px;
    font-family: 'Courier New', Courier, monospace;
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.9rem;
}