/* The documentation site of the template. One style sheet for every page;
   no build step. Colours are tokens, redefined for the dark theme. */

:root {
  --bg: #f4f5f8;
  --surface: #ffffff;
  --sunk: #f8f9fb;
  --ink: #1b2130;
  --muted: #5b6475;
  --line: #d8dde6;
  --accent: #2a4ea3;
  --accent-soft: #e7ecf8;
  /* Who acts in a step. */
  --human: #9a5b00;
  --human-soft: #fdf1dc;
  --agent: #5a3fb0;
  --agent-soft: #eeeafb;
  --script: #0f6b58;
  --script-soft: #e0f3ee;
  --shadow: 0 1px 2px rgba(20, 28, 45, 0.06), 0 4px 14px rgba(20, 28, 45, 0.06);
  --sidebar: 264px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1218;
    --surface: #181c25;
    --sunk: #141821;
    --ink: #e8ebf2;
    --muted: #9aa3b5;
    --line: #2d3442;
    --accent: #93b0f6;
    --accent-soft: #1d2843;
    --human: #f0b45a;
    --human-soft: #33270f;
    --agent: #b9a6f7;
    --agent-soft: #261f42;
    --script: #6fd1b9;
    --script-soft: #12302a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="dark"] {
  --bg: #0f1218;
  --surface: #181c25;
  --sunk: #141821;
  --ink: #e8ebf2;
  --muted: #9aa3b5;
  --line: #2d3442;
  --accent: #93b0f6;
  --accent-soft: #1d2843;
  --human: #f0b45a;
  --human-soft: #33270f;
  --agent: #b9a6f7;
  --agent-soft: #261f42;
  --script: #6fd1b9;
  --script-soft: #12302a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 18px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-underline-offset: 2px;
}

code,
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

code {
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.1em 0.45em;
  overflow-wrap: anywhere;
}

/* --- Layout: a sidebar and the page ------------------------------------- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: block;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  line-height: 1.25;
  padding: 0 8px;
}

.brand small {
  display: block;
  color: var(--muted);
  font-weight: 500;
  font-size: 12.5px;
  margin-top: 3px;
}

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

.nav a {
  display: block;
  color: var(--ink);
  text-decoration: none;
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 14.5px;
}

.nav a:hover {
  background: var(--sunk);
}

.nav a[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 650;
}

.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 8px;
  font-size: 13.5px;
}

.theme-toggle {
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 5px 9px;
  cursor: pointer;
  text-align: left;
}

.theme-toggle:hover {
  color: var(--ink);
}

.page {
  margin-left: var(--sidebar);
  padding: 44px 40px 80px;
}

.wrap {
  max-width: 880px;
  margin: 0 auto;
}

.wrap.wide {
  max-width: 1100px;
}

.menu-button {
  display: none;
}

/* --- Text ----------------------------------------------------------------- */

h1 {
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

h2 {
  font-size: 23px;
  line-height: 1.25;
  margin: 46px 0 10px;
}

h3 {
  font-size: 17px;
  margin: 26px 0 6px;
}

.lede {
  font-size: 18.5px;
  color: var(--muted);
  margin: 0 0 8px;
  max-width: 62ch;
}

p,
li {
  max-width: 72ch;
}

.note {
  border: 1px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 10px;
  padding: 10px 14px;
  margin: 18px 0;
}

.note p {
  margin: 0;
}

/* --- Cards and tables ----------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.card p {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

.table-scroll {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14.5px;
}

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

th {
  background: var(--sunk);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

tr:last-child td {
  border-bottom: 0;
}

td:first-child {
  font-weight: 600;
}

.tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 99px;
  padding: 2px 9px;
  white-space: nowrap;
}

.tag.built {
  background: var(--script-soft);
  color: var(--script);
}

.tag.partial {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag.principle {
  background: var(--agent-soft);
  color: var(--agent);
}

.tag.proposed {
  background: var(--human-soft);
  color: var(--human);
}

.tag.left-out {
  background: var(--sunk);
  color: var(--muted);
  border: 1px solid var(--line);
}

/* --- The timeline of the history page ----------------------------------- */

.timeline {
  list-style: none;
  margin: 30px 0 0;
  padding: 0 0 0 26px;
  border-left: 2px solid var(--line);
}

.timeline > li {
  position: relative;
  padding-bottom: 30px;
}

.timeline > li::before {
  content: "";
  position: absolute;
  left: -34px;
  top: 9px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg);
}

.timeline h2 {
  margin: 0 0 8px;
}

/* --- The pipeline strip on the introduction ------------------------------- */

.pipeline {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 4px;
  padding: 0;
  margin: 18px 0;
}

.pipeline li {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  font-weight: 600;
}

