/* Virtual Git Server: the documentation.
   Builds on site.css - its tokens, fonts, header, buttons and footer - and adds
   the three columns (sidebar, page, table of contents) and what a page holds. */

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.docs { --sidebar: 256px; --toc: 208px; --page: 800px; }
.docs-bar { width: min(1440px, 100% - 48px); margin-inline: auto; }

/* ---------- header ---------- */

.docs .top { border-bottom-color: var(--line); }
.docs .top-inner { gap: 20px; }
.docs .brand-edition { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }

.search { position: relative; margin-left: auto; width: min(340px, 100%); }
.search input {
  width: 100%; font: inherit; font-size: 0.92rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 7px 34px 7px 12px;
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font: 600 0.72rem "Martian Mono", ui-monospace, monospace; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; pointer-events: none;
}
.search input:focus + kbd { display: none; }
.search-results {
  position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0;
  list-style: none; margin: 0; padding: 6px; max-height: min(70vh, 520px); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); box-shadow: var(--shadow);
  min-width: min(440px, calc(100vw - 32px));
}
.search-results li a { display: block; padding: 8px 10px; border-radius: var(--radius-s); text-decoration: none; color: var(--ink); }
.search-results li a[aria-selected="true"], .search-results li a:hover { background: var(--accent-soft); }
.search-results .r-title { display: block; font-weight: 600; font-size: 0.93rem; }
.search-results .r-page { color: var(--muted); font-weight: 400; }
.search-results .r-text { display: block; color: var(--muted); font-size: 0.82rem; line-height: 1.4; margin-top: 2px; }
.search-results mark { background: none; color: var(--accent); font-weight: 650; }
.search-results .r-none { padding: 10px; color: var(--muted); font-size: 0.9rem; }

.menu {
  display: none; font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; cursor: pointer;
}

/* ---------- three columns ---------- */

.docs-layout {
  width: min(1440px, 100% - 48px); margin-inline: auto;
  display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc); gap: 48px;
  align-items: start;
}

