/* Handbook. Builds on site.css; pages are generated by tools/build_handbook.py from content/handbook/.
   Layout: sidebar (sections as coloured icon tiles that unfold into pages) · article · "On this page".
   Every component below is one a page source can use; the list lives in the builder's docstring. */

.hb-body { background: var(--bg); }
/* The handbook needs three columns, so it is wider than the rest of the site; the top navigation widens with
   it on handbook pages, so the logo and the sidebar share one left edge. */
.hb-body .nav-inner { max-width: 1480px; }
.hb-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 0 clamp(28px, 4vw, 64px);
  max-width: 1480px; margin: 0 auto; padding: calc(var(--nav-h) + 28px) var(--gutter) 64px; }
.hb-layout.has-toc { grid-template-columns: 290px minmax(0, 1fr) 220px; }

/* Section colours: one per part of the handbook, used for the sidebar tile and the article's accents. */
.c-green { --sec: var(--green-ink); --sec-soft: var(--green-soft); }
.c-navy { --sec: var(--navy); --sec-soft: var(--navy-soft); }
.c-info { --sec: var(--info); --sec-soft: color-mix(in srgb, var(--info) 14%, var(--surface)); }
.c-violet { --sec: var(--violet); --sec-soft: var(--violet-soft); }
.c-purple { --sec: var(--purple); --sec-soft: var(--purple-soft); }
.c-yellow { --sec: var(--yellow); --sec-soft: var(--yellow-soft); }
.c-ink { --sec: var(--text); --sec-soft: var(--surface-3); }  /* MCP: the one part for people who work in a terminal */
.c-muted { --sec: var(--muted); --sec-soft: var(--surface-3); }

/* ---------------------------------------------------------------- sidebar */
/* The sidebar is as tall as the screen: the sections scroll inside it, the Troubleshooting row below them does not,
   so that row always sits at the bottom left of the screen (Jonas, 19.10.2026). */
.hb-side { position: sticky; top: calc(var(--nav-h) + 20px); align-self: start; display: flex; flex-direction: column;
  height: calc(100vh - var(--nav-h) - 36px); }
.hb-side-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 6px 6px 0; scrollbar-width: thin; }
.hb-search-btn { display: flex; align-items: center; gap: 10px; width: 100%; margin-bottom: 18px; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font: inherit;
  font-size: 0.92rem; cursor: pointer; text-align: left; box-shadow: var(--shadow); }
.hb-search-btn span { flex: 1; }
.hb-search-btn:hover { border-color: var(--border-strong); color: var(--text); }
.hb-search-btn svg.ic { width: 17px; height: 17px; }
.hb-search-btn kbd { font-size: 0.72rem; }
.hb-sec { margin-bottom: 4px; }
.hb-sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 7px 8px;
  border-radius: 12px; color: var(--text); }
.hb-sec > summary::-webkit-details-marker { display: none; }
.hb-sec > summary:hover { background: var(--surface); }
.hb-sec > summary:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }
.hb-sec-ic { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--sec); color: var(--surface); }
.hb-sec-ic svg.ic { width: 18px; height: 18px; stroke-width: 2; }
.hb-sec-title { flex: 1; font-weight: 700; font-size: 0.98rem; }
.hb-sec-chev { width: 16px; height: 16px; color: var(--faint); transition: transform .2s ease; }
.hb-sec[open] .hb-sec-chev { transform: rotate(90deg); }
.hb-sec ul { list-style: none; margin: 2px 0 10px 25px; padding: 0 0 0 20px; border-left: 1px solid var(--border); }
.hb-sec li a { display: block; padding: 6px 10px; margin-left: -1px; border-left: 2px solid transparent; border-radius: 0 8px 8px 0;
  color: var(--muted); font-size: 0.92rem; line-height: 1.35; }
.hb-sec li a:hover { color: var(--text); text-decoration: none; background: var(--surface); }
.hb-sec li a[aria-current="page"] { color: var(--sec); border-left-color: var(--sec); font-weight: 650; background: var(--sec-soft); }
.hb-menu-btn { display: none; }

