/* Validation panel, authority diagram, process assembly, and scroll reveals. */

/* ---------- scroll reveals ---------- */

.reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity 0.5s ease,
    transform 0.5s ease;
}

.reveal-ready [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  /* Keep the signal, drop the pulse. */
  .pb-live-dot,
  .process-builder.is-live .pb-btn,
  .process-builder.is-building .pb-steps > li.is-added {
    animation: none;
  }

  .pb-live-dot {
    box-shadow: 0 0 0 3px rgb(34 197 94 / 0.25);
  }

  .reveal-ready [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

@media (max-width: 860px) {
  /* Grid items default to min-width:auto, so without this the diagram's
     min-width would widen its column and scroll the page sideways. */
}

/* ---------- what-it-is explainer ---------- */

/* The information section sits between the hero and the benefit claims, so it
   reads as plain description rather than another card grid. */
.explainer {
  padding-top: 96px;
}

/* Introductory paragraphs span the section beneath the heading. */
.explainer .section-heading {
  max-width: none;
  margin-bottom: 44px;
}

.explainer-lede {
  display: block;
  width: 100%;
  margin-top: 22px;
  color: var(--soft);
  font-size: 1rem;
  line-height: 1.75;
}

.explainer-lede p {
  margin: 0;
}

.explainer-lede p + p {
  margin-top: 16px;
}

.explainer .section-heading > p {
  margin: 18px 0 0;
  color: var(--soft);
  font-size: 1rem;
  line-height: 1.68;
}

.explainer .section-heading > p strong {
  color: var(--ink);
}

.explainer-body {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(36px, 5vw, 68px);
  align-items: start;
}

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

.setup-steps li {
  display: grid;
  transition:
    opacity 0.45s ease,
    filter 0.45s ease;
}

/* Only dims once the script is running, so no-JS reads all three plainly. */
.explainer-body.is-guided .setup-steps li[data-stage]:not(.is-reached) {
  opacity: 0.42;
}

.setup-steps li[data-stage] {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

.setup-steps li:last-child {
  border-bottom: 0;
}

.setup-steps span {
  color: var(--blue);
  font:
    400 0.72rem "DM Mono",
    monospace;
}

.setup-steps strong {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
}

.setup-steps p {
  margin: 8px 0 0;
  color: var(--soft);
  font-size: 0.84rem;
  line-height: 1.6;
}

/* ---------- process builder mock ----------
   Mirrors TenantWorkflowStepsEditor.vue. Palette taken from the tenant app's
   Vuetify theme (primary #27272A, surface #FFF, grey-200 #E4E4E7), so the
   section shows the product rather than an illustration of it. */

.builder-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

/* The "live" signal. Scoped to the builder so the bright green never leaks
   into the page palette, and retired the moment someone interacts. */
.pb-hint {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--soft);
  font-size: 0.8rem;
  transition: opacity 0.4s ease;
}

.pb-live-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgb(34 197 94 / 0.55);
  animation: pb-beacon 2.2s ease-out infinite;
}

.builder-column.is-discovered .pb-hint {
  opacity: 0;
  pointer-events: none;
}

@keyframes pb-beacon {
  0% {
    box-shadow: 0 0 0 0 rgb(34 197 94 / 0.55);
  }
  70% {
    box-shadow: 0 0 0 9px rgb(34 197 94 / 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgb(34 197 94 / 0);
  }
}

.process-builder {
  --pb-primary: #27272a;
  --pb-ink: #18181b;
  --pb-muted: #71717a;
  --pb-line: #e4e4e7;
  --pb-sunk: #fafafa;
  --pb-info: #0369a1;

  border: 1px solid var(--pb-line);
  border-radius: 10px;
  background: #fff;
  box-shadow:
    0 2px 6px rgb(24 24 27 / 0.04),
    0 18px 44px rgb(24 24 27 / 0.08);
  font-family: Inter, system-ui, sans-serif;
}

.pb-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 17px 18px;
}

.pb-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 7px;
  background: rgb(39 39 42 / 0.08);
  color: var(--pb-primary);
  font-size: 0.82rem;
  font-weight: 600;
}

.pb-avatar-icon {
  font-size: 1rem;
}

