/* ============================================
   网络钓鱼编年史 - 章节内容页统一样式
   History of Phishing - Chapter Content Styles
   统一调用文件: chapters.css
   ============================================ */

/* ===== CHAPTER READER LAYOUT ===== */
.chapter-reader {
    padding-top: 72px;
    background: var(--bg-warm);
    min-height: 100vh;
}

/* ===== CHAPTER HEADER ===== */
.chapter-header {
    background: var(--primary-dark);
    padding: 80px 0 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.chapter-header::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 0%, rgba(201,162,39,0.1) 0%, transparent 60%);
}

.chapter-header .chapter-number {
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 700;
    color: var(--accent-gold);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.chapter-header .section-number {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 600;
    color: rgba(201,162,39,0.6);
    letter-spacing: 2px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.chapter-header h1 {
    font-family: var(--font-display);
    font-size: clamp(24px, 4vw, 40px);
    font-weight: 900;
    color: white;
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.3;
    position: relative;
    z-index: 1;
}

.chapter-header .chapter-desc {
    font-size: 15px;
    color: rgba(255,255,255,0.5);
    max-width: 600px;
    margin: 20px auto 0;
    line-height: 1.8;
    position: relative;
    z-index: 1;
}

/* ===== CHAPTER NAV (sticky) ===== */
.chapter-nav {
    background: white;
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    position: sticky;
    top: 72px;
    z-index: 100;
}

.chapter-nav-inner {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.chapter-nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: var(--transition-fast);
}

.chapter-nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.chapter-nav .nav-center,
.chapter-nav .section-indicator {
    font-size: 12px;
    color: var(--text-light);
    letter-spacing: 1px;
    padding: 8px 16px;
}

/* ===== CHAPTER CONTENT ===== */
.chapter-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 60px 24px 100px;
    background: white;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow);
}

.chapter-content h2 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    margin: 56px 0 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent-light);
    scroll-margin-top: 140px;
}

.chapter-content h3 {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 700;
    color: var(--primary-mid);
    margin: 40px 0 16px;
    scroll-margin-top: 140px;
}

.chapter-content h4 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin: 28px 0 12px;
}

.chapter-content p {
    font-size: 16px;
    line-height: 2;
    color: var(--text-secondary);
    margin-bottom: 20px;
    text-align: justify;
}

.chapter-content .lead {
    font-family: var(--font-display);
    font-size: 18px;
    color: var(--text);
    line-height: 2;
    margin-bottom: 32px;
    padding: 24px 28px;
    background: var(--bg-warm);
    border-left: 4px solid var(--accent-gold);
    border-radius: 0 var(--radius) var(--radius) 0;
}

/* ===== BLOCKQUOTE ===== */
.chapter-content blockquote {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 16px;
    color: var(--text-secondary);
    padding: 24px 28px;
    margin: 32px 0;
    background: var(--primary-light);
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-mid);
    position: relative;
}

.chapter-content blockquote::before {
    content: '"';
    position: absolute;
    top: 8px;
    left: 16px;
    font-family: var(--font-display);
    font-size: 48px;
    color: var(--accent-light);
    line-height: 1;
    pointer-events: none;
}

.chapter-content blockquote p {
    position: relative;
    z-index: 1;
    margin-bottom: 12px;
}

.chapter-content blockquote p:last-child {
    margin-bottom: 0;
}

.chapter-content blockquote cite {
    display: block;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-light);
    font-style: normal;
}

