/* Copyright Nige Ltd. Author: Nigel Hamilton. */
/* agents.321.do - the look of the 321.do main site. The first part of this
   file is taken from web.321.do public/css/site.css (tokens, base, header,
   type, buttons, badges, agent cards, footer, responsive) so the two sites
   read as one. The second part styles what only this site has: forms, the
   two visibility tiers, tokens. Change shared rules there first, then here. */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@400;500;600&family=Geist+Mono:wght@400;500;600&display=swap');

:root {
    --paper: #0c0c0d;          /* the screen */
    --ink: #f4f2eb;            /* phosphor-warm text */
    --muted: #9a968e;          /* 7.6:1 on paper */
    --hairline: #26262a;
    --panel: #121214;
    --panel-2: #17171a;

    --focus: #7aa7f0;          /* brand blue for dark ground */
    --focus-deep: #4f7fd1;
    --focus-light: #9bb8ff;
    --focus-soft: rgba(122, 167, 240, 0.14);
    --accent: var(--focus);

    --ok: #a6c97f;
    --warn: #e0a96d;

    --term-bg: #000000;
    --term-text: #e8e6df;
    --term-muted: #8a877f;

    --radius: 4px;
    --max-width: 1080px;
    --reading-width: 660px;
    --hero-width: 800px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; animation: none !important; }
}

body {
    font-family: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-weight: 400;
    background: var(--paper);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.mono, .brand, code, pre, kbd,
h1, h2, h3, .site-nav a, .nav-toggle, .cta, .action-link, .card-link, .agent-card-role, th {
    font-family: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

a { color: var(--focus); }

:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 3px;
    border-radius: 2px;
}

.skip-link {
    position: absolute;
    left: 16px;
    top: -60px;
    background: var(--focus);
    color: #0c0c0d;
    padding: 10px 16px;
    border-radius: var(--radius);
    z-index: 100;
    text-decoration: none;
}
.skip-link:focus { top: 12px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 24px 48px;
}
/* ---- header ------------------------------------------------- */

.site-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 0 44px;
    flex-wrap: wrap;
}

.header-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
}

.logo-mark {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
    line-height: 1;
}
.logo-device { display: block; height: 28px; width: auto; }
.logo-mark--small .logo-device { height: 20px; }

.logo-focus-ring, .logo-focus-dot { color: var(--focus); }

.header-brand .brand {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--ink);
}

.site-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.site-nav a {
    color: var(--muted);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: color 0.15s ease, background 0.15s ease;
}
.site-nav a:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }
.site-nav a.nav-active { color: var(--ink); background: rgba(255, 255, 255, 0.08); }
.site-nav a.nav-active::before { content: "> "; color: var(--focus); }
.site-nav .nav-cta { display: none; color: var(--focus); font-weight: 600; }

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--hairline);
    color: var(--ink);
    font: inherit;
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: var(--radius);
    cursor: pointer;
}
/* ---- type ---------------------------------------------------- */

.page-content { padding: 8px 0; min-width: 0; }
.docs-body, .section, .hero { min-width: 0; }

.hero {
    max-width: var(--hero-width);
    margin: 56px 0 56px;
}

.hero h1 {
    font-size: 2.6rem;
    line-height: 1.12;
    letter-spacing: -0.03em;
    font-weight: 500;
    margin-bottom: 20px;
}

/* a static block cursor closes the headline; it never blinks. The h1
   reserves the cursor's width as padding and the cursor's negative
   right margin cancels it, so the cursor can never wrap onto its own line. */
.hero h1 { padding-right: 0.7em; }
.hero h1::after {
    content: "";
    display: inline-block;
    width: 0.5em;
    height: 0.9em;
    margin-left: 0.18em;
    margin-right: -0.7em;
    vertical-align: -0.1em;
    background: var(--focus);
}

.hero h2 {
    font-size: 1.8rem;
    line-height: 1.15;
    letter-spacing: -0.02em;
    font-weight: 500;
    margin-bottom: 16px;
}

.subheadline {
    font-size: 1.18rem;
    color: var(--muted);
    line-height: 1.55;
    margin-bottom: 24px;
    max-width: 600px;
}
.subheadline a { color: var(--focus); }

.eyebrow {
    font-family: 'Geist Mono', monospace;
    font-size: 0.76rem;
    padding-left: 1.1em;
    position: relative;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--focus);
    margin-bottom: 16px;
}
.eyebrow::before { content: "#"; position: absolute; left: 0; color: var(--muted); }

.section {
    max-width: var(--max-width);
    margin: 64px 0;
}

.section h2 {
    font-size: 1.35rem;
    line-height: 1.25;
    letter-spacing: -0.02em;
    font-weight: 500;
    margin-bottom: 16px;
    max-width: var(--reading-width);
}

