/* Homepage: one lobby, two readers. A single column with a wide three-lane demo,
   and a Human / Agent switch that shows the page the way an agent reads it.
   Tokens, header and footer are in site.css. Ported from design-directions/front-desk. */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0E1016; --card: #171A24; --sunk: #12151D; --ink: #E9EBF2; --muted: #99A0B5;
    --line: #282C3A; --accent: #8E9CFF; --accent-ink: #0B1030; --ok: #4CC98A;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0E1016; --card: #171A24; --sunk: #12151D; --ink: #E9EBF2; --muted: #99A0B5;
  --line: #282C3A; --accent: #8E9CFF; --accent-ink: #0B1030; --ok: #4CC98A;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; text-wrap: balance; margin: 0; }
p, ul, dl, pre { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
code, pre { font-family: var(--font-mono); }

/* Page rhythm */
.front { display: flex; flex-direction: column; gap: clamp(72px, 10vw, 136px); padding-bottom: 96px; }

/* Hero */
.hero { padding-top: clamp(48px, 9vw, 112px); display: grid; gap: 28px; }
.hero h1 {
  font-size: var(--step-3); line-height: 0.95; letter-spacing: -0.035em; font-weight: 750;
  font-variation-settings: "opsz" 96; max-width: 13ch;
}
.eyebrow { font-family: var(--font-mono); font-size: 0.875rem; letter-spacing: 0.02em; color: var(--muted); }
.eyebrow .desk-word { color: var(--accent); }
.hero-actions .text-link { font-size: var(--step-0); }
.lede { font-size: var(--step-1); max-width: 40ch; color: var(--ink); }
.lede span { color: var(--muted); }
.note { font-size: var(--step--1); color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 18px; }
.mcp { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; max-width: 100%; padding: 6px 6px 6px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.mcp-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); white-space: nowrap; }
.mcp code { font-size: 0.9375rem; overflow-wrap: anywhere; min-width: 0; }
.copy { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 6px 12px; font-size: var(--step--1); font-weight: 500; }
.copy:hover { border-color: var(--ink); }
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 11px 18px; border-radius: 12px; background: var(--ink); color: var(--paper); text-decoration: none; font-weight: 600; border: 0; }
.btn:hover { background: var(--accent); color: var(--accent-ink); }
.link-btn { border: 0; background: none; padding: 4px 0; font-family: var(--font-mono); font-size: 0.875rem; color: var(--accent); text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.meta { font-size: var(--step--1); color: var(--muted); }
.promise { max-width: 64ch; color: var(--muted); }
.promise strong { color: var(--ink); font-weight: 600; }
.promise a { color: var(--ink); text-underline-offset: 3px; white-space: nowrap; }
/* Two sides, one headline. The radios switch the headline and the panel under it.
   Without :has(), both sides show, one after the other. */
/* Tabs with an underline, so they never look like the Human / Agent pill in the header. */
.side-switch { display: flex; flex-wrap: wrap; gap: 4px 28px; min-width: 0; margin: 0; padding: 0; border: 0; border-bottom: 1px solid var(--line); }
.side-switch-legend { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.side-switch input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.side-switch label { margin-bottom: -1px; padding: 6px 0 10px; border-bottom: 2px solid transparent; font-size: var(--step-0); font-weight: 600; color: var(--muted); cursor: pointer; }
.side-switch label:hover { color: var(--ink); }
.side-switch input:checked + label { color: var(--ink); border-bottom-color: var(--accent); }
.side-switch input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 2px; }
.hero h1 > span { display: block; }
.hero:has(#side-business:checked) .for-agent,
.hero:has(#side-agent:checked) .for-business { display: none; }
.side-panel { display: grid; gap: 28px; }
.side-how, .side-now { font-size: var(--step--1); color: var(--muted); max-width: 64ch; }
.side-how a { color: var(--ink); text-underline-offset: 3px; }
.side-prompt { max-width: 720px; font-size: var(--step--1); }
.side-prompt summary { cursor: pointer; color: var(--muted); }
.side-prompt summary:hover { color: var(--ink); }
.side-prompt .prompt-text { margin-top: 10px; padding: 12px 16px; border: 1px dashed var(--line); border-radius: 12px; background: var(--card); }
.side-now a { color: var(--ink); }
/* Live light: green when /health answered ok on this page load */
.live { display: inline-flex; align-items: center; gap: 7px; margin-right: 12px; padding: 2px 10px 2px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 500; }
.live[hidden] { display: none; }
.live-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--muted); }
.live[data-state="up"] .live-dot { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: live-pulse 2.4s ease-out infinite; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 7px transparent; } }
@media (prefers-reduced-motion: reduce) { .live[data-state="up"] .live-dot { animation: none; } }
/* Copy-paste instructions for an assistant or an agent */
.copy-quiet { background: none; }
.prompt { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; justify-self: stretch; max-width: 720px; padding: 12px 12px 12px 16px; border: 1px dashed var(--line); border-radius: 12px; background: var(--card); }
.prompt-label { grid-column: 1 / -1; font-size: var(--step--1); color: var(--muted); }
.prompt-text { font-family: var(--font-mono); font-size: 0.875rem; overflow-wrap: anywhere; }

