/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
    font-family: Georgia, 'Palatino Linotype', 'Palatino', serif;
    color: #3a3428;
    min-height: 100vh;
    position: relative;
}

/* === Newspaper Background === */
.newspaper-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}
.newspaper-grain {
    position: absolute; inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='6' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='400' height='400' filter='url(%23g)' opacity='0.06'/%3E%3C/svg%3E");
}
.newspaper-columns {
    position: absolute; inset: 0;
    opacity: 0.03;
    background: repeating-linear-gradient(90deg, transparent, transparent 180px, #4a3a28 180px, #4a3a28 181px);
}
.newspaper-rows {
    position: absolute; inset: 0;
    opacity: 0.018;
    background: repeating-linear-gradient(180deg, transparent, transparent 11px, #4a3a28 11px, #4a3a28 12px);
}
.newspaper-text {
    position: absolute; inset: 0;
    overflow: hidden;
    opacity: 0.035;
    font-family: 'Times New Roman', serif;
    font-size: 8px;
    line-height: 1.4;
    color: #2a2218;
    padding: 60px 15px;
    columns: 3;
    column-gap: 12px;
}
.newspaper-wash {
    position: absolute; inset: 0;
    background:
        radial-gradient(ellipse at 30% 25%, rgba(200,180,140,0.08), transparent 60%),
        radial-gradient(ellipse at 75% 70%, rgba(180,160,120,0.06), transparent 50%);
}

/* === Navigation === */
.main-nav {
    position: relative;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 30px;
}
.nav-logo {
    font-size: 17px;
    letter-spacing: 2px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.nav-logo-icon {
    width: 28px;
    height: 28px;
}
.nav-links {
    display: flex;
    gap: 22px;
}
.nav-links a {
    font-size: 12px;
    letter-spacing: 1px;
    text-transform: uppercase;
    text-decoration: none;
}
.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
}

/* === Content === */
.content {
    position: relative;
    z-index: 1;
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

/* === Open Book === */
.open-book {
    max-width: 1040px;
    margin: 30px auto;
    perspective: 1200px;
}
.book-spread {
    display: flex;
    height: 650px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.1);
}
.book-page {
    flex: 1;
    position: relative;
    overflow: hidden;
}
.book-page::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='5' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23p)' opacity='0.025'/%3E%3C/svg%3E");
    pointer-events: none;
}
.book-page-left {
    border-right: none;
}
.book-page-left::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 30px;
    background: linear-gradient(270deg, rgba(0,0,0,0.04), transparent);
    z-index: 1;
    pointer-events: none;
}
.book-page-right::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 30px;
    background: linear-gradient(90deg, rgba(0,0,0,0.04), transparent);
    z-index: 1;
    pointer-events: none;
}
.book-spine {
    width: 8px;
    background: linear-gradient(90deg, rgba(0,0,0,0.06), rgba(0,0,0,0.02) 20%, rgba(255,255,255,0.1) 50%, rgba(0,0,0,0.02) 80%, rgba(0,0,0,0.06));
    z-index: 2;
}
.book-shadow {
    height: 6px;
    background: linear-gradient(180deg, rgba(0,0,0,0.08), transparent);
    border-radius: 0 0 4px 4px;
}

