/* =====================================================================================================
   DokWiki stylesheet (light and dark). No external fonts or images; icons are inline SVG or data: URLs.

   Theme: follows prefers-color-scheme; <html data-theme="light|dark"> (user preference or the header
   toggle) overrides it. All colours are custom properties on :root, so other stylesheets should use
   var(--...) rather than literal colours.

   Shared classes for other screens (editor, history, admin, login, preferences):
     .btn               neutral button; works on <a> and <button>
     .btn-primary       main action (brand orange)
     .btn-danger        destructive action (delete, discard)
     .btn-sm            smaller button (combine with the above)
     .form-row          one labelled field: <div class="form-row"><label for=x>..</label><input id=x>
                        <p class="hint">..</p></div>; inputs, selects and textareas fill the row
     .form-inline       label + field + button on one line
     .notice            information box; add .notice-error (red) or .notice-ok (green)
     .card              bordered box with padding
     .muted             secondary text colour; .small for smaller text
     .toolbar           horizontal row of buttons/links/fields that wraps on small screens
     .badge             small pill label (e.g. a product name)
     .sr-only           visually hidden, still read by screen readers
     .doc               rendered Markdown: put an editor preview inside <div class="doc"> to get
                        exactly the page styles (callouts, tables, code blocks, footnotes, ...)
     .message           narrow centred column for simple screens (login, errors)

   Layout produced by View.render:
     div.site-brand (templates/header.html, normally a .brandbar)
     header.appbar (sticky: site title, product switcher, search, theme toggle, user menu)
     .page-wrap[.has-sidebar][.has-toc] > aside.sidebar#sidebar + main#main.main + aside.toc-aside
     footer.site-footer (templates/footer.html)
   ===================================================================================================== */

:root {
  --appbar-h: 56px;
  --sidebar-w: 272px;
  --toc-w: 224px;
  --radius: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --brand: #ee9d20;
  --brand-strong: #d9860b;
  --brand-ink: #1b1200;
  --chrome-bg: #111827;
  --chrome-bg-2: #1f2937;
  --chrome-fg: #e5e7eb;
  --chrome-muted: #9ca3af;

  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-sunken: #eef1f4;
  --bg-hover: #eef1f5;
  --fg: #1f2328;
  --fg-muted: #59636e;
  --border: #d5dbe1;
  --border-soft: #e6eaee;
  --link: #9a5700;
  --link-hover: #6e3e00;
  --accent-soft: #fdf0dc;
  --accent-line: #ee9d20;
  --focus: #1f6feb;
  --code-bg: #f3f5f7;
  --code-fg: #1f2328;
  --mark-bg: #ffe08a;
  --mark-fg: #1f2328;
  --missing: #c4202d;
  --shadow: 0 8px 24px rgba(17, 24, 39, 0.12), 0 2px 6px rgba(17, 24, 39, 0.08);
  --overlay: rgba(15, 20, 27, 0.5);

  --note: #0969da;      --note-bg: #eef5ff;
  --tip: #1a7f37;       --tip-bg: #edf8f0;
  --important: #8250df; --important-bg: #f4effd;
  --warning: #9a6700;   --warning-bg: #fff7e0;
  --caution: #c4202d;   --caution-bg: #fff0f0;
  --ok: #1a7f37;        --ok-bg: #edf8f0;
  --error: #c4202d;     --error-bg: #fff0f0;
  color-scheme: light;
}

