/**
 * ═══════════════════════════════════════════════════════════════════════════
 * BLOG AUTOMATION SYSTEM - STYLESHEET
 * ═══════════════════════════════════════════════════════════════════════════
 * 
 * Modern, clean design with full customization via CSS variables.
 * All colors and fonts are controlled through config.php
 * 
 * @version 2.0.0
 */

/* ═══════════════════════════════════════════════════════════════════════════
   RESET & BASE
   ═══════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    color: var(--color-text);
    background-color: var(--color-background);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--color-accent);
    text-decoration: none;
    transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
    opacity: 0.85;
}

/* ═══════════════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════════════ */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   HEADER
   ═══════════════════════════════════════════════════════════════════════════ */

.site-header {
    background: var(--color-primary);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

.site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-link {
    display: flex;
    align-items: center;
}

.logo {
    height: 48px;
    width: auto;
    object-fit: contain;
}

.main-nav {
    display: flex;
    gap: 2rem;
}

.main-nav a {
    color: rgba(255, 255, 255, 0.85);
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    padding: 0.5rem 0;
    position: relative;
}

.main-nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--color-accent);
    transition: width 0.3s ease;
}

.main-nav a:hover,
.main-nav a.active {
    color: #fff;
    opacity: 1;
}

.main-nav a:hover::after,
.main-nav a.active::after {
    width: 100%;
}

/* ═══════════════════════════════════════════════════════════════════════════
   BLOG INDEX PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.blog-main {
    flex: 1;
    padding: 4rem 0;
}

.blog-header {
    text-align: center;
    margin-bottom: 4rem;
}

.blog-title {
    font-family: var(--font-heading);
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 700;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.03em;
}

.blog-subtitle {
    font-size: 1.15rem;
    color: var(--color-text-light);
    max-width: 600px;
    margin: 0 auto;
}

/* Posts List - Single Column Large Excerpts */
.posts-list {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

.post-card {
    background: var(--color-background);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08);
}

.post-card-content {
    padding: 2.5rem;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--color-text-light);
}

.post-card-meta time {
    font-weight: 500;
}

.reading-time {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.reading-time::before {
    content: '•';
    color: var(--color-text-light);
    opacity: 0.5;
}

.post-card-title {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
}

.post-card-title a {
    color: var(--color-primary);
    transition: color 0.2s ease;
}

.post-card-title a:hover {
    color: var(--color-accent);
    opacity: 1;
}

.post-card-excerpt {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--color-text);
    margin-bottom: 1.5rem;
}

.post-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.post-card-author {
    font-size: 0.9rem;
    color: var(--color-text-light);
    font-weight: 500;
}

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

.read-more:hover {
    gap: 0.75rem;
    opacity: 1;
}

.read-more svg {
    transition: transform 0.2s ease;
}

.read-more:hover svg {
    transform: translateX(2px);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 6rem 2rem;
    background: var(--color-surface);
    border-radius: 16px;
    max-width: 500px;
    margin: 0 auto;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
}

.empty-state h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--color-text-light);
}

/* ═══════════════════════════════════════════════════════════════════════════
   PAGINATION
   ═══════════════════════════════════════════════════════════════════════════ */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 4rem;
    flex-wrap: wrap;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--color-primary);
    color: #fff;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: background 0.2s ease, transform 0.2s ease;
}

.pagination-btn:hover {
    background: var(--color-secondary);
    transform: translateY(-1px);
    opacity: 1;
}

.pagination-numbers {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.pagination-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-weight: 500;
    color: var(--color-text);
    transition: background 0.2s ease, color 0.2s ease;
}

.pagination-num:hover {
    background: var(--color-surface);
    opacity: 1;
}

.pagination-num.active {
    background: var(--color-primary);
    color: #fff;
}

.pagination-ellipsis {
    color: var(--color-text-light);
    padding: 0 0.5rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   SINGLE POST PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.post-main {
    flex: 1;
    padding: 3rem 0 5rem;
}

.post-article {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.post-header {
    margin-bottom: 3rem;
    text-align: center;
}

.post-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    color: var(--color-text-light);
}

.post-meta time {
    font-weight: 500;
}

.post-title {
    font-family: var(--font-heading);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.2;
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
}

.author-byline {
    font-size: 1rem;
    color: var(--color-text-light);
}

.author-byline .author-name {
    font-weight: 500;
    color: var(--color-text);
}

/* Post Content */
.post-content {
    font-size: 1.1rem;
    line-height: 1.85;
}

.post-content h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--color-primary);
    margin: 2.5rem 0 1rem;
    letter-spacing: -0.02em;
}

