/* ============================================
   诗礼传家 - 主样式表
   童趣古风 × 现代响应式设计
   ============================================ */

/* Google Fonts - 思源宋体 */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&display=swap');

/* CSS变量定义 */
:root {
    /* 主色调 */
    --color-zhusha: #D4342F;      /* 朱砂红 - 四书 */
    --color-zhuqing: #7EBEA3;     /* 竹青绿 - 诸子 */
    --color-liuli: #F5A623;       /* 琉璃黄 - 诗词 */
    --color-qinghua: #2E5C8A;     /* 青花蓝 - 古文观止 */
    
    /* 背景色 */
    --bg-xuanzhi: #F7F3E9;        /* 宣纸米 */
    --bg-huiben: #FFF9E6;         /* 绘本黄 */
    --bg-nav: #F0F4F8;            /* 浅云灰 */
    --bg-white: #FFFFFF;
    
    /* 文字色 */
    --text-mohei: #2C2C2C;        /* 墨黑 */
    --text-shenhe: #5C4033;       /* 深褐 */
    --text-gray: #666666;         /* 灰色 */
    --text-light: #999999;        /* 浅灰 */
    
    /* 高亮 */
    --highlight-yellow: #FFF176;   /* 柠檬黄 */
    --highlight-pinyin: #666666;   /* 拼音灰 */
    
    /* 字体 */
    --font-serif: 'Noto Serif SC', 'Source Han Serif SC', 'SimSun', 'STSong', serif;
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&display=swap');
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-kaiti: 'Kaiti', 'STKaiti', '楷体', serif;
    
    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    
    /* 阴影 */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.1);
    
    /* 间距 */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.5rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
    --space-xxl: 4rem;
    
    /* 容器 */
    --container-max: 1200px;
    --container-padding: 1.5rem;
}

/* 基础重置 */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    color: var(--text-mohei);
    background-color: var(--bg-xuanzhi);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

/* 容器 */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
}

/* ============================================
   导航栏
   ============================================ */
.main-nav {
    background: rgba(240, 244, 248, 0.95);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.nav-container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0.75rem var(--container-padding);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--text-mohei);
}

.logo-icon {
    font-size: 1.5rem;
}

.logo-text {
    font-family: var(--font-serif);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-item {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-xl);
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-item:hover {
    background: rgba(0,0,0,0.05);
    transform: translateY(-1px);
}

.nav-item.sishu:hover { background: rgba(212, 52, 47, 0.1); color: var(--color-zhusha); }
.nav-item.zhuzi:hover { background: rgba(126, 190, 163, 0.1); color: var(--color-zhuqing); }
.nav-item.shici:hover { background: rgba(245, 166, 35, 0.1); color: var(--color-liuli); }
.nav-item.guanzhi:hover { background: rgba(46, 92, 138, 0.1); color: var(--color-qinghua); }

/* ============================================
   导航栏下拉菜单
   ============================================ */
.nav-dropdown li {
    position: relative;
}

.nav-dropdown li:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.12), transparent);
}

.nav-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 180px;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.75rem 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    border: 1px solid rgba(0,0,0,0.08);
}

.nav-links li:hover .nav-dropdown {
    opacity: 1;
    visibility: visible;
}


/* 导航菜单项相对定位，作为下拉菜单的定位基准 */
.nav-links li {
    position: relative;
}

.nav-dropdown li a {
    display: block;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    color: var(--text-mohei);
    transition: all 0.2s ease;
    border-radius: 0;
    white-space: nowrap;
    text-align: center;
}

/* 导航菜单古典装饰 - 左右书名号 */
.nav-dropdown li {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.deco-left, .deco-right {
    color: #D4342F !important;
    opacity: 0.5 !important;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.deco-left { margin-right: 2px; }
.deco-right { margin-left: 2px; }

.nav-dropdown li:hover .deco-left,
.nav-dropdown li:hover .deco-right {
    opacity: 0.8;
}

/* 菜单文字居中 */
.nav-dropdown li a {
    text-align: center;
}

.nav-dropdown li a:hover {
    background: var(--bg-nav);
    color: var(--color-zhusha);
}

.nav-dropdown li a .tag {
    font-size: 0.75rem;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.nav-dropdown li a .tag.done { background: #E8F5E9; color: #2E7D32; }
.nav-dropdown li a .tag.pending { background: #FFF3E0; color: #E65100; }

/* 下拉菜单小箭头 */
.nav-dropdown::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid white;
}

/* 移动端菜单按钮 */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem;
    background: none;
    border: none;
    cursor: pointer;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-mohei);
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* 搜索图标 */
.search-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-mohei);
    transition: all 0.2s ease;
    text-decoration: none;
}

.search-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--color-zhusha);
}

