/* Robodepo (working name) — consumer-facing agent page and approval page — MIT */

:root {
  color-scheme: light;

  --paper: #faf8f4;
  --paper-raised: #ffffff;
  --ink: #1c1a16;
  --ink-soft: #4c473d;
  --ink-faint: #7d7669;
  --border: #e5dfd2;
  --border-strong: #d2c9b6;
  --accent: #1f5f56;
  --accent-soft: #2d7d70;
  --accent-tint: #e9f1ef;
  --danger: #8a3324;

  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --content-width: 46rem;
  --content-width-wide: 52rem;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

main {
  margin: 0 auto;
  max-width: var(--content-width-wide);
  padding: 0 clamp(1.1rem, 4vw, 2rem) 5rem;
}

/* --------------------------------- Masthead -------------------------------- */

.masthead {
  border-bottom: 1px solid var(--border);
  padding: 1.5rem clamp(1.1rem, 4vw, 2rem);
}

.masthead > * {
  margin: 0 auto;
  max-width: var(--content-width-wide);
}

.wordmark {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tagline {
  margin-top: 0.25rem;
  color: var(--ink-faint);
  font-size: 0.88rem;
}

/* ------------------------------------ Hero ---------------------------------- */

.hero {
  max-width: var(--content-width);
  padding-top: clamp(2.25rem, 5vw, 3.5rem);
}

h1 {
  margin: 0;
  max-width: 20ch;
  font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.7rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
}

.hero-sub {
  margin: 1.15rem 0 0;
  max-width: 40rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

.status-pill {
  display: inline-flex;
  align-items: flex-start;
  gap: 0.6rem;
  max-width: 100%;
  margin: 1.65rem 0 0;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--paper-raised);
  padding: 0.55rem 1rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.5;
}

.status-pill::before {
  content: "";
  flex: none;
  margin-top: 0.4em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
}

.live-call {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.75rem 0 0;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
}

.live-call::before {
  content: "";
  flex: none;
  width: 0.4rem;
  height: 0.4rem;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: transparent;
}

.live-call.is-active {
  color: var(--ink);
  font-weight: 600;
}

.live-call.is-active::before {
  border-color: var(--accent);
  background: var(--accent);
}

.agent-note {
  max-width: 40rem;
  margin: 0.85rem 0 0;
  color: var(--ink-faint);
  font-size: 0.78rem;
  line-height: 1.55;
}

/* --------------------------------- Section rhythm ---------------------------- */

section {
  margin-top: 3.25rem;
}

section h2 {
  margin: 0 0 0.9rem;
  max-width: var(--content-width);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.capabilities,
.decision,
.why-it-works,
.roadmap,
.section-feedback {
  padding-top: 2.25rem;
  border-top: 1px solid var(--border);
}

.section-intro {
  max-width: var(--content-width);
  margin: 0 0 1.5rem;
  color: var(--ink-faint);
  font-size: 0.95rem;
  line-height: 1.55;
}

/* ------------------------------- Capability cards ---------------------------- */

.capability-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .capability-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.capability-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper-raised);
  padding: 1.25rem 1.35rem;
}

.capability-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.capability-card p {
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

.chip-row {
  margin-top: 0.85rem !important;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.capability-card .chip-row {
  margin-top: 0.6rem !important;
}

.chip {
  display: inline-block;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--accent-tint);
  padding: 0.2rem 0.5rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

/* --------------------------------- Handoff ---------------------------------- */

#handoff {
  max-width: var(--content-width);
  border: 2px solid var(--accent);
  border-radius: 10px;
  background: var(--paper-raised);
  padding: 1.5rem 1.6rem 1.75rem;
  box-shadow: 0 2px 14px rgba(31, 95, 86, 0.12);
}

#handoff[hidden] {
  display: none;
}

#handoff h2 {
  margin-top: 0.4rem;
}

