/* md2blog - Pleasant, Modern Theme */

:root {
    /* Light theme (default) */
    --bg-primary: #faf9f6;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f0;
    --text-primary: #2c3e50;
    --text-secondary: #5a6c7d;
    --accent: #3498db;
    --accent-hover: #2980b9;
    --accent-soft: rgba(52, 152, 219, 0.1);
    --border: #e8e8e3;
    --shadow: rgba(0, 0, 0, 0.04);
    --shadow-hover: rgba(0, 0, 0, 0.08);
    
    /* Semantic colors */
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --info: #3498db;
    
    /* Typography */
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-serif: Georgia, 'Times New Roman', serif;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Fira Code', Consolas, monospace;
    
    /* Spacing */
    --max-width: 720px;
    --header-height: 64px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0f172a;
        --bg-secondary: #1e293b;
        --bg-tertiary: #334155;
        --text-primary: #f1f5f9;
        --text-secondary: #94a3b8;
        --accent: #60a5fa;
        --accent-hover: #93c5fd;
        --accent-soft: rgba(96, 165, 250, 0.15);
        --border: #334155;
        --shadow: rgba(0, 0, 0, 0.3);
        --shadow-hover: rgba(0, 0, 0, 0.4);
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Header */
.site-header {
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.02em;
    transition: color 0.2s ease;
}

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

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

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease;
    position: relative;
}

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

.nav-links a:hover {
    color: var(--accent);
}

.nav-links a:hover::after {
    width: 100%;
}

/* Nav Right Section */
.nav-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

/* Search Bar */
.nav-search {
    position: relative;
    flex: 1;
    max-width: 300px;
    display: flex;
    align-items: center;
}

.nav-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    pointer-events: none;
    z-index: 2;
    flex-shrink: 0;
}

.nav-search input {
    width: 100%;
    padding: 0.5rem 1rem 0.5rem 2.25rem;
    border: 1px solid var(--border);
    border-radius: 9999px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}

.nav-search input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.nav-search input::placeholder {
    color: var(--text-secondary);
}

.search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px var(--shadow-hover);
    max-height: 300px;
    overflow-y: auto;
    z-index: 200;
}

.search-results.show {
    display: block;
}

.search-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: background-color 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover,
.search-result-item.active {
    background-color: var(--accent-soft);
}

.search-result-title {
    font-weight: 500;
}

.search-result-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    background-color: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

.search-no-results {
    padding: 1rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Social Icons */
.social-icons {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-radius: 6px;
}

.social-icon:hover {
    color: var(--accent);
    background-color: var(--accent-soft);
    transform: translateY(-2px);
}

.social-icon svg {
    width: 20px;
    height: 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 3rem 1.5rem;
}

/* Footer */
.site-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 2.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.footer-separator {
    color: var(--border);
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 0 3rem;
    margin-bottom: 3rem;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--accent), var(--accent-hover));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 1.25rem;
    color: var(--text-secondary);
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Posts List */
.recent-posts, .posts-page {
    margin-bottom: 4rem;
}

.recent-posts h2, .posts-page h1, .pages-list h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.post-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px var(--shadow);
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px var(--shadow-hover);
    border-color: var(--accent);
}

.post-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

.post-card h3 a {
    color: var(--text-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.post-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 0.75rem;
}

.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background-color: var(--accent-soft);
    color: var(--accent);
    padding: 0.35rem 0.85rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.view-all {
    display: inline-block;
    margin-top: 2rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
}

.view-all:hover {
    color: var(--accent-hover);
    transform: translateX(4px);
}

/* Pages List */
.pages-list {
    margin-bottom: 3rem;
}

.pages-list ul {
    list-style: none;
    display: grid;
    gap: 0.75rem;
}

.pages-list li {
    padding: 0.875rem 1.25rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.pages-list li:hover {
    border-color: var(--accent);
    background-color: var(--accent-soft);
}

.pages-list a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    display: block;
}

.pages-list a:hover {
    color: var(--accent);
}

/* Post/Page Content */
.post, .tos-page {
    max-width: 100%;
}

.post-header, .page-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.post-header h1, .page-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.03em;
    line-height: 1.2;
}

.post-content, .page-content {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.post-content h1, .post-content h2, .post-content h3,
.page-content h1, .page-content h2, .page-content h3 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.3;
}

.post-content h1, .page-content h1 {
    font-size: 2rem;
}

.post-content h2, .page-content h2 {
    font-size: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.post-content h3, .page-content h3 {
    font-size: 1.25rem;
}

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

.post-content a, .page-content a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s ease;
}

.post-content a:hover, .page-content a:hover {
    border-bottom-color: var(--accent);
}

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

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

.post-content code, .page-content code {
    background-color: var(--bg-tertiary);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-family: var(--font-mono);
    font-size: 0.875em;
    color: var(--accent);
}

.post-content pre, .page-content pre {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    padding: 1.25rem;
    border-radius: var(--border-radius);
    overflow-x: auto;
    margin-bottom: 1.5rem;
    box-shadow: inset 0 2px 4px var(--shadow);
}

.post-content pre code, .page-content pre code {
    background-color: transparent;
    padding: 0;
    color: var(--text-primary);
}

