@charset "UTF-8";

/* ── Lattice Docs Theme ── */

:root {
    --sidebar-width: 280px;
    --toc-width: 220px;
    --content-max-width: 800px;
    --font-body: system-ui, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    --font-size: 16px;
    --font-size-nav: 0.875rem;
    --font-size-small: 0.65rem;
    --line-height: 1.7;

    /* Light theme */
    --bg: #fafafa;
    --bg-sidebar: #f5f5f5;
    --text: #333;
    --text-muted: #777;
    --text-heading: #1a1a1a;
    --border: #e5e5e5;
    --link: #4a6fa5;
    --link-hover: #345082;
    --accent: #4a6fa5;
    --code-bg: #f0f0f0;
    --code-border: #e0e0e0;
    --code-text: #2a2a2a;
    --blockquote-border: #ccc;
    --blockquote-bg: #f8f8f8;
    --table-header-bg: #f0f0f0;
    --table-border: #e0e0e0;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1a1a1a;
        --bg-sidebar: #151515;
        --text: #ccc;
        --text-muted: #888;
        --text-heading: #e8e8e8;
        --border: #333;
        --link: #7fa8d4;
        --link-hover: #a0c4e8;
        --accent: #7fa8d4;
        --code-bg: #222;
        --code-border: #383838;
        --code-text: #ccc;
        --blockquote-border: #555;
        --blockquote-bg: #1e1e1e;
        --table-header-bg: #222;
        --table-border: #383838;
    }
}

/* ── Reset ── */

*, *::before, *::after { box-sizing: border-box; }
html { font-size: var(--font-size); -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font-body);
    line-height: var(--line-height);
    color: var(--text);
    background: var(--bg);
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ── */

nav.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    font-size: var(--font-size-nav);
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
}

nav.sidebar::-webkit-scrollbar { width: 4px; }
nav.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Header */
nav.sidebar .sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

nav.sidebar .site-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
    text-decoration: none;
    letter-spacing: -0.01em;
}

nav.sidebar .github-link {
    color: var(--text-muted);
    text-decoration: none;
    line-height: 1;
}
nav.sidebar .github-link:hover { color: var(--text); }
nav.sidebar .github-link svg { display: block; }

/* Nav list */
nav.sidebar > ul {
    padding: 1rem 1.5rem;
    margin: 0;
    list-style: none;
    border-top: 1px solid var(--border);
}

nav.sidebar ul ul { padding: 0; margin: 0 0 0.5rem; list-style: none; }
nav.sidebar li { margin: 0; }

nav.sidebar .section-label {
    display: block;
    padding: 1rem 0 0.25rem;
    letter-spacing: 0.02em;
    color: var(--text-heading);
}

nav.sidebar li:first-child > .section-label { padding-top: 0; }

/* Nav links */
nav.sidebar ul a {
    display: block;
    padding: 0.35rem 0.5rem;
    color: var(--text-muted);
    text-decoration: none;
    border-left: 1px solid var(--border);
    transition: color 0.1s, border-color 0.1s;
}

nav.sidebar ul a:hover {
    color: var(--text);
    border-left-color: var(--text-muted);
}

nav.sidebar ul a.active {
    color: var(--accent);
    font-weight: 500;
    border-left-color: var(--accent);
}

/* ── Content ── */

article.content {
    flex: 1;
    min-width: 0;
    max-width: calc(var(--content-max-width) + 6rem);
    padding: 2.5rem 3rem;
}

/* ── Table of Contents ── */

aside.toc {
    width: var(--toc-width);
    min-width: var(--toc-width);
    padding: 2.5rem 1.5rem 2.5rem 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    font-size: var(--font-size-nav);
    line-height: 1.5;
}

aside.toc .toc-title {
    display: block;
    letter-spacing: 0.02em;
    color: var(--text-heading);
    margin-bottom: 0.75rem;
}

aside.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

aside.toc li { margin: 0; }

aside.toc a {
    display: block;
    padding: 0.2rem 0;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.1s;
}

aside.toc a:hover {
    color: var(--text);
}

aside.toc a.active {
    color: var(--accent);
}

aside.toc ul ul a {
    padding-left: 0.75rem;
}

/* ── Typography ── */

h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    font-weight: 600;
    line-height: 1.3;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

h1 { font-size: 2rem; margin-top: 0; margin-bottom: 1rem; letter-spacing: -0.02em; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); }
h2 { font-size: 1.5rem; margin-top: 2.5rem; letter-spacing: -0.01em; }
h3 { font-size: 1.25rem; margin-top: 2rem; }
h4 { font-size: 1.1rem; }

p { margin-top: 0; margin-bottom: 1rem; }

a:link, a:visited { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

strong { font-weight: 600; color: var(--text-heading); }

/* Lists */
ul, ol { margin-top: 0; margin-bottom: 1rem; padding-left: 1.5rem; }
li { margin-bottom: 0.25rem; }
li > ul, li > ol { margin-top: 0.25rem; margin-bottom: 0; }

/* Code */
code {
    font-family: var(--font-mono);
    font-size: 0.875em;
    background: var(--code-bg);
    color: var(--code-text);
    padding: 0.15em 0.35em;
    border-radius: 4px;
    border: 1px solid var(--code-border);
}

pre {
    margin: 0 0 1.25rem;
    padding: 1rem 1.25rem;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 6px;
    overflow-x: auto;
    line-height: 1.5;
}

pre code { background: none; border: none; padding: 0; border-radius: 0; color: var(--code-text); }

/* Hugo highlight wrapper */
.highlight { margin: 0 0 1.25rem; }
.highlight pre { margin: 0; }

/* Blockquotes */
blockquote {
    margin: 0 0 1rem;
    padding: 0.75rem 1.25rem;
    border-left: 3px solid var(--blockquote-border);
    background: var(--blockquote-bg);
    color: var(--text-muted);
}

blockquote p { margin-bottom: 0.5rem; }
blockquote p:last-child { margin-bottom: 0; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin-bottom: 1.25rem; font-size: var(--font-size-nav); }
thead th { background: var(--table-header-bg); font-weight: 600; text-align: left; padding: 0.6rem 0.75rem; border-bottom: 2px solid var(--table-border); }
tbody td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--table-border); }
tbody tr:last-child td { border-bottom: none; }

/* Status badges */
.status-badge {
    font-size: var(--font-size-small);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.15em 0.5em;
    border-radius: 3px;
    vertical-align: middle;
    position: relative;
    top: -0.15em;
}

.status-draft { background: #f0e6c0; color: #7a6520; }
.status-design { background: #d8e8f0; color: #3a6080; }
.status-proposal { background: #e0daf0; color: #5a4080; }

@media (prefers-color-scheme: dark) {
    .status-draft { background: #3d3520; color: #c8b060; }
    .status-design { background: #1e2e3a; color: #80b0d0; }
    .status-proposal { background: #2a2040; color: #a090c0; }
}

/* Misc */
hr { border: none; border-top: 1px solid var(--border); margin: 2rem 0; }
img { max-width: 100%; height: auto; }
dt { font-weight: 600; margin-top: 1rem; }
dd { margin-left: 1.5rem; margin-bottom: 0.5rem; }

/* ── Mobile ── */

@media (max-width: 1100px) {
    aside.toc { display: none; }
}

@media (max-width: 768px) {
    body { flex-direction: column; }

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

    article.content { padding: 1.5rem 1rem; max-width: none; }
}
