/* docs.knownprint.com: the layout, the page text, code, tables, callouts, tabs and search. Colours
   are the site's tokens (tools/site/public/assets/site.css); the dark set follows the system. */

@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/fonts/archivo-latin-wght.woff2") format("woff2");
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304,
    U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("/assets/fonts/archivo-latin-ext-wght.woff2") format("woff2");
  unicode-range:
    U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308,
    U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: light dark;
  --page: #f4f7fc;
  --card: #ffffff;
  --sunken: #e8eef8;
  --hover: #eef3ff;
  --text: #0b1b33;
  --muted: #475569;
  --faint: #64748b;
  --primary: #2451e6;
  --primary-hover: #1b3fbf;
  --primary-soft: rgba(36, 81, 230, 0.1);
  --border: #d9e1ec;
  --border-strong: #94a3b8;
  --note: #2451e6;
  --note-bg: #eef3ff;
  --tip: #15803d;
  --tip-bg: #f0fdf4;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --code-bg: #0b1b33;
  --code-head: #132a4d;
  --code-text: #f4f7fc;
  --code-comment: #a9b8cf;
  --code-keyword: #7fa6ff;
  --code-string: #9be7f2;
  --code-number: #fcd38d;
  --code-prop: #c4d5ff;
  --code-var: #fca5a5;
  --inline-code-bg: #e8eef8;
  --mark: #2451e6;
  --shadow: 0 12px 32px rgba(11, 27, 51, 0.18);
  --font: "Archivo", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --topbar: 60px;
  --sidebar: 272px;
  --toc: 232px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b1b33;
    --card: #132a4d;
    --sunken: #10233f;
    --hover: #1a3459;
    --text: #f4f7fc;
    --muted: #c3cfdf;
    --faint: #8396b0;
    --primary: #7fa6ff;
    --primary-hover: #a9c3ff;
    --primary-soft: rgba(127, 166, 255, 0.14);
    --border: #243b5e;
    --border-strong: #3d5a85;
    --note: #7fa6ff;
    --note-bg: #13284a;
    --tip: #4ade80;
    --tip-bg: #10301f;
    --warn: #fbbf24;
    --warn-bg: #33270d;
    --code-bg: #071326;
    --code-head: #0f2242;
    --inline-code-bg: #1a3459;
    --mark: #7fa6ff;
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  }
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}
a:hover {
  color: var(--primary-hover);
}
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
::selection {
  background: var(--primary-soft);
}

.skip {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.skip:focus {
  top: 8px;
}

/* Top bar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar);
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
  max-width: 1480px;
  margin: 0 auto;
  padding: 0 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand:hover {
  color: var(--text);
}
.mark {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--mark);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand-docs {
  font-weight: 600;
  color: var(--muted);
  padding-left: 8px;
  border-left: 1px solid var(--border);
}
.search-button {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 300px;
  margin-left: 12px;
  height: 38px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--faint);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
}
.search-button:hover {
  border-color: var(--border-strong);
}
.search-button svg,
.search-form svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}
.search-label {
  flex: 1;
  text-align: left;
}
kbd {
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--sunken);
  color: var(--muted);
}
.topnav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.topnav a {
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.topnav a:hover {
  color: var(--text);
  background: var(--hover);
}
.topnav .topnav-cta {
  margin-left: 6px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
}
.topnav .topnav-cta:hover {
  background: var(--primary-hover);
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .topnav .topnav-cta,
  .topnav .topnav-cta:hover {
    color: #0b1b33;
  }
}
.menu-button {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-left: -8px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--text);
  cursor: pointer;
}
.menu-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* Three columns */

.layout {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr) var(--toc);
  max-width: 1480px;
  margin: 0 auto;
}
.sidebar {
  position: sticky;
  top: var(--topbar);
  align-self: start;
  height: calc(100vh - var(--topbar));
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 12px 48px 20px;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
}
.nav-section + .nav-section {
  margin-top: 22px;
}
/* The site's links, in the drawer only: the top bar holds them on wider screens. */
.nav-site {
  display: none;
}
.nav-heading {
  margin: 0 0 6px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar a {
  display: block;
  padding: 5px 10px;
  border-radius: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14.5px;
  line-height: 1.4;
}
.sidebar a:hover {
  background: var(--hover);
  color: var(--text);
}
.sidebar a[aria-current="page"] {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

main {
  min-width: 0;
  padding: 40px 56px 32px;
}
main:focus {
  outline: none;
}
.doc {
  max-width: 780px;
  margin: 0 auto;
}

.toc {
  position: sticky;
  top: var(--topbar);
  align-self: start;
  max-height: calc(100vh - var(--topbar));
  overflow-y: auto;
  padding: 40px 20px 40px 8px;
  font-size: 13.5px;
  scrollbar-width: thin;
}
.toc-heading {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--faint);
}
.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--border);
}
.toc a {
  display: block;
  padding: 3px 0 3px 12px;
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.4;
}
.toc .toc-3 a {
  padding-left: 24px;
}
.toc a:hover {
  color: var(--text);
}
.toc a.active {
  color: var(--primary);
  border-left-color: var(--primary);
}

