/* 《Home》向新杂志 - PageFlip 3D 版本 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --ink-dark: #2c241b;
    --ink-medium: #4a3f35;
    --ink-light: #6b5d4f;
    --paper: #f5f0e8;
    --paper-dark: #e8e0d4;
    --paper-light: #faf8f3;
    --accent: #8b4513;
    --accent-light: #a0522d;
    --bamboo: #5d7a5d;
    --shadow: rgba(44, 36, 27, 0.1);
}

body {
    font-family: 'Noto Serif SC', 'Source Han Serif SC', 'STSong', 'SimSun', 'Songti SC', serif;
    background: var(--paper);
    color: var(--ink-dark);
    line-height: 1.8;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* 背景装饰 */
.bg-decoration {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.ink-wash {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(107, 93, 79, 0.03) 0%, transparent 70%);
}

.ink-1 {
    width: 800px;
    height: 600px;
    top: -200px;
    right: -200px;
}

.ink-2 {
    width: 600px;
    height: 800px;
    bottom: -300px;
    left: -200px;
}

.bamboo-pattern {
    position: absolute;
    right: 0;
    top: 0;
    width: 200px;
    height: 100%;
    background: 
        linear-gradient(90deg, transparent 0%, rgba(93, 122, 93, 0.02) 100%),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 60px,
            rgba(93, 122, 93, 0.03) 60px,
            rgba(93, 122, 93, 0.03) 62px
        );
}

/* 头部 */
.main-header {
    position: relative;
    z-index: 1;
    padding: 60px 20px 40px;
    text-align: center;
    background: linear-gradient(to bottom, var(--paper-light), var(--paper));
}

.header-inner {
    max-width: 600px;
    margin: 0 auto;
}

.site-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: 8px;
}

.title-main {
    color: var(--ink-dark);
}

.title-sub {
    color: var(--accent);
    font-size: 36px;
    font-weight: 500;
}

.site-desc {
    font-size: 16px;
    color: var(--ink-light);
    letter-spacing: 6px;
    position: relative;
    display: inline-block;
}

.site-desc::before,
.site-desc::after {
    content: '❧';
    margin: 0 16px;
    color: var(--accent-light);
    font-size: 12px;
}

/* 主体内容 */
.magazine-container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--ink-dark);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.title-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: var(--paper);
    font-size: 16px;
    border-radius: 4px;
}

.divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.divider-line {
    width: 80px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--ink-light), transparent);
}

.divider-dot {
    color: var(--accent);
    font-size: 10px;
}

/* 杂志网格 */
.magazine-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 24px;
}

.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px;
    color: var(--ink-light);
}

.scroll-loader {
    width: 40px;
    height: 60px;
    margin: 0 auto 20px;
    background: var(--paper-dark);
    border: 2px solid var(--ink-light);
    border-radius: 4px;
    position: relative;
    animation: scrollMove 2s ease-in-out infinite;
}

@keyframes scrollMove {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* 杂志卡片 */
.magazine-card {
    background: var(--paper-light);
    border-radius: 4px;
    overflow: hidden;
    box-shadow: 
        0 2px 8px var(--shadow),
        0 0 0 1px rgba(139, 69, 19, 0.1);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.magazine-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 2px,
            rgba(139, 69, 19, 0.02) 2px,
            rgba(139, 69, 19, 0.02) 4px
        );
    pointer-events: none;
}

.magazine-card:hover {
    transform: translateY(-8px);
    box-shadow: 
        0 12px 32px var(--shadow),
        0 0 0 1px rgba(139, 69, 19, 0.15);
}

