/* ============================================================
   Public documentation pages — layout, theme, search, TOC
   Inspired by modern docs shells (e.g. docs.build.io)
   ============================================================ */

:root {
  --main-nav-height: 64px;
  --dp-sidebar-width: 280px;
  --dp-toc-width: 220px;
  --dp-content-max: 48rem;
  --scrollbar-width: calc(100vw - 100%);
  overscroll-behavior: none;

  --dp-radius: 8px;
  --dp-radius-sm: 6px;
  --dp-radius-lg: 12px;

  --dp-bg: #ffffff;
  --dp-surface: #f6f8fa;
  --dp-surface-alt: #ffffff;
  --dp-text: #3d444d;
  --dp-text-strong: #1f2328;
  --dp-text-muted: #656d76;
  --dp-border: #d0d7de;
  --dp-border-subtle: #eaeef2;
  --dp-link: #0969da;
  --dp-link-hover: #0550ae;
  --dp-accent: #0969da;
  --dp-accent-soft: rgba(9, 105, 218, 0.12);
  --dp-code-bg: #eff1f3;
  --dp-code-text: #1f2328;
  --dp-pre-bg: #1f2328;
  --dp-pre-text: #e6edf3;
  --dp-hover-bg: rgba(31, 35, 40, 0.06);
  --dp-active-bg: rgba(9, 105, 218, 0.12);
  --dp-active-text: #0550ae;
  --dp-shadow: rgba(31, 35, 40, 0.12);
  --dp-header-blur: rgba(255, 255, 255, 0.85);
  --dp-kbd-bg: #eff1f3;
  --dp-kbd-border: #d0d7de;
  --dp-mark-bg: #fff8c5;
  --dp-mark-text: #1f2328;
}

[data-theme="dark"] {
  --dp-bg: #0d1117;
  --dp-surface: #010409;
  --dp-surface-alt: #161b22;
  --dp-text: #c9d1d9;
  --dp-text-strong: #f0f6fc;
  --dp-text-muted: #8b949e;
  --dp-border: #30363d;
  --dp-border-subtle: #21262d;
  --dp-link: #58a6ff;
  --dp-link-hover: #79b8ff;
  --dp-accent: #58a6ff;
  --dp-accent-soft: rgba(88, 166, 255, 0.14);
  --dp-code-bg: #21262d;
  --dp-code-text: #e6edf3;
  --dp-pre-bg: #010409;
  --dp-pre-text: #e6edf3;
  --dp-hover-bg: rgba(177, 186, 196, 0.1);
  --dp-active-bg: rgba(88, 166, 255, 0.16);
  --dp-active-text: #79b8ff;
  --dp-shadow: rgba(0, 0, 0, 0.55);
  --dp-header-blur: rgba(13, 17, 23, 0.88);
  --dp-kbd-bg: #21262d;
  --dp-kbd-border: #30363d;
  --dp-mark-bg: #9e6a03;
  --dp-mark-text: #f0f6fc;
}

.public-page__container--doc-page-tabs {
  --main-nav-height: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body,
footer {
  background-color: var(--dp-bg);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-size: 15px;
  color: var(--dp-text);
  margin: 0;
  overflow-wrap: anywhere;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.15s ease, color 0.15s ease;
}

/* ------------------------------------------------------------
   Shell
   ------------------------------------------------------------ */

.public-page__container {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 100vh;
  width: 100%;
}

.public-page__content__body {
  position: relative;
  width: 100%;
  height: calc(100vh - var(--main-nav-height));
  scrollbar-width: thin;
}

.public-page__content__body > div {
  height: 100%;
}

.main_content_page {
  width: min(90%, 1100px);
  margin: 0 auto;
  margin-top: var(--main-nav-height);
  font-family: inherit;
  line-height: 1.65;
  font-weight: 400;
  font-size: 18px;
  padding: 24px 16px 64px;
}

@media (max-width: 768px) {
  .public-page__content__body {
    height: auto;
    min-height: calc(100vh - var(--main-nav-height));
  }

  .main_content_page {
    width: 100%;
    margin-top: var(--main-nav-height);
    padding: 16px;
    font-size: 16px;
  }
}

/* ------------------------------------------------------------
   Header
   ------------------------------------------------------------ */

.public-page__content__header {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.public-page__content__header--overlay {
  background: transparent;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 999;
  overflow: visible;
  border-bottom: 1px solid var(--dp-border);
}

/* Blur on a separate layer so it doesn't clip the search dropdown */
.public-page__content__header--overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--dp-header-blur);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
}