/* Demo */
.desk-section { display: grid; gap: 14px; margin-top: calc(-1 * clamp(24px, 5vw, 72px)); }
.desk { border: 1px solid var(--line); border-radius: 18px; background: var(--card); overflow: hidden; }
.desk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.desk-title { font-family: var(--font-body); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.desk-step { font-size: var(--step--1); font-weight: 500; min-width: 0; }
.desk-controls { display: flex; gap: 8px; margin-left: auto; }
.desk-controls button { border: 1px solid var(--line); background: var(--paper); border-radius: 8px; padding: 4px 10px; font-size: 0.8125rem; }
/* On a narrow screen the caption gets its own row, so a longer caption does not move the buttons. */
@media (max-width: 700px) {
  .desk-step { order: 3; flex-basis: 100%; }
}
.lanes { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr) minmax(0, 1.1fr); }
.lane { position: relative; min-width: 0; padding: 18px 18px 22px; display: flex; flex-direction: column; gap: 12px; background: var(--sunk); transition: background-color 300ms ease; }
.lane + .lane { border-left: 1px solid var(--line); }
.lane::before { content: ""; position: absolute; inset: 0 0 auto; height: 3px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 400ms ease; }
.lane.active { background: var(--card); }
.lane.active::before { transform: scaleX(1); }
.lane-head { display: flex; align-items: center; gap: 8px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.lane-head .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background-color 300ms ease; }
.lane.active .lane-head { color: var(--ink); }
.lane.active .lane-head .dot { background: var(--accent); }
@media (max-width: 900px) {
  .lanes { grid-template-columns: minmax(0, 1fr); }
  .lane + .lane { border-left: 0; border-top: 1px solid var(--line); }
}

/* Steps appear as the demo plays. Without script, everything shows. */
.desk.playing [data-step] { transition: opacity 320ms ease, transform 320ms ease, max-height 400ms ease; }
.desk.playing [data-step]:not(.on) { opacity: 0; transform: translateY(6px); }
@media (prefers-reduced-motion: reduce) {
  .desk.playing [data-step], .lane, .lane::before { transition: none; }
  .desk.playing [data-step]:not(.on) { transform: none; }
}

