/* ============================================
   ORGANISMS - UMU documentation page (/product/umu/documentation)
   Loaded only on this page. The layout sits inside the shared content band (same width as the menu):
   the section wrapper is full width, a sticky contents column on the left, the article on the right.
   The documentation body is generated (main/Tools/build_umu_docs.py): chapters, tables, highlighted code and figures.
   ============================================ */

.umu-docs-page {
    --umd-bg-code: #0d1117;
    --umd-code-border: rgba(62, 230, 212, 0.22);
    --umd-text: #d6d6d6;
    --umd-muted: #9aa0a6;
    --umd-offset: calc(var(--header-actual-height, 105px) + var(--cookie-banner-height, 0px) + 16px);
    /* code palette, contrast against #0d1117 is at least 6:1 */
    --tk-k: #ff7b72;
    --tk-t: #79c0ff;
    --tk-m: #d2a8ff;
    --tk-s: #a5d6ff;
    --tk-n: #ffa657;
    --tk-c: #8b949e;
    --tk-a: #7ee787;
    --tk-p: #b1bac4;
}

/* Header */
.umd-header-lead { max-width: 760px; }
.umd-lang-note {
    display: inline-block; margin: 0 auto 1.4rem; padding: 0.35rem 1rem; border-radius: 999px;
    font-size: 0.85rem; color: var(--umd-muted); border: 1px solid var(--umu-line); background: var(--umu-card);
}

/* Layout: contents column and article */
.umd-section { padding-top: 1.5rem; }
.umd-layout {
    display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 2.4rem; align-items: start;
    width: 100%; max-width: none; margin-inline: 0; padding-inline: 0;
}
.umd-sidebar {
    position: sticky; top: var(--umd-offset);
    max-height: calc(100vh - var(--umd-offset) - 1rem); overflow-y: auto; overscroll-behavior: contain;
    padding-right: 0.4rem; scrollbar-width: thin;
}
.umd-article { min-width: 0; color: var(--umd-text); font-size: 1rem; line-height: 1.75; }

