@font-face {
    font-family: 'RosmarinusText';
    src: url('../../asset/fonts/textFonts.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

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

body {
    background: #140f0a;
    /* 背景图：webBg2.jpeg */
    background-image: url('../../asset/img/PaperTextureSeamless/worldBg.webp');
    background-attachment: fixed;
    background-position: center;
    background-size: cover;
    
    color: #c9b896;
    font-family: 'RosmarinusText', 'Crimson Text', serif;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Navigation */
.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;
    z-index: 1001; /* Ensure it stays above the drawer */
}

@media (max-width: 830px) {
    .mobile-menu-toggle {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%; /* Initially hidden off-screen */
        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; /* Space for close button if needed, or just padding */
    }

    .nav-links.active {
        right: 0;
    }
    
    .nav-links li {
        margin: 1.5rem 0;
    }
}

/* Page Container */
.world-header {
    text-align: center;
    padding: 8rem 2rem 4rem;
    position: relative;
    z-index: 1;
}

.world-title {
    font-family: serif;
    font-size: clamp(3rem, 8vw, 5rem);
    color: #d4af37;
    text-shadow: 2px 4px 8px rgba(0,0,0,0.6);
    margin-bottom: 1rem;
}

.world-subtitle {
    font-family: 'RosmarinusText', serif;
    font-size: 2.3rem;
    color: #4b3923;
    font-style: italic;
}

/* Card Grid */
.card-grid {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: flex-start; /* 关键：顶对齐 */
    gap: 40px; /* 列间距 */
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* 列容器 */
.world-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 40px; /* 卡片垂直间距 */
    min-width: 0; /* 防止 flex item 溢出 */
}

/* 重试按钮 */
.retry-button {
    background: transparent;
    border: 1px solid #8b2e2e;
    color: #8b2e2e;
    font-family: 'RosmarinusText', serif;
    font-size: 1.8rem;
    padding: 0.8rem 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
}

.retry-button:hover {
    background: #8b2e2e;
    color: #ffecc7;
    box-shadow: 0 5px 15px rgba(139, 46, 46, 0.3);
}

/* 移动端适配 */
@media (max-width: 768px) {
    .card-grid {
        flex-direction: column;
    }
}

/* Concept Card */
.concept-card {
    position: relative;
    width: 100%;
    margin-bottom: 2rem;
    transition: transform 0.3s ease;
}

/* 为了打破规整感，给偶数项一个默认的偏移 */
/* 注意：这在多列布局中可能会导致底部对齐问题，但在 Masonry 缺席的情况下这是常用手法 */
@media (min-width: 769px) {
    .concept-card:nth-child(even) {
        margin-top: 60px;
    }
}

/* 上层羊皮纸 */
.upper-paper {
    position: relative;
    padding: 2.5rem;
    background-color: #ffecc7;
    background-image: url('../../asset/img/PaperTextureSeamless/parchment.webp');
    background-size: cover;
    background-blend-mode: multiply;
    
    border: 1px solid #8b7355;
    /* 应用 SVG 滤镜 */
    filter: url(#parchment-filter) drop-shadow(0 10px 15px rgba(0,0,0,0.3));
    
    cursor: pointer;
    z-index: 10; /* 确保在下层之上 */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.upper-paper:hover {
    transform: translateY(-4px);
    box-shadow: 0 15px 25px rgba(0,0,0,0.4);
}

.card-title {
    font-family:serif;
    font-size: 3rem;
    color: #2b1d0e;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid rgba(139, 115, 85, 0.3);
    padding-bottom: 0.5rem;
    pointer-events: none;
}

.card-subtitle {
    font-family: serif;
    font-size: 1.6rem;
    color: #8b2e2e;
    margin-bottom: 1rem;
    font-style: italic;
    pointer-events: none;
}

.card-summary {
    font-family: serif;
    font-size: 1.7rem;
    color: #3d2f1f;
    line-height: 1.6;
    pointer-events: none;
}

.card-image {
    margin-top: 1rem;
    width: 100%;
    height: auto;
    border: 1px solid #8b7355;
    filter: sepia(0.3);
    pointer-events: none;
}

/* 下层羊皮纸容器 */
.lower-paper-container {
    position: relative;
    z-index: 5;
    margin-top: -15px;
    perspective: 1000px; /* 3D 透视效果 */
    /* 移除之前的 grid 动画 */
}

.lower-paper-container.expanded {
    margin-bottom: 2rem;
}

/* 下层纸条分段 */
.lower-paper-segment {
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    
    background-color: #fff3d4;
    background-image: url('../../asset/img/PaperTextureSeamless/parchmentForView.webp');
    background-size: cover;
    background-blend-mode: multiply;
    
    border: 1px solid #8b7355;
    border-top: none; 
    
    /* 初始状态：折叠 */
    height: 0;
    opacity: 0;
    transform-origin: top center;
    transform: rotateX(-60deg) translateY(-10px); /* 3D折叠起始状态 */
    
    transition: all 0.6s cubic-bezier(0.25, 1, 0.5, 1); /* 缓动曲线 */
    
    filter: url(#parchment-filter) drop-shadow(0 5px 10px rgba(0,0,0,0.15));
}

.lower-paper-segment.visible {
    opacity: 1;
    transform: rotateX(0) translateY(0);
    border-top: 1px dashed rgba(139, 115, 85, 0.5);
}

/* Markdown Content Styling */
.markdown-content {
    font-family: serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2b1d0e;
    padding: 2rem;
    /* 确保内容本身也有淡入效果，避免太突兀 */
    opacity: 0;
    transition: opacity 0.3s 0.2s ease;
}

.lower-paper-container.expanded .markdown-content {
    opacity: 1;
}

.markdown-content h2, .markdown-content h3 {
    font-family: serif;
    color: #8b2e2e;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-content p {
    margin-bottom: 1.2em;
}

.markdown-content blockquote {
    border-left: 3px solid #8b7355;
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #5d4d3d;
}

.markdown-content ul, .markdown-content ol {
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

/* Loading & Error */
.loading-state, .error-state {
    text-align: center;
    padding: 4rem;
    color: #a7260f;
    font-size: 4rem;
    grid-column: 1 / -1;
}

/* Responsive */
@media (max-width: 768px) {
    .card-grid {
        /* 移动端恢复单列 */
        grid-template-columns: 1fr;
        gap: 30px;
        padding: 1rem;
    }
    
    .world-title {
        font-size: 3rem;
    }
    
    /* Navigation is handled by max-width: 830px query above */
    
    /* 移动端取消交错布局 */
    .concept-card:nth-child(even) {
        margin-top: 0;
    }
}
