/*
 * The few rules that only the Vault's own pages need. Like every stylesheet
 * but tokens.css, it holds no raw colour and no raw length. A number with a
 * unit appears only in the condition of a query, which cannot read a token.
 */

/* The onboarding screen: one panel, centred on the grid. */
.onboard {
  grid-column: 4 / span 6;
}

.onboard__body {
  display: grid;
  gap: var(--s7);
}

/* Room for the longest answer, kept whether or not there is one, so the panel does not jump when it arrives. */
.onboard__outcome {
  display: grid;
  gap: var(--s2);
  align-content: start;
  min-height: var(--s9);
  overflow-wrap: anywhere;
}

.onboard__outcome .no-answer {
  padding: var(--s3) var(--s4);
}

.form {
  display: grid;
  gap: var(--s5);
}

.form__field {
  display: grid;
  gap: var(--s2);
}

/* A wire entry here is a line to read. It opens nothing, so it does not look like something to press. */
.wire__summary--static,
.wire__summary--static:hover {
  background: none;
  cursor: default;
}

/*
 * This page cannot name most of the parties it hears from, so a wire entry
 * carries an identifier where another page carries a short name. In a narrow
 * column there is no room for that beside a long verdict, and the identifier
 * is the one that may not be cut. So where the entry is narrow its label and
 * its verdict share the first row, the verdict still at the right, and the
 * two lines take the whole width beneath. Which form it takes depends on the
 * room and never on the verdict, so a list of entries stays even. The width
 * asked about is what the three parts need side by side: the label, the
 * longer line, and the longest verdict.
 */
.wire__entry {
  container-type: inline-size;
}

@container (max-width: 38em) {
  .wire__summary--static {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: var(--s2);
  }

  .wire__summary--static > .status {
    grid-row: 1;
    grid-column: 2;
    justify-self: end;
    text-align: right;
    /* On the narrowest phone the longest verdict takes two lines before it runs under the label. */
    white-space: normal;
  }

  /* The two lines, whether the shared stylesheet boxes them together or lays each out on its own. */
  .wire__summary--static > .wire__lines,
  .wire__summary--static > .wire__lines > :first-child {
    grid-row: 2;
    grid-column: 1 / -1;
  }

  .wire__summary--static > .wire__lines > :last-child {
    grid-row: 3;
    grid-column: 1 / -1;
  }
}

/* On the smallest phones an entry is narrower than its second line. There the line wraps, so the end of a time is never left out. */
@container (max-width: 18.5em) {
  .wire__summary--static .wire__what {
    overflow: visible;
    white-space: normal;
  }
}

/*
 * An identifier is printed whole and may break anywhere to fit. It is never
 * cut off: the end of a DID is as much a part of it as the start.
 */
.id {
  overflow-wrap: anywhere;
}

/* A shortened key is one short word. It moves to the next line whole. */
.id--whole {
  white-space: nowrap;
}

/* The masthead prints this service's own identifier whole, on as many lines as it needs. */
.mast__did {
  max-width: none;
  overflow: visible;
  white-space: normal;
  text-align: right;
}

/*
 * The head of a trace. On another page both ends are names. Here the
 * presenter is usually a key this service has never seen, and it is printed
 * as an identifier is printed everywhere. So a cell is never narrower than
 * what it holds, and the head breaks onto more lines before one cell runs
 * under the next.
 */
.trace__parties {
  flex-wrap: wrap;
  min-width: min-content;
}

.trace__party {
  min-width: min-content;
}

.trace__party .label {
  white-space: nowrap;
}

.trace__party b {
  overflow: visible;
  white-space: normal;
  overflow-wrap: anywhere;
}

/*
 * A row of the trace. Its check name is an identifier, so it is never broken,
 * not even at its hyphen. Its sentence is balanced, so its last line never
 * holds one word alone.
 */
.trace__check {
  white-space: nowrap;
}

.trace__row .fine {
  text-wrap: pretty;
}

/*
 * On a phone a row's check name and its state share the first line when both
 * fit beside the number. When they do not, the state takes a line of its own,
 * still at the right, and the name stays whole. The sentence, and the reason
 * the gate gave, start under the name, as they do on any phone.
 */
@media (max-width: 37.5em) {
  .trace__row {
    display: flex;
    flex-wrap: wrap;
  }

  .trace__num {
    flex: none;
    width: var(--s6);
  }

  .trace__row .status {
    margin-left: auto;
  }

  .trace__row .fine,
  .trace__reason {
    order: 1;
    flex: none;
    width: calc(100% - var(--s6) - var(--s3));
    margin-left: calc(var(--s6) + var(--s3));
  }
}

/* A clause of a caption moves to the next line whole. */
.clause {
  display: inline-block;
}

/*
 * A hop's caption, one level below the heading of the pass it sits in. It
 * starts where that heading starts, is set in the case it is written in, and
 * sits close to the rows it names.
 */
.trace__hop-label {
  margin: 0;
  padding: var(--s2) var(--s5) 0 calc(var(--s5) + var(--rule));
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink-2);
}

/* A row in a list of records: the title above its identifier. */
.row > div {
  min-width: 0;
}

/* Every record has the same room above and below, the last one included, and on a wide page all four fit their list. */
#records-body .row {
  padding-top: var(--s2);
  padding-bottom: var(--s2);
}

/* A number inside a line of policy keeps that line's height, so every row sits at the same pitch. */
.fineprint .mono {
  line-height: inherit;
}

/* A label that has to wrap breaks into even lines and never leaves one word alone. */
.label {
  text-wrap: balance;
}

@media (max-width: 68.75em) {
  .onboard {
    grid-column: 1 / -1;
  }
}

/* Framed, the tally is its label and its headline, and the panel's own edge closes it. */
:root[data-frame] .tally__headline {
  border-bottom: 0;
}
