/* The guides' pages: the application's palette and type (crates/ui_kit). */

@font-face {
  font-family: "Plex Sans";
  src: url("fonts/IBMPlexSans-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("fonts/IBMPlexSans-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("fonts/IBMPlexSans-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg0: #0b0e12;
  --bg1: #10151b;
  --bg2: #161c24;
  --bg3: #1f2731;
  --border: #1f2731;
  --border-strong: #2c3541;
  --text1: #e6ebf0;
  --text2: #9aa5b1;
  --text3: #7c8796;
  --accent: #4fa3e6;
  --accent-hover: #6db5ec;
  --accent-text: #0b1520;
  --success: #4fd08f;
  --warning: #e6a44f;
  --mesh: #c77dff;
  --radius: 8px;
  --page: 1120px;
}

* {
  box-sizing: border-box;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg0);
  color: var(--text1);
  font: 16px/1.6 "Plex Sans", system-ui, sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

code,
pre {
  font-family: "Plex Mono", ui-monospace, monospace;
  font-size: 0.9em;
}
code {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.05em 0.35em;
}
pre {
  background: var(--bg1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
  line-height: 1.45;
}
pre code {
  background: none;
  border: 0;
  padding: 0;
}

.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 24px;
}
.wrap.wide {
  max-width: 1360px;
}

/* Header */

.top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(11, 14, 18, 0.72);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--border);
}
.top .wrap {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text1);
  font-weight: 600;
  font-size: 17px;
}
.brand:hover {
  color: var(--text1);
  text-decoration: none;
}
.brand img {
  width: 24px;
  height: 24px;
}
.pill {
  font-size: 13px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text1);
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}
.pill:hover {
  border-color: var(--text2);
  color: var(--text1);
  text-decoration: none;
}
.pill.solid {
  background: var(--text1);
  border-color: var(--text1);
  color: var(--bg0);
  font-weight: 500;
}
.pill.solid:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg0);
}
.top nav {
  display: flex;
  gap: 28px;
  margin: 0 auto;
  font-size: 14px;
}
.top nav a {
  color: var(--text2);
}
.top nav a:hover,
.top nav a[aria-current="page"] {
  color: var(--text1);
  text-decoration: none;
}

/* Buttons */

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--bg2);
  color: var(--text1);
  font-weight: 500;
}
.button:hover {
  background: var(--bg3);
  color: var(--text1);
  text-decoration: none;
}
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.button.primary:hover {
  background: var(--accent-hover);
}
.button small {
  font-weight: 400;
  opacity: 0.75;
}

footer {
  border-top: 1px solid var(--border);
  padding: 32px 0 48px;
  color: var(--text3);
  font-size: 14px;
}
footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
}
footer a {
  color: var(--text3);
}
footer a:hover {
  color: var(--text1);
  text-decoration: none;
}
footer .brand {
  font-size: 15px;
  margin-right: 8px;
}
footer .brand img {
  width: 20px;
  height: 20px;
}
.foot-end {
  margin-left: auto;
  font: 12px "Plex Mono", ui-monospace, monospace;
  letter-spacing: 0.06em;
}

/* Guides */

.release-line {
  margin-top: 14px;
  color: var(--text3);
  font-size: 14px;
}

.docs {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 200px;
  gap: 48px;
  padding-top: 32px;
  padding-bottom: 64px;
}
.docs nav.side {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  font-size: 14px;
  padding-bottom: 32px;
  /* The list fades at its foot while there is more of it to scroll. */
  mask-image: linear-gradient(180deg, #000 calc(100% - 48px), transparent);
}
.docs nav.side h4 {
  margin: 18px 0 6px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
}
.docs nav.side h4:first-of-type {
  margin-top: 0;
}
.docs nav.side summary {
  display: none;
}
.docs nav.side ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.docs nav.side li a {
  display: block;
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--text2);
}
.docs nav.side li a:hover {
  background: var(--bg2);
  color: var(--text1);
  text-decoration: none;
}
.docs nav.side li a[aria-current="page"] {
  background: var(--bg2);
  color: var(--text1);
}

article {
  min-width: 0;
}
article h1 {
  font-size: 34px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 20px;
}
article h2 {
  font-size: 24px;
  font-weight: 600;
  margin: 40px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}
