/* ============================================
   文章详情页样式 (single.php)
   从 single.php 内联 <style> 提取，支持浏览器缓存
   ============================================ */

:root {
    --article-primary: #1a365d;
    --article-accent: #1a73e8;
    --article-dark: #0f172a;
    --article-text: #334155;
    --article-text-light: #64748b;
    --article-border: #e2e8f0;
}

.single-article-page {
    font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #fafbfc;
    min-height: 100vh;
}

.article-hero {
    position: relative;
    padding: 80px 0 100px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    overflow: hidden;
}

.article-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 10% 90%, rgba(26, 115, 232, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 90% 10%, rgba(26, 54, 93, 0.3) 0%, transparent 40%),
        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.03'%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");
}

.article-hero::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(to top, #fafbfc, transparent);
}

.article-hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
    animation: fadeInUp 0.8s ease-out;
}

.article-breadcrumb {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

.article-breadcrumb a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: color 0.3s;
}

.article-breadcrumb a:hover {
    color: #1a73e8;
}

.article-breadcrumb i {
    font-size: 10px;
    opacity: 0.6;
}

.article-title {
    font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "STSong", "SimSun", serif;
    font-size: 42px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 24px 0;
    line-height: 1.3;
}

.article-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}

.article-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.article-meta-item i {
    font-size: 14px;
    opacity: 0.8;
}

.article-category {
    background: #1a73e8;
    color: #fff;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s;
}

.article-category:hover {
    background: #1557b0;
}

.article-main {
    padding: 0 0 80px;
    margin-top: -40px;
    position: relative;
    z-index: 3;
}

.article-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 40px;
}