/* Dark: by system preference unless the light theme is forced, or when the dark theme is forced. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141b; --bg-soft: #151b23; --bg-sunken: #1b222c; --bg-hover: #1f2731;
    --fg: #e6edf3; --fg-muted: #9ba6b2; --border: #2f3843; --border-soft: #232b35;
    --link: #f5b351; --link-hover: #ffd08a; --accent-soft: #2b2110; --accent-line: #ee9d20;
    --focus: #58a6ff; --code-bg: #1b222c; --code-fg: #e6edf3; --mark-bg: #8a6a10; --mark-fg: #fff8e6;
    --missing: #ff7b72; --shadow: 0 8px 24px rgba(0, 0, 0, 0.5); --overlay: rgba(0, 0, 0, 0.6);
    --note: #58a6ff; --note-bg: #0f2036; --tip: #3fb950; --tip-bg: #0f2418; --important: #b48cff; --important-bg: #1f1736;
    --warning: #d8a32a; --warning-bg: #261d07; --caution: #ff7b72; --caution-bg: #2d1214;
    --ok: #3fb950; --ok-bg: #0f2418; --error: #ff7b72; --error-bg: #2d1214;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141b; --bg-soft: #151b23; --bg-sunken: #1b222c; --bg-hover: #1f2731;
  --fg: #e6edf3; --fg-muted: #9ba6b2; --border: #2f3843; --border-soft: #232b35;
  --link: #f5b351; --link-hover: #ffd08a; --accent-soft: #2b2110; --accent-line: #ee9d20;
  --focus: #58a6ff; --code-bg: #1b222c; --code-fg: #e6edf3; --mark-bg: #8a6a10; --mark-fg: #fff8e6;
  --missing: #ff7b72; --shadow: 0 8px 24px rgba(0, 0, 0, 0.5); --overlay: rgba(0, 0, 0, 0.6);
  --note: #58a6ff; --note-bg: #0f2036; --tip: #3fb950; --tip-bg: #0f2418; --important: #b48cff; --important-bg: #1f1736;
  --warning: #d8a32a; --warning-bg: #261d07; --caution: #ff7b72; --caution-bg: #2d1214;
  --ok: #3fb950; --ok-bg: #0f2418; --error: #ff7b72; --error-bg: #2d1214;
  color-scheme: dark;
}

/* ------------------------------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--appbar-h) + 16px); }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--fg); font: 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word;
}
a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
:focus:not(:focus-visible) { outline: none; }
img, video { max-width: 100%; height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
code, kbd, pre, samp { font-family: var(--mono); }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
mark { background: var(--mark-bg); color: var(--mark-fg); padding: 0 0.1em; border-radius: 2px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 8px; top: -100px; z-index: 100; padding: 8px 14px; border-radius: var(--radius);
  background: var(--brand); color: var(--brand-ink); font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 8px; }
.muted { color: var(--fg-muted); }
.small { font-size: 0.875rem; }

/* ------------------------------------------------------------------------------------------ header */
.site-brand { flex: none; }
.brandbar { background: var(--chrome-bg); color: var(--chrome-fg); }
.brandbar-inner {
  max-width: 1440px; margin: 0 auto; padding: 0 20px; height: 44px;
  display: flex; align-items: center; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; flex: none; }
.brand:hover { color: #fff; }
.brand-word { font-size: 1.2rem; font-weight: 700; letter-spacing: 0.02em; }
.brand-accent { color: var(--brand); }
.brand-nav { display: flex; gap: 2px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.brand-nav::-webkit-scrollbar { display: none; }
.brand-nav a {
  color: var(--chrome-fg); text-decoration: none; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; padding: 6px 10px; border-radius: 6px; white-space: nowrap;
}
.brand-nav a:hover { color: #fff; background: var(--chrome-bg-2); }
.brand-nav a[aria-current] { color: var(--brand); }
.brandbar :focus-visible { outline-color: var(--brand); }

.appbar {
  flex: none; position: sticky; top: 0; z-index: 30; height: var(--appbar-h);
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.appbar-inner {
  max-width: 1440px; height: 100%; margin: 0 auto; padding: 0 20px;
  display: flex; align-items: center; gap: 12px;
}
.site-title {
  color: var(--fg); font-weight: 700; font-size: 1.05rem; text-decoration: none; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.site-title:hover { color: var(--fg); text-decoration: underline; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; padding: 0; border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: var(--fg-muted); cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--fg); }
.no-js .theme-toggle { display: none; }
.nav-toggle { display: none; }
.appbar-break { display: none; }

/* dropdown menus built from <details> (product switcher, user menu) */
details.menu { position: relative; flex: none; }
details.menu > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 10px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.9rem; font-weight: 500; white-space: nowrap; user-select: none;
}
details.menu > summary::-webkit-details-marker { display: none; }
details.menu > summary:hover { background: var(--bg-hover); }
details.menu[open] > summary { background: var(--bg-hover); }
details.menu[open] > summary .caret { transform: rotate(180deg); }
.caret { transition: transform 0.15s; flex: none; }
.menu-list {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 40; min-width: 200px; max-height: 70vh; overflow: auto;
  margin: 0; padding: 6px; list-style: none; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu-right { left: auto; right: 0; }
.menu-list a, .menu-button {
  display: block; width: 100%; padding: 7px 10px; border: 0; border-radius: 6px; background: none;
  color: var(--fg); text-align: left; text-decoration: none; font-size: 0.92rem; cursor: pointer; white-space: nowrap;
}
.menu-list a:hover, .menu-button:hover { background: var(--bg-hover); color: var(--fg); }
.menu-list a[aria-current] { font-weight: 600; background: var(--accent-soft); }
.menu-list form { margin: 0; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink); font-size: 0.8rem; font-weight: 700;
}
.user-name { max-width: 12em; overflow: hidden; text-overflow: ellipsis; }
.login-link {
  flex: none; padding: 7px 12px; border-radius: var(--radius); font-size: 0.92rem; font-weight: 600;
  text-decoration: none; color: var(--fg); border: 1px solid var(--border); white-space: nowrap;
}
.login-link:hover { background: var(--bg-hover); color: var(--fg); }

/* header search */
.site-search { position: relative; flex: 1 1 260px; max-width: 420px; margin-left: auto; }
.site-search .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--fg-muted); pointer-events: none; }
.site-search input[type="search"] {
  width: 100%; height: 38px; padding: 0 34px 0 34px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg-soft); color: var(--fg); -webkit-appearance: none; appearance: none;
}
.site-search input::placeholder { color: var(--fg-muted); }
.site-search input[type="search"]:focus { background: var(--bg); border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: -1px; }
.search-key {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); pointer-events: none;
  min-width: 20px; padding: 0 5px; font-size: 0.75rem; line-height: 18px; text-align: center;
  border: 1px solid var(--border); border-radius: 4px; color: var(--fg-muted); background: var(--bg);
}
.site-search input:focus ~ .search-key { display: none; }
.site-search input::-webkit-search-cancel-button { -webkit-appearance: none; }

