/* Styles for the DocBook-generated manuals in /doc/. Loaded after site.css.
   static/js/docs.js adds the sidebar (body.has-sidebar),
   heading anchors and copy buttons; everything degrades without it. */

.is-doc { font-size: 16px; }
.doc-crumbs { max-width: 900px; padding-top: 28px; font-size: .9rem; font-weight: 600; }
.is-doc > .book, .is-doc > .article, .is-doc > .refentry,
.doc-layout > .book, .doc-layout > .article, .doc-layout > .refentry {
  width: 100%; max-width: 900px; margin: 0 auto; padding: 8px 24px 88px;
  color: var(--fg-2); flex: 1; min-width: 0;
}
.is-doc .doc-footer { padding: 0 0 28px; }
.is-doc .doc-footer .footer-base { margin-top: 0; }
.is-doc [id] { scroll-margin-top: 84px; }

/* Layout with sidebar */
.doc-layout {
  display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 56px;
  width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 24px; flex: 1;
}
.has-sidebar .doc-crumbs { max-width: 1200px; }
.doc-layout > .book, .doc-layout > .article, .doc-layout > .refentry { margin: 0; padding: 8px 0 88px; max-width: 820px; }
.doc-sidebar { position: relative; }
.doc-sidebar nav {
  position: sticky; top: 84px; max-height: calc(100vh - 104px); overflow-y: auto;
  padding: 4px 8px 24px 0; font-size: .9rem; scrollbar-width: thin;
}
.doc-sidebar-title { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin: 8px 0 12px; }
.is-doc .doc-sidebar ul { list-style: none; margin: 0; padding: 0; }
.doc-sidebar li { margin: 0; }
.doc-sidebar a {
  display: flex; align-items: baseline; gap: 10px;
  padding: 5px 10px; border-radius: 8px; color: var(--fg-2); line-height: 1.4;
  border-left: 2px solid transparent;
}
.doc-sidebar a:hover { text-decoration: none; color: var(--fg); background: var(--bg-soft); }
.doc-sidebar .lvl-1 { margin-top: 10px; }
.doc-sidebar .lvl-1:first-child { margin-top: 0; }
.doc-sidebar .lvl-1 > a { font-weight: 650; color: var(--fg); }
.doc-sidebar .lvl-2 > a { padding-left: 38px; color: var(--muted); font-size: .875rem; border-radius: 0 8px 8px 0; }
.doc-sidebar a.active { color: var(--accent); background: var(--accent-soft); }
.doc-sidebar .lvl-2 > a.active { border-left-color: var(--accent); }
.doc-sidebar .num {
  display: inline-grid; place-items: center; flex: none; width: 20px; height: 20px; border-radius: 6px;
  background: var(--bg-soft); border: 1px solid var(--border); color: var(--muted); font-size: .72rem; font-weight: 700;
}
.doc-sidebar a.active .num { background: linear-gradient(135deg, #14b8a6, #2563eb); border-color: transparent; color: #fff; }

/* Title page */
.is-doc .titlepage hr { display: none; }
.is-doc .book > .titlepage {
  position: relative; overflow: hidden; margin: 16px 0 40px; padding: 36px 36px 28px; border-radius: 20px;
  background:
    radial-gradient(520px 260px at 0% 0%, color-mix(in srgb, #14b8a6 18%, transparent), transparent),
    radial-gradient(520px 260px at 100% 100%, color-mix(in srgb, #2563eb 16%, transparent), transparent),
    var(--bg-soft);
  border: 1px solid var(--border);
}
.is-doc .book > .titlepage > div > div:first-child::before {
  content: "Documentation"; display: block; color: var(--accent); font-weight: 700; font-size: .78rem;
  text-transform: uppercase; letter-spacing: .12em; margin-bottom: 10px;
}
.is-doc .book > .titlepage h1.title { font-size: clamp(2rem, 4.5vw, 2.9rem); letter-spacing: -.03em; margin: 0 0 20px; }
.is-doc .book > .titlepage .author { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0 22px 6px 0; }
.is-doc h3.author { font-size: .95rem; margin: 0; }
.is-doc .affiliation, .is-doc .author code.email { font-size: .85rem; color: var(--muted); }
.is-doc .author code.email { background: none; padding: 0; }
.is-doc .affiliation br { display: none; }
.is-doc .book > .titlepage p.copyright, .is-doc .book > .titlepage p.pubdate {
  font-size: .8rem; color: var(--muted); margin: 0; line-height: 1.6;
}
.is-doc .book > .titlepage .author + div, .is-doc .book > .titlepage div:has(> .author) { margin-bottom: 0; }
.is-doc .book > .titlepage div:has(> p.copyright):first-of-type { margin-top: 14px; }

/* Headings */
.is-doc .chapter > .titlepage h1.title, .is-doc .chapter > .titlepage h2.title {
  font-size: 2rem; letter-spacing: -.025em; margin: 1.8em 0 .7em; padding-top: 1.4em; border-top: 1px solid var(--border);
}
.is-doc .section h2.title, .is-doc .refsect1 > h2 { font-size: 1.45rem; margin: 2em 0 .6em; }
.is-doc .section .section h3.title, .is-doc .refsect2 > h3 { font-size: 1.15rem; margin: 1.6em 0 .5em; }
.is-doc h4.title { font-size: 1.05rem; margin: 1.4em 0 .5em; }
.is-doc .titlepage:empty, .is-doc .titlepage > div:empty { display: none; }
.is-doc .anchor {
  margin-left: .4em; color: var(--muted); font-weight: 500; opacity: 0; text-decoration: none !important;
  transition: opacity .15s ease;
}
.is-doc h1:hover .anchor, .is-doc h2:hover .anchor, .is-doc h3:hover .anchor, .is-doc .anchor:focus { opacity: 1; }
.is-doc .anchor:hover { color: var(--accent); }

/* Built-in table of contents (fallback without JS and on narrow screens) */
.is-doc div.toc {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px 24px; margin: 0 0 40px; font-size: .95rem;
}
.is-doc div.toc > p { margin: 0 0 10px; text-transform: uppercase; letter-spacing: .1em; font-size: .78rem; color: var(--muted); }
.is-doc dl.toc { margin: 0; }
.is-doc dl.toc dd { margin-left: 1.25em; }
.is-doc dl.toc dt { margin: 3px 0; }
.is-doc dl.toc a { color: var(--fg-2); }
.is-doc dl.toc a:hover { color: var(--link); }
.is-doc .list-of-tables { display: none; }

/* Text */
.is-doc p, .is-doc li, .is-doc dd { line-height: 1.75; }
.is-doc a.ulink, .is-doc a.link { text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); text-underline-offset: 3px; }
.is-doc a.ulink:hover, .is-doc a.link:hover { text-decoration-color: var(--link); }
.is-doc ul, .is-doc ol { padding-left: 1.4em; }
.is-doc li { margin: .35em 0; }
.is-doc li::marker { color: var(--muted); }
.is-doc li > p { margin: 0 0 .4em; }
.is-doc .orderedlist > ol { counter-reset: step; list-style: none; padding: 0; }
.is-doc .orderedlist > ol > li { counter-increment: step; position: relative; padding-left: 44px; margin: 1em 0; }
.is-doc .orderedlist > ol > li::before {
  content: counter(step); position: absolute; left: 0; top: .15em;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem;
}
.is-doc code, .is-doc .literal, .is-doc .filename, .is-doc .option, .is-doc .command, .is-doc .package {
  font-family: var(--mono); font-size: .86em;
}
.is-doc code.literal, .is-doc code.filename, .is-doc code.option, .is-doc code.command, .is-doc code.function,
.is-doc code.varname, .is-doc span.package {
  background: var(--inline-code-bg); padding: .12em .38em; border-radius: 6px; color: var(--fg); overflow-wrap: anywhere;
}
.is-doc em.replaceable, .is-doc .replaceable { color: var(--accent); font-style: italic; }
.is-doc .emphasis strong, .is-doc strong { color: var(--fg); }

/* Code blocks */
.is-doc .code-wrap { position: relative; margin: 1em 0 1.5em; }
.is-doc pre.programlisting, .is-doc pre.screen, .is-doc pre.synopsis {
  background: var(--code-bg); color: var(--code-fg); padding: 18px 22px; border-radius: 12px;
  overflow-x: auto; font-size: .85rem; line-height: 1.7; margin: 1em 0 1.5em;
  border: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04);
}
.is-doc .code-wrap > pre { margin: 0; }
.is-doc pre .replaceable { color: #5eead4; }
.is-doc .copy {
  position: absolute; top: 8px; right: 8px; padding: 4px 10px; border-radius: 7px; cursor: pointer;
  font: 600 .75rem var(--font); color: #cbd5e1; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .14);
  opacity: 0; transition: opacity .15s ease, background .15s ease;
}
.is-doc .code-wrap:hover .copy, .is-doc .copy:focus-visible { opacity: 1; }
.is-doc .copy:hover { background: rgba(255, 255, 255, .16); color: #fff; }

/* Definition lists (options, commands) */
.is-doc .variablelist { margin: 1em 0 1.6em; }
.is-doc .variablelist > dl {
  margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface);
}
.is-doc .variablelist > dl > dt {
  margin: 0; padding: 12px 18px 0; font-weight: 600; color: var(--fg);
  border-top: 1px solid var(--border);
}
.is-doc .variablelist > dl > dt:first-child { border-top: 0; }
.is-doc .variablelist > dl > dt + dt { border-top: 0; padding-top: 2px; }
.is-doc .variablelist > dl > dd { margin: 0; padding: 4px 18px 14px; }
.is-doc .variablelist > dl > dd > p:last-child { margin-bottom: 0; }
.is-doc .variablelist dt code.option, .is-doc .variablelist dt code.literal { background: var(--accent-soft); color: var(--accent); }
@media (min-width: 1100px) {
  .is-doc .variablelist > dl { display: grid; grid-template-columns: minmax(150px, 32%) minmax(0, 1fr); }
  .is-doc .variablelist > dl > dt { grid-column: 1; padding: 14px 18px; background: var(--bg-soft); border-right: 1px solid var(--border); }
  .is-doc .variablelist > dl > dt + dt { padding-top: 0; }
  .is-doc .variablelist > dl > dd { grid-column: 2; padding: 14px 20px; border-top: 1px solid var(--border); }
  .is-doc .variablelist > dl > dd:nth-child(2) { border-top: 0; }
}

/* Command synopsis */
.is-doc .cmdsynopsis {
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 18px; font-family: var(--mono); font-size: .88rem; line-height: 1.9;
}
.is-doc .cmdsynopsis p { margin: 0; }
.is-doc .cmdsynopsis code { background: none; padding: 0; }
.is-doc .cmdsynopsis + .cmdsynopsis { margin-top: 8px; }

/* Admonitions */
.is-doc .note, .is-doc .important, .is-doc .warning, .is-doc .tip, .is-doc .caution {
  border: 1px solid color-mix(in srgb, var(--accent-2) 25%, var(--border));
  background: color-mix(in srgb, var(--accent-2) 7%, var(--surface));
  border-radius: 12px; padding: 14px 18px 14px 50px; margin: 1.4em 0; position: relative;
}
.is-doc .note::before, .is-doc .tip::before, .is-doc .important::before, .is-doc .warning::before, .is-doc .caution::before {
  content: "i"; position: absolute; left: 16px; top: 15px;
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-2); color: #fff; font: 700 .8rem/1 var(--font);
}
.is-doc .important, .is-doc .warning, .is-doc .caution {
  border-color: color-mix(in srgb, #f59e0b 35%, var(--border)); background: color-mix(in srgb, #f59e0b 8%, var(--surface));
}
.is-doc .important::before, .is-doc .warning::before, .is-doc .caution::before { content: "!"; background: #f59e0b; }
.is-doc .note h3.title, .is-doc .important h3.title, .is-doc .warning h3.title, .is-doc .tip h3.title, .is-doc .caution h3.title {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; margin: 2px 0 6px; padding: 0; border: 0; color: var(--fg);
}
.is-doc .note p:last-child, .is-doc .important p:last-child, .is-doc .warning p:last-child, .is-doc .tip p:last-child { margin-bottom: 0; }
.is-doc .highlights { font-size: 1.05rem; }

/* Tables */
.is-doc .table { margin: 1.2em 0 1.6em; }
.is-doc .table-contents { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.is-doc table { border-collapse: collapse; width: 100%; font-size: .93rem; margin: 0; }
.is-doc th, .is-doc td { border: 0 !important; border-bottom: 1px solid var(--border) !important; padding: 10px 14px; text-align: left; vertical-align: top; }
.is-doc tr:last-child td { border-bottom: 0 !important; }
.is-doc th { background: var(--bg-soft); color: var(--fg); font-weight: 650; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.is-doc .table > .title { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.is-doc .table-break { display: none; }

/* Manual pages */
.is-doc .refentry > .refnamediv {
  margin: 16px 0 32px; padding: 32px 36px; border-radius: 20px; border: 1px solid var(--border);
  background:
    radial-gradient(520px 260px at 0% 0%, color-mix(in srgb, #14b8a6 18%, transparent), transparent),
    radial-gradient(520px 260px at 100% 100%, color-mix(in srgb, #2563eb 16%, transparent), transparent),
    var(--bg-soft);
}
.is-doc .refnamediv h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; color: var(--accent); margin: 0 0 10px; border: 0; padding: 0; }
.is-doc .refnamediv p { font-size: clamp(1.4rem, 3vw, 1.9rem); line-height: 1.3; letter-spacing: -.02em; color: var(--fg); margin: 0; font-weight: 700; }
.is-doc .refsynopsisdiv h2 { font-size: 1.45rem; margin: 0 0 .6em; }
.is-doc .refentrytitle { font-weight: 650; }
/* Man page section names are all caps in the source; show them in sentence case. */
.is-doc .refsect1 > h2 { text-transform: lowercase; }
.is-doc .refsect1 > h2::first-letter { text-transform: uppercase; }

/* Footnotes */
.is-doc .footnotes { margin-top: 3em; font-size: .9rem; color: var(--muted); }
.is-doc .footnotes hr { border: 0; border-top: 1px solid var(--border); }

@media (max-width: 1000px) {
  .doc-layout { display: block; padding: 0; }
  .doc-sidebar { display: none; }
  .doc-layout > .book, .doc-layout > .article, .doc-layout > .refentry { margin: 0 auto; padding: 8px 24px 88px; max-width: 900px; }
}
@media (min-width: 1001px) {
  .has-sidebar .book > .toc { display: none; }
}
@media (max-width: 860px) {
  .doc-nav.nav-links { display: flex; position: static; flex-direction: row; padding: 0; background: none; border: 0; box-shadow: none; margin-left: auto; }
  .doc-nav.nav-links > a:not(.btn) { padding: 6px 8px; }
  .doc-nav .btn { display: none; }
}
@media (max-width: 720px) {
  .is-doc > .book, .is-doc > .article, .is-doc > .refentry,
  .doc-layout > .book, .doc-layout > .article, .doc-layout > .refentry { padding: 8px 16px 64px; }
  .doc-crumbs { padding-top: 20px; }
  .is-doc .book > .titlepage, .is-doc .refentry > .refnamediv { padding: 24px 20px; }
}
