/* AgentDisplay — site chrome.
 *
 * Everything that isn't the display itself: nav, hero, the instructions block,
 * the copy-paste snippets, the spec page. Loads AFTER css/display.css, which
 * owns the design tokens.
 */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background: var(--ad-bg);
    color: var(--ad-text-2);
    font-family: var(--ad-font);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* Film grain over the whole page. Fixed, non-interactive, and the one ambient
 * effect that survives — it costs nothing and it is what makes a screenshot
 * look like a product rather than a bootstrap page. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 9999;
}

a { color: var(--ad-running); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Nav ─────────────────────────────────────────────────────────────────── */
.nav {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: 56px;
    padding: 0 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(6, 6, 12, 0.86);
    backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--ad-border-soft);
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-shrink: 0;
    color: inherit;
}
.nav-logo:hover { text-decoration: none; }
.nav-logo svg { width: 26px; height: 26px; display: block; }
.nav-logo span {
    font-family: var(--ad-head);
    font-weight: 700;
    font-size: 17px;
    color: var(--ad-running);
}

.nav-url {
    font-family: var(--ad-mono);
    font-size: 11px;
    color: var(--ad-dim);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-shrink: 0;
}

.nav-right a {
    font-size: 13.5px;
    color: var(--ad-dim);
    font-weight: 500;
}
.nav-right a:hover { color: var(--ad-text); text-decoration: none; }

/* Connection state. Not a status value — this is the socket, not the agent,
 * and conflating the two is how a display ends up claiming an agent is fine
 * when the page simply lost its connection. */
.nav-live {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--ad-mono);
    font-size: 10px;
    color: var(--ad-dim);
    flex-shrink: 0;
}

.nav-live-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--ad-complete);
    animation: ad-pulse 2s ease-in-out infinite;
}
.nav-live[data-state="down"] .nav-live-dot { background: var(--ad-error); animation: none; }
.nav-live[data-state="connecting"] .nav-live-dot { background: var(--ad-waiting); }

/* ── Display bar ─────────────────────────────────────────────────────────────
 * The display page's own chrome: brand, the agent's name, and the views. Slim
 * and monospaced on purpose — it is a status line, not navigation, and it
 * should read as part of the instrument rather than as a website header. */
.bar {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 100;
    height: 44px;
    padding: 0 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #08080f;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* The cyan hairline. It is what makes the bar read as an instrument panel
   rather than a plain dark strip, and it costs one pseudo-element. */
.bar::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 1px;
    background: linear-gradient(90deg,
        var(--ad-running) 0%,
        color-mix(in srgb, var(--ad-running) 35%, transparent) 42%,
        transparent 78%);
}

.bar-brand {
    display: flex;
    align-items: center;
    gap: 9px;
    color: inherit;
    flex-shrink: 0;
}
.bar-brand:hover { text-decoration: none; }

/* Connection lamp. Not a status value — this is the socket, not the agent, and
   conflating the two would have a display claim an agent is fine when the page
   merely lost its connection. */
.bar-lamp {
    width: 9px;
    height: 9px;
    border-radius: 2px;
    background: var(--ad-running);
    flex-shrink: 0;
    animation: ad-pulse 2.4s ease-in-out infinite;
}
.bar-lamp[data-state="down"] { background: var(--ad-error); animation: none; }
.bar-lamp[data-state="connecting"] { background: var(--ad-waiting); }

.bar-name {
    font-family: var(--ad-mono);
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ad-text);
    letter-spacing: -0.01em;
}

.bar-sep {
    color: rgba(255, 255, 255, 0.16);
    font-size: 12px;
    flex-shrink: 0;
}

.bar-agent {
    font-family: var(--ad-mono);
    font-size: 12.5px;
    color: var(--ad-dim);
    /* Lowercased for the house look only — the real name is untouched in the
       data and on the card. */
    text-transform: lowercase;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* "14 messages · updated 39m ago", beside the name. Quieter than the name and
   set apart from it, so the bar reads as one identity line rather than two
   competing labels. */
.bar-meta {
    font-family: var(--ad-mono);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.28);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.08);
}
.bar-meta:empty { display: none; }
.bar-meta .ad-msg-ago { color: rgba(255, 255, 255, 0.4); opacity: 1; }

