/* Blog Common Styles */

:root {
    --font-heading: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --color-dark: #0f172a;
    --color-text: #475569;
    --color-primary: #2563eb;
    --color-primary-dark: #1d4ed8;
    --color-accent: #eff6ff;
    --color-bg: #f8fafc;
    --color-surface: #ffffff;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    --radius-lg: 1.5rem;
    --radius-md: 1rem;
    --radius-sm: 0.5rem;
}

body {
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.blog-page {
    background-color: var(--color-bg);
    padding-bottom: 6rem;
}

/* --- Hero Header (Index) --- */
.blog-hero {
    position: relative;
    padding: 6rem 1.5rem 5rem;
    text-align: center;
    background: #fff;
    border-bottom: 1px solid #f1f5f9;
    overflow: hidden;
}

.blog-hero__overline {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-primary);
    margin-bottom: 1.2rem;
    background: rgba(37, 99, 235, 0.08);
    padding: 0.5rem 1.2rem;
    border-radius: 999px;
}

.blog-hero__title {
    font-family: var(--font-heading);
    font-size: clamp(2.8rem, 5vw, 4.5rem);
    font-weight: 800;
    color: var(--color-dark);
    line-height: 1.05;
    margin: 0 auto 1.5rem;
    max-width: 950px;
    letter-spacing: -0.03em;
}

.blog-hero__subtitle {
    font-size: 1.25rem;
    color: var(--color-text);
    line-height: 1.6;
    max-width: 650px;
    margin: 0 auto;
}

/* --- Featured Post (Index) --- */
.featured-section {
    max-width: 1200px;
    margin: 4rem auto 5rem;
    padding: 0 1.5rem;
}

.featured-card {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    background: #ffffff;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    min-height: 520px;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(0,0,0,0.02);
}

.featured-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.featured-card__image {
    position: relative;
    overflow: hidden;
}

.featured-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s cubic-bezier(0.2, 1, 0.3, 1);
}

.featured-card:hover .featured-card__image img {
    transform: scale(1.05);
}

.featured-card__content {
    padding: 4.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #fff;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.featured-card__title {
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--color-dark);
    line-height: 1.1;
    margin: 0 0 1.5rem;
    letter-spacing: -0.03em;
}

.featured-card__excerpt {
    font-size: 1.15rem;
    color: var(--color-text);
    line-height: 1.7;
    margin-bottom: 2.5rem;
}

.read-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1rem;
    transition: gap 0.2s ease;
}

.featured-card:hover .read-more-btn {
    gap: 0.75rem;
}

/* --- Grid Section (Index) --- */
.posts-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.section-label {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 2.5rem;
    padding-left: 1rem;
    border-left: 4px solid var(--color-primary);
    line-height: 1;
}

.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 2.5rem;
}

.grid-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    height: 100%;
    border: 1px solid #e2e8f0;
}

.grid-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: transparent;
}

.grid-card__image {
    aspect-ratio: 16/10;
    position: relative;
    overflow: hidden;
    background: #f1f5f9;
}

.grid-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.grid-card:hover .grid-card__image img {
    transform: scale(1.08);
}

.grid-card__content {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.grid-card__title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-dark);
    line-height: 1.3;
    margin: 0 0 1rem;
    letter-spacing: -0.02em;
}

.grid-card__excerpt {
    font-size: 0.95rem;
    color: var(--color-text);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.grid-card__footer {
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 1.25rem;
    border-top: 1px solid #f1f5f9;
    font-size: 0.85rem;
    font-weight: 600;
    color: #94a3b8;
}

.grid-card__read-time {
    color: var(--color-primary);
}

/* --- Article Detail Page Styles --- */

.article-wrapper {
    max-width: 840px; /* Slightly wider for editorial feel */
    margin: 0 auto;
    padding: 4rem 1.5rem 6rem;
}

.article-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

/* Top Meta: Tag & Date */
.article-meta-top {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.article-tag {
    color: var(--color-primary);
    background: #eff6ff;
    padding: 0.3rem 0.8rem;
    border-radius: 99px;
    font-size: 0.8rem;
}

.article-date {
    color: #94a3b8;
}

.article-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 4vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    color: var(--color-dark);
    margin: 0 auto 2rem;
    letter-spacing: -0.03em;
}

/* Author Row */
.article-author-row {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
}

.author-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
}

.author-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #64748b;
    font-size: 1.2rem;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.author-text {
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

.author-name {
    font-weight: 700;
    color: var(--color-dark);
    font-size: 1rem;
}

.author-role {
    font-size: 0.85rem;
    color: #64748b;
}

/* Hero Image */
.article-hero {
    width: 100%;
    aspect-ratio: 16/9;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 4rem;
    box-shadow: var(--shadow-xl);
    background: #f1f5f9;
}

.article-hero img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Body Layout */
.article-body-wrapper {
    max-width: 720px; /* Optimal reading width */
    margin: 0 auto;
}

/* Table of Contents */
.toc-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 2rem;
    margin-bottom: 3.5rem;
    box-shadow: var(--shadow-sm);
}

.toc-title {
    font-size: 0.95rem;
    font-weight: 800;
    margin: 0 0 1.2rem;
    color: var(--color-dark);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.toc-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.toc-list a {
    color: #64748b;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
    display: block;
    padding-left: 1rem;
    border-left: 3px solid #f1f5f9;
}

.toc-list a:hover {
    color: var(--color-primary);
    border-left-color: var(--color-primary);
    padding-left: 1.25rem;
    background: linear-gradient(90deg, #f8fafc 0%, transparent 100%);
}

/* Content Typography */
.article-content {
    font-size: 1.15rem;
    line-height: 1.8;
    color: #334155;
    font-family: "Inter", sans-serif; /* Ensure consistent reading font */
}

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

.article-content .lead {
    font-size: 1.35rem;
    font-weight: 400;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

.article-content h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-top: 3.5rem;
    margin-bottom: 1.25rem;
    color: var(--color-dark);
    letter-spacing: -0.02em;
    line-height: 1.25;
}

.article-content h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--color-dark);
    letter-spacing: -0.01em;
}

