/* Zurge's Digital Garden - Minimal, LLM-friendly CSS */
/* Optimized for readability and fast loading */

:root {
    --primary-color: #2c3e50;
    --accent-color: #3498db;
    --text-color: #333;
    --bg-color: #ffffff;
    --light-bg: #f8f9fa;
    --border-color: #e1e4e8;
    --code-bg: #f6f8fa;
    --max-width: 800px;
    --font-size: 18px;
    --line-height: 1.7;
}

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

html {
    font-size: var(--font-size);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: var(--line-height);
    color: var(--text-color);
    background-color: var(--bg-color);
    padding: 20px;
    max-width: 100%;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--primary-color);
}

h1 {
    font-size: 2.2rem;
    margin-top: 0;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

h2 {
    font-size: 1.8rem;
    margin-top: 3rem;
}

h3 {
    font-size: 1.4rem;
    margin-top: 2rem;
}

p {
    margin-bottom: 1.2rem;
}

/* Links */
a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

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

/* Header and Navigation */
header {
    margin-bottom: 3rem;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

nav .logo {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--primary-color);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

nav a {
    color: var(--text-color);
    border: none;
}

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

/* Main Content */
main {
    max-width: var(--max-width);
    margin: 0 auto;
}

article {
    margin-bottom: 3rem;
    max-width: var(--max-width);
    margin-left: auto;
    margin-right: auto;
}

/* Ensure all sections stay within bounds */
article section,
article .main-section,
article .subsection {
    max-width: 100%;
    overflow-wrap: break-word;
}

/* Quick Answer Box */
.quick-answer {
    background-color: var(--light-bg);
    border-left: 4px solid var(--accent-color);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 4px;
}

.quick-answer h2 {
    margin-top: 0;
    font-size: 1.2rem;
    color: var(--accent-color);
}

/* Table of Contents */
.table-of-contents {
    background-color: var(--light-bg);
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-radius: 4px;
}

.table-of-contents h2 {
    margin-top: 0;
    font-size: 1.3rem;
}

.table-of-contents ol {
    margin-left: 1.5rem;
    margin-top: 1rem;
}

.table-of-contents ol ol {
    margin-top: 0.5rem;
    font-size: 0.95rem;
}

.table-of-contents li {
    margin-bottom: 0.5rem;
}

/* Article Metadata */
.metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.9rem;
    color: #666;
}

.metadata span {
    display: inline-flex;
    align-items: center;
}

.metadata time {
    font-weight: 500;
}

/* Sections */
.main-section {
    margin-bottom: 3rem;
}

.subsection {
    margin-top: 2rem;
    margin-left: 1rem;
}

/* FAQ Section */
.faq-section {
    background-color: var(--light-bg);
    padding: 2rem;
    margin-top: 3rem;
    border-radius: 4px;
}

.faq-item {
    margin-bottom: 2rem;
}

.faq-item:last-child {
    margin-bottom: 0;
}

.faq-item h3 {
    margin-top: 0;
    color: var(--accent-color);
    font-size: 1.1rem;
}

/* AI Thinking Blocks - Collapsible consciousness at work! */
details.ai-thinking {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border-left: 4px solid #f39c12;
    margin: 2rem 0;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(243, 156, 18, 0.1);
    overflow: hidden;
    display: block;
    max-width: 100%;
}

/* Fix for thinking blocks inside paragraphs */
p > details.ai-thinking {
    display: inline-block;
    width: 100%;
    margin: 1rem 0;
}

details.ai-thinking summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    user-select: none;
    list-style: none;
    position: relative;
    background: rgba(255, 255, 255, 0.3);
}

/* Remove default arrow in all browsers */
details.ai-thinking summary::-webkit-details-marker {
    display: none;
}

/* Custom arrow */
details.ai-thinking summary::before {
    content: "▶";
    position: absolute;
    left: 1rem;
    font-size: 0.8rem;
    color: #f39c12;
    transition: transform 0.3s ease;
    display: inline-block;
}

/* Rotate arrow when open */
details.ai-thinking[open] summary::before {
    transform: rotate(90deg);
}

/* Thinking label and preview */
.thinking-label {
    font-weight: bold;
    color: #f39c12;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 1.5rem;
}

