/* MEGA Tech 博客全局样式 - 2026-03-18 */

/* ======================
   图片大小控制 - 电脑端
   ====================== */

/* 文章中的所有图片 */
.article-content img,
.article-body img,
figure img {
    max-width: 65% !important;
    height: auto;
    display: block;
    margin: 30px auto;
}

/* YouTube视频和iframe */
iframe,
video {
    max-width: 65% !important;
    height: auto;
    display: block;
    margin: 30px auto;
}

/* 图片容器 */
figure {
    text-align: center;
    margin: 30px 0;
}

/* P-Q曲线图可以稍大一些 */
img[src*="pq-curve"] {
    max-width: 75% !important;
}

/* ======================
   表格样式 - 电脑端（居中对齐）
   ====================== */

.article-body table,
.article-content table {
    max-width: 75% !important;
    width: 75% !important;
    margin: 30px auto !important;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: table !important;
}

/* 表头 */
th {
    background: #f8f9fa;
    font-weight: bold;
    padding: 12px 15px;
    text-align: left;
    border: 1px solid #dee2e6;
}

/* 表格单元格 */
td {
    padding: 10px 15px;
    border: 1px solid #dee2e6;
    vertical-align: top;
}

/* 斑马条纹 */
tbody tr:nth-child(odd) {
    background: #f8f9fa;
}

/* 鼠标悬停效果 */
tbody tr:hover {
    background: #e9ecef;
}

/* ======================
   响应式设计 - 手机端
   ====================== */

/* 手机/平板竖屏 */
@media (max-width: 768px) {
    .article-content img,
    .article-body img,
    figure img,
    iframe,
    video {
        max-width: 90% !important;
        margin: 20px auto;
    }
    
    img[src*="pq-curve"] {
        max-width: 90% !important;
    }
    
    /* 表格移动端 */
    .article-body table,
    .article-content table {
        max-width: 95% !important;
        width: 95% !important;
        margin: 20px auto !important;
        font-size: 14px;
        overflow-x: auto;
    }
    
    th, td {
        padding: 8px 10px;
        font-size: 14px;
    }
}

/* 小手机 */
@media (max-width: 480px) {
    .article-content img,
    .article-body img,
    figure img,
    iframe,
    video {
        max-width: 95% !important;
        margin: 15px auto;
    }
    
    .article-body table,
    .article-content table {
        max-width: 98% !important;
        width: 98% !important;
        margin: 15px auto !important;
        font-size: 13px;
    }
    
    th, td {
        padding: 6px 8px;
        font-size: 13px;
    }
}

/* 平板横屏 */
@media (min-width: 768px) and (max-width: 1024px) {
    .article-content img,
    .article-body img,
    figure img,
    iframe,
    video {
        max-width: 75% !important;
        margin: 25px auto;
    }
    
    table {
        max-width: 80% !important;
        width: 80% !important;
    }
}

/* 超宽屏 */
@media (min-width: 1400px) {
    .article-content img,
    .article-body img,
    figure img,
    iframe,
    video {
        max-width: 55% !important;
    }
    
    table {
        max-width: 60% !important;
        width: 60% !important;
    }
}


/* 面包屑导航样式 */
.breadcrumb {
    margin: 20px 0;
    padding: 15px 0;
    font-size: 14px;
}

.breadcrumb ol {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.breadcrumb li {
    display: inline-flex;
    align-items: center;
}

.breadcrumb li:not(:last-child)::after {
    content: "»";
    margin: 0 10px;
    color: #999;
}

.breadcrumb a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb a:hover {
    color: #004499;
    text-decoration: underline;
}

.breadcrumb span {
    color: #666;
    font-weight: 500;
}

/* 移动端面包屑 */
@media (max-width: 768px) {
    .breadcrumb {
        font-size: 13px;
        margin: 15px 0;
        padding: 10px 0;
    }
    
    .breadcrumb li:not(:last-child)::after {
        margin: 0 6px;
    }
}


/* 订阅区域样式 */
.subscribe-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 20px;
    margin: 50px auto;
    max-width: 800px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    clear: both;
    z-index: 100;
}


.subscribe-header h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 600;
}

.subscribe-header p {
    margin: 0 0 20px 0;
    font-size: 14px;
    opacity: 0.9;
}

.subscribe-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.subscribe-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: white;
    color: #667eea;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid white;
}

.subscribe-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    background: #f8f9fa;
}

.subscribe-icon {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* 订阅模态框 */
.subscribe-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    margin: 15% auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-content h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 22px;
}

.modal-content p {
    margin: 0 0 20px 0;
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

.close-modal {
    position: absolute;
    right: 15px;
    top: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    transition: color 0.2s;
    width: 35px;
    height: 35px;
    line-height: 1;
    padding: 0;
}

.close-modal:hover {
    color: #333;
}

/* 移动端订阅区域 */
@media (max-width: 768px) {
    .subscribe-section {
        margin: 30px auto;
        padding: 25px 15px;
    }
    
    .subscribe-header h3 {
        font-size: 20px;
    }
    
    .subscribe-options {
        flex-direction: column;
        gap: 10px;
    }
    
    .subscribe-btn {
        width: 100%;
        justify-content: center;
        padding: 10px 20px;
    }
}


/* ============================================
   订阅区域样式修复 - 解决图片遮挡问题
   ============================================ */
.subscribe-section {
    position: relative;
    z-index: 100;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px 20px;
    margin: 50px auto;  /* 增加上下间距 */
    max-width: 800px;
    clear: both;  /* 清除浮动，避免被其他元素影响 */
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

/* 确保订阅区域前后都有足够的间距 */
.subscribe-section + *,
* + .subscribe-section {
    margin-top: 50px;
}

/* 防止图片等元素与订阅区域重叠 */
.subscribe-section::before,
.subscribe-section::after {
    content: '';
    display: table;
}


/* Site Title Styling (for inner pages) */
header .site-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
    line-height: 1.3;
    font-weight: bold;
}

header .site-title a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
    display: inline-block;
}

header .site-title a:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Hero H1 样式 - 白色大字体 */
.hero h1 {
    color: white !important;
    font-size: 2.8rem !important;
    font-weight: bold;
    margin-bottom: 15px;
    line-height: 1.3;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-bottom: none;
    margin-bottom: 40px;
    padding: 60px 20px;
}

.hero p {
    color: rgba(255, 255, 255, 0.95) !important;
    font-size: 1.3rem !important;
}

/* Site Title Styling (for inner pages) - Match h1 size */
header .site-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
    line-height: 1.3;
    font-weight: bold;
}

header .site-title a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
    display: inline-block;
}

header .site-title a:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* Mobile responsiveness for site-title */
@media (max-width: 768px) {
    header .site-title {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    header .site-title {
        font-size: 1.6rem;
    }
}

/* ======================
   表格横向滚动（新增 2026-03-27）
   ====================== */

/* 为表格添加滚动容器效果 */
.article-body,
.article-content {
    overflow-x: auto;
}

/* 表格保持原始宽度，不被压缩 */
.article-body table,
.article-content table {
    min-width: 600px;
    width: auto;
    max-width: none !important;
}

/* 手机端表格滚动 */
@media (max-width: 768px) {
    /* 文章容器允许横向滚动 */
    .article-body,
    .article-content {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 表格保持原始宽度 */
    .article-body table,
    .article-content table {
        min-width: 500px;
        width: auto;
        max-width: none !important;
        margin: 20px 0 !important;
    }
}