.article-content ul, .article-content ol {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
}

.article-content li {
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.article-content li::marker {
    color: var(--color-primary);
    font-weight: 600;
}

.article-content a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    text-decoration-color: rgba(37, 99, 235, 0.3);
    transition: all 0.2s;
    font-weight: 600;
}

.article-content a:hover {
    color: var(--color-primary-dark);
    text-decoration-color: var(--color-primary);
}

/* Enhanced Blockquote */
.article-content blockquote {
    border: none;
    background: #f8fafc;
    margin: 3rem 0;
    padding: 2.5rem;
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--color-dark);
    border-radius: var(--radius-md);
    position: relative;
    box-shadow: inset 4px 0 0 var(--color-primary);
}

.article-content blockquote::before {
    content: "“";
    position: absolute;
    top: 1rem;
    left: 1.5rem;
    font-size: 4rem;
    line-height: 1;
    color: #e2e8f0;
    font-family: serif;
}

/* Info Box (custom style often used in content) */
.info-box {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin: 2rem 0;
    color: #1e40af;
    font-size: 1.05rem;
}

/* Tables */
.article-content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 2.5rem 0;
    font-size: 1rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 1px solid #e2e8f0;
}

.article-content th {
    background: #f8fafc;
    font-weight: 700;
    text-align: left;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    color: var(--color-dark);
}

.article-content td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.article-content tr:last-child td {
    border-bottom: none;
}

/* Share Section */
.share-section {
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.share-label {
    font-weight: 700;
    color: var(--color-dark);
    margin-bottom: 1.5rem;
}

.share-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.share-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.6rem 1.5rem;
    border-radius: 99px;
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    color: #fff;
    transition: transform 0.2s;
}

.share-btn:hover {
    transform: translateY(-2px);
}

.share-fb { background: #1877f2; }
.share-li { background: #0a66c2; }
.share-mail { background: #475569; }

/* Article Footer */
.article-footer {
    margin-top: 3rem;
    text-align: center;
}

/* --- New Related Posts Section (Grid/Card Redesign) --- */
.related-section-wrapper {
    background-color: #f8fafc;
    border-top: 1px solid #e2e8f0;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    width: 100vw;
    padding: 5rem 0;
    margin-top: 5rem;
}

.related-posts {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.related-posts__heading {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-dark);
    margin-bottom: 2.5rem;
    text-align: left;
    letter-spacing: -0.02em;
}

.related-posts__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.next-post-card {
    background: #ffffff;
    border-radius: var(--radius-md);
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0,0,0,0.04);
}

.next-post-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
}

.next-post-card__image-wrapper {
    width: 100%;
    aspect-ratio: 16/9;
    background: #e2e8f0;
    position: relative;
    overflow: hidden;
}

.next-post-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.next-post-card:hover .next-post-card__image {
    transform: scale(1.1);
}

.next-post-card__placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-weight: 700;
    font-size: 1rem;
    background-color: #e2e8f0;
}

.next-post-card__content {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.next-post-card__meta {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.next-post-card__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-dark);
    margin: 0 0 1rem;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.next-post-card__action {
    margin-top: auto;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--color-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: gap 0.2s ease;
}

.next-post-card:hover .next-post-card__action {
    gap: 0.6rem;
}

/* Buttons */
.button.outline {
    display: inline-flex;
    align-items: center;
    padding: 0.75rem 1.5rem;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    background: transparent;
    color: #64748b;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.button.outline:hover {
    border-color: #cbd5e1;
    color: var(--color-dark);
    background: #fff;
    transform: translateY(-1px);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .featured-card {
        grid-template-columns: 1fr;
        min-height: auto;
    }
    .featured-card__image {
        aspect-ratio: 21/9;
    }
    .featured-card__content {
        padding: 2.5rem;
    }
    .featured-card__title {
        font-size: 2.2rem;
    }
    
    .related-posts__grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .blog-hero {
        padding: 4rem 1rem 4rem;
    }
    .blog-hero__title {
        font-size: 2.5rem;
    }
    
    .featured-card__image {
        aspect-ratio: 16/9;
    }
    .featured-card__content {
        padding: 1.5rem;
    }
    .featured-card__title {
        font-size: 1.75rem;
    }
    
    .posts-grid {
        display: flex;
        overflow-x: auto;
        gap: 1rem;
        scroll-snap-type: x mandatory;
        scroll-padding: 1rem;
        padding: 0 1rem 1.5rem;
        margin: 0 -1rem;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .posts-grid::-webkit-scrollbar {
        display: none;
    }
    
    .grid-card {
        flex: 0 0 85%;
        max-width: 85%;
        scroll-snap-align: start;
    }
    
    .section-label {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    /* Detail page mobile */
    .article-title { 
        font-size: 2rem; 
    }
    .article-wrapper { 
        padding: 2rem 1rem 4rem; 
    }
    .article-content {
        font-size: 1.1rem;
    }
    
    /* Mobile Related Posts */
    .related-posts__grid {
        display: flex;
        grid-template-columns: none;
        overflow-x: auto;
        gap: 1rem;
        margin: 0 -1.5rem;
        padding: 0 1.5rem 1.5rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .next-post-card {
        flex: 0 0 280px;
        width: 280px;
        scroll-snap-align: center;
    }
}
