/* MOMDYN docs: layout and content styles. Colors, fonts, the nav and the footer come from /styles.css. */

.docs-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 3rem; padding-top: 1.25rem; padding-bottom: 3rem; }
.doc { min-width: 0; max-width: 46rem; }
.docs-side, .docs-toc { display: none; }
.skip { z-index: 60; }

/* ---- Sidebar tree (also used in the mobile menu) ---- */
.docs-tree, .docs-tree ul { list-style: none; margin: 0; padding: 0; }
.docs-tree ul { margin-left: 0.85rem; padding-left: 0.6rem; border-left: 1px solid var(--separator); }
.docs-tree a, .docs-tree summary {
  display: block; min-height: 2.75rem; padding: 0.55rem 0.5rem; border-radius: 10px;
  color: var(--label); text-decoration: none; font-size: 0.97rem; line-height: 1.35;
}
.docs-tree a:hover, .docs-tree summary:hover { background: var(--bg-secondary); }
.docs-tree a[aria-current="page"] { color: var(--green-text); font-weight: 700; background: var(--bg-secondary); }
.docs-tree .ext { color: var(--label-secondary); }
.docs-tree details { border: 0; }
.docs-tree summary { cursor: pointer; list-style: none; font-weight: 650; display: flex; align-items: center; justify-content: space-between; min-height: 2.75rem; padding: 0.55rem 0.5rem; position: static; }
.docs-tree summary::-webkit-details-marker { display: none; }

@media (min-width: 56rem) {
  .docs-layout { grid-template-columns: 17rem minmax(0, 1fr); }
  .docs-side { display: block; position: sticky; top: 4rem; align-self: start; max-height: calc(100svh - 5rem); overflow-y: auto; padding-right: 0.5rem; }
}
@media (min-width: 76rem) {
  .docs-layout { grid-template-columns: 17rem minmax(0, 46rem) 14rem; }
  .docs-toc { display: block; position: sticky; top: 4rem; align-self: start; max-height: calc(100svh - 5rem); overflow-y: auto; font-size: 0.9rem; }
}

/* ---- Right rail: on this page ---- */
.docs-toc[hidden] { display: none !important; }
.docs-toc .toc-title { margin: 0 0 0.5rem; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--label-secondary); }
.docs-toc ul { list-style: none; margin: 0; padding: 0; }
.docs-toc a { display: block; padding: 0.3rem 0; color: var(--label-secondary); text-decoration: none; line-height: 1.35; }
.docs-toc a:hover { color: var(--green-text); }
.docs-toc ul ul { margin-left: 0.8rem; }

/* ---- Content ---- */
.crumbs { margin: 0 0 0.75rem; font-size: 0.9rem; color: var(--label-secondary); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; margin: 0; padding: 0; }
.crumbs li + li::before { content: "/"; margin-right: 0.5rem; color: var(--separator); }
.crumbs a { color: var(--label-secondary); }
.doc h1 { font-size: clamp(2rem, 6vw, 2.8rem); margin: 0 0 1.25rem; }
.doc h2 { font-size: 1.6rem; margin: 2.5rem 0 0.75rem; scroll-margin-top: 4.5rem; }
.doc h3 { font-size: 1.25rem; margin: 2rem 0 0.5rem; scroll-margin-top: 4.5rem; }
.doc h4 { font-size: 1.05rem; margin: 1.5rem 0 0.4rem; }
.doc p, .doc li { line-height: 1.65; }
.doc p { margin: 0 0 1rem; }
.doc ul, .doc ol { padding-left: 1.4rem; margin: 0 0 1rem; }
.doc hr { border: 0; border-top: 1px solid var(--separator); margin: 2rem 0; }
.doc code { font: 0.9em var(--mono); background: var(--bg-secondary); padding: 0.1em 0.35em; border-radius: 6px; }
.doc sub { line-height: 0; }