.article-content-wrapper {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.article-featured-image {
    margin: -40px -40px 30px -40px;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
}

.article-featured-image img {
    width: 100%;
    height: auto;
    display: block;
}

.article-body-wrapper {
    position: relative;
}

.article-body-wrapper.collapsed .article-body {
    max-height: 600px;
    overflow: hidden;
}

.article-body-wrapper.expanded .article-body {
    max-height: none;
    overflow: visible;
}

.article-body-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(to bottom, transparent, #fff);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.article-body-wrapper.collapsed .article-body-fade {
    opacity: 1;
}

.article-body-wrapper.expanded .article-body-fade {
    opacity: 0;
}

.expand-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 20px;
    margin-top: -100px;
    background: linear-gradient(to bottom, transparent, #fff);
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: #1a73e8;
    transition: all 0.3s ease;
    z-index: 10;
}

.expand-btn:hover {
    color: #1557b0;
}

.expand-btn i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.article-body-wrapper.collapsed .expand-btn {
    margin-top: 0;
}

.article-body-wrapper.expanded .expand-btn {
    margin-top: 20px;
    background: #fff;
}

.article-body {
    font-size: 16px;
    line-height: 1.8;
    color: #334155;
}

.article-body p {
    margin-bottom: 1.5em;
}

.article-body h2 {
    font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "STSong", "SimSun", serif;
    font-size: 26px;
    font-weight: 600;
    color: #1e293b;
    margin: 1.5em 0 1em 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.article-body h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 1.3em 0 0.8em 0;
}

.article-body a {
    color: #1a73e8;
    text-decoration: underline;
    transition: color 0.3s;
}

.article-body a:hover {
    color: #1557b0;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1em 0;
    cursor: zoom-in;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.article-body img:hover {
    transform: scale(1.01);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* 文章图片放大灯箱 */
.article-img-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(15, 23, 42, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    cursor: zoom-out;
    padding: 20px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.article-img-overlay.active {
    opacity: 1;
    visibility: visible;
}

.article-img-overlay img {
    max-width: 92vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    transform: scale(0.92);
    transition: transform 0.3s ease;
    cursor: default;
}

.article-img-overlay.active img {
    transform: scale(1);
}

.article-img-close {
    position: absolute;
    top: 20px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.article-img-close:hover {
    background: rgba(255,255,255,0.25);
}

.article-body video {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 1.5em 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: block;
}

.article-body .wp-video,
.article-body .video-wrapper {
    width: 100% !important;
    margin: 1.5em 0;
}

.article-body .wp-video .wp-video-shortcode,
.article-body video.wp-video-shortcode {
    width: 100% !important;
    max-width: 100%;
    height: auto;
    border-radius: 12px;
}

.article-body iframe {
    max-width: 100%;
    width: 100%;
    border-radius: 12px;
    margin: 1.5em 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.article-body .embed-container,
.article-body .video-embed {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    margin: 1.5em 0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.article-body .embed-container iframe,
.article-body .embed-container video,
.article-body .video-embed iframe,
.article-body .video-embed video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 12px;
}

.article-body ul, .article-body ol {
    margin: 1em 0;
    padding-left: 2em;
}

.article-body li {
    margin-bottom: 0.5em;
}

.article-body blockquote {
    background: linear-gradient(135deg, #e8f0fe, #d2e3fc);
    border-left: 4px solid #1a73e8;
    padding: 20px 24px;
    margin: 1.5em 0;
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: #64748b;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5em 0;
    font-size: 14px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    overflow: hidden;
}

.article-body table thead {
    background: linear-gradient(135deg, #1a73e8, #1565c0);
    color: #fff;
}

.article-body table thead th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    border: none;
}

.article-body table thead th:first-child {
    border-radius: 12px 0 0 0;
}

.article-body table thead th:last-child {
    border-radius: 0 12px 0 0;
}

.article-body table tbody {
    background: #fff;
}

.article-body table tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s ease;
}

.article-body table tbody tr:last-child {
    border-bottom: none;
}

.article-body table tbody tr:hover {
    background: #f8fafc;
}

.article-body table tbody td {
    padding: 12px 16px;
    color: #334155;
    border: none;
}

.article-body table tbody tr:first-child td:first-child {
    border-radius: 0 0 0 12px;
}

.article-body table tbody tr:first-child td:last-child {
    border-radius: 0 0 12px 0;
}

.article-body table tfoot {
    background: #f8fafc;
    border-top: 2px solid #e2e8f0;
}

.article-body table tfoot td {
    padding: 12px 16px;
    font-weight: 600;
    color: #475569;
}

.article-body table tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.2s ease;
}

.article-body table tr:last-child {
    border-bottom: none;
}

.article-body table tr:hover {
    background: #f8fafc;
}

.article-body table td {
    padding: 12px 16px;
    color: #334155;
    border: none;
}

.article-body table th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    border: none;
}

/* 无 thead 的表格，第一行作为标题行 */
.article-body table tbody:first-child tr:first-child {
    background: linear-gradient(135deg, #1a73e8, #1565c0);
    color: #fff;
}

.article-body table tbody:first-child tr:first-child td,
.article-body table tbody:first-child tr:first-child th {
    background: linear-gradient(135deg, #1a73e8, #1565c0);
    color: #fff;
    font-weight: 600;
}

.article-tags {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid #e2e8f0;
}

.tags-label {
    color: #64748b;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tag-link {
    background: #f1f5f9;
    color: #64748b;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    text-decoration: none;
    transition: all 0.3s;
}

.tag-link:hover {
    background: #1a73e8;
    color: #fff;
}

.article-share {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
}

.share-label {
    color: #64748b;
    font-size: 14px;
}

.share-buttons {
    display: flex;
    gap: 12px;
}

.share-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 18px;
    transition: all 0.3s;
    cursor: pointer;
    text-decoration: none;
}

.share-btn.wechat {
    background: #07c160;
    color: #fff;
}

.share-btn.weibo {
    background: #e6162d;
    color: #fff;
}

.share-btn.qq {
    background: #12b7f5;
    color: #fff;
}

.share-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.15);
}

.wechat-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.wechat-modal-content {
    background: #fff;
    border-radius: 16px;
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.wechat-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

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

.wechat-modal-header {
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.wechat-modal-header i {
    font-size: 24px;
    color: #07c160;
}

.wechat-modal-header span {
    font-size: 20px;
    font-weight: 600;
    color: #333;
}

.wechat-modal-body p {
    color: #666;
    margin-bottom: 20px;
}

.wechat-qrcode {
    padding: 20px;
    background: #f8f8f8;
    border-radius: 12px;
    margin-bottom: 20px;
}

.wechat-qrcode img {
    width: 180px;
    height: 180px;
    object-fit: contain;
}

.wechat-tip {
    font-size: 13px;
    color: #999;
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .wechat-modal-content {
        padding: 20px;
    }
    .wechat-qrcode img {
        width: 150px;
        height: 150px;
    }
}

.article-navigation {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item:hover {
    background: #f1f5f9;
}

.nav-prev {
    text-align: left;
}

.nav-next {
    text-align: right;
}

.nav-label {
    font-size: 12px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-title {
    font-size: 15px;
    font-weight: 500;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-sidebar {
    position: sticky;
    top: 20px;
}

.sidebar-widget {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
}

.widget-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 20px 0;
    padding-bottom: 14px;
    border-bottom: 2px solid #1a73e8;
    display: flex;
    align-items: center;
    gap: 10px;
}

.widget-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: linear-gradient(to bottom, #1a73e8, #4285f4);
    border-radius: 2px;
}

.related-posts, .hot-posts {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.related-post-item {
    display: flex;
    gap: 14px;
    text-decoration: none;
    transition: all 0.3s;
}

.related-post-item:hover .related-post-info h4 {
    color: #1a73e8;
}

.related-post-image {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
}

.related-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.related-post-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.related-post-info h4 {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    margin: 0 0 6px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s;
}

.related-post-info span {
    font-size: 12px;
    color: #94a3b8;
}

.hot-post-item {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
    transition: all 0.3s;
}

.hot-post-item:hover .hot-post-info h4 {
    color: #1a73e8;
}

.hot-post-rank {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a365d, #0f172a);
    color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

.hot-post-item:nth-child(1) .hot-post-rank {
    background: linear-gradient(135deg, #1a73e8, #1557b0);
}

.hot-post-info {
    flex: 1;
}

.hot-post-info h4 {
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
    margin: 0 0 4px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s;
}

.hot-post-info span {
    font-size: 12px;
    color: #94a3b8;
}

.no-related {
    color: #94a3b8;
    font-size: 14px;
    text-align: center;
    padding: 20px 0;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1200px) {
    .article-layout {
        grid-template-columns: 1fr;
    }
    
    .article-sidebar {
        position: static;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 24px;
    }
    
    .sidebar-widget {
        margin-bottom: 0;
    }
}

@media (max-width: 768px) {
    .article-hero {
        padding: 60px 0 80px;
    }
    
    .article-title {
        font-size: 28px;
    }
    
    .article-meta {
        gap: 12px;
    }
    
    .article-content-wrapper {
        padding: 24px;
    }
    
    .article-featured-image {
        margin: -24px -24px 24px -24px;
    }
    
    .article-body {
        font-size: 15px;
    }
    
    .article-body video {
        border-radius: 10px;
    }
    
    .article-body iframe {
        border-radius: 10px;
    }
    
    .article-body .embed-container,
    .article-body .video-embed {
        border-radius: 10px;
    }
    
    .article-body table {
        font-size: 13px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .article-body table thead th,
    .article-body table tbody td,
    .article-body table tfoot td {
        padding: 10px 12px;
    }
    
    .article-body h2 {
        font-size: 22px;
    }
    
    .article-navigation {
        grid-template-columns: 1fr;
    }
    
    .article-sidebar {
        grid-template-columns: 1fr;
    }
    
    .article-share {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .article-body table {
        font-size: 12px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    }
    
    .article-body table thead th,
    .article-body table tbody td,
    .article-body table tfoot td {
        padding: 8px 10px;
    }
}

@media (max-width: 480px) {
    .article-hero-title {
        font-size: 24px;
    }
    
    .article-breadcrumb {
        font-size: 12px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .article-meta-item {
        font-size: 12px;
    }
    
    .article-body video {
        margin: 1em 0;
        border-radius: 8px;
    }
    
    .article-body iframe {
        border-radius: 8px;
        margin: 1em 0;
    }
    
    .article-body .embed-container,
    .article-body .video-embed {
        border-radius: 8px;
        margin: 1em 0;
    }
    
    .article-body .wp-video {
        margin: 1em 0;
    }
    
    .article-body table {
        font-size: 11px;
    }
    
    .article-body table th,
    .article-body table td {
        padding: 6px 8px;
    }
    
    .article-body-wrapper.collapsed .article-body {
        max-height: 350px;
        overflow: hidden;
    }
    
    .article-body-wrapper.expanded .article-body {
        max-height: none;
        overflow: visible;
    }
    
    .article-body-fade {
        display: none !important;
    }
    
    .expand-btn {
        display: block;
        width: 100%;
        padding: 16px;
        font-size: 13px;
        min-height: 50px;
        -webkit-tap-highlight-color: transparent;
        background: #fff;
        border: none;
        cursor: pointer;
        font-weight: 600;
        color: #1a73e8;
        text-align: center;
        margin-top: 0;
    }
    
    .article-body-wrapper.collapsed .expand-btn {
        background: linear-gradient(to bottom, transparent, #fff);
    }
    
    .expand-btn i {
        font-size: 10px;
        margin-left: 5px;
    }
}