/* ==========================================================================
   1. VARIABLES GLOBALES (LIGHT MODE - DEFAULT)
========================================================================== */
:root {
    line-height: 1.5;
    --md-text-font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --md-code-font-family: "Roboto Mono", monospace;
    --md-typeset-font-size: 0.5rem !important;
    --md-typeset-h1-font-size: 2.2rem;
    --text-normal: #4e4e4e !important;
    --md-typeset-color: var(--text-normal) !important;

    /* Header ajustado a 50px */
    --md-header-height: 50px;

    /* --- COLORES --- */
    --sanctus-accent: #8E00FF;
    --header-bg: #e0e0e0;
    --header-text: #333333;
    --main-bg: #ffffff;

    /* Sidebar */
    --sidebar-bg-faux: #f6f6f6;
    --sidebar-border: #c7c7c7;
    --nav-text-color: #434343;
    --scrollwrap-text: #666666;

    /* UI Elements */
    --heading-h1: #444444;
    --heading-h2-h3: #333333;
    --kbd-bg: #f3f4f6;
    --kbd-border: #d1d5db;
    --kbd-text: #1f2937;
    --img-border: rgba(0, 0, 0, 0.05);
    --shadow-transparent: rgba(0, 0, 0, 0.0);

    /* Legacy */
    --legacy-grid-bg: #bc2828;
    --legacy-nav-bg: #9f4c4c;
}

/* ==========================================================================
   1.5. VARIABLES MODO OSCURO
========================================================================== */
[data-md-color-scheme="slate"] {
    --sanctus-accent: #a855f7;
    --header-bg: #2e303e;
    --header-text: #f5f5f5;
    --text-normal: #f5f5f5 !important;
    --main-bg: #1e1e24;
    --sidebar-bg-faux: #222230;
    --sidebar-border: #545454;
    --nav-text-color: #d4d4d4;
    --scrollwrap-text: #a0a0a0;
    --heading-h1: #d0d0d0;
    --heading-h2-h3: #dddddd;
    --kbd-bg: #374151;
    --kbd-border: #4b5563;
    --kbd-text: #f3f4f6;
    --img-border: rgba(255, 255, 255, 0.1);
}

:root {
    --md-primary-fg-color: var(--sanctus-accent) !important;
    --md-accent-fg-color: var(--sanctus-accent) !important;
    --md-typeset-color: var(--text-normal) !important;
}

body,
.md-typeset {
    /* Usamos un Gris Oscuro (#2e2e2e) para que se lea sobre blanco. 
       El #ededed que tenías era muy claro. */
    color: #545454 !important;
}

/* MODO OSCURO (Texto Claro) */
[data-md-color-scheme="slate"] body,
[data-md-color-scheme="slate"] .md-typeset {
    /* Aquí sí usamos el Gris Claro (#dcdcdc) */
    color: #bdbdbd !important;
}

/* ==========================================================================
   2. GLOBAL FIXES (SCROLLBAR & LAYOUT)
   Aquí arreglamos el scroll y el "Back to Top"
========================================================================== */

html {
    /* Auto: La barra SOLO aparece si el contenido es más largo que la pantalla */
    overflow-y: auto !important;

    /* OPCIONAL: 'stable' evita el salto visual reservando el espacio.
       Si prefieres que la barra DESAPAREZCA TOTALMENTE (aunque el sitio salte),
       BORRA la línea de abajo 'scrollbar-gutter'. */
    scrollbar-gutter: stable;

    width: 100vw;
}

body {
    background-color: var(--main-bg) !important;
    min-height: 100vh;
    margin: 0 !important;
}

/* OCULTAR BOTÓN "BACK TO TOP" (Si te molesta, descomenta esto) */
.md-top {
    display: none !important;
}