/* ------------------------------------------------------------------------------------------ layout */
.page-wrap {
  flex: 1 0 auto; width: 100%; max-width: 1440px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1fr); align-items: start;
}
.page-wrap.has-sidebar { grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
.main { min-width: 0; width: 100%; max-width: 900px; padding: 28px 40px 56px; outline: none; }
.page-wrap:not(.has-sidebar) .main { justify-self: center; }
.toc-aside { display: none; }
@media (min-width: 1200px) {
  .page-wrap.has-toc { grid-template-columns: minmax(0, 1fr) var(--toc-w); }
  .page-wrap.has-sidebar.has-toc { grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--toc-w); }
  .toc-aside {
    display: block; position: sticky; top: var(--appbar-h); max-height: calc(100vh - var(--appbar-h));
    overflow: auto; padding: 32px 20px 32px 8px; font-size: 0.85rem;
  }
}

/* sidebar */
.sidebar {
  position: sticky; top: var(--appbar-h); height: calc(100vh - var(--appbar-h)); overflow-y: auto; overscroll-behavior: contain;
  border-right: 1px solid var(--border-soft); background: var(--bg); font-size: 0.92rem; scrollbar-width: thin;
}
.sidebar-inner { padding: 20px 12px 32px 16px; }
.sidebar-product {
  display: block; margin: 0 0 10px; padding: 4px 8px; color: var(--fg); font-weight: 700; font-size: 0.8rem;
  letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none;
}
.sidebar-product:hover { color: var(--link); }
.sidebar-nav ul, .sidebar-nav ol { list-style: none; margin: 0; padding: 0; }
.sidebar-nav ul ul, .sidebar-nav ol ol, .sidebar-nav ul ol, .sidebar-nav ol ul {
  margin: 2px 0 4px 12px; padding-left: 8px; border-left: 1px solid var(--border-soft);
}
.sidebar-nav li { position: relative; margin: 1px 0; }
.sidebar-nav p { margin: 0; }
/* A paragraph outside the lists (e.g. "Product | What's New") keeps its links inline on one line. */
.sidebar-nav > p { padding: 5px 8px; line-height: 1.35; }
.sidebar-nav h1, .sidebar-nav h2, .sidebar-nav h3, .sidebar-nav h4 {
  margin: 16px 0 6px; padding: 0 8px; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fg-muted);
}
.sidebar-nav h1 .anchor, .sidebar-nav h2 .anchor, .sidebar-nav h3 .anchor, .sidebar-nav h4 .anchor { display: none; }
.sidebar-nav hr { margin: 12px 8px; }
.sidebar-nav a { border-radius: 6px; color: var(--fg); text-decoration: none; }
/* Only list-item links are full-width rows; links inside a paragraph stay inline. */
.sidebar-nav li > a, .sidebar-nav li > p > a { display: block; padding: 5px 8px; line-height: 1.35; }
.sidebar-nav > p a { padding: 2px 3px; margin: 0 -3px; }
.sidebar-nav a:hover { background: var(--bg-hover); color: var(--fg); }
.sidebar-nav a[aria-current="page"] {
  background: var(--accent-soft); color: var(--fg); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent-line);
}
.sidebar-nav a.external::after { opacity: 0.6; }
.sidebar-nav a.missing { color: var(--missing); }
.js .sidebar-nav li.has-children > a, .js .sidebar-nav li.has-children > p > a { padding-right: 32px; }
.js .sidebar-nav li.has-children:not(.open) > ul, .js .sidebar-nav li.has-children:not(.open) > ol { display: none; }
.nav-caret {
  position: absolute; right: 2px; top: 2px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 5px;
  background: transparent; color: var(--fg-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.nav-caret:hover { background: var(--bg-sunken); color: var(--fg); }
.nav-caret .caret { transform: rotate(-90deg); }
li.open > .nav-caret .caret { transform: none; }
.sidebar-foot { margin: 20px 0 0; padding: 12px 8px 0; border-top: 1px solid var(--border-soft); font-size: 0.85rem; }
.sidebar-foot a { color: var(--fg-muted); }
.sidebar-foot span[aria-hidden] { margin: 0 4px; color: var(--fg-muted); }
.nav-overlay, .drawer-close { display: none; }

/* "On this page" */
.otp-title { margin: 0 0 8px; font-weight: 700; font-size: 0.78rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-muted); }
.toc-aside ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border-soft); }
.toc-aside li a {
  display: block; margin-left: -1px; padding: 4px 10px; border-left: 2px solid transparent;
  color: var(--fg-muted); text-decoration: none; line-height: 1.35;
}
.toc-aside li.otp-3 a { padding-left: 22px; }
.toc-aside li a:hover { color: var(--fg); }
.toc-aside li a.active { color: var(--fg); border-left-color: var(--accent-line); font-weight: 600; }