dl.handoff {
  display: grid;
  margin: 1rem 0 0;
  grid-template-columns: max-content 1fr;
  gap: 0.55rem 1.5rem;
}

dl.handoff dt {
  color: var(--ink-faint);
  font-size: 0.85rem;
}

dl.handoff dd {
  margin: 0;
  font-size: 0.98rem;
  overflow-wrap: anywhere;
}

/* -------------------------------- Decision ------------------------------------ */

.decision {
  max-width: var(--content-width-wide);
}

.decision > p {
  max-width: var(--content-width);
  margin: 0 0 0.65rem;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.6;
}

.decision > p:last-of-type {
  margin-bottom: 0;
}

.approval-preview {
  margin: 1.75rem 0 0;
  max-width: 260px;
}

.approval-preview svg,
.approval-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.approval-preview figcaption {
  margin-top: 0.6rem;
  color: var(--ink-faint);
  font-size: 0.82rem;
  line-height: 1.5;
}

.approval-mock .am-card {
  fill: var(--paper-raised);
  stroke: var(--border-strong);
  stroke-width: 1.5;
}

.approval-mock .am-title {
  fill: var(--ink);
  font: 700 15px var(--font-body);
}

.approval-mock .am-rule {
  stroke: var(--border);
  stroke-width: 1;
}

.approval-mock .am-label {
  fill: var(--ink-faint);
  font: 600 10px var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.approval-mock .am-value {
  fill: var(--ink);
  font: 500 13px var(--font-body);
}

.approval-mock .am-total {
  font: 700 17px var(--font-body);
  fill: var(--accent);
}

.approval-mock .am-fp-ring,
.approve-fingerprint .am-fp-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.approval-mock .am-fp-line,
.approve-fingerprint .am-fp-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
}

.approval-mock .am-button {
  fill: var(--accent);
}

.approval-mock .am-button-label {
  fill: #ffffff;
  font: 600 12px var(--font-body);
  text-anchor: middle;
}

/* --------------------------- Approve and order pages -------------------------------- */

.approve-main,
.order-main {
  margin: 0 auto;
  max-width: 30rem;
  padding: 0 clamp(1.1rem, 4vw, 2rem) 4rem;
}

.approve-main .eyebrow,
.order-main .eyebrow {
  margin-top: clamp(2rem, 5vw, 3rem);
}

.approve-main h1,
.order-main h1 {
  margin: 0.75rem 0 0;
  max-width: none;
}

.approve-card,
.order-card {
  position: relative;
  margin-top: 1.75rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--paper-raised);
  padding: 1.6rem 1.6rem 1.75rem;
}

.handoff-total,
#handoff > dl.handoff dd:nth-of-type(3),
.order-confirmed > dl.handoff dd:nth-of-type(4) {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--accent);
}

.approve-fingerprint {
  display: block;
  width: 3.5rem;
  height: 3.5rem;
  margin: 1.5rem auto 0;
}

.approve-card form {
  margin-top: 1.5rem;
}

.approve-card button {
  width: 100%;
  margin-top: 0;
}

.approve-footer,
.order-footer {
  margin-top: 2rem;
  text-align: center;
}

.approve-footer a,
.order-footer a {
  font-size: 0.85rem;
}

.order-id {
  display: inline-block;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--accent-tint);
  padding: 0.15rem 0.5rem;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  overflow-wrap: anywhere;
}

.order-links {
  margin: 0;
}

.order-back-link {
  display: inline-block;
  margin-top: 1.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  padding: 0.65rem 1.25rem;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

.order-back-link:hover {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

/* --------------------------------- Why it works -------------------------------- */

.why-it-works p {
  max-width: var(--content-width);
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.65;
}

/* ------------------------------------ Roadmap ---------------------------------- */

.roadmap-intro {
  max-width: var(--content-width);
  margin: 0 0 1.5rem;
  color: var(--ink-faint);
  font-size: 0.95rem;
  line-height: 1.55;
}

.roadmap-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .roadmap-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.roadmap-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper-raised);
  padding: 1.25rem 1.35rem;
}

