:root {
    --bg: #121212;
    --surface: #1e1e1e;
    --text: #e0e0e0;
    --text-muted: #888;
    --accent: #7eb8f7;
    --accent-visited: #b39ddb;
    --hr: rgba(255, 255, 255, 0.12);
    --sidebar-width: 200px;
    --header-height: 56px;
}

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

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: Lato, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Header ---- */

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 2rem;
    border-bottom: 1px solid var(--hr);
    position: sticky;
    top: 0;
    background-color: var(--bg);
    z-index: 10;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text);
    text-decoration: none;
}

.header-brand img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.header-name {
    font-family: Spectral, serif;
    font-size: 1rem;
}

nav {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

nav a {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--text);
    font-size: 0.9rem;
    text-decoration: none;
}

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

nav a:visited {
    color: var(--text);
}

nav svg {
    width: 1rem;
    height: 1rem;
    fill: currentColor;
    display: block;
}

/* ---- Layout ---- */

.layout {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem;
    gap: 2.5rem;
    flex: 1;
}

aside {
    border-right: 1px solid var(--hr);
}

/* ---- Typography ---- */

h1, h2, h3, h4 {
    font-family: Spectral, serif;
    margin-bottom: 0.75rem;
    line-height: 1.3;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

p {
    line-height: 1.7;
    margin-bottom: 1rem;
}

blockquote {
    border-left: 3px solid var(--accent);
    background-color: var(--surface);
    margin: 1rem 0;
    padding: 0.65rem 1rem;
    border-radius: 0 4px 4px 0;
    color: var(--text-muted);
}

blockquote p {
    margin-bottom: 0;
}

hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, var(--hr), transparent);
    margin: 1.5rem 0;
}

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

a:hover {
    text-decoration: underline;
}

a:visited {
    color: var(--accent-visited);
}

/* ---- Sidebar Nav ---- */

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    padding-top: 0.5rem;
}

.sidebar-nav a {
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 0.4rem 0.65rem;
    border-radius: 4px;
    text-decoration: none;
    width: 100%;
    justify-content: flex-end;
    transition: color 0.15s, background-color 0.15s;
}

.sidebar-nav a:visited {
    color: var(--text-muted);
}

.sidebar-nav a:hover {
    color: var(--text);
    background-color: var(--surface);
    text-decoration: none;
}

.sidebar-nav a.active {
    color: var(--accent);
    background-color: rgba(126, 184, 247, 0.08);
}

/* ---- Footer ---- */

footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem 2rem;
    border-top: 1px solid var(--hr);
    font-size: 0.8rem;
}

footer a {
    color: var(--text-muted);
}

footer a:visited {
    color: var(--text-muted);
}

/* ---- Sidebar Toggle (mobile only) ---- */

.sidebar-toggle {
    display: none;
}

/* ---- Responsive ---- */

@media (max-width: 640px) {
    header {
        padding: 0 1rem;
    }

    .layout {
        grid-template-columns: 1fr;
        padding: 1.5rem 1rem;
        gap: 0;
    }

    aside {
        border-right: none;
        border-bottom: 1px solid var(--hr);
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 0.6rem 0.65rem;
        background: none;
        border: none;
        color: var(--text);
        font-family: Lato, sans-serif;
        font-size: 0.9rem;
        cursor: pointer;
    }

    .sidebar-chevron {
        transition: transform 0.2s;
    }

    .sidebar-toggle[aria-expanded="true"] .sidebar-chevron {
        transform: rotate(180deg);
    }

    .sidebar-nav {
        display: none;
        padding-bottom: 0.5rem;
    }

    .sidebar-nav.open {
        display: flex;
    }
}