/* Sphinx toctree lists rendered inside a page */
.toctree { margin: 0 0 1.25rem; padding: 0.9rem 1.1rem; background: var(--bg-secondary); border-radius: 16px; }
.toctree .caption { margin: 0 0 0.4rem; font-weight: 700; font-size: 0.85rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--label-secondary); }
.toctree ul { margin: 0; padding-left: 1.1rem; }
.toctree li { line-height: 1.7; }

/* Images and animated demos */
.shots { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: flex-start; margin: 0 0 1.25rem; }
.shots img, .shots video { max-width: 100%; height: auto; border-radius: 14px; background: var(--bg-secondary); box-shadow: 0 0 0 1px var(--separator); }

/* Parameter blocks (generated reference pages) */
.param { padding: 0.9rem 0; border-top: 1px solid var(--separator); }
.param:last-of-type { border-bottom: 1px solid var(--separator); }
.param p { margin: 0.3rem 0 0; color: var(--label-secondary); }
.param .pname { font: 700 1rem var(--mono); color: var(--label); }
.param .ptype { margin-left: 0.6rem; font-size: 0.85rem; font-weight: 600; color: var(--green-text); }

/* Previous / next */
.pager { display: grid; gap: 0.75rem; margin-top: 3rem; }
.pager a { display: flex; flex-direction: column; justify-content: center; min-height: 4rem; padding: 0.8rem 1.1rem; border-radius: 16px; background: var(--bg-secondary); color: var(--label); text-decoration: none; }
.pager a span { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--label-secondary); }
.pager a b { font-size: 1.05rem; }
.pager .next { text-align: right; }
.pager a:hover { filter: brightness(0.97); }
@media (min-width: 40rem) { .pager { grid-template-columns: 1fr 1fr; } .pager .next { grid-column: 2; } }

.site-footer { padding-bottom: 2.5rem; }

.doc > section:first-of-type > h2:first-child, .doc > h1 + * > h2:first-child { margin-top: 1rem; }
.docs-tree summary::after { content: ""; width: 0.5rem; height: 0.5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); margin-right: 0.3rem; }
.docs-tree details[open] > summary::after { transform: rotate(45deg); }

/* ---- Collapsible side panels: round icon buttons fixed at the page edges, animated column widths ---- */
.doc-tools { display: none; }
@media (min-width: 56rem) {
  .docs-layout {
    --side: 17rem; --toc: 0rem; column-gap: 0; padding-top: 3.5rem;
    grid-template-columns: var(--side) minmax(0, 1fr) var(--toc);
    transition: grid-template-columns 0.3s ease;
  }
  .docs-layout.no-side { --side: 0rem; }
  .docs-layout.no-toc, .docs-layout:has(.docs-toc[hidden]) { --toc: 0rem; }
  .doc { max-width: none; }

  .doc-tools { display: block; grid-column: 1 / -1; position: sticky; top: 4.25rem; height: 0; z-index: 20; margin-top: -2.75rem; }
  .doc-tools .tool { position: absolute; top: 0; width: 2.75rem; height: 2.75rem; padding: 0; display: grid; place-items: center; border: 1px solid var(--separator); border-radius: 50%; background: var(--bg-secondary); color: var(--label); cursor: pointer; transition: background 0.2s; }
  .doc-tools #toggle-side { left: 0; }
  .doc-tools #toggle-toc { right: 0; display: none; }
  .doc-tools .tool:hover { color: var(--green-text); }
  .doc-tools .tool[aria-expanded="false"] { background: var(--bg); }

  /* Panels keep their width while the track animates; they are clipped, then faded. */
  .docs-side, .docs-toc {
    display: block; position: sticky; top: 4.5rem; align-self: start; max-height: calc(100svh - 5.5rem);
    min-width: 0; overflow-x: hidden; overflow-y: auto; opacity: 1; visibility: visible;
    transition: opacity 0.2s ease, visibility 0s;
  }
  .docs-side > nav { width: 15rem; }
  .docs-toc > nav { width: 14rem; margin-left: 2rem; }
  .docs-layout.no-side .docs-side, .docs-layout.no-toc .docs-toc { opacity: 0; visibility: hidden; transition: opacity 0.15s ease, visibility 0s 0.3s; }
  .docs-toc { display: none; }
}
@media (min-width: 76rem) {
  .docs-layout { --toc: 16rem; }
  .docs-toc:not([hidden]) { display: block; }
  .docs-layout.no-toc, .docs-layout:has(.docs-toc[hidden]) { --toc: 0rem; }
  .doc-tools #toggle-toc:not([hidden]) { display: grid; }
}
@media (prefers-reduced-motion: reduce) {
  .docs-layout, .docs-side, .docs-toc { transition: none !important; }
}