/* ------------------------------------------------------------------------------------------ page chrome */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 12px; }
.breadcrumb ol { display: flex; flex-wrap: wrap; list-style: none; margin: 0; padding: 0; font-size: 0.875rem; color: var(--fg-muted); }
.breadcrumb li + li::before { content: "\203A"; margin: 0 8px; color: var(--fg-muted); }
.breadcrumb a { color: var(--fg-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--link); text-decoration: underline; }
.page-actions { margin-left: auto; }
.also-in {
  margin: 0 0 16px; padding: 8px 12px; border: 1px solid var(--border-soft); border-radius: var(--radius);
  background: var(--bg-soft); font-size: 0.9rem; color: var(--fg-muted);
}
.page-foot {
  display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 48px; padding-top: 16px;
  border-top: 1px solid var(--border-soft); color: var(--fg-muted); font-size: 0.875rem;
}
.page-foot a { color: var(--fg-muted); }
.page-foot a:hover { color: var(--link); }

/* ------------------------------------------------------------------------------------------ shared UI */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); color: var(--fg);
  font-size: 0.92rem; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); color: var(--fg); text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand-strong); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-strong); color: var(--brand-ink); }
.btn-danger { background: #c4202d; border-color: #a51b26; color: #fff; }
.btn-danger:hover { background: #a51b26; color: #fff; }
.btn-sm { min-height: 30px; padding: 3px 10px; font-size: 0.85rem; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form-row { display: grid; gap: 6px; margin: 0 0 16px; }
.form-row > label { font-weight: 600; font-size: 0.92rem; }
.form-row .hint { margin: 0; font-size: 0.85rem; color: var(--fg-muted); }
.form-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
input[type="text"], input[type="search"], input[type="password"], input[type="email"], input[type="number"], input[type="url"],
select, textarea {
  min-height: 38px; padding: 7px 10px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--fg); max-width: 100%;
}
.form-row input, .form-row select, .form-row textarea { width: 100%; }
textarea { line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--focus); outline: 2px solid var(--focus); outline-offset: -1px; }
.notice {
  margin: 0 0 16px; padding: 12px 16px; border: 1px solid var(--border); border-left: 4px solid var(--note);
  border-radius: var(--radius); background: var(--note-bg);
}
.notice > :first-child { margin-top: 0; }
.notice > :last-child { margin-bottom: 0; }
.notice-error { border-left-color: var(--error); background: var(--error-bg); }
.notice-ok { border-left-color: var(--ok); background: var(--ok-bg); }
.card { position: relative; padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--bg-sunken); color: var(--fg-muted);
  font-size: 0.75rem; font-weight: 600; vertical-align: 1px; white-space: nowrap;
}
.message { max-width: 44rem; }
.page-wrap:not(.has-sidebar) .message { margin: 24px auto; }

