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

:root {
    --accent: #a8c4a2;
    --fg: #d4d0c8;
    --dim: #666;
    --bg: #0c0c0c;
    --text: #e9e6e0;
    --border: #1e1e1e;
    --bg-secondary: #161616;
    --error: #c45c5c;
    --link: #6ba3d6;
}

[data-theme="light"] {
    --accent: #2e7d32;
    --fg: #333;
    --dim: #888;
    --bg: #f5f5f0;
    --text: #1a1a1a;
    --border: #ddd;
    --bg-secondary: #eaeaea;
    --error: #c62828;
    --link: #1a73e8;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    padding: 64px 0 64px 72px;
}

/* Two-column layout */
.page-layout {
    display: flex;
    height: calc(100vh - 128px);
}

.main-content {
    flex: 0 0 560px; /* 560px width, and don't grow/shrink*/
    max-width: 560px;
    overflow-y: auto;
}

.title {
    display: flex;
    align-items: baseline;
    gap: 16px;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 2px;
}

.title-link {
    color: var(--text);
    text-decoration: none;
    transition: color 0.15s;
}

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

.boot-line {
  color: var(--dim);
  font-size: 13px;
  margin-bottom: 32px;
  min-height: 20px;
}

.boot-cursor {
    display: inline-block;
    color: var(--accent);
    margin-left: 2px;
    animation: boot-blink 1s steps(2) infinite;
}

@keyframes boot-blink {
    50% { opacity: 0; }
}

body.pre-boot .nav-links,
body.pre-boot .bio,
body.pre-boot .links,
body.pre-boot .personal-bests,
body.pre-boot .status,
body.pre-boot .terminal {
    opacity: 0;
}

body.booted .nav-links,
body.booted .bio,
body.booted .links,
body.booted .personal-bests,
body.booted .status,
body.booted .terminal {
    opacity: 1;
    transition: opacity 0.5s ease;
}

.bio {
    font-size: 13px;
    line-height: 1.9;
    margin-bottom: 36px;
}

.accent {
    color: var(--accent);
}

.links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 28px;
}