.section h3 {
    font-size: 1.08rem;
    font-weight: 500;
    margin: 28px 0 8px;
    letter-spacing: -0.01em;
}

.section p, .section li {
    max-width: var(--reading-width);
    line-height: 1.6;
}
.section > p { margin-bottom: 14px; }

.intro {
    font-size: 1.06rem;
    color: var(--muted);
    margin-bottom: 16px;
    max-width: var(--reading-width);
}

.section a:not(.cta):not(.action-link):not(.card-link) {
    color: var(--focus);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--focus-soft);
    padding-bottom: 1px;
}
.section a:not(.cta):not(.action-link):not(.card-link):hover { border-bottom-color: var(--focus); color: var(--focus-deep); }

.section ul, .section ol { margin: 0 0 16px 22px; }
.section li { margin-bottom: 6px; }

.section code:not(pre code) {
    background: rgba(255, 255, 255, 0.08);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.92em;
}

/* ---- ctas ------------------------------------------------------ */

.cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 22px;
    border-radius: var(--radius);
    background: var(--focus);
    color: #0c0c0d;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.3;
    border: 1.5px solid var(--focus);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.cta:hover { background: var(--focus-light); border-color: var(--focus-light); }
.cta::after { content: "\2192"; font-family: 'Geist Mono', monospace; }

.cta-secondary {
    background: transparent;
    color: var(--focus);
    border-color: var(--focus);
}
.cta-secondary:hover { background: var(--focus-soft); color: var(--focus-light); }

.header-cta { padding: 9px 16px; font-size: 0.92rem; }

.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }

.action-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--focus);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--focus-soft);
    padding-bottom: 1px;
}
.action-link::after { content: "\2192"; font-family: 'Geist Mono', monospace; }
.action-link:hover { border-bottom-color: var(--focus); }

/* ---- status badges ------------------------------------------------ */

.status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-family: 'Geist Mono', monospace;
    font-size: 0.74rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 4px;
    border: 1px solid var(--hairline);
    background: var(--panel);
    color: var(--muted);
    white-space: nowrap;
}
.status-dot { width: 8px; height: 8px; border-radius: 2px; background: currentColor; }
/* ---- agent catalogue ------------------------------------------ */

.agent-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 24px;
    min-width: 0;
}

.agent-card {
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    background: var(--panel);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.agent-card--planned { background: transparent; border-style: dashed; border-color: #3a3a40; }

.agent-card img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; border-bottom: 1px solid var(--hairline); }

.agent-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.agent-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.agent-card-name { font-weight: 600; font-size: 1.1rem; }
.agent-card-id { color: var(--muted); font-size: 0.82rem; }
.agent-card-role { color: var(--ink); font-weight: 500; }
.agent-card p { color: var(--muted); font-size: 0.94rem; margin: 0; }

.agent-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px 24px;
    margin: 24px 0 0;
    max-width: 760px;
}
.agent-meta dt {
    font-family: 'Geist Mono', monospace;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
}
.agent-meta dd { margin: 0 0 6px; }
.agent-meta dd .mono { font-size: 0.95em; }

.crumb { font-size: 0.9rem; margin: 0 0 18px; color: var(--muted); }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--focus); text-decoration: underline; }
.crumb-sep { margin: 0 6px; }

.personality { color: var(--muted); font-style: italic; margin-top: -8px; }

/* agent names are trade marks: the tm rides the h1 quietly, as on 123.do */
.tm { font-size: 0.4em; vertical-align: super; margin-left: 2px; color: var(--muted); font-family: 'Geist', system-ui, sans-serif; font-weight: 400; }

/* ---- footer -------------------------------------------------------- */