/* Page text */

.eyebrow {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--primary);
}
.doc h1 {
  margin: 0;
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  font-weight: 750;
}
.lede {
  margin: 12px 0 32px;
  font-size: 18.5px;
  line-height: 1.55;
  color: var(--muted);
}
.doc h2,
.doc h3,
.doc h4 {
  position: relative;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.doc h2 {
  margin: 48px 0 14px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 26px;
  font-weight: 700;
}
.doc h3 {
  margin: 32px 0 10px;
  font-size: 20px;
  font-weight: 650;
}
.doc h4 {
  margin: 24px 0 8px;
  font-size: 17px;
  font-weight: 650;
}
.anchor {
  position: absolute;
  left: -0.9em;
  width: 0.9em;
  color: var(--faint);
  text-decoration: none;
  opacity: 0;
  font-weight: 400;
}
h2:hover .anchor,
h3:hover .anchor,
h4:hover .anchor,
.anchor:focus {
  opacity: 1;
}
.doc p,
.doc ul,
.doc ol {
  margin: 0 0 16px;
}
.doc ul,
.doc ol {
  padding-left: 1.4em;
}
.doc li {
  margin: 4px 0;
}
.doc li > ul,
.doc li > ol {
  margin: 4px 0 0;
}
.doc li > p {
  margin: 0 0 8px;
}
.doc strong {
  font-weight: 650;
}
.doc hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}
.doc blockquote {
  margin: 0 0 16px;
  padding: 4px 0 4px 16px;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
}
.doc :not(pre) > code {
  font-family: var(--mono);
  font-size: 0.86em;
  padding: 0.12em 0.36em;
  border-radius: 5px;
  background: var(--inline-code-bg);
  overflow-wrap: anywhere;
}
.doc a code {
  color: inherit;
}

/* Tables */