.public-page__content__header-inner {
  display: flex;
  flex-direction: column;
  width: 100%;
  overflow: visible;
}

.public-page__content__header-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  padding: 0;
}

.public-page__content__header-row--unified {
  padding: 0;
  width: 100%;
}

.public-page__header-mailmate-shell {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  min-height: var(--main-nav-height);
  padding: 0 24px;
  background: transparent;
  border-bottom: none;
  overflow: visible;
}

.public-page__header-mailmate-left {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 20px;
  min-width: 0;
  flex: 1 1 auto;

  ul {
    list-style: none;
  }

  a {
    text-decoration: none;
    color: inherit;
  }
}

.public-page__header-primary-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  column-gap: 28px;
  row-gap: 4px;
  min-width: 0;
  margin-left: 0.5rem;
}

.public-page__header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
  min-width: 0;
  overflow: visible;
}

.public-page__content__header__links.public-page__nav-custom {
  flex: 0 1 auto;
  min-width: 0;
  flex-wrap: wrap;
}

.page-tabs--in-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px;
  width: auto;
  max-width: 100%;
  border: none;
  margin: 0;
  padding: 0;
  background: transparent;
  flex: 0 1 auto;
  min-width: 0;
}

.public-page__content__header__title {
  font-size: 1.125rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--dp-text-strong);
}

.public-page__header__title-link {
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--dp-text-strong);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(280px, 42vw);
}

.public-page__header__title-link:hover {
  color: var(--dp-accent);
}

.public-page__content__header__links {
  display: flex;
  gap: 28px;

  @media screen and (max-width: 996px) {
    display: none;
  }
}

.public-page__header-mailmate-left .public-page__content__header__links a.public-page__content__header__link,
.public-page__header-mailmate-left .public-page__content__header__link.nav-link,
.public-page__header-mailmate-left .page-tabs--in-header a.public-page__content__header__link {
  font-family: inherit;
  text-decoration: none;
  color: var(--dp-text-muted);
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0;
  border-bottom: none;
  box-shadow: none;
  padding: 6px 0;
  transition: color 0.12s ease;
  white-space: nowrap;
}

.public-page__header-mailmate-left .public-page__content__header__links a.public-page__content__header__link:hover,
.public-page__header-mailmate-left .public-page__content__header__link.nav-link:hover,
.public-page__header-mailmate-left .page-tabs--in-header a.public-page__content__header__link:hover {
  color: var(--dp-text-strong);
}

.public-page__header-mailmate-left a.public-page__content__header__link.active-nav-link,
.public-page__header-mailmate-left a.public-page__content__header__link.active-nav-link:hover,
.public-page__header-mailmate-left .page-tabs--in-header a.active-nav-link,
.public-page__header-mailmate-left .page-tabs--in-header a.active-nav-link:hover,
.public-page__header-mailmate-left .page-tabs--in-header a.page-tab--active {
  color: var(--dp-text-strong);
  font-weight: 600;
  border-bottom: none;
  box-shadow: none;
  text-decoration: none;
  background: none;
}

@media screen and (max-width: 996px) {
  .public-page__header-mailmate-shell {
    position: relative;
    padding: 0 12px;
    gap: 8px;
  }

  .public-page__header-mailmate-left {
    flex: 1 1 auto;
    min-width: 0;
    gap: 10px;
  }

  .public-page__header-primary-nav {
    display: none;
  }

  .public-page__header-actions {
    flex: 0 0 auto;
    justify-content: flex-end;
    gap: 6px;
  }

  .public-page__header__title-link {
    max-width: none;
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-logo {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/* ------------------------------------------------------------
   Logo / brand
   ------------------------------------------------------------ */

.public-page__header__logo {
  max-width: 150px;
  max-height: 36px;
  display: block;

  @media screen and (max-width: 500px) {
    max-width: 110px;
  }
}

.header-logo {
  display: flex;
  align-items: center;
  min-width: 0;
}

.title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  padding: 0;
  color: var(--dp-text-strong);
}

/* ------------------------------------------------------------
   Theme toggle
   ------------------------------------------------------------ */

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--dp-border);
  border-radius: var(--dp-radius);
  background: var(--dp-surface-alt);
  color: var(--dp-text-muted);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.theme-toggle:hover {
  background-color: var(--dp-hover-bg);
  color: var(--dp-text-strong);
  border-color: var(--dp-text-muted);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--dp-accent);
  outline-offset: 2px;
}

