:root {
  --paper: #fbfbf9;
  --sheet: #ffffff;
  --ink: #1c1b19;
  --muted: #6f6d67;
  --line: #e2e0d9;
  --wash: #f3f2ee;
  --in: #b5722f;
  --out: #34659a;
  --good: #2f6b3a;
  --bad: #9b2c2c;
  --warn: #8a5a00;
  --warn-wash: #fbf3e2;
  --mark: #fff1c2;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --measure: 62ch;
  --gutter: 2.5rem;
  --text-xs: 11.5px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-base: 15px;
  --text-lg: 15.5px;
  --radius: 6px;
  --radius-sm: 4px;
  --marker: 6px;
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16171a;
    --sheet: #1d1f23;
    --ink: #e8e6df;
    --muted: #8f8d85;
    --line: #2b2e34;
    --wash: #22252a;
    --in: #d08a4b;
    --out: #8fb3d9;
    --good: #6fae7a;
    --bad: #d47070;
    --warn: #d6a24a;
    --warn-wash: #2a2419;
    --mark: #4a3f14;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  text-decoration: underline;
}

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

h1,
h2,
h3 {
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  margin: 0;
  text-wrap: balance;
}

p {
  margin: 0;
}

p + p {
  margin-top: 0.75rem;
}

code,
pre,
kbd {
  font-family: var(--mono);
  font-size: 0.9em;
}

pre {
  background: var(--wash);
  padding: 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
  border-radius: var(--radius);
  margin: 0;
}

mark {
  background: var(--mark);
  color: inherit;
  padding: 0 0.1em;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}


.in {
  color: var(--in);
}

.out {
  color: var(--out);
}


.label,
.unfold h2,
article.page .body h2,
article.page .body th,
.rows .head,
.rows .day,
section.index h2,
.trace h2,
section.day h2,
aside.facets h2,
table.list th {
  font-size: var(--text-xs);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* Folio */

header.site {
  display: flex;
  align-items: baseline;
  gap: 2rem;
  padding: 0.85rem var(--gutter);
  border-bottom: 1px solid var(--line);
  font-size: var(--text-sm);
}

header.site .wordmark {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--ink);
  letter-spacing: -0.01em;
}

header.site nav {
  display: flex;
  align-items: baseline;
  gap: 1.2rem;
  flex: 1;
}

header.site nav a {
  color: var(--muted);
  padding-bottom: 1px;
}

header.site nav a.current {
  color: var(--ink);
  border-bottom: 1.5px solid var(--ink);
}

header.site form.search {
  margin-left: auto;
  display: flex;
}

header.site form.search input {
  width: 18rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet);
}

header.site form.search input::placeholder {
  color: var(--muted);
}

/* Account menu */

header.site details.account {
  position: relative;
  margin-left: auto;
  white-space: nowrap;
}

header.site details.account > summary {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  cursor: pointer;
  list-style: none;
  color: var(--muted);
}

header.site details.account > summary::-webkit-details-marker {
  display: none;
}

header.site details.account > summary b {
  color: var(--ink);
  font-weight: 500;
}


header.site .menu,
header.site .menu details.workspaces > div {
  position: absolute;
  min-width: 13rem;
  padding: 0.35rem 0;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgb(0 0 0 / 8%);
  display: flex;
  flex-direction: column;
  z-index: 3;
}

header.site .menu {
  right: 0;
  top: 1.75rem;
}

header.site .menu details.workspaces > div {
  right: calc(100% + 0.3rem);
  top: -0.35rem;
}


header.site .menu a,
header.site .menu summary,
header.site .menu button {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.5rem;
  width: 100%;
  padding: 0.35rem 0.9rem;
  text-align: left;
  color: var(--ink);
}

header.site .menu a:hover,
header.site .menu summary:hover,
header.site .menu button:hover {
  background: var(--wash);
  text-decoration: none;
}

header.site .menu form {
  display: contents;
}

header.site .menu .label {
  padding: 0.5rem 0.9rem 0.2rem;
}

header.site .menu hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.35rem 0;
}

header.site .menu details.workspaces {
  position: relative;
}

header.site .menu details.workspaces > summary {
  cursor: pointer;
  list-style: none;
}

header.site .menu details.workspaces > summary::-webkit-details-marker {
  display: none;
}

/* The corners of a square, turned: down under the name, right at a submenu, a tick beside
   the workspace you are in. Drawn rather than typed, so they take the text's colour. */

header.site details.account > summary::after,
header.site .menu details.workspaces > summary::after,
header.site .menu a.current::after {
  content: "";
  width: 5px;
  height: 5px;
  align-self: center;
  border-right: 1.2px solid currentcolor;
  border-bottom: 1.2px solid currentcolor;
  transform: rotate(45deg);
}