.post-content h3 {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--color-primary);
    margin: 2rem 0 0.75rem;
}

.post-content h4 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--color-primary);
    margin: 1.5rem 0 0.5rem;
}

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
    margin: 1.5rem 0;
    padding-left: 1.5rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: var(--color-surface);
    border-left: 4px solid var(--color-accent);
    border-radius: 0 12px 12px 0;
    font-style: italic;
    color: var(--color-text-light);
}

.post-content blockquote p:last-child {
    margin-bottom: 0;
}

.post-content code {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.9em;
    background: var(--color-surface);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    color: var(--color-accent);
}

.post-content pre {
    margin: 2rem 0;
    padding: 1.5rem;
    background: var(--color-primary);
    border-radius: 12px;
    overflow-x: auto;
}

.post-content pre code {
    background: transparent;
    color: #fff;
    padding: 0;
}

.post-content img {
    border-radius: 12px;
    margin: 2rem auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.post-content a {
    color: var(--color-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.post-content a:hover {
    text-decoration: none;
}

.post-content table {
    width: 100%;
    margin: 2rem 0;
    border-collapse: collapse;
}

.post-content th,
.post-content td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.post-content th {
    background: var(--color-surface);
    font-weight: 600;
}

/* Post Footer */
.post-footer {
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.author-box {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    padding: 2rem;
    background: var(--color-surface);
    border-radius: 16px;
    margin-bottom: 2rem;
}

.author-info {
    flex: 1;
}

.author-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-text-light);
    margin-bottom: 0.35rem;
}

.author-info .author-name {
    display: block;
    font-family: var(--font-heading);
    font-size: 1.25rem;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.author-bio {
    font-size: 0.95rem;
    color: var(--color-text-light);
    line-height: 1.6;
}

/* CTA Button */
.cta-section {
    text-align: center;
    margin-top: 2.5rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 2.5rem;
    background: var(--color-accent);
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    box-shadow: 0 4px 20px rgba(233, 69, 96, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(233, 69, 96, 0.4);
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RELATED POSTS
   ═══════════════════════════════════════════════════════════════════════════ */

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

.related-posts h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 2rem;
    text-align: center;
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.related-card {
    display: block;
    padding: 1.75rem;
    background: var(--color-surface);
    border-radius: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.related-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
    opacity: 1;
}

.related-card h3 {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.related-card p {
    font-size: 0.9rem;
    color: var(--color-text-light);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.related-date {
    font-size: 0.8rem;
    color: var(--color-text-light);
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════════════════ */

.site-footer {
    background: var(--color-primary);
    color: rgba(255, 255, 255, 0.7);
    padding: 2rem 0;
    text-align: center;
    margin-top: auto;
}

.site-footer p {
    font-size: 0.9rem;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .site-header .container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .main-nav {
        gap: 1.5rem;
    }
    
    .blog-main {
        padding: 2.5rem 0;
    }
    
    .blog-header {
        margin-bottom: 2.5rem;
    }
    
    .posts-list {
        gap: 1.5rem;
    }
    
    .post-card-content {
        padding: 1.5rem;
    }
    
    .post-card-title {
        font-size: 1.35rem;
    }
    
    .post-card-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .post-main {
        padding: 2rem 0 3rem;
    }
    
    .post-article {
        padding: 0 1rem;
    }
    
    .post-content {
        font-size: 1rem;
    }
    
    .author-box {
        flex-direction: column;
        padding: 1.5rem;
    }
    
    .related-grid {
        grid-template-columns: 1fr;
    }
    
    .pagination {
        gap: 0.5rem;
    }
    
    .pagination-btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
    
    .pagination-num {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .logo {
        height: 40px;
    }
    
    .main-nav a {
        font-size: 0.9rem;
    }
    
    .blog-title {
        font-size: 2rem;
    }
    
    .post-title {
        font-size: 1.75rem;
    }
    
    .btn-primary {
        padding: 0.875rem 2rem;
        font-size: 0.95rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════════════════════════════════════ */

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

.post-card {
    animation: fadeInUp 0.5s ease forwards;
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.2s; }
.post-card:nth-child(3) { animation-delay: 0.3s; }
.post-card:nth-child(4) { animation-delay: 0.4s; }
.post-card:nth-child(5) { animation-delay: 0.5s; }

.post-article {
    animation: fadeInUp 0.6s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════════════ */

@media print {
    .site-header,
    .site-footer,
    .cta-section,
    .related-posts,
    .pagination {
        display: none;
    }
    
    .post-article {
        max-width: 100%;
        padding: 0;
    }
    
    .post-content a {
        text-decoration: none;
        color: inherit;
    }
    
    .post-content a::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}