.site-footer {
    margin-top: 96px;
    padding: 36px 0 8px;
    border-top: 1px solid var(--hairline);
    color: var(--muted);
    font-size: 0.92rem;
}
.site-footer > * { margin: 8px 0; }
.site-footer-strapline { color: var(--ink); margin-bottom: 16px; }
.site-footer-nav { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.site-footer-nav a { color: var(--muted); text-decoration: none; }
.site-footer-nav a:hover { color: var(--ink); }
.site-footer a { color: var(--muted); }
.footer-brand-wrap { display: inline-flex; align-items: center; gap: 8px; }
.footer-brand { color: var(--muted); font-size: 0.85rem; }

/* registered mark: sized down without growing the line box; used only for
   the registered marks 123.do and 321.do, never for agent names */

.status--verified { color: var(--ok); border-color: rgba(166, 201, 127, 0.45); background: rgba(166, 201, 127, 0.08); }
.status--preview  { color: var(--warn); border-color: rgba(224, 169, 109, 0.45); background: rgba(224, 169, 109, 0.08); }
.status--planned  { color: var(--muted); }

.agent-card-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.card-link { color: var(--focus); text-decoration: none; font-weight: 500; }
.card-link:hover { text-decoration: underline; }

/* ============================================================
   agents.321.do only
   ============================================================ */

/* An agent brings its own colour as --agent (a validated #rrggbb). It is an
   accent only - a band and a swatch - so text contrast never depends on it. */
.agent-card { border-top: 3px solid var(--agent, var(--hairline)); }
.agent-card-name, .agent-card p, .agent-meta dd, .subheadline { overflow-wrap: anywhere; }
.agent-card .card-link { margin-top: 4px; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 2px; vertical-align: -2px;
          background: var(--agent, var(--focus)); border: 1px solid rgba(255, 255, 255, 0.25); }
.hero--agent { border-left: 4px solid var(--agent, var(--focus)); padding-left: 22px; }
.hero .status { margin-bottom: 16px; }
.empty, .api-note { color: var(--muted); }
.api-note { margin-top: 28px; font-size: 0.9rem; }

/* breadcrumbs, in the main site's .crumb voice */
.crumbs { font-size: 0.9rem; margin: 0 0 18px; color: var(--muted); }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--hairline); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--focus); text-decoration: underline; }
.crumbs [aria-current="page"] { color: var(--ink); }

/* header: the signed-in email and the sign-out button sit in the nav */
.nav-email { color: var(--muted); font-size: 0.85rem; padding: 8px 12px; font-family: 'Geist Mono', monospace; }
.nav-inline { margin: 0; display: inline-flex; }
.nav-inline button {
    font-family: 'Geist Mono', monospace; font-size: 0.95rem; color: var(--muted); background: none;
    border: 0; padding: 8px 12px; border-radius: var(--radius); cursor: pointer;
}
.nav-inline button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }

/* flash: what just happened, on the page the action lands on */
.flash {
    border: 1px solid rgba(166, 201, 127, 0.45); border-left: 4px solid var(--ok);
    background: rgba(166, 201, 127, 0.08); color: var(--ink);
    border-radius: var(--radius); padding: 12px 16px; margin: 0 0 24px; max-width: 900px;
}

/* buttons: .btn is the main site's .cta under this app's class names */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    padding: 13px 22px; border-radius: var(--radius); background: var(--focus); color: #0c0c0d;
    font-family: 'Geist Mono', ui-monospace, monospace; font-weight: 600; font-size: 0.95rem; line-height: 1.3;
    text-decoration: none; border: 1.5px solid var(--focus); cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--focus-light); border-color: var(--focus-light); }
