/* ── {M}aker Wiki — Matching mmaker.es landing design ───────────────── */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,400&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --w-bg: #ffffff;
    --w-bg-alt: #f8f9fb;
    --w-bg-code: #0f172a;
    --w-bg-code-header: #1e293b;
    --w-sidebar-bg: #f8f9fb;
    --w-sidebar-border: #e2e5ea;
    --w-sidebar-text: #4b5563;
    --w-sidebar-hover: #eef0f3;
    --w-sidebar-active: rgba(163,134,48,.07);
    --w-gold: #a38630;
    --w-gold-dim: rgba(163,134,48,.07);
    --w-gold-border: rgba(163,134,48,.20);
    --w-text: #111827;
    --w-text-secondary: #4b5563;
    --w-text-muted: #9ca3af;
    --w-border: #e2e5ea;
    --w-border-soft: #eef0f3;
    --w-radius: 8px;
    --w-sidebar-w: 280px;
    --w-topbar-h: 56px;
    --w-font-sans: 'Inter', system-ui, sans-serif;
    --w-font-mono: 'DM Mono', monospace;
}

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

body {
    font-family: var(--w-font-sans);
    background: var(--w-bg);
    color: var(--w-text);
    line-height: 1.7;
    font-size: 15px;
}

/* ── Layout ──────────────────────────────────────────────────────────── */

.wiki-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar — light grey to match mmaker.es ─────────────────────────── */

