/* Documentation design: paper, ink, geometry, and a restrained technical accent. */
:root {
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-stack--headings: var(--font-stack);
  --font-stack--monospace: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sidebar-item-font-size: 0.82rem;
  --sidebar-caption-font-size: 0.65rem;
  --sidebar-search-input-font-size: 0.82rem;
  --toc-font-size: 0.76rem;
  --toc-title-font-size: 0.65rem;
  --code-font-size: 0.82rem;
}

body {
  --doc-bg: #fbfaf7;
  --doc-fg: #202725;
  --doc-muted: #606963;
  --doc-rule: #dedfd8;
  --doc-surface: #f1f1eb;
  --doc-link: #285f86;
  --doc-copper: #a56943;
  --doc-poster-grid: rgba(40, 95, 134, 0.075);
  --doc-shadow: 0 14px 36px rgba(32, 39, 37, 0.045);
}
body[data-theme="dark"] {
  --doc-bg: #171d1d;
  --doc-fg: #e8ece5;
  --doc-muted: #a6b1a8;
  --doc-rule: #343e39;
  --doc-surface: #202928;
  --doc-link: #92bede;
  --doc-copper: #d6a27e;
  --doc-poster-grid: rgba(146, 190, 222, 0.075);
  --doc-shadow: 0 14px 36px rgba(0, 0, 0, 0.1);
}
@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) {
    --doc-bg: #171d1d;
    --doc-fg: #e8ece5;
    --doc-muted: #a6b1a8;
    --doc-rule: #343e39;
    --doc-surface: #202928;
    --doc-link: #92bede;
    --doc-copper: #d6a27e;
    --doc-poster-grid: rgba(146, 190, 222, 0.075);
    --doc-shadow: 0 14px 36px rgba(0, 0, 0, 0.1);
  }
}