/* Lane 1: the agent */
.chat { display: flex; flex-direction: column; gap: 10px; font-size: 0.9375rem; }
.bubble { align-self: flex-end; max-width: 92%; background: var(--ink); color: var(--paper); padding: 10px 13px; border-radius: 14px 14px 4px 14px; }
.tool { display: grid; gap: 2px; padding: 8px 10px; border: 1px dashed var(--line); border-radius: 10px; font-family: var(--font-mono); font-size: 0.78rem; background: var(--card); }
.tool .fn { color: var(--accent); font-weight: 600; }
.tool .args { color: var(--muted); }
.tool .res { color: var(--ink); }
.tool .res::before { content: "→ "; color: var(--muted); }
.say { padding-inline: 2px; }
.say.final { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ok); background: color-mix(in srgb, var(--ok) 8%, var(--card)); }

/* Lane 2: the front desk and its visitor badge */
.badge { border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); overflow: hidden; box-shadow: 0 1px 0 var(--line), 0 12px 28px -18px color-mix(in srgb, var(--ink) 45%, transparent); }
.badge-top { position: relative; display: flex; justify-content: space-between; align-items: flex-end; padding: 18px 14px 8px; background: var(--accent); color: var(--accent-ink); font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; }
.badge-top .slot { position: absolute; top: 7px; left: 50%; width: 30px; height: 6px; border-radius: 4px; background: var(--card); transform: translateX(-50%); }
.badge-id { font-family: var(--font-mono); letter-spacing: 0; text-transform: none; opacity: 0.85; }
.badge-body { padding: 12px 14px 12px; display: grid; gap: 10px; }
.badge-name { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; line-height: 1.15; letter-spacing: -0.01em; }
.badge-via { margin-top: -6px; color: var(--muted); font-size: var(--step--1); }
.checks { list-style: none; padding: 0; display: grid; gap: 8px; font-size: 0.84rem; line-height: 1.4; }
.checks li { display: grid; grid-template-columns: 16px 1fr; gap: 8px; align-items: start; }
.checks strong { display: block; font-weight: 600; }
.checks span { color: var(--muted); }
.tick { color: var(--ok); margin-top: 2px; }
.tick path { stroke: var(--card); }
.route { font-family: var(--font-mono); font-size: 0.8rem; color: var(--accent); }
.route.back { color: var(--ok); }

/* Lane 3: the shop's ordinary inbox */
.email { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-size: 0.84rem; }
.email-subj { font-weight: 600; font-size: 0.92rem; }
.email-from { color: var(--muted); }
.email-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; }
.email-facts dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.email-facts dd { margin: 0; font-weight: 500; }
.email-note { color: var(--muted); font-size: 0.78rem; }
.reply { display: grid; gap: 6px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ink); background: var(--card); font-size: 0.875rem; }
.reply-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.reply-rest { visibility: hidden; }
.reply.typing .reply-typed::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 1px; background: var(--ink); vertical-align: -2px; }
.sent { justify-self: end; font-size: 0.78rem; font-weight: 600; color: var(--ok); }
.desk-caption { font-size: var(--step--1); color: var(--muted); max-width: 70ch; }
/* Three plain steps above the illustration, so the page reads before the demo plays */
.desk-steps { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 24px; }
.desk-steps li { display: flex; gap: 10px; align-items: baseline; min-width: 0; }
.desk-steps-n { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600; }
@media (max-width: 760px) { .desk-steps { grid-template-columns: minmax(0, 1fr); } }

/* Business owners first, with free help */
.owners { display: grid; gap: 28px; justify-items: start; }
.owners > h2 { font-size: var(--step-2); letter-spacing: -0.02em; }
.owners .lede { max-width: 52ch; }
.owners .side-actions { margin-top: 0; }
.help { justify-self: stretch; display: grid; gap: 16px; padding: clamp(20px, 3vw, 32px); border-top: 2px solid var(--accent); background: var(--card); border-radius: 0 0 var(--radius) var(--radius); }
.help h3 { font-size: 1.375rem; letter-spacing: -0.01em; }
.help-list { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 32px; }
.help-list li { display: grid; gap: 2px; min-width: 0; }
.help-list a { font-weight: 600; text-underline-offset: 3px; }
.help-list span { color: var(--muted); font-size: var(--step--1); overflow-wrap: anywhere; }
@media (max-width: 760px) { .help-list { grid-template-columns: minmax(0, 1fr); } }