.bar-tabs {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.bar-tab {
    font-family: var(--ad-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.32);
    padding: 5px 11px;
    border: 1px solid transparent;
    border-radius: 5px;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.bar-tab:hover {
    color: var(--ad-text-2);
    text-decoration: none;
}

.bar-tab.is-active {
    color: var(--ad-text);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.12);
}

@media (max-width: 760px) {
    /* The meta goes first — the agent's name is identity and has to survive. */
    .bar-meta { display: none; }
}

@media (max-width: 560px) {
    .bar { padding: 0 12px; gap: 8px; }
    .bar-sep, .bar-agent { display: none; }
    .bar-tab { padding: 5px 8px; letter-spacing: 0.1em; }
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-family: var(--ad-head);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--ad-running); color: #04070a; }
.btn-primary:hover { background: #7dd8ff; }

.btn-ghost {
    background: transparent;
    border-color: var(--ad-border);
    color: var(--ad-text-2);
}
.btn-ghost:hover { border-color: rgba(79, 195, 247, 0.4); color: var(--ad-text); }

.btn-amber { background: #f59e0b; color: #140d00; }
.btn-amber:hover { background: #fbbf24; }

.btn-sm { padding: 7px 14px; font-size: 12.5px; }

/* ── Page shells ─────────────────────────────────────────────────────────── */
.page { max-width: 860px; margin: 0 auto; padding: 88px 24px 64px; }
.page--wide { max-width: 980px; }

.hero {
    min-height: 82vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 110px 24px 56px;
}

.hero-icon { margin-bottom: 22px; }

/* The hero line is the promise, verbatim from the brief. It is the sentence
 * the whole site has to earn, so nothing shares its size. */
.hero h1 {
    font-family: var(--ad-head);
    font-size: clamp(32px, 6vw, 58px);
    font-weight: 700;
    color: #fff;
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
    max-width: 16ch;
}

.hero-sub {
    font-size: clamp(15px, 2.2vw, 18px);
    color: var(--ad-dim);
    max-width: 46ch;
    margin-bottom: 34px;
}

/* Reassurance, not a feature list — sized to be read after the headline and
   before the box, then never thought about again. */
.hero-works {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 7px;
    font-size: 12.5px;
    color: var(--ad-dim);
    margin: -18px 0 30px;
    max-width: 620px;
}

.hero-works span {
    font-family: var(--ad-mono);
    font-size: 11px;
    color: var(--ad-text-2);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    padding: 2px 8px;
}

.hero.is-compact .hero-works { display: none; }

.url-row {
    display: flex;
    align-items: stretch;
    max-width: 700px;
    width: 100%;
    margin-bottom: 14px;
}

.url-input {
    flex: 1;
    min-width: 0;
    background: rgba(12, 12, 22, 0.9);
    border: 1px solid var(--ad-border);
    border-right: none;
    border-radius: 10px 0 0 10px;
    padding: 14px 16px;
    font-family: var(--ad-mono);
    font-size: 12.5px;
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}
.url-input:focus { border-color: rgba(79, 195, 247, 0.45); }

.url-go {
    border-radius: 0 10px 10px 0;
    padding: 14px 26px;
    font-size: 15px;
    flex-shrink: 0;
}

.hero-schema {
    font-family: var(--ad-mono);
    font-size: 12px;
    color: var(--ad-dim);
    line-height: 1.9;
    max-width: 700px;
}

/* ── Compact hero ────────────────────────────────────────────────────────────
 * Once the run starts the hero does not go away — it shrinks and sticks under
 * the nav, so the URL box and the Go button stay reachable while the visitor
 * watches the display change below. That adjacency is the entire point: press
 * a button here, see a result there, without either leaving the screen. */
.hero.is-compact {
    position: sticky;
    top: 56px;
    z-index: 80;
    min-height: 0;
    padding: 16px 24px 14px;
    background: rgba(6, 6, 12, 0.94);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--ad-border-soft);
    transition: padding 0.35s ease;
}

.hero.is-compact .hero-icon,
.hero.is-compact .hero-sub,
.hero.is-compact .hero-schema { display: none; }

.hero.is-compact h1 {
    font-size: clamp(15px, 2.2vw, 19px);
    margin-bottom: 10px;
    max-width: none;
    opacity: 0.75;
}

.hero.is-compact .url-row { margin-bottom: 8px; }
.hero.is-compact .url-input { padding: 10px 14px; font-size: 12px; }
.hero.is-compact .url-go { padding: 10px 20px; font-size: 14px; }

.hero-step {
    font-family: var(--ad-mono);
    font-size: 11.5px;
    color: var(--ad-running);
    opacity: 0.85;
}
.hero-step[hidden] { display: none; }

/* The display region moves up under the sticky bar rather than sitting a
   screen away from the button that changes it.
 *
 * scroll-margin-top is what stops the card being sliced in half: the sticky
 * hero floats above the flow, so anything scrolled to — by scrollIntoView or
 * by an anchor — lands underneath it unless told to leave room. The value is
 * nav (56px) + the compact hero, with a little air. */
body.is-live #demo {
    /* 73px, not the 24px I had: the compact hero is sticky but still occupies
       its place in the flow, so this is breathing room rather than collision
       clearance — and at 24px the first card sat right on top of the bar. */
    padding-top: 73px;
    scroll-margin-top: 190px;
}

body.is-live #demo-host { scroll-margin-top: 190px; }

/* Same reason, for anyone who scrolls by hand: the first card keeps clear of
   the bar instead of tucking under it. */
body.is-live #demo-host .ad-head { scroll-margin-top: 190px; }
.hero-schema .k { color: var(--ad-running); }
.hero-schema .v { color: var(--ad-complete); }
.hero-schema .u { color: #f59e0b; }

/* ── Sections ────────────────────────────────────────────────────────────── */
.section { padding: 64px 24px; max-width: 860px; margin: 0 auto; }

.section-label {
    font-family: var(--ad-mono);
    font-size: 11px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ad-running);
    margin-bottom: 12px;
}

.section-title {
    font-family: var(--ad-head);
    font-size: clamp(22px, 3.4vw, 30px);
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}

.section-note {
    font-size: 15px;
    color: var(--ad-dim);
    max-width: 62ch;
    margin-bottom: 28px;
}

.section--center { text-align: center; }
.section--center .section-note { margin-left: auto; margin-right: auto; }

/* ── The instructions block ──────────────────────────────────────────────────
 * The most important element on the site. Agents don't install packages — they
 * get told about a URL in English — so this paragraph is the distribution
 * channel, and it is sized and placed like it. */
.instr {
    background: var(--ad-surface);
    border: 1px solid rgba(79, 195, 247, 0.22);
    border-radius: var(--ad-radius);
    padding: 22px 24px 20px;
}

.instr-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.instr-label {
    font-family: var(--ad-head);
    font-size: 14px;
    font-weight: 600;
    color: var(--ad-running);
}

.instr-text {
    font-family: var(--ad-mono);
    font-size: 12.5px;
    line-height: 1.85;
    color: var(--ad-text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: rgba(0, 0, 0, 0.28);
    border-radius: 9px;
    padding: 15px 17px;
}

.instr-foot {
    margin-top: 12px;
    font-size: 12.5px;
    color: var(--ad-dim);
}

/* Docked variant on the display page — present, dismissible, never covering
 * the newest message. */
.instr-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    z-index: 90;
    background: rgba(6, 6, 12, 0.96);
    backdrop-filter: blur(20px);
    border-top: 1px solid rgba(79, 195, 247, 0.16);
    padding: 13px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
}
.instr-bar[hidden] { display: none; }
.instr-bar .instr-body { flex: 1; min-width: 0; }
.instr-bar .instr-label { font-size: 12px; margin-bottom: 5px; }
.instr-bar .instr-text {
    background: none;
    padding: 0;
    font-size: 11.5px;
    line-height: 1.7;
    max-height: 3.4em;
    overflow: hidden;
}
.instr-bar .instr-actions { display: flex; gap: 8px; flex-shrink: 0; }

.icon-btn {
    background: transparent;
    border: 1px solid var(--ad-border);
    color: var(--ad-dim);
    border-radius: 7px;
    width: 32px; height: 32px;
    font-size: 17px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.18s, color 0.18s;
}
.icon-btn:hover { border-color: rgba(79, 195, 247, 0.35); color: var(--ad-running); }

/* ── Snippets ────────────────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.tab {
    background: transparent;
    border: 1px solid var(--ad-border);
    color: var(--ad-dim);
    border-radius: 8px;
    padding: 7px 14px;
    font-family: var(--ad-mono);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.18s, color 0.18s, background 0.18s;
}
.tab:hover { color: var(--ad-text); }
.tab[aria-selected="true"] {
    background: rgba(79, 195, 247, 0.12);
    border-color: rgba(79, 195, 247, 0.4);
    color: var(--ad-running);
}

.code {
    position: relative;
    background: var(--ad-surface);
    border: 1px solid var(--ad-border-soft);
    border-radius: 11px;
    padding: 16px 18px;
    overflow-x: auto;
}

.code pre {
    font-family: var(--ad-mono);
    font-size: 12.5px;
    line-height: 1.75;
    color: var(--ad-text);
    white-space: pre;
}

.code-copy {
    position: absolute;
    top: 10px; right: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--ad-border);
    color: var(--ad-dim);
    border-radius: 6px;
    padding: 4px 10px;
    font-family: var(--ad-mono);
    font-size: 11px;
    cursor: pointer;
}
.code-copy:hover { color: var(--ad-running); border-color: rgba(79, 195, 247, 0.35); }

/* ── Format table (landing + spec) ───────────────────────────────────────── */
.keytable { width: 100%; border-collapse: collapse; }

.keytable th {
    text-align: left;
    font-family: var(--ad-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ad-dim);
    font-weight: 500;
    padding: 0 0 10px;
    border-bottom: 1px solid var(--ad-border);
}

.keytable td {
    padding: 13px 0;
    border-bottom: 1px solid var(--ad-border-soft);
    font-size: 14px;
    color: var(--ad-text-2);
    vertical-align: top;
}

.keytable td:first-child {
    font-family: var(--ad-mono);
    font-size: 13px;
    color: var(--ad-running);
    width: 26%;
    padding-right: 18px;
    white-space: nowrap;
}

/* The five status values, shown as the pills they render as. Seeing them is
 * the fastest way to learn them. */
.status-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 4px 0 6px;
}

.status-legend {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
}

/* The live example in §1 — a real display card framed as a figure. The card
 * itself is styled entirely by display.css; this only draws the frame and
 * keeps the caption quiet. */
.spec-live {
    margin: 26px 0 4px;
    padding: 20px 20px 15px;
    background: var(--ad-surface);
    border: 1px solid var(--ad-border-soft);
    border-radius: var(--ad-radius);
}

.spec-live figcaption {
    margin-top: 15px;
    font-size: 12px;
    line-height: 1.7;
    color: var(--ad-dim);
}

.spec-live figcaption a { color: var(--ad-text-2); }

.status-legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 15px;
    background: var(--ad-surface);
    border: 1px solid var(--ad-border-soft);
    border-left: 3px solid var(--ad-c, var(--ad-unknown));
    border-radius: 10px;
}