/* ---------------------------------------------------------------- article */
.hb-main { min-width: 0; }
.hb-article { max-width: 780px; color: var(--text); font-size: 1.04rem; line-height: 1.72; }
.hb-crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.86rem; color: var(--faint); margin-bottom: 10px; }
.hb-crumbs a { color: var(--muted); }
.hb-crumbs span:last-child { color: var(--sec); font-weight: 650; }
.hb-article h1 { font-size: clamp(2.1rem, 4.4vw, 3rem); font-weight: 780; letter-spacing: -0.03em; line-height: 1.1; margin: 0 0 14px; text-wrap: balance; }
.hb-article .lead { font-size: 1.18rem; line-height: 1.6; color: var(--muted); margin-bottom: 30px; max-width: 64ch; }
.hb-article h2 { font-size: clamp(1.45rem, 2.6vw, 1.8rem); font-weight: 750; letter-spacing: -0.02em; line-height: 1.25;
  margin: 52px 0 14px; padding-top: 10px; scroll-margin-top: calc(var(--nav-h) + 20px); text-wrap: balance; }
.hb-article h3 { font-size: 1.18rem; font-weight: 700; margin: 32px 0 10px; scroll-margin-top: calc(var(--nav-h) + 20px); }
.hb-article h4 { font-size: 1rem; font-weight: 700; margin: 24px 0 8px; scroll-margin-top: calc(var(--nav-h) + 20px); }
.hb-anchor { margin-left: 8px; color: var(--faint); font-weight: 500; opacity: 0; text-decoration: none; transition: opacity .15s ease; }
:is(h2, h3, h4):hover > .hb-anchor, .hb-anchor:focus-visible { opacity: 1; text-decoration: none; }
.hb-article p, .hb-article ul, .hb-article ol, .hb-article dl, .hb-article table { margin: 0 0 16px; }
.hb-article ul, .hb-article ol { padding-left: 1.35em; }
.hb-article li + li { margin-top: 5px; }
.hb-article a { color: var(--green-ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--green-ink) 35%, transparent); text-underline-offset: 3px; }
.hb-article a:hover { text-decoration-color: currentColor; }
.hb-article code { font-family: var(--mono); font-size: .88em; padding: 2px 6px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); }
.hb-article hr { border: 0; border-top: 1px solid var(--border); margin: 36px 0; }
kbd { display: inline-block; min-width: 1.6em; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border-strong);
  border-bottom-width: 2px; background: var(--surface); font-family: var(--mono); font-size: .8em; line-height: 1.5; text-align: center; color: var(--text); }

/* Tables */
.hb-article table { width: 100%; border-collapse: collapse; font-size: 0.95rem; display: block; overflow-x: auto; }
.hb-article th { text-align: left; font-size: 0.78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border-strong); }
.hb-article td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }

/* A path through the app's menus: Settings › AI › Provider */
.ui { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px; vertical-align: baseline; }
.ui-step { padding: 1px 8px; border-radius: 7px; background: var(--surface); border: 1px solid var(--border); font-size: .9em; font-weight: 600; color: var(--text); white-space: nowrap; }
.ui-sep { color: var(--faint); font-size: .9em; padding: 0 2px; }

/* Small labels */
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.74rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; vertical-align: middle; color: var(--badge, var(--muted)); background: color-mix(in srgb, var(--badge, var(--muted)) 13%, transparent); }
.badge.key { --badge: var(--violet); }
.badge.optional { --badge: var(--info); }
.badge.soon { --badge: var(--wait); }

/* Callouts */
.callout { --c: var(--info); margin: 22px 0; padding: 14px 18px 4px; border-radius: 14px; border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
  background: color-mix(in srgb, var(--c) 8%, var(--surface)); }