.roadmap-card .badge {
  position: absolute;
  top: 1.1rem;
  right: 1.1rem;
}

.roadmap-card h3 {
  margin: 0 3.25rem 0.5rem 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.roadmap-card p {
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.55;
}

.roadmap-card .chip-row {
  margin-top: 0.6rem !important;
}

/* --------------------------------- Buttons -------------------------------------- */

button {
  margin-top: 1.25rem;
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  padding: 0.75rem 1.25rem;
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms ease;
}

button:hover {
  background: var(--accent-soft);
}

.handoff-button {
  display: block;
  width: 100%;
  margin-top: 1.4rem;
  position: relative;
}

/*
 * Inert until the client script adds it: `renderHandoff`'s own
 * `approvalGestureAvailable()` callback already knows whether the biometric
 * label is showing (`public/agent/robodepo-webmcp.js`, the block that sets
 * `button.textContent = available ? APPROVE_GESTURE_LABEL : APPROVE_PLAIN_LABEL`);
 * a one-line `button.classList.toggle("has-fingerprint", available)` there
 * lights up this glyph exactly when the label does. Styled ahead of that
 * wiring so the CSS is ready the moment it lands.
 */
.handoff-button.has-fingerprint {
  padding-left: 2.75rem;
}

.handoff-button.has-fingerprint::before {
  content: "";
  position: absolute;
  left: 1.15rem;
  top: 50%;
  width: 1.15rem;
  height: 1.15rem;
  transform: translateY(-50%);
  background-repeat: no-repeat;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='white' stroke-width='1.6'/%3E%3Cpath d='M6 10q6-6 12 0' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M5 13q7-7 14 0' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M6.5 16q5.5-5.5 11 0' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'/%3E%3Cpath d='M8 18.5q4-4 8 0' fill='none' stroke='white' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
}

.handoff-status {
  margin: 0.85rem 0 0;
  min-height: 1.3em;
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.handoff-secondary {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
}

.handoff-secondary a {
  color: var(--ink-faint);
}

.handoff-secondary a:hover {
  color: var(--accent);
}

.order-confirmed {
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-tint);
  padding: 1.1rem 1.25rem 1.3rem;
}

.order-confirmed h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.order-confirmed h2::before {
  content: "\2713";
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--accent);
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 700;
}

.order-id-row {
  margin: 0.85rem 0 0;
}

/* The chip's own tint would vanish against the completed card's matching
   background, so it gets a plain paper backing here specifically. */
.order-confirmed .order-id {
  background: var(--paper-raised);
}

.order-link {
  margin: 1.25rem 0 0;
}

.order-link a {
  display: inline-block;
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 0.55rem 1.1rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.88rem;
  text-decoration: none;
}

.order-link a:hover {
  background: var(--accent);
  color: #ffffff;
}

/* ---------------------------------- Details -------------------------------------- */

details {
  max-width: var(--content-width-wide);
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper-raised);
}

details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 1.25rem;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.92rem;
  list-style: none;
  cursor: pointer;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::after {
  flex: none;
  color: var(--accent);
  content: "+";
  font-family: var(--font-mono);
  font-size: 1.1rem;
}

details[open] > summary::after {
  content: "\2212";
}

details > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.decision details.security-detail {
  margin-top: 1.5rem;
  max-width: var(--content-width);
}

.security-detail > #why-human-confirms {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--border);
  background: transparent;
  padding: 1.3rem 1.25rem 1.5rem;
}

.security-detail #why-human-confirms h2 {
  margin-top: 0;
  font-size: 1.05rem;
}

.tool-catalogue > ul.tools,
.activity-log > ol.activity {
  padding: 0.25rem 1.25rem 1.35rem;
}

/* ------------------------------------ Tools -------------------------------------- */