/* Search */
.umd-search { position: relative; margin-bottom: 1rem; }
.umd-search input {
    width: 100%; box-sizing: border-box; padding: 0.6rem 0.9rem; border-radius: 10px; font: inherit; font-size: 0.92rem;
    color: #fff; background: #151a1d; border: 1px solid var(--umu-line);
}
.umd-search input:focus-visible { outline: 2px solid var(--umu-accent); outline-offset: 1px; }
.umd-results {
    list-style: none; margin: 0.4rem 0 0; padding: 0.3rem; display: none; border-radius: 10px;
    background: #12171a; border: 1px solid var(--umu-line); max-height: 60vh; overflow-y: auto;
}
.umd-results.is-open { display: block; }
.umd-results a { display: block; padding: 0.5rem 0.6rem; border-radius: 8px; color: #e8e8e8; text-decoration: none; font-size: 0.88rem; line-height: 1.4; }
.umd-results a:hover, .umd-results a:focus-visible, .umd-results a.is-selected { background: rgba(62, 230, 212, 0.12); outline: none; }
.umd-results small { display: block; color: var(--umd-muted); font-size: 0.78rem; margin-top: 0.1rem; }
.umd-results mark { background: rgba(255, 154, 60, 0.3); color: inherit; border-radius: 3px; }
.umd-results-empty { padding: 0.6rem; color: var(--umd-muted); font-size: 0.88rem; }

/* Contents */
.umd-toc-toggle {
    display: none; width: 100%; margin-bottom: 0.8rem; padding: 0.65rem 1rem; border-radius: 10px; cursor: pointer; text-align: left;
    font: inherit; font-weight: 600; color: #fff; background: var(--umu-card); border: 1px solid var(--umu-line);
}
.umd-toc ul { list-style: none; margin: 0; padding: 0; }
.umd-toc > ul > li { margin: 0.1rem 0; }
.umd-toc a {
    display: block; padding: 0.3rem 0.6rem; border-left: 2px solid transparent; border-radius: 0 8px 8px 0;
    color: #a9aeb3; font-size: 0.88rem; line-height: 1.4; text-decoration: none; overflow-wrap: anywhere;
}
.umd-toc a:hover, .umd-toc a:focus-visible { color: #fff; background: rgba(255, 255, 255, 0.04); outline: none; }
.umd-toc .umd-toc-ch > a { font-weight: 600; color: #cfd3d6; }
.umd-toc .umd-toc-no { color: var(--umu-accent); margin-right: 0.35rem; font-variant-numeric: tabular-nums; }
.umd-toc ul ul { margin: 0.1rem 0 0.4rem 0.7rem; display: none; border-left: 1px solid rgba(255, 255, 255, 0.08); }
.umd-toc li.is-open > ul { display: block; }
.umd-toc ul ul a { font-size: 0.82rem; }
.umd-toc ul ul ul a { font-size: 0.78rem; opacity: 0.9; }
.umd-toc a.is-active { color: #fff; border-left-color: var(--umu-accent); background: rgba(62, 230, 212, 0.1); }

/* Intro and chapters */
.umd-intro p, .umd-intro ul { max-width: 78ch; }
.umd-intro { margin-bottom: 1.2rem; }
.umd-chapter { margin-bottom: 3.2rem; scroll-margin-top: var(--umd-offset); }
.umd-article p { margin: 0 0 1rem; max-width: 80ch; }
.umd-article ul, .umd-article ol { margin: 0 0 1.1rem; padding-left: 1.5rem; max-width: 80ch; }
.umd-article li { margin: 0.3rem 0; }
.umd-article li::marker { color: var(--umu-accent); }
.umd-article strong { color: #fff; }
.umd-article a { color: var(--umu-accent); }
.umd-article code {
    font-family: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, Menlo, monospace; font-size: 0.86em;
    background: rgba(62, 230, 212, 0.09); border: 1px solid rgba(62, 230, 212, 0.18); border-radius: 6px; padding: 0.08em 0.4em;
    overflow-wrap: anywhere; color: #e9fffb;
}

/* Headings. The global section title underline is switched off here (knowledge graph P7/P9). */
body.umu-docs-page section .umd-article h2.umd-h2::after,
body.umu-docs-page section .umd-article h3.umd-h3::after,
body.umu-docs-page section .umd-article h4.umd-h4::after { content: none; display: none; }
.umd-article .umd-h2, .umd-article .umd-h3, .umd-article .umd-h4 {
    position: relative; text-align: left; color: #fff; line-height: 1.3; scroll-margin-top: var(--umd-offset);
    white-space: normal; text-wrap: wrap; overflow-wrap: anywhere;
}
.umd-article .umd-h2 { font-size: clamp(1.6rem, 2.2vw + 0.8rem, 2.2rem); margin: 0 0 1.1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--umu-line); background: none; -webkit-text-fill-color: currentColor; }
.umd-article .umd-h3 { font-size: clamp(1.25rem, 1vw + 0.9rem, 1.55rem); margin: 2.4rem 0 0.9rem; color: var(--umu-accent); }
.umd-article .umd-h4 { font-size: 1.08rem; margin: 2rem 0 0.7rem; color: #eaeaea; }
.umd-no { color: var(--umu-accent); margin-right: 0.2rem; }
.umd-anchor {
    margin-left: 0.4rem; font-weight: 400; text-decoration: none; opacity: 0; color: var(--umd-muted) !important; transition: opacity 0.15s;
}
.umd-h2:hover .umd-anchor, .umd-h3:hover .umd-anchor, .umd-h4:hover .umd-anchor, .umd-anchor:focus-visible { opacity: 1; }
.umd-top-wrap { margin: 1.6rem 0 0; text-align: right; }
.umd-top { font-size: 0.85rem; text-decoration: none; }
.umd-top:empty { display: none; }

/* Tables */
.umd-table-wrap {
    margin: 0 0 1.6rem; overflow-x: auto; border: 1px solid var(--umu-line); border-radius: 12px; background: rgba(255, 255, 255, 0.015);
    -webkit-overflow-scrolling: touch;
}
.umd-table-wrap:focus-visible { outline: 2px solid var(--umu-accent); outline-offset: 2px; }
.umd-table-wrap table { width: 100%; border-collapse: collapse; min-width: 640px; font-size: 0.92rem; line-height: 1.55; }
.umd-table-wrap th {
    position: sticky; top: 0; text-align: left; white-space: nowrap; padding: 0.7rem 0.9rem; color: #fff; font-weight: 700;
    background: #12302f; border-bottom: 1px solid var(--umu-line);
}
.umd-table-wrap td { padding: 0.65rem 0.9rem; vertical-align: top; border-top: 1px solid rgba(255, 255, 255, 0.06); overflow-wrap: anywhere; }
.umd-table-wrap td:first-child { font-weight: 600; color: #fff; min-width: 9rem; }
.umd-table-wrap tbody tr:nth-child(even) { background: rgba(255, 255, 255, 0.025); }
.umd-table-wrap tbody tr:hover { background: rgba(62, 230, 212, 0.05); }

/* Code */
.umd-code { margin: 0 0 1.6rem; border: 1px solid var(--umd-code-border); border-radius: 12px; background: var(--umd-bg-code); overflow: hidden; }
.umd-code-head {
    display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; padding: 0.35rem 0.5rem 0.35rem 0.9rem;
    background: rgba(255, 255, 255, 0.04); border-bottom: 1px solid var(--umd-code-border);
}
.umd-code-lang { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--umd-muted); }
.umd-copy {
    cursor: pointer; font: inherit; font-size: 0.8rem; padding: 0.25rem 0.8rem; border-radius: 8px; color: #e8e8e8;
    background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.16);
}
.umd-copy:empty { display: none; }
.umd-copy:hover, .umd-copy:focus-visible { background: rgba(62, 230, 212, 0.16); border-color: var(--umu-accent); outline: none; }
.umd-copy.is-done { color: #0b1a18; background: var(--umu-accent); border-color: var(--umu-accent); }
.umd-code pre { margin: 0; padding: 1rem 1.1rem; overflow-x: auto; tab-size: 4; color: #e6edf3; }
.umd-code pre:focus-visible { outline: 2px solid var(--umu-accent); outline-offset: -2px; }
.umd-code pre code {
    display: block; padding: 0; border: 0; border-radius: 0; background: none; color: inherit; font-size: 0.86rem; line-height: 1.6;
    white-space: pre; overflow-wrap: normal;
}
.tk-k { color: var(--tk-k); }
.tk-t { color: var(--tk-t); }
.tk-m { color: var(--tk-m); }
.tk-s { color: var(--tk-s); }
.tk-n { color: var(--tk-n); }
.tk-c { color: var(--tk-c); font-style: italic; }
.tk-a { color: var(--tk-a); }
.tk-p { color: var(--tk-p); }

/* Figures */
.umd-single, .umd-gallery { margin: 0 0 1.6rem; }
.umd-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1rem; align-items: start; }
.umd-figure { margin: 0; padding: 0.6rem; background: #14181a; border: 1px solid var(--umu-line); border-radius: 12px; }
.umd-single .umd-figure { display: inline-block; max-width: 100%; }
.umd-lightbox { display: block; cursor: zoom-in; border-radius: 8px; overflow: hidden; }
.umd-lightbox:focus-visible { outline: 2px solid var(--umu-accent); outline-offset: 2px; }
.umd-figure img { display: block; max-width: 100%; height: auto; margin-inline: auto; border-radius: 6px; }
.umd-figure figcaption { padding: 0.55rem 0.3rem 0.1rem; font-size: 0.82rem; line-height: 1.45; color: var(--umd-muted); text-align: center; }

/* Lightbox */
.umd-lb {
    position: fixed; inset: 0; z-index: 2147481000; display: none; align-items: center; justify-content: center; flex-direction: column;
    gap: 0.8rem; padding: 1rem; background: rgba(0, 0, 0, 0.92);
}
.umd-lb.is-open { display: flex; }
.umd-lb img { max-width: 94vw; max-height: 80vh; width: auto; height: auto; border-radius: 8px; background: #111; }
.umd-lb-cap { max-width: 90vw; color: #d6d6d6; font-size: 0.92rem; text-align: center; }
.umd-lb button {
    position: absolute; cursor: pointer; font: inherit; font-size: 1.4rem; line-height: 1; width: 44px; height: 44px; border-radius: 50%; color: #fff;
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.3);
}
.umd-lb button:hover, .umd-lb button:focus-visible { background: rgba(62, 230, 212, 0.3); outline: none; }
.umd-lb-close { top: 1rem; right: 1rem; }
.umd-lb-prev { left: 1rem; top: 50%; }
.umd-lb-next { right: 1rem; top: 50%; }

/* Tablet and phone: the contents become a collapsible block above the article */
@media (max-width: 960px) {
    .umd-layout { grid-template-columns: minmax(0, 1fr); gap: 1.2rem; }
    .umd-sidebar { position: static; max-height: none; overflow: visible; padding-right: 0; }
    .umd-toc-toggle { display: block; }
    .umd-toc { display: none; max-height: 55vh; overflow-y: auto; margin-bottom: 0.8rem; padding: 0.4rem; border: 1px solid var(--umu-line); border-radius: 10px; }
    .umd-sidebar.is-open .umd-toc { display: block; }
    .umd-table-wrap table { min-width: 560px; }
    .umd-lb-prev, .umd-lb-next { top: auto; bottom: 1rem; }
}
@media (max-width: 600px) {
    .umd-code pre { padding: 0.8rem; }
    .umd-code pre code { font-size: 0.8rem; }
    .umd-article .umd-anchor { opacity: 0.6; }
}
@media (prefers-reduced-motion: reduce) {
    .umd-anchor { transition: none; }
}
