/* GitMaster documentation. Colors come from the app palette (design/visual-identity.md):
   ink first, one quiet warm hue, the signature orange only as a small accent. */

:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --bg-soft: #eeede7;
  --border: #dbd9d2;
  --faint: #8a8882;
  --muted: #696761;
  --fg: #31302d;
  --strong: #161614;
  --red: #ba3e4b;
  --orange: #aa5100;
  --yellow: #846600;
  --green: #007b2f;
  --cyan: #007677;
  --blue: #006cbc;
  --violet: #7856c0;
  --magenta: #a9438d;
  --signature: #f54e00;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --topbar: 56px;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1a1918;
  --bg-soft: #272623;
  --border: #393833;
  --faint: #716f68;
  --muted: #9d9b92;
  --fg: #d2cfc5;
  --strong: #faf8f4;
  --red: #ff8b90;
  --orange: #f69557;
  --yellow: #d3a82d;
  --green: #64c175;
  --cyan: #00c0c0;
  --blue: #64b2ff;
  --violet: #b89fff;
  --magenta: #ed8ecf;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #1a1918;
    --bg-soft: #272623;
    --border: #393833;
    --faint: #716f68;
    --muted: #9d9b92;
    --fg: #d2cfc5;
    --strong: #faf8f4;
    --red: #ff8b90;
    --orange: #f69557;
    --yellow: #d3a82d;
    --green: #64c175;
    --cyan: #00c0c0;
    --blue: #64b2ff;
    --violet: #b89fff;
    --magenta: #ed8ecf;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--topbar) + 16px); -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.65 var(--font);
}

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 3px; }

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  padding: 8px 12px; background: var(--strong); color: var(--bg); border-radius: 6px;
}
.skip-link:focus { top: 8px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Top bar */

.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar);
  display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--strong); text-decoration: none; font-weight: 650; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-docs { color: var(--muted); font-weight: 450; }
.logo { display: block; border-radius: 6px; }
.logo-light { display: none; }
:root[data-theme="light"] .logo-dark { display: none; }
:root[data-theme="light"] .logo-light { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .logo-dark { display: none; }
  :root:not([data-theme="dark"]) .logo-light { display: block; }
}

.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--fg); cursor: pointer;
}
.icon-button:hover { background: var(--bg-soft); border-color: var(--border); }
.nav-toggle { display: none; }

.search { position: relative; margin-left: auto; width: min(380px, 40vw); }
.search input {
  width: 100%; height: 36px; padding: 0 34px 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-soft); color: var(--fg); font: inherit; font-size: 0.9rem;
}
.search input::placeholder { color: var(--muted); }
.search-key {
  position: absolute; right: 8px; top: 7px; padding: 0 6px; font: 0.75rem/20px var(--mono);
  color: var(--muted); border: 1px solid var(--border); border-radius: 4px; background: var(--bg);
}
.search-results {
  position: absolute; right: 0; top: 44px; width: min(560px, 92vw); max-height: 70vh; overflow: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgb(0 0 0 / 18%); padding: 6px;
}
.search-result { display: block; padding: 8px 10px; border-radius: 6px; color: var(--fg); text-decoration: none; }
.search-result:hover, .search-result[aria-selected="true"] { background: var(--bg-soft); text-decoration: none; }
.search-result .sr-title { display: flex; gap: 8px; align-items: baseline; color: var(--strong); font-weight: 600; }
.search-result .sr-section { color: var(--muted); font-size: 0.8rem; font-weight: 450; }
.search-result .sr-snippet { margin-top: 2px; color: var(--muted); font-size: 0.85rem; line-height: 1.45; }
.search-result mark { background: color-mix(in srgb, var(--yellow) 28%, transparent); color: inherit; border-radius: 2px; }
.search-empty { padding: 12px; color: var(--muted); }

/* Layout */

.shell {
  display: grid; grid-template-columns: 280px minmax(0, 1fr) 240px;
  max-width: 1440px; margin: 0 auto;
}