.theme-toggle svg {
  width: 16px;
  height: 16px;
}

.theme-toggle__moon {
  display: none;
}

[data-theme="dark"] .theme-toggle__sun {
  display: none;
}

[data-theme="dark"] .theme-toggle__moon {
  display: block;
}

/* ------------------------------------------------------------
   Search
   ------------------------------------------------------------ */

.search-container {
  position: relative;
  display: flex;
  min-width: 0;
  flex: 0 1 280px;
  max-width: min(320px, 100%);
  overflow: visible;
}

.search-container.search-container--hidden {
  @media screen and (max-width: 996px) {
    display: none;
  }
}

/* Mobile/tablet: icon-only search that expands into a full-width overlay */
@media screen and (max-width: 996px) {
  .search-container {
    flex: 0 0 36px;
    width: 36px;
    max-width: 36px;
  }

  .search-kbd {
    display: none !important;
  }

  #searchBox {
    width: 36px;
    min-width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
    border-radius: var(--dp-radius);
    background: var(--dp-surface-alt);
    border: 1px solid var(--dp-border);
  }

  .searchIcon {
    color: var(--dp-text-muted);
  }

  .search-input {
    justify-content: center;
    gap: 0;
  }

  #searchInput {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .search-container.is-open,
  .search-container:focus-within {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    flex: none;
    width: auto;
    max-width: none;
  }

  .search-container.is-open #searchBox,
  .search-container:focus-within #searchBox {
    width: 100%;
    min-width: 0;
    padding: 0 12px;
    border-radius: 999px;
    justify-content: flex-start;
    box-shadow: 0 8px 24px var(--dp-shadow);
  }

  .search-container.is-open .search-input,
  .search-container:focus-within .search-input {
    justify-content: flex-start;
    gap: 8px;
  }

  .search-container.is-open #searchInput,
  .search-container:focus-within #searchInput {
    position: static;
    width: 100%;
    height: auto;
    opacity: 1;
    overflow: visible;
    clip: auto;
  }

  .search-container.is-open .search-results,
  .search-container:focus-within .search-results.active {
    left: 0;
    right: 0;
    min-width: 0;
  }
}

#searchBox {
  position: relative;
  background: var(--dp-surface);
  border-radius: 999px;
  border: 1px solid var(--dp-border);
  display: flex;
  align-items: center;
  padding: 0 12px;
  width: 100%;
  min-width: 0;
  height: 38px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

#searchBox:focus-within {
  border-color: var(--dp-accent);
  background: var(--dp-surface-alt);
  box-shadow: 0 0 0 3px var(--dp-accent-soft);
}

.search-input {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.searchIcon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  color: var(--dp-text-muted);
}

#searchInput {
  border: none;
  outline: none;
  width: 100%;
  min-width: 0;
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--dp-text-strong);
  background: transparent;
  appearance: none;
}

#searchInput::placeholder {
  color: var(--dp-text-muted);
}

.search-kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--dp-kbd-border);
  border-radius: 5px;
  background: var(--dp-kbd-bg);
  color: var(--dp-text-muted);
  font-family: inherit;
  font-size: 0.6875rem;
  font-weight: 550;
  line-height: 1;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: auto;
  right: 0;
  width: max(100%, min(400px, 92vw));
  min-width: min(360px, 92vw);
  background: var(--dp-surface-alt);
  border: 1px solid var(--dp-border);
  border-radius: var(--dp-radius-lg);
  box-shadow: 0 12px 32px var(--dp-shadow);
  display: none;
  z-index: 1100;
  overflow: hidden;
}

.search-results.active {
  display: block;
}

.search-result-text {
  padding: 10px 14px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dp-text-muted);
  border-bottom: 1px solid var(--dp-border-subtle);
}

#searchResults {
  list-style: none;
  margin: 0;
  padding: 6px;
  max-height: min(360px, 60vh);
  overflow-y: auto;
}

#searchResults li {
  padding: 0;
  cursor: pointer;
  border-radius: var(--dp-radius);
}

