/* ddp theme — layout, contextual sidebar, method cards, copy buttons.
   Colours are CSS variables; html[data-theme="dark"] overrides them. */

:root {
  /* DDP brand: navy #283548, green #8BB93F / #7BA740 (from the official invoice header) */
  --brand-navy: #283548;
  --brand-green: #8bb93f;
  --brand-green-dark: #7ba740;

  --bg: #ffffff;
  --surface: #f5f7f9;
  --surface-2: #ecf0f4;
  --card-head: #edf1f6;
  --border: #dbe1e8;
  --text: #1c2736;
  --text-2: #364559;
  --muted: #5d6a7c;
  --accent: #4a7a14;            /* links / text on white: 5:1 contrast */
  --accent-soft: #edf5df;
  --accent-strong: #283548;     /* primary buttons, current language */
  --on-accent: #ffffff;
  --hover: #eef2f6;
  --code-bg: #f4f6f9;
  --code-inline: #e9eef3;
  --ok: #2b8a3e;
  --err: #e03131;
  --shadow: 0 1px 2px rgb(28 39 54 / 6%), 0 1px 3px rgb(28 39 54 / 9%);
  --pop-bg: #ffffff;
  --pop-border: var(--border);

  --k-class: #6741d9;
  --k-exception: #e03131;
  --k-function: #1971c2;
  --k-method: #0b7285;
  --k-property: #9c36b5;
  --k-attribute: #c2680c;
  --k-data: #495057;

  --c-note: #1971c2;
  --c-tip: #2b8a3e;
  --c-warning: #e8590c;
  --c-danger: #e03131;
  --c-see: #6741d9;
  --c-added: #2b8a3e;
  --c-changed: #c2680c;
  --c-deprecated: #c92a2a;

  --topbar-h: 64px;
  --sidebar-w: 324px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #111823;
  --surface: #172130;
  --surface-2: #1d2a3d;
  --card-head: #1c283a;
  --border: #2b394e;
  --text: #e7ebf1;
  --text-2: #c4ccd8;
  --muted: #8f9bae;
  --accent: #a4d159;
  --accent-soft: #223221;
  --accent-strong: #8bb93f;
  --on-accent: #16210a;
  --hover: #1a2536;
  --code-bg: #0e1520;
  --code-inline: #1f2c40;
  --ok: #69db7c;
  --err: #ff8787;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%);
  --pop-bg: #1b2739;

  --k-class: #b197fc;
  --k-exception: #ff8787;
  --k-function: #74c0fc;
  --k-method: #66d9e8;
  --k-property: #e599f7;
  --k-attribute: #ffc078;
  --k-data: #ced4da;

  --c-note: #74c0fc;
  --c-tip: #69db7c;
  --c-warning: #ffa94d;
  --c-danger: #ff8787;
  --c-see: #b197fc;
  --c-added: #69db7c;
  --c-changed: #ffc078;
  --c-deprecated: #ff8787;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15.5px/1.65 var(--font);
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, kbd, pre, samp { font-family: var(--mono); font-size: .9em; }

.ddp-skip {
  position: absolute; left: -999px; top: 8px; z-index: 100;
  background: var(--accent-strong); color: var(--on-accent); padding: 8px 12px; border-radius: 6px;
}
.ddp-skip:focus { left: 8px; }

/* ---- top bar ---------------------------------------------------------- */
.ddp-topbar {
  position: sticky; top: 0; z-index: 50; height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px; padding: 0 18px 0 0;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.ddp-brand { display: flex; align-items: center; gap: 0; align-self: stretch; color: var(--text); white-space: nowrap; }
.ddp-brand:hover { text-decoration: none; }
.ddp-band { display: block; height: var(--topbar-h); width: auto; flex: none; }
.ddp-brand-name { margin-left: 6px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.ddp-brand-version {
  margin-left: 10px; font: 600 11.5px var(--mono); color: var(--accent);
  background: var(--accent-soft); padding: 2px 9px; border-radius: 999px;
}
.ddp-search {
  position: relative; display: flex; align-items: center; gap: 8px; min-width: 0;
  margin-left: auto; width: min(360px, 38vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 0 10px; color: var(--muted);
}
.ddp-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ddp-search input[type="search"] {
  flex: 1; min-width: 0; width: 0; height: 34px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 14px; outline: none;
}
.ddp-search kbd { font-size: 11px; border: 1px solid var(--border); border-radius: 5px; padding: 0 6px; color: var(--muted); background: var(--bg); }
.ddp-actions { display: flex; align-items: center; gap: 6px; }
/* language dropdown: the list is exactly as wide as the button (its parent) */
.ddp-lang { position: relative; min-width: 150px; }
.ddp-lang-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 34px; padding: 0 10px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text);
  font: 500 13.5px var(--font); text-align: left;
}
.ddp-lang-btn:hover { background: var(--hover); }
.ddp-lang-btn[aria-expanded="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ddp-lang-globe { flex: none; color: var(--muted); }
.ddp-lang-current { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ddp-lang-caret { flex: none; margin-left: auto; color: var(--muted); transition: transform .15s; }
.ddp-lang-btn[aria-expanded="true"] .ddp-lang-caret { transform: rotate(180deg); }
.ddp-lang-list {
  position: absolute; z-index: 60; top: calc(100% + 6px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none;
  max-height: min(70vh, 420px); overflow-y: auto;
  background: var(--pop-bg); border: 1px solid var(--pop-border); border-radius: 10px;
  box-shadow: 0 10px 30px rgb(16 24 40 / 18%), 0 2px 6px rgb(16 24 40 / 10%);
}
.ddp-lang-list[hidden] { display: none; }
.ddp-lang-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 32px; padding: 0 10px;
  border-radius: 7px; color: var(--text); font-size: 13.5px; white-space: nowrap;
}
.ddp-lang-list a:hover, .ddp-lang-list a:focus-visible { background: var(--hover); text-decoration: none; outline-offset: -2px; }
.ddp-lang-list li[aria-selected="true"] a { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--brand-green); }
.ddp-lang-name { overflow: hidden; text-overflow: ellipsis; }
.ddp-lang-abbr { display: none; font: 600 12px var(--mono); letter-spacing: .04em; }
.ddp-icon-btn, .ddp-menu-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer;
}
.ddp-icon-btn:hover, .ddp-menu-btn:hover { background: var(--hover); text-decoration: none; }
.ddp-menu-btn { display: none; margin-left: 12px; }
html[data-theme="dark"] .ddp-i-sun, html[data-theme="light"] .ddp-i-moon { display: none; }

/* ---- shell ------------------------------------------------------------- */
.ddp-shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.ddp-sidebar {
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); overflow-y: auto; overscroll-behavior: contain;
  border-right: 1px solid var(--border); background: var(--bg); padding: 12px 10px 40px;
  scrollbar-width: thin; scrollbar-color: var(--border) transparent;
}
.ddp-main { padding: 28px clamp(18px, 4vw, 56px) 60px; min-width: 0; }
.ddp-article { max-width: 980px; margin: 0 auto; }
.ddp-scrim { position: fixed; inset: var(--topbar-h) 0 0 0; background: rgb(0 0 0 / 45%); z-index: 39; }

/* ---- contextual sidebar ------------------------------------------------ */
.ddp-nav-filter { position: sticky; top: -12px; z-index: 2; background: var(--bg); padding: 0 0 10px; }
#ddp-filter {
  width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px;
}
#ddp-filter:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ddp-tree, .ddp-children { list-style: none; margin: 0; padding: 0; }
.ddp-children { margin-left: 10px; padding-left: 6px; border-left: 1px solid var(--border); }
.ddp-group > .ddp-children { margin-left: 0; padding-left: 0; border-left: 0; }
.ddp-tree > .ddp-node > .ddp-children { margin-left: 11px; }
.ddp-node:not(.is-open) > .ddp-children { display: none; }
.ddp-row { display: flex; align-items: center; gap: 2px; min-height: 28px; }
.ddp-toggle, .ddp-toggle-spacer { flex: none; width: 20px; height: 20px; }
.ddp-toggle { border: 0; padding: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 5px; position: relative; }
.ddp-toggle:hover { background: var(--hover); }
.ddp-toggle::before {
  content: ""; position: absolute; left: 7px; top: 6px; width: 5px; height: 5px;
  border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform .15s;
}
.ddp-node.is-open > .ddp-row > .ddp-toggle::before { transform: rotate(45deg); top: 5px; }
.ddp-link {
  flex: 1; display: flex; align-items: center; gap: 7px; min-width: 0; padding: 3px 8px; border-radius: 7px;
  color: var(--text-2); font-size: 13.5px; line-height: 1.35; overflow-wrap: break-word; word-break: break-word;
}
.ddp-link:hover { background: var(--hover); text-decoration: none; color: var(--text); }
.ddp-node.is-current > .ddp-row > .ddp-link { background: var(--accent-soft); color: var(--accent); font-weight: 600; border-radius: 2px 7px 7px 2px; box-shadow: inset 3px 0 0 var(--brand-green); }
.ddp-link.is-active { background: var(--accent-soft); color: var(--accent); }
.ddp-group-title { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 9px 8px 2px; }
.ddp-glyph {
  flex: none; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px;
  font: 700 10.5px var(--mono); color: var(--kc, var(--muted));
  background: color-mix(in srgb, var(--kc, var(--muted)) 16%, transparent);
}
.ddp-name { font-family: var(--mono); font-size: 12.5px; min-width: 0; }
.kind-class { --kc: var(--k-class); } .kind-exception { --kc: var(--k-exception); }
.kind-function { --kc: var(--k-function); } .kind-method, .kind-classmethod, .kind-staticmethod { --kc: var(--k-method); }
.kind-property { --kc: var(--k-property); } .kind-attribute { --kc: var(--k-attribute); } .kind-data { --kc: var(--k-data); }
.ddp-nav .is-filtered-out { display: none; }
.ddp-nav.is-filtering .ddp-children { display: block !important; }