.status-legend-item p {
    font-size: 13px;
    color: var(--ad-dim);
    line-height: 1.5;
}

/* ── Callout ─────────────────────────────────────────────────────────────── */
.callout {
    background: rgba(79, 195, 247, 0.05);
    border: 1px solid rgba(79, 195, 247, 0.16);
    border-radius: var(--ad-radius);
    padding: 22px 24px;
}

.callout--amber {
    background: rgba(245, 158, 11, 0.05);
    border-color: rgba(245, 158, 11, 0.18);
}

.callout h3 {
    font-family: var(--ad-head);
    font-size: 18px;
    color: #fff;
    margin-bottom: 8px;
}

.callout p { font-size: 14.5px; color: var(--ad-dim); margin-bottom: 16px; }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.pill {
    font-family: var(--ad-mono);
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 6px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.16);
    color: #f59e0b;
}

/* ── Spec page ───────────────────────────────────────────────────────────── */
.spec-head {
    border-bottom: 1px solid var(--ad-border);
    padding-bottom: 26px;
    margin-bottom: 34px;
}

.spec-head h1 {
    font-family: var(--ad-head);
    font-size: clamp(28px, 4.6vw, 40px);
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

.spec-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    font-family: var(--ad-mono);
    font-size: 12px;
    color: var(--ad-dim);
}