.post-content blockquote, .page-content blockquote {
    background-color: var(--accent-soft);
    border-left: 4px solid var(--accent);
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    font-style: italic;
}

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

.post-content img, .page-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin: 2rem 0;
    box-shadow: 0 4px 12px var(--shadow);
}

.post-content table, .page-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.post-content th, .post-content td,
.page-content th, .page-content td {
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    text-align: left;
}

.post-content th, .page-content th {
    background-color: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
}

.post-content tr:nth-child(even), .page-content tr:nth-child(even) {
    background-color: var(--bg-secondary);
}

.post-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.back-link {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.back-link:hover {
    color: var(--accent-hover);
    transform: translateX(-4px);
}

/* Callouts */
.callout {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    margin: 1.5rem 0;
    box-shadow: 0 2px 8px var(--shadow);
}

.callout-title {
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
}

.callout-content {
    color: var(--text-secondary);
}

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

.callout-note { border-left: 4px solid var(--info); }
.callout-tip { border-left: 4px solid var(--success); }
.callout-important { border-left: 4px solid var(--warning); }
.callout-warning { border-left: 4px solid var(--danger); }
.callout-caution { border-left: 4px solid var(--warning); }
.callout-info { border-left: 4px solid var(--info); }
.callout-example { border-left: 4px solid var(--success); }
.callout-quote { border-left: 4px solid var(--text-secondary); }

/* Mark/Highlight */
mark {
    background-color: rgba(243, 156, 18, 0.3);
    color: var(--text-primary);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

/* Terms of Service Modal */
.tos-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tos-modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.tos-modal-content {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    max-width: 480px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.tos-modal-content h2 {
    margin-bottom: 1rem;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.tos-text {
    margin-bottom: 2rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.tos-text a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

.tos-text a:hover {
    text-decoration: underline;
}

.tos-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.btn {
    padding: 0.875rem 1.75rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background-color: var(--border);
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 900px) {
    .nav-container {
        padding: 0 1rem;
        flex-wrap: wrap;
        height: auto;
        min-height: var(--header-height);
        padding-top: 0.75rem;
        padding-bottom: 0.75rem;
        gap: 0.75rem;
    }
    
    .site-title {
        font-size: 1.1rem;
    }
    
    .nav-search {
        order: 3;
        max-width: none;
        width: 100%;
        flex: none;
    }
    
    .nav-search .search-icon {
        left: 10px;
        width: 14px;
        height: 14px;
    }
    
    .nav-search input {
        padding: 0.5rem 1rem 0.5rem 2rem;
    }
    
    .nav-right {
        gap: 1rem;
    }
    
    .nav-links {
        gap: 1rem;
    }
    
    .nav-links a {
        font-size: 0.85rem;
    }
    
    .social-icons {
        gap: 0.5rem;
    }
    
    .social-icon {
        width: 28px;
        height: 28px;
    }
    
    .social-icon svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 768px) {
    .hero {
        padding: 2.5rem 0 2rem;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero-description {
        font-size: 1.1rem;
    }
    
    .main-content {
        padding: 2rem 1rem;
    }
    
    .post-header h1, .page-header h1 {
        font-size: 1.75rem;
    }
    
    .post-card {
        padding: 1.25rem;
    }
    
    .tos-modal-content {
        padding: 1.75rem;
    }
    
    .tos-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
}

/* Syntax Highlighting (CodeHilite) */
.codehilite {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.codehilite pre {
    margin: 0;
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}

/* Hidden class for TOS check */
.tos-hidden {
    display: none !important;
}

body.tos-pending {
    overflow: hidden;
}

body.tos-pending .main-content,
body.tos-pending .site-header,
body.tos-pending .site-footer {
    filter: blur(4px);
    pointer-events: none;
}

/* Sitemap Page */
.sitemap-page {
    max-width: 100%;
}

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

.sitemap-page .page-description {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.sitemap-section {
    margin-bottom: 2.5rem;
}

.sitemap-section h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
    color: var(--text-primary);
}

.sitemap-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sitemap-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1.25rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.sitemap-list li:hover {
    border-color: var(--accent);
    background-color: var(--accent-soft);
}

/* Dated Posts List */
.dated-posts-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.dated-posts-list li {
    padding: 1rem 1.25rem;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
    line-height: 1.6;
}

.dated-posts-list li:hover {
    border-color: var(--accent);
    background-color: var(--accent-soft);
}

.dated-posts-list .post-date {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 600;
}

.dated-posts-list strong a {
    color: var(--text-primary);
    text-decoration: none;
}

.dated-posts-list strong a:hover {
    color: var(--accent);
}

.dated-posts-list .read-more {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.dated-posts-list .read-more:hover {
    text-decoration: underline;
}

.sitemap-list a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    flex: 1;
}

.sitemap-list a:hover {
    color: var(--accent);
}

.sitemap-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Print styles */
@media print {
    .site-header,
    .site-footer,
    .tos-modal {
        display: none !important;
    }
    
    .main-content {
        max-width: 100%;
        padding: 0;
    }
    
    body {
        background: white;
        color: black;
    }
}