.pb-headings strong {
  display: block;
  color: var(--pb-ink);
  font-size: 0.94rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.pb-headings span {
  display: block;
  margin-top: 2px;
  color: var(--pb-muted);
  font-size: 0.76rem;
}

.pb-btn {
  position: relative;
  appearance: none;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  border-radius: 6px;
  background: rgb(39 39 42 / 0.08);
  color: var(--pb-primary);
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background 0.18s ease;
}

.pb-btn:hover,
.process-builder.is-adding .pb-btn {
  background: rgb(39 39 42 / 0.18);
}

/* Before the first interaction the control reads as live rather than as
   part of a static screenshot. */
.process-builder.is-live .pb-btn {
  background: rgb(34 197 94 / 0.15);
  color: #14532d;
  animation: pb-beacon 2.2s ease-out infinite;
}

.process-builder.is-live .pb-btn:hover {
  background: rgb(34 197 94 / 0.26);
}

.pb-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: default;
}

.pb-btn[aria-disabled="true"]:hover {
  background: rgb(39 39 42 / 0.08);
}

.pb-btn i {
  font-style: normal;
  font-size: 0.95rem;
  line-height: 1;
}

.pb-divider {
  height: 1px;
  background: var(--pb-line);
}

.pb-body {
  padding: 16px;
}

.process-builder.is-building .pb-body {
  min-height: 200px;
}

.pb-empty {
  padding: 13px 15px;
  border-radius: 7px;
  background: rgb(3 105 161 / 0.08);
  color: var(--pb-info);
  font-size: 0.8rem;
}

.pb-steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pb-steps > li {
  padding: 14px;
  border: 1px solid var(--pb-line);
  border-radius: 9px;
  background: #fff;
}

.pb-step-head {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
}

.pb-step-titles strong {
  display: block;
  min-height: 1.15em;
  color: var(--pb-ink);
  font-size: 0.85rem;
  font-weight: 500;
}

.pb-step-titles span {
  display: block;
  margin-top: 1px;
  color: var(--pb-muted);
  font-size: 0.73rem;
}

.pb-actions {
  display: inline-flex;
  gap: 3px;
  color: #a1a1aa;
}

.pb-act {
  appearance: none;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  padding: 0;
  border-radius: 6px;
  color: inherit;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.pb-act:hover {
  background: rgb(39 39 42 / 0.08);
  color: var(--pb-primary);
}

.pb-actions .pb-del {
  color: #b91c1c;
}

.pb-actions .pb-del:hover {
  background: rgb(185 28 28 / 0.09);
  color: #b91c1c;
}

.pb-btn:focus-visible,
.pb-act:focus-visible {
  outline: 2px solid var(--pb-primary);
  outline-offset: 2px;
}

/* Reordering moves items visually; the DOM order stays stable so the
   no-JS card still reads 1-4 top to bottom. */
.pb-steps > li {
  order: 0;
}

/* ---------- run state ---------- */

/* An author display rule beats the hidden attribute's UA style, so state it. */
.pb-foot[hidden],
.pb-menu[hidden] {
  display: none;
}

.pb-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--pb-line);
}

.pb-run {
  appearance: none;
  border: 0;
  padding: 9px 15px;
  border-radius: 6px;
  background: var(--pb-primary);
  color: #fff;
  font:
    600 0.78rem Inter,
    sans-serif;
  cursor: pointer;
}

.pb-run:hover {
  background: #18181b;
}

.pb-run[aria-disabled="true"] {
  opacity: 0.5;
  cursor: default;
}

.pb-run:focus-visible {
  outline: 2px solid var(--pb-primary);
  outline-offset: 2px;
}

.pb-run-status {
  color: var(--pb-muted);
  font-size: 0.76rem;
}

.pb-state {
  min-width: 0;
  color: var(--pb-muted);
  font-size: 0.7rem;
  font-family: "DM Mono", monospace;
}

.pb-steps > li.is-running .pb-state {
  color: var(--pb-info);
}

.pb-steps > li.is-done .pb-state {
  color: #15803d;
}

/* Editing controls step aside while the process is running. */
.process-builder.is-running .pb-actions,
.process-builder.is-running .pb-grip {
  display: none;
}

.process-builder.is-running .pb-fields {
  display: none;
}

.pb-step-head {
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
}

/* Fields belong to the step being edited; finished steps collapse to their
   header the way a long form reads once you have moved past it. This holds
   with or without the script, so the no-JS card stays a sensible height. */
.pb-steps > li:not(.is-editing) .pb-fields {
  display: none;
}