/* ==========================================================================
   3. HEADER & LOGO
========================================================================== */
header.md-header {
    background-color: var(--header-bg) !important;
    color: var(--header-text) !important;
    text-shadow: none !important;
    box-shadow: none !important;
    height: var(--md-header-height) !important;

    /* Forzamos ancho total para cubrir el hueco del scrollbar */
    width: 100vw !important;
    left: 0 !important;
    z-index: 9999 !important;
}

.md-header {
    padding: 0rem !important;
}

.md-header__title {
    color: var(--header-text) !important;
}

.md-header__button {
    padding: 0rem !important;
}

.md-header__button.md-logo {
    margin: 0 !important;
}

/* Logo Sizing */
.md-header__button img {
    height: 1.5rem !important;
    object-fit: contain;
    cursor: pointer !important;
}

/* LOGO DARK MODE */
[data-md-color-scheme="slate"] .md-header__button.md-logo img {
    content: url('https://sanctusnodes.com/images/logo_white.svg');
}

.md-header__topic:first-child {
    display: none !important;
}

.md-search__form {
    margin: 0 !important;
    height: 1.0rem !important;
}

.md-search__input {
    font-size: .6rem !important;
    height: 1.0rem !important;
}

.md-search__icon {
    display: none !important;
}

/* ==========================================================================
   4. SIDEBAR & LAYOUT (Columna Infinita)
========================================================================== */

.md-main {
    background-color: var(--main-bg) !important;
}

.md-main__inner,
.md-sidebar--primary,
.md-sidebar--secondary {
    margin-top: 0 !important;
    padding-top: 0rem !important;
}

.md-sidebar--secondary {
    padding-top: 0.5rem !important;
}

.md-sidebar__scrollwrap {
    margin-top: 0rem !important;
    padding-top: 1rem !important;
    color: var(--scrollwrap-text);
}

/* --- TÉCNICA DE COLUMNA FALSA --- */
@media screen and (min-width: 76.25em) {
    .md-main__inner {
        position: relative;
        min-height: calc(100vh - var(--md-header-height));
    }

    .md-main__inner::before {
        content: "";
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        width: 220px !important;
        background-color: var(--sidebar-bg-faux);
        border-right: thin solid var(--sidebar-border);
        z-index: 0;
        height: 100%;
    }

    .md-sidebar__scrollwrap {
        width: 220px !important;
        top: var(--md-header-height) !important;
        height: calc(100vh - var(--md-header-height)) !important;
        margin: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
    }

    .md_sidebar__inner {
        width: 220px !important;
    }

    .md-sidebar--primary {
        background-color: transparent !important;
        margin-left: 0 !important;
        z-index: 1;
    }
}

/* ==========================================================================
   5. NAVEGACIÓN
========================================================================== */

/* --- Root topics/folders with children --- */
.md-nav--primary>.md-nav__list>.md-nav__item--nested>.md-nav__link {
    font-weight: 600 !important;
    text-transform: uppercase !important;
    color: var(--nav-text-color) !important;
    letter-spacing: 0.5px;
    padding-bottom: 0.2rem !important;
    padding-top: 0.2rem !important;
    transition: color 0.15s ease;
}

.md-nav--primary>.md-nav__list>.md-nav__item--nested>.md-nav__link:hover {
    opacity: 1;
}

.md-nav--primary>.md-nav__list>.md-nav__item--active.md-nav__item--nested>.md-nav__link {
    color: var(--sanctus-accent) !important;
}

/* --- ESTILO PARA EL LINK ACTIVO (Resaltado con Bold) --- */
.md-nav__link--active {
    font-weight: 800 !important;
    color: var(--sanctus-accent) !important;
    opacity: 1 !important;
}

.md-nav__link {
    transition: all 0.2s ease !important;
}

.md-nav__link:hover {
    color: var(--sanctus-accent) !important;
    /* Un tinte muy leve de tu color púrpura */
    padding-left: 0px !important;
    /* Un pequeño desplazamiento lateral sutil */
}

.md-nav--primary .md-nav__title[for="__drawer"] {
    display: none;
}