.spec section { margin-bottom: 40px; }

.spec h2 {
    font-family: var(--ad-head);
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
    scroll-margin-top: 76px;
}

.spec h3 {
    font-family: var(--ad-head);
    font-size: 15px;
    font-weight: 600;
    color: var(--ad-text);
    margin: 22px 0 8px;
}

.spec p, .spec li { font-size: 14.5px; line-height: 1.75; color: var(--ad-text-2); }
.spec p { margin-bottom: 12px; }
.spec ul, .spec ol { margin: 0 0 14px 20px; }
.spec li { margin-bottom: 6px; }

.spec code {
    font-family: var(--ad-mono);
    font-size: 12.5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    padding: 1.5px 6px;
    color: var(--ad-running);
}

.spec .code code { background: none; padding: 0; color: inherit; }

.spec-toc {
    position: sticky;
    top: 76px;
    font-family: var(--ad-mono);
    font-size: 12px;
    line-height: 2;
}
.spec-toc a { color: var(--ad-dim); }
.spec-toc a:hover { color: var(--ad-running); }

.spec-layout { display: grid; grid-template-columns: 180px 1fr; gap: 44px; }

/* A grid track's automatic minimum is its min-content width, and the widest
 * thing on this page is an unbreakable code line — so without this the whole
 * page scrolls sideways in the band between the sidebar breakpoint and a wide
 * desktop. The code blocks already scroll inside themselves; this lets them. */