/* ===== DATA BOX ===== */
.data-box {
    background: linear-gradient(135deg, var(--primary-light), #f0f4f8);
    border-radius: var(--radius);
    padding: 28px;
    margin: 32px 0;
    border: 1px solid var(--border-light);
}

.data-box h4 {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 0;
}

.data-box p {
    font-size: 14px;
    margin-bottom: 0;
}

.data-box ul,
.data-box ol {
    margin: 8px 0 0 0;
    padding-left: 20px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.9;
}

.data-box ul li,
.data-box ol li {
    margin-bottom: 4px;
}

/* ===== CHART CONTAINER (NEW) ===== */
.chart-container {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    margin: 40px 0;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.chart-container:hover {
    box-shadow: var(--shadow);
}

.chart-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
}

.chart-header h4 {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-header .chart-source {
    font-size: 11px;
    color: var(--text-light);
    font-style: italic;
    max-width: 300px;
    text-align: right;
    line-height: 1.5;
}

.chart-body {
    width: 100%;
    height: 380px;
    padding: 16px;
}

.chart-caption {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.8;
    padding: 16px 24px 20px;
    margin: 0;
    background: var(--bg-warm);
    border-top: 1px solid var(--border-light);
    text-align: justify;
}

/* ===== TIMELINE INSET (纵向时间轴) ===== */
.timeline-inset {
    background: var(--bg-warm);
    border-radius: var(--radius);
    padding: 28px;
    margin: 32px 0;
    border: 1px solid var(--border-light);
}

.timeline-inset h4 {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 0;
}

.timeline-inset-item {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border);
}

.timeline-inset-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.timeline-inset-item .year {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    min-width: 80px;
    flex-shrink: 0;
}

.timeline-inset-item .event {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===== TIMELINE INLINE (内联时间轴) ===== */
.timeline-inline {
    background: var(--bg-warm);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin: 28px 0;
    border-left: 3px solid var(--accent-gold);
}

.timeline-inline .tl-item {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px dashed var(--border-light);
}

.timeline-inline .tl-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.timeline-inline .tl-year {
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    min-width: 80px;
    flex-shrink: 0;
}

.timeline-inline .tl-desc {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ===== FIGURE / IMAGE PLACEHOLDER ===== */
.figure-box {
    margin: 32px 0;
    text-align: center;
}

.figure-box .figure-placeholder {
    background: linear-gradient(135deg, var(--primary-light), #e8eef5);
    border-radius: var(--radius);
    padding: 48px 24px;
    border: 2px dashed var(--border);
    color: var(--text-light);
    font-size: 14px;
}

.figure-box .figure-caption {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 12px;
    font-style: italic;
}

/* ===== KEY TERMS ===== */
.key-term {
    background: var(--accent-light);
    color: var(--primary-dark);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 0.95em;
}

/* ===== PULL QUOTE (侧边引用) ===== */
.pull-quote {
    float: right;
    width: 280px;
    margin: 0 0 24px 32px;
    padding: 20px 24px;
    background: var(--bg-warm);
    border-radius: var(--radius);
    border-top: 3px solid var(--accent-gold);
    font-family: var(--font-display);
    font-size: 15px;
    font-style: italic;
    color: var(--text);
    line-height: 1.8;
}

.pull-quote cite {
    display: block;
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-light);
    font-style: normal;
}

/* ===== FOOTNOTE ===== */
.footnote {
    font-size: 13px;
    color: var(--text-light);
    padding: 20px 24px;
    background: #fafafa;
    border-radius: var(--radius);
    margin: 32px 0;
    border: 1px solid var(--border-light);
}

.footnote strong {
    color: var(--primary);
}

/* ===== SECTION TOC (本节内容导航) ===== */
.section-toc {
    background: var(--bg-warm);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin: 32px 0;
    border: 1px solid var(--border-light);
}

.section-toc h4 {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 12px;
    margin-top: 0;
}

.section-toc ol,
.section-toc ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
    line-height: 2;
}

.section-toc li a {
    color: var(--primary-mid);
    text-decoration: none;
}

.section-toc li a:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* ===== ARTICLE IMAGES (通用插图样式) ===== */
/* 
   用法：在文章中插入图片时，使用以下结构：
   <figure class="article-figure">
       <img src="../images/xxx.webp" alt="图片描述" loading="lazy">
       <figcaption>图片说明文字</figcaption>
   </figure>

   或者简写（自动识别p>img结构）：
   <p><img src="../images/xxx.webp" alt="图片描述"><br>图片说明文字</p>
*/

/* 基础图片样式 - 适用于文章内所有图片 */
.chapter-content img {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
    margin: 24px auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
    object-fit: contain;
}

.chapter-content img:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* 图片所在的段落容器 - 居中并限制最大宽度 */
.chapter-content p:has(> img:first-child) {
    text-align: center;
    margin: 32px 0;
}

/* 图片后的换行+文字作为图片说明 */
.chapter-content p:has(> img) br + * {
    display: block;
    font-size: 13px;
    color: var(--text-light);
    text-align: center;
    margin-top: 12px;
    font-style: italic;
    line-height: 1.6;
}

/* figure 标签样式（推荐用法） */
.chapter-content figure.article-figure {
    margin: 32px 0;
    text-align: center;
}

.chapter-content figure.article-figure img {
    margin: 0 auto 12px;
}

.chapter-content figure.article-figure figcaption {
    font-size: 13px;
    color: var(--text-light);
    font-style: italic;
    line-height: 1.6;
    text-align: center;
}

/* ===== LISTS ===== */
.chapter-content ul,
.chapter-content ol {
    margin: 16px 0 24px 24px;
    color: var(--text-secondary);
    line-height: 2;
}

.chapter-content li {
    margin-bottom: 8px;
}

/* ===== SECTION LIST (章节目录页用) ===== */
.section-list {
    margin: 32px 0;
}

.section-list-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
    background: var(--bg-warm);
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid var(--border-light);
    transition: var(--transition);
    text-decoration: none;
}

.section-list-item:hover {
    box-shadow: var(--shadow);
    border-color: var(--accent-light);
    transform: translateY(-2px);
}

.section-list-item .sec-num {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 900;
    color: var(--accent-gold);
    min-width: 50px;
    text-align: center;
    line-height: 1;
}

.section-list-item .sec-info {
    flex: 1;
}

.section-list-item .sec-info h4 {
    font-family: var(--font-display);
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 6px;
    margin-top: 0;
}

.section-list-item .sec-info p {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 0;
    line-height: 1.7;
}

.section-list-item .sec-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    margin-top: 8px;
}

