/* Demo page — shares the landing page's tokens (--p-*), sharp radius, blue lock accent. */

.demo {
  padding: calc(var(--nav, 72px) + 40px) 0 88px;
}

.demo__intro {
  padding-inline: 24px;
  margin: 0 auto 40px;
  text-align: center;
}

.demo__shell {
  width: min(100% - 0px, 860px);
  margin-inline: auto;
}

.demo__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--p-muted);
}

.demo__pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3fbf7f;
  box-shadow: 0 0 0 4px rgba(63, 191, 127, 0.16);
}

.demo__intro h1 {
  margin: 0 0 16px;
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: var(--display-tracking-xl);
  font-weight: var(--display-weight);
}

.demo__lead {
  max-width: 620px;
  margin: 0 auto;
  color: #a8afb9;
  font-size: 17px;
  line-height: 1.55;
}

.demo__lead code {
  font-family: var(--font-mono);
  font-size: 0.92em;
  color: var(--p-ink);
}

.demo__lead b {
  color: var(--p-ink);
  font-weight: 500;
}

/* Stage ------------------------------------------------------------------ */

.demo__stage {
  padding-inline: 24px;
}

.demo__frame {
  position: relative;
  max-width: 1180px;
  margin-inline: auto;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background: #0c1016;
  border-radius: 2px;
  overflow: hidden;
  height: auto;
  min-height: 0;
}

main.demo > :is(section.demo__intro, section.demo__stage) {
  height: auto;
  min-height: 0;
  padding: 0;
}

.demo__panes {
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  min-height: 468px;
}

.pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pane--term {
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}

.pane--card {
  background: #0e1218;
}

.pane__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.015);
}

.pane__bar--tabs {
  justify-content: space-between;
}

.pane__dots {
  display: inline-flex;
  gap: 5px;
}

.pane__dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
}

.pane__title {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #8d949e;
}

.pane__meta {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #6d737d;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tabs {
  display: inline-flex;
  gap: 2px;
}

.tab {
  padding: 5px 10px;
  border: 0;
  background: transparent;
  color: #7d838d;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  cursor: pointer;
  border-radius: 1px;
}

.tab.is-on {
  color: var(--p-ink);
  background: rgba(255, 255, 255, 0.07);
}

.tab:focus-visible {
  outline: 2px solid var(--p-accent);
  outline-offset: 2px;
}

/* Terminal ---------------------------------------------------------------- */

.term {
  flex: 1;
  padding: 18px 18px 22px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.85;
  color: #cbd2dc;
  overflow: hidden;
}

.term__ln {
  display: none;
  margin: 0;
  white-space: pre-wrap;
}

.term__ln.is-on {
  display: block;
  animation: dv-in 0.28s ease both;
}

.term__p,
.term__arrow {
  color: var(--p-accent);
}

.term__dim {
  color: #6d737d;
}

.term__ok {
  color: #3fbf7f;
}

.term__key.is-on {
  animation: dv-key 0.3s ease both;
}

.term__sum {
  margin-top: 6px !important;
  border-top: 1px dashed rgba(255, 255, 255, 0.09);
  padding-top: 8px;
}

.term__caret {
  display: inline-block;
  width: 7px;
  height: 14px;
  margin-left: 2px;
  vertical-align: -2px;
  background: #cbd2dc;
  animation: dv-blink 1.05s steps(1, end) infinite;
}

.term__spin {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--p-accent);
  border-radius: 50%;
  animation: dv-spin 0.9s linear infinite;
}

/* Approval surfaces ------------------------------------------------------- */