.section-label {
  color: var(--dim);
  font-size: 12px;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.link-row a {
    color: var(--fg);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.15s;
}

.link-row a::before { content: '[['; color: var(--dim); }
.link-row a::after { content: ']]'; color: var(--dim); }

.link-row a:hover,
.link-row a:hover::before,
.link-row a:hover::after {
    color: var(--accent)
}

.comment {
    color: var(--dim);
    font-size: 13px;
    padding-left: 6px;
}

.status {
    margin-top: 40px; padding-top: 28px;
    border-top: 1px solid var(--border);
    font-size: 12px; color: var(--dim); line-height: 1.7;
}
.status .status-dot { color: var(--accent); }

.personal-bests {
    padding-top: 28px;
    font-size: 13px
}

.pb-table {
    border-collapse: collapse;
}

.pb-label {
    color: var(--dim);
    padding-right: 24px;
}

.pb-value {
    color: var(--fg);
}

.nav-links {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.nav-links a {
    color: var(--dim);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    transition: color 0.15s;
}

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

.theme-toggle {
    background: none;
    border: none;
    color: var(--dim);
    font-size: 14px;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    transition: color 0.15s;
    line-height: 1;
}

.theme-toggle:hover {
    color: var(--accent);
}

/* Terminal */
.terminal {
    flex: 1 1 0%;
    border-left: 1px solid var(--border);
    padding: 0 72px 0 32px;
    margin-left: 48px;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.terminal-header {
    color: var(--dim);
    font-size: 12px;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.terminal-output {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    font-size: 13px;
    line-height: 1.7;
}

.terminal-output .terminal-line {
    white-space: pre-wrap;
    word-break: break-word;
}

.terminal-output .terminal-line .prompt {
    color: var(--accent);
}

.terminal-output .terminal-line .cmd {
    color: var(--fg);
}

.terminal-output .terminal-line .result {
    color: var(--dim);
}

.terminal-output .terminal-line .error {
    color: var(--error);
}

.terminal-input-line {
    position: relative;
    display: flex;
    align-items: center;
    font-size: 13px;
    margin-top: 8px;
}

.terminal-prompt {
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
}

.terminal-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.terminal-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    color: var(--dim);
    pointer-events: none;
    font-size: 13px;
    line-height: 1.4;
    font-family: inherit;
}

.terminal-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--fg);
    font-family: inherit;
    font-size: 13px;
    width: 100%;
    caret-color: var(--accent);
    line-height: 1.4;
}

.terminal-dropdown {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    margin-bottom: 4px;
    min-width: 140px;
    z-index: 10;
}

.terminal-dropdown.open {
    display: block;
}

.terminal-dropdown-item {
    padding: 4px 12px;
    font-size: 13px;
    color: var(--fg);
    cursor: pointer;
    font-family: inherit;
}

.terminal-dropdown-item:hover,
.terminal-dropdown-item.active {
    background: var(--border);
    color: var(--accent);
}

/* Notes */
/* notes pages have a narrower directory sidebar instead of the terminal, so let the content fill the space */
.notes-page .main-content {
    flex: 1 1 0%;
    max-width: 900px;
}

.notes-nav {
    flex: 0 0 auto;
    width: fit-content;
    border-left: 1px solid var(--border);
    padding: 0 32px;
    margin-left: 48px;
    overflow-y: auto;
}

.notes-nav-header {
    color: var(--dim);
    font-size: 12px;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.notes-tree, .notes-tree ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.notes-tree ul {
    padding-left: 16px;
}

.notes-tree li {
    font-size: 13px;
    line-height: 1.7;
}

.notes-tree-dir, .notes-tree-file {
    color: var(--dim);
    text-decoration: none;
    transition: color 0.15s;
}

.notes-tree-dir {
    color: var(--fg);
}

.notes-tree-dir:hover, .notes-tree-file:hover,
.notes-tree-dir.active, .notes-tree-file.active {
    color: var(--accent);
}

.notes-list {
    list-style: none;
    padding: 0;
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.notes-link {
    color: var(--link);
    text-decoration: none;
    font-size: 14px;
}

.notes-link:hover {
    text-decoration: underline;
}

.notes-empty {
    color: var(--dim);
    font-size: 13px;
    margin-top: 16px;
}

.notes-content {
    font-size: 13px;
    line-height: 1.7;
    color: var(--text);
    margin-top: 16px;
}

.notes-content h1, .notes-content h2, .notes-content h3, .notes-content h4 {
    margin-top: 28px;
    margin-bottom: 10px;
    font-weight: 500;
}

.notes-content h1 { font-size: 18px; }
.notes-content h2 { font-size: 16px; }
.notes-content h3 { font-size: 14px; color: var(--accent); }
.notes-content h4 { font-size: 13px; color: var(--dim); }

.notes-content p {
    margin: 10px 0;
}

.notes-content a {
    color: var(--link);
    text-decoration: none;
}
.notes-content a:hover {
    text-decoration: underline;
}

.notes-content ul, .notes-content ol {
    margin: 10px 0;
    padding-left: 24px;
}

.notes-content li {
    margin: 4px 0;
}

.notes-content code {
    background: var(--bg-secondary);
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.notes-content pre {
    background: var(--bg-secondary);
    padding: 12px 14px;
    border-radius: 4px;
    overflow-x: auto;
    margin: 12px 0;
}

.notes-content pre code {
    background: none;
    padding: 0;
}

.notes-content blockquote {
    border-left: 2px solid var(--border);
    padding-left: 14px;
    margin: 12px 0;
    color: var(--dim);
}

.notes-content mark {
    background: rgba(255, 215, 64, 0.22);
    color: inherit;
    padding: 0 3px;
    border-radius: 2px;
}

.notes-content hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.wiki-broken {
    color: var(--error);
    border-bottom: 1px dotted var(--error);
}

/* Mobile */
@media (max-width: 768px) {
    body {
        padding: 32px 24px;
        height: auto;
        overflow: auto;
    }

    .page-layout {
        flex-direction: column;
        min-height: auto;
    }

    .page-layout {
        height: auto;
        overflow: visible;
    }

    .main-content {
        flex: none;
        max-width: none;
        overflow-y: visible;
    }

    .terminal,
    .notes-nav {
        display: none;
    }
}