.spec-layout > * { min-width: 0; }

/* ── Sign in ─────────────────────────────────────────────────────────────── */
.signin { max-width: 460px; margin: 40px auto 0; }

.signin h1 {
    font-family: var(--ad-head);
    font-size: clamp(26px, 4.5vw, 34px);
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
}

.signin-lead { font-size: 14.5px; line-height: 1.65; color: var(--ad-text-2); margin-bottom: 16px; }

.signin-row { display: flex; gap: 8px; }

.signin-row input {
    flex: 1;
    min-width: 0;
    background: rgba(12, 12, 22, 0.9);
    border: 1px solid var(--ad-border);
    border-radius: 9px;
    padding: 12px 14px;
    font-family: var(--ad-mono);
    font-size: 14px;
    color: #fff;
    outline: none;
}
.signin-row input:focus { border-color: rgba(79, 195, 247, 0.45); }
#code { letter-spacing: 6px; }

.signin-error { margin-top: 14px; font-size: 13.5px; color: #f7c667; }
.signin-small { margin-top: 14px; font-size: 12.5px; color: var(--ad-dim); }
.signin-foot { margin-top: 36px; border-top: 1px solid var(--ad-border-soft); padding-top: 16px; }

/* ── Welcome (post-purchase) ─────────────────────────────────────────────── */
.welcome { max-width: 620px; margin: 0 auto; text-align: center; }

.welcome-tick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    color: var(--ad-complete);
    background: color-mix(in srgb, var(--ad-complete) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--ad-complete) 40%, transparent);
    margin-bottom: 22px;
}

.welcome h1 {
    font-family: var(--ad-head);
    font-size: clamp(28px, 5vw, 40px);
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
    margin-bottom: 14px;
}

.welcome-lead {
    font-size: 16px;
    line-height: 1.7;
    color: var(--ad-text-2);
    margin-bottom: 30px;
}

.welcome-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.welcome-next {
    text-align: left;
    background: var(--ad-surface);
    border: 1px solid var(--ad-border-soft);
    border-radius: var(--ad-radius);
    padding: 24px 26px;
}

.welcome-next h2 {
    font-family: var(--ad-head);
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.welcome-next p {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--ad-dim);
}

.welcome-small {
    margin-top: 12px;
    font-size: 13px;
    opacity: 0.8;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.footer {
    padding: 40px 24px;
    text-align: center;
    border-top: 1px solid var(--ad-border-soft);
}
.footer p { font-size: 12.5px; color: var(--ad-dim); }
.footer p + p { margin-top: 7px; opacity: 0.65; }

/* ── Demo coach ──────────────────────────────────────────────────────────────
 * Sits BELOW the display, never above it. The display is what gets
 * screenshotted and it stays the hero — this is scaffolding for someone's
 * first thirty seconds, and it disappears from a real display entirely. */
.coach {
    max-width: 860px;
    margin: 28px auto 0;
    padding: 22px 24px 20px;
    background: var(--ad-surface);
    border: 1px dashed rgba(79, 195, 247, 0.3);
    border-radius: var(--ad-radius);
}

.coach-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.coach-badge {
    font-family: var(--ad-mono);
    font-size: 10px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ad-running);
    background: rgba(79, 195, 247, 0.12);
    border: 1px solid rgba(79, 195, 247, 0.3);
    border-radius: 5px;
    padding: 3px 9px;
}