.callout.tip { --c: var(--ok); }
.callout.warning { --c: var(--wait); }
.callout.danger { --c: var(--bad); }
.callout.ai { --c: var(--violet); }
.callout-title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px !important; font-weight: 750; font-size: 0.95rem; color: var(--c); }
.callout-title svg.ic { width: 18px; height: 18px; }
.callout-body { font-size: 0.98rem; }
.callout-body > :last-child { margin-bottom: 12px; }

/* Numbered steps with a rail */
.steps { list-style: none; padding: 0 !important; margin: 26px 0 !important; counter-reset: step; }
.steps > li { position: relative; padding: 0 0 26px 58px; margin: 0 !important; counter-increment: step; }
.steps > li::before { content: counter(step); position: absolute; left: 0; top: -2px; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 750; font-size: 0.95rem; color: var(--sec); background: var(--sec-soft);
  border: 1.5px solid color-mix(in srgb, var(--sec) 35%, transparent); }
.steps > li::after { content: ""; position: absolute; left: 17px; top: 40px; bottom: 4px; width: 2px; background: var(--border); border-radius: 2px; }
.steps > li:last-child { padding-bottom: 4px; }
.steps > li:last-child::after { display: none; }
.steps > li > h3 { margin: 4px 0 6px; font-size: 1.08rem; }

/* Screenshots: framed, click to enlarge */
.shot { margin: 24px 0; }
.shot img { display: block; width: 100%; max-width: var(--w, 100%); height: auto; border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--surface-2); cursor: zoom-in; }
.shot figcaption { margin-top: 9px; font-size: 0.88rem; color: var(--muted); line-height: 1.5; }
.shot.narrow img, .shot.narrow .shot-frame { max-width: min(460px, var(--w, 100%)); }
.shot-zoom { position: absolute; right: 10px; top: 10px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px solid var(--border); color: var(--text); opacity: 0; transition: opacity .15s ease; pointer-events: none; }
.shot-frame { position: relative; max-width: var(--w, 100%); }
.shot-frame img { max-width: 100%; }
.shot-frame:hover .shot-zoom { opacity: 1; }
.shot-zoom svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

/* Lightbox */
.hb-lightbox { max-width: min(96vw, 1800px); max-height: 94vh; padding: 0; border: 0; border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-sheet); overflow: visible; }
.hb-lightbox::backdrop { background: color-mix(in srgb, #0b1218 78%, transparent); backdrop-filter: blur(3px); }
.hb-lightbox img { display: block; max-width: min(96vw, 1800px); max-height: calc(94vh - 52px); width: auto; height: auto; border-radius: 14px 14px 0 0; }
.hb-lightbox-caption { margin: 0; padding: 12px 18px; font-size: 0.92rem; color: var(--muted); }
.hb-lightbox-close { position: absolute; top: -14px; right: -14px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1.3rem; line-height: 1; cursor: pointer; box-shadow: var(--shadow); }

/* Carousel: screenshots to click through */
.carousel { margin: 24px 0; }
.carousel-viewport { overflow: hidden; border-radius: 12px; }
.carousel-track { display: flex; transition: transform .35s ease; }
.carousel-track > .shot { flex: 0 0 100%; margin: 0; }
.carousel-bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.carousel-bar button { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; }
.carousel-bar button:hover { border-color: var(--sec); color: var(--sec); }
.carousel-bar button svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.carousel-dots { display: flex; gap: 6px; }
.carousel-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); transition: background .2s ease, width .2s ease; }
.carousel-dots span.on { width: 20px; border-radius: 4px; background: var(--sec); }
.carousel-count { margin-left: auto; font-size: 0.85rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.no-js .carousel-track { flex-direction: column; gap: 20px; }

/* Tabs */
.tabs { margin: 22px 0; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.tabs-list { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); overflow-x: auto; }
.tabs-list button { padding: 7px 14px; border-radius: 9px; border: 0; background: none; font: inherit; font-size: 0.92rem; font-weight: 650; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs-list button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.tabs > section { padding: 18px 20px 4px; }
.no-js .tabs > section::before { content: attr(data-tab); display: block; font-weight: 750; margin-bottom: 8px; }

/* Code */
.code { position: relative; margin: 20px 0; padding: 38px 18px 16px; border-radius: 12px; background: var(--stage); color: var(--stage-text);
  font: 500 0.88rem/1.6 var(--mono); overflow-x: auto; border: 1px solid var(--stage-line); }
.code code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; }
.code::before { content: attr(data-lang); position: absolute; left: 16px; top: 10px; font-size: 0.72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--stage-muted); }
.copy-btn { position: absolute; right: 10px; top: 8px; padding: 3px 10px; border-radius: 7px; border: 1px solid var(--stage-line); background: var(--stage-2);
  color: var(--stage-text); font: 600 0.78rem/1.6 inherit; font-family: inherit; cursor: pointer; }
