html {
  scroll-behavior: smooth;
}

/* =========================================
   Desktop / Standard SaaS TOC Design
========================================= */
nav.xpl-toc {
  background: #f3f8fd !important; /* Very subtle, clean SaaS gray/blue */
  border: 1px solid #e2e8f0;      /* Crisp, subtle border */
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); /* Soft depth */
  border-radius: 8px;
  padding: 24px; 
  color: #1e293b; 
  font-size: 15px; 
  line-height: 1.4rem !important;
}

/* Smooth sticky behavior for Desktop */
nav.xpl-toc.is-sticky { 
  position: sticky; 
  top: 100px; 
  z-index: 99; 
  max-height: calc(100vh - 120px); 
  overflow-y: auto; 
}

/* Sleek scrollbar for long TOCs */
nav.xpl-toc.is-sticky::-webkit-scrollbar { width: 4px; }
nav.xpl-toc.is-sticky::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Clean Header (No horizontal bar) */
nav.xpl-toc .xpl-toc__header {
  display: flex; align-items: center; justify-content: space-between; 
  margin-bottom: 16px; 
}

nav.xpl-toc .xpl-toc__title {
  font-weight: 600;           
  font-size: 0.89rem;           
  color: #0c214cd4; /* Subtle muted header color */
  text-transform: uppercase;
}

/* Hide toggle on Desktop */
nav.xpl-toc .xpl-toc__toggle { display: none !important; }

/* List Styling */
nav.xpl-toc .xpl-toc__list,
nav.xpl-toc .xpl-toc__sublist {
  list-style: none !important; margin: 0 !important; padding: 0 !important; border: 0 !important;
}

nav.xpl-toc .xpl-toc__item { margin: 10px 0; }  

/* Link Styling - Clean SaaS Look */
nav.xpl-toc .xpl-toc__link {
  display: block; 
  text-decoration: none; 
  color: #0c214cd4 !important;
  font-size: 0.9rem; 
  font-weight: 400; 
  line-height: 1.2rem;  
  padding-left: 12px;
  border-left: 2px solid transparent; /* Preps for the active state indicator */
  transition: all 0.2s ease;
}

nav.xpl-toc .xpl-toc__link:hover { 
  color: #0551d8 !important; 
  text-decoration: none !important; 
  border-left: 2px solid #94a3b8; /* Subtle line on hover */
}

/* Active State: Highlight text and solid left border */
nav.xpl-toc .xpl-toc__link.is-active { 
  font-weight: 600; 
  color: #0551d8 !important; 
  border-left: 2px solid #0551d8;
}

/* Indentation for H3/H4 */
nav.xpl-toc .xpl-toc__item.lvl-3 > .xpl-toc__link { margin-left: 12px; font-size: 0.9rem; }
nav.xpl-toc .xpl-toc__item.lvl-4 > .xpl-toc__link { margin-left: 24px; font-size: 0.85rem; }


/* =========================================
   Mobile / Tablet Configuration
========================================= */
@media (max-width: 980px) {
  nav.xpl-toc { 
    position: static !important; /* Absolutely forces it NOT to be sticky */
    width: auto;                 /* FIX: Stops horizontal scrolling overflow */
    box-sizing: border-box;
    margin-bottom: 0px!important;         /* Gives space before the content starts */
    padding: 16px 20px;
    border-radius: 6px;
  }
  
  nav.xpl-toc .xpl-toc__header { margin-bottom: 0; } /* Remove bottom margin when collapsed */
  
  nav.xpl-toc .xpl-toc__title { color: #1e293b; font-weight: 700; }
  
  /* Show and style the toggle button */
  nav.xpl-toc .xpl-toc__toggle {
    display: inline-flex !important;
    align-items: center; gap: 8px;
    border: 0; background: transparent; cursor: pointer;
    padding: 0; font-size: 0.9rem; font-weight: 500; color: #0551d8;
  }
  
  /* Chevron setup */
  nav.xpl-toc .xpl-toc__toggle::after {
    content: ""; width: 7px; height: 7px; 
    border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(-135deg); transition: transform 0.2s ease;
    margin-top: 4px;
  }

  /* Chevron points DOWN when collapsed */
  nav.xpl-toc.is-collapsed .xpl-toc__toggle::after { 
    transform: rotate(45deg); 
    margin-top: -2px;
  }
    
  /* FORCE hide list when collapsed */
  nav.xpl-toc.is-collapsed .xpl-toc__list { display: none !important; }
  
  /* Show list when open */
  nav.xpl-toc:not(.is-collapsed) .xpl-toc__list:not(:empty) {
  display: block !important;
  margin-top: 0px !important;
  border-top: 1px solid #e2e8f0;
  padding-top: 16px !important;
}

nav.xpl-toc .xpl-toc__list:empty {
  display: none !important;
  margin-top: 0 !important;
  padding-top: 0 !important;
  border-top: 0 !important;
}
}

/* =========================================
   Archive / Filter Styles (Restored!)
========================================= */
.xpl-archive.is-loading .xpl-archive__grid {
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.xpl-archive.is-loading .xpl-archive__pagination {
  opacity: 0.6;
  pointer-events: none;
}

.xpl-filter--search {
  margin-bottom: 1.25rem;
}

.xpl-filter__search input[type="search"] {
  width: 100%;
  box-sizing: border-box;
  border-radius: 999px;
  border: 1px solid #e1e4f0;
  background-color: #ffffff;
  padding: 0.6rem 0.9rem;
  font-size: 14px;
  line-height: 1.4;
  outline: none;
}

.xpl-filter__search input[type="search"]::placeholder {
  color: #a0a4b8;
}

.xpl-filter__search input[type="search"]:focus {
  border-color: #2144ff;
  box-shadow: 0 0 0 1px rgba(33,68,255,0.15);
}

.xpl-archive__filters .xpl-archive__clear {
  margin-top: 1.5rem;
  width: 100%;
  border-radius: 999px;
  border: 1px solid #e1e4f0;
  background-color: #f6f7fb;
  padding: 0.45rem 1rem;
  font-size: 13px;
  line-height: 1.4;
  text-align: center;
  cursor: pointer;
}

.xpl-archive__filters .xpl-archive__clear:hover {
  background-color: #e9ebf5;
}