:root{
  --institutional-header-offset:76px;
}

/* Fundamentos, Lineamientos y FAQ conservan dos columnas hasta 900px. */
@media(min-width:901px){
  .chapter-layout{
    align-items:start;
  }

  .chapter-layout > .chapter-sidebar,
  .chapter-layout > .chapter-aside{
    position:sticky;
    top:var(--institutional-header-offset);
    height:calc(100vh - var(--institutional-header-offset));
    height:calc(100dvh - var(--institutional-header-offset));
    min-height:0;
    max-height:calc(100vh - var(--institutional-header-offset));
    max-height:calc(100dvh - var(--institutional-header-offset));
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior:contain;
    align-self:start;
    scrollbar-gutter:stable;
    scrollbar-width:thin;
    scrollbar-color:rgba(6,27,53,.22) transparent;
  }
}

/* Directorio de Nodos y Convocatoria cambian a una columna en 980px. */
@media(min-width:981px){
  .nodos-layout,
  .process-layout{
    align-items:start;
  }

  .nodos-layout > .nodos-sidebar,
  .nodos-layout > .nodos-aside,
  .process-layout > .process-sidebar,
  .process-layout > .process-aside{
    position:sticky;
    top:var(--institutional-header-offset);
    height:calc(100vh - var(--institutional-header-offset));
    height:calc(100dvh - var(--institutional-header-offset));
    min-height:0;
    max-height:calc(100vh - var(--institutional-header-offset));
    max-height:calc(100dvh - var(--institutional-header-offset));
    overflow-x:hidden;
    overflow-y:auto;
    overscroll-behavior:contain;
    align-self:start;
    scrollbar-gutter:stable;
    scrollbar-width:thin;
    scrollbar-color:rgba(6,27,53,.22) transparent;
  }

  /* Toda la columna izquierda desplaza el directorio; no se anidan barras. */
  .nodos-layout > .nodos-sidebar .node-nav{
    max-height:none;
    overflow:visible;
  }
}

.chapter-main,
.nodos-main,
.process-main,
.chapter-main :where([id]),
.nodos-main :where([id]),
.process-main :where([id]){
  scroll-margin-top:calc(var(--institutional-header-offset) + 16px);
}

.chapter-layout > .chapter-sidebar::-webkit-scrollbar,
.chapter-layout > .chapter-aside::-webkit-scrollbar,
.nodos-layout > .nodos-sidebar::-webkit-scrollbar,
.nodos-layout > .nodos-aside::-webkit-scrollbar,
.process-layout > .process-sidebar::-webkit-scrollbar,
.process-layout > .process-aside::-webkit-scrollbar{
  width:8px;
}

.chapter-layout > .chapter-sidebar::-webkit-scrollbar-thumb,
.chapter-layout > .chapter-aside::-webkit-scrollbar-thumb,
.nodos-layout > .nodos-sidebar::-webkit-scrollbar-thumb,
.nodos-layout > .nodos-aside::-webkit-scrollbar-thumb,
.process-layout > .process-sidebar::-webkit-scrollbar-thumb,
.process-layout > .process-aside::-webkit-scrollbar-thumb{
  border-radius:999px;
  background:rgba(6,27,53,.18);
}

.chapter-layout > .chapter-sidebar::-webkit-scrollbar-track,
.chapter-layout > .chapter-aside::-webkit-scrollbar-track,
.nodos-layout > .nodos-sidebar::-webkit-scrollbar-track,
.nodos-layout > .nodos-aside::-webkit-scrollbar-track,
.process-layout > .process-sidebar::-webkit-scrollbar-track,
.process-layout > .process-aside::-webkit-scrollbar-track{
  background:transparent;
}
