/* ==========================================================
   Tacit CMS Styles
   Minimalist dark mode, high readability
========================================================== */

:root {
    --bg-dark: #07150B;
    /* Deep pine base */
    --bg-panel: #0E2415;
    /* Slightly lighter pine for sidebar */
    --bg-hover: #163620;
    --text-main: #E5E7EB;
    --text-muted: #9CA3AF;
    --accent: #D4A373;
    /* Muted amber */
    --border: rgba(255, 255, 255, 0.1);

    --font-ui: 'IBM Plex Sans', sans-serif;
    --font-body: 'IBM Plex Sans', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

/* Layout */
.cms-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--bg-panel);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h2 {
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--text-main);
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

#searchInput {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

#searchInput:focus {
    border-color: var(--accent);
}

.sidebar-nav {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.nav-group {
    margin-bottom: 24px;
}

.nav-group-title {
    padding: 0 24px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 600;
}

.nav-link {
    display: block;
    padding: 8px 24px 8px 32px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    border-left: 2px solid transparent;
}

.nav-link:hover {
    color: var(--text-main);
    background-color: var(--bg-hover);
}

.nav-link.active {
    color: var(--accent);
    background-color: var(--bg-hover);
    border-left-color: var(--accent);
    font-weight: 500;
}

/* Main Content Area */
.content-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
}

.content-header {
    height: 64px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.mobile-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.breadcrumbs {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.home-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.home-link:hover {
    color: var(--accent);
}

/* Markdown Reading Pane */
.markdown-body {
    flex-grow: 1;
    padding: 48px 64px 80px;
    overflow-y: auto;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.empty-state {
    text-align: center;
    margin-top: 20vh;
    color: var(--text-muted);
}

.empty-state h1 {
    color: var(--text-main);
    margin-bottom: 16px;
}

/* Markdown Styles (Github-inspired but dark mode) */
.markdown-body h1 {
    font-size: 2.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
    margin: 32px 0 24px;
    color: #fff;
    letter-spacing: -0.02em;
}

.markdown-body h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin: 40px 0 16px;
    color: #fff;
}

.markdown-body h3 {
    font-size: 1.25rem;
    margin: 32px 0 16px;
    color: #fff;
}

.markdown-body p {
    margin-bottom: 16px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #D1D5DB;
}

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

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

.markdown-body ul,
.markdown-body ol {
    margin-bottom: 16px;
    padding-left: 24px;
    font-size: 1.05rem;
    line-height: 1.7;
    color: #D1D5DB;
}

.markdown-body li {
    margin-bottom: 8px;
}

.markdown-body blockquote {
    border-left: 4px solid var(--accent);
    padding: 16px 20px;
    background: rgba(212, 163, 115, 0.05);
    /* very faint accent bg */
    color: #9CA3AF;
    margin: 24px 0;
    border-radius: 0 4px 4px 0;
}

.markdown-body blockquote p:last-child {
    margin-bottom: 0;
}

.markdown-body code {
    font-family: var(--font-mono);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

.markdown-body pre {
    background: #000;
    padding: 16px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 24px 0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.markdown-body pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    font-size: 0.85rem;
    color: #A7B6C2;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
    font-size: 0.95rem;
}

.markdown-body th,
.markdown-body td {
    padding: 12px 16px;
    border: 1px solid var(--border);
    text-align: left;
}

.markdown-body th {
    background: var(--bg-hover);
    font-weight: 600;
    color: #fff;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 24px 0;
}

.markdown-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 40px 0;
}

/* Loading State */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: absolute;
        z-index: 100;
        height: 100%;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    }

    .mobile-toggle {
        display: block;
    }

    .markdown-body {
        padding: 24px;
    }
}