.coach-count {
    font-family: var(--ad-mono);
    font-size: 11px;
    color: var(--ad-dim);
    margin-left: auto;
}

.coach h2 {
    font-family: var(--ad-head);
    font-size: 19px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 14px;
    letter-spacing: -0.01em;
}

/* The URL is the lesson. Reserved keys and invented ones are coloured
 * differently, because "which of these words are special" is the single thing
 * a newcomer needs to learn about the format. */
.coach-url {
    font-family: var(--ad-mono);
    font-size: 12.5px;
    line-height: 1.85;
    color: var(--ad-text-2);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 9px;
    padding: 14px 16px;
    margin-bottom: 16px;
    overflow-wrap: anywhere;
}

.coach-url .u { color: var(--ad-dim); }
.coach-url .k { color: var(--ad-running); }
.coach-url .k.stat { color: #c084fc; }
.coach-url .v { color: var(--ad-complete); }
.coach-url .amp { color: var(--ad-dim); }

.coach-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.coach-hint {
    font-size: 13px;
    color: var(--ad-dim);
}

/* Sits at the TOP of the box now — what just happened, before how to do it
   yourself. Hidden until the first press. */
.coach-teach {
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--ad-border-soft);
    font-size: 14px;
    line-height: 1.65;
    color: var(--ad-text-2);
}
.coach-teach[hidden] { display: none; }

.coach-note {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--ad-dim);
    margin-bottom: 14px;
    max-width: 62ch;
}
.coach-note:empty { display: none; }

/* The code block inside the box needs its own ground against the box's
   surface, not the page's. */
.coach .code { background: rgba(0, 0, 0, 0.32); }

.coach-teach code {
    font-family: var(--ad-mono);
    font-size: 12.5px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 4px;
    padding: 1.5px 6px;
    color: var(--ad-running);
}

.coach-teach--error { color: #f7c667; }

/* ── The guided panel on a display page ──────────────────────────────────────
 * Only on the display (js/demo.js adds coach--guided); the landing page's coach
 * is a conversion element and stays at full strength.
 *
 * It sits at 0.2 because of what the page is FOR: someone glances at a display
 * to read a status, and on their own display that glance was landing on a
 * tutorial box louder than the agent. Dim, it reads as scaffolding you can
 * ignore; hover or tab into it and it is fully there. focus-within matters more
 * than the hover — a keyboard user must not have to aim at something they
 * cannot see. */
.coach--guided {
    opacity: 0.2;
    transition: opacity 0.25s ease;
}

.coach--guided:hover,
.coach--guided:focus-within { opacity: 1; }

/* Reduced motion still gets the state change, just without the fade. */
@media (prefers-reduced-motion: reduce) {
    .coach--guided { transition: none; }
}

/* ── Handing the instructions to an agent ────────────────────────────────────
 * Its own block under the demo button, because it is a different act: the
 * button above sends one update by hand, this makes the agent do it forever. */
.coach-handoff {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--ad-border-soft);
}

.coach-handoff p {
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--ad-dim);
    margin-bottom: 14px;
    max-width: 62ch;
}

.coach-handoff code {
    font-family: var(--ad-mono);
    font-size: 12px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 4px;
    padding: 1.5px 6px;
    color: var(--ad-running);
}

.coach-done h2 { margin-bottom: 10px; }

.coach-done p {
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--ad-dim);
    margin-bottom: 18px;
    max-width: 62ch;
}

@media (max-width: 640px) {
    .coach { margin: 22px 0 0; padding: 18px 16px 16px; }
    .coach h2 { font-size: 17px; }
    .coach-url { font-size: 11px; }
    .coach-actions { align-items: stretch; flex-direction: column; }
}

/* ── Accessibility ───────────────────────────────────────────────────────────
 * The document-wide half of the pair. display.css keeps its equivalents scoped
 * to .ad-display / .ad-tile because that file is also loaded inside
 * MissionBoard, where a global rule would be someone else's problem. */
