/*
 * Mutual Trust docs: layout glue for /docs/* pages only. Loaded after /site.css.
 * Visuals come from the Sectigo design system (/ds/css/index.css): this file only arranges the
 * docs navigation, "On this page" list, article column and previous/next links, using semantic
 * tokens. It declares no colors of its own; dark mode follows the DS `dark` class on <html>.
 */

/* ---- Three-column docs layout: navigation · article · on this page ---- */
.wrap.docs-layout {
  max-width: 1360px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0 var(--spacing-2xl);
  align-items: start;
}
@media (min-width: 1024px) {
  .wrap.docs-layout { grid-template-columns: 232px minmax(0, 1fr); }
}

/* The article column reuses the site's `.doc` prose rules without its 860px page cap. */
.doc.docs-main {
  max-width: none;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "toc" "body";
  gap: 0 var(--spacing-2xl);
  align-content: start;
}
@media (min-width: 1280px) {
  .doc.docs-main {
    grid-template-columns: minmax(0, 1fr) 208px;
    grid-template-areas: "head toc" "body toc";
  }
}
.docs-head { grid-area: head; min-width: 0; max-width: 820px; }
.docs-body { grid-area: body; min-width: 0; max-width: 820px; }
.docs-toc { grid-area: toc; min-width: 0; }

/* ---- Left navigation (desktop) ---- */
.docs-nav {
  display: none;
  font-size: var(--body-small-font-size);
  line-height: var(--body-small-line-height);
}
@media (min-width: 1024px) {
  .docs-nav {
    display: block;
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
    padding-block: var(--spacing-2xl);
    padding-right: var(--spacing-sm);
  }
}
.docs-nav__section + .docs-nav__section { margin-top: var(--spacing-lg); }
.docs-nav__heading {
  margin: 0 0 var(--spacing-xs);
  padding-inline: var(--spacing-sm);
  font-family: var(--font-family-body);
  font-size: var(--body-small-font-size);
  line-height: var(--body-small-line-height);
  font-weight: var(--font-weight-body-strong);
  color: var(--text-heading-secondary);
}
.docs-nav ul,
.docs-menu ul,
.docs-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-nav__link {
  display: block;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  border-left: var(--border-width-thick, 2px) solid transparent;
  color: var(--text-body-primary);
  text-decoration: none;
}
.docs-nav__link:hover { background-color: var(--surface-muted-faint); color: var(--text-body-primary); }
.docs-nav__link[aria-current="page"] {
  background-color: var(--surface-selected);
  border-left-color: var(--border-action-primary);
  font-weight: var(--font-weight-body-strong);
}
.docs-nav__link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 1px; }

/* ---- Navigation disclosure (below 1024px) ---- */
.docs-menu {
  margin-top: var(--spacing-lg);
  border: var(--border-width-thin) solid var(--border-default-subtle);
  border-radius: var(--radius-md);
  background-color: var(--surface-primary);
}
@media (min-width: 1024px) { .docs-menu { display: none; } }
.docs-menu > summary {
  cursor: pointer;
  padding: var(--spacing-sm) var(--spacing-lg);
  font-weight: var(--font-weight-body-strong);
  color: var(--text-heading-secondary);
}
.docs-menu > summary:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: var(--radius-md); }
.docs-menu__body { padding: 0 var(--spacing-sm) var(--spacing-lg); }