.sidebar {
  position: sticky; top: var(--topbar); align-self: start;
  height: calc(100vh - var(--topbar)); overflow-y: auto;
  padding: 20px 12px 40px 20px; border-right: 1px solid var(--border);
  font-size: 0.92rem;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.nav-heading {
  margin: 20px 0 6px; padding: 0 10px; color: var(--muted);
  font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase;
}
.nav-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 10px; border-radius: 6px; color: var(--fg); text-decoration: none;
}
.nav-link:hover { background: var(--bg-soft); text-decoration: none; }
.nav-link[aria-current="page"] {
  background: color-mix(in srgb, var(--blue) 12%, var(--bg)); color: var(--strong); font-weight: 600;
}
.dot { flex: none; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--faint); }
.dot-partial { border-color: var(--yellow); background: linear-gradient(90deg, var(--yellow) 50%, transparent 50%); }
.dot-planned { border-color: var(--faint); background: transparent; }
.dot-preview { border-color: var(--violet); background: var(--violet); }

.content { min-width: 0; padding: 32px 40px 64px; outline: none; }
.doc { max-width: 46rem; }
.crumbs { margin: 0 0 4px; color: var(--muted); font-size: 0.85rem; }

.toc {
  position: sticky; top: var(--topbar); align-self: start;
  max-height: calc(100vh - var(--topbar)); overflow-y: auto;
  padding: 32px 16px 40px 8px; font-size: 0.85rem;
}
.toc-title { margin: 0 0 8px; color: var(--muted); font-size: 0.75rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.toc a { display: block; padding: 3px 12px; margin-left: -1px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--strong); }
.toc a[aria-current="true"] { color: var(--strong); border-left-color: var(--blue); }
.toc .toc-l3 a { padding-left: 24px; }

/* Article */

.doc h1 { margin: 0 0 20px; color: var(--strong); font-size: 2.1rem; line-height: 1.2; letter-spacing: -0.01em; }
.doc h2 { margin: 2.2em 0 0.6em; padding-bottom: 0.3em; border-bottom: 1px solid var(--border); color: var(--strong); font-size: 1.45rem; line-height: 1.3; }
.doc h3 { margin: 1.8em 0 0.5em; color: var(--strong); font-size: 1.15rem; line-height: 1.35; }
.doc h4 { margin: 1.5em 0 0.4em; color: var(--strong); font-size: 1rem; }
.doc p, .doc ul, .doc ol, .doc .table-wrap, .doc .codeblock, .doc aside, .doc blockquote { margin: 0 0 1em; }
.doc ul, .doc ol { padding-left: 1.5em; }
.doc li { margin: 0.25em 0; }
.doc li > p { margin-bottom: 0.4em; }
.doc hr { border: 0; border-top: 1px solid var(--border); margin: 2em 0; }
.doc img { max-width: 100%; height: auto; }

.anchor { margin-left: 0.4em; color: var(--faint); font-weight: 400; text-decoration: none; opacity: 0; }
h2:hover > .anchor, h3:hover > .anchor, h4:hover > .anchor, .anchor:focus { opacity: 1; }

code { font: 0.88em var(--mono); padding: 0.15em 0.4em; border-radius: 5px; background: var(--bg-soft); border: 1px solid var(--border); }
kbd { font: 0.85em var(--mono); }

.codeblock { position: relative; }
.codeblock pre {
  margin: 0; padding: 30px 16px 14px; overflow-x: auto;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 10px;
  font: 0.86rem/1.6 var(--mono); tab-size: 4;
}
.codeblock pre code { padding: 0; border: 0; background: none; font: inherit; }
.codeblock::before {
  content: attr(data-lang); position: absolute; left: 14px; top: 7px;
  color: var(--muted); font: 0.7rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em;
}
.codeblock[data-lang="text"]::before { content: ""; }
.copy-button {
  position: absolute; right: 8px; top: 6px; padding: 2px 8px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--bg); color: var(--muted);
  font: 0.72rem var(--font); cursor: pointer; opacity: 0;
}
.codeblock:hover .copy-button, .copy-button:focus-visible { opacity: 1; }