.sidebar {
  position: sticky; top: 64px; max-height: calc(100vh - 64px); overflow-y: auto;
  padding: 28px 8px 48px 0; scrollbar-width: thin;
}
.nav-group + .nav-group { margin-top: 22px; }
.nav-title { font-size: 0.78rem; font-weight: 650; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); padding: 0 10px 6px; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a {
  display: block; padding: 5px 10px; border-radius: var(--radius-s);
  color: var(--ink); text-decoration: none; font-size: 0.95rem; line-height: 1.35;
}
.sidebar a:hover { background: var(--sunken); }
.sidebar a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.toc { position: sticky; top: 64px; padding: 36px 0 32px; max-height: calc(100vh - 64px); overflow-y: auto; font-size: 0.88rem; }
.toc-title { font-weight: 650; margin-bottom: 8px; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.toc a { display: block; padding: 4px 0 4px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc a:hover { color: var(--ink); }
.toc a.active { color: var(--accent); border-left-color: var(--accent); }

/* ---------- the page ---------- */

.doc { padding: 36px 0 72px; min-width: 0; max-width: var(--page); }
.doc .eyebrow { font-size: 0.85rem; font-weight: 600; color: var(--accent); }
.doc h1 { margin-top: 6px; font-size: clamp(2rem, 3.6vw, 2.7rem); font-stretch: 88%; line-height: 1.05; letter-spacing: -0.02em; }
.doc .lead { max-width: none; margin-top: 14px; font-size: 1.17rem; line-height: 1.55; color: var(--muted); }

.doc article > * + * { margin-top: 1.05em; }
.doc article > .lead + * { margin-top: 32px; }
.doc h2 {
  margin-top: 2.4em !important; padding-top: 0.2em;
  font-size: 1.55rem; font-stretch: 92%; letter-spacing: -0.015em; max-width: none;
}
.doc h3 { margin-top: 1.9em !important; font-size: 1.16rem; }
.doc h2 + *, .doc h3 + * { margin-top: 0.7em; }
.doc h2, .doc h3 { position: relative; scroll-margin-top: 84px; }
.anchor {
  margin-left: 0.35em; color: var(--muted); text-decoration: none; font-weight: 400;
  opacity: 0; transition: opacity .15s;
}
.doc h2:hover .anchor, .doc h3:hover .anchor, .anchor:focus-visible { opacity: 1; }

.doc ul, .doc ol { padding-left: 1.3em; }
.doc li + li { margin-top: 0.35em; }
.doc li > ul, .doc li > ol { margin-top: 0.35em; }
.doc li > p + p { margin-top: 0.5em; }
.doc strong { font-weight: 650; }
.doc hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.doc :not(pre) > code { white-space: normal; overflow-wrap: anywhere; }
.doc a code { color: inherit; }
.doc blockquote { margin-inline: 0; padding: 4px 0 4px 18px; border-left: 3px solid var(--line); color: var(--muted); }

/* tables */
.table { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); }
.table table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
.table th, .table td { text-align: left; vertical-align: top; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.table tr:last-child td { border-bottom: 0; }
.table th { font-weight: 650; background: var(--sunken); white-space: nowrap; }
.table td:first-child { white-space: nowrap; }
.table td:first-child code { white-space: nowrap; }
.table.wrap-first td:first-child, .table td:first-child.wrap { white-space: normal; }

/* code blocks and their colors are in site.css, shared with the project page */

/* callouts */
.callout {
  border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius-m);
  background: var(--surface); padding: 14px 18px;
}
.callout > * + * { margin-top: 0.6em; }
.callout-title { font-weight: 650; }
.callout.tip { border-left-color: var(--online); }
.callout.tip .callout-title { color: var(--online); }
.callout.note .callout-title { color: var(--accent); }
.callout.warning { border-left-color: var(--warn); background: color-mix(in srgb, var(--warn) 6%, var(--surface)); }
.callout.warning .callout-title { color: var(--warn); }
.callout ul { margin: 0.5em 0 0; }

/* screenshots: a light and a dark capture, the theme picks */
.shot {
  display: block; border: 1px solid var(--line); border-radius: var(--radius-m);
  overflow: hidden; box-shadow: var(--shadow); background: var(--surface);
}
.shot img { display: block; width: 100%; height: auto; }
.shot-dark { display: none !important; }
:root[data-theme="dark"] .shot-light { display: none !important; }
:root[data-theme="dark"] .shot-dark { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shot-light { display: none !important; }
  :root:not([data-theme="light"]) .shot-dark { display: block !important; }
}
.caption, .diagram figcaption { display: block; margin-top: 10px; color: var(--muted); font-size: 0.9rem; line-height: 1.45; }
.doc p:has(> .shot) { margin-top: 1.6em; margin-bottom: 0.6em; }

/* diagrams: inline SVG drawn with the tokens */
.diagram { margin: 1.6em 0 0.6em; }
.diagram svg { display: block; width: 100%; height: auto; font-family: "Bricolage Grotesque", system-ui, sans-serif; }
.diagram figcaption:empty { display: none; }
.diagram .d-box { fill: var(--surface); stroke: var(--line); stroke-width: 1.5; }
.diagram .d-soft { fill: var(--sunken); stroke: var(--line); stroke-width: 1.5; }
.diagram .d-accent { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.diagram .d-ok { fill: color-mix(in srgb, var(--online) 12%, var(--surface)); stroke: var(--online); stroke-width: 1.5; }
.diagram .d-warn { fill: color-mix(in srgb, var(--warn) 10%, var(--surface)); stroke: var(--warn); stroke-width: 1.5; }
.diagram .d-frame { fill: none; stroke: var(--line); stroke-width: 1.5; stroke-dasharray: 5 4; }
.diagram .d-line { fill: none; stroke: var(--muted); stroke-width: 1.5; }
.diagram .d-line-accent { fill: none; stroke: var(--accent); stroke-width: 2; }
.diagram .d-line-ok { fill: none; stroke: var(--online); stroke-width: 2; }
.diagram .d-dash { stroke-dasharray: 4 4; }
.diagram .d-head { fill: var(--muted); }
.diagram .d-head-accent { fill: var(--accent); }
.diagram .d-head-ok { fill: var(--online); }
.diagram .d-dot { fill: var(--accent); }
.diagram .d-dot-ok { fill: var(--online); }
.diagram .d-dot-muted { fill: var(--muted); }
.diagram text { fill: var(--ink); font-size: 14px; }
.diagram .d-title { font-weight: 650; font-size: 15px; }
.diagram .d-small { font-size: 12.5px; fill: var(--muted); }
.diagram .d-mono { font-family: "Martian Mono", ui-monospace, monospace; font-size: 11.5px; fill: var(--muted); }
.diagram .d-label-accent { fill: var(--accent); font-weight: 600; }
.diagram .d-label-ok { fill: var(--online); font-weight: 600; }
.diagram .d-label-warn { fill: var(--warn); font-weight: 600; }

/* tabs: buttons made by docs.js from the panels' labels; without it, panels stack */
.doc-tabs { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); padding: 6px 16px 16px; }
.tab + .tab { margin-top: 16px; }
.tab > * + * { margin-top: 0.8em; }
.tab-title { font-weight: 650; padding-top: 10px; }
.doc-tabs.ready { padding-top: 0; }
.doc-tabs.ready .tab-title { display: none; }
.doc-tabs.ready .tab + .tab { margin-top: 0; }
.doc-tabs.ready .tab[hidden] { display: none; }
.tab-list { display: flex; flex-wrap: wrap; gap: 2px; margin: 0 -16px 14px; padding: 6px 10px 0; border-bottom: 1px solid var(--line); }
.tab-list button {
  font: inherit; font-size: 0.9rem; color: var(--muted); background: none; border: 0;
  border-bottom: 2px solid transparent; padding: 8px 10px 9px; margin-bottom: -1px; cursor: pointer;
}
.tab-list button:hover { color: var(--ink); }
.tab-list button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* a definition list of terms, as the concepts use it */
.doc dl { display: grid; gap: 14px; }
.doc dl > div { border-left: 2px solid var(--line); padding-left: 14px; }
.doc dt { font-weight: 650; }
.doc dd { margin: 2px 0 0; color: var(--muted); }

/* cards on the overview */
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 1.4em !important; }
.cards a {
  display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-m);
  background: var(--surface); color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s;
}
.cards a:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.cards strong { display: block; color: var(--accent); }
.cards span { display: block; margin-top: 4px; color: var(--muted); font-size: 0.93rem; line-height: 1.45; }