/* ------------------------------------------------------------------------------------------ rendered Markdown */
.doc { font-size: 1rem; line-height: 1.7; }
.doc > :first-child { margin-top: 0; }
.doc h1, .doc h2, .doc h3, .doc h4, .doc h5, .doc h6 { line-height: 1.25; font-weight: 700; margin: 2em 0 0.6em; position: relative; }
.doc h1 { font-size: 2.1rem; margin-top: 0; letter-spacing: -0.01em; }
.doc h2 { font-size: 1.5rem; padding-bottom: 0.3em; border-bottom: 1px solid var(--border-soft); }
.doc h3 { font-size: 1.22rem; }
.doc h4 { font-size: 1.05rem; }
.doc h5, .doc h6 { font-size: 0.95rem; }
.doc h6 { color: var(--fg-muted); }
.doc p, .doc ul, .doc ol, .doc dl, .doc blockquote, .doc pre, .doc .table-wrap, .doc details, .doc .callout { margin: 0 0 1.1em; }
.doc ul, .doc ol { padding-left: 1.6em; }
.doc li > ul, .doc li > ol { margin: 0.25em 0; }
.doc li + li { margin-top: 0.25em; }
.doc li > p { margin: 0.25em 0; }
.doc .task-list-item, .doc li.task { list-style: none; }
.doc li > input[type="checkbox"], .doc .task-list-item-checkbox { margin: 0 0.45em 0 -1.35em; vertical-align: -1px; }
.doc a.footnote-backref { text-decoration: none; }
.doc a.anchor {
  margin-left: 0.35em; padding: 0 0.2em; color: var(--fg-muted); font-weight: 400; text-decoration: none; opacity: 0;
  transition: opacity 0.12s;
}
.doc h1:hover .anchor, .doc h2:hover .anchor, .doc h3:hover .anchor, .doc h4:hover .anchor, .doc h5:hover .anchor,
.doc h6:hover .anchor, .doc a.anchor:focus { opacity: 1; }
@media (hover: none) { .doc a.anchor { opacity: 0.35; } }
.doc a.external::after {
  content: ""; display: inline-block; width: 0.72em; height: 0.72em; margin-left: 0.2em; vertical-align: 0.05em;
  background-color: currentColor; opacity: 0.75;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M14 3h7v7h-2V6.4l-9.3 9.3-1.4-1.4L17.6 5H14V3zM5 5h6v2H5v12h12v-6h2v8H3V5h2z'/%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'%3E%3Cpath d='M14 3h7v7h-2V6.4l-9.3 9.3-1.4-1.4L17.6 5H14V3zM5 5h6v2H5v12h12v-6h2v8H3V5h2z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.doc a.missing, a.missing { color: var(--missing); text-decoration-style: dashed; }
.doc img { max-width: 100%; height: auto; border-radius: 4px; vertical-align: middle; }
/* Images side by side (sibling <img> blocks, or several images in one paragraph) form a top-aligned row.
   The :has() rule (first image of a row) is separate so browsers without :has() still apply the first. */
.doc > img, .doc > a > img, .doc p > img + img, .doc p > a + a > img { vertical-align: top; margin: 0 8px 8px 0; }
.doc p > img:has(+ img), .doc p > a:has(+ a > img) > img { vertical-align: top; margin: 0 8px 8px 0; }
/* Rows of screenshots written as <div class="image-row"> (the importer emits these). */
.doc .image-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: flex-start; margin: 0 0 1.1em; }
.doc .image-row > *, .doc .image-row img { margin: 0; }
.doc .image-row img { display: block; vertical-align: top; }
.doc .image-row > p { flex: 0 1 auto; }
.doc p > img:only-child, .doc p > a:only-child > img { display: block; margin: 0.5em 0; box-shadow: 0 1px 3px rgba(17, 24, 39, 0.18); }
.doc code {
  padding: 0.15em 0.38em; border-radius: 5px; background: var(--code-bg); color: var(--code-fg); font-size: 0.875em;
}
.doc pre {
  position: relative; padding: 14px 16px; overflow: auto; border: 1px solid var(--border-soft); border-radius: var(--radius);
  background: var(--code-bg); color: var(--code-fg); font-size: 0.84rem; line-height: 1.55; tab-size: 4;
}
.doc pre code { padding: 0; background: none; font-size: inherit; border-radius: 0; white-space: pre; }
.copy-btn {
  position: absolute; top: 6px; right: 6px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg); color: var(--fg-muted); font: 600 0.75rem var(--font); cursor: pointer; opacity: 0; transition: opacity 0.12s;
}
.doc pre:hover .copy-btn, .copy-btn:focus-visible, .copy-btn.copied { opacity: 1; }
@media (hover: none) { .copy-btn { opacity: 0.85; } }
.copy-btn:hover { color: var(--fg); }
.doc kbd, kbd {
  display: inline-block; padding: 0.1em 0.45em; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px;
  background: var(--bg-soft); font-size: 0.82em; line-height: 1.3;
}
.doc blockquote { margin-left: 0; margin-right: 0; padding: 0.2em 1em; border-left: 4px solid var(--border); color: var(--fg-muted); }
.doc blockquote > :last-child { margin-bottom: 0; }
.doc .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border-soft); border-radius: var(--radius); }
/* Cells wrap like JSPWiki's; the wrapper scrolls sideways only when a table can't fit even with wrapped cells. */
.doc table { border-collapse: collapse; width: 100%; font-size: 0.92rem; line-height: 1.5; }
.doc th, .doc td {
  padding: 8px 12px; border-bottom: 1px solid var(--border-soft); text-align: left; vertical-align: top; overflow-wrap: break-word;
}
.doc td + td, .doc th + th { border-left: 1px solid var(--border-soft); }
.doc th { background: var(--bg-soft); font-weight: 600; }
.doc tbody tr:last-child td { border-bottom: 0; }
.doc tbody tr:nth-child(2n) td { background: var(--bg-soft); }
.doc th[align="center"], .doc td[align="center"] { text-align: center; }
.doc th[align="right"], .doc td[align="right"] { text-align: right; }
.doc table:not(.table-wrap table) { display: block; overflow-x: auto; max-width: 100%; }
.doc dl dt { font-weight: 600; margin-top: 0.6em; }
.doc dl dd { margin: 0.2em 0 0.6em 1.4em; }
.doc details { padding: 8px 14px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--bg-soft); }
.doc details > summary { cursor: pointer; font-weight: 600; }
.doc details[open] > summary { margin-bottom: 8px; }
.doc hr { margin: 2.2em 0; }
.doc sup, .doc sub { line-height: 0; }

