/* The harness page's own styles. Everything shared (type, colours, buttons, the reading grid)
   comes from ../style.css; this file only adds the stack diagram, the effect ledger, the plugin
   list and the event lists. */

/* The stack diagram: five labelled layers, one per row, with the framework at the bottom. */
.stack {
  border: 1px solid var(--line);
  background: #f4f9fd;
  margin: 1.5rem 0;
}

.stack-row {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid #dbe6ef;
  align-items: baseline;
}

.stack-row:last-child {
  border-bottom: 0;
}

.stack-label {
  font-weight: 700;
  color: #142d44;
  font-size: 0.92rem;
}

.stack-body {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 0.94rem;
  color: var(--muted);
}

.stack-base {
  background: var(--wash);
}

.stack-base .stack-body {
  color: var(--ink);
  font-weight: 550;
}


/* The services panel: a definition list that reads as a table without being one. */
.metrics {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem 1rem;
  margin: 1rem 0 1.5rem;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 0;
}

.metrics dt {
  font-family: ui-monospace, monospace;
  font-size: 0.86rem;
  color: var(--muted);
}

.metrics dd {
  margin: 0;
  font-weight: 650;
  text-align: right;
  overflow-wrap: anywhere;
}

/* The plugin list: one button per package, its mount state and its role. The button is the
   control and the label at once, so a reader can see the whole composition without clicking. */
.plugin-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  gap: 0.6rem;
  margin: 1rem 0;
}

.plugin-toggle {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.1rem 0.6rem;
  align-items: baseline;
  text-align: left;
  padding: 0.55rem 0.7rem;
  background: white;
  color: var(--ink);
  border: 1px solid #7c97ac;
}

.plugin-toggle:hover {
  background: var(--wash);
  color: var(--ink);
}

.plugin-toggle[aria-pressed="true"] {
  border-left: 4px solid #075c9c;
  background: #f2f8fd;
}

.plugin-toggle[aria-pressed="false"] {
  border-left: 4px solid #9fb4c6;
  color: var(--muted);
}

.plugin-pkg {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
  grid-column: 1;
}

.plugin-state {
  grid-column: 1;
  font-size: 0.8rem;
  color: var(--muted);
}

.plugin-toggle[aria-pressed="true"] .plugin-state {
  color: #075c9c;
  font-weight: 650;
}

.plugin-role {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

/* The effect ledger. Each row is one registration and the inverse the runtime holds for it; the
   rows are numbered, because the order they come off in is the whole point. */
.effect-list {
  list-style: none;
  margin: 1rem 0 1.5rem;
  padding: 0;
  border-left: 3px solid #4c8fc4;
}

.effect {
  padding: 0.45rem 0 0.45rem 0.9rem;
  border-bottom: 1px solid #dbe6ef;
  max-width: 82ch;
}

.effect-head {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.55rem;
  align-items: baseline;
}

.effect-seq {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  color: var(--muted);
}

.effect-plugin {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: #142d44;
  font-weight: 650;
}

.effect-label {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.effect-inverse {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

/* The unwound ledger keeps the same rows: an inversion is the same registration, read backwards. */
.effect-unwound {
  border-left-color: #ad5500;
}

.effect-unwound .effect-inverse {
  color: #8a4300;
}

.effect-unwinding {
  background: #fff1d8;
}

.unwind-title {
  margin: 1.6rem 0 0.4rem;
  font-size: 1rem;
}

.unwind-title:empty {
  display: none;
}

/* The event lists: the turn flow and the tail of the session log. */
.event-list {
  list-style: none;
  margin: 0.8rem 0 1.5rem;
  padding: 0;
  border-left: 3px solid var(--line);
}

.event {
  display: grid;
  grid-template-columns: minmax(9rem, auto) minmax(0, 1fr);
  gap: 0.2rem 0.8rem;
  align-items: baseline;
  padding: 0.3rem 0 0.3rem 0.9rem;
  border-bottom: 1px solid #dbe6ef;
  font-size: 0.9rem;
}

.event-name {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  color: #142d44;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.event-text {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.event-session {
  border-left: 0;
}

.event-agent .event-name {
  color: #8a4300;
}

.event-capability .event-name {
  color: #0b5e46;
}

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

@media (max-width: 760px) {
  .stack-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

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

/* Long identifiers have no break opportunity, so a phone-width column overflows the page
   without this. */
.article p,
.article li,
.article dd,
.article td {
  overflow-wrap: anywhere;
}
