/*
================================================================================
BLOG V4 - PROFESSIONAL BLOG DESIGN
================================================================================
Inspired by: Linear, Vercel, Notion
Features: Clean minimalism, excellent typography, smooth interactions
================================================================================
*/

/* CSS Variables */
:root {
    --color-bg: #ffffff;
    --color-bg-secondary: #fafafa;
    --color-bg-tertiary: #f5f5f5;
    --color-text: #111111;
    --color-text-secondary: #666666;
    --color-text-tertiary: #888888;
    --color-border: #e5e5e5;
    --color-border-light: #f0f0f0;
    --color-accent: #dc2626;
    --color-accent-hover: #b91c1c;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-serif: 'Newsreader', Georgia, serif;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
}

/* Dark Mode */
[data-theme="dark"] {
    --color-bg: #0a0a0a;
    --color-bg-secondary: #111111;
    --color-bg-tertiary: #1a1a1a;
    --color-text: #ffffff;
    --color-text-secondary: #a0a0a0;
    --color-text-tertiary: #666666;
    --color-border: #222222;
    --color-border-light: #1a1a1a;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.blog-page {
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

.blog-page a {
    text-decoration: none;
    color: inherit;
}

.blog-page ul {
    list-style: none;
}

/* Reading Progress */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    background: var(--color-accent);
    z-index: 10000;
    width: 0%;
    transition: width 0.1s linear;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    z-index: 100;
}

[data-theme="dark"] .site-header {
    background: rgba(10, 10, 10, 0.95);
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
    font-size: 15px;
}

.brand-logo {
    width: 28px;
    height: 28px;
}

.nav-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.nav-blog-title {
    font-family: var(--font-serif);
    font-size: 18px;
    font-weight: 500;
    color: var(--color-text);
    text-decoration: none;
    letter-spacing: -0.01em;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text);
}

.theme-icon-dark {
    display: none;
}

[data-theme="dark"] .theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: inline;
}

/* Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

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

.search-container {
    max-width: 600px;
    margin: 100px auto 0;
    padding: 0 24px;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 16px 20px;
    box-shadow: var(--shadow-lg);
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    color: var(--color-text);
    outline: none;
}

.search-input-wrapper input::placeholder {
    color: var(--color-text-tertiary);
}

.search-close {
    position: absolute;
    top: 24px;
    right: 24px;
    background: none;
    border: none;
    font-size: 32px;
    color: white;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
}

.search-close:hover {
    opacity: 1;
}

/* Category Navigation */
.category-nav {
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 64px;
    z-index: 99;
}

.category-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.category-list {
    display: flex;
    gap: 4px;
    list-style: none;
    padding: 12px 0;
    margin: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.category-list::-webkit-scrollbar {
    display: none;
}

.category-link {
    display: block;
    padding: 6px 14px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.category-link:hover {
    color: var(--color-text);
    background: var(--color-bg-tertiary);
}

.category-link.active {
    color: var(--color-text);
    background: var(--color-bg-tertiary);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Featured Section */
.featured-section {
    padding: 48px 0 32px;
}

.featured-post {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 48px;
    align-items: center;
}

@media (max-width: 900px) {
    .featured-post {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

.featured-image-link {
    display: block;
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.featured-image {
    aspect-ratio: 16 / 10;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

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

.featured-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

.featured-image-link:hover .featured-image img {
    transform: scale(1.02);
}

.featured-content {
    max-width: 520px;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    font-size: 14px;
}

.post-category {
    color: var(--color-accent);
    font-weight: 600;
}

.post-date,
.reading-time {
    color: var(--color-text-secondary);
}

.reading-time::before {
    content: "•";
    margin-right: 12px;
    color: var(--color-text-tertiary);
}

.featured-title {
    font-family: var(--font-serif);
    font-size: 36px;
    line-height: 1.2;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.featured-title a {
    color: var(--color-text);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.featured-title a:hover {
    color: var(--color-accent);
}

.featured-excerpt {
    font-size: 17px;
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: 24px;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 12px;
}

.author-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.author-info {
    display: flex;
    flex-direction: column;
}

.author-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text);
}

.author-title {
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* Newsletter Strip */
.newsletter-strip {
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: 20px 0;
}

.newsletter-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

@media (max-width: 640px) {
    .newsletter-content {
        flex-direction: column;
        text-align: center;
    }
}

.newsletter-text {
    font-size: 15px;
    color: var(--color-text-secondary);
    margin: 0;
}

.newsletter-form {
    display: flex;
    align-items: center;
    gap: 8px;
}

.newsletter-input {
    width: 240px;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    background: var(--color-bg);
    color: var(--color-text);
    outline: none;
    transition: border-color var(--transition-fast);
}

.newsletter-input:focus {
    border-color: var(--color-accent);
}

.newsletter-input::placeholder {
    color: var(--color-text-tertiary);
}

/* Posts Section */
.posts-section {
    padding: 48px 0 64px;
}

.section-header {
    margin-bottom: 32px;
}

.section-header h2 {
    font-family: var(--font-serif);
    font-size: 24px;
    font-weight: 500;
    color: var(--color-text);
}

/* Posts Grid */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
}

@media (max-width: 1024px) {
    .posts-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .posts-grid {
        grid-template-columns: 1fr;
    }
}

.post-card {
    display: flex;
    flex-direction: column;
}

.post-card-link {
    display: flex;
    flex-direction: column;
    height: 100%;
    text-decoration: none;
    color: inherit;
}

.post-card-image {
    aspect-ratio: 16 / 10;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.post-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-base);
}

.post-card:hover .post-card-image img {
    transform: scale(1.03);
}

.post-card-content {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.post-card-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
}

.post-card-title {
    font-family: var(--font-serif);
    font-size: 20px;
    line-height: 1.3;
    margin-bottom: 10px;
    color: var(--color-text);
    transition: color var(--transition-fast);
}

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

.post-card-excerpt {
    font-size: 14px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
    flex: 1;
}

.post-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--color-border-light);
}

.post-author-small {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.author-avatar-small {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.reading-time-small {
    font-size: 13px;
    color: var(--color-text-tertiary);
}

/* Load More */
.load-more-container {
    text-align: center;
    margin-top: 48px;
}

.post-card--hidden {
    display: none;
}

.btn-load-more {
    padding: 12px 24px;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-load-more:hover {
    border-color: var(--color-text);
    color: var(--color-text);
}

/* Footer */
.site-footer {
    background: var(--color-bg-secondary);
    border-top: 1px solid var(--color-border);
    padding: 48px 0 24px;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 48px;
    margin-bottom: 48px;
}

@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
}

.footer-brand .brand {
    margin-bottom: 12px;
}

.footer-description {
    font-size: 14px;
    color: var(--color-text-secondary);
    max-width: 280px;
    line-height: 1.6;
}

.footer-links h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text);
    margin-bottom: 16px;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    font-size: 14px;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--color-text);
}

.footer-bottom {
    padding-top: 24px;
    border-top: 1px solid var(--color-border);
    text-align: center;
}

.footer-bottom p {
    font-size: 13px;
    color: var(--color-text-tertiary);
    margin: 0;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
}

.btn-primary {
    background: var(--color-accent);
    color: white;
}

.btn-primary:hover {
    background: var(--color-accent-hover);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 13px;
}

/* 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.05s; }
.post-card:nth-child(2) { animation-delay: 0.1s; }
.post-card:nth-child(3) { animation-delay: 0.15s; }
.post-card:nth-child(4) { animation-delay: 0.2s; }
.post-card:nth-child(5) { animation-delay: 0.25s; }
.post-card:nth-child(6) { animation-delay: 0.3s; }