.sec-status.published {
    background: #dcfce7;
    color: #166534;
}

.sec-status.writing {
    background: #fef3c7;
    color: #92400e;
}

.sec-status.planned {
    background: #f3f4f6;
    color: #6b7280;
}

/* ===== FOOTER NAV ===== */
.chapter-footer-nav {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

.chapter-footer-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 20px 24px;
    background: white;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    text-decoration: none;
    transition: var(--transition);
}

.chapter-footer-nav a:hover {
    box-shadow: var(--shadow);
    border-color: var(--accent-light);
    transform: translateY(-2px);
}

.chapter-footer-nav a .label {
    font-size: 11px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chapter-footer-nav a .title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
}

.chapter-footer-nav a.next {
    text-align: right;
    align-items: flex-end;
}

.chapter-footer-nav a.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    /* 图片移动端适配 */
    .chapter-content img {
        margin: 16px auto;
        border-radius: var(--radius-sm);
    }
    .chapter-content p:has(> img:first-child) {
        margin: 24px 0;
    }
    .chapter-content figure.article-figure {
        margin: 24px 0;
    }
    .chapter-content figure.article-figure figcaption,
    .chapter-content p:has(> img) br + * {
        font-size: 12px;
    }
    
    .chapter-header {
        padding: 60px 0 40px;
    }
    .chapter-content {
        padding: 40px 20px 60px;
    }
    .chapter-content h2 {
        font-size: 20px;
    }
    .chapter-content h3 {
        font-size: 17px;
    }
    .chapter-content p {
        font-size: 15px;
    }
    .chapter-footer-nav {
        flex-direction: column;
    }
    .chapter-footer-nav a.next {
        text-align: left;
        align-items: flex-start;
    }
    .chapter-nav-inner {
        justify-content: center;
    }
    .chapter-nav .nav-center,
    .chapter-nav .section-indicator {
        display: none;
    }
    .section-list-item {
        flex-direction: column;
        gap: 12px;
    }
    .section-list-item .sec-num {
        font-size: 24px;
    }
    .pull-quote {
        float: none !important;
        width: 100% !important;
        margin: 24px 0 !important;
    }
    /* Chart responsive */
    .chart-body {
        height: 300px;
        padding: 10px;
    }
    .chart-header {
        padding: 16px 16px 12px;
    }
    .chart-header .chart-source {
        max-width: 100%;
        text-align: left;
        font-size: 10px;
    }
    .chart-caption {
        padding: 12px 16px 16px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    /* 图片小屏适配 */
    .chapter-content img {
        margin: 12px auto;
        border-radius: 8px;
    }
    .chapter-content p:has(> img:first-child) {
        margin: 16px 0;
    }
    .chapter-content figure.article-figure {
        margin: 16px 0;
    }
    
    .chart-body {
        height: 260px;
        padding: 8px;
    }
}
