/* Reset & Global */
@font-face {
    font-family: 'RosmarinusText';
    src: url('../../asset/fonts/textFonts.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #1a1410; /* 深色背景 */
    background-image: url('../../asset/img/PaperTextureSeamless/story-detail&readerBg.webp'); 
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
    
    color: #3d2f1f; /* 深褐色文字，适合羊皮纸 */
    font-family: 'Crimson Text', serif;
    line-height: 1.6;
    overflow-x: hidden;
}

/* Navigation (Copied from Timeline) */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(20, 15, 10, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
    z-index: 1000;
    padding: 0;
    transition: all 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Old English Text MT regular', serif;
    font-size: 2rem;
    color: #d4af37;
    letter-spacing: 0.1em;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    font-family: 'RosmarinusText', serif;
    font-size: 1.6rem;
    color: #c9b896;
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: #d4af37;
    transition: width 0.3s ease;
}

.nav-links a:hover, .nav-links a.active {
    color: #d4af37;
}

.nav-links a:hover::after, .nav-links a.active::after {
    width: 100%;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: #c9b896;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Story Detail Main Layout */
.story-detail-main {
    min-height: 100vh;
    padding: 100px 20px 60px; /* Top padding for fixed nav */
    display: flex;
    justify-content: center;
    position: relative; /* 确保子元素可以相对定位 */
}

/* 真实封面图片（悬浮于羊皮纸之上，不受滤镜影响） */
.story-cover-real {
    position: absolute;
    z-index: 100; /* 高于 parchment-container */
    border: 4px solid #3d2f1f;
    box-shadow: 5px 5px 15px rgba(0,0,0,0.3);
    /* 不规则羊皮纸形状遮罩 */
    clip-path: polygon(
        5% 0%, 95% 2%, 100% 10%, 98% 90%, 
        90% 100%, 10% 98%, 0% 90%, 2% 10%
    );
    transition: all 0.3s ease;
}

/* Parchment Container */
.parchment-container {
    position: relative;
    width: 100%;
    max-width: 1000px;
    background: #f4e8d0;
    padding: 60px;
    margin: 0 auto;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5);
    
    /* Parchment Texture */
    background-image: url('../../asset/img/PaperTextureSeamless/parchment.webp');
    background-size: cover;
    background-blend-mode: multiply;
    
    /* SVG Filter Edge Effect */
    filter: url(#parchment-filter);
}

/* Loading & Error States */
.loading-state, .error-state {
    text-align: center;
    padding: 4rem;
    font-size: 1.2rem;
    color: #8b7355;
    font-style: italic;
}

.retry-btn {
    margin-top: 1rem;
    padding: 0.5rem 1.5rem;
    background: #8b2e2e;
    color: #f4e8d0;
    border: none;
    font-family: 'Crimson Text', serif;
    cursor: pointer;
    transition: background 0.3s;
}

.retry-btn:hover {
    background: #a63a3a;
}

/* Story Header */
.story-header {
    display: flex;
    gap: 40px;
    margin-bottom: 60px;
    border-bottom: 2px solid #8b7355;
    padding-bottom: 40px;
}

.story-cover-wrapper {
    flex: 0 0 300px;
    position: relative;
}

.story-cover-placeholder {
    width: 100%;
    height: auto;
    border: 4px solid transparent; /* 保持尺寸一致 */
    opacity: 0; /* 不可见，仅占位 */
    visibility: hidden; /* 防止被滤镜影响显示 */
}

.story-info {
    flex: 1;
}

.story-title {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    color: #2c2416;
    margin-bottom: 20px;
    line-height: 1.2;
}

.decorative-line {
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #8b7355 0%, transparent 100%);
    margin-bottom: 20px;
}

.story-description {
    font-size: 1.1rem;
    color: #3d2f1f;
    line-height: 1.8;
}

/* Markdown Styles within description */
.story-description h1, .story-description h2, .story-description h3 {
    font-family: 'Playfair Display', serif;
    color: #8b2e2e;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.story-description p {
    margin-bottom: 1em;
}

.story-description ul, .story-description ol {
    margin-bottom: 1em;
    padding-left: 1.5em;
}

.story-description blockquote {
    border-left: 4px solid #8b7355;
    padding-left: 1em;
    color: #665;
    font-style: italic;
    margin: 1em 0;
}

/* Chapter Section */
.chapter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.chapter-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 2rem;
    color: #8b2e2e;
}

.sort-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: 0.9rem;
    color: #665;
}

.sort-btn {
    background: transparent;
    border: 1px solid #8b7355;
    color: #3d2f1f;
    padding: 4px 12px;
    font-family: 'Crimson Text', serif;
    cursor: pointer;
    transition: all 0.3s;
}

.sort-btn.active, .sort-btn:hover {
    background: #8b7355;
    color: #f4e8d0;
}

.chapter-list {
    display: grid;
    gap: 20px;
}

.chapter-item {
    display: block; /* Make it a link block */
    background: rgba(255, 255, 255, 0.4);
    border: 1px solid #8b7355;
    padding: 20px;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
}

.chapter-item:hover {
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    border-color: #8b2e2e;
}

.chapter-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.4rem;
    color: #2c2416;
    margin-bottom: 10px;
}

.chapter-summary {
    font-size: 1rem;
    color: #554;
    margin-bottom: 10px;
    line-height: 1.5;
}

.chapter-meta {
    font-size: 0.9rem;
    color: #8b7355;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.read-btn {
    color: #8b2e2e;
    font-weight: bold;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 830px) {
    .parchment-container {
        padding: 30px 20px;
    }
    
    .story-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .story-cover-wrapper {
        flex: 0 0 auto;
        width: 200px;
    }
    
    .decorative-line {
        background: linear-gradient(90deg, transparent, #8b7355, transparent);
    }
    
    .mobile-menu-toggle {
        display: block;
        z-index: 1001;
    }

    .nav-links {
        display: flex;
        position: fixed;
        top: 0;
        right: -100%;
        width: 250px;
        height: 100vh;
        background: rgba(20, 15, 10, 0.98);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: right 0.3s ease;
        z-index: 1000;
        box-shadow: -5px 0 15px rgba(0,0,0,0.5);
        padding-top: 60px;
    }

    .nav-links.active {
        right: 0;
    }
    
    .nav-links li {
        margin: 1.5rem 0;
    }
}
