/* ==========================================
   Post Page Styles
   ========================================== */

/* Article Header */
.article-header {
    position: relative;
    height: 70vh;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.article-hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.article-hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.article-hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.article-hero-background .hero-gradient {
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.4) 50%, rgba(0, 0, 0, 0.7) 100%);
    z-index: 2;
}

.article-hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: white;
    padding: 2rem 0;
}

.article-hero-content * {
    color: white !important;
}

.article-tags {
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.article-tag {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.article-tag:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.article-title {
    font-size: clamp(2rem, 5vw, 4rem);
    font-weight: 900;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    color: white !important;
    display: block !important;
    visibility: visible !important;
}

.article-title:empty::before {
    content: "文章標題";
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
}

.article-meta {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    font-size: 1rem;
    opacity: 0.9;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem 1.5rem;
    border-radius: 50px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.meta-item:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.meta-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    flex-shrink: 0;
}

.meta-icon {
    font-size: 1.2rem;
}

.meta-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.meta-label {
    font-size: 0.75rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.meta-content time,
.meta-content span {
    font-size: 0.9rem;
    font-weight: 600;
}

/* Article Content */
.article-content {
    padding: 4rem 0;
    background: white;
}

.article-body {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 3rem;
    min-height: 200px;
    padding: 2rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.article-body:empty::before {
    content: "請在 Ghost 後台編輯文章內容";
    color: #999;
    font-style: italic;
    display: block;
    text-align: center;
    padding: 2rem;
    background: #f8f9fa;
    border: 2px dashed #ddd;
    border-radius: 8px;
    margin: 2rem 0;
}

/* Article Meta Info (moved above content) */
.article-meta-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin: 0 auto 3rem auto;
    max-width: 800px;
    padding: 2rem;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 10px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.article-meta-info .meta-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.article-meta-info .meta-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.article-meta-info .meta-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.article-meta-info .meta-icon-wrapper i {
    font-size: 1.1rem;
    color: white;
}

.article-meta-info .meta-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.article-meta-info .meta-label {
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.article-meta-info .meta-content time,
.article-meta-info .meta-content span {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
}

.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.article-body h2 {
    font-size: 2rem;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.article-body h3 {
    font-size: 1.5rem;
    position: relative;
    padding-left: 1rem;
}

.article-body h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

.article-body p {
    margin-bottom: 1.5rem;
}

.article-body blockquote {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary-color);
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    font-style: italic;
    position: relative;
}

.article-body blockquote::before {
    content: '"';
    position: absolute;
    top: -10px;
    left: 10px;
    font-size: 3rem;
    color: var(--primary-color);
    opacity: 0.3;
}

.article-body ul,
.article-body ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.article-body li {
    margin-bottom: 0.5rem;
}

.article-body code {
    background: #f1f5f9;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Fira Code', monospace;
    font-size: 0.875rem;
    color: #e53e3e;
}

.article-body pre {
    background: #1a202c;
    color: #e2e8f0;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin: 2rem 0;
    font-family: 'Fira Code', monospace;
    font-size: 0.875rem;
    line-height: 1.5;
}

.article-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.article-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin: 2rem 0;
}

.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.article-body th,
.article-body td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.article-body th {
    background: var(--bg-dark);
    color: white;
    font-weight: 600;
}

.article-body tr:hover {
    background: var(--bg-secondary);
}

/* Article Footer */
.article-footer {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.article-tags-list {
    margin-bottom: 2rem;
}

.article-tags-list h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-link {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-radius: 25px;
    font-size: 0.875rem;
    transition: var(--transition);
    text-decoration: none;
}

.tag-link:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Share Buttons */
.article-share {
    text-align: center;
    margin-top: 2rem;
}

.article-share h4 {
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-size: 1.5rem;
    font-weight: 600;
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.share-button {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    cursor: pointer;
    font-size: 1.5rem;
    overflow: hidden;
}

.share-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.2) 50%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.share-button:hover::before {
    transform: translateX(100%);
}

.share-button.facebook {
    background: linear-gradient(135deg, #4267b2, #365899);
    color: white;
    box-shadow: 0 8px 25px rgba(66, 103, 178, 0.3);
}

.share-button.instagram {
    background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af, #515bd4);
    color: white;
    box-shadow: 0 8px 25px rgba(221, 42, 123, 0.3);
}

.share-button.threads {
    background: linear-gradient(135deg, #000000, #333333);
    color: white;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.share-button.linkedin {
    background: linear-gradient(135deg, #0077b5, #005885);
    color: white;
    box-shadow: 0 8px 25px rgba(0, 119, 181, 0.3);
}

.share-button.copy-link {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.share-button:hover {
    transform: translateY(-5px) scale(1.1);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.share-button:active {
    transform: translateY(-2px) scale(1.05);
}

.share-button i {
    position: relative;
    z-index: 2;
    font-size: 1.2rem;
}

/* Share button labels */
.share-button::after {
    content: attr(data-label);
    position: absolute;
    top: -40px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.share-button:hover::after {
    opacity: 1;
}

/* Related Posts */
.related-posts {
    padding: 4rem 0;
    background: var(--bg-secondary);
}

.related-posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.related-post {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
}

.related-post:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.related-post-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.related-post-image {
    height: 150px;
    overflow: hidden;
}

.related-post-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.related-post:hover .related-post-image img {
    transform: scale(1.05);
}

.related-post-content {
    padding: 1.5rem;
}

.related-post-title {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.related-post-excerpt {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    line-height: 1.5;
}

.related-post-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-light);
}

/* Progress Bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    z-index: 1001;
}

.reading-progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width 0.1s ease;
    box-shadow: 0 0 8px rgba(118, 75, 162, 0.4);
}

/* Table of Contents */
.toc {
    position: fixed;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    max-width: 200px;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.toc.active {
    opacity: 1;
    visibility: visible;
}

.toc h4 {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.toc ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.toc li {
    margin-bottom: 0.25rem;
}

.toc a {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    display: block;
    padding: 0.25rem 0;
}

.toc a:hover,
.toc a.active {
    color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .article-header {
        height: 50vh;
        min-height: 400px;
    }
    
    .article-title {
        font-size: 2rem;
    }
    
    .article-meta {
        flex-direction: column;
        gap: 1rem;
    }
    
    .article-body {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .share-buttons {
        justify-content: center;
    }
    
    .related-posts-grid {
        grid-template-columns: 1fr;
    }
    
    .toc {
        display: none;
    }
}

@media (max-width: 480px) {
    .article-content {
        padding: 2rem 0;
    }
    
    .article-body {
        padding: 0 0.5rem;
    }
    
    .article-footer {
        padding: 0 0.5rem;
    }
    
    .share-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .share-button {
        justify-content: center;
    }
}