.pb-fields {
  display: grid;
  gap: 10px;
  margin-top: 13px;
}

.pb-field {
  display: block;
}

.pb-field > span:first-child {
  display: block;
  margin-bottom: 5px;
  color: var(--pb-muted);
  font-size: 0.72rem;
}

.pb-input {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--pb-line);
  border-radius: 6px;
  background: var(--pb-sunk);
  color: var(--pb-ink);
  font-size: 0.82rem;
}

input.pb-name {
  width: 100%;
  appearance: none;
  font-family: inherit;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}

input.pb-name:hover {
  border-color: #d4d4d8;
}

input.pb-name:focus {
  outline: none;
  border-color: var(--pb-primary);
  background: #fff;
}

button.pb-select {
  width: 100%;
  appearance: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color 0.15s ease;
}

button.pb-select:hover {
  border-color: #d4d4d8;
}

button.pb-select[aria-expanded="true"] {
  border-color: var(--pb-primary);
  background: #fff;
}

.pb-field {
  position: relative;
}

.pb-label {
  display: block;
  margin-bottom: 5px;
  color: var(--pb-muted);
  font-size: 0.72rem;
}

.pb-menu {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: 100%;
  margin: 4px 0 0;
  max-height: 208px;
  overflow-y: auto;
  padding: 5px;
  list-style: none;
  border: 1px solid var(--pb-line);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 10px 26px rgb(24 24 27 / 0.14);
}

/* Opens upward when there is not enough room below. */
.pb-field.is-flipped .pb-menu {
  top: auto;
  bottom: 100%;
  margin: 0 0 4px;
}

.pb-menu li {
  padding: 8px 10px;
  border-radius: 5px;
  color: var(--pb-ink);
  font-size: 0.8rem;
  cursor: pointer;
}

.pb-menu li:hover {
  background: rgb(39 39 42 / 0.06);
}

.pb-menu li[aria-selected="true"] {
  background: rgb(39 39 42 / 0.09);
  font-weight: 500;
}

.pb-grip {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  color: #a1a1aa;
  font: inherit;
  font-size: 0.8rem;
  cursor: grab;
}

.pb-grip:active {
  cursor: grabbing;
}

.pb-grip:focus-visible {
  outline: 2px solid var(--pb-primary);
  outline-offset: 2px;
  border-radius: 4px;
}

.pb-steps > li.is-dragging {
  opacity: 0.45;
}

.pb-steps > li.is-drop-target {
  border-color: var(--pb-primary);
  box-shadow: 0 0 0 3px rgb(39 39 42 / 0.08);
}

.pb-select i {
  color: var(--pb-muted);
  font-style: normal;
  font-size: 0.8rem;
}

.pb-select b {
  flex: 1;
  font-weight: 400;
}

.pb-select em {
  color: var(--pb-muted);
  font-style: normal;
  font-size: 0.7rem;
}

.pb-typed::after {
  content: "";
  display: inline-block;
  width: 1px;
  height: 0.95em;
  background: var(--pb-primary);
  opacity: 0;
  vertical-align: -0.12em;
}

.process-builder.is-typing .pb-steps > li.is-editing .pb-typed::after {
  opacity: 1;
  animation: pb-caret 1s steps(1) infinite;
}

@keyframes pb-caret {
  50% {
    opacity: 0;
  }
}

/* Animated state. Without the script every step and field stays visible. */
.process-builder.is-building .pb-steps > li {
  display: none;
}

.process-builder.is-building .pb-steps > li.is-added {
  display: block;
  animation: pb-drop 0.34s ease both;
}

.process-builder.is-building .pb-empty {
  display: none;
}

.process-builder.is-building.is-empty .pb-empty {
  display: block;
}

@keyframes pb-drop {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 980px) {
  .explainer-body {
    grid-template-columns: 1fr;
  }
}

/* Touch pointers cannot start an HTML5 drag, so the handle is hidden there and
   the arrow buttons become the only reordering mechanism. */
@media (hover: none), (pointer: coarse) {
  .pb-grip {
    display: none;
  }

  .pb-step-head {
    grid-template-columns: auto minmax(0, 1fr) auto;
  }

  .pb-act {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
  }

  .pb-menu li {
    padding: 12px 10px;
  }

  input.pb-name,
  button.pb-select {
    min-height: 42px;
    font-size: 16px; /* stops iOS Safari zooming the page on focus */
  }
}

