/* docs-ai-wow: a flat, square documentation look.
   Chrome from Starburst docs (navy header, tab row, light headings, plain side nav).
   Body from Python's "What's new" (breadcrumb bar, field lists, bordered admonitions,
   grid tables, monospace code, plain previous/next).
   Type: Jost (ai-wow house face, variable), light for headings; code in monospace.
   Self-contained: fonts vendored in assets/fonts (SIL OFL), no CDN. */

/* Google Fonts' split: the Latin-Ext file loads only on pages that use ş, ğ, İ and the like. */
@font-face { font-family: "Jost"; src: url("fonts/Jost-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Jost"; src: url("fonts/Jost-LatinExt.woff2") format("woff2"); font-weight: 100 900; font-display: swap; unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #ffffff;
  --panel: #f6f7f9;
  --line: #d8dbe0;
  --ink: rgba(0, 0, 0, .87);
  --muted: rgba(0, 0, 0, .58);
  --link: #0b63ad;
  --navy: #06184c;
  --navy-2: #000925;
  --teal: #2bc4d9;
  --done: #2e8b57;
  --running: #2a78d6;
  --issues: #b0700f;
  --error: #c8362f;
  --pending: #6b7280;
  --see: #c9b84a;      /* Python "See also" yellow */
  --see-bg: #fdfbe8;
  --fig: #ffffff;
  --header-h: 56px;
  --tabs-h: 40px;
  --sans: "Jost", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: Menlo, Consolas, Monaco, "Liberation Mono", "Lucida Console", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1f1f1f; --panel: #2a2a2a; --line: #444; --ink: rgba(255, 255, 255, .87); --muted: rgba(255, 255, 255, .6);
    --link: #77aaff; --navy: #0a1640; --navy-2: #050c24; --teal: #4fd3e6;
    --done: #5fbf88; --running: #4f8fe0; --issues: #e0a040; --error: #d9564a; --pending: #6b7280;
    --see: #9a9446; --see-bg: rgba(255, 255, 0, .08); --fig: #1f1f1f; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1f1f1f; --panel: #2a2a2a; --line: #444; --ink: rgba(255, 255, 255, .87); --muted: rgba(255, 255, 255, .6);
  --link: #77aaff; --navy: #0a1640; --navy-2: #050c24; --teal: #4fd3e6;
  --done: #5fbf88; --running: #4f8fe0; --issues: #e0a040; --error: #d9564a; --pending: #6b7280;
  --see: #9a9446; --see-bg: rgba(255, 255, 0, .08); --fig: #1f1f1f; color-scheme: dark;
}
/* Names the figures were written against. */
:root { --fg: var(--ink); --fg-2: var(--muted); --edge: var(--muted); --surface: var(--bg); --chip: var(--panel);
  --accent: var(--link); --turf: var(--done); --ochre: var(--issues); --clay: var(--error); }

* { box-sizing: border-box; border-radius: 0; }
html { scroll-padding-top: calc(var(--header-h) + var(--tabs-h) + 16px); }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.65 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--bg); color: var(--ink); padding: 8px 12px; border: 1px solid var(--line); }
.skip:focus { left: 8px; }