/* Map the theme's controls, drawers, and reference UI onto the same palette. */
html body[data-theme], html body:not([data-theme]) {
  --color-background-primary: var(--doc-bg);
  --color-background-secondary: var(--doc-surface);
  --color-background-hover: var(--doc-surface);
  --color-background-border: var(--doc-rule);
  --color-background-item: var(--doc-rule);
  --color-foreground-primary: var(--doc-fg);
  --color-foreground-secondary: var(--doc-muted);
  --color-foreground-muted: var(--doc-muted);
  --color-foreground-border: var(--doc-rule);
  --color-brand-primary: var(--doc-link);
  --color-brand-content: var(--doc-link);
  --color-brand-visited: var(--doc-link);
  --color-content-foreground: var(--doc-fg);
  --color-content-background: var(--doc-bg);
  --color-sidebar-background: var(--doc-bg);
  --color-sidebar-background-border: var(--doc-rule);
  --color-sidebar-item-background: var(--doc-bg);
  --color-sidebar-item-background--current: var(--doc-surface);
  --color-sidebar-item-background--hover: var(--doc-surface);
  --color-sidebar-link-text: var(--doc-muted);
  --color-sidebar-link-text--top-level: var(--doc-fg);
  --color-sidebar-brand-text: var(--doc-fg);
  --color-sidebar-caption-text: var(--doc-muted);
  --color-sidebar-search-background: var(--doc-surface);
  --color-sidebar-search-border: var(--doc-rule);
  --color-sidebar-search-text: var(--doc-fg);
  --color-sidebar-search-icon: var(--doc-muted);
  --color-toc-background: var(--doc-bg);
  --color-toc-item-text: var(--doc-muted);
  --color-toc-item-text--active: var(--doc-link);
  --color-header-background: var(--doc-bg);
  --color-header-border: var(--doc-rule);
  --color-header-text: var(--doc-fg);
  --color-inline-code-background: var(--doc-surface);
  --color-code-background: var(--doc-surface);
  --color-code-foreground: var(--doc-fg);
  --color-table-header-background: var(--doc-surface);
  --color-table-border: var(--doc-rule);
  --color-highlight-on-target: transparent;
  --color-api-background: var(--doc-surface);
  --color-api-background-hover: var(--doc-surface);
  --color-api-overall: var(--doc-muted);
  --color-api-name: var(--doc-link);
  --color-api-pre-name: var(--doc-muted);
  --color-api-keyword: var(--doc-fg);
  background: var(--doc-bg);
  color: var(--doc-fg);
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
}
html { scroll-behavior: auto; }
.main { min-width: 0; }
.content { box-sizing: border-box; width: 100%; max-width: 61rem; padding: 0 3.2rem; margin-inline: auto; }
.main .content { padding-top: 2.1rem; }
article { padding-bottom: 2rem; }
article p, article li { line-height: 1.8; }
article p { max-width: 72ch; margin-block: 1rem; }
article li { margin-block: 0.3rem; }
article ul, article ol { padding-left: 1.3rem; }
article a { color: var(--doc-link); text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
article a:hover { text-decoration-color: var(--doc-copper); }
a:focus-visible, button:focus-visible, input:focus-visible, label:focus-visible { outline: 2px solid var(--doc-link); outline-offset: 4px; }
::selection { color: var(--doc-bg); background: var(--doc-link); }
h1, h2, h3, h4 { color: var(--doc-fg); font-weight: 620; letter-spacing: -0.035em; }
h1 { font-size: clamp(2.1rem, 3vw, 2.8rem); line-height: 1.15; margin-block: 0.45rem 1.7rem; max-width: 24ch; }
h2 { font-size: 1.65rem; line-height: 1.3; margin-block: 3.7rem 1.2rem; padding: 0; border: 0; }
h3 { font-size: 1.16rem; line-height: 1.5; letter-spacing: -0.015em; margin-block: 2.1rem 0.8rem; }
h4 { font-size: 1rem; letter-spacing: 0; }
a.headerlink { font-weight: 400; color: var(--doc-muted); }
.content-icon-container { margin-top: 0.75rem; gap: 0.65rem; color: var(--doc-muted); opacity: 0.7; }
.content-icon-container:hover, .content-icon-container:focus-within { opacity: 1; }

/* Navigation is a quiet index, with readable links and distinct group labels. */
.sidebar-brand { padding: 2.2rem 1.4rem 1.6rem; }
.sidebar-brand-text { font-family: Georgia, "Times New Roman", serif; font-size: 1.7rem; font-weight: 500; letter-spacing: -0.055em; }
.sidebar-search-container { margin: 0 1.15rem 1.6rem; padding: 0; border: 1px solid var(--doc-rule); border-radius: 5px; }
.sidebar-search-container::before { left: 0.8rem; }
.sidebar-search { padding: 0.65rem 0.85rem 0.65rem 2.15rem; border: 0; }
.sidebar-search:focus-within { box-shadow: 0 0 0 2px var(--doc-link); }
.sidebar-tree { padding: 0 0.9rem 1.8rem; }
.sidebar-tree .caption { padding: 0 0.7rem; margin: 1.35rem 0 0.35rem; font-weight: 650; font-size: 0.64rem; letter-spacing: 0.12em; line-height: 1.5; }
.sidebar-tree li { margin: 0; }
.sidebar-tree .reference { display: block; padding: 0.36rem 0.7rem; border-radius: 4px; line-height: 1.4; }
.sidebar-tree .reference.current { color: var(--doc-link); font-weight: 600; box-shadow: inset 2px 0 var(--doc-link); }
.sidebar-tree .reference:hover { background: var(--doc-surface); }
.toc-tree { border-left: 1px solid var(--doc-rule); padding-left: 1rem; line-height: 1.6; }
.toc-title { color: var(--doc-muted); font-size: 0.65rem; font-weight: 650; letter-spacing: 0.1em; }
.toc-tree li { margin-block: 0.4rem; }
.toc-tree a { color: var(--doc-muted); }
.toc-tree a:hover, .toc-tree .scroll-current > a { color: var(--doc-link); }
footer { color: var(--doc-muted); font-size: 0.75rem; line-height: 1.7; border-top: 1px solid var(--doc-rule); padding-top: 1.4rem; }
.related-pages { border-top: 1px solid var(--doc-rule); padding-top: 1.4rem; margin-top: 2.6rem; }
.related-pages a { color: var(--doc-link); }

/* Code and reference content use one consistent, high-contrast reading surface. */
.highlight { background: var(--doc-surface); border: 1px solid var(--doc-rule); border-radius: 7px; box-shadow: none; margin-block: 1.25rem; }
.highlight pre { padding: 1.25rem 1.4rem; font-size: 0.82rem; line-height: 1.8; }
.highlight .hll { background: var(--doc-rule); }
article code.literal { font-size: 0.84em; padding: 0.13em 0.35em; border: 1px solid var(--doc-rule); border-radius: 4px; background: var(--doc-surface); }
button.copybtn { top: 0.6rem; right: 0.6rem; border: 1px solid var(--doc-rule); border-radius: 4px; background: var(--doc-bg); }
.sig:not(.sig-inline) { display: block; font-weight: 500; text-indent: 0; margin-inline: 0; font-size: 0.87rem; line-height: 1.85; padding: 1rem 1.1rem; background: var(--doc-surface); border-left: 2px solid var(--doc-link); border-radius: 0 5px 5px 0; overflow-wrap: anywhere; }
.sig-name { color: var(--doc-link); }
dl.py { margin-block: 2.4rem; }
dl.py > dd { margin-left: 0; padding-top: 0.5rem; }
dl.field-list > dt { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--doc-muted); }
.admonition { border-radius: 5px; box-shadow: none; border: 1px solid var(--doc-rule); background: var(--doc-surface); }
.admonition > .admonition-title { background: transparent; }
.table-wrapper { overflow-x: auto; max-width: 100%; margin-block: 1.5rem; }
table.docutils { width: 100%; font-size: 0.86rem; border-collapse: collapse; border: 0; line-height: 1.65; }
table.docutils th { background: var(--doc-surface); font-size: 0.77rem; font-weight: 650; color: var(--doc-muted); }
table.docutils td, table.docutils th { padding: 0.8rem 0.95rem; border: 0; border-bottom: 1px solid var(--doc-rule); text-align: left; }
article table code.literal { white-space: normal; overflow-wrap: anywhere; }
.kernel-tree { border-left: 2px solid var(--doc-rule); padding: 0.4rem 0 0.4rem 1.3rem; margin-block: 1.5rem; }