.pipeline span {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
  padding: 5px 10px;
}

.pipeline li.gate span {
  border-color: var(--human);
  background: var(--human-soft);
  color: var(--human);
}

.pipeline li:not(:last-child)::after {
  content: "→";
  color: var(--muted);
  padding: 0 2px;
}

/* --- The workflow diagram -------------------------------------------------- */

.diagram {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  align-items: start;
  margin: 16px 0 8px;
}

.lane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 18px 20px;
  box-shadow: var(--shadow);
}

.lane h3 {
  margin: 0 0 2px;
  font-size: 15px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.lane > p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13.5px;
}

/* A lane is a grid: the steps in the first column, the loops beside them. */
.steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  row-gap: 26px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.steps > li {
  grid-column: 1;
  position: relative;
}

/* The arrow to the next step. */
.steps > li:not(.last):not(.loop)::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -22px;
  width: 2px;
  height: 18px;
  background: var(--line);
}

.steps > li:not(.last):not(.loop)::before {
  content: "";
  position: absolute;
  left: calc(50% - 4px);
  bottom: -23px;
  border: 5px solid transparent;
  border-top-color: var(--muted);
  border-bottom: 0;
}

.step {
  display: block;
  width: 100%;
  text-align: left;
  text-decoration: none;
  font: inherit;
  color: var(--ink);
  background: var(--tint);
  border: 1px solid var(--edge);
  border-radius: 10px;
  padding: 9px 12px;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.step:hover,
.step:focus-visible {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  outline: none;
}

.step:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow);
}

.step b {
  display: block;
  font-size: 14.5px;
  line-height: 1.3;
}

.step small {
  display: block;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.35;
  margin-top: 2px;
}

.step.human {
  --tint: var(--human-soft);
  --edge: var(--human);
}

.step.agent {
  --tint: var(--agent-soft);
  --edge: var(--agent);
}

.step.script {
  --tint: var(--script-soft);
  --edge: var(--script);
}

/* A loop back to an earlier step: a bracket in the second column with its
   arrowhead at the step it returns to. */
.steps > .loop {
  grid-column: 2;
  position: relative;
  margin: 18px 0 18px 4px;
  border: 2px solid var(--line);
  border-left: 0;
  border-radius: 0 12px 12px 0;
}

.steps > .loop::before {
  content: "";
  position: absolute;
  left: -2px;
  top: -6px;
  border: 5px solid transparent;
  border-right-color: var(--muted);
  border-left: 0;
}

.loop span {
  position: absolute;
  top: 50%;
  left: 12px;
  right: -8px;
  transform: translateY(-50%);
  font-size: 11.5px;
  line-height: 1.25;
  color: var(--muted);
}

.between {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  margin: 2px 0 0;
}

.unattended {
  border: 1px dashed var(--agent);
  border-radius: 10px;
  background: var(--sunk);
  padding: 8px 12px;
  font-size: 13.5px;
  margin: 0 0 14px;
}

/* --- The details of the steps, and the dialog that shows one -------------- */

.details {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.detail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 20px 18px;
}

.detail:target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.detail h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

/* The first row of a step says who acts, in the colour of the diagram. */
.detail dl.human dd:first-of-type {
  color: var(--human);
  font-weight: 700;
}

.detail dl.agent dd:first-of-type {
  color: var(--agent);
  font-weight: 700;
}

.detail dl.script dd:first-of-type {
  color: var(--script);
  font-weight: 700;
}

.detail dl {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 6px 14px;
  margin: 10px 0 0;
  font-size: 14.5px;
}

.detail dt {
  color: var(--muted);
  font-weight: 600;
}

.detail dd {
  margin: 0;
}

.detail p {
  margin: 0 0 6px;
}

dialog.popup {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

dialog.popup::backdrop {
  background: rgba(10, 14, 22, 0.55);
}

dialog.popup .lane {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  padding: 22px 24px 8px;
}

dialog.popup.wide {
  width: min(560px, calc(100vw - 32px));
}

dialog.popup .detail {
  border: 0;
  border-radius: 0;
  padding: 22px 24px 8px;
}

.popup-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 16px 12px;
}

