/* KrunkScript Documentation Styles */
/* Dark theme with gold & lavender accents */

:root {
    --bg: #111118;
    --bg-sidebar: #0c0c12;
    --bg-sidebar-hover: #1a1a24;
    --bg-sidebar-active: rgba(167, 139, 250, 0.1);
    --bg-card: #18181f;
    --bg-raised: #1e1e28;
    --bg-code: #0d0d14;
    --bg-code-inline: rgba(139, 126, 200, 0.12);
    --bg-table-header: #161620;
    --bg-table-hover: rgba(255, 215, 0, 0.03);
    --text: #e8e6f0;
    --text-secondary: #d8d4c5;
    --text-muted: #6e6a82;
    --text-sidebar: #7e7a96;
    --text-sidebar-hover: #c8c4de;
    --text-code: #d4d0ec;
    --gold: #ffd700;
    --gold-dim: #e6c200;
    --gold-subtle: rgba(255, 215, 0, 0.08);
    --gold-glow: rgba(255, 215, 0, 0.15);
    --lavender: #8b7ec8;
    --lavender-bright: #a99de0;
    --lavender-subtle: rgba(139, 126, 200, 0.08);
    --border: #252530;
    --border-light: #1e1e28;
    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
    --radius: 8px;
    --radius-sm: 5px;
    --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', Consolas, 'Liberation Mono', Menlo, monospace;
    --transition: 0.15s ease;
}

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

body {
    font-family: var(--font-sans);
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    display: flex;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ─── Navigation Sidebar ─── */
nav {
    width: 260px;
    background: var(--bg-sidebar);
    padding: 24px 14px;
    border-right: 1px solid var(--border);
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 1000;
}

nav::-webkit-scrollbar {
    width: 3px;
}

nav::-webkit-scrollbar-track {
    background: transparent;
}

nav::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

nav h1 {
    font-size: 0.9em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 20px;
    padding: 8px 14px;
    color: var(--gold);
}

nav ul {
    list-style: none;
}

nav li {
    margin: 1px 0;
}

nav a {
    color: var(--text-sidebar);
    text-decoration: none;
    display: block;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-size: 0.85em;
    font-weight: 450;
    border-left: 2px solid transparent;
}

nav a:hover {
    background: var(--bg-sidebar-hover);
    color: var(--text-sidebar-hover);
    border-left-color: var(--border);
}

nav a.active {
    background: var(--bg-sidebar-active);
    color: var(--lavender-bright);
    border-left-color: var(--lavender-bright);
    font-weight: 600;
}

/* ─── Search Box ─── */
.search-box {
    margin-bottom: 18px;
    padding: 0 4px;
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: var(--font-sans);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    transition: all var(--transition);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box input:focus {
    outline: none;
    border-color: var(--gold-dim);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 0 0 3px var(--gold-subtle);
}

#search-results {
    position: absolute;
    left: 4px;
    right: 4px;
    margin-top: 6px;
    max-height: 380px;
    overflow-y: auto;
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    z-index: 100;
}

.search-result {
    display: block;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background var(--transition);
}

.search-result:hover {
    background: var(--gold-subtle);
}

.search-result:last-child {
    border-bottom: none;
}

.search-result .type {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: var(--lavender);
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 6px;
    text-transform: uppercase;
    vertical-align: middle;
}

.search-result .name {
    font-weight: 600;
    color: var(--text);
    font-size: 0.92em;
}

.search-result .desc {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.4;
}

/* ─── Main Content ─── */
main {
    margin-left: 260px;
    padding: 48px 60px;
    max-width: 940px;
    flex: 1;
    min-width: 0;
}

/* ─── Typography ─── */
h1, h2, h3, h4 {
    color: var(--text);
    font-weight: 650;
}

h1 {
    font-size: 1.85em;
    margin: 0 0 0.7em;
    padding-bottom: 14px;
    border-bottom: 2px solid var(--gold);
}

h1:first-child {
    margin-top: 0;
}

h2 {
    font-size: 1.3em;
    margin: 2.4em 0 0.6em;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

h3 {
    font-size: 1.1em;
    margin: 1.8em 0 0.5em;
    color: var(--gold-dim);
}

h4 {
    font-size: 0.95em;
    margin: 1.5em 0 0.4em;
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

p {
    margin: 0.7em 0;
    color: var(--text-secondary);
}

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

/* ─── Code ─── */
pre {
    background: var(--bg-code);
    color: var(--text-code);
    padding: 18px 22px;
    border-radius: var(--radius);
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    margin: 1em 0;
    border: 1px solid var(--border);
}

code {
    font-family: var(--font-mono);
    background: var(--bg-code-inline);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    color: var(--lavender-bright);
    font-weight: 500;
}

pre code {
    background: none;
    padding: 0;
    color: var(--text-code);
    font-weight: 400;
    font-size: 1em;
}

/* ─── Tables ─── */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1em 0;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
}

th, td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.88em;
}

th {
    background: var(--bg-table-header);
    font-weight: 650;
    color: var(--gold-dim);
    font-size: 0.78em;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

td {
    color: var(--text-secondary);
}

tr:last-child td {
    border-bottom: none;
}

tr:hover td {
    background: var(--bg-table-hover);
}

/* ─── Links ─── */
main a {
    color: var(--gold-dim);
    font-weight: 500;
    transition: color var(--transition);
}

main a:hover {
    color: var(--gold);
    text-decoration-thickness: 2px;
}

/* ─── Horizontal Rules ─── */
hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 2.5em 0;
}

/* ─── Lists ─── */
ul, ol {
    margin: 0.7em 0;
    padding-left: 1.6em;
}

li {
    margin: 0.35em 0;
    color: var(--text-secondary);
}

li::marker {
    color: var(--gold-dim);
}

/* ─── Blockquotes ─── */
blockquote {
    border-left: 3px solid var(--gold);
    margin: 1em 0;
    padding: 10px 18px;
    background: var(--gold-subtle);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-secondary);
}

blockquote p {
    margin: 0.3em 0;
}

/* ─── Menu Toggle (mobile) ─── */
.menu-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1001;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 20px;
    line-height: 1;
    padding: 8px 11px;
    cursor: pointer;
    color: var(--gold);
    box-shadow: var(--shadow-md);
    transition: all var(--transition);
}

.menu-toggle:hover {
    background: var(--bg-raised);
}

/* ─── Nav Overlay (mobile) ─── */
.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .menu-toggle {
        display: block;
    }

    nav {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    body.nav-open nav {
        transform: translateX(0);
    }

    body.nav-open .nav-overlay {
        display: block;
        opacity: 1;
    }

    main {
        margin-left: 0;
        padding: 20px 18px;
        padding-top: 60px;
    }

    h1 { font-size: 1.5em; }
    h2 { font-size: 1.2em; }

    pre {
        padding: 14px 16px;
        font-size: 12px;
        border-radius: var(--radius-sm);
    }

    table { font-size: 0.85em; }
    th, td { padding: 8px 10px; }
}

/* ─── Copy Button ─── */
.code-block-wrapper {
    position: relative;
}

.copy-button {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 3px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-family: var(--font-sans);
    opacity: 0;
    transition: all var(--transition);
}

.code-block-wrapper:hover .copy-button {
    opacity: 1;
}

.copy-button:hover {
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.6);
}

/* ─── Selection ─── */
::selection {
    background: var(--gold);
    color: var(--bg);
}