.md-nav__item {
    font-size: 0.7rem;
}

md-grid {
    background-color: var(--legacy-grid-bg);
}

.md-nav--container {
    background-color: var(--legacy-nav-bg);
}

/* Animación */
.md-nav--primary .md-nav__item .md-nav {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 10;
    transition: grid-template-rows 0.6s cubic-bezier(0.4, 0.2, 0.2, 1), opacity .3s ease-out !important;
    max-height: unset !important;
    height: auto !important;
    visibility: visible !important;
}

.md-nav--primary .md-nav__item .md-nav>.md-nav__list {
    overflow: hidden;
    min-height: 0;
}

.md-nav--primary .md-nav__toggle:checked~.md-nav {
    grid-template-rows: 1fr;
    opacity: 1;
}

.md-nav--primary .md-nav__icon {
    transition: transform 0.8s ease-out !important;
}

/* ==========================================================================
   6. CONTENIDO & TIPOGRAFÍA
========================================================================== */
h1 {
    font-weight: 700 !important;
    color: var(--heading-h1) !important;
    margin: 0 0 0.5em !important;
}

h2,
h3 {
    font-weight: 400 !important;
    color: var(--heading-h2-h3) !important;
    margin: 0.8em 0 0.5em !important;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3,
.md-typeset h4,
.md-typeset h5,
.md-typeset h6 {
    pointer-events: none;
}

/* --- MEJORA DE VISIBILIDAD DE ENLACES EN TEXTO --- */
.md-typeset a {
    font-weight: 500 !important;
    /* Hace que el enlace sea bold */
    color: var(--sanctus-accent) !important;
    transition: color 0.2s ease, opacity 0.2s ease;
}

/* Efecto al pasar el ratón para dar feedback visual */
.md-typeset a:hover {
    opacity: 0.8;
    font-weight: 500 !important;
    text-decoration: underline;
    text-underline-offset: 2px !important;
    /* Opcional: añade subrayado al hacer hover */
}

/* Fix for .md-button hover (prevents purple-on-purple) */
.md-typeset .md-button:hover,
.md-typeset .md-button:active,
.md-typeset .md-button:focus {
    color: #ffffff !important;
    text-decoration: none !important;
}

.md-typeset .headerlink {
    display: none;
    visibility: hidden;
}

.md-typeset ul li {
    margin-bottom: 0px !important;
}

img {
    display: inline-block;
    margin: 10px 0;
    cursor: zoom-in;
}

.md-typeset img {
    border-radius: 3px;
    box-shadow: 0 0px 0px var(--shadow-transparent);
    border: 1px solid var(--img-border);
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    padding-top: 0;
    overflow: hidden;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 5px;
    border: 0;
}

kbd {
    border: 1px solid var(--kbd-border);
    border-radius: 4px;
    background-color: var(--kbd-bg);
    color: var(--kbd-text);
    font-size: 0.85em;
    padding: 0.1em 0.4em;
    box-shadow: 0 1px 0 var(--kbd-border);
}

.md-grid {
    max-width: 1200px;
}

/* ==========================================================================
   7. FOOTER
========================================================================== */
.md-footer__inner {
    padding: 0rem !important;
}

.md-footer-meta {
    display: none;
}

.md-footer__title {
    font-weight: 600;
}

/* ==========================================================================
   8. FIX DEFINITIVO: SIDEBAR SCROLLWRAPS
   Forzamos a los culpables a medir exactamente el hueco disponible.
========================================================================== */

.md-sidebar__scrollwrap {
    /* 1. Les decimos: "Tu techo es el Header" */
    top: var(--md-header-height) !important;

    /* 2. Les decimos: "Tu altura es pantalla - header" (Ni un pixel más) */
    height: calc(100vh - var(--md-header-height)) !important;

    /* 3. Aseguramos que no tengan márgenes extraños */
    margin: 0 !important;
    padding-top: 0 !important;
    /* El padding interno lo manejamos abajo si hace falta */
    padding-bottom: 0 !important;

    /* 4. Evitamos que generen scroll en el body si se pasan */
    overflow-y: auto !important;
    overflow-x: hidden !important;

    /* Opcional: Si el contenido interno necesita aire arriba, úsalo aquí */
    /* padding-top: 1rem !important; */
}

/* Ajuste fino para el sidebar izquierdo (Menú) si usas el padding visual */
.md-sidebar--primary .md-sidebar__scrollwrap {
    padding-top: 20px !important;
}

/* ==========================================================================
   9. ADMONITIONS CUSTOM COLORS (Neutral/Informational types)
========================================================================== */

/* Change the border color to your accent */
.md-typeset .admonition.question,
.md-typeset details.question,
.md-typeset .admonition.faq,
.md-typeset details.faq,
.md-typeset .admonition.note,
.md-typeset details.note,
.md-typeset .admonition.tip,
.md-typeset details.tip,
.md-typeset .admonition.info,
.md-typeset details.info,
.md-typeset .admonition.abstract,
.md-typeset details.abstract,
.md-typeset .admonition.example,
.md-typeset details.example,
.md-typeset .admonition.quote,
.md-typeset details.quote {
    border-color: var(--sanctus-accent) !important;
}

/* Change the background of the title/summary area */
.md-typeset .question>summary,
.md-typeset .question>.admonition-title,
.md-typeset .faq>summary,
.md-typeset .faq>.admonition-title,
.md-typeset .note>summary,
.md-typeset .note>.admonition-title,
.md-typeset .tip>summary,
.md-typeset .tip>.admonition-title,
.md-typeset .info>summary,
.md-typeset .info>.admonition-title,
.md-typeset .abstract>summary,
.md-typeset .abstract>.admonition-title,
.md-typeset .example>summary,
.md-typeset .example>.admonition-title,
.md-typeset .quote>summary,
.md-typeset .quote>.admonition-title {
    /* Uses a very light, transparent version of your purple */
    background-color: rgba(142, 0, 255, 0.08) !important;
}

/* Change the color of the left icon */
.md-typeset .question>summary::before,
.md-typeset .question>.admonition-title::before,
.md-typeset .faq>summary::before,
.md-typeset .faq>.admonition-title::before,
.md-typeset .note>summary::before,
.md-typeset .note>.admonition-title::before,
.md-typeset .tip>summary::before,
.md-typeset .tip>.admonition-title::before,
.md-typeset .info>summary::before,
.md-typeset .info>.admonition-title::before,
.md-typeset .abstract>summary::before,
.md-typeset .abstract>.admonition-title::before,
.md-typeset .example>summary::before,
.md-typeset .example>.admonition-title::before,
.md-typeset .quote>summary::before,
.md-typeset .quote>.admonition-title::before {
    background-color: var(--sanctus-accent) !important;
}

/* For Dark Mode (Slate) - Keeps the background subtle so it's readable */
[data-md-color-scheme="slate"] .md-typeset .question>summary,
[data-md-color-scheme="slate"] .md-typeset .question>.admonition-title,
[data-md-color-scheme="slate"] .md-typeset .faq>summary,
[data-md-color-scheme="slate"] .md-typeset .faq>.admonition-title,
[data-md-color-scheme="slate"] .md-typeset .note>summary,
[data-md-color-scheme="slate"] .md-typeset .note>.admonition-title,
[data-md-color-scheme="slate"] .md-typeset .tip>summary,
[data-md-color-scheme="slate"] .md-typeset .tip>.admonition-title,
[data-md-color-scheme="slate"] .md-typeset .info>summary,
[data-md-color-scheme="slate"] .md-typeset .info>.admonition-title,
[data-md-color-scheme="slate"] .md-typeset .abstract>summary,
[data-md-color-scheme="slate"] .md-typeset .abstract>.admonition-title,
[data-md-color-scheme="slate"] .md-typeset .example>summary,
[data-md-color-scheme="slate"] .md-typeset .example>.admonition-title,
[data-md-color-scheme="slate"] .md-typeset .quote>summary,
[data-md-color-scheme="slate"] .md-typeset .quote>.admonition-title {
    background-color: rgba(168, 85, 247, 0.15) !important;
    /* Uses your dark mode accent */
}

/* Change the color of the dropdown arrow for collapsible blocks */
.md-typeset .question>summary::after,
.md-typeset .faq>summary::after,
.md-typeset .note>summary::after,
.md-typeset .tip>summary::after,
.md-typeset .info>summary::after,
.md-typeset .abstract>summary::after,
.md-typeset .example>summary::after,
.md-typeset .quote>summary::after {
    background-color: var(--sanctus-accent) !important;
}

/* ==========================================================================
   10. IMPORTANT ADMONITIONS (Yellow Attention)
========================================================================== */

/* Change the border color to yellow */
.md-typeset .admonition.important,
.md-typeset details.important {
    border-color: #ffb300 !important;
}

/* Change the background of the title/summary area */
.md-typeset .important>summary,
.md-typeset .important>.admonition-title {
    background-color: rgba(255, 179, 0, 0.1) !important;
}

/* Change the color of the left icon */
.md-typeset .important>summary::before,
.md-typeset .important>.admonition-title::before {
    background-color: #ffb300 !important;
}

/* For Dark Mode (Slate) */
[data-md-color-scheme="slate"] .md-typeset .important>summary,
[data-md-color-scheme="slate"] .md-typeset .important>.admonition-title {
    background-color: rgba(255, 179, 0, 0.15) !important;
}

/* Change the color of the dropdown arrow for collapsible blocks */
.md-typeset .important>summary::after {
    background-color: #ffb300 !important;
}

/* ==========================================================================
   11. FIX: SIDEBAR SCROLLBAR LAYOUT SHIFT
========================================================================== */
/* Prevents text from reflowing and jumping around when the sidebar scrollbar appears on hover */
.md-sidebar__scrollwrap {
    scrollbar-gutter: stable !important;
    overflow-y: scroll !important;
}

/* ==========================================================================
   14. GTM FIX: HIDE ANNOUNCEMENT BANNER
   Prevents a gray band at the top of the page caused by GTM noscript placement.
========================================================================== */
.md-banner {
    display: none !important;
}

/* ==========================================================================
   12. FIX: CONTENT BOTTOM PADDING
========================================================================== */
/* Agrega aire al final del documento para que el texto no toque el pie del navegador */
.md-content__inner {
    padding-bottom: 80px !important;
}

/* ==========================================================================
   13. LIGHTBOX FIX PARA DECALS TRANSPARENTES
========================================================================== */
/* Si se usa GLightbox */
.gslide-image img {
    background-color: #262626 !important;
}

.glightbox-container .goverlay {
    background-color: rgba(15, 15, 18, 0.95) !important;
}

/* Si se usa el Zoom nativo de MkDocs Material */
:root {
    --md-default-bg-color: #0f0f12;
    /* Asegura que el fondo del zoom respete el modo oscuro */
}

.md-typeset [data-md-component="image"] img {
    background-color: #262626 !important;
    /* Fuerza el canvas gris tras la imagen expandida */
}

/* ==========================================================================
   FIX: KROKI DIAGRAMS (Remover bordes, lupa y lightbox)
========================================================================== */
.md-typeset img[src*="kroki"] {
    border: none !important;
    box-shadow: none !important;
    cursor: default !important;
    pointer-events: none !important;
    background-color: transparent !important;
}

/* --- DEBUG MODE: BORDERLAND --- */
/* Pone un borde rojo a TODO para ver quién se sale */
/* Descomenta para activar */

/*
* {

    outline: 1px solid red !important;

}*/