:root {
    color-scheme: dark;
    --bg: #141612;
    --accent-bg: #1E211B;
    --text: #F2E9E4;
    --text-light: #4A4E4D;
    --accent: #A3B18A;
    --accent-hover: #B5C1A1;
    --accent-text: var(--bg);
    --code: #A3B18A;
    --preformatted: #F2E9E4;
    --disabled: #0A0B09;
    /* Simple.css internal mappings */
    --text-main: var(--text);
    --text-muted: var(--text-light);
    --border: #32362D;

    /* Nit: Custom scrollbars */
    scrollbar-color: var(--border) var(--bg);
    scrollbar-width: thin;
}

/* Nit: Selection color */
::selection {
    background: var(--accent);
    color: var(--accent-text);
}

[x-cloak] { display: none !important; }

/* Typography */
body {
    font-family: 'Inter', system-ui, sans-serif;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--accent);
}

.site-title {
    font-family: 'Fira Code', monospace;
}

/* Layout */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

header, footer {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
    padding: 1rem 1.5rem;
}

main {
    flex: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    box-sizing: border-box;
}

/* Header & Navigation */
header h1 {
    margin-top: 0;
    margin-bottom: 2rem;
}

header h1 a {
    text-decoration: none;
    color: inherit;
}

nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 1rem;
}

/* Footer */
footer {
    margin-top: auto;
}

.social-links a {
    margin: 0 0.5rem;
    text-decoration: none;
    color: inherit;
}

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

.admin-link {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: 0.5rem;
    opacity: 0.5;
}

.admin-link:hover {
    color: var(--accent);
    opacity: 1;
}

/* Home Page Timeline */
.timeline-date-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.timeline-date {
    margin: 0;
    white-space: nowrap;
    font-weight: bold;
    font-size: 0.9rem;
    color: var(--text-main);
}

.timeline-divider {
    flex-grow: 1;
    margin: 0;
    border: none;
    border-top: 1px solid var(--border);
}

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

.timeline-item-article-title {
    margin-bottom: 0.2rem;
}

.timeline-item-icon {
    font-size: 0.8em;
    margin-right: 0.5rem;
    color: var(--accent);
}

.timeline-item-details {
    margin-left: 1.8rem;
}

.timeline-item-description {
    margin-top: 0;
    margin-bottom: 0.2rem;
    color: var(--text-main);
    opacity: 0.9;
}

.timeline-item-time {
    margin: 0;
    font-size: 0.75rem;
    color: var(--text-main);
    opacity: 0.6;
}

.timeline-item-note {
    border-left: 4px double var(--accent);
    padding-left: 1rem;
    margin-left: 0.2rem;
}

.timeline-item-note-content {
    margin: 0;
    font-style: italic;
    color: var(--text-main);
}

/* Tags Page */
.tag-list {
    list-style: none;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-list-vertical {
    flex-direction: column;
    gap: 0.75rem;
}

.tag-list-item {
    margin: 0;
}

.tag-list-link {
    font-size: 1.1rem;
    text-decoration: none;
}

.tag-list-link:hover {
    text-decoration: underline;
}

.tag-list-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    background: var(--accent);
    color: var(--accent-text) !important;
    padding: 0.2rem 0.6rem;
    border-radius: 15px;
    font-size: 0.85rem;
    line-height: 1;
    text-decoration: none !important;
}

.tag-pill:hover {
    background: var(--accent-hover);
    color: var(--accent-text) !important;
}

.tag-pill button {
    background: none;
    border: none;
    color: var(--accent-text);
    margin: 0 !important;
    margin-left: 0.3rem !important;
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tag-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--accent-bg);
    border: 1px solid var(--border);
    border-radius: 0 0 5px 5px;
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.tag-suggestion {
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
}

/* Admin Styles */
.admin-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.admin-table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 3rem;
}

table.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.admin-table th, .admin-table td {
    padding: 0.5rem;
}

.admin-table thead tr {
    text-align: left;
    border-bottom: 2px solid var(--border);
}

.admin-table tbody tr {
    border-bottom: 1px solid var(--border);
}

.status-badge {
    font-size: 0.8rem;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-published {
    background: var(--accent);
    color: var(--accent-text);
}

.status-draft {
    background: var(--border);
    color: var(--text-muted);
}

.pagination-row {
    display: flex;
    justify-content: space-between;
    margin-top: -2rem;
    margin-bottom: 3rem;
}

/* Editor Styles */
.editor-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.editor-metadata-column {
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.editor-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.editor-col {
    flex: 1;
    min-width: 200px;
}

.tag-input-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 5px;
    min-height: 2.5rem;
    align-items: center;
    background: var(--bg);
}

/* EasyMDE Dark Overrides */
.editor-toolbar { border-color: var(--border); background-color: var(--accent-bg); }
.editor-toolbar button { 
    color: var(--text-main) !important; 
    background: none !important; 
    border: none !important;
    opacity: 0.8;
}
.editor-toolbar button:hover, .editor-toolbar button.active { 
    background: var(--border) !important; 
    opacity: 1;
}
.CodeMirror { 
    border-color: var(--border); 
    border-bottom-left-radius: 5px; 
    border-bottom-right-radius: 5px; 
    font-size: 1.1rem; 
    background-color: var(--bg);
    color: var(--text-main);
    min-height: 400px;
}
.CodeMirror-cursor { border-left: 2px solid var(--accent); }
.CodeMirror-selected { background: var(--accent-bg) !important; }
.editor-preview, .editor-preview-side { background-color: var(--bg); color: var(--text-main); }
.editor-preview pre, .editor-preview-side pre { background-color: var(--accent-bg); border: 1px solid var(--border); }
.editor-preview code, .editor-preview-side code { background-color: transparent; }

/* Responsive adjustments */
@media (min-width: 800px) {
    body:has(#markdown-editor) main {
        max-width: 95%;
    }
}

@media (max-width: 800px) {
    .CodeMirror { font-size: 1rem; }
    main { padding: 0.5rem !important; }
}
