/* ============================================================
   demos.css — additional interactive widgets:
   - Lifecycle scrubber
   - Receipt verifier
   - Trust score composer
   - Protocol matrix
   Matches tokens defined in site.css / tokens.css.
   ============================================================ */

/* shared: section eyebrow index (small, unobtrusive) */
.demo-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.demo-pane-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border: 1px solid var(--hairline); border-bottom: none;
  background: var(--bg-2); font-family: var(--font-mono); font-size: 10.5px;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em;
  border-radius: 6px 6px 0 0;
}
.demo-pane-head .n { color: var(--accent); }

.code-block {
  background: #0C0C0B; color: #E8E6E2;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6;
  padding: 18px 20px; border: 1px solid var(--hairline);
  white-space: pre-wrap; word-break: break-word;
  border-radius: 0 0 6px 6px;
  overflow-x: auto;
}
.code-block .c1 { color: oklch(72% 0.14 155); }      /* keyword green */
.code-block .c2 { color: #E1BD7B; }                  /* strings */
.code-block .c3 { color: #7A7A73; }                  /* comments */
.code-block .c4 { color: #93B7D9; }                  /* keys */
.code-block .c5 { color: #C89DD1; }                  /* numbers */

/* ========================================================
   DEMO · Contract lifecycle scrubber
   ======================================================== */
.scrub {
  margin-top: var(--s-5);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: var(--s-5);
  background: var(--bg);
}
.scrub-track-row { position: relative; padding: 18px 8px 56px; }
.scrub-track {
  position: relative; height: 2px; background: var(--hairline);
}
.scrub-progress {
  position: absolute; top: 0; left: 0; height: 2px;
  background: var(--accent);
  transition: width 340ms cubic-bezier(.2,.7,.3,1);
}
.scrub-stops {
  position: absolute; top: -6px; left: 0; right: 0;
  display: flex; justify-content: space-between;
}
.scrub-stop {
  background: var(--bg); border: 1.5px solid var(--hairline-strong);
  width: 14px; height: 14px; border-radius: 50%;
  cursor: pointer; padding: 0; transition: all 200ms;
  position: relative;
}
.scrub-stop:hover { border-color: var(--fg); }
.scrub-stop.on {
  background: var(--accent); border-color: var(--accent);
  transform: scale(1.3);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}
.scrub-stop.passed { background: var(--accent); border-color: var(--accent); }
.scrub-labels {
  position: absolute; top: 26px; left: 0; right: 0;
  display: flex; justify-content: space-between;
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase;
}
.scrub-labels span { transform: translateX(-50%); padding: 6px 8px; cursor: pointer; }
.scrub-labels span:first-child { transform: translateX(-6px); }
.scrub-labels span:last-child { transform: translateX(calc(-100% + 6px)); }
.scrub-labels span.on { color: var(--accent); }

.scrub-panes {
  display: grid; grid-template-columns: 0.9fr 1.1fr 1fr;
  border: 1px solid var(--hairline); border-radius: 8px;
  margin-top: var(--s-5); overflow: hidden;
}
@media (max-width: 900px) { .scrub-panes { grid-template-columns: 1fr; } }
.scrub-pane {
  padding: var(--s-4); border-right: 1px solid var(--hairline);
  min-height: 300px; font-size: 13px; position: relative;
  background: var(--bg);
}
.scrub-pane:last-child { border-right: none; background: var(--bg-2); }
@media (max-width: 900px) {
  .scrub-pane { border-right: none; border-bottom: 1px solid var(--hairline); }
  .scrub-pane:last-child { border-bottom: none; }
}
.scrub-pane h5 {
  font-family: var(--font-mono); font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.14em; margin: 0 0 var(--s-3); font-weight: 500;
}
.kv { display: grid; grid-template-columns: 1fr auto; gap: 10px 16px; font-family: var(--font-mono); font-size: 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; color: var(--fg); text-align: right; font-weight: 500; }
.scrub-event-box {
  background: #0C0C0B; color: #E8E6E2; padding: 14px;
  border-radius: 4px; font-family: var(--font-mono); font-size: 12px;
  line-height: 1.6; min-height: 220px;
  white-space: pre-wrap; word-break: break-word;
}
.wh-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--hairline);
  font-family: var(--font-mono); font-size: 11.5px;
  animation: dfadeIn 300ms ease;
}
.wh-row:last-child { border-bottom: none; }
.wh-row .wh-sub { color: var(--fg); }
.wh-row .status-2xx { color: var(--accent); font-weight: 600; }
.wh-row .lat { color: var(--muted); }
@keyframes dfadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.play-btn {
  position: absolute; top: 18px; right: 18px;
  font-family: var(--font-mono); font-size: 10.5px;
  border: 1px solid var(--hairline-strong); background: var(--bg);
  padding: 6px 12px; cursor: pointer;
  letter-spacing: 0.08em; color: var(--fg); border-radius: 4px;
  transition: all 150ms;
}
.play-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ========================================================
   DEMO · Receipt verifier
   ======================================================== */
.receipt-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4);
  margin-top: var(--s-5);
}
@media (max-width: 900px) { .receipt-grid { grid-template-columns: 1fr; } }
.receipt-input {
  width: 100%; height: 280px; padding: 16px;
  border: 1px solid var(--hairline);
  background: #0C0C0B; color: #E8E6E2;
  font-family: var(--font-mono); font-size: 12px;
  border-radius: 0 0 6px 6px; resize: vertical; line-height: 1.6;
}
.receipt-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.verify-out {
  border: 1px solid var(--hairline);
  border-radius: 0 0 6px 6px;
  background: var(--bg);
  min-height: 280px;
  font-family: var(--font-mono); font-size: 12px;
}
.verify-out .vrow {
  display: grid; grid-template-columns: 170px 1fr; padding: 11px 16px;
  border-bottom: 1px solid var(--hairline); gap: 10px; align-items: baseline;
  animation: dfadeIn 240ms ease;
}
.verify-out .vrow:last-child { border-bottom: none; }
.verify-out .vrow .k { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: 0.12em; }
.verify-out .vrow .v { word-break: break-all; color: var(--fg); }
.verify-out .vrow .v.ok { color: var(--accent); font-weight: 500; }
.verify-out .vrow .v.err { color: #D04A3A; }
.verify-actions { margin-top: var(--s-3); display: flex; gap: 10px; }
.verify-note {
  margin-top: 10px; font-family: var(--font-mono); font-size: 10px;
  color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase;
}

/* ========================================================
   DEMO · Trust score composer
   ======================================================== */
.trust {
  margin-top: var(--s-5);
  border: 1px solid var(--hairline); border-radius: 10px;
  padding: var(--s-5) var(--s-5) var(--s-4);
  background: var(--bg);
}
.trust-head {
  display: grid; grid-template-columns: 1fr auto; gap: var(--s-5);
  align-items: end;
  margin-bottom: var(--s-4); padding-bottom: var(--s-4);
  border-bottom: 1px solid var(--hairline);
}
@media (max-width: 700px) { .trust-head { grid-template-columns: 1fr; } }
.trust-display {
  font-family: var(--font-mono); font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.16em;
}
.trust-display .score {
  display: block; font-family: var(--font-display); font-size: 96px;
  color: var(--fg); letter-spacing: -0.04em; margin-top: 4px; line-height: 0.9;
  font-weight: 600;
  font-feature-settings: "tnum" 1; font-variant-numeric: tabular-nums;
}
.trust-display .delta {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--accent); margin-top: 12px; display: inline-block;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.trust-tiers {
  display: flex; flex-direction: column; gap: 4px;
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.12em;
}
.tier-pip {
  padding: 6px 14px; border: 1px solid var(--hairline);
  color: var(--muted); background: var(--bg);
  transition: all 200ms; min-width: 140px; text-align: center;
  border-radius: 3px;
}
.tier-pip.on {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}
.trust-rows { display: flex; flex-direction: column; }
.trust-row {
  display: grid; grid-template-columns: 220px 1fr 64px 78px;
  gap: var(--s-3); align-items: center; padding: 14px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px; transition: background 200ms;
}
.trust-row:hover { background: var(--bg-2); }
.trust-row:last-child { border-bottom: none; }
@media (max-width: 760px) { .trust-row { grid-template-columns: 1fr; gap: 8px; padding: 14px 0; } }
.trust-row .name {
  font-family: var(--font-mono); font-size: 12.5px; font-weight: 500; color: var(--fg);
}
.trust-row .name .src {
  display: block; font-size: 11px; color: var(--muted);
  margin-top: 3px; font-family: var(--font-body); font-weight: 400; letter-spacing: 0;
}
.trust-row input[type=range] {
  width: 100%; accent-color: var(--accent); cursor: pointer;
}
.trust-row .weight {
  font-family: var(--font-mono); font-size: 13px; color: var(--accent);
  text-align: right; font-weight: 600;
}
.trust-row .comp-score {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted); text-align: right;
}
.trust-bar {
  height: 4px; background: var(--bg-3); position: relative;
  overflow: hidden; margin-bottom: 8px; border-radius: 2px;
}
.trust-bar .fill {
  height: 100%; background: var(--accent);
  transition: width 300ms cubic-bezier(.2,.7,.3,1);
}
.trust-note {
  margin-top: var(--s-4); padding: var(--s-3) var(--s-4);
  background: var(--bg-2); border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: var(--fs-sm); color: var(--muted); line-height: 1.55;
}
.trust-note .label {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--accent); margin-bottom: 4px; display: block; font-weight: 600;
}

/* ========================================================
   DEMO · Protocol matrix
   ======================================================== */
.proto {
  margin-top: var(--s-5);
}
.proto-chips {
  display: flex; flex-wrap: wrap; gap: 0;
  margin-bottom: var(--s-4);
  border: 1px solid var(--hairline); border-radius: 6px;
  overflow: hidden; background: var(--bg); width: fit-content;
  max-width: 100%;
}
.proto-chip {
  font-family: var(--font-mono); font-size: 12px;
  padding: 10px 18px;
  border: none; border-right: 1px solid var(--hairline);
  background: var(--bg); color: var(--muted);
  cursor: pointer; transition: all 200ms;
  white-space: nowrap;
}
.proto-chip:last-child { border-right: none; }
.proto-chip:hover { background: var(--bg-2); color: var(--fg); }
.proto-chip.on { background: #0A0A09; color: #FAFAF9; font-weight: 600; }
.proto-panels {
  display: grid; grid-template-columns: 1fr 1.25fr; gap: var(--s-4);
}
@media (max-width: 900px) { .proto-panels { grid-template-columns: 1fr; } }