/* callouts: div.callout.callout-note|tip|important|warning|caution > p.callout-title */
.doc .callout { --c: var(--note); --cbg: var(--note-bg); padding: 12px 16px; border-left: 4px solid var(--c); border-radius: var(--radius); background: var(--cbg); }
.doc .callout > :last-child { margin-bottom: 0; }
.doc .callout-tip { --c: var(--tip); --cbg: var(--tip-bg); }
.doc .callout-important { --c: var(--important); --cbg: var(--important-bg); }
.doc .callout-warning { --c: var(--warning); --cbg: var(--warning-bg); }
.doc .callout-caution { --c: var(--caution); --cbg: var(--caution-bg); }
.doc .callout-title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; color: var(--c); font-weight: 700; }
.doc .callout-title::before {
  content: ""; flex: none; width: 16px; height: 16px; background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zm1 7H7v5h2V7zm0-3H7v2h2V4z'/%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 16 16'%3E%3Cpath d='M8 0a8 8 0 1 1 0 16A8 8 0 0 1 8 0zm1 7H7v5h2V7zm0-3H7v2h2V4z'/%3E%3C/svg%3E") center / contain no-repeat;
}
.doc .callout-warning .callout-title::before, .doc .callout-caution .callout-title::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 .5l8 14.5H0L8 .5zm1 5.5H7v5h2V6zm0 6H7v2h2v-2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 .5l8 14.5H0L8 .5zm1 5.5H7v5h2V6zm0 6H7v2h2v-2z'/%3E%3C/svg%3E");
}
.doc .callout-tip .callout-title::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a5.5 5.5 0 0 1 3.3 9.9c-.5.4-.8 1-.8 1.6V12H5.5v-.5c0-.6-.3-1.2-.8-1.6A5.5 5.5 0 0 1 8 0zM5.5 13h5v1.5c0 .8-.7 1.5-1.5 1.5H7c-.8 0-1.5-.7-1.5-1.5V13z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a5.5 5.5 0 0 1 3.3 9.9c-.5.4-.8 1-.8 1.6V12H5.5v-.5c0-.6-.3-1.2-.8-1.6A5.5 5.5 0 0 1 8 0zM5.5 13h5v1.5c0 .8-.7 1.5-1.5 1.5H7c-.8 0-1.5-.7-1.5-1.5V13z'/%3E%3C/svg%3E");
}

