/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cormorant', serif;
    overflow: hidden;
    height: 100vh;
    background: #000;
}

/* Scene container */
.scene-container {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

#three-scene {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* Background text */
.background-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Cinzel', serif;
    font-size: 15vw;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.03);
    letter-spacing: 0.2em;
    text-align: center;
    z-index: 0;
    pointer-events: none;
    animation: backgroundPulse 10s ease-in-out infinite;
}

@keyframes backgroundPulse {
    0%, 100% { opacity: 0.03; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.05; transform: translate(-50%, -50%) scale(1.02); }
}

/* Content overlay */
.content-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
}

.content-overlay * {
    pointer-events: auto;
}

/* Main header */
.main-header {
    position: absolute;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(15px);
    padding: 1rem 2.5rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideDown 1s ease-out;
}

.title {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 0 20px rgba(255, 255, 255, 0.4);
    margin-bottom: 0.3rem;
    letter-spacing: 0.1em;
}

.subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 300;
}

/* ========== HAMBURGER MENU ========== */
.hamburger-menu {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 100;
}

.hamburger-btn {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: all 0.3s ease;
}

.hamburger-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.hamburger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.hamburger-dropdown {
    position: absolute;
    top: 60px;
    right: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    min-width: 180px;
}

.hamburger-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.hamburger-dropdown .control-btn {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    font-family: 'Cormorant', serif;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    white-space: nowrap;
}

.hamburger-dropdown .control-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateX(-3px);
}

/* ========== 3D BOOK CAROUSEL ========== */
.books-section {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    animation: slideUp 1s ease-out 0.5s both;
}

.books-title {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    margin-bottom: 1rem;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.3);
}

.carousel-container {
    position: relative;
    height: 280px;
    perspective: 1200px;
}

.carousel {
    position: absolute;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.carousel-item {
    position: absolute;
    width: 220px;
    height: 260px;
    left: 50%;
    top: 50%;
    margin-left: -110px;
    margin-top: -130px;
    transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.book-card {
    display: block;
    width: 100%;
    height: 100%;
    text-decoration: none;
    color: #fff;
    background: linear-gradient(145deg, rgba(20, 20, 40, 0.95), rgba(10, 10, 25, 0.98));
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    overflow: hidden;
    transition: all 0.4s ease;
    transform-style: preserve-3d;
    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5),
        0 0 20px rgba(100, 150, 255, 0.1);
}

.book-card:hover {
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow:
        0 15px 50px rgba(0, 0, 0, 0.6),
        0 0 30px rgba(100, 150, 255, 0.2);
    transform: translateY(-5px);
}

.book-cover {
    height: 140px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(60, 60, 100, 0.4), rgba(30, 30, 60, 0.6));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.book-cover::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    animation: shimmer 8s linear infinite;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.book-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
}


.book-cover h3 {
    font-family: 'Cinzel', serif;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    padding: 0 0.8rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.book-info {
    padding: 0.8rem;
    height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.book-desc {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.book-link {
    font-family: 'Cinzel', serif;
    font-size: 0.9rem;
    color: rgba(100, 180, 255, 0.9);
    text-align: right;
    transition: color 0.3s ease;
}

.book-card:hover .book-link {
    color: rgba(150, 210, 255, 1);
}

/* Carousel navigation */
.carousel-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-nav:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-50%) scale(1.1);
}

.carousel-prev { left: 0; }
.carousel-next { right: 0; }

.carousel-dots {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
}

.carousel-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
}

.carousel-dot.active {
    background: rgba(100, 180, 255, 0.9);
    box-shadow: 0 0 10px rgba(100, 180, 255, 0.5);
}

.carousel-dot:hover {
    background: rgba(255, 255, 255, 0.6);
}

/* ========== LOADER ========== */
.loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0a0a0a 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.5s ease;
}

.loader.hidden {
    opacity: 0;
    pointer-events: none;
}

.loader-content {
    text-align: center;
    color: #fff;
}

.loader-ship {
    font-size: 4rem;
    animation: shipFloat 2s ease-in-out infinite;
    margin-bottom: 1rem;
}

@keyframes shipFloat {
    0%, 100% { transform: translateY(0) rotate(-5deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

.loader p {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    opacity: 0.8;
}

.loader-bar {
    width: 300px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.loader-progress {
    height: 100%;
    background: linear-gradient(90deg, #4a9eff, #00d4ff);
    width: 0%;
    transition: width 0.3s ease;
}

/* ========== ANIMATIONS ========== */
@keyframes slideDown {
    from { transform: translateX(-50%) translateY(-50px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateX(-50%) translateY(50px); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .background-text { font-size: 20vw; }
    .title { font-size: 1.8rem; }
    .subtitle { font-size: 0.9rem; }
    .main-header { padding: 0.8rem 1.5rem; top: 1rem; }

    .books-section { bottom: 1rem; width: 95%; }
    .books-title { font-size: 1.1rem; }
    .carousel-container { height: 240px; }
    .carousel-item { width: 180px; height: 220px; margin-left: -90px; margin-top: -110px; }
    .book-cover { height: 110px; }
    .book-icon { font-size: 2.2rem; }
    .book-cover h3 { font-size: 0.85rem; }
    .book-info { padding: 0.6rem; height: 110px; }
    .book-desc { font-size: 0.75rem; -webkit-line-clamp: 2; }

    .carousel-nav { width: 40px; height: 40px; font-size: 1.4rem; }
    .hamburger-menu { top: 1rem; right: 1rem; }
    .hamburger-btn { width: 44px; height: 44px; }
}

@media (max-width: 480px) {
    .carousel-item { width: 160px; height: 200px; margin-left: -80px; margin-top: -100px; }
    .carousel-container { height: 220px; }
}

/* Three.js canvas enhancement */
#three-scene canvas {
    filter: contrast(1.05) brightness(1.02);
}
