/* Terminal-inspired theme with dark/light modes */

:root {
    /* Dark mode (midnight blue) - default */
    --bg: #0f1219;
    --bg-surface: #1a1f2e;
    --text: #d4d7e0;
    --text-muted: #6b7280;
    --accent: #8b9dc3;
    --accent-hover: #a8b5d1;
    --border: #2a3142;
    --tree-line: #2a3142;
}

[data-theme="light"] {
    /* Light mode (cream/beige/brown) */
    --bg: #f5f0e8;
    --bg-surface: #ebe5d9;
    --text: #3d3a35;
    --text-muted: #7a756b;
    --accent: #9c7a5a;
    --accent-hover: #b08a68;
    --border: #d4cfc3;
    --tree-line: #d4cfc3;
}

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

html {
    font-size: 16px;
}

body {
    font-family:
        "JetBrains Mono", "Fira Code", "SF Mono", "Consolas", monospace;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition:
        background-color 0.3s,
        color 0.3s;
}

/* Layout */
.page-wrapper {
    display: flex;
    max-width: 960px;
    margin: 0 auto;
    min-height: 100vh;
}

.sidebar {
    width: 200px;
    padding: 2rem 1rem;
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    margin-bottom: 1.5rem;
}

.sidebar-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    display: block;
    margin-bottom: 0.25rem;
}

.sidebar-title:hover {
    color: var(--accent);
    text-decoration: none;
}

.sidebar-prompt {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sidebar-nav {
    font-size: 0.8rem;
}

.content-area {
    flex: 1;
    padding: 2rem 1.5rem 4rem;
    min-width: 0;
}

/* No sidebar layout fallback */
header {
    padding: 2rem 1.5rem 1rem;
    max-width: 720px;
    margin: 0 auto;
    position: relative;
}

main {
    max-width: 720px;
    margin: 0 auto;
    padding: 1rem 1.5rem 4rem;
}

footer {
    max-width: 720px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.7rem;
    padding: 0.35rem 0.5rem;
    cursor: pointer;
    transition:
        color 0.2s,
        border-color 0.2s;
    border-radius: 3px;
}

.theme-toggle:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

/* Terminal Navigation */
.terminal-nav {
    margin-bottom: 0.5rem;
}

.terminal-prompt {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

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

.terminal-prompt .path {
    color: var(--text);
}

.terminal-prompt .symbol {
    color: var(--text-muted);
}

nav {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    margin-top: 0.5rem;
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

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

/* Typography */
h1,
h2,
h3 {
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

h1 {
    font-size: 1.25rem;
    color: var(--text);
}

h2 {
    font-size: 1rem;
    color: var(--text-muted);
}

p {
    margin-bottom: 1rem;
    color: var(--text);
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Hero / Intro section */
.intro {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.intro .command {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.intro .command span {
    color: var(--accent);
}

.intro .output {
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.intro .bio {
    color: var(--text-muted);
    max-width: 55ch;
    font-size: 0.9rem;
}

.cursor {
    display: inline-block;
    width: 0.5em;
    height: 1em;
    background-color: var(--accent);
    margin-left: 2px;
    animation: blink 1s step-end infinite;
    vertical-align: text-bottom;
}

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

/* File Tree */
.file-tree {
    margin: 1rem 0;
}

.tree-header {
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}

.tree-header span {
    color: var(--accent);
}

.tree {
    font-size: 0.85rem;
}

.tree-root {
    color: var(--accent);
    margin-bottom: 0.25rem;
}

/* Folder styles */
.folder {
    margin: 0.125rem 0;
}

.folder-header {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    padding: 0.125rem 0;
    user-select: none;
}

.folder-header:hover {
    color: var(--accent);
}

.folder-header .toggle {
    color: var(--text-muted);
    width: 0.75em;
    font-size: 0.6rem;
    transition: transform 0.2s;
}

.folder.open > .folder-header .toggle {
    transform: rotate(90deg);
}

.folder-header .folder-name {
    color: var(--text);
}

.folder-header:hover .folder-name {
    color: var(--accent);
}

.folder-contents {
    margin-left: 0.75rem;
    padding-left: 0.75rem;
    border-left: 1px solid var(--tree-line);
    display: none;
}

.folder.open > .folder-contents {
    display: block;
}

/* File styles */
.file {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.125rem 0;
    font-size: 0.8rem;
}

.file-icon {
    color: var(--text-muted);
    font-size: 0.6rem;
}

.file a {
    color: var(--text-muted);
    text-decoration: none;
}

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

.file .meta {
    color: var(--text-muted);
    font-size: 0.65rem;
    margin-left: auto;
    opacity: 0.7;
}

/* Links section */
.links {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
}

.links a {
    color: var(--text-muted);
    font-size: 0.875rem;
}

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

/* Code blocks */
pre {
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    font-size: 0.85rem;
}

code {
    font-family: inherit;
    font-size: 0.85em;
}

p code {
    background-color: var(--bg-surface);
    padding: 0.15em 0.35em;
    border-radius: 3px;
    font-size: 0.85em;
}

/* Article pages */
article {
    max-width: 65ch;
}

article h1 {
    margin-bottom: 0.5rem;
    margin-top: 0;
}

article .meta {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 2rem;
}

article h2 {
    margin-top: 2.5rem;
}

article h2::before {
    content: "## ";
    color: var(--accent);
}

article ul,
article ol {
    margin: 1rem 0 1rem 1.5rem;
    color: var(--text);
}

article li {
    margin-bottom: 0.5rem;
}

/* Images in articles - terminal window style */
article img {
    max-width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
    margin: 1.5rem 0;
    display: block;
}

article figure {
    margin: 1.5rem 0;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}

article figure img {
    margin: 0;
    border: none;
    border-radius: 0;
}

article figcaption {
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

/* List pages */
.list-page h1 {
    margin-top: 0;
    font-size: 1rem;
}

.list-page h1::before {
    content: "~/";
    color: var(--accent);
}

.projects-list {
    list-style: none;
    margin-top: 1rem;
}

.projects-list li {
    padding: 0.35rem 0;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.projects-list a {
    color: var(--text);
}

.projects-list a:hover {
    color: var(--accent);
}

.projects-list .date {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

/* Responsive */
@media (max-width: 700px) {
    .page-wrapper {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 1rem;
    }

    .content-area {
        padding: 1.5rem 1rem 3rem;
    }

    html {
        font-size: 14px;
    }

    header,
    main,
    footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .theme-toggle {
        top: 1rem;
        right: 1rem;
    }

    .folder-contents {
        margin-left: 0.5rem;
        padding-left: 0.5rem;
    }

    .projects-list li {
        flex-direction: column;
        gap: 0.25rem;
    }
}