#searchResults li:hover,
#searchResults li.is-active {
  background-color: var(--dp-hover-bg);
}

#searchResults a,
#searchResults .search-result-item {
  text-decoration: none;
  color: var(--dp-text);
  display: block;
  padding: 10px 12px;
}

#searchResults .search-hint,
#searchResults .no-results {
  padding: 14px 12px;
  color: var(--dp-text-muted);
  font-size: 0.875rem;
}

.search-modal-group {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.search-modal-item {
  display: block;
  padding: 12px 0 10px 18px;
  text-decoration: none;
}

.search-result-parent {
  font-size: 0.75rem;
  color: var(--dp-text-muted);
  margin-bottom: 2px;
}

.search-result-title {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--dp-text-strong);
}

.search-matches {
  margin-top: 4px;
}

.search-match-line {
  color: var(--dp-text);
  margin-bottom: 2px;
  white-space: pre-line;
  font-size: 0.8125rem;
  padding-left: 2px;
  line-height: 1.45;
}

.search-match-line.no-matches {
  color: #b91c1c;
}

.search-modal-item:hover .search-match-line {
  background: var(--dp-hover-bg);
}

mark,
.search-landing-highlight {
  background: var(--dp-mark-bg);
  color: var(--dp-mark-text);
  border-radius: 2px;
  padding: 0 2px;
}

/* ------------------------------------------------------------
   Document layout (sidebar + content + TOC)
   ------------------------------------------------------------ */

.document-view {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}

.document-view .wrapper {
  display: grid;
  grid-template-columns: var(--dp-sidebar-width) minmax(0, 1fr);
  gap: 0;
  flex: 1 1 0;
  min-height: 0;
  height: 100%;
}

.document-view .container-left {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--dp-border);
  background: var(--dp-surface);
  max-width: none;
  width: auto;
  height: 100%;
  float: none;
}

.document-view .toc {
  background: transparent;
  border-right: none;
  flex: 1 1 0;
  min-height: 0;
  height: auto;
  width: 100%;
  padding: 16px 12px 20px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.document-view .footer {
  margin-top: 0;
  border-right: none;
}

.document-view .container-right {
  float: none;
  height: 100%;
  width: 100%;
  flex-grow: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  position: relative;
  background: var(--dp-bg);
}

@media screen and (min-width: 1201px) {
  .document-view .container-right {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--dp-toc-width);
    column-gap: 40px;
    align-items: start;
    padding-right: 28px;
  }

  .document-view .container-right > #content {
    grid-column: 1;
    min-width: 0;
  }

  .document-view .container-right > .container-right-toc {
    grid-column: 2;
    grid-row: 1;
  }
}

.document-view .doc-content {
  max-width: var(--dp-content-max) !important;
  width: 100%;
  padding: 40px 48px 80px;
  margin: 0;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--dp-text);
}

@media screen and (max-width: 1200px) {
  .document-view .doc-content {
    padding-right: 40px;
  }
}

@media screen and (max-width: 996px) {
  .document-view .wrapper {
    grid-template-columns: minmax(0, 1fr);
  }

  .document-view .container-left {
    display: none;
  }

  .document-view .doc-content {
    max-width: 100% !important;
    padding: 28px 24px 64px;
  }
}

@media screen and (max-width: 640px) {
  .document-view .doc-content {
    padding: 20px 16px 56px !important;
  }
}