header.site details.account[open] > summary::after {
  transform: rotate(225deg);
}

header.site .menu details.workspaces > summary::after {
  transform: rotate(-45deg);
}

header.site .menu a.current {
  font-weight: 500;
}

header.site .menu a.current::after {
  width: 4px;
  height: 8px;
  border-width: 1.4px;
  transform: rotate(45deg) translate(-1px, -1px);
}

.flash {
  padding: 0.6rem var(--gutter);
  background: var(--wash);
  border-bottom: 1px solid var(--line);
  font-size: var(--text-md);
  color: var(--ink);
}

main {
  width: 100%;
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.8rem var(--gutter) 3rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Page header */

.crumbs {
  font-size: var(--text-sm);
  color: var(--muted);
}

.crumbs a {
  color: var(--muted);
}

.crumbs b {
  color: var(--ink);
  font-weight: 500;
}

h1 {
  font-size: 26px;
  margin-top: 0.9rem;
}

h1 .count,
h1 .agent {
  color: var(--muted);
  font-weight: 400;
  margin-left: 0.4rem;
}

h1 .dot {
  margin-right: 0.6rem;
  vertical-align: 0.1em;
}

.line {
  margin-top: 0.5rem;
  font-size: var(--text-sm);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1rem;
  align-items: baseline;
}

.line .ink {
  color: var(--ink);
}

.line .status {
  color: var(--ink);
}

.line .status::before {
  content: "";
  display: inline-block;
  width: var(--marker);
  height: var(--marker);
  border-radius: 50%;
  background: var(--out);
  margin-right: 0.4rem;
  vertical-align: 1px;
}

.line .badge {
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 0.4rem;
  background: var(--sheet);
}

.line .toggle {
  color: var(--ink);
  border-bottom: 1px dotted var(--muted);
  padding-bottom: 1px;
}

.line .toggle[aria-expanded="true"] {
  border-bottom-style: solid;
  border-bottom-color: var(--ink);
}

.line .toggle.in::before {
  content: "";
  display: inline-block;
  width: var(--marker);
  height: var(--marker);
  border-radius: 1px;
  background: var(--in);
  margin-right: 0.4rem;
  vertical-align: 1px;
}

.line .cta {
  margin-left: auto;
  color: var(--ink);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.15rem 0.6rem;
  font-weight: 500;
}

.line .cta:hover {
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
}


.banner {
  margin-top: 1rem;
  padding: 0.55rem 0.9rem;
  background: var(--wash);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  max-width: var(--measure);
}

.banner a {
  margin-left: 0.5rem;
}

.banner.trouble {
  background: var(--warn-wash);
  border-left: 2px solid var(--warn);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--ink);
}

.banner.trouble b {
  color: var(--warn);
  font-weight: 600;
  margin-right: 0.4rem;
}

.banner.trouble.failed {
  border-left-color: var(--bad);
}

.banner.trouble.failed b {
  color: var(--bad);
}

.banner.trouble ul {
  margin: 0.3rem 0 0;
  padding-left: 1.1rem;
}

.banner.trouble code {
  background: var(--sheet);
  padding: 0 0.3rem;
  border-radius: var(--radius-sm);
}

/* Disclosure panels */

.unfold {
  margin-top: 1rem;
  max-width: var(--measure);
  background: var(--wash);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  font-size: var(--text-sm);
  color: var(--muted);
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.3rem;
}

.unfold[hidden] {
  display: none;
}

