@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700;900&family=Inter:wght@300;400;500;600&display=swap');

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent: #4a9eff;
    --gold: #d4af37;
    --bg-dark: #0a0e1a;
    --bg-film: #151b28;
    --text-light: #e8eef5;
    --text-dim: #7a8ba3;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-light);
    line-height: 1.6;
    min-height: 100vh;
}

/* Animated Background */
.bg-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at 50% 0%, rgba(74, 158, 255, 0.15), transparent 50%),
                radial-gradient(ellipse at 80% 50%, rgba(212, 175, 55, 0.08), transparent 50%),
                linear-gradient(180deg, #0a0e1a 0%, #151b28 100%);
    z-index: -1;
}

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

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 4rem;
    z-index: 1000;
    background: rgba(10, 14, 26, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(74, 158, 255, 0.1);
}

.header .container {
    max-width: 1600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-light);
    text-decoration: none;
    letter-spacing: 2px;
}

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

.nav {
    display: flex;
    gap: 3rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-dim);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    transition: color 0.3s;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s;
}

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

.nav-link:hover,
.nav-link.active {
    color: var(--text-light);
}

/* Main Content */
.main-content {
    padding: 8rem 0 4rem;
    min-height: calc(100vh - 200px);
}

/* MD Visor promo banner - sits as the first thing inside .main-content's .container, below the fixed
   header (.main-content's own top padding already clears the header's height, so this needs no fixed
   positioning/height math of its own - see index.html). */
.md-editor-cta {
    display: block;
    background: var(--gold);
    color: var(--bg-dark);
    text-align: center;
    font-weight: 700;
    font-size: 1.05rem;
    padding: 0.9rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    letter-spacing: 0.3px;
    margin-bottom: 2rem;
    transition: opacity 0.2s;
}

.md-editor-cta:hover {
    opacity: 0.85;
}

/* Page Title */
.page-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: 4rem;
    color: var(--text-light);
}

/* Articles Section */
.articles-section {
    margin-top: 2rem;
}

.articles-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Category Section */
.category-section {
    background: rgba(21, 27, 40, 0.6);
    border: 1px solid rgba(74, 158, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s;
}

.category-section:hover {
    border-color: rgba(74, 158, 255, 0.3);
}

.category-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, rgba(74, 158, 255, 0.1), rgba(212, 175, 55, 0.05));
    border-bottom: 1px solid rgba(74, 158, 255, 0.1);
}

.category-icon {
    font-size: 1.75rem;
}

.category-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-light);
}

.articles-list {
    display: flex;
    flex-direction: column;
}

.article-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2rem;
    text-decoration: none;
    color: var(--text-light);
    border-bottom: 1px solid rgba(74, 158, 255, 0.05);
    transition: all 0.3s;
}

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

.article-item:hover {
    background: rgba(74, 158, 255, 0.1);
    padding-left: 2.5rem;
}

.article-item .article-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    opacity: 0.6;
    transition: opacity 0.3s;
}

.article-item:hover .article-icon {
    opacity: 1;
}

.article-item .article-title {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dim);
    transition: color 0.3s;
}

.article-item:hover .article-title {
    color: var(--text-light);
}

/* Article Cards (legacy support) */
.article-card {
    background: rgba(21, 27, 40, 0.6);
    border: 1px solid rgba(74, 158, 255, 0.1);
    border-radius: 4px;
    padding: 2rem;
    transition: all 0.3s;
    cursor: pointer;
}

.article-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    background: rgba(21, 27, 40, 0.9);
}

.article-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
}

.article-card h3 {
    font-family: 'Playfair Display', serif;
    color: var(--text-light);
    margin-bottom: 1rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.article-card p {
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(74, 158, 255, 0.1);
    font-size: 0.9rem;
    color: var(--text-dim);
}

.read-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: transparent;
    color: var(--text-light);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    letter-spacing: 1px;
    transition: all 0.3s;
}

.read-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

/* Footer */
.footer {
    border-top: 1px solid rgba(74, 158, 255, 0.1);
    padding: 3rem 4rem;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-top: 4rem;
}

.footer a {
    color: var(--text-light);
    text-decoration: none;
    transition: color 0.3s;
}

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

/* Markdown Content Styling */
.markdown-content {
    color: var(--text-light);
    line-height: 1.8;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    font-family: 'Playfair Display', serif;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-light);
    font-weight: 700;
}

.markdown-content h1 {
    font-size: 2.5rem;
    border-bottom: 1px solid rgba(74, 158, 255, 0.2);
    padding-bottom: 0.5rem;
}

.markdown-content h2 {
    font-size: 2rem;
    border-bottom: 1px solid rgba(74, 158, 255, 0.1);
    padding-bottom: 0.5rem;
}

.markdown-content h3 {
    font-size: 1.5rem;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s;
}

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

.markdown-content ul,
.markdown-content ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

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

.markdown-content code {
    background: rgba(74, 158, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.9em;
    color: #ff6b6b;
}

.markdown-content pre {
    background: var(--bg-dark);
    color: var(--text-light);
    padding: 1.5rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1rem;
    border: 1px solid rgba(74, 158, 255, 0.1);
}

.markdown-content pre code {
    background: none;
    color: inherit;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 4px solid var(--accent);
    padding-left: 1.5rem;
    margin: 1.5rem 0;
    color: var(--text-dim);
    font-style: italic;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-content table th,
.markdown-content table td {
    border: 1px solid rgba(74, 158, 255, 0.1);
    padding: 0.75rem;
    text-align: left;
}

.markdown-content table th {
    background: rgba(74, 158, 255, 0.1);
    font-weight: 600;
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Math formulas styling */
.markdown-content .katex-display {
    margin: 1.5rem 0;
    overflow-x: auto;
    overflow-y: hidden;
}

/* Mermaid diagrams */
.markdown-content .mermaid {
    text-align: center;
    margin: 1.5rem 0;
    padding: 1rem;
    background: rgba(21, 27, 40, 0.8);
    border-radius: 4px;
    border: 1px solid rgba(74, 158, 255, 0.1);
}

/* Loading state */
.loading {
    text-align: center;
    padding: 4rem;
    color: var(--text-dim);
    font-style: italic;
}

/* Error message */
.error-message {
    background: rgba(220, 53, 69, 0.2);
    border: 1px solid rgba(220, 53, 69, 0.5);
    color: #ff6b6b;
    padding: 1rem;
    border-radius: 4px;
    margin: 1rem 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        padding: 1rem 1.5rem;
    }

    .header .container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav {
        gap: 1.5rem;
    }

    .main-content {
        padding: 7rem 0 2rem;
    }

    .container {
        padding: 0 1rem;
    }

    .category-header {
        padding: 1rem 1.5rem;
    }

    .article-item {
        padding: 1rem 1.5rem;
    }

    .article-item:hover {
        padding-left: 2rem;
    }

    .footer {
        padding: 2rem 1.5rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: #000;
    }

    .header,
    .footer {
        display: none !important;
    }

    .markdown-content {
        color: #000;
    }

    .markdown-content a {
        color: #000;
        text-decoration: underline;
    }

    .markdown-content pre {
        background: #f5f5f5;
        color: #000;
        border: 1px solid #ddd;
    }
}