/* Behind the desk */
.behind { display: grid; gap: 28px; justify-items: start; }
.behind > h2 { font-size: var(--step-2); letter-spacing: -0.02em; }
.features { justify-self: stretch; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--ink); }
.feature { display: grid; gap: 10px; align-content: start; padding: 20px 22px 0 0; min-width: 0; }
.feature + .feature { padding-left: 22px; border-left: 1px solid var(--line); }
.feature h3 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -0.01em; }
.feature p { color: var(--muted); }
.tag-next { justify-self: start; padding: 2px 9px; border: 1px solid var(--accent); border-radius: 999px; color: var(--accent); font-family: var(--font-mono); font-size: 0.72rem; }
@media (max-width: 960px) {
  .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .feature:nth-child(odd) { padding-left: 0; border-left: 0; }
  .feature:nth-child(n+3) { margin-top: 20px; border-top: 1px solid var(--line); }
}
@media (max-width: 560px) {
  .features { grid-template-columns: minmax(0, 1fr); }
  .feature + .feature { padding-left: 0; border-left: 0; margin-top: 20px; border-top: 1px solid var(--line); }
}

/* One standard: the same five tools at every business's address */
.standard { display: grid; gap: 28px; }
.standard > h2 { font-size: var(--step-2); letter-spacing: -0.02em; }
.standard .lede { max-width: 58ch; }
.standard-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 28px 48px; align-items: start; }
.standard-text { display: grid; gap: 24px; align-content: start; }
.endpoint { display: grid; align-content: start; gap: 6px; min-width: 0; padding: 18px 18px 6px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.endpoint h3 { font-size: 1.25rem; line-height: 1.2; letter-spacing: -0.01em; }
.endpoint-kind { font-size: var(--step--1); color: var(--muted); }
.endpoint-path { justify-self: start; max-width: 100%; margin-top: 4px; padding: 3px 8px; border-radius: 6px; background: var(--sunk); font-size: 0.78rem; overflow-wrap: anywhere; }
.endpoint-tools { list-style: none; padding: 0; margin-top: 10px; display: grid; }
.endpoint-tools li { display: grid; gap: 1px; min-width: 0; padding: 9px 0; border-top: 1px dashed var(--line); }
.endpoint-tools code { color: var(--accent); font-weight: 600; font-size: 0.84rem; overflow-wrap: anywhere; }
.endpoint-tools span { color: var(--muted); font-size: var(--step--1); }
.standard-now code { color: var(--ink); font-size: 0.9em; }
.standard-foot { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 18px; font-size: var(--step--1); color: var(--muted); }
.standard-foot p { max-width: 70ch; }
@media (max-width: 900px) {
  .standard-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .standard .standard-now { display: block; }
  .standard .standard-now strong { display: block; margin-bottom: 2px; }
}

/* Status lines and links shared by the sections */
.side-status { display: flex; gap: 8px; align-items: baseline; font-size: var(--step--1); color: var(--muted); }
.side-status strong { color: var(--ink); font-weight: 600; white-space: nowrap; }
.side-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: auto; }
.text-link { font-size: var(--step--1); color: var(--muted); text-underline-offset: 3px; }
.text-link:hover { color: var(--ink); }

/* What we do with data */
.data { display: grid; gap: 28px; justify-items: start; }
.data > h2 { font-size: var(--step-2); letter-spacing: -0.02em; }
.data .lede { max-width: 52ch; }
.data-grid { justify-self: stretch; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px 28px; }
.data-grid > .data-item { display: grid; gap: 8px; align-content: start; padding-top: 14px; border-top: 2px solid var(--accent); min-width: 0; }
.data-item h3 { font-size: 1.125rem; letter-spacing: -0.01em; }
.data-item p { color: var(--muted); overflow-wrap: anywhere; }
.data-item code { font-size: 0.85em; color: var(--ink); }
@media (max-width: 960px) { .data-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .data-grid { grid-template-columns: minmax(0, 1fr); } }

