:root {
    /* Warm earth tone color palette with greens and reds */
    --color-bg-dark: #181612;           /* Deep warm brown - main background */
    --color-bg-medium: #2a2820;         /* Moss-tinged brown - containers */
    --color-bg-light: #3a3a2e;          /* Olive clay - hover states */
    --color-bg-lighter: #4a4a3a;        /* Sage clay - active states */

    --color-text-primary: #f5f0e8;      /* Warm cream - headings */
    --color-text-secondary: #e8e0d0;    /* Warm beige - subheadings */
    --color-text-tertiary: #d8d0c0;     /* Warm tan - h3 */
    --color-text-muted: #c8c0b0;        /* Warm sand - body text */
    --color-text-dim: #b0a890;          /* Warm neutral - links */
    --color-text-very-dim: #989078;     /* Warm dim - disabled */

    --color-accent: #c97a5f;            /* Terracotta red - links in content */
    --color-code-bg: #181612;           /* Code background */
}

html {
    height: 100%;
    overflow: hidden;
}

body {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    background: var(--color-bg-dark);
    color: var(--color-text-secondary);
    font-family: 'IBM Plex Mono', monospace;
    overflow: hidden;
}

.site-container {
    margin: 15px;
    display: grid;
    grid-template-columns: 300px 1fr;
    column-gap: 25px;
    height: calc(100vh - 30px);
    overflow: hidden;
}

.left-container {
    background: var(--color-bg-medium);
    padding: 20px;
    overflow-y: hidden;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

.left-container nav {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.nav-static {
    flex-shrink: 0;
}

.nav-scrollable {
    flex: 1;
    overflow-y: auto;
    margin-top: 10px;
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
}

.left-container h2 {
    margin-top: 0;
    color: var(--color-text-primary);
    font-size: 1.5em;
    margin-bottom: 20px;
}

.left-container h3 {
    color: var(--color-text-tertiary);
    font-size: 1em;
    margin-top: 30px;
    margin-bottom: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

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

.nav-links li {
    margin-bottom: 8px;
}

.nav-links a {
    display: block;
    color: var(--color-text-dim);
    text-decoration: none;
    padding: 8px 12px;
    margin: 0 -12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-transform: lowercase;
}

.nav-links a::after {
    content: ".";
}

.post-date {
    font-size: 0.75em;
    color: var(--color-text-very-dim);
    margin-right: 2px;
    display: inline-block;
}

.post-title {
    display: inline;
}

.nav-links a:hover {
    background: var(--color-bg-light);
    color: var(--color-text-primary);
}

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

.nav-links a.active {
    background: var(--color-bg-lighter);
    color: var(--color-text-primary);
    font-weight: 500;
}

.nav-links a.active .post-date {
    color: var(--color-accent);
}

.right-container {
    background: var(--color-bg-medium);
    padding: 0;
    overflow-y: auto;
    border-radius: 8px;
    position: relative;
}

.right-container.has-markdown {
    padding: 0;
}

.right-container.has-markdown #game-canvas {
    filter: saturate(0.4) brightness(0.6);
}

#content {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    line-height: 1.6;
}

#content-overlay {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
    width: min(880px, 100%);
    padding: 40px;
    background: var(--color-bg-medium);
    margin: 0;
    line-height: 1.6;
    overflow-y: auto;
    height: 100%;
    box-sizing: border-box;
    border-radius: 8px;
}

#content-overlay img,
#content-overlay pre,
#content-overlay table {
    max-width: 100%;
    overflow-x: auto;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2px;
}

.page-date {
    font-size: 0.85em;
    color: var(--color-text-very-dim);
    opacity: 0.6;
    font-weight: 300;
    letter-spacing: 0.05em;
}

.page-close {
    background: none;
    border: none;
    color: var(--color-text-very-dim);
    font-size: 2em;
    line-height: 0.6;
    cursor: pointer;
    padding: 0;
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

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

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: block;
    border-radius: 8px;
    z-index: 1;
}

#content h1,
#content-overlay h1 {
    color: var(--color-text-primary);
    border-bottom: 2px solid var(--color-bg-lighter);
    padding-bottom: 10px;
    margin-bottom: 20px;
    font-size: 1.8em;
}

#content h2,
#content-overlay h2 {
    color: var(--color-text-secondary);
    margin-top: 30px;
}

#content h3,
#content-overlay h3 {
    color: var(--color-text-tertiary);
}

#content p,
#content-overlay p {
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

#content a,
#content-overlay a {
    color: var(--color-accent);
    text-decoration: none;
}

#content a:hover,
#content-overlay a:hover {
    text-decoration: underline;
}

#content ul, #content ol,
#content-overlay ul, #content-overlay ol {
    color: var(--color-text-muted);
    margin-bottom: 16px;
}

#content code,
#content-overlay code {
    background: var(--color-code-bg);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 0.9em;
}

#content pre,
#content-overlay pre {
    background: var(--color-code-bg);
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
}

#content pre code,
#content-overlay pre code {
    background: none;
    padding: 0;
}

/* Menu toggle button - hidden on desktop */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--color-bg-medium);
    color: var(--color-text-primary);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
    opacity: 1;
    pointer-events: auto;
}

.menu-toggle:hover {
    background: var(--color-bg-light);
}

.menu-toggle:active {
    transform: scale(0.95);
}

/* Hide menu toggle when menu is visible */
.menu-toggle.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Mobile GoL container - hidden on desktop */
.mobile-gol-container {
    display: none;
}

/* Mobile styles */
@media (max-width: 768px) {
    html, body {
        overflow: hidden;
    }

    .site-container {
        margin: 0;
        grid-template-columns: 1fr;
        height: 100vh;
        column-gap: 0;
        display: block;
    }

    .menu-toggle {
        display: block;
    }

    .left-container {
        position: fixed;
        top: 0;
        left: 0;
        width: 85%;
        max-width: 320px;
        height: 100vh;
        transform: translateX(0);
        transition: transform 0.3s ease;
        z-index: 1000;
        border-radius: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }

    .left-container.menu-hidden {
        transform: translateX(-100%);
    }

    .mobile-gol-container {
        display: block;
        width: calc(100% + 40px);
        margin: -20px -20px 20px -20px;
        aspect-ratio: 1;
        background: var(--color-bg-dark);
        overflow: hidden;
    }

    #mobile-game-canvas {
        width: 100%;
        height: 100%;
        display: block;
    }

    /* Hide desktop game of life on mobile */
    #game-canvas {
        display: none;
    }

    .right-container {
        margin-left: 0;
        border-radius: 0;
        height: 100vh;
        width: 100vw;
        z-index: 1;
        padding-top: 80px;
    }

    .right-container.has-markdown {
        padding: 80px 20px 20px 20px;
    }

    .left-container h1 {
        font-size: 1.3em;
    }

    .left-container h2 {
        font-size: 0.9em;
    }
}
