/* Persistent top menu bar + mobile drawer + left 'On this page' section navigation */
.mbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 38px;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  font-family: var(--font-text, system-ui, sans-serif);
  background: rgba(6, 8, 13, .96);
}
.mbar::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: rgba(6, 8, 13, .96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.mb-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mb-home {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 38px;
  color: #f8fafc;
  font-weight: 650;
  font-size: .9375rem;
  text-decoration: none;
  letter-spacing: -.01em;
}

.mb-home .mb-arrow {
  color: #38bdf8;
  font-size: 1.15rem;
  line-height: 1;
  margin-top: -2px;
}

.mb-home:hover {
  color: #38bdf8;
}

/* Desktop navigation links across the top menu bar */
.mb-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.mb-nav a {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  border-radius: 6px;
  color: #94a3b8;
  font-size: .8125rem;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s, background .15s;
}

.mb-nav a:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, .06);
}

.mb-nav a[aria-current="page"] {
  color: #ffffff;
  background: rgba(56, 189, 248, .12);
  font-weight: 600;
}

/* Right side actions */
.mb-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mb-btn-audit {
  display: inline-flex;
  align-items: center;
  padding: 4px 11px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, .12);
  border: 1px solid rgba(56, 189, 248, .3);
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
}

.mb-btn-audit:hover {
  background: #38bdf8;
  color: #06080d;
  border-color: #38bdf8;
}