/* Content typography */
.document-view .doc-content {
  h1 {
    font-size: 2rem;
    font-weight: 750;
    margin-top: 0;
    margin-bottom: 0.85em;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--dp-text-strong);
    padding-bottom: 0.45em;
    border-bottom: 1px solid var(--dp-border);
  }

  h2 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-top: 2.1em;
    margin-bottom: 0.75em;
    line-height: 1.3;
    letter-spacing: -0.015em;
    color: var(--dp-text-strong);
    border-bottom: 1px solid var(--dp-border-subtle);
    padding-bottom: 0.35em;
  }

  h3 {
    font-size: 1.15rem;
    font-weight: 650;
    margin-top: 1.6em;
    margin-bottom: 0.55em;
    line-height: 1.4;
    color: var(--dp-text-strong);
  }

  h4 {
    font-weight: 650;
    margin-top: 1.4em;
    margin-bottom: 0.45em;
    color: var(--dp-text-strong);
  }

  h5,
  h6 {
    font-weight: 600;
    margin-top: 1.3em;
    margin-bottom: 0.4em;
    color: var(--dp-text);
  }

  h1,
  h2,
  h3,
  h4 {
    scroll-margin-top: calc(var(--main-nav-height) + 20px);
  }

  p {
    margin-top: 1em;
    margin-bottom: 1em;
  }

  a {
    color: var(--dp-link);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-thickness: 1px;
    font-weight: 500;
    transition: color 0.12s ease;
  }

  a:hover {
    color: var(--dp-link-hover);
  }

  strong {
    font-weight: 650;
    color: var(--dp-text-strong);
  }

  ul {
    list-style-type: disc;
    padding-left: 1.4em;
    margin-top: 1em;
    margin-bottom: 1em;
  }

  ol {
    list-style-type: decimal;
    padding-left: 1.4em;
    margin-top: 1em;
    margin-bottom: 1em;
  }

  li {
    margin-top: 0.4em;
    margin-bottom: 0.4em;
  }

  li > ul,
  li > ol {
    margin-top: 0.35em;
    margin-bottom: 0.35em;
  }

  code {
    font-size: 0.875em;
    font-weight: 600;
    color: var(--dp-code-text);
    background: var(--dp-code-bg);
    padding: 0.15em 0.4em;
    border-radius: 0.3rem;
    border: 1px solid var(--dp-border-subtle);
  }

  pre {
    background: var(--dp-pre-bg);
    color: var(--dp-pre-text);
    border: 1px solid var(--dp-border);
    padding: 1em 1.25em;
    border-radius: var(--dp-radius);
    overflow-x: auto;
    font-size: 0.875em;
    line-height: 1.65;
    margin-top: 1.5em;
    margin-bottom: 1.5em;
  }

  pre code {
    background: transparent;
    color: inherit;
    font-weight: 400;
    padding: 0;
    border-radius: 0;
    border: none;
    font-size: inherit;
  }

  blockquote {
    border-left: 3px solid var(--dp-accent);
    padding: 0.25em 0 0.25em 1em;
    color: var(--dp-text-muted);
    margin-top: 1.4em;
    margin-bottom: 1.4em;
  }

  hr {
    border: none;
    border-top: 1px solid var(--dp-border);
    margin-top: 2.5em;
    margin-bottom: 2.5em;
  }

  table {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin-top: 1.5em;
    margin-bottom: 1.5em;
    font-size: 0.875em;
    line-height: 1.6;
  }

  thead th {
    font-weight: 650;
    color: var(--dp-text-strong);
    border-bottom: 2px solid var(--dp-border);
    padding: 0.65em 0.85em;
    text-align: left;
    white-space: nowrap;
  }

  tbody td {
    padding: 0.65em 0.85em;
    border-bottom: 1px solid var(--dp-border-subtle);
  }

  tbody tr:last-child td {
    border-bottom: none;
  }

  img {
    max-width: 100%;
    height: auto;
    border-radius: var(--dp-radius);
    margin-top: 1.5em;
    margin-bottom: 1.5em;
  }

  span[style*="overflow: hidden"][style*="transform: rotate(0.00rad)"] {
    max-width: 100% !important;
    height: auto !important;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  span[style*="overflow: hidden"] img {
    max-width: 100% !important;
    height: auto !important;
    margin: 0 auto !important;
    display: block;
    transform: none !important;
    -webkit-transform: none !important;
  }
}

/* Non-document content helpers */
.toc a {
  text-decoration: none;
}

.toc-sidebar {
  margin-top: 30px;
}

.content-main {
  margin-left: 320px;

  @media screen and (max-width: 996px) {
    margin-left: 0;
    padding: 20px;
  }
}