.search-icon svg {
    width: 20px;
    height: 20px;
}

/* ============================================
   悬浮导航按钮
   ============================================ */
.floating-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

.floating-nav:hover {
    opacity: 1;
}

.floating-nav.prev {
    left: 1rem;
}

.floating-nav.next {
    right: 1rem;
}

.floating-nav a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--color-zhusha);
    color: white;
    border-radius: 50%;
    font-size: 1.2rem;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    text-decoration: none;
}

.floating-nav a:hover {
    transform: scale(1.1);
    box-shadow: var(--shadow-lg);
}

.floating-nav a.disabled {
    background: var(--text-light);
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   首页英雄区
   ============================================ */
.hero {
    background: linear-gradient(135deg, var(--bg-xuanzhi) 0%, var(--bg-huiben) 100%);
    padding: var(--space-xxl) 0;
    position: relative;
    overflow: hidden;

    display: flex;
    align-items: center;
}

.hero-decoration {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.cloud {
    position: absolute;
    font-size: 3rem;
    opacity: 0.3;
    animation: float 6s ease-in-out infinite;
}

.cloud-1 { top: 10%; left: 10%; animation-delay: 0s; }
.cloud-2 { top: 20%; right: 15%; animation-delay: 2s; }
.cloud-3 { bottom: 30%; left: 20%; animation-delay: 4s; }

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.hero-content {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-title {
    margin-bottom: var(--space-lg);
}

.title-main {
    display: block;
    font-family: var(--font-serif);
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-weight: 700;
    color: var(--color-zhusha);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.1);
}

.title-sub {
    display: block;
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--text-shenhe);
    font-weight: 400;
}

.hero-description {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    color: var(--text-gray);
    max-width: 600px;
    margin: 0 auto var(--space-xl);
    line-height: 1.8;
}

.hero-cta {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: var(--radius-xl);
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
    border: none;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: var(--color-zhusha);
    color: white;
}

.btn-primary:hover {
    background: #b82d28;
}

.btn-secondary {
    background: white;
    color: var(--text-mohei);
}

.btn-secondary:hover {
    background: var(--bg-huiben);
}

.btn-icon {
    font-size: 1.25rem;
}

/* 卷轴装饰 */
.hero-illustration {
    margin-top: var(--space-xl);
}

.scroll-decoration {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    max-width: 400px;
}

.scroll-top, .scroll-bottom {
    width: 100%;
    height: 20px;
    background: linear-gradient(90deg, #8B4513 0%, #A0522D 50%, #8B4513 100%);
    border-radius: 10px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.scroll-content {
    background: var(--bg-xuanzhi);
    padding: 1.5rem 2rem;
    border-left: 3px solid #8B4513;
    border-right: 3px solid #8B4513;
    writing-mode: vertical-rl;
    text-orientation: upright;
}

.scroll-text {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    color: var(--text-shenhe);
    letter-spacing: 0.5rem;
}

/* ============================================
   板块区域
   ============================================ */
.sections {
    padding: var(--space-xxl) 0;
    background: var(--bg-white);
}

.section-title {
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-mohei);
}

.section-subtitle {
    text-align: center;
    color: var(--text-gray);
    margin-bottom: var(--space-xl);
    font-size: 1.1rem;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.card {
    display: flex;
    flex-direction: column;
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: height 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card:hover::before {
    height: 100%;
    opacity: 0.05;
}

.card-sishu::before { background: var(--color-zhusha); }
.card-sishu:hover { border-color: var(--color-zhusha); }

.card-zhuzi::before { background: var(--color-zhuqing); }
.card-zhuzi:hover { border-color: var(--color-zhuqing); }

.card-shici::before { background: var(--color-liuli); }
.card-shici:hover { border-color: var(--color-liuli); }

.card-guanzhi::before { background: var(--color-qinghua); }
.card-guanzhi:hover { border-color: var(--color-qinghua); }

.card-icon {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
}

.card-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-mohei);
}

.card-desc {
    color: var(--text-gray);
    font-size: 0.95rem;
    line-height: 1.6;
    flex-grow: 1;
    margin-bottom: var(--space-sm);
}

.card-stats {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.stat {
    font-size: 0.85rem;
    color: var(--text-light);
    background: var(--bg-nav);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-xl);
}

.card-arrow {
    position: absolute;
    right: var(--space-md);
    bottom: var(--space-md);
    font-size: 1.5rem;
    color: var(--text-light);
    transition: all 0.3s ease;
}

.card:hover .card-arrow {
    transform: translateX(4px);
    color: var(--color-zhusha);
}

/* ============================================
   特色功能
   ============================================ */
.features {
    padding: var(--space-xxl) 0;
    background: linear-gradient(180deg, var(--bg-huiben) 0%, var(--bg-xuanzhi) 100%);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

.feature {
    text-align: center;
    padding: var(--space-lg);
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.feature:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.feature-icon {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
}

.feature-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-mohei);
}

.feature-desc {
    color: var(--text-gray);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* ============================================
   推荐开始
   ============================================ */
.recommend {
    padding: var(--space-xxl) 0;
    background: var(--bg-white);
}

.recommend-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-xl);
}

.recommend-card {
    display: block;
    padding: var(--space-lg);
    background: var(--bg-xuanzhi);
    border-radius: var(--radius-lg);
    border: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.recommend-card:hover {
    border-color: var(--color-zhusha);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.recommend-badge {
    display: inline-block;
    background: var(--color-zhusha);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-xl);
    margin-bottom: var(--space-sm);
}

.recommend-card h3 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-mohei);
}

