/* /internal/assets/static/themes/default/css/article.css */

/*
 * ===================================================================
 * I. General Fixes & Layout
 * ===================================================================
 */

/* General container for article pages */
.article-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}


/*
 * ===================================================================
 * II. Article List Page (`article_list.html`)
 * ===================================================================
 */

.article-list-section {
    padding: 40px 0;
}

/* Page Header ("Blog", "Category: ...") */
.page-header {
    text-align: center;
    margin-bottom: 50px;
}

.page-header h1 {
    font-size: 3.5rem;
    margin-bottom: 10px;
    color: var(--color-text-light);
    background: none;
    -webkit-text-fill-color: initial;
}

.page-header .category-description,
.page-header .tag-description {
    font-size: 1.2rem;
    color: #6b7280;
}

/* Grid for article cards */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 40px;
}

/* Article Card */
.article-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid #e5e7eb;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.card-image {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.article-card:hover .card-image img {
    transform: scale(1.05);
}

.card-content {
    padding: 24px;
}

.card-content h2 {
    margin-top: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    /* Reset h2 global styles from style.css */
    padding-bottom: 0;
    color: var(--color-text-light);
}
.card-content h2::after {
    display: none;
}

.card-content .excerpt {
    font-size: 1rem;
    line-height: 1.6;
    color: #4b5563;
    margin-top: 12px;
    /* Clamp text to 3 lines */
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;  
    overflow: hidden;
}

.card-metadata {
    margin-top: 20px;
    font-size: 0.875rem;
    color: #6b7280;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #f3f4f6;
    padding-top: 16px;
}

/* Pagination */
.pagination {
    text-align: center;
    margin-top: 60px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 500;
    color: #374151;
    background-color: #fff;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.pagination a:hover {
    border-color: var(--color-accent-blue);
    color: var(--color-accent-blue);
    background-color: #f9fafb;
}

.pagination .page-info {
    border-color: var(--color-accent-blue);
    background-color: var(--color-accent-blue);
    color: #fff;
    font-weight: 600;
}

.pagination .disabled {
    color: #9ca3af;
    background-color: #f3f4f6;
    border-color: #e5e7eb;
    pointer-events: none;
}


/*
 * ===================================================================
 * III. Article Detail Page (`article_detail.html`)
 * ===================================================================
 */

.article-full-container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    max-width: 80ch; /* Optimal reading width */
    margin: 0 auto 40px auto; /* Removed margin-top to avoid collapsing with main's padding-top */
    padding: 40px 50px 50px;
}

@media (max-width: 768px) {
    .article-full-container {
        padding: 25px;
    }
}

.article-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid #e5e7eb;
}

.article-header h1 {
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 20px;
    color: #111827;
    background: none;
    -webkit-text-fill-color: initial;
}

.article-header .metadata {
    color: #6b7280;
    font-size: 0.95rem;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.article-header .metadata span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.article-header .categories {
    margin-top: 15px;
    font-size: 0.95rem;
}
.article-header .categories a {
    color: var(--color-accent-blue);
    text-decoration: none;
    margin: 0 5px;
    font-weight: 500;
}
.article-header .categories a:hover {
    text-decoration: underline;
}

.article-cover {
    margin: 0 auto 40px;
    border-radius: 12px;
    overflow: hidden;
}
.article-cover img {
    width: 100%;
    display: block;
}

/* Article Content Styling */
.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #374151;
}

.article-content h1, 
.article-content h2, 
.article-content h3,
.article-content h4,
.article-content h5,
.article-content h6 {
    color: #111827;
    margin-top: 2.2em;
    margin-bottom: 1em;
    font-weight: 600;
    line-height: 1.3;
}
.article-content h2 {
    padding-bottom: 0.3em;
    border-bottom: 1px solid #e5e7eb;
}

.article-content p {
    margin-bottom: 1.2em;
}

.article-content a {
    color: var(--color-accent-blue);
    text-decoration: none;
    font-weight: 500;
}
.article-content a:hover {
    text-decoration: underline;
}

.article-content ul, .article-content ol {
    padding-left: 25px;
    margin-bottom: 1.2em;
}

.article-content li > p {
    margin-bottom: 0.5em;
}

.article-content blockquote {
    border-left: 4px solid var(--color-accent-blue);
    padding: 10px 20px;
    margin: 20px 0;
    background-color: #f9fafb;
    color: #4b5563;
    font-style: italic;
}

.article-content blockquote p {
    margin: 0;
}

/* Code Block Styling */
.article-content pre {
    background: #2d2d2d; /* Dark background */
    color: #f8f8f2; /* Light text */
    padding: 20px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 20px 0;
    position: relative; /* For copy button positioning */
}

.article-content code {
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.95em;
}

/* Inline code */
.article-content :not(pre) > code {
    background: #e5e7eb;
    color: #dd1144;
    padding: .2em .4em;
    margin: 0;
    font-size: 85%;
    border-radius: 3px;
}

.copy-code-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: #4a4a4a;
    color: #ccc;
    border: 1px solid #666;
    border-radius: 5px;
    padding: 4px 8px;
    font-size: 0.8em;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.article-content pre:hover .copy-code-button {
    opacity: 1;
}

.copy-code-button:hover {
    background-color: #5a5a5a;
    color: #fff;
}
.copy-code-button:active {
    background-color: #6a6a6a;
}

/* Article Footer (Tags) */
.article-footer {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #e5e7eb;
}

.article-footer .tags-label {
    font-weight: 600;
    color: #111827;
    margin-right: 10px;
}

.article-footer .tags a {
    display: inline-block;
    background-color: #eef2ff;
    color: #4338ca;
    padding: 6px 12px;
    margin: 0 5px 8px 0;
    border-radius: 9999px; /* Pill shape */
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s;
}
.article-footer .tags a:hover {
    background-color: #e0e7ff;
    color: #3730a3;
}

/* Related Articles Section */
.related-articles {
    margin-top: 60px;
    padding-top: 40px;
    border-top: 1px solid #e5e7eb;
}
.related-articles h2 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 40px;
    color: #111827;
}
.related-articles h2::after {
    display: none; /* remove global h2 style */
}

/* Use the same articles-grid and article-card for related articles */
.related-articles .articles-grid {
    gap: 30px;
}

.related-articles .article-card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}
.related-articles .card-image {
    height: 180px;
}
.related-articles .card-content h2 {
    font-size: 1.2rem;
}
.related-articles .card-content {
    padding: 20px;
}