ul.tools {
  margin: 0;
  padding: 0;
  list-style: none;
}

ul.tools li {
  border-top: 1px solid var(--border);
  padding: 0.85rem 0;
}

ul.tools li:first-child {
  border-top: 0;
}

.tool-name {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.tool-divider {
  display: block;
  margin: 0 0 0.9rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border-strong);
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.badge {
  display: inline-block;
  margin-left: 0.6rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: middle;
  color: var(--ink-faint);
}

.badge.operational {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

.badge.preview {
  color: var(--ink-faint);
}

.badge.live {
  border-color: var(--accent);
  background: var(--accent-tint);
  color: var(--accent);
}

.tool-summary {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.tool-guide {
  margin: 0.65rem 0 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
}

.tool-guide > summary {
  padding: 0.5rem 0.75rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
}

.tool-guide > summary::after {
  font-size: 0.85rem;
}

.tool-guide h4 {
  margin: 0.9rem 0.9rem 0.3rem;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.tool-guide h4:first-of-type {
  margin-top: 0.85rem;
}

.tool-guide p {
  margin: 0 0.9rem 0.7rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.tool-guide pre.guide-example {
  margin: 0 0.9rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper-raised);
  padding: 0.75rem 0.9rem;
  overflow-x: auto;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.55;
  white-space: pre;
}

/* ------------------------------------- Feedback form ---------------------------------------- */

.feedback-form {
  max-width: var(--content-width);
}

.field {
  margin: 0 0 1rem;
}

.field label {
  display: block;
  margin: 0 0 0.4rem;
  color: var(--ink-soft);
  font-size: 0.85rem;
  font-weight: 600;
}

.field select,
.field textarea {
  display: block;
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--paper-raised);
  padding: 0.6rem 0.75rem;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
}

.field textarea {
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.5;
}

#feedback-submit {
  margin-top: 0.25rem;
}

.feedback-result {
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  line-height: 1.5;
}

.feedback-result:empty {
  margin: 0;
}

/* ------------------------------------- Notes ---------------------------------------- */

.note {
  margin: 1rem 0 0;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.lede {
  margin: 1.1rem 0 0;
  max-width: 42rem;
  color: var(--ink-soft);
  font-size: 1.05rem;
  line-height: 1.6;
}

/* ------------------------------------- Activity ------------------------------------- */

ol.activity {
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

ol.activity li {
  border-top: 1px solid var(--border);
  padding: 0.35rem 0;
  color: var(--ink-soft);
}

ol.activity li:first-child {
  border-top: 0;
}

/* -------------------------------------- Footer --------------------------------------- */

footer {
  max-width: var(--content-width-wide);
  margin-top: 3.5rem;
  border-top: 1px solid var(--border);
  padding-top: 1.35rem;
  color: var(--ink-faint);
  font-size: 0.85rem;
}

footer p {
  margin: 0 0 0.5rem;
}

footer p:last-child {
  margin-bottom: 0;
}

.dev-links {
  overflow-wrap: anywhere;
}

/* -------------------------------------- Generic --------------------------------------- */

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

h3 {
  margin: 1.5rem 0 0.5rem;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
}

h3:first-of-type {
  margin-top: 1rem;
}

section ul {
  margin: 0;
  max-width: var(--content-width);
  padding-left: 1.15rem;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

section ul li {
  margin-bottom: 0.4rem;
}

section ul.tools {
  max-width: none;
  padding-left: 0;
  font-size: inherit;
}

#approve-status {
  margin: 1rem 0 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-soft);
}

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

@media (max-width: 480px) {
  h1 {
    max-width: none;
  }

  .capability-card,
  .roadmap-card,
  #handoff {
    padding: 1.1rem 1.15rem 1.3rem;
  }

  .tool-name {
    display: block;
  }

  .badge {
    margin-left: 0;
    margin-top: 0.35rem;
    display: inline-block;
  }

  .roadmap-card .badge {
    margin-top: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