/* Undo landing-page section styling inside docs content */
.doc section { padding: 0; }
.doc section h2 { font-size: 1.6rem; margin: 2.25rem 0 0.75rem; }
.doc section section h2 { font-size: 1.25rem; margin-top: 1.75rem; }
.doc section:first-of-type > h2:first-child { margin-top: 0.5rem; }
.doc .crumbs ol { padding: 0; }

/* ---- Mobile: menu button in the nav bar opens a drawer from the left ---- */
.nav-menu { flex: none; width: 2.75rem; height: 2.75rem; margin-left: -0.35rem; display: grid; place-items: center; padding: 0; border: 1px solid var(--separator); border-radius: 50%; background: var(--bg-secondary); color: var(--label); cursor: pointer; }
.nav-menu[aria-expanded="true"] { color: var(--green-text); }
.scrim { position: fixed; inset: 3.5rem 0 0; z-index: 44; background: rgb(0 0 0 / 0.4); opacity: 0; transition: opacity 0.3s ease; }
body.drawer-open .scrim { opacity: 1; }
@media (max-width: 55.99rem) {
  .docs-side {
    display: block; position: fixed; z-index: 45; top: 3.5rem; bottom: 0; left: 0; width: min(20rem, 86vw);
    padding: 0.75rem 1rem 2rem; overflow-y: auto; background: var(--bg); border-right: 1px solid var(--separator);
    transform: translateX(-100%); visibility: hidden; transition: transform 0.3s ease, visibility 0s 0.3s;
  }
  body.drawer-open .docs-side { transform: none; visibility: visible; transition: transform 0.3s ease, visibility 0s; }
  body.drawer-open { overflow: hidden; }
}
@media (min-width: 56rem) { .nav-menu, .scrim { display: none; } }
@media (prefers-reduced-motion: reduce) { .scrim, .docs-side { transition: none !important; } }

/* ================= Docs upgrade: search, anchors, tables, equations, cards ================= */

/* ---- Search button (nav) and dialog ---- */
.search-btn { margin-left: auto; display: inline-flex; align-items: center; gap: 0.5rem; min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.8rem; border: 1px solid var(--separator); border-radius: 999px; background: var(--bg-secondary); color: var(--label); font: 500 0.95rem var(--sans); cursor: pointer; justify-content: center; }
.search-btn:hover { color: var(--green-text); }
.search-label, .search-kbd { display: none; }
@media (min-width: 48rem) {
  .search-btn { margin-left: 0.5rem; }
  .search-label { display: inline; }
}
@media (min-width: 64rem) { .search-kbd { display: inline; font: 600 0.78rem var(--sans); color: var(--label-secondary); padding: 0.1rem 0.4rem; border: 1px solid var(--separator); border-radius: 6px; } }
.search-dialog { width: min(40rem, calc(100vw - 1.5rem)); max-height: min(36rem, calc(100svh - 3rem)); margin: 4rem auto auto; padding: 0; border: 1px solid var(--separator); border-radius: 18px; background: var(--bg); color: var(--label); overflow: hidden; }
.search-dialog[open] { display: flex; flex-direction: column; }
.search-dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.search-head { display: flex; justify-content: space-between; align-items: center; padding: 0.5rem 0.75rem 0.5rem 1.25rem; font-weight: 650; border-bottom: 1px solid var(--separator); }
.search-close { width: 2.75rem; height: 2.75rem; border: 0; border-radius: 50%; background: transparent; color: var(--label); font-size: 1.6rem; cursor: pointer; }
#search-box { padding: 1rem 1.25rem 1.25rem; overflow-y: auto;
  --pagefind-ui-scale: 0.95; --pagefind-ui-primary: var(--green-text); --pagefind-ui-text: var(--label); --pagefind-ui-background: var(--bg);
  --pagefind-ui-border: var(--separator); --pagefind-ui-tag: var(--bg-secondary); --pagefind-ui-border-width: 1px; --pagefind-ui-border-radius: 12px; --pagefind-ui-font: var(--sans); }