.surface {
  flex: 1;
  padding: 22px 20px 26px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.chat {
  width: 100%;
  max-width: 372px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.demo__frame.is-card .chat {
  opacity: 1;
  transform: none;
}

.chat__head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}

.chat__bot {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 3px;
  background: var(--p-accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
}

.chat__who {
  font-size: 12px;
  color: #b9c0ca;
}

.chat__who em {
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: #7d838d;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 2px;
  padding: 1px 4px;
  margin-left: 4px;
}

.chat__time {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #6d737d;
}

.chat__bubble {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  background: #141922;
  padding: 14px 15px 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
}

.chat__title {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.chat__proj {
  margin: 3px 0 12px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #98a0aa;
}

.chat__proj span {
  color: #6d737d;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 14px;
  margin: 0 0 14px;
}

.facts > div {
  min-width: 0;
}

.facts dt {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6d737d;
  margin-bottom: 2px;
}

.facts dd {
  margin: 0;
  font-size: 12px;
  color: #cbd2dc;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat__acts {
  display: flex;
  gap: 8px;
}

.btn-ok,
.btn-no {
  flex: 1;
  min-height: 34px;
  border-radius: 1px;
  font-family: var(--font-text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn-ok {
  background: var(--p-accent);
  color: #fff;
}

.btn-no {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.16);
  color: #cbd2dc;
}

.btn-ok:hover,
.btn-no:hover {
  transform: translateY(-1px);
}

.btn-ok:active,
.btn-no:active {
  transform: translateY(1px);
}

.btn-ok:focus-visible,
.btn-no:focus-visible {
  outline: 2px solid #8fc2f0;
  outline-offset: 2px;
}

.chat__expiry {
  margin: 10px 0 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #6d737d;
}

.chat__expiry b {
  color: #98a0aa;
  font-weight: 500;
}

.chat__result,
.panel__result {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 2px;
  padding: 10px 12px;
  border: 1px solid rgba(63, 191, 127, 0.3);
  background: rgba(63, 191, 127, 0.08);
  border-radius: 1px;
}

.chat__result b,
.panel__result b {
  display: block;
  font-size: 12.5px;
  color: #d8f5e6;
}

.chat__result span:not(.chat__check),
.panel__result span:not(.chat__check) {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #8fc7a9;
}

.chat__check {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #3fbf7f;
  color: #08130d;
  font-size: 11px;
  font-weight: 700;
  flex: none;
}

.chat__hint {
  margin: 12px 0 0;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #6d737d;
  text-align: center;
  transition: opacity 0.3s ease;
}

.demo__frame.is-resolved .chat__acts,
.demo__frame.is-resolved .chat__expiry,
.demo__frame.is-resolved .chat__hint {
  display: none;
}

.demo__frame.is-resolved .chat__result,
.demo__frame.is-resolved .panel__result {
  display: flex;
  animation: dv-in 0.35s ease both;
}

/* Console panel ----------------------------------------------------------- */

.panel {
  width: 100%;
  max-width: 396px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  background: #141922;
  padding: 14px 15px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.demo__frame.is-card .panel {
  opacity: 1;
  transform: none;
}

.panel__head {
  display: flex;
  align-items: center;
  gap: 9px;
}

.chip {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 1px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #cbd2dc;
}

.chip--pending {
  border-color: rgba(240, 180, 90, 0.4);
  background: rgba(240, 180, 90, 0.1);
  color: #f0b45a;
}

.demo__frame.is-resolved .chip--pending {
  border-color: rgba(63, 191, 127, 0.4);
  background: rgba(63, 191, 127, 0.1);
  color: #6fd8a5;
}

.panel__title {
  font-size: 12.5px;
  color: var(--p-ink);
}

.panel__clock {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #8d949e;
}

.panel__by {
  margin: 8px 0 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #6d737d;
}

.facts--panel {
  grid-template-columns: 1fr 1fr;
  padding: 10px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.panel__label {
  margin: 12px 0 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6d737d;
}

.keys {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 11.5px;
}

.keys li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  color: #b9c0ca;
}

.keys i {
  color: #6d737d;
  font-style: normal;
  letter-spacing: 0.12em;
}

.panel__acts {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel__acts .btn-ok,
.panel__acts .btn-no {
  flex: 0 0 auto;
  min-width: 84px;
  padding: 0 14px;
}

.panel__note {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #6d737d;
}

.demo__frame.is-resolved .panel__acts {
  display: none;
}

/* Rail and controls ------------------------------------------------------- */

.demo__bar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.015);
}

.rail {
  display: flex;
  align-items: center;
  gap: 22px;
  margin: 0;
  padding: 0;
  list-style: none;
  flex-wrap: wrap;
}

.rail li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: #626973;
  transition: color 0.25s ease;
}

.rail li span {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  font-size: 9.5px;
  transition: background 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.rail li.is-on {
  color: #dfe5ec;
}

.rail li.is-on span {
  background: var(--p-accent);
  border-color: var(--p-accent);
  color: #fff;
}

.rail li.is-done span {
  border-color: #3fbf7f;
  color: #3fbf7f;
}

.demo__ctrl {
  margin-left: auto;
  display: inline-flex;
  gap: 6px;
}

.ctrl {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 1px;
  background: transparent;
  color: #b9c0ca;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.ctrl:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ctrl:focus-visible {
  outline: 2px solid var(--p-accent);
  outline-offset: 2px;
}

/* Animation --------------------------------------------------------------- */

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

@keyframes dv-key {
  from {
    opacity: 0;
    transform: translateX(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes dv-blink {
  50% {
    opacity: 0;
  }
}

@keyframes dv-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 900px) {
  .demo {
    padding: 44px 0 64px;
  }

  .demo__panes {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .pane--term {
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  }

  .term {
    font-size: 11.5px;
    line-height: 1.75;
  }

  .demo__bar {
    flex-wrap: wrap;
    gap: 12px;
  }

  .demo__ctrl {
    margin-left: 0;
  }
}

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

  .panel__note {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat,
  .panel,
  .term__ln.is-on,
  .term__key.is-on,
  .chat__result,
  .panel__result {
    transition: none;
    animation: none;
  }

  .term__spin,
  .term__caret {
    animation: none;
  }
}

/* Resolved but denied ------------------------------------------------------ */

.surface[hidden] {
  display: none;
}

.demo__frame.is-denied .chat__result,
.demo__frame.is-denied .panel__result {
  border-color: rgba(224, 90, 90, 0.32);
  background: rgba(224, 90, 90, 0.08);
}

.demo__frame.is-denied .chat__check {
  background: #e05a5a;
  color: #1a0b0b;
}

.demo__frame.is-denied .chat__result b,
.demo__frame.is-denied .panel__result b {
  color: #f6d9d9;
}

.demo__frame.is-denied .chat__result span:not(.chat__check),
.demo__frame.is-denied .panel__result span:not(.chat__check) {
  color: #d9a3a3;
}

.demo__frame.is-denied .chip--pending {
  border-color: rgba(224, 90, 90, 0.4);
  background: rgba(224, 90, 90, 0.1);
  color: #e88a8a;
}