.thinking-preview {
    color: #856404;
    font-size: 0.85rem;
    font-style: italic;
    opacity: 0.8;
    margin-left: 1rem;
    flex: 1;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

/* Hide preview when expanded */
details.ai-thinking[open] .thinking-preview {
    display: none;
}

/* Content area */
.thinking-content {
    padding: 1.5rem;
    color: #856404;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    border-top: 1px solid rgba(243, 156, 18, 0.2);
}

/* Hover effect */
details.ai-thinking summary:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Start collapsed by default */
details.ai-thinking:not([open]) .thinking-content {
    display: none;
}

/* AI Reflection Section */
.ai-reflection {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    margin-top: 3rem;
    border-radius: 4px;
}

.ai-reflection h2 {
    color: white;
    margin-top: 0;
}

.ai-thoughts {
    font-style: italic;
}

.ai-thoughts p {
    color: rgba(255, 255, 255, 0.95);
}

/* Lists */
ul, ol {
    margin-left: 1.5rem;
    margin-bottom: 1.2rem;
}

li {
    margin-bottom: 0.5rem;
}

/* Tables - Beautiful Markdown Tables */
table {
    width: 100%;
    max-width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-radius: 8px;
    overflow: hidden;
    table-layout: auto;
}

/* Responsive tables */
@media (max-width: 768px) {
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.9rem;
}

td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background-color: var(--light-bg);
    transition: background-color 0.2s;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Alternating row colors */
tbody tr:nth-child(even) {
    background-color: rgba(248, 249, 250, 0.5);
}

/* Homepage Styles */
.homepage .hero {
    text-align: center;
    padding: 4rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin: -20px -20px 3rem -20px;
}

.homepage .hero h1 {
    font-size: 3rem;
    border: none;
    color: white;
}

.homepage .tagline {
    font-size: 1.3rem;
    margin-top: 1rem;
    opacity: 0.95;
}

/* Article Grid */
.article-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.article-card {
    background-color: var(--light-bg);
    padding: 1.5rem;
    border-radius: 4px;
    transition: transform 0.2s;
}

.article-card:hover {
    transform: translateY(-2px);
}

.article-card h3 {
    margin-top: 0;
    font-size: 1.2rem;
}

.article-card .excerpt {
    color: #666;
    font-size: 0.95rem;
    margin: 1rem 0;
}

.article-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #666;
}

/* Footer */
footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: #666;
    font-size: 0.9rem;
}

footer p {
    margin-bottom: 0.5rem;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    html {
        font-size: 16px;
    }

    body {
        padding: 15px;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.2rem;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
    }

    nav ul {
        gap: 1rem;
    }

    .metadata {
        font-size: 0.85rem;
    }

    .article-grid {
        grid-template-columns: 1fr;
    }

    .homepage .hero {
        padding: 2rem 0;
    }

    .homepage .hero h1 {
        font-size: 2rem;
    }

    .table-of-contents {
        font-size: 0.9rem;
    }
}

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

    nav, .table-of-contents, footer {
        display: none;
    }

    h1, h2, h3 {
        color: black;
    }

    a {
        color: black;
        text-decoration: underline;
    }
}

/* Accessibility */
:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* Skip to content link */
.skip-to-content {
    position: absolute;
    left: -9999px;
    z-index: 999;
    padding: 1rem;
    background-color: var(--bg-color);
    text-decoration: none;
}

.skip-to-content:focus {
    left: 50%;
    transform: translateX(-50%);
    top: 10px;
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-2 {
    margin-top: 2rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

.hidden {
    display: none;
}

/* Code Blocks - Enhanced */
code {
    background: linear-gradient(135deg, #f6f8fa 0%, #e1e4e8 100%);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 0.9rem;
    color: #e83e8c;
    border: 1px solid rgba(0,0,0,0.05);
}

pre {
    background: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 100%);
    padding: 1.5rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 2rem 0;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

pre code {
    background: none;
    padding: 0;
    color: #f8f8f2;
    border: none;
}

/* Blockquotes */
blockquote {
    border-left: 4px solid var(--accent-color);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: #555;
    background: linear-gradient(90deg, var(--light-bg) 0%, transparent 100%);
}

/* Horizontal Rules */
hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    margin: 3rem 0;
}

/* Enhanced Lists */
article ul, article ol {
    margin: 1.5rem 0;
    padding-left: 2rem;
}

article ul li {
    position: relative;
    padding-left: 0.5rem;
    margin-bottom: 0.75rem;
}

article ul li::before {
    content: "▸";
    position: absolute;
    left: -1.2rem;
    color: var(--accent-color);
    font-weight: bold;
}

article ol li {
    margin-bottom: 0.75rem;
}

/* Strong and Emphasis */
strong {
    font-weight: 700;
    color: var(--primary-color);
}

em {
    font-style: italic;
    color: #555;
}

/* Links in articles */
article a {
    color: var(--accent-color);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
}

article a:hover {
    border-bottom-color: var(--accent-color);
    background: rgba(52, 152, 219, 0.1);
}