: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;
}

/* A link to a page or source that does not exist: the address, shown for what it is. */
a.missing {
  color: var(--muted);
  text-decoration: underline dotted;
}

: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 > summary,
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);
}

/* The two menus in the corner: the workspace you are in, then you */

header.site details.dropdown {
  position: relative;
  white-space: nowrap;
}

header.site details.workspace {
  margin-left: auto;
}

header.site details.workspace + details.account {
  margin-left: -1rem;
}

header.site details.dropdown > summary {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
  font-weight: 500;
}

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

header.site details.account > summary {
  align-items: center;
}

header.site details.account .initials {
  display: inline-grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--wash);
  border: 1px solid var(--line);
  font-size: var(--text-xs);
  letter-spacing: 0.02em;
}

header.site .menu {
  position: absolute;
  top: 1.75rem;
  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 details.workspace .menu {
  right: 0;
}

header.site details.account .menu {
  right: 0;
  top: 2.1rem;
}

header.site .menu a,
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 button:hover {
  background: var(--wash);
  text-decoration: none;
}

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

header.site .menu .who {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0.4rem 0.9rem 0.2rem;
}

header.site .menu .who b {
  font-weight: 500;
}

header.site .menu .who span {
  color: var(--muted);
  font-size: var(--text-xs);
}

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

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

header.site details.workspace > 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.workspace[open] > summary::after {
  transform: rotate(225deg);
}

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);
}

.unfold summary .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);
}

/* Whether the brain is still updating: the trouble banner across the page, the headline
   on one line and a cause on each line after it. */
.banner.processing {
  max-width: none;
  padding: 0.4rem 0.9rem;
  line-height: 1.45;
}

.banner.processing p {
  margin: 0;
}

.banner.processing ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.banner.processing .quiet {
  color: var(--muted);
}

/* A run's texts, a fold each */

.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);
}

.unfold > summary {
  cursor: pointer;
}

.unfold[open] > summary {
  margin-bottom: 0.6rem;
}

/* A frame still on its way: the words it will hold, with a turning ring before them, until
   the frame lands and takes their place. */
.loading {
  font-size: var(--text-sm);
  color: var(--muted);
}

.spinner {
  display: inline-block;
  vertical-align: -0.1em;
  margin-right: 0.4rem;
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
}

@media (prefers-reduced-motion: no-preference) {
  .spinner {
    animation: spin 0.9s linear infinite;
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.unfold pre {
  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.snippet pre {
  font-size: 0.9em;
  line-height: inherit;
}

.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;
  }

  /* Where and who on the first line, the surfaces and the search under them. */
  header.site nav {
    order: 1;
    flex-basis: 100%;
    flex-wrap: wrap;
    gap: 0.6rem 1.2rem;
  }

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

  header.site details.workspace + details.account {
    margin-left: -0.4rem;
  }

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

  .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) {
  .facets a,
  .rows .row {
    transition: color 0.15s ease, border-color 0.15s ease;
  }
}

/* A form's first, unseen submit button: Enter in its text field sends the text. */
.enter-submits {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
}