#search-box .pagefind-ui__result-link { color: var(--green-text); }
#search-box mark { background: color-mix(in srgb, var(--green) 30%, transparent); color: inherit; }

/* ---- Heading anchors ---- */
.doc h2, .doc h3, .doc h4 { position: relative; }
.anchor { display: inline-block; width: 1.1em; height: 1.1em; margin-left: 0.35em; vertical-align: -0.1em; opacity: 0; background: var(--label-secondary);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-1 1'/%3E%3Cpath d='M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l1-1'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7 0l3-3a5 5 0 0 0-7-7l-1 1'/%3E%3Cpath d='M14 11a5 5 0 0 0-7 0l-3 3a5 5 0 0 0 7 7l1-1'/%3E%3C/svg%3E") center / contain no-repeat; }
.doc h2:hover .anchor, .doc h3:hover .anchor, .doc h4:hover .anchor, .anchor:focus { opacity: 1; }
@media (hover: none) { .anchor { opacity: 0.5; } }

/* ---- On this page ---- */
.docs-toc a[aria-current="true"] { color: var(--green-text); font-weight: 650; }
.docs-toc ul ul a { font-size: 0.86rem; }
.toc-mobile { margin: 0 0 1.25rem; border-radius: 14px; background: var(--bg-secondary); }
.toc-mobile > summary { min-height: 2.75rem; padding: 0.6rem 1rem; font-weight: 650; cursor: pointer; display: flex; align-items: center; justify-content: space-between; list-style: none; }
.toc-mobile > summary::-webkit-details-marker { display: none; }
.toc-mobile > summary::after { content: ""; width: 0.5rem; height: 0.5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-right: 0.3rem; transition: transform 0.15s; }
.toc-mobile[open] > summary::after { transform: rotate(-135deg); }
.toc-mobile nav { padding: 0 1rem 0.75rem; }
.toc-mobile .toc-title { display: none; }
.toc-mobile ul { list-style: none; margin: 0; padding: 0; }
.toc-mobile ul ul { margin-left: 0.9rem; }
.toc-mobile a { display: block; min-height: 2.5rem; padding: 0.5rem 0; color: var(--label); text-decoration: none; }
@media (min-width: 76rem) { .toc-mobile { display: none; } }

/* ---- Sidebar footer ---- */
.side-cta { margin: 1.25rem 0.5rem 0; padding-top: 1rem; border-top: 1px solid var(--separator); }
.side-cta .store-badge img { width: 132px; height: 44px; }
.side-cta p { margin: 0.4rem 0 0; font-size: 0.85rem; color: var(--label-secondary); }

/* ---- Content blocks ---- */
.doc pre:not(.code) { margin: 0 0 1.25rem; padding: 1rem; overflow-x: auto; border-radius: 14px; background: #1C1C1E; color: #fff; font: 0.8125rem/1.55 var(--mono); }
.doc pre code, .doc pre.code code { background: none; padding: 0; border-radius: 0; }
.doc pre.code { margin-bottom: 1.25rem; }
.code-caption { margin: 0 0 0.4rem; font-size: 0.9rem; color: var(--label-secondary); }
.equation { margin: 0 0 1.25rem; padding: 0.9rem 1rem; overflow-x: auto; border-radius: 14px; background: var(--bg-secondary); text-align: center; }
.equation .katex-display { margin: 0; }
.tex .katex { font-size: 1.05em; }
.doc video.demo { max-width: 100%; height: auto; border-radius: 14px; background: var(--bg-secondary); box-shadow: 0 0 0 1px var(--separator); }
.doc kbd { font: 600 0.85em var(--sans); padding: 0.1em 0.4em; border: 1px solid var(--separator); border-radius: 6px; }
.diagram-slot { display: grid; place-items: center; align-content: center; gap: 0.4rem; margin: 0 0 1.25rem; min-height: 11rem; border: 1.5px dashed var(--separator); border-radius: 16px; color: var(--label-secondary); background: var(--bg-secondary); }
.diagram-slot figcaption { font-size: 0.9rem; }
.todo { display: inline-block; padding: 0 0.4rem; border-radius: 6px; background: color-mix(in srgb, #FF9F0A 28%, transparent); color: var(--label); font: 700 0.75rem var(--sans); letter-spacing: 0.04em; }
.dash { color: var(--label-secondary); }

/* ---- Parameter tables ---- */
.table-wrap { margin: 0 0 1.5rem; overflow-x: auto; border: 1px solid var(--separator); border-radius: 14px; }
table.params { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
table.params th, table.params td { padding: 0.65rem 0.8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--separator); }
table.params thead th { position: sticky; top: 0; background: var(--bg-secondary); font-size: 0.8rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--label-secondary); white-space: nowrap; }
table.params tbody tr:last-child > * { border-bottom: 0; }
table.params code { font: 0.88em var(--mono); background: var(--bg-secondary); padding: 0.1em 0.35em; border-radius: 6px; white-space: nowrap; }
table.params tbody th { font-weight: 600; }
@media (max-width: 47.99rem) {
  table.params thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  table.params, table.params tbody, table.params tr, table.params th, table.params td { display: block; }
  table.params tr { padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--separator); }
  table.params tbody tr:last-child { border-bottom: 0; }
  table.params th, table.params td { padding: 0.15rem 0; border: 0; }
  table.params td::before { content: attr(data-label) ": "; font-size: 0.8rem; font-weight: 700; color: var(--label-secondary); }
  table.params td:last-child::before { content: none; }
}

/* ---- End-of-tutorial card ---- */
.cta-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; margin: 2.5rem 0 1rem; padding: 1.25rem 1.5rem; border-radius: 20px; background: var(--bg-secondary); border: 1px solid var(--separator); }
.cta-title { margin: 0; font-size: 1.2rem; font-weight: 750; letter-spacing: -0.01em; }
.cta-sub { margin: 0.3rem 0 0.6rem; color: var(--label-secondary); }
.cta-next { font-weight: 650; }
.cta-card .store-badge img { width: 140px; height: 47px; }

/* ---- Docs home hub ---- */
.hub { display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 1.5rem 0 2rem; padding: 0; list-style: none; }
@media (min-width: 40rem) { .hub { grid-template-columns: 1fr 1fr; } }
.hub li { margin: 0; }
.hub a { display: flex; flex-direction: column; gap: 0.35rem; height: 100%; padding: 1.1rem 1.2rem; border-radius: 18px; background: var(--bg-secondary); border: 1px solid transparent; color: var(--label); text-decoration: none; }
.hub a:hover { border-color: var(--green-text); }
.hub .ico { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 12px; background: var(--indigo); color: #fff; }
.hub b { font-size: 1.1rem; }
.hub span.sub { color: var(--label-secondary); line-height: 1.45; }
.hub .more { margin-top: auto; padding-top: 0.2rem; font-size: 0.9rem; color: var(--green-text); font-weight: 600; }
.doc-hero { display: block; max-width: 100%; height: auto; margin: 0 0 1.25rem; border-radius: 16px; box-shadow: 0 0 0 1px var(--separator); }
.lede { font-size: 1.15rem; color: var(--label-secondary); }

/* The landing page's FAQ summary markers (+ / -) must not leak into the docs chevrons */
.docs-tree summary::after, .docs-tree details[open] > summary::after, .toc-mobile > summary::after, .toc-mobile[open] > summary::after { content: ""; position: static; font-size: inherit; }
.doc .hub { padding: 0; }
