:root {
  --ink: #111210;
  --paper: #f3f0e9;
  --paper-soft: #d8d3c9;
  --muted: #a7a299;
  --accent: #ed7048;
  --accent-soft: #f5a98c;
  --line: rgba(243, 240, 233, 0.14);
  --line-strong: rgba(243, 240, 233, 0.24);
  --max: 1160px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  background:
    radial-gradient(circle at 78% 10%, rgba(237, 112, 72, 0.09), transparent 23rem),
    radial-gradient(circle at 5% 90%, rgba(243, 240, 233, 0.045), transparent 31rem),
    var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(255, 255, 255, .018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .018) 1px, transparent 1px);
  background-size: 38px 38px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.shell { width: min(calc(100% - 40px), var(--max)); margin: 0 auto; }

.nav {
  height: 86px;
  display: flex;
  align-items: center;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--paper);
  text-decoration: none;
  font-size: 1.22rem;
  font-weight: 690;
  letter-spacing: -0.04em;
}

.brand img { width: 27px; height: 27px; }
.brand-dot { color: var(--accent); }

.page-hero { padding: 92px 0 54px; }
.page-hero h1 {
  margin: 0;
  max-width: 900px;
  font-size: clamp(3rem, 6vw, 5.7rem);
  font-weight: 635;
  line-height: 0.92;
  letter-spacing: -0.072em;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  color: var(--accent-soft);
  font: 600 0.69rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.eyebrow::before { content: ""; width: 24px; height: 1px; background: var(--accent); }

.lede {
  max-width: 680px;
  margin: 30px 0 0;
  color: var(--paper-soft);
  font-size: clamp(1.05rem, 1.6vw, 1.25rem);
  line-height: 1.62;
  letter-spacing: -0.016em;
}

.flow-wrap {
  margin: 20px 0 88px;
  padding: clamp(24px, 5vw, 58px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 255, 255, .025);
}

.flow-stage {
  position: relative;
  display: grid;
  grid-template-columns: 1fr .9fr 1fr;
  gap: clamp(38px, 7vw, 84px);
  align-items: center;
  min-height: 370px;
}

.flow-line {
  position: absolute;
  left: 17%;
  right: 17%;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #54514b 10%, #54514b 90%, transparent);
}

.flow-line::after {
  content: "";
  position: absolute;
  inset: -2px 0;
  background: repeating-linear-gradient(90deg, transparent 0 12px, var(--ink) 12px 19px);
}

.flow-node { position: relative; z-index: 2; text-align: center; }
.flow-node-label { margin-top: 20px; color: var(--paper-soft); font-size: .86rem; }
.flow-node-label small {
  display: block;
  margin-top: 6px;
  color: #76736c;
  font: 500 .64rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.doc-visual, .page-visual {
  width: 180px;
  height: 205px;
  margin: auto;
  border: 1px solid var(--line-strong);
  border-radius: 17px;
  background: #1c1d1a;
  box-shadow: 0 23px 55px rgba(0, 0, 0, .28);
}

.doc-visual { padding: 22px; transform: rotate(-2deg); }
.mini-kicker {
  color: #8c8880;
  font: 600 .57rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.bar { height: 7px; margin-top: 11px; overflow: hidden; border-radius: 5px; background: #34342f; }
.bar i { display: block; height: 100%; border-radius: inherit; background: #555149; }
.doc-visual .bar:nth-child(3) i { width: 85%; }
.doc-visual .bar:nth-child(4) i { width: 62%; }
.doc-visual .bar:nth-child(5) i { width: 72%; }
.spark { display: grid; grid-template-columns: repeat(4, 1fr); align-items: end; gap: 7px; height: 54px; margin-top: 25px; }
.spark i { display: block; border-radius: 4px 4px 1px 1px; background: var(--accent); opacity: .65; }
.spark i:nth-child(1) { height: 34%; }
.spark i:nth-child(2) { height: 58%; }
.spark i:nth-child(3) { height: 46%; }
.spark i:nth-child(4) { height: 88%; }

.stend-visual { position: relative; width: 144px; height: 144px; margin: auto; }
.stend-open { position: absolute; inset: 0; width: 100%; height: 100%; }
.stend-open path { fill: none; stroke: var(--paper); stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.stend-open rect { fill: var(--accent); }
.stend-pulse {
  position: absolute;
  inset: -18px;
  border: 1px solid rgba(237, 112, 72, .28);
  border-radius: 42px;
  animation: pulse-ring 3s ease-out infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(.75); opacity: 0; }
  25% { opacity: 1; }
  75%, 100% { transform: scale(1.15); opacity: 0; }
}

.page-visual { padding: 13px; transform: rotate(2deg); }
.browser-top { display: flex; align-items: center; gap: 5px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.browser-top i { width: 5px; height: 5px; border-radius: 50%; background: #57544e; }
.browser-url { margin-left: 7px; color: #706d66; font: 500 .56rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.published { padding: 28px 6px 17px; }
.published-head { display: flex; align-items: center; gap: 9px; }
.closed-mark { position: relative; width: 30px; height: 30px; border: 4px solid var(--paper); border-radius: 9px; opacity: .95; }
.closed-mark::after { content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 2px; background: var(--accent); }
.published strong { font-size: .85rem; letter-spacing: -.02em; }
.published p { margin: 15px 0 0; color: #8b877f; font-size: .65rem; line-height: 1.5; }
.recipient { display: flex; align-items: center; justify-content: center; gap: 9px; margin-top: 22px; }
.recipient i { width: 27px; height: 27px; border: 1px solid #4d4a44; border-radius: 50%; background: #35352f; }
.recipient span { color: #77736c; font-size: .66rem; }

.journey-packet {
  position: absolute;
  z-index: 5;
  top: calc(50% - 7px);
  left: 16%;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--accent);
  box-shadow: 0 0 24px rgba(237, 112, 72, .7);
}

.flow-stage.is-playing .journey-packet { animation: journey 10s cubic-bezier(.55, .05, .28, 1) both; }
@keyframes journey {
  0%, 8% { left: 16%; opacity: 0; transform: scale(.5); }
  14% { opacity: 1; }
  39% { left: 49%; transform: scale(1); }
  52% { left: 49%; transform: scale(1.25) rotate(90deg); }
  72%, 90% { left: 83%; transform: scale(.72) rotate(90deg); opacity: 1; }
  100% { left: 83%; opacity: 0; }
}

.replay {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 28px auto 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: 600 .67rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.replay:hover { color: var(--paper); border-color: var(--line-strong); }
.properties { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 0 0 104px; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: var(--line); }
.property { padding: 31px; background: var(--ink); }
.property .num { color: var(--accent); font: 600 .66rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.property h2 { margin: 17px 0 10px; font-size: 1.12rem; letter-spacing: -.025em; }
.property p { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.6; }
.next-sentence { max-width: 46rem; margin: 0 0 88px; }
.next-sentence p { margin: 0; color: var(--paper-soft); font-size: 1.08rem; line-height: 1.7; }
.next-sentence a { color: var(--paper); text-decoration-color: rgba(237, 112, 72, .7); text-underline-offset: 5px; }
.next-sentence a:hover { color: var(--accent-soft); text-decoration-color: var(--accent); }

.setup-layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 56px; align-items: start; margin: 24px 0 95px; }
.agent-tabs { position: sticky; top: 22px; display: flex; flex-direction: column; gap: 7px; }
.agent-tab {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 17px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: 600 .83rem/1.2 inherit;
  text-align: left;
}

.agent-tab::after { content: "→"; color: #5e5b55; opacity: 0; transform: translateX(-5px); transition: all 160ms ease; }
.agent-tab:hover { color: var(--paper); background: rgba(255, 255, 255, .025); }
.agent-tab[aria-selected="true"] { color: var(--paper); border-color: var(--line); background: rgba(255, 255, 255, .045); }
.agent-tab[aria-selected="true"]::after { opacity: 1; transform: none; color: var(--accent); }
.tab-note { margin: 18px 16px 0; color: #6f6c65; font-size: .72rem; line-height: 1.55; }
.setup-panel { min-height: 600px; }
.setup-panel[hidden] { display: none; }
.setup-panel + .setup-panel { margin-top: 70px; }
.tabs-enhanced .setup-panel + .setup-panel { margin-top: 0; }
.setup-panel h2 { margin: 0 0 9px; font-size: 1.75rem; letter-spacing: -.04em; }
.setup-intro { margin: 0 0 30px; color: var(--muted); font-size: .9rem; line-height: 1.6; }
.steps { counter-reset: step; display: flex; flex-direction: column; }
.step { position: relative; counter-increment: step; padding: 0 0 32px 54px; }
.step:not(:last-child)::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 0; width: 1px; background: var(--line); }
.step::after { content: counter(step); position: absolute; left: 0; top: -4px; width: 33px; height: 33px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--accent-soft); background: var(--ink); font: 600 .65rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.step h3 { margin: 0 0 8px; font-size: .95rem; letter-spacing: -.015em; }
.step p { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.58; }
.step code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.code-block { position: relative; margin-top: 14px; padding: 16px 48px 16px 17px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; color: #d9d5cc; background: #0b0c0a; font: 500 .72rem/1.65 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; }
.copy { position: absolute; right: 8px; top: 8px; padding: 6px 8px; border: 0; border-radius: 7px; color: #807c74; background: #1d1e1a; cursor: pointer; font: 600 .57rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.copy:hover { color: var(--paper); }
.ask-card { margin-top: 2px; padding: 23px 24px; border: 1px solid rgba(237, 112, 72, .29); border-radius: 16px; background: rgba(237, 112, 72, .065); }
.ask-card span { display: block; margin-bottom: 9px; color: var(--accent-soft); font: 600 .6rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; text-transform: uppercase; }
.ask-card p { margin: 0; color: var(--paper); font-size: 1.05rem; line-height: 1.5; letter-spacing: -.015em; }

.footer { display: flex; justify-content: space-between; align-items: center; min-height: 100px; border-top: 1px solid var(--line); color: #6e6a64; font-size: .72rem; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--paper); }

@media (max-width: 900px) {
  .setup-layout { grid-template-columns: 1fr; gap: 34px; }
  .agent-tabs { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 5px; }
  .agent-tab { width: auto; min-width: max-content; }
  .agent-tab::after, .tab-note { display: none; }
  .flow-stage { gap: 20px; }
}

@media (max-width: 660px) {
  .shell { width: min(calc(100% - 28px), var(--max)); }
  .nav { height: 72px; }
  .page-hero { padding: 66px 0 42px; }
  .page-hero h1 { font-size: clamp(2.75rem, 14vw, 4.4rem); }
  .flow-wrap { padding: 34px 18px; }
  .flow-stage { grid-template-columns: 1fr; min-height: 790px; }
  .flow-line { left: 50%; right: auto; top: 15%; bottom: 15%; width: 1px; height: auto; }
  .journey-packet { top: 14%; left: calc(50% - 7px); }
  .flow-stage.is-playing .journey-packet { animation: journey-mobile 10s cubic-bezier(.55, .05, .28, 1) both; }
  @keyframes journey-mobile {
    0%, 8% { top: 14%; opacity: 0; }
    14% { opacity: 1; }
    42% { top: 49%; }
    72%, 90% { top: 84%; opacity: 1; }
    100% { top: 84%; opacity: 0; }
  }
  .doc-visual, .page-visual { width: 160px; height: 180px; }
  .stend-visual { width: 118px; height: 118px; }
  .properties { grid-template-columns: 1fr; }
  .footer { align-items: flex-start; flex-direction: column; justify-content: center; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .journey-packet { left: 83%; opacity: 1; }
}