/* Letter */
.letter { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 24px 56px; }
.letter h2 { font-size: var(--step-2); letter-spacing: -0.02em; }
.letter-body { display: grid; gap: 16px; font-size: var(--step-1); max-width: 60ch; }
.sign { display: grid; gap: 2px; margin-top: 8px; font-family: var(--font-display); font-weight: 700; font-size: 1.25rem; }
.sign span { font-family: var(--font-mono); font-weight: 400; font-size: 0.875rem; color: var(--muted); user-select: all; }
@media (max-width: 860px) { .letter { grid-template-columns: 1fr; } }

/* The agent's version of the page */
.wipe { position: fixed; inset: 0; z-index: 40; background: var(--term-bg); pointer-events: none; }
body.agent { background: var(--term-bg); color: var(--term-fg); color-scheme: dark; }
body.agent .top { background: color-mix(in srgb, var(--term-bg) 92%, transparent); border-bottom-color: color-mix(in srgb, var(--term-fg) 18%, transparent); }
body.agent .top .nav, body.agent .top .menu { visibility: hidden; }
body.agent .top .brand { color: var(--term-fg); font-family: var(--font-mono); font-weight: 500; font-size: 0.95rem; }
body.agent .top .mark { background: var(--term-hi); }
body.agent .top .mark::before { background: var(--term-bg); }
body.agent .top .switch { background: transparent; border-color: color-mix(in srgb, var(--term-fg) 25%, transparent); }
body.agent .top .switch button { color: var(--term-dim); }
body.agent .top .switch button[aria-pressed="true"] { background: var(--term-hi); color: var(--term-bg); }
body.agent :focus-visible { outline-color: var(--term-hi); }
.agent-page { padding-block: clamp(32px, 6vw, 72px) 96px; font-family: var(--font-mono); font-size: 0.9375rem; line-height: 1.65; }
.agent-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding-bottom: 18px; margin-bottom: 26px; border-bottom: 1px dashed color-mix(in srgb, var(--term-fg) 22%, transparent); }
.agent-bar code { color: var(--term-dim); font-size: 0.8125rem; overflow-wrap: anywhere; min-width: 0; }
.agent-bar code b { color: var(--term-fg); font-weight: 500; }
.agent-bar .copy-md { margin-left: auto; border: 1px solid color-mix(in srgb, var(--term-fg) 30%, transparent); background: transparent; color: var(--term-fg); border-radius: 8px; padding: 6px 12px; font-family: var(--font-mono); font-size: 0.8125rem; }
.agent-bar .copy-md:hover { border-color: var(--term-hi); color: var(--term-hi); }
.md { max-width: 78ch; }
.md p { overflow-wrap: anywhere; }
.md .mk { color: var(--term-dim); }
.md-h1 { font-size: 1.6rem; font-weight: 600; color: #FFFFFF; line-height: 1.3; }
.md-h2 { margin-top: 6px; font-weight: 600; color: var(--term-hi); }
.md-q { color: var(--term-fg); font-size: 1.05rem; }
.md-li { padding-left: 2ch; text-indent: -2ch; }
.md code { color: var(--term-hi); }
.md-gap { height: 0.9em; }
.md .cursor { display: inline-block; width: 0.6em; height: 1.1em; margin-left: 4px; vertical-align: -3px; background: var(--term-hi); animation: blink 1.05s steps(1) infinite; }
.md.reveal p { animation: line-in 240ms ease both; animation-delay: calc(var(--i, 0) * 36ms); }
@keyframes line-in { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .md.reveal p { animation: none; }
  .md .cursor { animation: none; }
}