/* [[toc]] */
.doc nav.toc { display: inline-block; min-width: 260px; max-width: 100%; margin: 0 0 1.2em; padding: 12px 20px 12px 16px; border: 1px solid var(--border-soft); border-radius: var(--radius); background: var(--bg-soft); font-size: 0.92rem; }
.doc nav.toc ul, .doc nav.toc ol { margin: 0; padding-left: 1.1em; }
.doc nav.toc li + li { margin-top: 0.15em; }
.doc nav.toc > p:first-child, .doc nav.toc .toc-title { margin: 0 0 6px; font-weight: 700; }

/* footnotes */
.doc section.footnotes { margin-top: 3em; padding-top: 1em; border-top: 1px solid var(--border-soft); font-size: 0.88rem; color: var(--fg-muted); }
.doc section.footnotes ol { padding-left: 1.4em; }
.doc section.footnotes hr { display: none; }
.doc sup a, .doc a.footnote-ref { text-decoration: none; }
.doc :target { scroll-margin-top: calc(var(--appbar-h) + 16px); }
.doc li:target, .doc section.footnotes li:target { background: var(--accent-soft); border-radius: 4px; }

/* ------------------------------------------------------------------------------------------ screens */
.home .main { max-width: 1100px; }
.hero { padding: 32px 0 24px; text-align: center; }
.hero h1 { margin: 0 0 8px; font-size: 2.2rem; letter-spacing: -0.01em; }
.lead { margin: 0 auto 24px; max-width: 40rem; color: var(--fg-muted); font-size: 1.1rem; }
.hero .search-form { justify-content: center; max-width: 36rem; margin: 0 auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; margin: 24px 0 0; padding: 0; list-style: none; }
.product-card { transition: border-color 0.12s, box-shadow 0.12s; }
.product-card:hover { border-color: var(--accent-line); box-shadow: var(--shadow); }
.product-card h2 { margin: 0 0 8px; font-size: 1.2rem; }
.product-card h2 a { color: var(--fg); text-decoration: none; }
.product-card h2 a::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.product-card p { margin: 0 0 8px; }
.product-card .card-meta { margin: 0; font-size: 0.85rem; }

.search-form { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 20px; }
.search-form input[type="search"] { flex: 1 1 240px; min-width: 0; }
.result-count { color: var(--fg-muted); margin: 0 0 16px; }
.hits { list-style: none; margin: 0; padding: 0; }
.hit { padding: 14px 0; border-bottom: 1px solid var(--border-soft); }
.hit-title { font-size: 1.1rem; font-weight: 600; }
.snippet { margin: 4px 0 0; color: var(--fg-muted); font-size: 0.93rem; line-height: 1.55; }
.snippet mark { color: var(--mark-fg); }

.notfound h1, .message h1 { font-size: 2rem; margin: 8px 0 12px; }
.suggestions { padding-left: 1.2em; }
.suggestions li { margin: 4px 0; }

.changes h1 { margin: 0 0 16px; }
.filter { margin: 0 0 20px; }
.filter label { font-weight: 600; font-size: 0.92rem; }
.feed-link { margin-left: auto; font-size: 0.9rem; }
.change-day { margin: 28px 0 8px; font-size: 1rem; color: var(--fg-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.change-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border-soft); }
.change-list li { padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 0.94rem; }
.change-list time { display: inline-block; min-width: 3.2em; font-family: var(--mono); font-size: 0.85rem; }
.change-action { font-weight: 600; }
.change-list .note { color: var(--fg-muted); }
.change-list .note::before { content: "\2014  "; }
.change-list .gone { text-decoration: line-through; color: var(--fg-muted); }