@media (max-width: 560px) {
  .pb-head {
    grid-template-columns: auto minmax(0, 1fr);
    row-gap: 12px;
  }

  .pb-btn {
    grid-column: 1 / -1;
    justify-content: center;
  }

  .pb-headings span {
    display: none;
  }

  .pb-step-head {
    column-gap: 9px;
  }

  .pb-actions {
    gap: 0;
  }
}

@media (max-width: 860px) {
  .explainer {
    padding-top: 72px;
  }
}

/* ---------- two-run comparison ----------
   Each run is a column you read down. Magnitude is one hue (the page blue);
   status colour appears only on the change chip, always with an arrow and a
   label. */

.tuning-head {
  max-width: none;
}

.run-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(16px, 2.4vw, 28px);
  align-items: start;
}

.run-col {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #fff;
  overflow: hidden;
}

.run-col.is-current {
  border-color: #b7c8d4;
  box-shadow: 0 12px 32px rgb(20 45 64 / 0.08);
}

.run-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

.run-col.is-current .run-col-head {
  background: var(--pale);
}

.run-col-head strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.run-col-head span {
  color: #8ba0af;
  font:
    400 0.68rem "DM Mono",
    monospace;
}

.runcol-list {
  flex: 1;
  margin: 0;
  padding: 0;
  list-style: none;
}

.runcol-item {
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
}

.runcol-item.is-flagged {
  background: #fdf6f4;
  box-shadow: inset 3px 0 0 #b4503c;
}

.run-line {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.run-idx {
  color: #8ba0af;
  font:
    400 0.68rem "DM Mono",
    monospace;
}

.run-name {
  min-width: 0;
}

.run-name strong {
  display: block;
  color: var(--ink);
  font-size: 0.86rem;
  line-height: 1.3;
}

.run-model {
  display: block;
  margin-top: 2px;
  color: var(--blue);
  font:
    400 0.67rem "DM Mono",
    monospace;
}

/* Amount and change share one right-hand column, stacked. */
.run-right {
  display: grid;
  justify-items: end;
  gap: 4px;
  text-align: right;
}

.run-amount {
  color: var(--ink);
  font:
    500 0.84rem "DM Mono",
    monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.run-col:not(.is-current) .run-amount {
  color: #8ba0af;
}

.delta {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font:
    500 0.68rem "DM Mono",
    monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.delta i {
  font-style: normal;
  font-size: 0.6rem;
}

.delta.is-worse {
  background: #f7e7e2;
  color: #97402c;
}

.delta.is-better {
  background: #e6f2ec;
  color: #176b4a;
}

.delta.is-same {
  color: #b3c1cb;
}

.run-col-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 20px;
  border-top: 1px solid var(--line);
  background: #f8fafb;
}

.run-col-foot span {
  color: var(--ink);
  font:
    600 0.8rem Inter,
    sans-serif;
}

.run-col-foot strong {
  color: var(--ink);
  font:
    500 1.05rem "DM Mono",
    monospace;
  font-variant-numeric: tabular-nums;
}

.run-col:not(.is-current) .run-col-foot strong {
  color: #8ba0af;
}

/* ---------- scan bar ---------- */

.scan-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--soft);
  font:
    400 0.78rem "DM Mono",
    monospace;
}

.scan-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--blue);
}

.scan-bar.is-scanning .scan-dot {
  animation: scan-pulse 1s ease-in-out infinite;
}

.scan-bar.is-found .scan-dot {
  background: #b4503c;
}

.scan-bar.is-clear .scan-dot {
  background: var(--green);
}

@keyframes scan-pulse {
  50% {
    opacity: 0.25;
  }
}

.scan-again {
  appearance: none;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--blue);
  font:
    500 0.72rem Inter,
    sans-serif;
  cursor: pointer;
}

.scan-again:hover {
  border-color: #b7c8d4;
  background: var(--pale);
}

.scan-again[hidden] {
  display: none;
}

/* Each step lights as the scan passes over it, in both runs at once. */
.runcol-item.is-scanning {
  background: var(--pale);
  box-shadow: inset 3px 0 0 var(--blue);
}

/* ---------- the finding ---------- */

.finding[hidden] {
  display: none;
}

.finding {
  margin-top: 14px;
  padding: 15px;
  border: 1px solid #e8d7d0;
  border-radius: 9px;
  background: #fff;
  animation: finding-in 0.35s ease both;
}