/* ---------- Starburst chrome: navy bar + tab row ---------- */
.site-header {
  position: sticky; top: 0; z-index: 30; height: var(--header-h);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: center; gap: 12px; color: #fff; font-weight: 600; font-size: 18px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { font: 700 13px var(--sans); letter-spacing: .04em; padding: 3px 6px; border: 1.5px solid #fff; }
.brand-sub { font-weight: 300; padding-left: 12px; border-left: 1px solid rgba(255, 255, 255, .5); }
.header-spacer { flex: 1; }
.search { position: relative; width: min(340px, 40vw); }
.search input {
  width: 100%; height: 34px; padding: 0 12px; border: 0; background: #fff; color: #111; font: 300 14px var(--sans);
}
.search input::placeholder { color: #667; }
.search-results {
  position: absolute; top: 38px; left: 0; right: 0; max-height: 60vh; overflow: auto;
  background: var(--bg); border: 1px solid var(--line); box-shadow: 0 6px 18px rgba(0, 0, 0, .2); padding: 4px 0; display: none;
}
.search-results.open { display: block; }
.search-results a { display: block; padding: 7px 12px; color: var(--ink); }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--panel); text-decoration: none; }
.search-results small { display: block; color: var(--muted); font-size: 12px; }
.search-empty { padding: 7px 12px; color: var(--muted); font-size: 14px; }
.icon-btn { height: 34px; min-width: 34px; padding: 0 10px; border: 1px solid rgba(255, 255, 255, .7); background: transparent; color: #fff; font: 14px var(--sans); cursor: pointer; }
.icon-btn:hover { background: rgba(255, 255, 255, .1); }
.menu-btn { display: none; }

.tabs {
  position: sticky; top: var(--header-h); z-index: 29; height: var(--tabs-h);
  display: flex; gap: 4px; padding: 0 24px; background: var(--navy-2); overflow-x: auto; scrollbar-width: none;
}
.tabs a { display: flex; align-items: center; padding: 0 14px; color: rgba(255, 255, 255, .82); font-size: 14px; font-weight: 500; white-space: nowrap; border-bottom: 3px solid transparent; }
.tabs a:hover { color: #fff; text-decoration: none; }
.tabs a[aria-current="true"] { color: #fff; border-bottom-color: var(--teal); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: calc(100vh - var(--header-h) - var(--tabs-h)); }
.sidebar {
  position: sticky; top: calc(var(--header-h) + var(--tabs-h)); height: calc(100vh - var(--header-h) - var(--tabs-h)); overflow-y: auto;
  border-right: 1px solid var(--line); background: var(--bg); padding: 24px 16px 40px 24px;
}
.sidebar h2 { font-size: 14px; font-weight: 700; margin: 20px 0 6px; }
.sidebar h2:first-child { margin-top: 0; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a { display: block; padding: 3px 0 3px 10px; color: var(--ink); font-size: 14px; font-weight: 300; line-height: 1.45; border-left: 2px solid transparent; }
.sidebar a:hover { color: var(--link); text-decoration: none; }
.sidebar a[aria-current="page"] { font-weight: 600; color: var(--link); border-left-color: var(--teal); }

.content { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 48px; padding: 0 40px 72px; max-width: 1280px; }
.article { min-width: 0; max-width: 880px; }
.toc { position: sticky; top: calc(var(--header-h) + var(--tabs-h)); align-self: start; max-height: calc(100vh - var(--header-h) - var(--tabs-h) - 28px); overflow-y: auto; font-size: 13.5px; padding-top: 28px; }
.toc h2 { font-size: 14px; font-weight: 700; margin: 0 0 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; }
.toc li a { display: block; padding: 3px 0; color: var(--muted); line-height: 1.4; }
.toc li.sub a { padding-left: 14px; font-size: 12.5px; }
.toc a:hover { color: var(--link); text-decoration: none; }
.toc a[aria-current="true"] { color: var(--ink); font-weight: 600; }

/* ---------- Python-style related bar (breadcrumbs + previous/next) ---------- */
.breadcrumbs {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px;
  font-size: 13.5px; color: var(--muted); padding: 10px 0; margin-bottom: 26px; border-bottom: 1px solid var(--line);
}
.breadcrumbs .rel a + a::before { content: "|"; color: var(--muted); margin: 0 8px; display: inline-block; }

/* ---------- article typography ---------- */
.article h1 { font-size: 34px; line-height: 1.2; font-weight: 300; color: var(--muted); margin: 0 0 18px; text-wrap: balance; }
.lead { font-size: 18px; line-height: 1.6; font-weight: 400; color: var(--ink); margin: 0 0 18px; }
.article h2 { font-size: 26px; font-weight: 300; margin: 44px 0 14px; }
.article h3 { font-size: 18px; font-weight: 700; margin: 28px 0 8px; }
.article p, .article ul, .article ol { margin: 0 0 14px; }
.article li { margin: 3px 0; }
.article li > ul { margin: 3px 0 0; }
.article strong { font-weight: 700; }
.article hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }
.article p a, .article li a, .article td a { text-decoration: underline; text-underline-offset: 2px; }
.anchor { margin-left: 6px; color: var(--muted); opacity: 0; font-weight: 400; text-decoration: none !important; }
h2:hover .anchor, h3:hover .anchor, .anchor:focus { opacity: 1; }

code { font: 600 .86em var(--mono); background: var(--panel); padding: 1px 4px; }
pre { background: #272822; color: #f8f8f2; border: 1px solid #616161; padding: 12px 14px; overflow-x: auto; margin: 0 0 16px; font-size: 13.5px; line-height: 1.5; }
pre code { background: none; padding: 0; color: inherit; font-weight: 400; font-size: inherit; }

.table-wrap { overflow-x: auto; margin: 0 0 18px; }
table { width: 100%; border-collapse: collapse; margin: 0; font-size: 14.5px; }
th, td { border: 1px solid var(--line); padding: 7px 10px; text-align: left; vertical-align: top; }
th { background: var(--panel); font-weight: 700; }

/* Field list, like Python's "Editors:" line: label column, no box. */
.glance { display: grid; grid-template-columns: 140px minmax(0, 1fr); margin: 0 0 22px; border-top: 1px solid var(--line); }
.glance > div { display: contents; }
.glance dt, .glance dd { padding: 10px 0; border-bottom: 1px solid var(--line); margin: 0; }
.glance dt { font-weight: 700; font-size: 14px; padding-right: 12px; }
.glance dt::after { content: ":"; }

/* Category line: plain text, Python's "Editors: …" shape. */
.tags { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0; margin: 0 0 18px; padding: 0; list-style: none; font-size: 14px; color: var(--muted); }
.tags::before { content: "Category"; font-weight: 700; color: var(--ink); background: var(--panel); border: 1px solid var(--line); padding: 0 6px; margin-right: 10px; }
.tags li { margin: 0; }
.tags li + li::before { content: "·"; margin: 0 8px; }

/* Admonitions: Python's bordered box, square. */
.callout { --c: var(--link); border: 1px solid var(--c); background: color-mix(in srgb, var(--c), transparent 92%); padding: 8px 12px; margin: 0 0 16px; }
.callout > :last-child { margin-bottom: 0; }
.callout-title { font-weight: 700; margin-right: 6px; }
.callout-title::after { content: ":"; }
.callout .callout-title + p { display: inline; }
.callout.note { --c: var(--see); background: var(--see-bg); }
.callout.tip { --c: var(--done); }
.callout.warning { --c: var(--issues); }
.callout.caution { --c: var(--error); }

/* Feature index: a ruled list, not cards. */
.card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 32px; margin: 0 0 22px; border-top: 1px solid var(--line); }
.card { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; }
.card strong { display: block; color: var(--link); font-weight: 700; }
.card:hover strong { text-decoration: underline; }
.card span { font-size: 14px; color: var(--muted); }

/* Numbers: one ruled row. */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); margin: 0 0 24px; border-top: 2px solid var(--navy); border-bottom: 1px solid var(--line); }
.stats div { padding: 10px 12px 10px 0; }
.stats b { display: block; font-size: 28px; font-weight: 300; line-height: 1.2; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12.5px; color: var(--muted); }

/* Status: square label. */
.status { display: inline-block; font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .06em; padding: 1px 6px; white-space: nowrap; color: #fff; background: var(--pending); }
.status.open { background: var(--running); }
.status.risk { background: var(--error); }
.status.idea { background: transparent; color: var(--muted); border: 1px solid var(--muted); }

/* Previous / next, Python's "Previous topic / Next topic". */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 44px; padding-top: 14px; border-top: 1px solid var(--line); }
.pager a { font-weight: 500; }
.pager small { display: block; color: var(--muted); font-size: 13px; font-weight: 700; }
.pager .next { text-align: right; grid-column: 2; }
.page-meta { margin-top: 24px; font-size: 13px; color: var(--muted); }

/* ---------- figures (house SVG class tokens: a public API, do not rename) ---------- */
figure { margin: 6px 0 24px; }
.fig { border: 1px solid var(--line); background: var(--fig); padding: 12px; overflow-x: auto; }
.fig svg { display: block; width: 100%; min-width: 560px; height: auto; }
figcaption { font-size: 14px; color: var(--muted); margin-top: 8px; }
figcaption strong { color: var(--ink); }
.svg-box { fill: var(--bg); stroke: var(--muted); stroke-width: 1.25; }
.svg-box-2 { fill: var(--panel); stroke: var(--muted); stroke-width: 1.25; }
.svg-zone { fill: none; stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 5; }
.svg-t { font: 600 14px var(--sans); fill: var(--ink); }
.svg-s { font: 300 11.5px var(--sans); fill: var(--muted); }
.svg-l { font: 400 11.5px var(--sans); fill: var(--muted); }
.svg-edge { stroke: var(--muted); stroke-width: 1.4; fill: none; }
.svg-turf { stroke: var(--done); stroke-width: 1.7; fill: none; }
.svg-ochre { stroke: var(--issues); stroke-width: 1.7; fill: none; }
.svg-clay { stroke: var(--error); stroke-width: 1.7; fill: none; }
.svg-dash { stroke-dasharray: 5 4; }
.svg-mask { fill: var(--fig); }
.t-turf { fill: var(--done); } .t-ochre { fill: var(--issues); } .t-clay { fill: var(--error); }

.site-footer { background: var(--navy); color: rgba(255, 255, 255, .8); padding: 18px 40px; font-size: 13px; }

/* ---------- responsive ---------- */
/* Section list nested under the current page in the side nav, Python's left "Table of Contents".
   Wide screens show the Starburst-style right column instead. */
.sidebar .side-toc { margin: 2px 0 6px 12px; padding: 0; }
.sidebar .side-toc a { font-size: 13px; color: var(--muted); padding: 2px 0 2px 10px; border-left: 0; font-weight: 300; }
.sidebar .side-toc a:hover { color: var(--link); }
@media (min-width: 1401px) { .sidebar .side-toc { display: none; } }
@media (max-width: 1400px) {
  .content { grid-template-columns: minmax(0, 1fr); }
  .toc { display: none; }
}
@media (max-width: 860px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .menu-btn { display: inline-block; }
  .sidebar { position: fixed; top: calc(var(--header-h) + var(--tabs-h)); left: 0; width: min(300px, 86vw); z-index: 25; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
  .sidebar.open { transform: none; }
  .content { padding: 0 16px 60px; }
  .site-header { padding: 0 16px; gap: 10px; }
  .tabs { padding: 0 8px; }
  .brand-sub { display: none; }
  .search { width: auto; flex: 1; min-width: 0; }
  .article h1 { font-size: 27px; }
  .glance { grid-template-columns: minmax(0, 1fr); }
  .glance dt { border-bottom: 0; padding-bottom: 0; }
  .card-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pager { grid-template-columns: 1fr; }
  .pager .next { grid-column: 1; }
  .site-footer { padding: 18px 16px; }
}
@media (max-width: 480px) { .brand { font-size: 0; gap: 0; } }
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }
@media print {
  .site-header, .tabs, .sidebar, .toc, .pager { display: none; }
  .layout, .content { display: block; padding: 0; }
}

/* Square corners on figure boxes too; the drawings keep their layout. */
.fig svg rect { rx: 0; ry: 0; }
.s-turf { stroke: var(--turf); }
.s-ochre { stroke: var(--ochre); }
.s-clay { stroke: var(--clay); }
