/* Root Variables - Book Theme */
:root {
    --book-brown: #8B4513;
    --book-gold: #C9A961;
    --book-burgundy: #6B4444;
    --book-accent: #8B6F47;
    --page-cream: #FFF8E7;
    --page-white: #FFFEF0;
    --text-dark: #2C2416;
    --border-gold: #B8860B;
}

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

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Georgia', 'Palatino', 'Times New Roman', serif;
    background: linear-gradient(135deg, #3E2723 0%, #5D4037 50%, #4E342E 100%);
}

/* Fixed Full-Screen Book Container */
.container {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow: hidden;
}

/* Book View */
.book-view {
    width: 100%;
    max-width: 1400px;
    height: 100%;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    background: var(--page-white);
    border-radius: 12px;
    box-shadow:
        0 30px 60px rgba(0, 0, 0, 0.5),
        inset 0 0 0 3px var(--book-gold),
        inset 20px 0 50px -20px rgba(139, 69, 19, 0.3);
    position: relative;
    overflow: hidden;
}

/* Minimal Header Bar */
.book-cover {
    background: linear-gradient(135deg, var(--book-burgundy) 0%, #5D4844 100%);
    padding: 10px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--book-gold);
    flex-shrink: 0;
}

.cover-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-photo {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--book-gold);
    background: white;
    flex-shrink: 0;
}

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

.book-info-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.main-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--book-gold);
    white-space: nowrap;
}

.subtitle {
    font-size: 0.9rem;
    color: #F5DEB3;
    font-style: italic;
    margin: 0;
}

.author {
    font-size: 0.95rem;
    color: #FFF8DC;
    font-weight: 500;
    margin: 0;
}

.year {
    display: none;
}

.main-nav {
    display: flex;
    gap: 8px;
}

.nav-link {
    padding: 6px 14px;
    background: rgba(201, 169, 97, 0.2);
    color: var(--book-gold);
    text-decoration: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid var(--book-gold);
    transition: all 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    background: var(--book-gold);
    color: var(--book-burgundy);
}

/* Song Display - Fixed Height */
.song-display {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--page-cream);
    position: relative;
    overflow: hidden;
}

/* Book spine shadow */
.song-display::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(to right, rgba(139, 69, 19, 0.15), transparent);
    pointer-events: none;
}

.song-card {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 30px 50px;
    background: var(--page-white);
    position: relative;
    overflow: hidden;
}

.song-number {
    position: absolute;
    top: 15px;
    right: 30px;
    color: var(--book-brown);
    font-size: 1rem;
    font-style: italic;
    opacity: 0.6;
}

.song-title {
    font-size: clamp(1.8rem, 4vh, 3rem);
    color: var(--book-accent);
    text-align: center;
    margin-bottom: 20px;
    font-weight: 700;
    line-height: 1.2;
}

.song-epigraph {
    font-size: clamp(1rem, 2vh, 1.3rem);
    font-style: italic;
    color: #5D4037;
    text-align: center;
    margin-bottom: 25px;
    padding: 15px;
    border-left: 3px solid var(--book-gold);
    background: rgba(212, 175, 55, 0.08);
    white-space: pre-line;
    max-height: 20vh;
    overflow: auto;
}

.song-epigraph:empty {
    display: none;
}

/* Poem Content - Scrollable if needed but sized to fit */
.song-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 20px;
}

.song-content-inner {
    font-size: clamp(1.5rem, 3vh, 2.5rem);
    line-height: 1.8;
    color: var(--text-dark);
    white-space: pre-line;
    text-align: left;
    max-width: 900px;
    margin: 0 auto;
}

/* Custom scrollbar */
.song-content::-webkit-scrollbar {
    width: 8px;
}

.song-content::-webkit-scrollbar-track {
    background: rgba(139, 69, 19, 0.1);
    border-radius: 4px;
}

.song-content::-webkit-scrollbar-thumb {
    background: var(--book-gold);
    border-radius: 4px;
}