/* Figures: the data carries the color; captions carry the interpretation. */
article img { max-width: 100%; height: auto; }
article img[src*="/generated/"] { display: block; width: 100%; height: auto; border: 0; }
figure { margin: 1.8rem 0; }
figure > img { display: block; margin-inline: auto; }
figcaption { color: var(--doc-muted); font-size: 0.8rem; line-height: 1.65; margin-top: 0.85rem; }
.plot-caption { color: var(--doc-muted); font-size: 0.82rem; }
.plot-pair, .plot-three { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1.6rem; align-items: start; margin-block: 1.8rem; }
.plot-three { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 1.2rem; }
.plot-pair figure, .plot-three figure { min-width: 0; margin: 0; }
article img[src*="construction-"] { max-width: 36rem; margin-inline: auto; }
.curve-catalog { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 2.2rem 1.4rem; margin-block: 2.2rem; }
.curve-catalog figure { margin: 0; min-width: 0; }
.curve-catalog img { width: 100%; border: 0; transition: transform 160ms ease; }
.curve-catalog a:hover img { transform: translateY(-3px); }
.curve-catalog figcaption { display: grid; gap: 0.25rem; font-size: 0.77rem; line-height: 1.55; margin-top: 0.7rem; border-top: 1px solid var(--doc-rule); padding-top: 0.7rem; }
.curve-catalog figcaption strong { font-weight: 600; }
.curve-catalog figcaption span { color: var(--doc-muted); font-size: 0.69rem; }