.card-cover {
    aspect-ratio: 9/16;
    background: linear-gradient(135deg, var(--paper-dark) 0%, var(--paper) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid rgba(139, 69, 19, 0.1);
    overflow: hidden;
}

.cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.magazine-card:hover .cover-img {
    transform: scale(1.05);
}

.cover-frame {
    width: 120px;
    height: 160px;
    background: var(--paper-light);
    border: 2px solid var(--accent);
    box-shadow: 
        inset 0 0 20px rgba(139, 69, 19, 0.05),
        0 4px 12px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.cover-frame::before {
    content: '';
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    bottom: 8px;
    border: 1px solid rgba(139, 69, 19, 0.2);
}

.cover-icon {
    font-size: 48px;
    opacity: 0.6;
}

/* 封面悬停遮罩层 */
.cover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(44, 36, 27, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.magazine-card:hover .cover-overlay {
    opacity: 1;
}

.read-btn-hover {
    padding: 12px 32px;
    background: var(--accent);
    border: 2px solid var(--paper);
    color: var(--paper);
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    letter-spacing: 2px;
}

.read-btn-hover:hover {
    background: var(--paper);
    color: var(--accent);
}

.card-info {
    padding: 12px 16px;
    position: relative;
    text-align: center;
}

.magazine-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink-dark);
    margin: 0 0 8px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

/* 分享链接按钮 */
.share-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--paper-dark);
    color: var(--ink-light);
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.3s;
}

.share-link-btn:hover {
    background: var(--paper-dark);
    color: var(--ink-dark);
    border-color: var(--accent);
}

.share-link-btn svg {
    opacity: 0.7;
}

/* Toast 消息动画 */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes fadeOutUp {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
}

/* 空状态 */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.4;
}

.empty-text {
    font-size: 16px;
    color: var(--ink-light);
}

/* 页脚 */
.main-footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--ink-light);
    font-size: 14px;
    border-top: 1px solid var(--paper-dark);
    position: relative;
    z-index: 1;
}

/* 阅读器 */
.reader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    flex-direction: column;
}

.reader-overlay.active {
    display: flex;
}

.reader-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #2d3748;
}

.reader-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