/* guide block above the API tree (Overview, README sections) */
.ddp-guides { list-style: none; margin: 0 0 4px; padding: 0; }
.ddp-guide > .ddp-row > .ddp-link { font-weight: 500; }
.ddp-guide-icon { flex: none; color: var(--muted); }
.ddp-guide.is-current .ddp-guide-icon { color: var(--accent); }
.ddp-nav-sep { height: 1px; margin: 8px 6px 8px; background: var(--border); }

/* ---- article typography ------------------------------------------------- */
.ddp-crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); max-width: 980px; margin: 0 auto 6px; }
.ddp-crumbs a { color: var(--muted); }
.ddp-article h1 { font-size: 2rem; line-height: 1.25; margin: .2em 0 .6em; letter-spacing: -.01em; overflow-wrap: anywhere; }
.ddp-article h1::after {
  content: ""; display: block; width: 64px; height: 5px; margin-top: .45em; background: var(--brand-green);
  clip-path: polygon(10px 0, 100% 0, calc(100% - 10px) 100%, 0 100%);
}
.ddp-article h2 { font-size: 1.45rem; margin: 2em 0 .6em; padding-bottom: .3em; border-bottom: 1px solid var(--border); }
.ddp-article h3 { font-size: 1.15rem; margin: 1.6em 0 .5em; }
.ddp-article h1, .ddp-article h2, .ddp-article h3, .ddp-article h4, dl.py > dt { scroll-margin-top: calc(var(--topbar-h) + 14px); }
a.headerlink { margin-left: .4em; opacity: 0; font-size: .8em; color: var(--muted); }
:is(h1, h2, h3, h4, h5, h6):hover > a.headerlink { opacity: 1; }
.ddp-article p { margin: .8em 0; }
.ddp-article ul, .ddp-article ol { padding-left: 1.4em; }
:not(pre) > code { background: var(--code-inline); border-radius: 5px; padding: .08em .35em; }
:not(pre) > code .pre { background: none; padding: 0; }
:not(pre) > code a, a > code { color: inherit; }
code.xref, a code { font-weight: 500; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
blockquote { margin: 1em 0; padding: .1em 1em; border-left: 3px solid var(--border); color: var(--text-2); }
table.docutils { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: .95em; }
table.docutils th, table.docutils td { border: 1px solid var(--border); padding: 7px 11px; text-align: left; vertical-align: top; }
table.docutils thead th { background: var(--surface); font-size: .8em; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
p.rubric {
  margin: 1.6em 0 .6em; padding-bottom: 4px; border-bottom: 1px solid var(--border);
  font: 700 .74rem var(--font); letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
}
.ddp-article img { max-width: 100%; height: auto; }

/* ---- code blocks + copy ------------------------------------------------- */
div[class*="highlight-"] { position: relative; margin: 1em 0; }
div.highlight { border: 1px solid var(--border); border-radius: 10px; background: var(--code-bg) !important; overflow: hidden; }
div.highlight pre { margin: 0; padding: 14px 16px; overflow-x: auto; line-height: 1.55; background: transparent !important; font-size: 13.3px; }
.ddp-codebar {
  position: absolute; top: 7px; right: 7px; z-index: 2; display: flex; align-items: center; gap: 6px;
  opacity: 0; transition: opacity .15s;
}
div[class*="highlight-"]:hover .ddp-codebar, .ddp-codebar:focus-within, .ddp-codebar:has(.is-copied, .is-failed) { opacity: 1; }
@media (hover: none) { .ddp-codebar { opacity: 1; } }
.ddp-lang-tag { font: 600 10.5px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ddp-copy {
  position: relative; display: inline-grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 1px solid var(--border); border-radius: 7px; background: var(--bg); color: var(--muted); cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
}
.ddp-copy:hover { color: var(--accent); border-color: var(--accent); }
.ddp-copy svg { grid-area: 1 / 1; width: 15px; height: 15px; }
.ddp-copy .i-ok, .ddp-copy .i-err { display: none; }
.ddp-copy.is-copied { color: var(--ok); border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--bg)); }
.ddp-copy.is-copied .i-copy, .ddp-copy.is-failed .i-copy { display: none; }
.ddp-copy.is-copied .i-ok { display: block; }
.ddp-copy.is-failed { color: var(--err); border-color: var(--err); }
.ddp-copy.is-failed .i-err { display: block; }
.ddp-copy::after {
  content: attr(data-label); position: absolute; right: calc(100% + 8px); top: 50%; transform: translateY(-50%);
  white-space: nowrap; font: 500 12px var(--font); padding: 3px 8px; border-radius: 6px;
  background: var(--text); color: var(--bg); opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 5;
}
.ddp-copy:hover::after, .ddp-copy:focus-visible::after, .ddp-copy.is-copied::after, .ddp-copy.is-failed::after { opacity: 1; }
.ddp-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ddp-import .highlight pre { font-size: 14px; }

/* ---- method / class / function cards ------------------------------------ */
dl.py { margin: 1.4rem 0 1.6rem; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
dl.py > dt.sig {
  position: relative; display: block; margin: 0; padding: 12px 210px 12px 16px; border-radius: 11px 11px 0 0;
  background: var(--card-head); border-bottom: 1px solid var(--border);
  font: 500 14px/1.7 var(--mono); overflow-wrap: anywhere;
}
dl.py > dt.sig:target { box-shadow: inset 4px 0 0 var(--brand-green); }
dl.py > dd { margin: 0; padding: 4px 18px 16px; }
dl.py > dd > :first-child { margin-top: .6em; }
dl.py dl.py { background: var(--bg); box-shadow: none; margin: 1.1rem 0; }
dl.py dl.py > dt.sig { background: var(--surface); }
dt.sig .sig-prename { color: var(--muted); font-weight: 400; }
dt.sig .sig-name { color: var(--text); font-weight: 700; }
dt.sig .sig-paren, dt.sig .sig-param .p { color: var(--muted); }
dt.sig em.sig-param { font-style: normal; }
dt.sig .sig-param .n { color: var(--text-2); }
dt.sig .sig-return { color: var(--muted); }
dt.sig .sig-return-icon { color: var(--accent); }
dt.sig a.headerlink { display: none; }
/* kind chips: Sphinx already prints "class"/"async"/"classmethod"... as em.property */
dt.sig em.property, dl.py:is(.function, .method, .attribute, .data) > dt.sig::before {
  display: inline-block; margin-right: 8px; padding: 0 8px; border-radius: 999px; vertical-align: 1px;
  font: 700 10.5px/1.7 var(--mono); letter-spacing: .05em; text-transform: uppercase; font-style: normal;
  color: var(--kc, var(--muted)); background: color-mix(in srgb, var(--kc, var(--muted)) 15%, transparent);
}
dt.sig em.property .pre { background: none; padding: 0; }
dt.sig em.property + em.property { margin-left: -4px; }
dl.py.class { --kc: var(--k-class); } dl.py.exception { --kc: var(--k-exception); }
dl.py.function { --kc: var(--k-function); } dl.py.method, dl.py.classmethod, dl.py.staticmethod { --kc: var(--k-method); }
dl.py.property { --kc: var(--k-property); } dl.py.attribute { --kc: var(--k-attribute); } dl.py.data { --kc: var(--k-data); }
dl.py.function > dt.sig::before { content: "function"; }
dl.py.method > dt.sig::before { content: "method"; }
dl.py.attribute > dt.sig::before { content: "attribute"; }
dl.py.data > dt.sig::before { content: "data"; }
dl.py > dt.sig .ddp-actions-sig { position: absolute; top: 8px; right: 10px; display: flex; align-items: center; gap: 6px; font-family: var(--font); }
dt.sig a.reference.internal:has(.viewcode-link) {
  display: inline-flex; align-items: center; height: 28px; padding: 0 9px; border: 1px solid var(--border); border-radius: 7px;
  background: var(--bg); color: var(--muted); font: 600 11.5px var(--font);
}
dt.sig a.reference.internal:has(.viewcode-link):hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.viewcode-link { font: inherit; }
dd > p:first-of-type { color: var(--text); }
.class-bases, p:has(> .ddp-bases) { color: var(--muted); font-size: .92em; }

/* ---- field sections (Args / Returns / Raises ...) ----------------------- */
.ddp-field-section { margin: 1.1em 0; }
.ddp-field-title { margin: 0 0 .5em !important; }
table.ddp-fields { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--bg); font-size: .94em; margin: 0; }
table.ddp-fields th, table.ddp-fields td { padding: 8px 12px; text-align: left; vertical-align: top; border: 0; border-bottom: 1px solid var(--border); }
table.ddp-fields tr:last-child td { border-bottom: 0; }
table.ddp-fields thead th { background: var(--surface-2); font: 700 10.5px var(--font); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
table.ddp-fields td p { margin: 0 0 .4em; }
table.ddp-fields td p:last-child { margin-bottom: 0; }
.ddp-param-name { font-family: var(--mono); }
.ddp-param-name strong { color: var(--accent); font-weight: 700; font-size: .95em; }
.ddp-param-type { font-family: var(--mono); font-size: .88em; color: var(--muted); overflow-wrap: anywhere; }
.ddp-param-type em, .ddp-param-type a { font-style: normal; }
table.ddp-fields td:first-child { white-space: nowrap; }
dl.field-list { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; }
dl.field-list > dt { font-weight: 700; }
dl.field-list > dd { margin: 0; }

/* ---- admonitions + version notes ---------------------------------------- */
.admonition, div.versionadded, div.versionchanged, div.deprecated, div.versionremoved {
  --ac: var(--c-note); margin: 1.1em 0; padding: 10px 14px 10px 16px; border: 1px solid color-mix(in srgb, var(--ac) 35%, var(--border));
  border-left: 4px solid var(--ac); border-radius: 9px; background: color-mix(in srgb, var(--ac) 7%, var(--bg));
}
.admonition > :last-child, div.versionadded > :last-child, div.versionchanged > :last-child, div.deprecated > :last-child { margin-bottom: 0; }
.admonition > p { margin: .4em 0; }
.admonition-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 .3em !important; color: var(--ac); font-weight: 700;
  font-size: .78rem; letter-spacing: .07em; text-transform: uppercase;
}
.admonition-title::before, div.versionadded > p:first-child::before, div.versionchanged > p:first-child::before,
div.deprecated > p:first-child::before, div.versionremoved > p:first-child::before {
  content: ""; flex: none; width: 16px; height: 16px; background: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
}
div.versionadded > p:first-child, div.versionchanged > p:first-child, div.deprecated > p:first-child, div.versionremoved > p:first-child {
  display: flex; align-items: baseline; gap: 8px; color: var(--ac); margin-top: 0; font-size: .95em;
}
div.versionadded > p:first-child::before, div.versionchanged > p:first-child::before,
div.deprecated > p:first-child::before, div.versionremoved > p:first-child::before { align-self: center; }
.versionmodified { font-weight: 700; }
.admonition.note, .admonition.important { --ac: var(--c-note); --icon: var(--i-info); }
.admonition.tip, .admonition.hint { --ac: var(--c-tip); --icon: var(--i-bulb); }
.admonition.warning, .admonition.caution, .admonition.attention { --ac: var(--c-warning); --icon: var(--i-warn); }
.admonition.danger, .admonition.error { --ac: var(--c-danger); --icon: var(--i-stop); }
.admonition.seealso { --ac: var(--c-see); --icon: var(--i-link); }
div.versionadded { --ac: var(--c-added); --icon: var(--i-plus); }
div.versionchanged { --ac: var(--c-changed); --icon: var(--i-edit); }
div.deprecated, div.versionremoved { --ac: var(--c-deprecated); --icon: var(--i-clock); }
:root {
  --i-info: 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%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v5M12 8h.01'/%3E%3C/svg%3E");
  --i-bulb: 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='M9 18h6M10 21h4M12 3a6 6 0 0 0-4 10.5V15h8v-1.5A6 6 0 0 0 12 3z'/%3E%3C/svg%3E");
  --i-warn: 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='M12 3l10 18H2zM12 10v5M12 18h.01'/%3E%3C/svg%3E");
  --i-stop: 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='M8 3h8l5 5v8l-5 5H8l-5-5V8zM12 8v5M12 16h.01'/%3E%3C/svg%3E");
  --i-link: 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 14a4 4 0 0 0 5.600 0l3-3a4 4 0 0 0-5.600-5.600l-1 1M14 10a4 4 0 0 0-5.600 0l-3 3a4 4 0 0 0 5.600 5.600l1-1'/%3E%3C/svg%3E");
  --i-plus: 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%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v8M8 12h8'/%3E%3C/svg%3E");
  --i-edit: 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='M4 20h4L19 9a2.800 2.800 0 0 0-4-4L4 16z'/%3E%3C/svg%3E");
  --i-clock: 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%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}

/* ---- toctree lists, indexes, search ------------------------------------- */
.toctree-wrapper ul { list-style: none; padding-left: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.toctree-wrapper li { margin: 0; }
.toctree-wrapper li > a { display: block; padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font-family: var(--mono); font-size: 13.5px; overflow-wrap: anywhere; }
.toctree-wrapper li > a:hover { border-color: var(--accent); text-decoration: none; }
.toctree-wrapper li > ul { display: none; }
.ddp-index-jump { display: flex; flex-wrap: wrap; gap: 6px; }
.ddp-index-jump a { padding: 2px 9px; border: 1px solid var(--border); border-radius: 6px; font: 600 12.5px var(--mono); }
.ddp-index-list { list-style: none; padding-left: 0 !important; columns: 3 240px; column-gap: 28px; }
.ddp-index-list li { break-inside: avoid; margin: 3px 0; }
.ddp-index-list ul { list-style: none; padding-left: 1.1em; }
.ddp-index-more { font-size: .8em; margin-left: 4px; }
table.ddp-modindex { width: 100%; border-collapse: collapse; }
table.ddp-modindex th { text-align: left; padding: 16px 0 4px; font: 700 13px var(--mono); color: var(--accent); border-bottom: 1px solid var(--border); }
table.ddp-modindex td { padding: 6px 12px 6px 0; vertical-align: top; }
table.ddp-modindex tr.sub td:first-child { padding-left: 1.4em; }
.ddp-search-page { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ddp-search-page input { flex: 1 1 260px; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--text); font: inherit; }
.ddp-search-page button { height: 38px; padding: 0 16px; border: 0; border-radius: 9px; background: var(--accent-strong); color: var(--on-accent); font: 600 14px var(--font); cursor: pointer; }
#search-results ul.search { list-style: none; padding: 0; }
#search-results ul.search li { padding: 12px 14px; margin: 8px 0; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
#search-results .context { color: var(--muted); font-size: .9em; margin: 4px 0 0; }

/* ---- pager + footer ------------------------------------------------------ */
.ddp-pager { display: flex; justify-content: space-between; gap: 14px; max-width: 980px; margin: 44px auto 0; }
.ddp-pager a { display: flex; flex-direction: column; max-width: 48%; padding: 10px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.ddp-pager a:hover { border-color: var(--accent); text-decoration: none; }
.ddp-pager small { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.ddp-pager span { font-family: var(--mono); font-size: 13.5px; overflow-wrap: anywhere; }
.ddp-next { margin-left: auto; text-align: right; }
.ddp-footer { position: relative; display: flex; flex-wrap: wrap; gap: 6px 22px; max-width: 980px; margin: 36px auto 0; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.ddp-footer::before { content: ""; position: absolute; left: 0; top: -2px; width: 72px; height: 3px; background: linear-gradient(90deg, var(--brand-navy) 0 55%, var(--brand-green) 55% 100%); }

/* ---- small screens --------------------------------------------------------- */
@media (max-width: 1000px) {
  /* phone header: always the DDP navy, in light and dark themes alike */
  .ddp-topbar {
    --bg: transparent; --surface: rgb(255 255 255 / 9%); --hover: rgb(255 255 255 / 14%);
    --border: rgb(255 255 255 / 20%); --text: #f2f5f9; --text-2: #e3e8ef; --muted: #b9c4d4;
    --pop-bg: #34445d; --pop-border: rgb(255 255 255 / 22%);
    --accent: #b4de68; --accent-soft: rgb(139 185 63 / 22%); --accent-strong: #8bb93f; --on-accent: #16210a;
    background: var(--brand-navy); border-bottom-color: rgb(255 255 255 / 12%);
    -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--text); color-scheme: dark;
  }
  .ddp-topbar .ddp-search input::placeholder { color: var(--muted); }
  .ddp-shell { grid-template-columns: minmax(0, 1fr); }
  .ddp-menu-btn { display: inline-grid; }
  .ddp-sidebar {
    position: fixed; left: 0; top: var(--topbar-h); bottom: 0; z-index: 40; width: min(88vw, 340px); height: auto;
    transform: translateX(-102%); transition: transform .2s; box-shadow: 0 0 30px rgb(0 0 0 / 25%);
  }
  body.ddp-nav-open .ddp-sidebar { transform: none; }
  body.ddp-nav-open { overflow: hidden; }
  .ddp-search { width: auto; flex: 1; margin-left: 0; }
  .ddp-search kbd { display: none; }
  .ddp-brand-name, .ddp-brand-version { display: none; }
  .ddp-band { width: 124px; object-fit: cover; object-position: left center; }
  dl.py > dt.sig { padding-right: 16px; padding-bottom: 46px; }
  dl.py > dt.sig .ddp-actions-sig { top: auto; bottom: 8px; left: 12px; right: auto; }
  .ddp-copy::after { right: auto; left: 0; top: auto; bottom: calc(100% + 6px); transform: none; }
}
@media (max-width: 560px) {
  .ddp-article h1 { font-size: 1.55rem; }
  .ddp-topbar { gap: 8px; padding-right: 10px; }
  /* language dropdown shrinks to the globe; its list is as narrow as the button and shows 2-letter codes */
  .ddp-lang { min-width: 0; width: 38px; }
  .ddp-lang-btn { justify-content: center; padding: 0; }
  .ddp-lang-current, .ddp-lang-caret { display: none; }
  .ddp-lang-list { padding: 3px; }
  .ddp-lang-list a { justify-content: center; height: 36px; padding: 0; }
  .ddp-lang-name { display: none; }
  .ddp-lang-abbr { display: inline; }
  .ddp-actions { gap: 6px; }
  table.ddp-fields td:first-child { white-space: normal; }
}
@media print {
  .ddp-topbar, .ddp-sidebar, .ddp-pager, .ddp-codebar, .ddp-actions-sig { display: none !important; }
  .ddp-shell { display: block; }
}