/* Controls Bar - Fixed at Bottom */
.controls {
    display: flex;
    gap: 15px;
    align-items: center;
    justify-content: center;
    padding: 15px 20px;
    background: linear-gradient(to bottom, var(--page-cream), #F5E6D3);
    border-top: 2px solid var(--book-gold);
    flex-shrink: 0;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--book-accent);
    color: var(--page-white);
    border: 2px solid var(--book-gold);
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'Georgia', serif;
    min-width: 120px;
}

.nav-btn:hover:not(:disabled) {
    background: var(--book-gold);
    color: var(--book-brown);
    transform: translateY(-2px);
}

.nav-btn:disabled {
    background: #999;
    border-color: #777;
    color: #DDD;
    cursor: not-allowed;
    opacity: 0.5;
}

.song-selector {
    flex: 1;
    max-width: 500px;
}

.song-dropdown {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border: 2px solid var(--book-gold);
    border-radius: 6px;
    background: var(--page-white);
    color: var(--text-dark);
    cursor: pointer;
    font-family: 'Georgia', serif;
}

.song-dropdown:focus {
    outline: none;
    border-color: var(--book-accent);
}

/* Footer */
footer {
    text-align: center;
    padding: 8px;
    color: var(--book-gold);
    font-size: 0.85rem;
    background: rgba(107, 68, 68, 0.3);
    flex-shrink: 0;
}

/* Accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* About Page */
.about-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px 50px;
    background: var(--page-white);
}

.author-photo-large {
    text-align: center;
    margin: 25px auto 30px;
}

.author-image-large {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--book-gold);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.about-content::-webkit-scrollbar {
    width: 8px;
}

.about-content::-webkit-scrollbar-track {
    background: rgba(139, 69, 19, 0.1);
}

.about-content::-webkit-scrollbar-thumb {
    background: var(--book-gold);
    border-radius: 4px;
}

.about-content h2 {
    font-size: clamp(1.8rem, 4vh, 2.5rem);
    color: var(--book-accent);
    margin-bottom: 20px;
    text-align: center;
    font-weight: 700;
}

.about-content p {
    font-size: clamp(1.1rem, 2.5vh, 1.4rem);
    line-height: 1.8;
    margin-bottom: 18px;
    text-align: justify;
}

.about-content .book-info {
    background: rgba(212, 175, 55, 0.1);
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid var(--book-gold);
}

.about-content .book-info p {
    margin-bottom: 10px;
    text-align: left;
}

.about-content .book-info strong {
    color: var(--book-accent);
}

/* Responsive - Tablet */
@media (max-width: 1024px) {
    .container {
        padding: 15px;
    }

    .song-card {
        padding: 25px 35px;
    }

    .song-content-inner {
        font-size: clamp(1.3rem, 3vh, 2rem);
    }
}

/* Responsive - Mobile */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .book-cover {
        padding: 8px 15px;
    }

    .author-photo {
        width: 30px;
        height: 30px;
    }

    .subtitle,
    .author {
        display: none;
    }

    .main-title {
        font-size: 1rem;
    }

    .nav-link {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    .song-card {
        padding: 20px 25px;
    }

    .song-title {
        font-size: clamp(1.5rem, 4vh, 2.2rem);
    }

    .song-content-inner {
        font-size: clamp(1.2rem, 3vh, 1.8rem);
        padding: 0 10px;
    }

    .controls {
        padding: 12px 10px;
        gap: 8px;
    }

    .nav-btn {
        padding: 10px 16px;
        min-width: 90px;
        font-size: 1rem;
    }

    .nav-btn span {
        display: none;
    }

    .song-selector {
        max-width: 100%;
    }

    .about-content {
        padding: 20px 25px;
    }

    .author-image-large {
        width: 140px;
        height: 140px;
        border-width: 3px;
    }
}

@media (max-width: 480px) {
    .song-content-inner {
        font-size: clamp(1.1rem, 3vh, 1.6rem);
    }

    .nav-btn {
        min-width: 60px;
        padding: 8px 12px;
    }
}

/* Print */
@media print {
    .controls,
    .main-nav,
    footer {
        display: none;
    }
}

/* Page animations */
@keyframes pageSlide {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.song-card {
    animation: pageSlide 0.3s ease;
}
