/* Color Palette: FCBA04 (gold), A50104 (dark red), 590004 (darker red), 250001 (darkest red), F3F3F3 (light gray) */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Crimson Text', serif;
    background: linear-gradient(135deg, #250001 0%, #590004 25%, #A50104 50%, #590004 75%, #250001 100%);
    color: #F3F3F3;
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated magical background */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 10% 10%, rgba(252, 186, 4, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 90% 90%, rgba(165, 1, 4, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(89, 0, 4, 0.03) 0%, transparent 80%);
    animation: magicalShift 25s ease-in-out infinite;
    z-index: -2;
}

@keyframes magicalShift {
    0%, 100% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(1deg) scale(1.02); }
    50% { transform: rotate(-1deg) scale(0.98); }
    75% { transform: rotate(0.5deg) scale(1.01); }
}

/* Header Styles */
header {
    background: linear-gradient(135deg, #250001 0%, #590004 50%, #A50104 100%);
    padding: 1rem 2rem;
    box-shadow: 0 4px 20px rgba(37, 0, 1, 0.5);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid #FCBA04;
}

header h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 700;
    color: #FCBA04;
    text-align: center;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    letter-spacing: 2px;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* Updated Navigation - Simple rectangular containers */
nav a {
    color: #F3F3F3;
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.8rem 1.5rem;
    background: rgba(37, 0, 1, 0.6);
    border: 2px solid #FCBA04;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
    display: block;
}

nav a:hover,
nav a.active {
    background: rgba(252, 186, 4, 0.2);
    color: #FCBA04;
    border-color: #F3F3F3;
}

nav a:active {
    transform: translateY(1px);
}

/* Main Content */
main {
    padding: 2rem;
    padding-bottom: 200px;
    max-width: 1400px;
    margin: 0 auto;
}

.works-container {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

/* Hero Section */
.hero-section {
    text-align: center;
    padding: 3rem 0;
}

.page-title {
    font-family: 'Cinzel', serif;
    font-size: 4rem;
    font-weight: 700;
    color: #FCBA04;
    margin-bottom: 1rem;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
    animation: titlePulse 4s ease-in-out infinite;
    position: relative;
}

@keyframes titlePulse {
    0%, 100% { 
        text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7), 0 0 30px rgba(252, 186, 4, 0.3);
        transform: scale(1);
    }
    50% { 
        text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7), 0 0 50px rgba(252, 186, 4, 0.6);
        transform: scale(1.02);
    }
}

.page-subtitle {
    font-size: 1.3rem;
    color: #F3F3F3;
    margin-bottom: 2rem;
    font-style: italic;
    opacity: 0.9;
}

.mystical-divider {
    width: 300px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #FCBA04, transparent);
    margin: 0 auto;
    position: relative;
    animation: dividerGlow 3s ease-in-out infinite alternate;
}

@keyframes dividerGlow {
    0% { box-shadow: 0 0 15px rgba(252, 186, 4, 0.5); }
    100% { box-shadow: 0 0 25px rgba(252, 186, 4, 0.8); }
}

.mystical-divider::before,
.mystical-divider::after {
    content: '◆';
    position: absolute;
    top: -10px;
    color: #FCBA04;
    font-size: 1.5rem;
    animation: sparkle 2s ease-in-out infinite alternate;
}

.mystical-divider::before {
    left: -30px;
}

.mystical-divider::after {
    right: -30px;
    animation-delay: 1s;
}

@keyframes sparkle {
    0% { opacity: 0.3; transform: scale(0.8) rotate(0deg); }
    100% { opacity: 1; transform: scale(1.2) rotate(180deg); }
}

/* Books Grid */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 3rem;
    padding: 2rem 0;
}

/* Book Container */
.book-container {
    perspective: 1000px;
    height: 500px;
    position: relative;
}

.book-card {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s ease-in-out;
    cursor: pointer;
    transform: rotateY(0deg);
}

/* Fixed animation - spins exactly 4 times and lands on blurb (180deg = back side) */
.book-container:hover .book-card {
    animation: spinToBlurb 0.8s ease-in-out forwards;
}

@keyframes spinToBlurb {
    0% { transform: rotateY(0deg); }
    25% { transform: rotateY(360deg); }
    50% { transform: rotateY(720deg); }
    75% { transform: rotateY(1080deg); }
    100% { transform: rotateY(1260deg); } /* 3.5 rotations = exactly 180deg (back side) */
}

/* Reset to front when not hovering */
.book-container:not(:hover) .book-card {
    transform: rotateY(0deg);
    transition: transform 0.6s ease-in-out;
}

.book-front,
.book-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(252, 186, 4, 0.3);
    overflow: hidden;
}