.copy-btn:hover { border-color: var(--stage-muted); }

/* An example prompt for the assistant */
.prompt { position: relative; display: flex; gap: 12px; align-items: flex-start; margin: 18px 0; padding: 14px 70px 14px 16px; border-radius: 14px;
  background: var(--violet-soft); border: 1px solid color-mix(in srgb, var(--violet) 25%, transparent); }
.prompt-ic { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--violet); color: var(--surface); }
.prompt-ic svg.ic { width: 16px; height: 16px; }
.prompt p { margin: 3px 0 0 !important; font-style: italic; color: var(--text); }
.prompt .copy-btn { top: 12px; border-color: color-mix(in srgb, var(--violet) 30%, transparent); background: var(--surface); color: var(--violet); }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 22px 0 28px; }
.card { display: flex; gap: 14px; align-items: flex-start; padding: 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
  box-shadow: var(--shadow); color: var(--text) !important; text-decoration: none !important; transition: transform .2s ease, border-color .2s ease; }
.card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.card-ic { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--sec-soft); color: var(--sec); }
.card-ic svg.ic { width: 20px; height: 20px; }
.card-text { display: grid; gap: 3px; }
.card-text b { font-size: 1rem; }
.card-text span { font-size: 0.9rem; color: var(--muted); line-height: 1.5; }

/* Definitions and checklists */
.defs { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; }
.defs dt { font-weight: 700; color: var(--text); }
.defs dd { margin: 0; color: var(--muted); }
.check { list-style: none; padding-left: 0 !important; }
.check li { position: relative; padding-left: 30px; }
.check li::before { content: ""; position: absolute; left: 0; top: .32em; width: 18px; height: 18px; border-radius: 50%; background: var(--green-soft);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--green-ink) 40%, transparent); }
.check li::after { content: ""; position: absolute; left: 6px; top: calc(.32em + 4px); width: 5px; height: 8px; border: solid var(--green-ink); border-width: 0 2px 2px 0; transform: rotate(45deg); }

