.kd-mobile-toc-button,
.kd-mobile-toc-dialog:not([open]) {
  display: none;
}

@media (max-width: 959px) {
  body.kd-mobile-toc-enabled {
    --kd-toc-button-height: 44px;
    --kd-toc-bottom: calc(var(--kd-phone-bottom, 0px) + env(safe-area-inset-bottom, 0px));
    padding-bottom: calc(var(--kd-toc-bottom) + var(--kd-toc-button-height));
  }

  .kd-mobile-toc-enabled .kd-blog-sidebar {
    display: none;
  }

  .kd-mobile-toc-enabled #connect_widget.wca-widget-loaded {
    bottom: calc(var(--kd-toc-bottom) + var(--kd-toc-button-height) + 16px) !important;
  }

  .kd-mobile-toc-enabled .uk-notification:has([data-cookie-name="privacy_agree"]) {
    bottom: calc(var(--kd-toc-bottom) + var(--kd-toc-button-height) + 10px) !important;
  }

  .kd-mobile-toc-button {
    position: fixed;
    z-index: 999;
    inset: auto 0 var(--kd-toc-bottom);
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    min-height: var(--kd-toc-button-height);
    padding: 0 10px;
    border: 0;
    border-radius: 0;
    background: linear-gradient(95deg, #2da8e9, #1b94d1);
    color: #fff;
    font: 700 14px/1.3 Arial, sans-serif;
    letter-spacing: .045em;
    text-transform: uppercase;
    cursor: pointer;
  }

  .kd-mobile-toc-button::before {
    content: '';
    width: 16px;
    height: 12px;
    border-block: 2px solid currentColor;
    box-sizing: border-box;
    background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat;
  }
}

html.kd-mobile-toc-open,
html.kd-mobile-toc-open body {
  overflow: hidden;
}

.kd-mobile-toc-dialog[open] {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #fff;
  color: #21333e;
  animation: kd-mobile-toc-slide-in .24s ease both;
}

.kd-mobile-toc-dialog[data-closing] {
  animation: kd-mobile-toc-slide-out .24s ease both;
}

.kd-mobile-toc-dialog::backdrop {
  background: rgb(33 51 62 / 28%);
}

.kd-mobile-toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 12px 16px;
  border-bottom: 1px solid #dbe6ec;
}

.kd-mobile-toc-head h2 {
  margin: 0;
  color: #14252f;
  font: 700 22px/1.15 Arial, sans-serif;
}

.kd-mobile-toc-close {
  display: grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #dbe6ec;
  border-radius: 11px;
  background: #fff;
  color: #21333e;
  font: 400 24px/1 Arial, sans-serif;
  cursor: pointer;
}

.kd-mobile-toc-sections {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px 12px calc(18px + env(safe-area-inset-bottom, 0px));
}

.kd-mobile-toc-sections ol {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.kd-mobile-toc-sections a {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  min-height: 52px;
  padding: 10px 13px;
  border: 1px solid #dbe6ec;
  border-radius: 12px;
  background: #fff;
  color: #21333e;
  font: 400 15px/1.35 Arial, sans-serif;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.kd-mobile-toc-number {
  color: #0879a8;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kd-mobile-toc-sections a::after {
  content: '';
  justify-self: center;
  width: 6px;
  height: 6px;
  border: solid currentColor;
  border-width: 1px 1px 0 0;
  transform: rotate(45deg);
}

.kd-mobile-toc-sections a[aria-current="location"] {
  padding-left: 11px;
  border-left: 3px solid #0879a8;
  color: #0879a8;
  font-weight: 700;
}

.kd-mobile-toc-sections a:focus-visible,
.kd-mobile-toc-close:focus-visible {
  outline: 2px solid #0879a8;
  outline-offset: -3px;
}

@keyframes kd-mobile-toc-slide-in {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes kd-mobile-toc-slide-out {
  from { transform: translateY(0); }
  to { transform: translateY(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .kd-mobile-toc-dialog[open] { animation: none; }
}


.kd-blog-toc:not(:has(a[href^="#"])) {
  display: none;
}

@media (max-width: 959px) {
  .kd-blog-sidebar:not(:has(.kd-blog-toc a[href^="#"])) {
    display: none;
  }
}