@keyframes finding-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
}

.finding.is-approved {
  border-color: #b9dcc9;
}

.finding.is-dismissed {
  border-color: var(--line);
}

.finding-label {
  margin: 0 0 9px;
  color: #97402c;
  font:
    400 0.66rem "DM Mono",
    monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.finding.is-approved .finding-label {
  color: #176b4a;
}

.finding-body {
  margin: 0 0 13px;
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.55;
}

.finding code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f2f5f7;
  font:
    400 0.9em "DM Mono",
    monospace;
}

.finding-action {
  margin: 13px 0 0;
  padding: 11px 13px;
  border-radius: 7px;
  background: #fdf1e9;
  color: #8a4318;
  font-size: 0.82rem;
  line-height: 1.5;
}

.finding.is-approved .finding-action {
  background: #eef7f2;
  color: #176b4a;
}

.finding-action code {
  background: #f7e7e2;
}

.finding.is-approved .finding-action code {
  background: #e0f0e7;
}

.finding-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 13px;
}

.finding-approve,
.finding-reject {
  appearance: none;
  padding: 9px 16px;
  border-radius: 7px;
  font:
    600 0.78rem Inter,
    sans-serif;
  cursor: pointer;
}

.finding-approve {
  border: 0;
  background: var(--navy, #0b2f4f);
  color: #fff;
}

.finding-approve:hover {
  background: #0b1621;
}

.finding-reject {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--soft);
}

.finding-reject:hover {
  border-color: #b7c8d4;
  color: var(--ink);
}

.finding-approve:focus-visible,
.finding-reject:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- tool call table ---------- */

.tool-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.tool-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 52px 52px 58px;
  gap: 8px;
  align-items: baseline;
  font:
    400 0.73rem "DM Mono",
    monospace;
  font-variant-numeric: tabular-nums;
}

.tool-list span {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.tool-list b {
  color: var(--soft);
  font-weight: 400;
  text-align: right;
}

.tool-list em {
  color: var(--soft);
  font-style: normal;
  text-align: right;
}

.tool-head {
  padding-bottom: 7px;
  border-bottom: 1px solid var(--line);
}

.tool-head b,
.tool-head em {
  color: #96a7b2;
  font-size: 0.66rem;
}

.tool-row.is-loop span,
.tool-row.is-loop .tool-calls,
.tool-row.is-loop .tool-tokens {
  color: #97402c;
  font-weight: 500;
}

.finding.is-approved .tool-row.is-loop {
  opacity: 0.5;
}

.finding.is-approved .tool-row.is-loop span,
.finding.is-approved .tool-row.is-loop .tool-calls,
.finding.is-approved .tool-row.is-loop .tool-tokens {
  color: var(--soft);
  font-weight: 400;
  text-decoration: line-through;
}

@media (prefers-reduced-motion: reduce) {
  .scan-bar.is-scanning .scan-dot,
  .finding {
    animation: none;
  }
}

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

/* ---------- repository access ---------- */

.authority-lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
  overflow: hidden;
}

.auth-group {
  padding: 24px 26px 26px;
  background: #fff;
}

.auth-title {
  margin: 0 0 16px;
  color: var(--soft);
  font:
    400 0.68rem "DM Mono",
    monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.auth-group ul {
  display: grid;
  gap: 13px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.auth-group li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 11px;
  align-items: baseline;
  color: var(--ink);
  font-size: 0.88rem;
  line-height: 1.5;
}

.auth-mark {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  font-size: 0.66rem;
  line-height: 1;
}

.is-can .auth-mark {
  background: #e6f2ec;
  color: #176b4a;
}

.is-cannot .auth-mark {
  background: #f7e7e2;
  color: #97402c;
}

.is-cannot .auth-title {
  color: #97402c;
}

@media (max-width: 720px) {
  .authority-lists {
    grid-template-columns: 1fr;
  }
}

/* ---------- the boundary ----------
   Tools cross into the sandbox; the credential and the grants do not. Built in
   HTML so the crossing can animate and the type stays live text. */

.boundary {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) 78px minmax(0, 1fr);
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
}