/* 加载面板 */
.loading-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 26, 46, 0.98);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--paper);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(245, 240, 232, 0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.reader-header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.close-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.close-btn:hover {
    opacity: 1;
}

.close-btn span {
    font-size: 20px;
}

.close-btn small {
    font-size: 10px;
}

.reader-title {
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    letter-spacing: 2px;
    flex: 1;
    text-align: center;
    padding: 0 20px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reader-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.control-btn {
    padding: 6px 16px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s;
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.control-btn small {
    font-size: 9px;
    opacity: 0.8;
}

.music-btn {
    position: relative;
}

.music-btn.playing .music-icon {
    animation: musicPulse 1.5s ease-in-out infinite;
}

.music-btn.muted {
    opacity: 0.6;
}

.music-btn.muted .music-icon::after {
    content: '🔇';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
}

@keyframes musicPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.reader-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    position: relative;
}

/* PageFlip 容器 */
.flipbook-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.flipbook {
    position: relative;
    margin: 0 auto;
}

/* PageFlip 页面样式 */
.flipbook .page {
    background: #fff;
}

/* 空白页样式 - 透明 */
.flipbook .page.blank-page {
    background: transparent !important;
}

.flipbook .page img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* PageFlip 项目样式 */
.stf__item {
    background: #fff;
}

.stf__item img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

/* PageFlip 内部元素样式 - 简化 */
.stf__parent {
    position: relative !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.stf__wrapper {
    position: relative !important;
    margin: 0 auto !important;
}

.stf__block {
    position: relative !important;
    margin: 0 auto !important;
    top: 0 !important;
    left: 0 !important;
}

.stf__item {
    background: #fff;
}

/* 翻页阴影效果 */
.stf__outerShadow,
.stf__innerShadow {
    pointer-events: none;
}



.reader-footer {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.4);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.page-indicator {
    color: #fff;
    font-size: 14px;
    letter-spacing: 1px;
}

.page-jump {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 13px;
}

.page-jump input {
    width: 56px;
    padding: 6px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    color: #fff;
    text-align: center;
    font-family: inherit;
}

.page-jump input:focus {
    outline: none;
    border-color: var(--accent);
}

.jump-btn {
    padding: 6px 16px;
    background: var(--accent);
    border: none;
    color: var(--paper);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.3s;
}

.jump-btn:hover {
    background: var(--accent-light);
}

/* ========== 响应式网格适配 ========== */
@media (max-width: 1400px) {
    .magazine-grid {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1200px) {
    .magazine-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 992px) {
    .magazine-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .magazine-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========== 手机端适配 (480px以下) ========== */
@media (max-width: 480px) {
    /* 头部 */
    .main-header {
        padding: 40px 16px 30px;
    }
    
    .site-title {
        font-size: 28px;
        letter-spacing: 4px;
    }
    
    .title-sub {
        font-size: 20px;
    }
    
    .site-desc {
        font-size: 14px;
        letter-spacing: 4px;
    }
    
    .site-desc::before,
    .site-desc::after {
        margin: 0 8px;
    }
    
    /* 主体内容 */
    .magazine-container {
        padding: 20px 12px 40px;
    }
    
    .section-header {
        margin-bottom: 32px;
    }
    
    .section-title {
        font-size: 22px;
    }
    
    .title-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .divider-line {
        width: 50px;
    }
    
    /* 杂志网格 - 手机端单列 */
    .magazine-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* 杂志卡片 - 横向布局 */
    .magazine-card {
        display: flex;
        flex-direction: row;
        height: 140px;
    }
    
    .card-cover {
        width: 100px;
        aspect-ratio: 9/16;
        min-height: auto;
        flex-shrink: 0;
    }
    
    .cover-frame {
        width: 70px;
        height: 90px;
    }
    
    .cover-overlay {
        background: rgba(44, 36, 27, 0.8);
    }
    
    .read-btn-hover {
        padding: 8px 16px;
        font-size: 13px;
        border-width: 1px;
    }
    
    .card-info {
        flex: 1;
        padding: 16px;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    
    .card-info::after {
        display: none;
    }
    
    .magazine-title {
        font-size: 16px;
        margin-bottom: 0;
    }
    
    .read-btn-hover {
        padding: 10px 24px;
        font-size: 14px;
    }
}

/* ========== 超小屏幕适配 ========== */
@media (max-width: 375px) {
    .site-title {
        font-size: 24px;
    }
    
    .title-sub {
        font-size: 18px;
    }
    
    .magazine-card {
        height: 120px;
    }
    
    .card-cover {
        width: 85px;
    }
    
    .card-info {
        padding: 12px;
    }
    
    .magazine-title {
        font-size: 14px;
    }
}

/* 阅读器 - 手机端优化 */
    .reader-header {
        padding: 10px 12px;
        min-height: 50px;
    }
    
    .reader-title {
        font-size: 14px;
        padding: 0 8px;
        letter-spacing: 1px;
    }
    
    .close-btn span {
        font-size: 18px;
    }
    
    .close-btn small {
        font-size: 9px;
    }
    
    .control-btn {
        padding: 5px 12px;
        font-size: 12px;
    }
    
    .reader-body {
        padding: 8px;
    }
    
    .reader-footer {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
        min-height: auto;
    }
    
    .page-indicator {
        font-size: 13px;
    }
    
    .page-jump {
        font-size: 12px;
        gap: 6px;
    }
    
    .page-jump input {
        width: 50px;
        padding: 5px 6px;
        font-size: 13px;
    }
    
    .jump-btn {
        padding: 5px 12px;
        font-size: 12px;
    }
    
    /* 背景装饰简化 */
    .ink-1, .ink-2 {
        display: none;
    }
    
    .bamboo-pattern {
        width: 60px;
        opacity: 0.5;
    }
    
    /* 页脚 */
    .main-footer {
        padding: 30px 16px;
        font-size: 13px;
    }
}

/* 超小屏幕适配 */
@media (max-width: 375px) {
    .site-title {
        font-size: 24px;
    }
    
    .title-sub {
        font-size: 18px;
    }
    
    .magazine-card {
        height: 120px;
    }
    
    .card-cover {
        width: 85px;
    }
    
    .card-info {
        padding: 12px;
    }
    
    .magazine-title {
        font-size: 14px;
    }
}

/* 动画 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.magazine-card {
    animation: fadeIn 0.6s ease forwards;
}