.table {
  margin: 0 0 20px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
}
.table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14.5px;
  line-height: 1.5;
}
.table th,
.table td {
  padding: 9px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.table th {
  background: var(--sunken);
  font-weight: 650;
  white-space: nowrap;
}
.table tr:last-child td {
  border-bottom: 0;
}
.table td:first-child code {
  white-space: nowrap;
}
.table .align-right {
  text-align: right;
}
.table .align-center {
  text-align: center;
}

/* Code */

.code {
  margin: 0 0 20px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--code-bg);
  color: var(--code-text);
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px 6px 14px;
  background: var(--code-head);
  font-size: 12.5px;
  color: var(--code-comment);
}
.code-title {
  font-family: var(--mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.copy {
  padding: 3px 10px;
  border: 1px solid rgba(244, 247, 252, 0.18);
  border-radius: 6px;
  background: transparent;
  color: var(--code-text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.copy:hover {
  background: rgba(244, 247, 252, 0.12);
}
.code pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  tab-size: 2;
}
.code code {
  font-family: inherit;
}
.t-c {
  color: var(--code-comment);
  font-style: italic;
}
.t-s {
  color: var(--code-string);
}
.t-k {
  color: var(--code-keyword);
}
.t-n {
  color: var(--code-number);
}
.t-p {
  color: var(--code-prop);
}
.t-v {
  color: var(--code-var);
}

/* Tabs: without the script every panel shows, each under its own title. */

.tabs {
  margin: 0 0 20px;
}
.tablist {
  display: none;
}
.tabs.ready .tablist {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding: 4px 4px 0;
  border-radius: 10px 10px 0 0;
  background: var(--code-head);
}
.tabs.ready .tablist button {
  padding: 7px 14px;
  border: 0;
  border-radius: 7px 7px 0 0;
  background: transparent;
  color: var(--code-comment);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.tabs.ready .tablist button[aria-selected="true"] {
  background: var(--code-bg);
  color: var(--code-text);
}
.tabs.ready [role="tabpanel"][hidden] {
  display: none;
}
.tabs.ready .code {
  border-radius: 0 0 10px 10px;
}
.tabs.ready .code-head .code-title {
  visibility: hidden;
}

/* Callouts */

.callout {
  margin: 0 0 20px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--note);
  border-radius: 10px;
  background: var(--note-bg);
}
.callout-tip {
  border-left-color: var(--tip);
  background: var(--tip-bg);
}
.callout-warning {
  border-left-color: var(--warn);
  background: var(--warn-bg);
}
.doc .callout-title {
  margin: 0 0 4px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: var(--note);
}
.callout-tip .callout-title {
  color: var(--tip);
}
.callout-warning .callout-title {
  color: var(--warn);
}
.callout > :last-child {
  margin-bottom: 0;
}

/* Previous and next */

.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 56px 0 0;
}
.pager a {
  display: block;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.pager a:hover {
  border-color: var(--primary);
}
.pager span {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--faint);
}
.pager-next {
  text-align: right;
  grid-column: 2;
}

.doc-footer {
  max-width: 780px;
  margin: 64px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--faint);
}
.doc-footer p {
  margin: 0 0 6px;
}
.doc-footer a {
  color: var(--muted);
  margin-left: 10px;
}

/* Search */

.search {
  width: min(640px, calc(100vw - 32px));
  max-height: min(560px, calc(100vh - 96px));
  margin: 72px auto auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.search[open] {
  display: flex;
  flex-direction: column;
}
.search::backdrop {
  background: rgba(11, 27, 51, 0.45);
}
.search-form {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--faint);
}
.search-form input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 17px;
  outline: none;
}
.search-form input::-webkit-search-cancel-button {
  display: none;
}
.search-close {
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--sunken);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.search-results {
  list-style: none;
  margin: 0;
  padding: 6px;
  overflow-y: auto;
}
.search-results a {
  display: block;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--text);
  text-decoration: none;
}
.search-results a[aria-selected="true"],
.search-results a:hover {
  background: var(--primary-soft);
}
.search-results .r-section {
  display: block;
  font-size: 12px;
  color: var(--faint);
}
.search-results .r-title {
  display: block;
  font-weight: 600;
}
.search-results .r-snippet {
  display: block;
  margin-top: 2px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.45;
}
.search-results mark {
  background: none;
  color: var(--primary);
  font-weight: 650;
}
.search-empty {
  margin: 0;
  padding: 20px;
  color: var(--faint);
  text-align: center;
}

/* Narrower screens */

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

@media (max-width: 900px) {
  .layout {
    display: block;
  }
  .menu-button {
    display: inline-flex;
  }
  .sidebar {
    position: fixed;
    top: var(--topbar);
    left: 0;
    bottom: 0;
    z-index: 25;
    width: min(320px, 86vw);
    height: auto;
    background: var(--page);
    box-shadow: var(--shadow);
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    visibility: hidden;
  }
  body.nav-open .sidebar {
    transform: none;
    visibility: visible;
  }
  .nav-site {
    display: block;
  }
  .topnav a:not(.topnav-cta) {
    display: none;
  }
  main {
    padding: 28px 16px 24px;
  }
  .search-button {
    flex: 1;
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .search-label,
  .search-button kbd,
  .brand-docs {
    display: none;
  }
  .search-button {
    flex: 0 0 38px;
    justify-content: center;
    padding: 0;
    margin-left: auto;
  }
  .topnav {
    display: none;
  }
  .lede {
    font-size: 17px;
  }
  .pager {
    grid-template-columns: 1fr;
  }
  .pager-next {
    grid-column: 1;
  }
}

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

@media print {
  .topbar,
  .sidebar,
  .toc,
  .pager,
  .copy {
    display: none;
  }
  .layout {
    display: block;
  }
}