/* === Book Image Page === */
.book-image {
    position: absolute;
    inset: 35px 40px 35px 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.book-image img {
    max-width: calc(100% - 20px);
    max-height: calc(100% - 20px);
    object-fit: contain;
    padding: 8px;
    border: 1px solid rgba(140,120,90,0.25);
    box-shadow:
        0 2px 8px rgba(0,0,0,0.12),
        0 1px 3px rgba(0,0,0,0.08),
        inset 0 0 20px rgba(140,120,90,0.06);
    background: linear-gradient(135deg, rgba(255,252,245,0.6), rgba(240,235,225,0.4));
    border-radius: 2px;
}
.book-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.book-image-placeholder svg {
    opacity: 0.5;
}
.book-image-placeholder span {
    font-size: 11px;
    letter-spacing: 1px;
    opacity: 0.5;
}

/* === Book Poem Page === */
.book-page-right {
    position: relative;
    overflow: hidden;
}
.book-poem {
    position: absolute;
    inset: 0;
    padding: 35px 30px 35px 40px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(140,120,90,0.3) transparent;
}
.book-poem::-webkit-scrollbar {
    width: 6px;
}
.book-poem::-webkit-scrollbar-track {
    background: transparent;
}
.book-poem::-webkit-scrollbar-thumb {
    background: rgba(140,120,90,0.3);
    border-radius: 3px;
}
.book-poem::-webkit-scrollbar-thumb:hover {
    background: rgba(140,120,90,0.5);
}
.book-poem-title {
    font-size: 16px;
    font-style: italic;
    text-decoration: underline;
    text-underline-offset: 4px;
    margin-bottom: 20px;
}
.book-poem-body {
    font-size: 13px;
    line-height: 2;
}
.book-poem-body p {
    margin-bottom: 18px;
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    opacity: 0.5;
    animation: bounceDown 1.5s ease-in-out infinite;
    pointer-events: none;
    transition: opacity 0.3s;
}
.scroll-indicator.hidden {
    opacity: 0;
}
.scroll-indicator span {
    font-size: 9px;
    letter-spacing: 1px;
}
@keyframes bounceDown {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(4px); }
}

.book-poem-meta {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid rgba(140,120,90,0.15);
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    opacity: 0.6;
}

/* === Bookshelf === */
.bookshelf {
    text-align: center;
    padding: 20px 0;
}
.bookshelf-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 18px;
    opacity: 0.6;
}
.bookshelf-books {
    display: flex;
    justify-content: center;
    gap: 18px;
    flex-wrap: wrap;
    padding-bottom: 15px;
}
.book-item {
    width: 90px;
    text-align: center;
    text-decoration: none;
}
.book-cover {
    width: 90px;
    height: 120px;
    border-radius: 2px 6px 6px 2px;
    box-shadow: 3px 3px 8px rgba(0,0,0,0.2), inset -2px 0 4px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.2s;
}
.book-item:hover .book-cover {
    transform: translateY(-4px);
}
.book-cover::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 6px;
    background: linear-gradient(90deg, rgba(0,0,0,0.25), transparent);
}
.book-cover-title {
    font-size: 11px;
    padding: 8px;
    letter-spacing: 0.5px;
}
.book-count {
    font-size: 10px;
    margin-top: 6px;
    opacity: 0.6;
}
.bookshelf-ledge {
    max-width: 520px;
    margin: 0 auto;
    height: 8px;
    border-radius: 0 0 2px 2px;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
}

/* === Category Tags === */
.category-tags {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 20px 0;
}
.category-tag {
    padding: 7px 16px;
    font-size: 12px;
    border-radius: 2px;
    text-decoration: none;
    transition: opacity 0.2s;
}
.category-tag:hover {
    opacity: 0.8;
}

/* === Hero === */
.hero {
    text-align: center;
    padding: 50px 20px 40px;
}
.hero-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 5px;
    margin-bottom: 8px;
    opacity: 0.6;
}
.hero-title {
    font-size: 34px;
    letter-spacing: 1px;
    margin-bottom: 4px;
    font-weight: normal;
}
.hero-divider {
    width: 60px;
    height: 1px;
    margin: 15px auto;
}
.hero-subtitle {
    font-size: 14px;
    font-style: italic;
    max-width: 420px;
    margin: 0 auto;
    line-height: 1.8;
    opacity: 0.7;
}

/* === Featured Poem (Mini Book) === */
.featured-book {
    max-width: 520px;
    margin: 0 auto 35px;
}
.featured-spread {
    display: flex;
    min-height: 200px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.14);
}
.featured-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.featured-image::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 20px;
    background: linear-gradient(270deg, rgba(0,0,0,0.03), transparent);
}
.featured-poem {
    flex: 1;
    padding: 20px 20px 20px 25px;
    position: relative;
}
.featured-poem::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, rgba(0,0,0,0.03), transparent);
}