/* ------------------------------------------------------------------------------------------ footer */
.site-footer { flex: none; margin-top: 32px; background: var(--chrome-bg); color: var(--chrome-muted); font-size: 0.875rem; }
.footer-inner { max-width: 1440px; margin: 0 auto; padding: 24px 20px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.site-footer a { color: var(--chrome-fg); text-decoration: none; }
.site-footer a:hover { color: var(--brand); text-decoration: underline; }
.site-footer :focus-visible { outline-color: var(--brand); }
.copyright { margin: 0; }

/* ------------------------------------------------------------------------------------------ responsive */
@media (max-width: 1199px) {
  .main { padding: 24px 32px 48px; }
}
@media (max-width: 959px) {
  .page-wrap.has-sidebar { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 20px 20px 40px; max-width: none; }
  .js .nav-toggle { display: inline-flex; margin-left: -6px; }
  /* Without JS the navigation sits below the content. */
  .no-js .sidebar { position: static; height: auto; order: 2; border-right: 0; border-top: 1px solid var(--border); }
  .no-js .page-wrap { display: flex; flex-direction: column; align-items: stretch; }
  .js .sidebar {
    position: fixed; z-index: 60; top: 0; left: 0; bottom: 0; height: auto; width: min(86vw, 320px);
    transform: translateX(-102%); transition: transform 0.2s ease; box-shadow: var(--shadow); visibility: hidden;
  }
  .js.nav-open .sidebar { transform: none; visibility: visible; }
  .js.nav-open .nav-overlay { display: block; position: fixed; inset: 0; z-index: 55; background: var(--overlay); }
  .js.nav-open body { overflow: hidden; }
  .js .drawer-close { display: inline-flex; float: right; margin: -8px -4px 0 0; }
  .brand-nav a { padding: 6px 8px; }
}
@media (max-width: 640px) {
  :root { --appbar-h: 100px; }
  .appbar { height: auto; }
  .appbar-inner { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 8px; }
  .nav-toggle { order: 1; }
  .site-title { order: 2; flex: 1 1 0; font-size: 0.98rem; }
  .theme-toggle { order: 3; }
  .user-menu, .login-link { order: 4; }
  .appbar-break { display: block; order: 5; flex: 0 0 100%; height: 0; }
  .switcher { order: 6; }
  .site-search { order: 7; flex: 1 1 0; min-width: 0; max-width: none; margin-left: 0; }
  .search-key { display: none; }
  .switcher-label { max-width: 8.5em; overflow: hidden; text-overflow: ellipsis; }
  .user-name { display: none; }
  .brandbar-inner { padding: 0 16px; gap: 12px; }
  .brand-word { font-size: 1.05rem; }
  .brand-nav a { font-size: 0.72rem; padding: 6px 6px; letter-spacing: 0.03em; }
  .main { padding: 16px 16px 32px; }
  .doc { font-size: 0.98rem; }
  .doc h1, .hero h1 { font-size: 1.7rem; }
  .doc h2 { font-size: 1.32rem; }
  .doc pre { margin-left: -16px; margin-right: -16px; border-radius: 0; border-left: 0; border-right: 0; }
  .page-actions { margin-left: 0; }
  .footer-inner { padding: 20px 16px; }
  .feed-link { margin-left: 0; }
}
@media (max-width: 520px) {
  /* The main-site links are in the footer too; keep the brand bar to the logo on phones. */
  .brand-nav { display: none; }
  .brandbar-inner { height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ------------------------------------------------------------------------------------------ print */
@media print {
  :root { --bg: #fff; --fg: #000; --fg-muted: #444; --link: #000; --code-bg: #f4f4f4; --border: #bbb; --border-soft: #ccc; color-scheme: light; }
  .site-brand, .appbar, .sidebar, .toc-aside, .site-footer, .page-actions, .copy-btn, .skip-link, .nav-overlay, .also-in, .doc a.anchor { display: none !important; }
  body { display: block; font-size: 11pt; background: #fff; color: #000; }
  .page-wrap, .page-wrap.has-sidebar, .page-wrap.has-sidebar.has-toc { display: block; max-width: none; }
  .main { max-width: none; padding: 0; }
  .doc a { color: #000; }
  .doc a.external::after { content: " (" attr(href) ")"; display: inline; width: auto; height: auto; background: none; -webkit-mask: none; mask: none; font-size: 0.85em; color: #444; }
  .doc pre, .doc pre code { white-space: pre-wrap; word-break: break-word; }
  .doc pre, .doc .table-wrap, .doc table, .doc img, .doc .callout { break-inside: avoid; }
  .doc h2, .doc h3, .doc h4 { break-after: avoid; }
  .doc .table-wrap { overflow: visible; border: 0; }
  .doc table { width: 100%; }
  .page-foot { margin-top: 24px; }
}