article h3 {
  font-size: 19px;
  font-weight: 600;
  margin: 28px 0 8px;
}
article p,
article li {
  color: #d3dae2;
}
article table {
  border-collapse: collapse;
  width: 100%;
  margin: 16px 0;
  font-size: 15px;
  display: block;
  overflow-x: auto;
}
article th,
article td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  vertical-align: top;
}
article th {
  background: var(--bg2);
}
article img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg1);
  vertical-align: top;
}
/* A picture on its own line, or two side by side, shrinking alike. */
article p:has(> img) {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 20px 0;
}
@media (max-width: 700px) {
  article p:has(> img) {
    flex-wrap: wrap;
  }
}
article p:has(> img) img {
  flex: 0 1 auto;
  min-width: 0;
}
article blockquote {
  margin: 16px 0;
  padding: 4px 16px;
  border-left: 3px solid var(--accent);
  color: var(--text2);
}

@media (max-width: 860px) {
  .docs {
    grid-template-columns: 1fr;
  }
  .docs nav.side {
    position: static;
    max-height: none;
    padding-bottom: 0;
    mask-image: none;
  }
  .docs nav.side summary {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    background: var(--bg1);
    color: var(--text2);
    font-size: 13px;
    cursor: pointer;
    list-style: none;
  }
  .docs nav.side summary::-webkit-details-marker {
    display: none;
  }
  .docs nav.side summary span {
    margin-left: auto;
    color: var(--text1);
    font-weight: 500;
  }
  .docs nav.side summary::after {
    content: "+";
    color: var(--text3);
  }
  .docs nav.side details[open] summary {
    margin-bottom: 16px;
  }
  .docs nav.side details[open] summary::after {
    content: "\2212";
  }
  .top nav {
    display: none;
  }
  .top nav + .pill {
    margin-left: auto;
  }
  .foot-end {
    margin-left: 0;
    flex-basis: 100%;
  }
}

/* Code in the guides: pandoc marks each token with a class. The colours
   are the app's own (sketch and status palette). */

div.sourceCode,
article pre {
  position: relative;
  margin: 16px 0;
}
div.sourceCode pre {
  margin: 0;
}
code span.kw,
code span.cf,
code span.im {
  color: #c77dff;
}
code span.st,
code span.ss,
code span.vs,
code span.ch,
code span.sc {
  color: #4fd08f;
}
code span.co,
code span.do,
code span.an,
code span.cv,
code span.in {
  color: var(--text3);
  font-style: italic;
}
code span.dv,
code span.bn,
code span.fl,
code span.cn {
  color: #e6a44f;
}
code span.fu {
  color: #6fd3c9;
}
code span.bu,
code span.ex {
  color: #7fd1e8;
}
code span.dt,
code span.at {
  color: #f2d479;
}
code span.op,
code span.ot {
  color: var(--text2);
}
code span.va {
  color: var(--text1);
}
code span.pp {
  color: #e86e6e;
}
code span.al,
code span.er {
  color: #e86e6e;
  font-weight: 600;
}
code span.wa {
  color: #e6a44f;
  font-style: italic;
}

.copy {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 3px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--bg2);
  color: var(--text2);
  font: 12px "Plex Sans", sans-serif;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
@media (hover: none) {
  .copy {
    opacity: 1;
  }
}
div.sourceCode:hover .copy,
pre:hover .copy,
.copy:focus {
  opacity: 1;
}
.copy:hover {
  color: var(--text1);
  background: var(--bg3);
}

/* Headings carry a link to themselves. */
article .anchor {
  margin-left: 8px;
  color: var(--text3);
  font-weight: 400;
  opacity: 0;
  text-decoration: none;
}
article h2:hover .anchor,
article h3:hover .anchor,
article .anchor:focus {
  opacity: 1;
}
article h2,
article h3 {
  scroll-margin-top: 72px;
}

/* On this page, beside the guide on wide screens. */
.docs aside.toc {
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  font-size: 13px;
  border-left: 1px solid var(--border);
  padding-left: 16px;
}
.docs aside.toc h4 {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text3);
}
.docs aside.toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.docs aside.toc ul ul {
  padding-left: 12px;
}
.docs aside.toc a {
  display: block;
  padding: 3px 0;
  color: var(--text2);
}
.docs aside.toc a:hover {
  color: var(--text1);
  text-decoration: none;
}

/* Previous and next guide. */
.pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 48px;
}
.pager a {
  display: block;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg1);
  color: var(--text1);
}
.pager a:hover {
  border-color: var(--border-strong);
  background: var(--bg2);
  text-decoration: none;
}
.pager small {
  display: block;
  color: var(--text3);
  font-size: 12px;
}
.pager .next {
  text-align: right;
  grid-column: 2;
}

@media (max-width: 1200px) {
  .docs {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .docs aside.toc {
    display: none;
  }
}
@media (max-width: 860px) {
  .docs {
    grid-template-columns: 1fr;
  }
}
