:root {
    --bg:         #0f1117;
    --bg2:        #161b22;
    --bg3:        #1c2128;
    --border:     #30363d;
    --accent:     #58a6ff;
    --accent2:    #3fb950;
    --accent3:    #f78166;
    --accent4:    #d2a8ff;
    --text:       #e6edf3;
    --text-muted: #8b949e;
    --code-bg:    #1e2430;
    --sidebar-w:  260px;
    --header-h:   56px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.7;
}

/* ── HEADER ── */
header {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-h);
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    z-index: 100;
    gap: 16px;
}

header .logo {
    font-size: 17px;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: -0.3px;
    white-space: nowrap;
}

header .version {
    font-size: 11px;
    background: var(--bg3);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 20px;
}

header .tagline {
    color: var(--text-muted);
    font-size: 13px;
    margin-left: auto;
}

/* ── SIDEBAR ── */
nav#sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg2);
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px 0 32px;
    z-index: 90;
}

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

.nav-group { margin-bottom: 4px; }

.nav-group-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    padding: 12px 20px 4px;
}

nav#sidebar a {
    display: block;
    padding: 5px 20px 5px 28px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13.5px;
    border-left: 2px solid transparent;
    transition: all .15s;
}

nav#sidebar a:hover,
nav#sidebar a.active {
    color: var(--text);
    background: var(--bg3);
    border-left-color: var(--accent);
}

/* ── MAIN ── */
main {
    margin-left: var(--sidebar-w);
    margin-top: var(--header-h);
    padding: 40px 56px 80px;
    max-width: 960px;
}

/* ── SECTIONS ── */
section {
    margin-bottom: 64px;
    scroll-margin-top: calc(var(--header-h) + 20px);
}

h1 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
h2 { font-size: 22px; font-weight: 700; margin: 40px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
h3 { font-size: 16px; font-weight: 600; margin: 28px 0 8px; color: var(--accent); }
h4 { font-size: 14px; font-weight: 600; margin: 20px 0 6px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

p { margin-bottom: 12px; }

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

/* ── HERO ── */
.hero {
    background: linear-gradient(135deg, #161b22 0%, #1c2128 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 32px 36px;
    margin-bottom: 40px;
}

.hero h1 { color: var(--accent); font-size: 32px; margin-bottom: 6px; }
.hero p  { color: var(--text-muted); font-size: 16px; margin-bottom: 0; }

.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

.badge {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 4px;
    font-weight: 600;
}
.badge-blue   { background: #1f3a5f; color: #58a6ff; }
.badge-green  { background: #1b3e2a; color: #3fb950; }
.badge-purple { background: #2e1f5e; color: #d2a8ff; }
.badge-orange { background: #3d2200; color: #f0883e; }

/* ── CODE ── */
pre, code {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Consolas', monospace;
    font-size: 13px;
}

code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--accent4);
}

pre {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    overflow-x: auto;
    margin: 14px 0;
    line-height: 1.6;
    tab-size: 4;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text);
    font-size: 13px;
}

/* syntax highlight helpers */
.kw   { color: #ff7b72; }   /* keyword */
.fn   { color: #d2a8ff; }   /* function */
.str  { color: #a5d6ff; }   /* string */
.cm   { color: #8b949e; font-style: italic; }  /* comment */
.cls  { color: #ffa657; }   /* class */
.var  { color: #79c0ff; }   /* variable */
.num  { color: #79c0ff; }   /* number */

/* ── TABLES ── */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
    font-size: 14px;
}

th {
    background: var(--bg3);
    text-align: left;
    padding: 9px 14px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
}

td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg3); }

td code { font-size: 12px; }

/* ── CARDS ── */
.card {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    margin: 12px 0;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin: 16px 0;
}

.card-small {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
}

.card-small h4 { margin-top: 0; font-size: 13px; color: var(--accent); text-transform: none; letter-spacing: 0; }
.card-small p  { font-size: 13px; color: var(--text-muted); margin-bottom: 0; }

/* ── CALLOUTS ── */
.callout {
    border-left: 3px solid;
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
    margin: 16px 0;
    font-size: 14px;
}
.callout-info    { border-color: var(--accent);  background: #1f3a5f33; }
.callout-warn    { border-color: #e3b341;         background: #3d2f0033; }
.callout-tip     { border-color: var(--accent2);  background: #1b3e2a33; }
.callout-danger  { border-color: var(--accent3);  background: #3d100033; }

.callout strong { display: block; margin-bottom: 4px; }

/* ── METHOD BLOCKS ── */
.method {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin: 16px 0;
    overflow: hidden;
}

.method-header {
    background: var(--bg3);
    padding: 10px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
}

.method-body {
    padding: 14px 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.method-body p { margin-bottom: 6px; }

.tag {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 3px;
}
.tag-get    { background: #1b3e2a; color: #3fb950; }
.tag-post   { background: #1f3a5f; color: #58a6ff; }
.tag-put    { background: #3d2f00; color: #e3b341; }
.tag-delete { background: #3d1000; color: #f78166; }
.tag-static { background: #2e1f5e; color: #d2a8ff; }

/* ── LIFECYCLE ── */
.lifecycle {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin: 16px 0;
}

.lifecycle-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    position: relative;
}

.lifecycle-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 32px;
    bottom: -8px;
    width: 2px;
    background: var(--border);
}

.lifecycle-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg3);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 4px;
}

.lifecycle-content {
    padding: 4px 0 20px;
}

.lifecycle-content strong { color: var(--text); font-size: 14px; display: block; }
.lifecycle-content span   { color: var(--text-muted); font-size: 13px; }

/* ── DIR TREE ── */
.dir-tree {
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px 24px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre;
    overflow-x: auto;
}

.dir-tree .d { color: #58a6ff; font-weight: 600; }
.dir-tree .f { color: var(--text-muted); }
.dir-tree .c { color: #8b949e; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
    nav#sidebar { display: none; }
    main { margin-left: 0; padding: 24px 20px 60px; max-width: 100%; }
    header .tagline { display: none; }
}