.btn::after { content: "\2192"; }
.btn--ghost { background: transparent; color: var(--focus); }
.btn--ghost:hover { background: var(--focus-soft); color: var(--focus-light); }
.btn--danger { background: #e07a6d; border-color: #e07a6d; color: #0c0c0d; }
.btn--danger:hover { background: #eb978c; border-color: #eb978c; }
.btn-row { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; margin-top: 28px; }
.btn-row .cancel { color: var(--muted); }
.btn-row .cancel:hover { color: var(--ink); }

/* the action panel: a page whose job is a form is owned by the form.
   A pane with a title bar, like the terminal panes on the main site. */
.action {
    max-width: 560px; margin: 24px 0 24px; background: var(--panel);
    border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden;
}
.action--wide { max-width: 760px; }
.action [hidden] { display: none !important; }
.action__band {
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    background: var(--term-bg); color: var(--term-muted); padding: 12px 24px;
    border-bottom: 1px solid var(--hairline);
    font-family: 'Geist Mono', monospace; font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase;
}
.action__band strong { color: var(--focus); font-weight: 500; }
.action__body { padding: 30px 24px 26px; }
.action h1 { font-size: 1.9rem; line-height: 1.15; letter-spacing: -0.03em; font-weight: 500; margin: 0 0 10px; overflow-wrap: anywhere; }
.action__lead { color: var(--muted); font-size: 1.06rem; margin: 0 0 26px; }
.action form { display: grid; gap: 20px; margin: 0; }
.action label { display: grid; gap: 8px; font-family: 'Geist Mono', monospace; font-weight: 500; font-size: 0.9rem; }
.action input[type="text"], .action input[type="email"], .action textarea {
    width: 100%; min-width: 0; padding: 0 14px; height: 54px; font: 400 1.05rem 'Geist', system-ui, sans-serif;
    color: var(--ink); background: var(--paper); border: 1.5px solid #3a3a40; border-radius: var(--radius);
}
.action textarea { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.action input::placeholder, .action textarea::placeholder { color: #6f6c66; }
.action input:focus, .action textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-soft); }
.action input[type="color"] { width: 96px; height: 54px; padding: 4px; background: var(--paper); border: 1.5px solid #3a3a40; border-radius: var(--radius); cursor: pointer; }
.action input.code { height: 72px; text-align: center; font: 500 2rem 'Geist Mono', monospace; letter-spacing: 0.45em; padding-left: 0.45em; }
.field-prefix { display: flex; align-items: center; min-width: 0; background: var(--paper); border: 1.5px solid #3a3a40; border-radius: var(--radius); }
.field-prefix:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus-soft); }
.field-prefix > span { padding-left: 14px; font: 400 0.95rem 'Geist Mono', monospace; color: var(--muted); white-space: nowrap; }
.action .field-prefix input { border: 0; box-shadow: none; height: 51px; padding-left: 1px; background: transparent; font-family: 'Geist Mono', monospace; }
.action__hint { font-family: 'Geist', system-ui, sans-serif; font-weight: 400; font-size: 0.88rem; color: var(--muted); }
.action__opt { font-weight: 400; font-size: 0.78rem; color: var(--muted); margin-left: 6px; }
.action .btn--go { width: 100%; height: 56px; margin-top: 4px; font-size: 1rem; }
.action__alt { margin: 22px 0 0; font-size: 0.94rem; color: var(--muted); }
.action .error, .field-error { color: #f0a39a; }
.action .error { border: 1px solid rgba(224, 122, 109, 0.5); background: rgba(224, 122, 109, 0.08); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 18px; }
.field-error { display: block; font-family: 'Geist', system-ui, sans-serif; font-weight: 500; font-size: 0.9rem; }

/* the two visibility tiers inside the register / edit form */
.action fieldset.tier { border: 0; border-top: 1px solid var(--hairline); padding: 20px 0 0; display: grid; gap: 20px; min-width: 0; }
.action .tier legend { font-family: 'Geist Mono', monospace; font-size: 0.76rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--focus); padding: 0 12px 0 0; }
.action .tier legend span { letter-spacing: 0; text-transform: none; color: var(--muted); margin-left: 8px; font-family: 'Geist', system-ui, sans-serif; font-size: 0.88rem; }

/* what only the publisher and 123.do accounts are shown */
.hidden-tier { border: 1px dashed #3a3a40; border-radius: var(--radius); padding: 22px 24px; margin: 40px 0 0; max-width: 900px; }
.hidden-tier h2 { font-size: 1.2rem; font-weight: 500; letter-spacing: -0.02em; margin: 0 0 6px; }
.hidden-tier__note { color: var(--muted); font-size: 0.92rem; margin: 0 0 4px; }
.hidden-tier ul { margin: 0 0 0 20px; }

/* API tokens */
.token-once { border: 1px solid rgba(224, 169, 109, 0.45); border-left: 4px solid var(--warn); background: rgba(224, 169, 109, 0.08); border-radius: var(--radius); padding: 16px 18px; margin: 0 0 24px; max-width: 900px; }
.token-once p { margin: 0 0 10px; }
.token-once p:last-child { margin: 0; color: var(--muted); font-size: 0.92rem; }
.token-once > code { display: block; background: var(--term-bg); color: var(--term-text); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 12px 14px; margin: 0 0 10px; overflow-wrap: anywhere; }
.token-list { list-style: none; max-width: 900px; border-top: 1px solid var(--hairline); }
.token-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.token-list small { display: block; color: var(--muted); }
/* ---- responsive ------------------------------------------------------ */

@media (max-width: 767px) {
    .hero { margin: 36px 0 40px; }
    .hero h2 { font-size: 1.45rem; }
    .section { margin: 44px 0; }
    .section h2 { font-size: 1.2rem; }

    .site-header { padding-bottom: 24px; }
    .nav-toggle { display: inline-flex; order: 2; margin-left: auto; }
    .header-cta { display: none; }
    .site-nav .nav-cta { display: block; }
    .site-nav {
        display: none;
        order: 4;
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        margin: 12px 0 0;
        padding-top: 12px;
        border-top: 1px solid var(--hairline);
    }
    .site-nav.nav-open { display: flex; }
    .site-nav a { padding: 12px; }
    .hero h1 { font-size: 2rem; }

    .cta { width: 100%; justify-content: center; }
    .header-cta { width: auto; }
    .btn { width: 100%; }
    .hero .btn, .btn-row .btn { width: 100%; }
    .action__body { padding: 24px 16px 20px; }
    .action__band { padding: 12px 16px; }
    .field-prefix > span { font-size: 0.8rem; padding-left: 10px; }
    .nav-email { display: none; }
}

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

@media (min-width: 960px) {
    .hero h1 { font-size: 3rem; }
    .agent-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
}
