/* ================== Floating Table of Contents ================== */
.mah-toc-floating {
    position: fixed;
    top: 100px;
    right: 20px;
    max-width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 9999;
    pointer-events: auto;
    transition: transform 0.3s ease-in-out;
  }
  
  .mah-toc-floating strong {
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
  }
  
  .mah-toc-floating ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
  }
  
  .mah-toc-floating li {
    margin-bottom: 6px;
    border-bottom: 1px solid #e2e8f0;
  }
  
  .mah-toc-floating a {
    font-size: 16px;
    color: #0073aa;
    text-decoration: none;
  }
  
  .mah-toc-floating a:hover {
    text-decoration: underline;
  }

  
  /* TOC content visibility */
  .mah-toc-list {
    margin-top: 10px;
  }
  
  .mah-toc-floating:not(.open) .mah-toc-list {
    display: none;
  }
  
  .mah-toc-floating.open .mah-toc-list {
    display: block;
  }
  
  /* TOC toggle button (visible on all screen sizes) */
  .mah-toc-toggle {
    display: flex;
    position: fixed;
    top: 100px;
    right: 16px;
    z-index: 10001;
    background-color: white;
    color: #2b6cb0;
    border: 2px solid #2b6cb0;
    border-radius: 25px;
    padding: 7px 10px;
    font-size: 17px;
    box-shadow: none;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    line-height: 1;
  }
  
  /* ================== Mobile Responsive TOC ================== */
  @media (max-width: 768px) {
    .mah-toc-toggle {
      position: fixed;
      bottom: 100px; /* pushed up above sticky footer */
      right: 16px;
      top: auto;
      padding: 7px 12px;
      font-size: 17px;
    }
  
    .mah-toc-floating {
      bottom: 160px;  /* prevent blocking sticky CTA */
      right: 10px;
      top: auto;
      left: auto;
      width: 320px;
      max-height: 60vh;
      padding: 10px;
      font-size: 13.6px;
      transform: translateX(100%);
    }
  
    .mah-toc-floating.open {
      transform: translateX(0%);
    }
  }
  
  /* ================== Desktop TOC Reset ================== */
  @media (min-width: 769px) {
    .mah-toc-floating:not(.open) .mah-toc-list {
      display: none;
    }
  
    .mah-toc-floating.open .mah-toc-list {
      display: block;
    }
  
    .mah-toc-floating {
      transform: none !important;
    }
  }
  
  .mah-toc {
    position: sticky;
    top: 100px;
    max-width: 280px;
    width: 100%;
    box-sizing: border-box;
    padding-left: var(--mah-spacing-md);
    margin-left: 0;
    align-self: flex-start;
    flex-shrink: 0;
    min-height: 1px;
    display: block;
    overflow: hidden;
  }