.popup-bar button {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

.popup-bar button:disabled {
  opacity: 0.4;
  cursor: default;
}

/* --- Narrow screens -------------------------------------------------------- */

@media (max-width: 1080px) {
  .diagram {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  /* Without the script the navigation is the first part of the page. */
  .sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .page {
    margin-left: 0;
    padding: 28px 16px 60px;
  }

  /* With the script it is a panel behind the menu button. */
  .js .sidebar {
    position: fixed;
    width: var(--sidebar);
    border-right: 1px solid var(--line);
    border-bottom: 0;
    padding-top: 60px;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    z-index: 30;
    box-shadow: var(--shadow);
  }

  .js body.menu-open .sidebar {
    transform: none;
  }

  .js .page {
    padding-top: 64px;
  }

  .js .menu-button {
    display: inline-flex;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 40;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px 12px;
    box-shadow: var(--shadow);
  }

  h1 {
    font-size: 28px;
  }

  .detail dl {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .detail dd {
    margin-bottom: 8px;
  }

  .steps {
    grid-template-columns: minmax(0, 1fr) 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .step,
  .sidebar {
    transition: none;
  }
}

/* --- The played run on the workflow page ---------------------------------- */

:root {
  --fail: #b3261e;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fail: #f2857c;
  }
}

:root[data-theme="dark"] {
  --fail: #f2857c;
}

.run {
  margin: 20px 0 8px;
}

.run-stage-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.run-svg {
  display: block;
  width: 100%;
  height: auto;
}

/* Across on a wide screen, down on a narrow one. */
.run-across {
  display: none;
}

.run-down {
  max-width: 400px;
  margin: 0 auto;
}

@media (min-width: 1440px) {
  .run-across {
    display: block;
  }

  .run-down {
    display: none;
  }
}

.run-col,
.run-hit {
  fill: transparent;
}

a:hover > .run-col,
a:focus-visible > .run-col {
  fill: var(--accent-soft);
  opacity: 0.6;
}

.run-svg a {
  cursor: pointer;
  outline: none;
}

.run-sep {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.run-stage {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.run-ghost,
.run-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 2;
}

.run-ink {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.run-ghost.loop,
.run-ink.loop {
  stroke-dasharray: 5 5;
}

.run-ink.loop {
  stroke: var(--human);
}

.run-track,
.run-bar {
  stroke-width: 9;
  stroke-linecap: round;
}

.run-bar {
  fill: none;
  stroke: var(--agent);
}

.run-head {
  fill: var(--accent);
}

.run-name {
  fill: var(--ink);
  font-size: 15px;
  font-weight: 650;
}

.run-stat {
  fill: var(--muted);
  font-size: 13.5px;
}

.run-stat.ok {
  fill: var(--script);
}

.run-stat.warn {
  fill: var(--human);
  font-weight: 650;
}

.run-gate {
  fill: var(--human);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.run-gate.on {
  opacity: 1;
}

.run-loop-label {
  fill: var(--human);
  font-size: 13px;
  font-weight: 650;
  transition: opacity 0.3s ease;
}

.run.playing .run-loop-label:not(.on) {
  opacity: 0;
}

/* A stop of the route: a circle for an agent or a script, a diamond where
   you decide. Grey while it waits, outlined while it works, filled when done. */
.run-node {
  --who: var(--script);
}

.run-node.human {
  --who: var(--human);
}

.run-node.agent {
  --who: var(--agent);
}

.run-node .ring {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 2.5;
  transition: fill 0.25s ease, stroke 0.25s ease;
}

.run-node .halo {
  fill: var(--who);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.run-node .mark {
  fill: var(--surface);
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.run-node[data-state="active"] .ring {
  stroke: var(--who);
}

.run-node[data-state="active"] .halo {
  opacity: 0.18;
}

.run-node[data-state="done"] .ring {
  fill: var(--who);
  stroke: var(--who);
}

.run-node[data-state="fail"] .ring {
  fill: var(--fail);
  stroke: var(--fail);
}

.run-node:hover .halo,
.run-node:focus-visible .halo {
  opacity: 0.22;
}

.run-node:hover .run-name,
.run-node:focus-visible .run-name,
a:hover > .run-name {
  text-decoration: underline;
}

/* Under the drawing: what happened, and the legend. */
.run-below {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 22px;
  align-items: start;
  margin-top: 18px;
}

.run-log {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 16px 20px 18px;
}

.run-log figcaption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  font-weight: 650;
  margin-bottom: 10px;
}

.run-log figcaption span {
  color: var(--muted);
  font-weight: 400;
  font-size: 13.5px;
}

.run-log ol {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 13.5px;
}

.run-log li {
  display: grid;
  grid-template-columns: 12.5em minmax(0, 1fr);
  gap: 12px;
  max-width: none;
  padding: 3px 8px;
  border-radius: 6px;
  transition: opacity 0.3s ease, background-color 0.3s ease;
}

.run-log .k {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.run-log .is-gate .k {
  color: var(--human);
  font-weight: 700;
}

.run-log .is-warn span:last-child {
  color: var(--human);
}

.run-log li.pending {
  opacity: 0.25;
}

.run-log li.now {
  background: var(--accent-soft);
}

.run-legend {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  font-size: 14.5px;
  color: var(--muted);
}

.run-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.run-legend b {
  color: var(--ink);
}

.run-legend svg {
  flex: none;
}

.run-legend .human rect {
  fill: var(--human);
}

.run-legend .agent circle {
  fill: var(--agent);
}

.run-legend .script circle {
  fill: var(--script);
}

.run-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.run-controls button,
.run-switch button {
  font: inherit;
  font-size: 14.5px;
  font-weight: 650;
  color: var(--ink);
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
}

.run-controls button:hover,
.run-switch button:hover {
  border-color: var(--accent);
}

.run-controls .run-play {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

@media (max-width: 900px) {
  .run-below {
    grid-template-columns: 1fr;
  }

  .run-log li {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .run-node .ring,
  .run-node .halo,
  .run-gate,
  .run-loop-label,
  .run-log li {
    transition: none;
  }
}

.run-tip {
  fill: var(--human);
  transition: opacity 0.3s ease;
}

.run.playing .run-tip:not(.on) {
  opacity: 0;
}

/* The two ways to run a feature. What differs between them is in the page
   twice, and the mode decides which one shows. */
.run-modes {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
  font-size: 14.5px;
}

.run-switch {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.run-switch button {
  border: 0;
  border-radius: 0;
  background: var(--surface);
  padding: 6px 14px;
}

.run-switch button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--surface);
}

.run-mode-note {
  flex-basis: 100%;
  margin: 0;
  max-width: none;
  color: var(--muted);
}

.run[data-mode="step"] .only-unattended,
.run[data-mode="unattended"] .only-step {
  display: none;
}

.run[data-mode="unattended"] .run-node.swap {
  --who: var(--agent);
}

.run-gate.agent {
  fill: var(--agent);
}

.run[data-mode="unattended"] .run-log .is-gate .k .only-unattended {
  color: var(--agent);
}

/* --- The dialog: where a step is in its stage ------------------------------- */

.popup-where {
  margin: 0;
  padding: 16px 24px 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.popup-where + .popup-body .detail {
  padding-top: 6px;
}

/* --- The home page ---------------------------------------------------------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 6px;
  max-width: none;
}

.button {
  display: inline-block;
  text-decoration: none;
  font-weight: 650;
  font-size: 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 16px;
}

.button:hover {
  border-color: var(--accent);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--surface);
}

.phases {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0 8px;
  padding: 0;
}

.phases > li {
  max-width: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}

.phases h3 {
  margin: 0 0 6px;
  font-size: 17px;
}

.phases p {
  margin: 0;
  font-size: 14.5px;
}

.phases .who {
  margin-top: 10px;
  color: var(--human);
  font-weight: 650;
  font-size: 13.5px;
}

.phases-note {
  color: var(--muted);
  font-size: 14.5px;
  max-width: none;
}

.inside {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 28px;
  align-items: start;
  margin-top: 12px;
}

.tree {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  font-size: 14px;
}

.tree-root {
  margin: 0 0 8px;
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

.tree ul ul {
  padding-left: 22px;
}

.tree li {
  max-width: none;
}

.tree-row {
  display: grid;
  grid-template-columns: 13.5em minmax(0, 1fr);
  gap: 12px;
  padding: 4px 0;
  color: var(--muted);
}

.tree ul ul .tree-row {
  grid-template-columns: calc(13.5em - 22px) minmax(0, 1fr);
}

.tree code {
  background: none;
  border: 0;
  padding: 0;
  color: var(--ink);
  font-size: 13.5px;
}

.tree summary {
  cursor: pointer;
  list-style: none;
}

.tree summary::-webkit-details-marker {
  display: none;
}

.tree summary code::before {
  content: "▸ ";
  color: var(--muted);
}

.tree details[open] > summary code::before {
  content: "▾ ";
}

.tree summary:hover code {
  color: var(--accent);
}

pre {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 16px;
  overflow-x: auto;
  font-size: 14px;
  line-height: 1.55;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  overflow-wrap: normal;
}

@media (max-width: 1000px) {
  .phases {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inside {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .phases {
    grid-template-columns: 1fr;
  }

  .tree-row,
  .tree ul ul .tree-row {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

/* A control that the script has not switched on stays out of the page: the
   layout rules above must not override the hidden attribute. */
[hidden] {
  display: none !important;
}

/* A list of situations with what to do in each. */
.handles {
  margin: 14px 0;
}

.handles dt {
  font-weight: 650;
  margin-top: 14px;
}

.handles dd {
  margin: 2px 0 0;
  max-width: 72ch;
}

/* A command that can be copied. The button is added by the script. */
pre {
  position: relative;
}

.copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  font: inherit;
  font-size: 12.5px;
  color: var(--muted);
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 9px;
  cursor: pointer;
}

.copy-button:hover {
  color: var(--ink);
  border-color: var(--accent);
}
