:root {
    --brand-gold: #ffc400;
    --brand-gold-low: rgba(255, 196, 0, 0.1);
    --bg-dark: #121212;
    --bg-side: #121212;
    --border: rgba(255, 255, 255, 0.06);
    --muted: #8a8d98; /* Un poco más oscuro para mejor contraste */
    --display: "Inter", sans-serif;
    --body: "Inter", sans-serif;
    --sidebar-w: 280px;
    --sidebar-c: 80px;
    --toc-w: 250px;
    --anim: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Scrollbar más elegante */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand-gold); }

* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; /* ELIMINA EL RECUADRO AZUL EN MÓVILES */
}

body {
    margin: 0;
    background: var(--bg-dark);
    color: #E0E0E0;
    font-family: var(--body);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}
::selection {
  background-color: #FFC400;
  color: #000000; /* Color del texto seleccionado (opcional) */
}

/* Para Firefox */
::-moz-selection {
  background-color: #FFC400;
  color: #000000;
}
.wiki-container {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr var(--toc-w);
    height: 100vh;
    transition: var(--anim);
}

.sidebar-checkbox { display: none; }

/* Lógica de colapso del Sidebar */
.sidebar-checkbox:checked ~ .sidebar { width: var(--sidebar-c); }
.sidebar-checkbox:checked ~ .sidebar .logo-area span,
.sidebar-checkbox:checked ~ .sidebar .nav-category span,
.sidebar-checkbox:checked ~ .sidebar .nav-item span,
.sidebar-checkbox:checked ~ .sidebar .arrow {
    display: none;
}
.sidebar-checkbox:checked ~ .sidebar .toggle-btn { transform: rotate(180deg); }
.sidebar-checkbox:checked ~ .wiki-container,
.sidebar-checkbox:checked ~ .sidebar ~ .main-content {
    grid-template-columns: var(--sidebar-c) 1fr var(--toc-w);
}

/* Redefinición de Grid cuando está checkeado */
.wiki-container:has(.sidebar-checkbox:checked) {
    grid-template-columns: var(--sidebar-c) 1fr var(--toc-w);
}

.sidebar {
    background: var(--bg-side);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--anim);
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    border-bottom: 1px solid var(--border);
}
.logo-svg {
    width: 32px;
    height: 32px;
    object-fit: contain;
    transition: transform 0.3s ease;
    filter: brightness(0) invert(1);
}
.logo-area {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 14px;
}
.logo-area:hover .logo-svg {
    transform: scale(1.1) rotate(-5deg);
}

.gold-icon { color: var(--brand-gold); flex-shrink: 0; }
.toggle-btn { cursor: pointer; color: var(--muted); transition: var(--anim); flex-shrink: 0; }

.sidebar-header {
    padding: 0 24px;
    height: 80px;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav { overflow-y: auto; flex: 1; }
.nav-category {
    padding: 20px 24px 10px;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.8;
    color: var(--muted);
}

.arrow { width: 14px; transition: var(--anim); }
.nav-group.open .arrow { transform: rotate(-180deg); }
.nav-items-wrapper { display: grid; grid-template-rows: 0fr; transition: var(--anim); }
.nav-group.open .nav-items-wrapper { grid-template-rows: 1fr; }
.nav-items-content { overflow: hidden; }

.nav-item {
    display: flex;
    margin: 4px 12px;
    align-items: center;
    padding: 10px 16px;
    border-radius: 8px;
    color: var(--muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--anim);
    
}

.nav-item.active {
    background: var(--brand-gold-low);
    color: var(--brand-gold);
}

.toc-sidebar {
    border-left: 1px solid var(--border);
    background: var(--bg-dark);
    padding: 40px 20px;
    overflow-y: auto;
}

.toc-container { position: sticky; top: 0; }
.toc-title {
    font-family: var(--display);
    color: var(--brand-gold);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.toc-links { display: flex; flex-direction: column; gap: 12px; }
.toc-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.85rem;
    line-height: 1.4;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    padding-left: 12px;
}
.toc-link:hover { color: #fff; }
.toc-link.active {
    color: var(--brand-gold);
    border-left-color: var(--brand-gold);
    font-weight: 600;
}

.main-content { overflow-y: auto; scroll-behavior: smooth; }
.content-wrapper { padding: 60px 40px; max-width: 850px; margin: 0 auto; width: 100%; }

.markdown-body h2 {
    border-left: 3px solid var(--brand-gold);
    background: linear-gradient(90deg, var(--brand-gold-low) 0%, transparent 100%);
    padding: 0.5rem 1rem;
    border-radius: 0 8px 8px 0;
}

.highlight-glow { animation: glow-pulse 1.5s ease-out; }

@keyframes glow-pulse {
    0% { text-shadow: 0 0 0px transparent; transform: translateX(0); }
    30% { text-shadow: 0 0 20px var(--brand-gold); transform: translateX(10px); }
    100% { text-shadow: 0 0 0px transparent; transform: translateX(0); }
}

.markdown-body h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(to bottom, #fff, #a7aab3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border-bottom: 1px solid var(--border);
}

.markdown-body p { color: #ced4da; line-height: 1.8; }
.markdown-body code {
    background: rgba(255, 196, 0, 0.1); color: var(--brand-gold);
    padding: 0.2rem 0.4rem; border-radius: 4px;
}

/* RESPONSIVE */
@media (max-width: 1100px) {
    .wiki-container { grid-template-columns: var(--sidebar-w) 1fr; }
    .toc-sidebar { display: none; }
}

@media (max-width: 768px) {
    .wiki-container { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        width: var(--sidebar-w) !important;
        z-index: 1000;
    }
    .sidebar-checkbox:checked ~ .sidebar { left: 0; }
    .sidebar-checkbox:checked ~ .sidebar .logo-area span,
    .sidebar-checkbox:checked ~ .sidebar .nav-category span,
    .sidebar-checkbox:checked ~ .sidebar .nav-item span,
    .sidebar-checkbox:checked ~ .sidebar .arrow {
        display: flex;
    }
    .toggle-btn, .nav-item, .logo-area, .nav-category {
    outline: none !important;
    user-select: none;
}
    .toggle-btn {
        position: fixed;
        bottom: 20px;
        right: 20px;
        background: var(--brand-gold);
        color: var(--bg-dark);
        width: 50px;
        height: 50px;
        border-radius: 50%;
        border: 2px solid rgba(255,255,255,0.1);
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 8px 32px rgba(255, 196, 0, 0.3);
        z-index: 1001;
    }
    .sidebar-checkbox:checked ~ .toggle-btn { transform: rotate(180deg); }
    .content-wrapper { padding: 40px 20px; }

    a {
        color: #ffc400;
    }
}