/* The colours and fonts of the app (assets/style.css), set for reading long pages. */
:root {
  color-scheme: light dark;
  --accent: #2d6a5f;

  --bg: light-dark(#fafaf9, #131312);
  --surface: light-dark(#ffffff, #1b1b19);
  --code: light-dark(#efeeeb, #232321);
  --text: light-dark(#1c1c1a, #ecebe8);
  --text-2: light-dark(#5c5c57, #a8a7a1);
  --line: light-dark(#e7e6e3, #2a2a27);
  --line-strong: light-dark(#cfcec9, #3b3b37);
  --link: light-dark(var(--accent), color-mix(in oklab, var(--accent), white 45%));
  --hover: color-mix(in oklab, transparent, var(--text) 6%);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial,
    sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 8px;
  --gutter: 1.5rem;
}

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

html {
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

::selection {
  background: color-mix(in oklab, var(--accent) 30%, transparent);
}

/* Header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem max(var(--gutter), (100% - 70rem) / 2 + var(--gutter));
  border-bottom: 1px solid var(--line);
}

.name {
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.github {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.github:hover {
  color: var(--text);
  text-decoration: none;
}

.mark {
  width: 1.125rem;
  height: 1.125rem;
  fill: currentColor;
}

/* Menu and page */

.layout {
  display: grid;
  grid-template-columns: 13rem minmax(0, 1fr);
  gap: 3rem;
  max-width: 70rem;
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 5rem;
}

.menu ul {
  position: sticky;
  top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu a {
  display: block;
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  color: var(--text-2);
  font-size: 0.9375rem;
}

.menu a:hover {
  background: var(--hover);
  color: var(--text);
  text-decoration: none;
}

.menu a[aria-current="page"] {
  background: var(--hover);
  color: var(--text);
  font-weight: 500;
}

main {
  max-width: 46rem;
}

/* Documents */

main h1 {
  margin: 0 0 1rem;
  font-size: 2rem;
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

main h2 {
  margin: 2.75rem 0 0.75rem;
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

main h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.125rem;
  font-weight: 600;
}

main p,
main ul,
main ol,
main pre,
main table {
  margin: 0 0 1rem;
}

main ul,
main ol {
  padding-left: 1.5rem;
}

main li + li {
  margin-top: 0.25rem;
}

main img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

code {
  font-family: var(--mono);
  font-size: 0.875em;
}

:not(pre) > code {
  padding: 0.125em 0.375em;
  border-radius: 4px;
  background: var(--code);
  box-decoration-break: clone;
}

pre {
  padding: 1rem 1.25rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  line-height: 1.5;
}

table {
  display: block;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  border-bottom-color: var(--line-strong);
  font-weight: 600;
}

th:first-child,
td:first-child {
  padding-left: 0;
}

td:first-child code {
  white-space: nowrap;
}

/* On narrow screens the menu becomes a row above the page. */
@media (width < 52rem) {
  :root {
    --gutter: 1rem;
  }

  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding-top: 1rem;
  }

  .menu ul {
    position: static;
    flex-direction: row;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .menu a {
    white-space: nowrap;
  }

  main h1 {
    font-size: 1.625rem;
  }
}