/* Landing: an editorial opening paired with a numbered curve poster. */
section#hilbertplot > h1 { display: none; }
.content:has(.landing-hero) .content-icon-container .view-this-page,
.content:has(.landing-hero) .content-icon-container .edit-this-page { display: none; }
.landing-hero { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(0,1fr); gap: 2.5rem; align-items: center; padding-block: 2.3rem 3.6rem; }
.landing-label, .landing-section-label { color: var(--doc-copper); font-family: var(--font-stack--monospace); font-size: 0.66rem; letter-spacing: 0.055em; font-weight: 500; line-height: 1.6; }
.landing-label { margin: 0 0 1.25rem; }
.landing-hero h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(3.3rem,5.4vw,5rem); font-weight: 400; letter-spacing: -0.065em; line-height: 1.02; margin: 0 0 1.5rem; max-width: none; }
.landing-description { color: var(--doc-muted); font-size: 1.03rem; line-height: 1.85; max-width: 34ch; margin: 0 0 1.6rem; }
.landing-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; align-items: center; margin-block: 0 1.8rem; font-size: 0.78rem; font-weight: 600; }
.landing-actions a { display: inline-flex; align-items: center; gap: 0.45rem; text-decoration: none; padding: 0.72rem 0.95rem; border-radius: 5px; transition: background 150ms ease, border-color 150ms ease; }
.landing-actions .landing-primary { color: var(--doc-bg); background: var(--doc-link); border: 1px solid var(--doc-link); }
.landing-actions .landing-primary:hover { background: var(--doc-fg); border-color: var(--doc-fg); }
.landing-secondary { border: 1px solid var(--doc-rule); }
.landing-secondary:hover { border-color: var(--doc-link); background: var(--doc-surface); }
.landing-source { padding-inline: 0.5rem !important; }
.landing-source:hover { text-decoration: underline; }
.landing-install { max-width: 25rem; border: 1px solid var(--doc-rule); background: var(--doc-surface); border-radius: 6px; }
.install-label { display: flex; justify-content: space-between; align-items: start; gap: 0.5rem; padding: 0.75rem 0.85rem 0; color: var(--doc-muted); font-size: 0.7rem; line-height: 1.5; }
.install-label a { color: var(--doc-muted); text-decoration: none; }
.install-label a:hover { color: var(--doc-link); text-decoration: underline; }
.install-line { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; padding: 0.7rem 0.85rem 0.85rem; }
.install-line code { border: 0; background: transparent; padding: 0; color: var(--doc-fg); font-size: 0.76rem; white-space: nowrap; }
.install-copy { border: 1px solid var(--doc-rule); border-radius: 4px; background: var(--doc-bg); color: var(--doc-muted); font: inherit; font-size: 0.65rem; padding: 0.32rem 0.45rem; cursor: pointer; }
.install-copy:hover { color: var(--doc-link); border-color: var(--doc-link); }
.landing-packages { display: flex; flex-wrap: wrap; gap: 0.4rem; font-size: 0.7rem; color: var(--doc-muted); margin: 0.85rem 0 0; }
.landing-packages a { color: var(--doc-muted); text-decoration: none; }
.landing-packages a:hover { color: var(--doc-link); text-decoration: underline; }
.landing-figure { position: relative; padding: 1rem 1.15rem; margin: 0; border: 1px solid var(--doc-rule); background-color: var(--doc-bg); background-image: linear-gradient(var(--doc-poster-grid) 1px, transparent 1px),linear-gradient(90deg,var(--doc-poster-grid) 1px,transparent 1px); background-size: 22px 22px; box-shadow: var(--doc-shadow); }
.poster-label { display: flex; justify-content: space-between; color: var(--doc-muted); font-family: var(--font-stack--monospace); font-size: 0.66rem; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
.landing-figure img { display: block; width: 100%; height: auto; aspect-ratio: 1; border: 0; }
.landing-figure figcaption { display: flex; justify-content: space-between; gap: 1rem; border-top: 1px solid var(--doc-rule); padding-top: 0.75rem; margin-top: 0.5rem; font-family: var(--font-stack--monospace); font-size: 0.66rem; letter-spacing: 0.025em; }

/* Concrete workflows and examples, without a repeated feature-card grid. */
.landing-section-heading { margin-top: 2rem; }
.landing-section-label { margin: 0 0 0.75rem; }
.landing-workflows { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 2rem; margin-block: 1.75rem 3rem; }
.landing-workflow { min-width: 0; border-top: 2px solid var(--doc-rule); padding-top: 1.3rem; }
.landing-workflow h3 { margin: 0 0 0.65rem; font-size: 1.1rem; }
.landing-workflow p { color: var(--doc-muted); font-size: 0.87rem; line-height: 1.75; margin-block: 0.65rem 1.1rem; }
.landing-workflow > p:first-of-type { min-height: 3.5rem; }
.landing-workflow .highlight { margin-block: 1rem; }
.landing-workflow .highlight pre { padding: 1.1rem; font-size: 0.75rem; line-height: 1.85; }
.landing-workflow > a { font-size: 0.8rem; font-weight: 600; }
.landing-analysis { border-top: 1px solid var(--doc-rule); padding-top: 1.8rem; margin-top: 3rem; }
.landing-example { margin-block: 1.8rem 3.5rem; }
.landing-example h3 { margin-block: 0.6rem 0.7rem; font-size: 1.35rem; }
.landing-example > p { max-width: 67ch; font-size: 0.92rem; }
.landing-example .plot-pair { gap: 1.5rem; margin-block: 1.3rem 1rem; }
.landing-example .plot-pair figure { border-top: 1px solid var(--doc-rule); padding-top: 0.9rem; }
.landing-example figcaption { font-size: 0.76rem; }
.landing-example figcaption > span { display: block; color: var(--doc-fg); font-size: 0.78rem; font-weight: 600; margin-bottom: 0.15rem; }
.landing-example > a { font-size: 0.82rem; font-weight: 600; }
.landing-route { margin-block: 1.5rem 3rem; border-top: 1px solid var(--doc-rule); }
.landing-route-item { display: grid; grid-template-columns: 1.8rem minmax(10rem,0.9fr) minmax(0,1.5fr) 1rem; align-items: baseline; column-gap: 1rem; padding: 1.1rem 0.25rem; text-decoration: none; border-bottom: 1px solid var(--doc-rule); }
.landing-route-item:hover { background: var(--doc-surface); }
.route-index { color: var(--doc-copper); font-size: 0.67rem; font-family: var(--font-stack--monospace); }
.landing-route-item strong { font-size: 0.86rem; font-weight: 600; color: var(--doc-fg); }
.landing-route-item > span:not([class]) { color: var(--doc-muted); font-size: 0.78rem; line-height: 1.6; }

@media (min-width: 1552px) {
  html { font-size: 100%; }
  .content { padding-inline: 3.6rem; }
}
@media (max-width: 1150px) {
  .content { padding-inline: 2.5rem; }
  .landing-hero { gap: 1.8rem; }
  .landing-hero h1 { font-size: 3.8rem; }
  .landing-actions { gap: 0.4rem; }
  .landing-actions a { padding-inline: 0.75rem; }
}
@media (max-width: 850px) {
  .content { padding-inline: 1.8rem; }
  .main .content { padding-top: 1.4rem; }
  .landing-hero { padding-top: 1.4rem; }
  .landing-hero h1 { font-size: 3.6rem; }
  .landing-workflows { gap: 1.4rem; }
  .plot-three { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .curve-catalog { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 650px) {
  .content { padding-inline: 1.25rem; }
  .main .content { padding-top: 1.1rem; }
  h1 { font-size: 2.1rem; margin-top: 0.8rem; }
  h2 { font-size: 1.5rem; margin-top: 3rem; }
  .landing-hero { grid-template-columns: 1fr; gap: 2rem; padding-block: 0.8rem 2.5rem; }
  .landing-hero h1 { font-size: clamp(3.4rem,13vw,4.6rem); }
  .landing-description { max-width: 39ch; font-size: 1rem; }
  .landing-label { font-size: 0.64rem; margin-bottom: 1.1rem; }
  .landing-actions { margin-bottom: 1.4rem; }
  .landing-actions a { padding: 0.75rem 0.85rem; }
  .landing-install { max-width: none; }
  .landing-packages { font-size: 0.7rem; }
  .landing-figure { width: min(100%,21rem); justify-self: center; box-sizing: border-box; }
  .landing-workflows, .plot-pair, .plot-three { grid-template-columns: 1fr; gap: 1.8rem; }
  .landing-workflow > p:first-of-type { min-height: 0; }
  .landing-workflow .highlight pre { font-size: 0.78rem; }
  .landing-route-item { grid-template-columns: 1.5rem 1fr 1rem; row-gap: 0.35rem; }
  .landing-route-item > span:not([class]) { grid-column: 2; }
  .landing-route-item .route-arrow { grid-column: 3; grid-row: 1; }
  .curve-catalog { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 1.8rem 1.1rem; }
  .highlight pre { padding: 1.1rem; font-size: 0.78rem; }
  .content-icon-container { margin-top: 1rem; }
  table.docutils { font-size: 0.8rem; }
  table.docutils td, table.docutils th { padding: 0.65rem 0.75rem; }
}
@media (max-width: 370px) {
  .content { padding-inline: 1rem; }
  .landing-hero h1 { font-size: 3.1rem; }
  .landing-actions { font-size: 0.72rem; }
  .install-line code { font-size: 0.72rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
@media print {
  body { --doc-bg: #fff; --doc-fg: #111; --doc-muted: #444; }
  .landing-actions, .install-copy { display: none; }
  .landing-figure { box-shadow: none; }
}

/* The transparent poster artwork needs a higher luminance on dark paper. */
body[data-theme="dark"] .landing-figure img { filter: brightness(1.4); }
@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"]) .landing-figure img { filter: brightness(1.4); }
}