.recommend-card p {
    color: var(--text-gray);
    font-size: 0.95rem;
}

/* ============================================
   页脚
   ============================================ */
.footer {
    background: var(--text-mohei);
    color: var(--bg-xuanzhi);
    padding: var(--space-xl) 0;
}

.footer-content {
    text-align: center;
}

.footer-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.footer-desc {
    max-width: 500px;
    margin: 0 auto var(--space-lg);
    opacity: 0.8;
    line-height: 1.6;
}

/* ============================================
   移动端适配
   ============================================ */
@media (max-width: 900px) {
    .nav-container {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .mobile-menu-btn {
        display: none;
    }

    .nav-links {
        display: flex;
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
        padding-top: 0;
        border-top: none;
        margin-top: 0;
    }

    .nav-item {
        text-align: center;
        padding: 0.4rem 0.6rem;
        white-space: nowrap;
        flex-shrink: 0;
        font-size: 0.85rem;
    }

    /* Logo缩小 */
    .logo {
        font-size: 1.1rem;
    }

    .logo-icon {
        font-size: 1.25rem;
    }
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    flex-wrap: wrap;
    margin-bottom: var(--space-lg);
}

.footer-links a {
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-links a:hover {
    opacity: 1;
}

.footer-copyright {
    font-size: 0.875rem;
    opacity: 0.6;

/* 段落单元标题栏（诸子页面TTS按钮栏） */
.unit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, #FFF3E0 0%, #FFE0B2 100%);
    padding: 0.6rem 1rem;
    border-radius: 10px 10px 0 0;
    border-bottom: 2px solid rgba(255,143,0,0.25);
    margin: 0;
}
.unit-title {
    font-family: var(--font-serif);
    font-size: 0.95rem;
    font-weight: 600;
    color: #E65100;
    margin: 0;
}
.unit-buttons {
    display: flex;
    gap: 0.5rem;
    margin: 0;
}
.unit-buttons .audio-btn {
    background: linear-gradient(135deg, #FF8F00 0%, #F57C00 100%);
    color: white;
    border: none;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.82rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.unit-buttons .audio-btn:hover {
    background: linear-gradient(135deg, #F57C00 0%, #EF6C00 100%);
}
.unit-buttons .audio-btn.playing {
}

/* 导航菜单古典装饰 - 左右书名号 */
.nav-dropdown li {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.deco-left, .deco-right {
    color: #D4342F !important;
    opacity: 0.5 !important;
    font-size: 0.85rem;
    flex-shrink: 0;
}
.deco-left { margin-right: 2px; }
.deco-right { margin-left: 2px; }

.nav-dropdown li:hover .deco-left,
.nav-dropdown li:hover .deco-right {
    opacity: 0.8;
}

/* 导航下拉菜单flex布局 - 强制生效 */
ul.nav-dropdown li {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}
ul.nav-dropdown li a {
    display: block !important;
    text-align: center !important;
}

/* 学生入口按钮 - 红色背景突出显示 */
.nav-item.xuesheng {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
    color: white !important;
    font-weight: 600;
    padding: 0.5rem 1.2rem;
    box-shadow: 0 2px 6px rgba(192, 57, 43, 0.3);
    transition: all 0.3s ease;
}

.nav-item.xuesheng:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(192, 57, 43, 0.5);
}

.nav-item.xuesheng.active {
    background: linear-gradient(135deg, #922b21 0%, #c0392b 100%);
}