.hl-comment { color: var(--muted); font-style: italic; }
.hl-string { color: var(--green); }
.hl-keyword, .hl-storage { color: var(--violet); }
.hl-constant { color: var(--orange); }
.hl-entity, .hl-support { color: var(--blue); }
.hl-punctuation { color: var(--muted); }
.hl-invalid { color: var(--red); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 10px; }
.table-wrap table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table-wrap th, .table-wrap td { padding: 8px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.table-wrap th { background: var(--bg-soft); color: var(--strong); font-weight: 600; white-space: nowrap; }
.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap td code { white-space: nowrap; }

blockquote { padding: 0.1em 1em; border-left: 3px solid var(--border); color: var(--muted); }

.callout { padding: 12px 16px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; background: var(--bg-soft); }
.callout > :last-child { margin-bottom: 0; }
.callout-label { text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.06em; }
.callout-note { border-left-color: var(--blue); }
.callout-note .callout-label { color: var(--blue); }
.callout-warning { border-left-color: var(--red); }
.callout-warning .callout-label { color: var(--red); }
.callout-planned { border-left-color: var(--yellow); background: color-mix(in srgb, var(--yellow) 9%, var(--bg)); }
.callout-planned .callout-label { color: var(--yellow); }

.badge {
  display: inline-block; margin-left: 12px; padding: 2px 10px; vertical-align: middle;
  border: 1px solid currentColor; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.02em; line-height: 1.5; white-space: nowrap;
}
.badge-partial, .badge-planned { color: var(--yellow); }
.badge-planned { color: var(--muted); }
.badge-implemented { color: var(--green); }
.badge.preview { color: var(--violet); }
.preview-note {
  margin: 0 0 1.5em; padding: 10px 14px; border-left: 3px solid var(--violet); border-radius: 6px;
  background: color-mix(in srgb, var(--violet) 9%, var(--bg)); color: var(--fg); font-size: 0.92rem;
}
.preview-note code { color: var(--strong); }

.pager { display: flex; justify-content: space-between; gap: 16px; max-width: 46rem; margin-top: 48px; }
.pager a {
  flex: 1; max-width: 50%; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px;
  color: var(--strong); text-decoration: none;
}
.pager a:hover { border-color: var(--blue); text-decoration: none; }
.pager .pager-label { display: block; color: var(--muted); font-size: 0.78rem; }
.pager .pager-next { margin-left: auto; text-align: right; }

.footer { max-width: 46rem; margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.85rem; }

/* Availability page */

.summary { display: flex; flex-wrap: wrap; gap: 12px; margin: 0 0 1.5em; }
.summary > div { min-width: 9rem; padding: 12px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-soft); }
.summary strong { display: block; color: var(--strong); font-size: 1.6rem; line-height: 1.2; }
.summary span { color: var(--muted); font-size: 0.85rem; }
.missing { margin: 0; padding-left: 1.2em; font-size: 0.88rem; }
.missing li { margin: 0.2em 0; }
.missing-more summary { cursor: pointer; color: var(--blue); }

/* Small screens */

@media (max-width: 1100px) {
  .shell { grid-template-columns: 260px minmax(0, 1fr); }
  .toc { display: none; }
}

@media (max-width: 820px) {
  .nav-toggle { display: inline-flex; }
  .brand-docs { display: none; }
  .search { width: auto; flex: 1; margin-left: 0; }
  .shell { display: block; }
  .sidebar {
    position: fixed; z-index: 40; top: var(--topbar); left: 0; width: min(320px, 88vw);
    background: var(--bg); transform: translateX(-102%); transition: transform 0.18s ease;
  }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgb(0 0 0 / 30%); }
  .nav-scrim { position: fixed; z-index: 35; inset: var(--topbar) 0 0 0; background: rgb(0 0 0 / 40%); }
  .content { padding: 24px 16px 48px; }
  .doc h1 { font-size: 1.7rem; }
  .search-key { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
  html { scroll-behavior: auto; }
}

@media print {
  .topbar, .sidebar, .toc, .pager, .copy-button, .nav-scrim { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; }
  body { background: #fff; color: #000; }
}