.wiki-sidebar {
    width: var(--w-sidebar-w);
    flex-shrink: 0;
    background: var(--w-sidebar-bg);
    border-right: 1px solid var(--w-sidebar-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.25s ease;
}

.wiki-sidebar-header {
    padding: 16px 20px;
    display: flex;
    align-items: baseline;
    gap: 8px;
    border-bottom: 1px solid var(--w-border-soft);
}

/* Logo — matches mmaker.es nav-name style */
.wiki-logo {
    font-family: var(--w-font-mono);
    font-size: 16px;
    font-weight: 500;
    color: var(--w-text);
    text-decoration: none;
    letter-spacing: 0.5px;
}
.wiki-logo-bracket {
    color: var(--w-gold);
}
.wiki-version {
    font-family: var(--w-font-mono);
    font-size: 10px;
    color: var(--w-text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 2px 8px;
    background: var(--w-gold-dim);
    border: 1px solid var(--w-gold-border);
    border-radius: 12px;
}

/* Search */
.wiki-search-wrap {
    padding: 10px 14px;
}
.wiki-search {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    font-family: var(--w-font-sans);
    border: 1px solid var(--w-border);
    border-radius: var(--w-radius);
    background: var(--w-bg);
    color: var(--w-text);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.wiki-search:focus {
    border-color: var(--w-gold);
    box-shadow: 0 0 0 2px var(--w-gold-dim);
}
.wiki-search::placeholder {
    color: var(--w-text-muted);
}

/* Navigation */
.wiki-nav {
    flex: 1;
    padding: 4px 0 20px;
    overflow-y: auto;
}
.wiki-nav-group {
    margin-bottom: 2px;
}
.wiki-nav-cat {
    font-family: var(--w-font-mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--w-text-muted);
    padding: 14px 20px 4px;
}
.wiki-nav-link {
    display: block;
    padding: 6px 20px 6px 24px;
    font-size: 13px;
    color: var(--w-sidebar-text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    border-left: 2px solid transparent;
    border-radius: 0 4px 4px 0;
}
.wiki-nav-link:hover {
    background: var(--w-sidebar-hover);
    color: var(--w-text);
}
.wiki-nav-link.active {
    background: var(--w-sidebar-active);
    color: var(--w-gold);
    border-left-color: var(--w-gold);
    font-weight: 500;
}
.wiki-nav-link.search-hidden { display: none; }
.wiki-nav-group.search-hidden { display: none; }

/* ── Main ────────────────────────────────────────────────────────────── */

.wiki-main {
    flex: 1;
    margin-left: var(--w-sidebar-w);
    min-width: 0;
}

/* ── Topbar — glass effect like mmaker.es nav ────────────────────────── */

.wiki-topbar {
    height: var(--w-topbar-h);
    border-bottom: 1px solid var(--w-border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 12px;
    position: sticky;
    top: 0;
    background: rgba(255,255,255,.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 50;
}
.wiki-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: var(--w-text-secondary);
    cursor: pointer;
    padding: 4px;
}
.wiki-breadcrumb {
    flex: 1;
    font-family: var(--w-font-mono);
    font-size: 12px;
    color: var(--w-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.3px;
}
.wiki-lang-toggle {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}
.wiki-lang-btn {
    font-family: var(--w-font-mono);
    font-size: 11px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--w-radius);
    text-decoration: none;
    color: var(--w-text-muted);
    transition: all 0.2s;
    border: 1px solid transparent;
}
.wiki-lang-btn:hover {
    color: var(--w-text);
    border-color: var(--w-border);
}
.wiki-lang-btn.active {
    color: var(--w-gold);
    background: var(--w-gold-dim);
    border-color: var(--w-gold-border);
}

/* ── Content ─────────────────────────────────────────────────────────── */

.wiki-content {
    max-width: 820px;
    margin: 0 auto;
    padding: 36px 44px 80px;
}

.wiki-section {
    display: none;
    animation: wiki-fade 0.25s ease;
}
.wiki-section.active { display: block; }

@keyframes wiki-fade {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Typography ──────────────────────────────────────────────────────── */

.wiki-section h1 {
    font-family: var(--w-font-sans);
    font-size: 30px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--w-text);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.wiki-section h2 {
    font-family: var(--w-font-sans);
    font-size: 20px;
    font-weight: 600;
    margin: 40px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--w-border);
    color: var(--w-text);
    letter-spacing: -0.01em;
}
.wiki-section h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 28px 0 8px;
    color: var(--w-text);
}
.wiki-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin: 20px 0 6px;
    color: var(--w-text-secondary);
}
.wiki-section > p.subtitle {
    font-size: 16px;
    color: var(--w-text-secondary);
    margin-bottom: 28px;
    line-height: 1.7;
}
.wiki-section p {
    margin-bottom: 14px;
}
.wiki-section ul, .wiki-section ol {
    margin: 0 0 16px 20px;
}
.wiki-section li {
    margin-bottom: 5px;
}
.wiki-section li > ul, .wiki-section li > ol {
    margin-top: 4px;
    margin-bottom: 4px;
}

/* ── Code — dark theme matching mmaker.es code blocks ────────────────── */

.wiki-section code {
    font-family: var(--w-font-mono);
    font-size: 13px;
    background: var(--w-gold-dim);
    padding: 2px 7px;
    border-radius: 4px;
    color: var(--w-gold);
    border: 1px solid var(--w-gold-border);
}
.wiki-section pre {
    background: var(--w-bg-code);
    border: 1px solid #1e293b;
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    margin-bottom: 18px;
    box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.wiki-section pre code {
    display: block;
    background: none;
    border: none;
    padding: 18px 20px;
    color: #e2e8f0;
    font-size: 13px;
    line-height: 1.55;
    overflow-x: auto;
}

/* ── Tables ──────────────────────────────────────────────────────────── */

.wiki-section table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    font-size: 14px;
    border: 1px solid var(--w-border);
    border-radius: var(--w-radius);
    overflow: hidden;
}
.wiki-section th,
.wiki-section td {
    text-align: left;
    padding: 10px 14px;
    border-bottom: 1px solid var(--w-border-soft);
}
.wiki-section th {
    background: var(--w-bg-alt);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--w-text-secondary);
    border-bottom: 1px solid var(--w-border);
}
.wiki-section tr:last-child td { border-bottom: none; }
.wiki-section tr:hover td {
    background: var(--w-bg-alt);
}

/* ── Callouts — gold-tinted info to match brand ──────────────────────── */

.wiki-tip,
.wiki-warn,
.wiki-info {
    padding: 14px 18px;
    border-radius: var(--w-radius);
    margin-bottom: 18px;
    font-size: 14px;
    border-left: 3px solid;
    line-height: 1.6;
}
.wiki-tip {
    background: #ecfdf5;
    border-color: #10b981;
    color: #065f46;
}
.wiki-warn {
    background: #fffbeb;
    border-color: #f59e0b;
    color: #92400e;
}
.wiki-info {
    background: var(--w-gold-dim);
    border-color: var(--w-gold);
    color: #78620e;
}

/* ── Definition list ─────────────────────────────────────────────────── */

.wiki-dl {
    margin-bottom: 18px;
}
.wiki-dl dt {
    font-weight: 600;
    font-size: 14px;
    margin-top: 14px;
    color: var(--w-text);
}
.wiki-dl dt code {
    font-weight: 500;
}
.wiki-dl dd {
    margin-left: 18px;
    margin-top: 3px;
    color: var(--w-text-secondary);
    font-size: 14px;
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 900px) {
    .wiki-sidebar {
        transform: translateX(-100%);
        background: var(--w-bg);
        box-shadow: none;
    }
    .wiki-sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 24px rgba(0,0,0,.12);
    }
    .wiki-main {
        margin-left: 0;
    }
    .wiki-menu-btn { display: block; }
    .wiki-content {
        padding: 24px 16px 60px;
    }
}

/* ── Overlay for mobile sidebar ──────────────────────────────────────── */

.wiki-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.25);
    z-index: 99;
}
.wiki-overlay.visible { display: block; }

/* ── Search highlight ────────────────────────────────────────────────── */

.search-hl {
    background: var(--w-gold-dim);
    border: 1px solid var(--w-gold-border);
    border-radius: 2px;
    padding: 0 2px;
}