/* ---------------------------------------------------------------- pager and "On this page" */
.hb-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-width: 780px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--border); }
.hb-pager a { display: grid; gap: 2px; padding: 14px 18px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.hb-pager a:hover { text-decoration: none; border-color: var(--green); }
.hb-pager span { font-size: 0.8rem; color: var(--faint); }
.hb-pager .hb-pager-next { text-align: right; }
.hb-toc { position: sticky; top: calc(var(--nav-h) + 28px); align-self: start; max-height: calc(100vh - var(--nav-h) - 48px); overflow-y: auto; font-size: 0.88rem; }
.hb-toc-title { font-weight: 750; font-size: 0.78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.hb-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.hb-toc li a { display: block; padding: 5px 0 5px 14px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); line-height: 1.4; }
.hb-toc li.l3 a { padding-left: 28px; font-size: 0.84rem; }
.hb-toc li a:hover { color: var(--text); text-decoration: none; }
.hb-toc li a.on { color: var(--green-ink); border-left-color: var(--green); font-weight: 650; }

/* ---------------------------------------------------------------- search */
.hb-search { width: min(680px, 94vw); margin-top: 12vh; padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-sheet); }
.hb-search::backdrop { background: color-mix(in srgb, #0b1218 55%, transparent); backdrop-filter: blur(2px); }
.hb-search input { width: 100%; padding: 18px 20px; border: 0; border-bottom: 1px solid var(--border); background: none; color: var(--text); font: inherit; font-size: 1.05rem; outline: none; }
.hb-search-results { list-style: none; margin: 0; padding: 6px; max-height: 56vh; overflow-y: auto; }
.hb-search-results a { display: grid; gap: 2px; padding: 10px 14px; border-radius: 10px; color: var(--text); text-decoration: none; }
.hb-search-results li[aria-selected="true"] a, .hb-search-results a:hover { background: var(--green-soft); text-decoration: none; }
.hb-search-results b { font-size: 0.98rem; }
.hb-search-results small { font-size: 0.78rem; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.hb-search-results span { font-size: 0.88rem; color: var(--muted); }
.hb-search-results mark { background: color-mix(in srgb, var(--green) 30%, transparent); color: inherit; border-radius: 3px; }
.hb-search-empty { padding: 18px; color: var(--muted); }
.hb-search-foot { margin: 0; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 0.8rem; color: var(--faint); }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 1240px) {
  .hb-layout.has-toc { grid-template-columns: 270px minmax(0, 1fr); }
  .hb-toc { display: none; }
}
@media (max-width: 900px) {
  .hb-layout, .hb-layout.has-toc { grid-template-columns: minmax(0, 1fr); padding-top: calc(var(--nav-h) + 12px); }
  .hb-menu-btn { display: flex; align-items: center; gap: 10px; position: sticky; top: calc(var(--nav-h) + 8px); z-index: 5; margin-bottom: 18px;
    padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 650; box-shadow: var(--shadow); }
  .hb-menu-btn svg.ic { width: 18px; height: 18px; }
  /* align-self also applies to a fixed grid child: stretch it, or it is only as tall as its links. */
  .hb-side { display: none; position: fixed; inset: var(--nav-h) 0 0 0; z-index: 40; align-self: stretch; height: auto; padding: 18px 16px 16px; background: var(--bg); }
  .hb-body.hb-menu-open .hb-side { display: flex; }
  .hb-pager { grid-template-columns: 1fr; }
  .defs { grid-template-columns: 1fr; gap: 2px 0; }
  .defs dd { margin-bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) { .carousel-track { transition: none; } }

/* A screenshot that has not been taken yet (the builder lists them); never shipped on purpose. */
.shot-placeholder { display: grid; gap: 6px; place-content: center; text-align: center; min-height: 220px; padding: 24px;
  border-radius: 12px; border: 2px dashed var(--border-strong); background: var(--surface-2); color: var(--muted); font-size: 0.9rem; }
.shot-placeholder b { color: var(--text); }
.shot.narrow .shot-placeholder { max-width: 460px; }

/* "See also": the related pages the prev/next buttons do not reach — one quiet line, not a card block. The cards
   ("Where to go next") are kept for the last page of a section, where the reader leaves the topic. */
.hb-seealso { margin-top: 40px; padding-top: 14px; border-top: 1px dashed var(--border); color: var(--muted); font-size: 0.92rem; }

/* The fixed Troubleshooting row at the foot of the sidebar; its right edge lines up with the search button above. */
.hb-trouble { flex: none; display: flex; align-items: center; gap: 12px; margin: 12px 6px 0 0; padding: 10px 12px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--wait) 40%, var(--border)); background: color-mix(in srgb, var(--wait) 9%, var(--surface));
  color: var(--text); font-size: 0.9rem; line-height: 1.3; }
.hb-trouble:hover, .hb-trouble[aria-current] { text-decoration: none; border-color: var(--wait); }
.hb-trouble .ic { flex: 0 0 auto; width: 20px; height: 20px; color: color-mix(in srgb, var(--wait) 70%, var(--text)); }
.hb-trouble span { display: grid; color: var(--muted); }
.hb-trouble b { color: var(--text); font-weight: 650; }