.doc-content {
  max-width: 1200px !important;
  padding: 48px;
  margin: 0 auto;

  @media screen and (max-width: 768px) {
    padding: 16px !important;
  }

  img {
    max-width: 100%;
    height: auto;
  }

  span[style*="overflow: hidden"][style*="transform: rotate(0.00rad)"] {
    max-width: 100% !important;
    height: auto !important;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  span[style*="overflow: hidden"] img {
    max-width: 100% !important;
    height: auto !important;
    margin: 0 auto !important;
    display: block;
    transform: none !important;
    -webkit-transform: none !important;
  }
}

.responsive-iframe-container {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%;
  overflow: hidden;
}

.responsive-iframe-container iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

@media (max-width: 768px) {
  iframe {
    max-width: 100% !important;
    height: auto !important;
  }
}

.responsive-img-container img {
  max-width: 100% !important;
  height: auto !important;
  object-fit: cover;
  border: none;
}

table {
  border: 1px solid var(--dp-border);
  border-radius: var(--dp-radius-sm);
  margin: 20px 0;
  border-collapse: collapse;
}

td {
  padding: 10px;
  border: 1px solid var(--dp-border);
}

/* ------------------------------------------------------------
   Left sidebar navigation
   ------------------------------------------------------------ */

.wrapper {
  display: flex;
  flex-direction: row;
  height: 100%;
  gap: 0;

  @media screen and (max-width: 996px) {
    height: 100%;
    margin: 0;
    padding: 0;
  }
}

.container-left {
  float: left;
  width: 100%;
  max-width: var(--dp-sidebar-width);
  display: flex;
  flex-direction: column;
  height: 100%;

  @media screen and (max-width: 996px) {
    display: none;
  }
}

.container-right {
  float: right;
  height: 100%;
  width: 100%;
  flex-grow: 1;
  overflow-y: auto;
  scrollbar-width: thin;
  position: relative;
}

.toc {
  background: var(--dp-surface);
  overflow-x: hidden;
  border-right: 1px solid var(--dp-border);
  width: 100%;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  height: 100%;
  padding: 16px 12px;
  overflow-y: auto;

  @media screen and (max-width: 996px) {
    display: none;
  }

  .toc-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    flex-grow: 1;
    gap: 2px;
  }

  .toc-link-text {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    height: 100%;
    font-size: 0.875rem;
    font-weight: 450;
    line-height: 1.35;
  }
}

.toc-section {
  display: none;
  flex-direction: column;
  margin-left: 10px;
  padding-left: 10px;
  border-left: 1px solid var(--dp-border);
  gap: 1px;
  transition: all 0.2s ease;
  max-height: 0;
  overflow: hidden;
}

.toc-section.show-toc {
  display: flex;
  max-height: 2000px;
  margin-top: 2px;
  margin-bottom: 6px;
}

.toc-link {
  width: 100%;
  line-height: 1.35;
  color: var(--dp-text-muted);
  font-family: inherit;
  text-decoration: none;
}

.toc-link-h1 {
  font-size: 0.875rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  padding: 7px 10px;
  display: flex;
  align-items: center;
  border-radius: var(--dp-radius);
  color: var(--dp-text);
  transition: background-color 0.12s ease, color 0.12s ease;

  &:hover {
    background-color: var(--dp-hover-bg);
    color: var(--dp-text-strong);
  }

  .toc-link-text {
    margin-left: 0;
  }
}

.toc-link-h1.toc-section-title {
  padding-left: 10px;

  .toc-link-text {
    margin-left: 0;
  }
}

.toc-section-title::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 8px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid var(--dp-text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.active-toc::before {
  transform: rotate(90deg);
  border-left-color: var(--dp-accent);
}

.toc-link-h2 {
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 450;
  text-align: left;
  padding: 6px 10px;
  border-radius: var(--dp-radius-sm);
  color: var(--dp-text-muted);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.toc-link-h2:hover {
  background-color: var(--dp-hover-bg);
  color: var(--dp-text-strong);
}

.toc-link-h1.active-link,
.toc-link-h2.active-link {
  display: flex;
  align-items: center;
  font-weight: 600;
  color: var(--dp-active-text);
  background-color: var(--dp-active-bg);
  border-left: none;
  border-radius: var(--dp-radius);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dp-accent) 25%, transparent);
}

.show-toc {
  display: flex;
}

/* ------------------------------------------------------------
   Right “On this page” TOC
   ------------------------------------------------------------ */

.container-right-toc {
  position: sticky;
  top: 28px;
  width: var(--dp-toc-width);
  max-height: calc(100vh - var(--main-nav-height) - 56px);
  overflow-y: auto;
  scrollbar-width: thin;
  z-index: 10;
  padding: 12px 0 32px;
  margin-top: 28px;
}

.container-right-toc__title {
  margin: 0 0 10px;
  padding: 0 0 0 14px;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--dp-text-muted);
}