:where(a, button, input, [tabindex]):focus-visible {
    outline: 2px solid var(--ad-running);
    outline-offset: 2px;
    border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}

/* ── Instructions inside the empty display ───────────────────────────────────
 * One button, no printed paragraph — the instructions are for pasting into an
 * agent, not for reading, and the button copies the full text. */
#empty-instr-copy { margin-top: 18px; }

/* ── The instructions chip in the display header ─────────────────────────────
 * Lives here rather than in display.css because it is viewer furniture: the
 * board widget renders the same card and must not ship a button that copies a
 * prompt into a dashboard nobody is pasting from.
 *
 * Shaped like a stat card so it belongs to that row, but deliberately NOT in
 * any status colour — five hues already mean five specific things on this page,
 * and a sixth cyan element beside them would read as a status. Neutral at rest,
 * cyan only under the cursor, where "clickable" is the only thing it claims. */
.ad-instr {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    background: none;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 6px;
    padding: 4px 10px;
    font-family: var(--ad-mono);
    font-size: 9.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ad-dim);
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
}

.ad-instr:hover {
    color: var(--ad-running);
    border-color: rgba(79, 195, 247, 0.45);
}

/* Structural, not :has() — the stats row already claims margin-left:auto, so
 * the chip only needs to claim the right edge when it is standing there alone
 * (a display whose agent has posted no stat cards). */
.ad-head > .ad-instr { margin-left: auto; }
.ad-head .ad-stats + .ad-instr { margin-left: 0; }

@media (max-width: 640px) {
    /* The header stacks on a phone; the chip goes with the stats rather than
     * clinging to a right edge that is no longer there. */
    .ad-head > .ad-instr, .ad-head .ad-stats + .ad-instr { margin-left: 0; }
}

/* ── The instructions modal ──────────────────────────────────────────────────
 * Opened by the header chip on a display. The copy button lives NEXT TO the
 * text it copies — a silent copy from the chip answered "what did that just
 * do?" with a toast, which is no answer weeks later. */
.ad-modal {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.ad-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 4, 8, 0.72);
    backdrop-filter: blur(3px);
}

.ad-modal-box {
    position: relative;
    max-width: 620px;
    width: 100%;
    background: var(--ad-surface);
    border: 1px solid var(--ad-border);
    border-radius: var(--ad-radius);
    padding: 26px 28px 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.ad-modal-box h2 {
    font-family: var(--ad-head);
    font-size: 19px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
    padding-right: 28px;
}

.ad-modal-lead {
    font-size: 13.5px;
    line-height: 1.65;
    color: var(--ad-dim);
    margin-bottom: 16px;
}

.ad-modal-lead code {
    font-family: var(--ad-mono);
    font-size: 12px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 4px;
    padding: 1.5px 6px;
    color: var(--ad-running);
}

/* The paragraph itself, shown in full: it is what lands in their agent, and
 * seeing it is what makes the copy button trustworthy. */
.ad-modal-instr {
    font-family: var(--ad-mono);
    font-size: 12.5px;
    line-height: 1.8;
    color: var(--ad-text);
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid var(--ad-border-soft);
    border-radius: 9px;
    padding: 14px 16px;
    margin-bottom: 18px;
    overflow-wrap: anywhere;
    user-select: all;
}

.ad-modal-actions { display: flex; gap: 12px; }

/* The badge block under the instructions — the modal's other hand-out. The
 * <img> is the live badge itself, not a picture of one. */
.ad-modal-badge {
    border-top: 1px solid var(--ad-border-soft);
    margin-top: 20px;
    padding-top: 18px;
}

.ad-modal-badge-md { margin-bottom: 14px; }

.ad-modal-badge-row { align-items: center; }

.ad-modal-badge-img { display: block; }

/* ── Alerts modal ──────────────────────────────────────────────────────────── */
.ad-alert-form {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.ad-alert-input {
    flex: 1;
    min-width: 0;
    background: rgba(0, 0, 0, 0.32);
    border: 1px solid var(--ad-border);
    border-radius: 9px;
    padding: 10px 14px;
    font-family: var(--ad-mono);
    font-size: 13px;
    color: var(--ad-text);
}
.ad-alert-input:focus { outline: 2px solid var(--ad-running); outline-offset: 1px; }
.ad-alert-input::placeholder { color: var(--ad-dim); }

/* The silence-alert opt-in, under the email field. One quiet sentence with a
 * select in it — it reads as a clause of the subscription, not a second form. */
.ad-alert-quiet {
    display: block;
    font-size: 12.5px;
    color: var(--ad-dim);
    margin: -2px 0 14px;
}

.ad-alert-quiet select {
    background: var(--ad-surface-2);
    color: var(--ad-text);
    border: 1px solid var(--ad-border);
    border-radius: 6px;
    padding: 3px 8px;
    font-family: inherit;
    font-size: 12.5px;
}

.ad-alert-quiet select:focus { outline: 2px solid var(--ad-running); outline-offset: 1px; }
.ad-alert-quiet strong { color: var(--ad-text-2); }

.ad-alert-quiet-tag {
    margin-left: 8px;
    text-transform: none;
    letter-spacing: normal;
    color: var(--ad-text-2);
}

.ad-alert-paid-note {
    font-size: 12.5px;
    color: var(--ad-dim);
    margin-bottom: 12px;
}

.ad-alert-list { margin-top: 6px; }

.ad-alert-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 2px;
    border-top: 1px solid var(--ad-border-soft);
    font-family: var(--ad-mono);
    font-size: 12px;
}

.ad-alert-target {
    color: var(--ad-text-2);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

/* Which display a subscription belongs to, on the /agents aggregate list. */
.ad-alert-board { color: var(--ad-dim); font-size: 10.5px; }

.ad-alert-state {
    margin-left: auto;
    flex-shrink: 0;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--ad-dim);
}

.ad-alert-remove {
    flex-shrink: 0;
    width: 24px; height: 24px;
    background: none;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--ad-dim);
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
}
.ad-alert-remove:hover { color: var(--ad-error); background: rgba(255, 255, 255, 0.05); }

