/* An experiment's page (templates/screens/experiment.html): the contents beside the chain of question,
   evidence and decision, and notes beside the chain; the figure and its table across both. */
.crumbs {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-5) var(--gutter);
  border-bottom: 1px solid var(--line);
  font-size: var(--meta-size);
  line-height: var(--meta-leading);
  color: var(--text-muted);
}

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

.crumbs [aria-current] {
  color: var(--text);
}

.experiment {
  display: grid;
  grid-template-columns: 200px minmax(0, 740px) minmax(0, 300px);
  column-gap: 52px;
  align-items: start;
  padding: var(--space-16) var(--gutter) var(--space-24);
}

.contents {
  position: sticky;
  top: var(--space-6);
  grid-column: 1;
  grid-row: 1 / span 6;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: var(--meta-size);
  line-height: var(--meta-leading);
  color: var(--text-muted);
}

/* The chain's links are the grid's rows; the figure and its table take the notes' column too. */
.chain {
  display: contents;
}

.chain > * {
  grid-column: 2;
  min-width: 0;
}

.chain > .evidence {
  grid-column: 2 / span 2;
}

.notes {
  grid-column: 3;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-14);
  padding-top: var(--space-24);
  font-size: var(--meta-size);
  line-height: var(--meta-leading);
  color: var(--text-muted);
}

.notes p {
  padding-left: 14px;
  border-left: 1px solid var(--line-strong);
}

.record {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  font-size: var(--meta-size);
  line-height: var(--meta-leading);
  color: var(--text-muted);
}

.record-meta .mono {
  color: var(--text);
}

.revision {
  align-self: flex-start;
  padding: 6px var(--space-3);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  font-size: var(--meta-size);
  line-height: var(--meta-leading);
  color: var(--text-secondary);
}

.revision a {
  color: var(--text);
}

.record-facts {
  padding: var(--space-5) 0 var(--space-12);
  border-top: 1px solid var(--line);
}

/* A link of the chain: its mark on a rail that runs down to the next. The evidence and the decision
   are solid, the others open. */
.step {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 0 var(--space-12) 44px;
}

.step::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 7px;
  width: 9px;
  height: 9px;
  border: 1px solid var(--text);
  border-radius: 50%;
}

.step::after {
  content: "";
  position: absolute;
  top: 17px;
  bottom: 0;
  left: 11px;
  width: 1px;
  background: var(--line-strong);
}

.step.solid::before {
  background: var(--text);
}

.step.last::after {
  content: none;
}

.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.evidence {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
  padding: 0 0 var(--space-14) 44px;
}

.policies tr.chosen > * {
  background: var(--track);
  color: var(--text);
  font-weight: 500;
}

.policies tbody th {
  color: var(--text-secondary);
}

.failures {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.failures li {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--line);
}

.failures .mono {
  color: var(--failure);
}

.failures p + p {
  color: var(--text-secondary);
}

.cost {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-3);
}

.commands {
  margin: 0;
  padding: var(--space-4) var(--space-5);
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  background: var(--surface);
  font-size: var(--meta-size);
  line-height: var(--ui-leading);
  color: var(--text-reading);
}

.artifacts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  color: var(--text-muted);
}

.revisions {
  display: grid;
  gap: 10px;
}

.revisions div {
  display: grid;
  grid-template-columns: 64px 64px minmax(0, 1fr);
  gap: var(--space-4);
  color: var(--text-secondary);
}

.revisions dt {
  color: var(--text);
}

/* Facts with room for longer names, side by side while they fit. */
@media (min-width: 641px) {
  .facts.wide {
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 10px var(--space-4);
  }
}

/* Too narrow for the contents and the notes beside the chain: one column, the notes after it. */
@media (max-width: 1024px) {
  .experiment {
    grid-template-columns: minmax(0, 1fr);
  }

  .contents {
    display: none;
  }

  .chain > *,
  .chain > .evidence,
  .notes {
    grid-column: 1;
    grid-row: auto;
  }

  .notes {
    padding-top: 0;
    gap: var(--space-5);
  }
}

@media (max-width: 640px) {
  .experiment {
    padding-block: var(--space-10);
  }

  .step,
  .evidence {
    padding-left: var(--space-8);
  }

  .step::before {
    left: 0;
  }

  .step::after {
    left: 4px;
  }

  .revisions div {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .revisions div dd:last-child {
    grid-column: 1 / -1;
  }
}