/* ---- On this page ---- */
.docs-toc {
  margin-top: var(--spacing-lg);
  padding: var(--spacing-md) var(--spacing-lg);
  border: var(--border-width-thin) solid var(--border-default-subtle);
  border-radius: var(--radius-md);
  font-size: var(--body-small-font-size);
  line-height: var(--body-small-line-height);
}
@media (min-width: 1280px) {
  .docs-toc {
    position: sticky;
    top: 0;
    margin-top: 0;
    padding: var(--spacing-2xl) 0 var(--spacing-lg) var(--spacing-lg);
    border: 0;
    border-left: var(--border-width-thin) solid var(--border-default-subtle);
    border-radius: 0;
    max-height: 100vh;
    overflow-y: auto;
  }
}
.docs-toc__title {
  margin: 0 0 var(--spacing-xs);
  font-weight: var(--font-weight-body-strong);
  color: var(--text-heading-secondary);
}
.docs-toc li + li { margin-top: var(--spacing-xs); }
.docs-toc a { color: var(--text-body-primary); text-decoration: none; }
.docs-toc a:hover { text-decoration: underline; }

/* ---- Article ---- */
.docs-lede { font-size: var(--body-large-font-size); max-width: 72ch; }
.docs-labels { display: flex; flex-wrap: wrap; gap: var(--spacing-sm); margin-bottom: var(--spacing-md); }
.docs-body > :where(ul, ol) { padding-left: var(--spacing-xl); margin-bottom: var(--body-regular-paragraph-spacing); }
.docs-body > :where(ul, ol) > li + li { margin-top: var(--body-regular-list-spacing); }
.docs-body :where(li) > :where(ul, ol) { padding-left: var(--spacing-xl); margin-top: var(--spacing-xs); }
.docs-body :where(.admonition, .code-block, .data-table) { margin-block: var(--spacing-lg); }
/* Links inside admonitions take the message colour (contrast on every admonition tint, both themes). */
.docs-body .admonition__message a { color: inherit; text-decoration: underline; text-underline-offset: 0.15em; }
.docs-body h3 {
  margin-top: var(--spacing-xl);
  font-size: var(--heading-h4-font-size);
  line-height: var(--heading-h4-line-height);
}
.docs-body h4 {
  margin-top: var(--spacing-lg);
  font-size: var(--heading-h5-font-size);
  line-height: var(--heading-h5-line-height);
}
.docs-body :where(h2, h3, h4) { scroll-margin-top: var(--spacing-lg); }
.docs-body :where(h3, h4) > code { font-size: 0.85em; }
.docs-method {
  display: inline-block;
  min-width: 4.5ch;
  margin-right: var(--spacing-xs);
  font-family: "DM Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8em;
  color: var(--text-heading-secondary);
}
.docs-dl dt { font-weight: var(--font-weight-body-strong); margin-top: var(--spacing-md); }
.docs-dl dd { margin: var(--spacing-xs) 0 0 var(--spacing-lg); }

/* Cards on the docs home: stretch to equal height, title is the link. */
.docs-cards { list-style: none; padding: 0; margin-block: var(--spacing-lg); }
.docs-cards > li { display: flex; }
.docs-card { width: 100%; }
.docs-card__link { color: inherit; text-decoration: none; }
.docs-card__link:hover { text-decoration: underline; }
.docs-card__link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; border-radius: var(--radius-xs); }

/* ---- Previous / next ---- */
.docs-pager {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  gap: var(--spacing-lg);
  margin-top: calc(var(--spacing-2xl) * 1.5);
  padding-top: var(--spacing-xl);
  border-top: var(--border-width-thin) solid var(--border-default-subtle);
}
.docs-pager__link {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  padding: var(--spacing-md) var(--spacing-lg);
  border: var(--border-width-thin) solid var(--border-default-subtle);
  border-radius: var(--radius-md);
  color: var(--text-body-primary);
  text-decoration: none;
}
.docs-pager__link:hover { border-color: var(--border-action-primary); color: var(--text-body-primary); }
.docs-pager__link:focus-visible { outline: 2px solid var(--border-focus); outline-offset: 2px; }
.docs-pager__link--next { text-align: right; grid-column: -2 / -1; }
.docs-pager__dir { font-size: var(--body-small-font-size); line-height: var(--body-small-line-height); color: var(--text-body-secondary); }
.docs-pager__title { font-weight: var(--font-weight-body-strong); color: var(--text-action-primary); }