.container-right-toc nav.content-toc {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px;
  border-left: 1px solid var(--dp-border);
  padding: 0 0 0 0;
}

.container-right-toc nav.content-toc a {
  display: block !important;
  float: none !important;
  padding: 5px 0 5px 14px;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--dp-text-muted);
  text-decoration: none;
  transition: color 0.12s ease, border-color 0.12s ease;
  width: 100%;
  border-left: 2px solid transparent;
  margin-left: -1px;
}

.container-right-toc nav.content-toc a:hover {
  color: var(--dp-text-strong);
}

.container-right-toc .content-toc-top {
  font-weight: 550;
  color: var(--dp-text);
}

.container-right-toc .content-toc-sub {
  font-weight: 400;
  color: var(--dp-text-muted);
}

@media screen and (max-width: 1200px) {
  .container-right-toc {
    display: none !important;
  }
}

/* Mobile page TOC (build.io-style collapse) */
.mobile-page-toc {
  display: none;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--dp-bg);
  border-bottom: 1px solid var(--dp-border);
  padding: 10px 16px;
}

.mobile-page-toc__toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--dp-border);
  border-radius: 999px;
  background: var(--dp-surface-alt);
  color: var(--dp-text-strong);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 550;
  cursor: pointer;
}

.mobile-page-toc__toggle:hover {
  background: var(--dp-hover-bg);
}

.mobile-page-toc__chevron {
  width: 14px;
  height: 14px;
  transition: transform 0.15s ease;
}

.mobile-page-toc__toggle[aria-expanded="true"] .mobile-page-toc__chevron {
  transform: rotate(90deg);
}

.mobile-page-toc__panel {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 10px;
  padding: 8px 4px 4px;
  border-top: 1px solid var(--dp-border-subtle);
}

.mobile-page-toc__panel[hidden] {
  display: none !important;
}

.mobile-page-toc__panel a {
  display: block;
  padding: 7px 10px;
  border-radius: var(--dp-radius-sm);
  color: var(--dp-text-muted);
  text-decoration: none;
  font-size: 0.875rem;
}

.mobile-page-toc__panel a:hover {
  background: var(--dp-hover-bg);
  color: var(--dp-text-strong);
}

.mobile-page-toc__panel .content-toc-top {
  font-weight: 550;
  color: var(--dp-text);
}

@media screen and (max-width: 1200px) {
  .mobile-page-toc {
    display: block;
  }
}

@media screen and (min-width: 1201px) {
  .mobile-page-toc {
    display: none !important;
  }
}

/* ------------------------------------------------------------
   Footer (sidebar bottom)
   ------------------------------------------------------------ */

.footer {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  flex-shrink: 0;
  width: 100%;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--dp-border);
  background: var(--dp-surface);
  text-align: left;
  margin-top: auto;

  @media screen and (max-width: 996px) {
    display: none;
  }
}

.switch_locale_link,
.support_info {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
  margin-top: 0;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 450;
  line-height: 1.3;
  color: var(--dp-text-muted);
  text-decoration: none;
  padding-left: 0;
}

.support_info img,
.switch_locale_link img {
  opacity: 0.75;
  filter: none;
}

[data-theme="dark"] .support_info img,
[data-theme="dark"] .switch_locale_link img {
  filter: invert(1) brightness(1.2);
  opacity: 0.85;
}

/* ------------------------------------------------------------
   Nav helpers / page tabs
   ------------------------------------------------------------ */

.nav_link,
.nav-link {
  text-decoration: none;
  color: var(--dp-text-strong);
  font-weight: 500;
  font-size: 0.875rem;
  line-height: 1.3;
  padding: 10px 15px;
  font-family: inherit;
}

.nav_link:hover,
.nav-link:hover {
  opacity: 0.75;
}

.active-link {
  background-color: var(--dp-active-bg);
  border-radius: var(--dp-radius);
  color: var(--dp-active-text);
}

.header-nav-list {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin-left: 24px;
  justify-content: space-between;
  align-items: center;
  width: 100%;

  @media screen and (max-width: 996px) {
    display: none;
  }
}

.sub_title {
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  line-height: 1.2;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--dp-text-muted);
}

.doc_group_navlink {
  display: flex;
  gap: 1rem;
  margin-left: 1rem;
}

.doc_navlink {
  display: inline-flex;
  align-items: center;
  padding: 1rem 0;
  color: var(--dp-text-muted);
  text-decoration: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.3;
}