/* === Poem Navigation === */
.poem-nav {
    display: flex;
    justify-content: space-between;
    max-width: 700px;
    margin: 0 auto;
    padding: 0 40px 30px;
}
.poem-nav a {
    font-size: 12px;
    text-decoration: none;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.poem-nav a:hover { opacity: 1; }

/* === Breadcrumb === */
.breadcrumb {
    font-size: 11px;
    padding: 15px 0 0;
    opacity: 0.6;
}
.breadcrumb a {
    text-decoration: underline;
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 30px 0;
}
.pagination a, .pagination span {
    padding: 6px 12px;
    font-size: 12px;
    text-decoration: none;
    border-radius: 2px;
}

/* === Search === */
.search-form {
    max-width: 500px;
    margin: 30px auto;
    display: flex;
    gap: 8px;
}
.search-input {
    flex: 1;
    padding: 10px 16px;
    font-family: inherit;
    font-size: 14px;
    border-radius: 2px;
    border: 1px solid;
}
.search-button {
    padding: 10px 20px;
    font-family: inherit;
    font-size: 14px;
    border: none;
    border-radius: 2px;
    cursor: pointer;
}

/* === Poem Cards (Category Browse) === */
.poem-cards {
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.poem-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    text-decoration: none;
    border-radius: 2px;
    transition: box-shadow 0.2s;
}
.poem-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.poem-card-thumb {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    object-fit: cover;
    border-radius: 2px;
}
.poem-card-text h3 {
    font-size: 16px;
    font-weight: normal;
    margin-bottom: 6px;
}
.poem-card-text p {
    font-size: 13px;
    line-height: 1.6;
    opacity: 0.7;
}

/* === Footer === */
.main-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 20px;
    font-size: 10px;
    letter-spacing: 1px;
    opacity: 0.6;
}

/* === Section Titles === */
.section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-align: center;
    margin-bottom: 12px;
    opacity: 0.6;
}

/* === Mobile === */
@media (max-width: 768px) {
    .nav-toggle { display: block; }
    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0; right: 0;
        flex-direction: column;
        padding: 15px 30px;
        gap: 12px;
    }
    .nav-links.open { display: flex; }

    /* Book layout: stack vertically */
    .open-book { max-width: 100%; margin: 15px auto; }
    .book-spread {
        flex-direction: column;
        height: auto;
    }
    .book-page-left {
        min-height: 250px;
    }
    .book-spine {
        width: auto;
        height: 4px;
        background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.01) 40%, rgba(0,0,0,0.05));
    }
    .book-image {
        position: relative;
        inset: auto;
        height: 250px;
        padding: 15px;
    }
    .book-image img {
        max-width: calc(100% - 10px);
        max-height: calc(100% - 10px);
    }
    .book-poem {
        position: relative;
        padding: 20px 18px 30px;
        overflow-y: visible;
        max-height: none;
    }
    .book-poem-title { font-size: 18px; }
    .book-poem-body { font-size: 14px; line-height: 1.9; }

    /* Featured poem mini book */
    .featured-spread {
        flex-direction: column;
    }
    .featured-image {
        min-height: 150px;
    }

    /* Bookshelf */
    .book-cover { width: 75px; height: 100px; }
    .book-item { width: 75px; }
    .bookshelf-books { gap: 12px; }

    /* Share bar */
    .share-bar { gap: 8px; padding: 12px 0 6px; }
    .share-btn { width: 30px; height: 30px; }
    .share-label { font-size: 10px; }

    /* Poem toolbar: always visible on mobile */
    .poem-toolbar { opacity: 1; }

    /* Scroll indicator hidden on mobile (no fixed book height) */
    .scroll-indicator { display: none; }
    .poem-fade { display: none; }

    /* Hero */
    .hero { padding: 30px 16px 25px; }
    .hero-title { font-size: 24px; }
    .hero-subtitle { font-size: 13px; }

    /* General */
    .main-nav { padding: 12px 16px; }
    .nav-logo { font-size: 14px; gap: 8px; }
    .nav-logo-icon { width: 22px; height: 22px; }
    .content { padding: 10px 12px; }
    .poem-nav { padding: 0 12px 16px; }
    .breadcrumb { font-size: 10px; }

    /* Footer */
    .footer-links { gap: 10px; }
    .footer-links a { font-size: 10px; }

    /* Prose pages */
    .prose-page { padding: 0 12px; }
    .prose-page .author-photo-wrap { float: none; margin: 0 auto 20px; }
}