/* Menu toggle and drawer panel */
.mb-menu > summary {
  list-style: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 4px 0 8px;
  color: #cbd5e1;
  font-weight: 550;
  font-size: .8125rem;
}
.mb-menu > summary::-webkit-details-marker { display: none; }
.mb-menu > summary:hover { color: #ffffff; }

.mb-ico, .mb-ico::before, .mb-ico::after {
  display: block;
  width: 15px;
  height: 2px;
  background: #cbd5e1;
  border-radius: 2px;
  transition: transform .25s, background .25s;
}
.mb-ico { position: relative; }
.mb-ico::before, .mb-ico::after { content: ""; position: absolute; left: 0; }
.mb-ico::before { top: -5px; }
.mb-ico::after { top: 5px; }

.mb-menu[open] .mb-ico { background: transparent; }
.mb-menu[open] .mb-ico::before { transform: translateY(5px) rotate(45deg); background: #f8fafc; }
.mb-menu[open] .mb-ico::after { transform: translateY(-5px) rotate(-45deg); background: #f8fafc; }

.mb-menu > summary:focus-visible, .mb-home:focus-visible, .mb-nav a:focus-visible, .mb-btn-audit:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
  border-radius: 6px;
}

.mb-panel {
  position: fixed;
  top: 38px;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  z-index: 70;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #080b12;
  border-left: 1px solid rgba(255, 255, 255, .1);
  padding: 18px 20px 32px;
  box-shadow: -24px 0 48px -24px rgba(0, 0, 0, .8);
}

.mb-panel .btn {
  display: flex;
  width: 100%;
  justify-content: center;
  margin-bottom: 20px;
  padding: 12px 16px;
}

.mb-h {
  font-family: var(--font-text, system-ui, sans-serif) !important;
  font-size: .8125rem !important;
  font-weight: 600;
  letter-spacing: 0;
  color: #8c9ab0;
  margin: 0 0 8px !important;
  max-width: none !important;
  line-height: 1.3 !important;
}

.mb-slides, .mb-pages { list-style: none; margin: 0 0 24px; padding: 0; }
.mb-slides { counter-reset: ms; columns: 2; column-gap: 10px; }
.mb-slides li { counter-increment: ms; break-inside: avoid; }
.mb-slides a { display: flex; gap: 8px; align-items: baseline; padding: 7px 8px; border-radius: 8px; color: #cbd5e1; text-decoration: none; font-size: .875rem; }
.mb-slides a::before { content: counter(ms); color: #38bdf8; font-weight: 650; min-width: 1.2em; font-variant-numeric: tabular-nums; }
.mb-pages a { display: block; padding: 9px 10px; border-radius: 8px; color: #f8fafc; text-decoration: none; font-weight: 600; font-size: .9375rem; }
.mb-pages a small { display: block; color: #8c9ab0; font-weight: 420; font-size: .8125rem; margin-top: 1px; line-height: 1.35; }
.mb-slides a:hover, .mb-pages a:hover { background: rgba(255, 255, 255, .06); }
.mb-slides a[aria-current], .mb-pages a[aria-current] { background: rgba(56, 189, 248, .12); color: #7dd3fc; }
html.mb-open { overflow: hidden; }

@media (min-width: 900px) {
  .mb-mobile-on-page { display: none; }
}

@media (max-width: 899px) {
  body .slide { padding-top: 42px; padding-bottom: 12px; }
  body .slide.slide-hero { padding-top: 46px; }
  .mb-nav { display: none; }
  .mb-btn-audit { display: none; }
  .mb-panel { width: 100%; border-left: 0; left: 0; z-index: 100; background: #080b12; }
  .mb-slides { columns: 1; }
}

/* ==========================================================================
   LEFT FLOATING "ON THIS PAGE" SECTION NAVIGATION
   ========================================================================== */
.rail {
  position: fixed;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 55;
  display: flex;
  flex-direction: column;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 8px 6px;
  width: 38px;
  box-sizing: border-box;
  pointer-events: auto;
  transition: width .25s cubic-bezier(.16, 1, .3, 1),
              background .25s ease,
              border-color .25s ease,
              box-shadow .25s ease,
              padding .25s ease;
}

/* Hover over the sections rail: expands "On this page" flyout */
.rail:hover,
.rail:focus-within {
  width: max-content;
  min-width: 200px;
  max-width: 300px;
  padding: 12px 14px;
  background: rgba(8, 11, 18, 0.95);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.rail-title {
  font-family: var(--font-text, system-ui, sans-serif);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0 6px 8px 6px;
  margin: 0;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity .18s ease, max-height .22s ease, margin .18s ease;
}

.rail:hover .rail-title,
.rail:focus-within .rail-title {
  opacity: 1;
  max-height: 24px;
  margin-bottom: 4px;
}

.rail-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(78vh, 600px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
  padding-right: 2px;
}

.rail button {
  all: unset;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 22px;
  padding: 3px 2px;
  border-radius: 6px;
  cursor: pointer;
  width: 100%;
  transition: background .15s ease, gap .22s ease, padding .22s ease;
}

.rail:hover button,
.rail:focus-within button {
  gap: 10px;
  padding: 4px 8px;
}

.rail button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.rail button[aria-current="true"] {
  background: rgba(56, 189, 248, 0.08);
}

.rail-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-medium, rgba(255, 255, 255, 0.25));
  flex-shrink: 0;
  margin: 0 10px;
  transition: height .25s cubic-bezier(.16, 1, .3, 1),
              border-radius .25s ease,
              background .25s ease,
              margin .22s ease,
              box-shadow .25s ease;
}

.rail:hover .rail-dot,
.rail:focus-within .rail-dot {
  margin: 0;
}

.rail button:hover .rail-dot {
  background: var(--text-secondary, #94a3b8);
}

/* Active current section dot: cyan/blue glowing pill */
.rail button[aria-current="true"] .rail-dot {
  height: 18px;
  border-radius: 3px;
  background: var(--blue-glow, #38bdf8);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.5);
}

/* Section header labels: all in grey, current in white */
.rail-label {
  font-family: var(--font-text, system-ui, sans-serif);
  font-size: 0.8125rem;
  line-height: 1.35;
  color: #8c9ab0; /* All headers in grey by default */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  max-width: 0;
  pointer-events: none;
  text-align: left;
  transition: opacity .18s ease, max-width .25s cubic-bezier(.16, 1, .3, 1), color .15s ease;
}

.rail:hover .rail-label,
.rail:focus-within .rail-label {
  opacity: 1;
  max-width: 240px;
  pointer-events: auto;
}

/* Inactive header hovered: turns brighter/white */
.rail button:hover .rail-label {
  color: #ffffff;
}

/* Current section header: white and slightly emphasized */
.rail button[aria-current="true"] .rail-label {
  color: #ffffff !important;
  font-weight: 600;
}

.rail button:focus-visible {
  outline: 2px solid var(--border-focus, #38bdf8);
  outline-offset: -1px;
}

@media (max-width: 899px) {
  .rail {
    display: none !important;
  }
}