.doc_navlink:hover {
  color: var(--dp-text-strong);
}

.hidden {
  display: none !important;
}

.mobile-nav-list {
  display: none;
}

.mobile-nav-list.mobile-nav-list--active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 20px;
  padding: 30px 0 20px 20px;
  background-color: var(--dp-surface);
  position: fixed;
  z-index: 999;
  width: 100%;
  min-height: 60px;

  a {
    font-size: 0.875rem;
    font-weight: 500;
  }

  .active-link {
    background-color: var(--dp-active-bg);
    border-bottom: 1px solid var(--dp-border);
    box-shadow: none;
  }
}

.nav_navigation-lists {
  line-height: 40px;
}

.page-tabs:not(.page-tabs--in-header) {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--dp-border);
  padding: 0 20px;
  background: var(--dp-bg);
}

.page-tabs:not(.page-tabs--in-header) .page-tab {
  padding: 10px 16px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--dp-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.page-tabs:not(.page-tabs--in-header) .page-tab:hover {
  color: var(--dp-text-strong);
}

.page-tabs:not(.page-tabs--in-header) .page-tab--active {
  color: var(--dp-accent);
  border-bottom-color: var(--dp-accent);
}

/* ------------------------------------------------------------
   Mobile drawer
   ------------------------------------------------------------ */

.header-items {
  display: none;
}

.header-nav-items {
  display: none;
  width: 100%;
}

.header-items--show-mobile {
  display: none;
  flex-direction: column;
  align-items: flex-start;
  position: absolute;
  right: 0;
  top: var(--main-nav-height);
  width: 100%;
  max-width: 420px;
  margin-left: auto;
  background: var(--dp-surface-alt);
  border-left: 1px solid var(--dp-border);
  box-shadow: -8px 16px 40px var(--dp-shadow);
  height: calc(100vh - var(--main-nav-height));
  overflow-y: auto;
  z-index: 1001;

  @media screen and (max-width: 996px) {
    display: flex;
  }

  ul {
    width: 100%;
    padding: 0;
    margin: 0;
  }

  li {
    width: 100%;
    border-bottom: none;
  }

  li:last-child {
    border-bottom: 1px solid var(--dp-border-subtle);
  }

  .nav_link {
    display: block;
    color: var(--dp-text-strong);
    font-size: 0.9375rem;
    transition: background-color 0.15s ease;
    width: 100%;

    &:hover {
      background-color: var(--dp-hover-bg);
    }

    span {
      display: block;
    }
  }

  .header-nav-items {
    display: block;
  }

  .header-mobile-primary-nav {
    display: flex;
    flex-direction: column;
    width: 100%;
    align-items: stretch;
    border-bottom: 1px solid var(--dp-border);
  }

  .header-mobile-drawer__link {
    display: block;
    width: 100%;
    padding: 12px 16px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--dp-border-subtle);
    text-align: left;
  }
}

ul ul {
  .nav_link {
    padding-left: 40px;
    font-size: 0.875rem;
  }
}

.mobile-toggle {
  display: none;
  flex-shrink: 0;

  @media screen and (max-width: 996px) {
    display: block;
    margin-left: 0;
  }
}

.mobile-toggle__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--dp-surface-alt);
  border: 1px solid var(--dp-border);
  border-radius: var(--dp-radius);
  padding: 0;
  cursor: pointer;
}

.mobile-toggle__button img {
  width: 18px;
  height: 18px;
}

[data-theme="dark"] .mobile-toggle__button img {
  filter: invert(1) brightness(1.15);
}

.mobile-toggle--active .mobile-toggle__button {
  background: var(--dp-hover-bg);
  border-color: var(--dp-text-muted);
}

.mobile-toggle__button__icon {
  display: none;
}

.mobile-toggle__button__icon--active {
  display: block;
}

/* ------------------------------------------------------------
   Scroll helpers
   ------------------------------------------------------------ */

.scroll-nojump {
  width: 100%;
}

@media screen and (min-width: 1536px) {
  .scroll-nojump {
    margin-left: var(--scrollbar-width);
    margin-right: 0;
    width: calc(100% - var(--scrollbar-width));
  }

  body:has(.page-full-width) .scroll-nojump {
    margin-left: 0;
    width: 100%;
  }
}