.book-front {
    background: linear-gradient(135deg, #250001 0%, #590004 50%, #A50104 100%);
    border: 3px solid #FCBA04;
    transform: rotateY(0deg);
}

.book-back {
    background: linear-gradient(135deg, #590004 0%, #250001 50%, #590004 100%);
    border: 3px solid #FCBA04;
    transform: rotateY(180deg);
}

/* Book Cover Design */
.book-cover {
    padding: 2rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
    background: 
        radial-gradient(circle at 30% 30%, rgba(252, 186, 4, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, rgba(37, 0, 1, 0.9) 0%, rgba(89, 0, 4, 0.8) 100%);
}

.book-cover::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    bottom: 20px;
    border: 2px solid rgba(252, 186, 4, 0.3);
    border-radius: 10px;
    animation: borderPulse 3s ease-in-out infinite;
}

@keyframes borderPulse {
    0%, 100% { border-color: rgba(252, 186, 4, 0.3); }
    50% { border-color: rgba(252, 186, 4, 0.6); }
}

.book-cover h3 {
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    font-weight: 700;
    color: #FCBA04;
    margin-bottom: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    z-index: 2;
    position: relative;
}

.book-symbol {
    font-size: 4rem;
    margin: 1rem 0;
    animation: symbolFloat 4s ease-in-out infinite;
    z-index: 2;
    position: relative;
}

@keyframes symbolFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    25% { transform: translateY(-10px) rotate(5deg); }
    50% { transform: translateY(-5px) rotate(0deg); }
    75% { transform: translateY(-10px) rotate(-5deg); }
}

.book-number {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(252, 186, 4, 0.2);
    color: #FCBA04;
    padding: 0.5rem 1rem;
    border-radius: 15px;
    font-family: 'Cinzel', serif;
    font-weight: 600;
    border: 1px solid #FCBA04;
    font-size: 0.9rem;
    z-index: 3;
}

.book-tagline {
    font-size: 1.1rem;
    color: #F3F3F3;
    font-style: italic;
    text-align: center;
    line-height: 1.4;
    z-index: 2;
    position: relative;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* Book Back/Blurb Design - FIXED */
.book-blurb {
    padding: 1.5rem;
    height: 100%;
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(89, 0, 4, 0.95) 0%, rgba(37, 0, 1, 0.95) 100%);
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.book-blurb::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    border: 2px solid rgba(252, 186, 4, 0.4);
    border-radius: 10px;
    pointer-events: none;
}

.book-blurb h4 {
    font-family: 'Cinzel', serif;
    font-size: 1.4rem;
    color: #FCBA04;
    margin-bottom: 1rem;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    z-index: 2;
    position: relative;
}

.book-blurb p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.8rem;
    color: #F3F3F3;
    text-align: justify;
    z-index: 2;
    position: relative;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.book-blurb p:last-child {
    margin-bottom: 0;
}

.book-blurb strong {
    color: #FCBA04;
    font-weight: 700;
}

.book-blurb em {
    color: #FCBA04;
    font-style: italic;
}

/* Custom scrollbar for book blurbs */
.book-blurb::-webkit-scrollbar {
    width: 6px;
}

.book-blurb::-webkit-scrollbar-track {
    background: rgba(37, 0, 1, 0.3);
    border-radius: 3px;
}

.book-blurb::-webkit-scrollbar-thumb {
    background: #FCBA04;
    border-radius: 3px;
}

.book-blurb::-webkit-scrollbar-thumb:hover {
    background: #F3F3F3;
}

/* Enhanced hover effects */
.book-container:hover {
    transform: translateY(-10px);
}

.book-container:hover .book-front,
.book-container:hover .book-back {
    box-shadow: 0 20px 50px rgba(252, 186, 4, 0.5);
}

/* Footer */
footer {
    background: linear-gradient(135deg, #250001 0%, #590004 100%);
    position: fixed;
    bottom: 0;
    width: 100%;
    padding: 1rem 2rem;
    border-top: 3px solid #FCBA04;
    box-shadow: 0 -4px 20px rgba(37, 0, 1, 0.5);
    z-index: 1000;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.contact-form {
    flex: 1;
    margin-right: 2rem;
}

.contact-form h3 {
    color: #FCBA04;
    margin-bottom: 0.5rem;
    font-family: 'Cinzel', serif;
}

.contact-form form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.contact-form input,
.contact-form textarea {
    padding: 0.3rem;
    border: 1px solid #FCBA04;
    border-radius: 5px;
    background: rgba(243, 243, 243, 0.1);
    color: #F3F3F3;
    font-size: 0.9rem;
}

.contact-form input {
    width: 150px;
}

.contact-form textarea {
    width: 200px;
    height: 60px;
    resize: none;
}

.contact-form input::placeholder,
.contact-form textarea::placeholder {
    color: rgba(243, 243, 243, 0.7);
}

.contact-form button {
    padding: 0.3rem 1rem;
    background: #FCBA04;
    color: #250001;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.contact-form button:hover {
    background: #F3F3F3;
    transform: translateY(-2px);
}

.footer-info {
    text-align: right;
    color: #F3F3F3;
}

.footer-info a {
    color: #FCBA04;
    text-decoration: none;
}

.footer-info a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    nav ul {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }
    
    nav a {
        width: 200px;
        text-align: center;
    }
    
    .page-title {
        font-size: 2.5rem;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .book-container {
        height: 450px;
    }
    
    .book-cover h3 {
        font-size: 1.5rem;
    }
    
    .book-symbol {
        font-size: 3rem;
    }
    
    .book-blurb {
        padding: 1.2rem;
    }
    
    .book-blurb h4 {
        font-size: 1.2rem;
    }
    
    .book-blurb p {
        font-size: 0.85rem;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .contact-form {
        margin-right: 0;
    }
    
    .contact-form form {
        justify-content: center;
    }
    
    main {
        padding: 1rem;
        padding-bottom: 180px;
    }
}

@media (max-width: 480px) {
    .books-grid {
        grid-template-columns: 1fr;
        padding: 1rem 0;
    }
    
    .book-container {
        height: 400px;
    }
    
    .book-cover {
        padding: 1.5rem;
    }
    
    .book-cover h3 {
        font-size: 1.3rem;
    }
    
    .book-tagline {
        font-size: 1rem;
    }
    
    .mystical-divider {
        width: 200px;
    }
    
    .book-blurb {
        padding: 1rem;
    }
    
    .book-blurb h4 {
        font-size: 1.1rem;
    }
    
    .book-blurb p {
        font-size: 0.8rem;
        line-height: 1.3;
    }
}