.ad-alert-note {
    margin-top: 12px;
    font-size: 13px;
    color: var(--ad-running);
    min-height: 1.2em;
}

@media (max-width: 640px) {
    .ad-alert-form { flex-direction: column; }
}

.ad-modal-x {
    position: absolute;
    top: 12px; right: 12px;
    width: 30px; height: 30px;
    background: none;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--ad-dim);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.ad-modal-x:hover { color: var(--ad-text); background: rgba(255, 255, 255, 0.06); }

@media (max-width: 640px) {
    .ad-modal { padding: 12px; }
    .ad-modal-box { padding: 20px 18px 18px; }
}

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
    position: fixed;
    top: 68px; left: 50%;
    transform: translateX(-50%);
    background: var(--ad-running);
    color: #04070a;
    font-family: var(--ad-mono);
    font-size: 11px;
    font-weight: 700;
    padding: 6px 16px;
    border-radius: 6px;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
    z-index: 200;
}
.toast.is-visible { opacity: 1; }

/* ── The team-view teaser ───────────────────────────────────
 * A silent loop of the org view, above the button that builds the real one.
 * Autoplay is allowed here because the file carries no audio track at all;
 * js/site.js pauses it for anyone who has asked for reduced motion, and the
 * poster frame shows the same board standing still. */
.teaser {
    margin: 0 auto 28px;
    max-width: 720px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--ad-radius);
    overflow: hidden;
    background: #000;
    line-height: 0;
}

.teaser video {
    display: block;
    width: 100%;
    height: auto;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .spec-layout { grid-template-columns: 1fr; gap: 0; }
    .spec-toc { display: none; }
}

@media (max-width: 640px) {
    .nav { padding: 0 12px; gap: 10px; }
    .nav-url { display: none; }
    .page { padding: 80px 16px 56px; }
    .section { padding: 48px 16px; }
    .hero { padding: 96px 16px 44px; }
    .url-input { font-size: 10.5px; padding: 12px 12px; }
    .url-go { padding: 12px 18px; font-size: 14px; }

    /* The instructions bar takes the full width on a phone and drops the
     * preview text — the Copy button is the only part that matters there. */
    .instr-bar { flex-direction: column; align-items: stretch; gap: 10px; }
    .instr-bar .instr-text { max-height: 4.6em; }
    .instr-bar .instr-actions { justify-content: flex-end; }

    .keytable td:first-child { width: 34%; }
    .status-legend { grid-template-columns: 1fr; }
}