.boundary-label,
.sandbox-label {
  margin: 0 0 14px;
  color: var(--soft);
  font:
    400 0.68rem "DM Mono",
    monospace;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.boundary-held {
  display: grid;
  gap: 11px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.boundary-held li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  color: var(--ink);
  font-size: 0.88rem;
}

.hold-mark {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: #f7e7e2;
  color: #97402c;
  font-size: 0.62rem;
}

.boundary-note {
  max-width: 34ch;
  margin: 16px 0 0;
  color: var(--soft);
  font-size: 0.8rem;
  line-height: 1.55;
}

/* The line the credential never crosses. */
.boundary-gap {
  position: relative;
  align-self: stretch;
  display: grid;
  place-items: center;
}

.boundary-rule {
  position: absolute;
  inset: 0 auto 0 50%;
  width: 1px;
  background: repeating-linear-gradient(
    to bottom,
    #b7c8d4 0 5px,
    transparent 5px 11px
  );
}

.boundary-word {
  position: relative;
  padding: 5px 0;
  background: var(--color-bg, #f5f6f8);
  color: #97a7b2;
  font:
    400 0.6rem "DM Mono",
    monospace;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
}

/* The sandbox itself: a container the tools land inside. */
.sandbox {
  border: 1px solid #b7c8d4;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 34px rgb(20 45 64 / 0.07);
}

.sandbox-head {
  border-radius: 11px 11px 0 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
  color: var(--soft);
  font:
    400 0.7rem "DM Mono",
    monospace;
}

.sandbox-dots {
  display: flex;
  gap: 5px;
}

.sandbox-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #cddce5;
}

.sandbox-body {
  padding: 18px;
}

.sandbox-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sandbox-tools li {
  padding: 7px 11px;
  border: 1px solid #cddce5;
  border-radius: 7px;
  background: var(--pale);
  color: var(--blue);
  font:
    400 0.73rem "DM Mono",
    monospace;
}

.sandbox-deny {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 16px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.sandbox-deny span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #97402c;
  font:
    400 0.72rem "DM Mono",
    monospace;
}

.sandbox-deny span::before {
  content: "✕";
  font-size: 0.62rem;
}

/* Crossing animation, once the figure is in view. */
.boundary.is-armed .sandbox-tools li {
  opacity: 0;
  transform: translateX(-160px);
}

.boundary.is-crossing .sandbox-tools li {
  animation: tool-cross 0.62s cubic-bezier(0.22, 0.7, 0.25, 1) both;
  animation-delay: calc(var(--i) * 0.16s);
}

@keyframes tool-cross {
  from {
    opacity: 0;
    transform: translateX(-160px) scale(0.94);
  }
  25% {
    opacity: 0.3;
  }
  82% {
    opacity: 0.55;
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* The held items try to follow, hit the line, and come back. */
.boundary.is-crossing .boundary-held li {
  animation: hold-back 0.75s ease both;
  animation-delay: calc(1.15s + var(--h, 0) * 0.1s);
}

@keyframes hold-back {
  0%,
  100% {
    transform: none;
  }
  40% {
    transform: translateX(11px);
  }
  62% {
    transform: translateX(-3px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .boundary.is-armed .sandbox-tools li,
  .boundary.is-crossing .sandbox-tools li,
  .boundary.is-crossing .boundary-held li {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

@media (max-width: 820px) {
  .boundary {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .boundary-gap {
    display: none;
  }

  .boundary-note {
    max-width: none;
  }
}

/* ---------- process assembly ----------
   Four loose instructions settle into an ordered, gated spine. The monospace
   fragment is the thing you would have typed; the structure forms around it
   rather than replacing it, which is the claim the section makes in words.

   The finished state is the default, so no-JS and reduced-motion visitors read
   the assembled process. The settle only plays when reveal.js marks the figure
   revealed, once, on the way past. */

.assembly-figure {
  position: relative;
  max-width: 760px;
  margin-inline: auto;
  padding-left: 54px;
}

.asm-rail {
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 26px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--blue), var(--line));
  transform-origin: top center;
}

.asm-stages {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.asm-stages > li {
  position: relative;
  display: grid;
  grid-template-columns: auto 118px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 18px rgb(20 45 64 / 0.05);
}

/* The node that ties each stage to the rail. */
.asm-stages > li::before {
  content: "";
  position: absolute;
  top: 50%;
  left: -32px;
  /* Centred with a margin rather than translateY so the node's scale-in
     animation does not have to carry the centring transform too. */
  margin-top: -5px;
  width: 10px;
  height: 10px;
  border: 2px solid var(--blue);
  border-radius: 50%;
  background: #fff;
}

.asm-ord {
  color: #8ba0af;
  font: 400 0.7rem "DM Mono", monospace;
}

.asm-name {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
}

.asm-instruction {
  overflow: hidden;
  color: var(--soft);
  font: 400 0.78rem "DM Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asm-gate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 5px;
  background: rgb(29 138 97 / 0.09);
  color: var(--green);
  font: 400 0.62rem "DM Mono", monospace;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.asm-gate i {
  font-style: normal;
}

.asm-legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  max-width: 980px;
  margin: 48px auto 0;
  padding: 34px 0 0;
  border-top: 1px solid var(--line);
  list-style: none;
}

.asm-legend strong {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
}

.asm-legend p {
  margin: 8px 0 0;
  color: var(--soft);
  font-size: 0.82rem;
  line-height: 1.65;
}

/* ---------- the settle ---------- */

.reveal-ready .assembly-figure.is-revealed .asm-stages > li {
  animation: asm-settle 620ms cubic-bezier(0.2, 0.7, 0.3, 1) backwards;
  animation-delay: calc(var(--i) * 130ms);
}

@keyframes asm-settle {
  from {
    opacity: 0.28;
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot));
    border-color: rgb(219 227 233 / 0);
    box-shadow: 0 0 0 rgb(20 45 64 / 0);
  }
  to {
    opacity: 1;
    transform: none;
    border-color: var(--line);
    box-shadow: 0 6px 18px rgb(20 45 64 / 0.05);
  }
}

/* Nodes and rail arrive only once the stages have landed, so the spine reads
   as a consequence of the order rather than a container it fell into. */
.reveal-ready .assembly-figure.is-revealed .asm-stages > li::before {
  animation: asm-node 300ms ease-out backwards;
  animation-delay: calc(560ms + var(--i) * 90ms);
}

@keyframes asm-node {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}

.reveal-ready .assembly-figure.is-revealed .asm-rail {
  animation: asm-rail 520ms ease-out 560ms backwards;
}

@keyframes asm-rail {
  from {
    transform: scaleY(0);
  }
}

.reveal-ready .assembly-figure.is-revealed .asm-gate {
  animation: asm-gate 320ms cubic-bezier(0.2, 0.8, 0.3, 1.35) backwards;
  animation-delay: calc(1020ms + var(--i) * 100ms);
}

@keyframes asm-gate {
  from {
    opacity: 0;
    transform: scale(0.6);
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal-ready .assembly-figure.is-revealed .asm-stages > li,
  .reveal-ready .assembly-figure.is-revealed .asm-stages > li::before,
  .reveal-ready .assembly-figure.is-revealed .asm-rail,
  .reveal-ready .assembly-figure.is-revealed .asm-gate {
    animation: none;
  }
}

@media (max-width: 980px) {
  .asm-legend {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

@media (max-width: 720px) {
  .assembly-figure {
    padding-left: 34px;
  }

  .asm-rail {
    left: 16px;
  }

  .asm-stages > li {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 6px 12px;
    /* Shorter throws so the scattered state never widens the viewport. */
    --dx: 0px;
    --dy: -14px;
    --rot: 0deg;
  }

  .asm-stages > li::before {
    top: 24px;
    left: -22px;
    margin-top: 0;
  }

  .asm-instruction {
    grid-column: 2 / -1;
    white-space: normal;
  }
}

/* ---------- outcomes, five across ----------
   The band in home.css divides with border-right and clears it on the last
   child. That holds at five columns, but once the cards wrap the divider has
   to follow column position instead of document order. */

.principles-five {
  grid-template-columns: repeat(5, 1fr);
}

.principles-five article {
  padding: 26px 22px;
}

@media (max-width: 1080px) {
  .principles-five {
    grid-template-columns: repeat(2, 1fr);
  }

  .principles-five article {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  /* Left column keeps a divider; the odd card that ends up alone does not. */
  .principles-five article:nth-child(odd):not(:last-child) {
    border-right: 1px solid var(--line);
  }

  .principles-five article:last-child {
    border-bottom: 0;
  }
}

@media (max-width: 720px) {
  .principles-five {
    grid-template-columns: 1fr;
  }

  .principles-five article:nth-child(odd):not(:last-child) {
    border-right: 0;
  }
}