/* previous and next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); }
.pager a {
  display: block; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius-m);
  text-decoration: none; color: var(--ink); font-weight: 600; background: var(--surface);
}
.pager a:hover { border-color: var(--accent); }
.pager span { display: block; font-size: 0.8rem; font-weight: 400; color: var(--muted); }
.pager .next { text-align: right; }

.docs .foot { margin-top: 0; }

/* ---------- smaller screens ---------- */

@media (max-width: 1240px) {
  .docs-layout { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); gap: 0; width: min(1440px, 100% - 32px); }
  .docs-bar { width: min(1440px, 100% - 32px); }
  .menu { display: inline-block; }
  .sidebar {
    display: none; position: fixed; z-index: 25; top: 64px; left: 0; right: 0; bottom: 0; max-height: none;
    background: var(--bg); padding: 20px 16px 48px; border-top: 1px solid var(--line);
  }
  .sidebar.open { display: block; }
  .doc { padding-top: 24px; }
  .docs .brand-name { display: none; }
  .docs .brand-edition { display: inline-block; }
  .search { width: auto; flex: 1; min-width: 0; }
  .search kbd { display: none; }
  .search-results { position: fixed; left: 16px; right: 16px; top: 60px; min-width: 0; }
  .docs .top-actions { margin-left: 0; }
  .docs .icon-link { display: none; }
  .cards { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 520px) {
  .pager { grid-template-columns: minmax(0, 1fr); }
  .pager .next { text-align: left; }
  .table th, .table td { padding: 8px 10px; }
}

@media (forced-colors: active) {
  .sidebar a[aria-current="page"] { outline: 1px solid CanvasText; }
}

/* a screenshot, large */
.shot { cursor: zoom-in; }
.zoom {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 56px 24px 24px;
  background: rgb(10 8 16 / 82%); cursor: zoom-out;
}
.zoom img { max-width: min(100%, 1560px); max-height: 100%; width: auto; height: auto; border-radius: var(--radius-m); box-shadow: 0 20px 60px rgb(0 0 0 / 50%); }
.zoom-close {
  position: absolute; top: 12px; right: 16px; font: inherit; font-size: 0.9rem; font-weight: 600;
  color: #fff; background: rgb(255 255 255 / 12%); border: 1px solid rgb(255 255 255 / 25%);
  border-radius: 999px; padding: 6px 14px; cursor: pointer;
}
