/*
 * Demo-only styles. One centred column: a spend meter, the agent's feed, and
 * the full dashboard folded away underneath. styles.css is an untouched copy
 * of cli/assets/ui/styles.css, so everything the demo adds lives here.
 */

:root {
  --card: #111110;
  --card-border: rgba(255, 255, 255, 0.07);
  --z-top: 100;
}

/* --- top bar ------------------------------------------------------------- */

.top {
  position: sticky;
  top: 0;
  z-index: var(--z-top);
  display: flex;
  align-items: center;
  gap: 14px;
  height: 52px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.top-note {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
  font-size: 13px;
}

.top-links a,
.recap a {
  color: var(--fg);
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-underline-offset: 3px;
  transition: text-decoration-color 150ms ease-out;
}

.top-links a {
  padding: 10px 0;
}

.top-links a:hover,
.recap a:hover {
  text-decoration-color: var(--fg);
}

.top-links a:focus-visible,
.recap a:focus-visible,
.full summary:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
  border-radius: 4px;
}

.top .btn {
  height: 30px;
  border-radius: 999px;
}

/* --- the column ---------------------------------------------------------- */

.page {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: min(600px, 100% - 32px);
  margin: 0 auto;
  padding: 40px 0 96px;
}

/* --- what has been spent ------------------------------------------------- */

.meter {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.meter-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
}

.meter-spent {
  font: 600 28px/1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.meter-of {
  color: var(--muted);
  font-size: 14px;
}

.chain {
  margin-left: auto;
  font: 500 12px var(--mono);
}

.chain.ok {
  color: var(--approved);
}

.chain.broken {
  color: var(--denied);
}

.meter-track {
  height: 6px;
  border-radius: 999px;
  background: var(--border);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--fg);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 500ms var(--ease-out);
}

/* --- the feed ------------------------------------------------------------ */

.feed {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--card);
}

.story {
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 15px;
  line-height: 1.5;
}

.story p {
  margin: 0;
}

.entry {
  scroll-margin: 80px 0 24px;
  animation: entry-in 260ms var(--ease-out);
}

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

.mail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.045);
}

.mail-meta {
  color: var(--muted);
  font-size: 12.5px;
}

.mail-hidden {
  margin-top: 6px !important;
  color: var(--muted);
  font: 12px/1.5 var(--mono);
  overflow-wrap: anywhere;
}

/* One line per thing the agent does, with what Shotoku said about it. */
.call {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chip {
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  font: 600 12px var(--mono);
  white-space: nowrap;
}

.chip.approved {
  background: rgba(61, 220, 132, 0.12);
}

.chip.pending {
  background: rgba(245, 197, 66, 0.14);
}

.chip.denied {
  background: rgba(255, 92, 92, 0.13);
}

.tag {
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 11px;
}

.say,
.note,
.you,
.recap {
  text-wrap: pretty;
}

.say {
  color: var(--fg);
}

.note,
.recap {
  color: var(--muted);
  font-size: 14px;
}

.you {
  font-weight: 600;
}

.thinking {
  color: var(--muted);
  font: 16px/1 var(--mono);
  letter-spacing: 0.2em;
  animation: breathe 1200ms ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.25;
  }
  50% {
    opacity: 1;
  }
}

/* --- the decision -------------------------------------------------------- */

.ask {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
  padding: 18px;
  border: 1px solid rgba(245, 197, 66, 0.5);
  border-radius: 16px;
  background: rgba(245, 197, 66, 0.06);
}

.ask-amount {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.ask-why {
  color: var(--muted);
  font-size: 14px;
}

.ask-buttons {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.ask .btn {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  font-size: 15px;
}

/* Both answers carry the same weight: the page does not lean towards spending. */
.ask-approve {
  border-color: rgba(61, 220, 132, 0.55);
  color: var(--approved);
}

.ask-deny {
  border-color: rgba(255, 92, 92, 0.55);
  color: var(--denied);
}

@media (hover: hover) and (pointer: fine) {
  .ask-approve:hover:not(:disabled) {
    border-color: var(--approved);
    background: rgba(61, 220, 132, 0.12);
  }

  .ask-deny:hover:not(:disabled) {
    border-color: var(--denied);
    background: rgba(255, 92, 92, 0.12);
  }
}

/* --- what to do next ----------------------------------------------------- */

.story-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  scroll-margin: 80px 0 24px;
}

.story-actions:empty {
  display: none;
}

.story-btn,
.start-btn {
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 14px;
  animation: entry-in 260ms var(--ease-out);
}

.story-btn {
  border-color: var(--border-strong);
}

.start-btn {
  align-self: flex-start;
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
}

@media (hover: hover) and (pointer: fine) {
  .story-btn:hover:not(:disabled) {
    border-color: var(--fg);
    background: rgba(245, 245, 240, 0.08);
  }

  .start-btn:hover:not(:disabled) {
    background: #ffffff;
    border-color: #ffffff;
  }
}

.provenance {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  text-wrap: balance;
}

/* --- the full dashboard, folded away ------------------------------------- */

.full {
  /* Wider than the column: the tables need the room. */
  width: min(1180px, 100vw - 32px);
  align-self: center;
  margin-top: 12px;
}

.full summary {
  width: max-content;
  margin: 0 auto;
  padding: 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  list-style: none;
  transition:
    color 150ms ease-out,
    border-color 150ms ease-out;
}

.full summary::-webkit-details-marker {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .full summary:hover {
    border-color: var(--muted);
    color: var(--fg);
  }
}

.full[open] summary {
  margin-bottom: 20px;
}

.dash {
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: var(--card);
  overflow: hidden;
}

.dash .bar {
  border-bottom-color: var(--card-border);
}

.dash main {
  padding-top: 24px;
  padding-bottom: 32px;
}

/* --- the opening --------------------------------------------------------- */

.intro {
  width: min(440px, calc(100vw - 32px));
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background: #0e0e0e;
  color: var(--fg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 6px 20px rgba(0, 0, 0, 0.4),
    0 32px 80px rgba(0, 0, 0, 0.55);
}

.intro::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.intro[open] {
  animation: intro-in 260ms var(--ease-out);
}

@keyframes intro-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.intro h2 {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.intro p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  text-wrap: pretty;
}

.intro-actions {
  margin-top: 22px;
}

.intro-start {
  width: 100%;
  height: 46px;
  border-radius: 999px;
  background: var(--fg);
  border-color: var(--fg);
  color: var(--bg);
  font-size: 15px;
}

@media (hover: hover) and (pointer: fine) {
  .intro-start:hover:not(:disabled) {
    background: #ffffff;
    border-color: #ffffff;
  }
}

@media (max-width: 720px) {
  .top-note {
    display: none;
  }

  .page {
    padding-top: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .top-links a,
  .recap a,
  .full summary,
  .meter-fill {
    transition: none;
  }

  .entry,
  .story-btn,
  .start-btn,
  .thinking,
  .intro[open] {
    animation: none;
  }
}
