/* TrickOrTreat documentation — EssentialsX-wiki inspired theme (light/dark). */

:root {
    --bg: #ffffff;
    --bg-alt: #f7f8fa;
    --sidebar-bg: #ffffff;
    --navbar-bg: rgba(255, 255, 255, 0.9);
    --text: #1c1e21;
    --text-muted: #5c6670;
    --heading: #17181c;
    --border: #e6e8eb;
    --accent: #2f6fe0;
    --accent-hover: #1f57bd;
    --accent-soft: #eaf1fd;
    --code-bg: #f5f7f9;
    --code-border: #e6e8eb;
    --code-text: #b5460a;
    --pre-bg: #1c2027;
    --pre-text: #e6edf3;
    --shadow: rgba(0, 0, 0, 0.06);
}

html[data-theme="dark"] {
    --bg: #1b1b1f;
    --bg-alt: #202024;
    --sidebar-bg: #17181c;
    --navbar-bg: rgba(23, 24, 28, 0.9);
    --text: #d6d7da;
    --text-muted: #9198a1;
    --heading: #f2f3f5;
    --border: #2b2c31;
    --accent: #6f9bff;
    --accent-hover: #8db0ff;
    --accent-soft: #23304d;
    --code-bg: #23242a;
    --code-border: #2b2c31;
    --code-text: #ffb37a;
    --pre-bg: #0f1114;
    --pre-text: #e6edf3;
    --shadow: rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.65;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}

/* ---------- Navbar ---------- */
#navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    background: var(--navbar-bg);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}
#navbar .logo {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 700;
    font-size: 17px;
    color: var(--heading);
    text-decoration: none;
}
#navbar .logo .pumpkin { font-size: 22px; }
#navbar .spacer { flex: 1; }
#navbar .nav-right { display: flex; align-items: center; gap: 18px; }
#navbar .nav-right .ver { color: var(--text-muted); font-size: 14px; }
#theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
    width: 36px; height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
#theme-toggle:hover { background: var(--bg-alt); border-color: var(--accent); }

/* ---------- Layout ---------- */
#layout { display: flex; }

#sidebar {
    position: fixed;
    top: 60px; bottom: 0; left: 0;
    width: 290px;
    overflow-y: auto;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    padding: 18px 12px 60px 20px;
}
#content {
    margin-left: 290px;
    margin-right: 240px;
    max-width: 780px;
    padding: 30px 44px 140px 44px;
    margin-top: 60px;
    width: 100%;
}

/* ---------- Sidebar search ---------- */
.search { margin: 0 8px 10px 0; }
#sidebar-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-alt);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
}
#sidebar-search::placeholder { color: var(--text-muted); }
#sidebar-search:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.no-results {
    display: none;
    color: var(--text-muted);
    font-size: 13.5px;
    padding: 6px 10px;
}
#sidebar .group.hidden, #sidebar a.hidden { display: none; }

/* ---------- Sidebar nav ---------- */
#sidebar .group {
    margin: 18px 0 4px 8px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-muted);
}
#sidebar .group:first-child { margin-top: 0; }
#sidebar a {
    display: block;
    padding: 6px 10px;
    margin: 1px 0;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14.5px;
    border-radius: 7px;
    transition: background .12s, color .12s;
}
#sidebar a:hover { background: var(--bg-alt); color: var(--text); }
#sidebar a.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 600;
}

/* ---------- Right TOC ---------- */
#toc {
    position: fixed;
    top: 60px; right: 0;
    width: 240px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    padding: 30px 20px;
}
#toc .toc-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    margin-bottom: 10px;
}
#toc a {
    display: block;
    padding: 3px 0 3px 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13.5px;
    border-left: 2px solid var(--border);
    line-height: 1.4;
}
#toc a:hover { color: var(--text); }
#toc a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }
#toc a.h3 { padding-left: 24px; }

/* ---------- Content typography ---------- */
#content h1 { font-size: 34px; margin: 0 0 10px 0; color: var(--heading); }
#content h2 {
    font-size: 25px;
    margin: 44px 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--heading);
    scroll-margin-top: 76px;
}
#content h3 { font-size: 19px; margin: 28px 0 6px 0; color: var(--heading); scroll-margin-top: 76px; }
#content h4 { font-size: 15px; margin: 18px 0 4px 0; color: var(--text-muted); text-transform: none; }
#content p { margin: 10px 0; }
#content ul, #content ol { margin: 10px 0; padding-left: 24px; }
#content li { margin: 4px 0; }

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

/* Hero */
.hero {
    background: linear-gradient(135deg, var(--accent-soft), var(--bg-alt));
    padding: 26px 28px;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin: 4px 0 20px 0;
}
.hero p { margin: 0; color: var(--text); font-size: 16px; }

/* Code */
code {
    font-family: "JetBrains Mono", "Consolas", "Courier New", monospace;
    font-size: 13.5px;
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-radius: 5px;
    padding: 1px 6px;
    color: var(--code-text);
}
pre {
    background: var(--pre-bg);
    color: var(--pre-text);
    padding: 16px 18px;
    border-radius: 10px;
    overflow-x: auto;
    font-size: 13.5px;
    line-height: 1.55;
    border: 1px solid var(--border);
}
pre code { background: none; border: none; color: inherit; padding: 0; font-size: 13.5px; }

/* Tables */
table { border-collapse: collapse; width: 100%; margin: 14px 0; font-size: 14.5px; }
th, td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
th { background: var(--bg-alt); color: var(--heading); font-weight: 600; }
tr:nth-child(even) td { background: var(--bg-alt); }

/* Callouts */
.note, .warn, .tip {
    margin: 16px 0; padding: 12px 16px; border-radius: 8px; font-size: 14.5px;
    border: 1px solid var(--border); border-left-width: 4px;
}
.note { background: var(--accent-soft); border-left-color: var(--accent); }
.warn { background: rgba(224, 122, 47, .10); border-left-color: #e07a2f; }
.tip  { background: rgba(74, 155, 61, .10); border-left-color: #4a9b3d; }

.badge {
    display: inline-block; background: var(--accent); color: #fff;
    font-size: 11px; padding: 2px 8px; border-radius: 20px;
    vertical-align: middle; margin-left: 6px; font-weight: 600;
}
.perm { color: var(--accent); font-weight: 600; font-family: "Consolas", monospace; font-size: 13.5px; }

hr { border: none; border-top: 1px solid var(--border); margin: 44px 0; }

footer {
    margin-left: 290px; margin-right: 240px;
    padding: 24px 44px 50px 44px;
    color: var(--text-muted); font-size: 13.5px;
    border-top: 1px solid var(--border);
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
    #toc { display: none; }
    #content, footer { margin-right: 0; }
}
@media (max-width: 800px) {
    #sidebar {
        position: static; width: 100%; height: auto;
        border-right: none; border-bottom: 1px solid var(--border);
        padding: 14px 16px;
    }
    #layout { flex-direction: column; }
    #content, footer { margin-left: 0; padding: 22px 18px 80px 18px; }
    html { scroll-padding-top: 12px; }
}