.unfold h2 {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.unfold h2 span:last-child {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.unfold section {
  display: contents;
}

.unfold section h2 {
  margin-top: 0.6rem;
}

.unfold ul,
.unfold ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: contents;
}

.unfold li {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem;
  align-items: baseline;
}

.unfold li a {
  color: var(--ink);
}

.unfold li .n {
  color: var(--muted);
  min-width: 1.2em;
}

.unfold li .n.v {
  color: var(--out);
  font-weight: 600;
}

.unfold li .k {
  color: var(--muted);
  margin-left: 0.3rem;
}

.unfold li small {
  display: block;
  color: var(--muted);
}

.unfold .wide {
  grid-column: 1 / -1;
}

.unfold pre {
  grid-column: 1 / -1;
  background: var(--sheet);
  font-size: var(--text-xs);
  line-height: 1.45;
  color: var(--ink);
}

/* Lists */

.rows {
  margin-top: 1rem;
}

.rows .head,
.rows .row {
  display: grid;
  gap: 1.2rem;
  align-items: baseline;
}

.rows .head {
  padding: 0.3rem 0;
}

.rows .row {
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
  font-size: var(--text-md);
}

.rows .row:last-child {
  border-bottom: 1px solid var(--line);
}

.rows .row a {
  color: var(--ink);
}

.rows .row .quiet {
  color: var(--muted);
  font-size: var(--text-sm);
}

.rows .row .trouble {
  display: block;
  color: var(--warn);
  font-size: var(--text-sm);
}

.rows .row.failed .trouble {
  color: var(--bad);
}

.rows .row .when {
  color: var(--muted);
  font-size: var(--text-sm);
  text-align: right;
  white-space: nowrap;
}

.rows .head span:last-child {
  text-align: right;
}

.rows .day {
  margin-top: 1.4rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}

.rows .day span:last-child {
  letter-spacing: 0;
  text-transform: none;
  font-weight: 400;
}

.rows .day + .row {
  border-top: 0;
}

.rows .foot {
  margin-top: 1.4rem;
  display: flex;
  gap: 2rem;
  font-size: var(--text-sm);
  color: var(--muted);
}

.rows .foot b {
  color: var(--ink);
  font-weight: 500;
}


.kind {
  color: var(--muted);
  font-size: var(--text-xs);
  margin-left: 0.4rem;
}

.status {
  font-size: var(--text-sm);
}

.status::before {
  content: "";
  display: inline-block;
  width: var(--marker);
  height: var(--marker);
  border-radius: 50%;
  background: var(--out);
  margin-right: 0.4rem;
  vertical-align: 1px;
}

.status.none {
  color: var(--muted);
}

.status.none::before {
  background: var(--line);
}


.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  vertical-align: 0;
  margin-right: 0.5rem;
}

.dot.done {
  background: var(--good);
}

.dot.failed {
  background: var(--bad);
}

.dot.running {
  background: var(--out);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--out) 25%, transparent);
}

.dot.queued {
  border: 1.5px solid var(--muted);
}


.facets {
  margin-top: 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: var(--text-sm);
}

.facets a {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.65rem;
  color: var(--muted);
  background: var(--sheet);
}

.facets a.current {
  color: var(--ink);
  border-color: var(--ink);
}

.facets a .count {
  margin-left: 0.3rem;
  color: var(--muted);
}

.count {
  color: var(--muted);
  font-weight: normal;
}


.rows.pages .head,
.rows.pages .row {
  grid-template-columns: minmax(0, 1fr) 11rem 10rem 14rem;
}

.rows.runs .row {
  grid-template-columns: 3.4rem 6rem minmax(0, 1fr) 10rem 4.5rem;
}

.rows .row .when b {
  color: var(--ink);
  font-weight: 400;
}

/* Copy controls */

.copyable {
  position: relative;
  margin-top: 0.6rem;
}

.copyable pre {
  padding-right: 4.5rem;
  font-size: var(--text-xs);
  line-height: 1.5;
}


.copyable.prompt pre {
  font-family: inherit;
  font-size: var(--text-sm);
}

.copyable button {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sheet);
  color: var(--muted);
  font-size: var(--text-xs);
  cursor: pointer;
}

.copyable button:hover {
  color: var(--ink);
}

details.recipe {
  border-top: 1px solid var(--line);
}

details.recipe:last-of-type {
  border-bottom: 1px solid var(--line);
}

details.recipe summary {
  padding: 0.55rem 0;
  cursor: pointer;
  font-size: var(--text-sm);
}

details.recipe[open] summary {
  font-weight: 500;
}

details.recipe ol {
  padding-left: 1.25rem;
  margin: 0.4rem 0 0.8rem;
  font-size: var(--text-sm);
}

details.recipe li + li {
  margin-top: 0.25rem;
}

details.recipe p {
  margin: 0.4rem 0 0.8rem;
  font-size: var(--text-sm);
}

details.recipe p.meta {
  color: var(--muted);
  font-size: var(--text-xs);
}

@media (max-width: 720px) {
  :root {
    --gutter: 1.1rem;
  }

  header.site {
    flex-wrap: wrap;
    gap: 0.6rem 1.2rem;
  }

  header.site form.search {
    margin-left: 0;
    width: 100%;
  }

  header.site form.search input {
    width: 100%;
  }

  /* No room beside the menu, so the submenu unfolds inside it, indented. */
  header.site .menu details.workspaces > div {
    position: static;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
  }

  header.site .menu details.workspaces > div a {
    padding-left: 1.7rem;
  }

  header.site .menu details.workspaces > div hr {
    margin-left: 1.7rem;
  }

  .rows .head {
    display: none;
  }

  .rows .row {
    grid-template-columns: 1fr !important;
    gap: 0.2rem;
  }

  .rows .row .when {
    text-align: left;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .line .toggle,
  .facets a,
  .rows .row {
    transition: color 0.15s ease, border-color 0.15s ease;
  }
}
