/* AI Agent Marketplace - no external fonts or assets (strict CSP). */

:root {
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --brand: #4f46e5;
    --brand-strong: #4338ca;
    --brand-soft: #eef2ff;
    --ok-bg: #ecfdf5; --ok-fg: #065f46; --ok-border: #a7f3d0;
    --warn-bg: #fffbeb; --warn-fg: #92400e; --warn-border: #fde68a;
    --error-bg: #fef2f2; --error-fg: #991b1b; --error-border: #fecaca;
    --hero-from: #1e1b4b;
    --hero-to: #312e81;
    --radius: 12px;
    --shadow: 0 1px 2px rgb(15 23 42 / 0.06), 0 1px 3px rgb(15 23 42 / 0.08);
    --accent: #4f46e5;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1120;
        --surface: #111827;
        --border: #1f2937;
        --text: #e5e7eb;
        --muted: #94a3b8;
        --brand: #818cf8;
        --brand-strong: #a5b4fc;
        --brand-soft: #1e1b4b;
        --ok-bg: #052e22; --ok-fg: #6ee7b7; --ok-border: #065f46;
        --warn-bg: #2a1d05; --warn-fg: #fcd34d; --warn-border: #92400e;
        --error-bg: #2b0b0b; --error-fg: #fca5a5; --error-border: #991b1b;
        --hero-from: #0f0d2e;
        --hero-to: #1e1b4b;
        --shadow: none;
        color-scheme: dark;
    }
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main { flex: 1; }

a { color: var(--brand); }
a:hover { color: var(--brand-strong); }

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 16px; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.mono, code, pre { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* Header and footer */

.site-header { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; text-decoration: none; }
.header-nav { display: flex; gap: 20px; font-size: 0.9375rem; }
.header-nav a { color: var(--muted); text-decoration: none; }
.header-nav a:hover { color: var(--text); }

.site-footer { border-top: 1px solid var(--border); margin-top: 48px; font-size: 0.875rem; }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-top: 20px; padding-bottom: 20px; color: var(--muted); }
.footer-inner p { margin: 0; }

/* Hero */

.hero { background: linear-gradient(135deg, var(--hero-from), var(--hero-to)); color: #fff; padding: 56px 0 48px; }
.hero h1 { font-size: clamp(1.75rem, 4vw, 2.75rem); line-height: 1.15; margin: 8px 0 16px; max-width: 820px; letter-spacing: -0.01em; }
.hero .lead { color: #c7d2fe; max-width: 720px; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; font-weight: 600; margin: 0; opacity: 0.85; }
.lead { font-size: 1.125rem; margin: 0; }

/* Verification banner */

.verification { margin-top: 24px; padding: 12px 16px; border-radius: 10px; font-size: 0.9375rem; border: 1px solid; }
.verification.ok { background: var(--ok-bg); color: var(--ok-fg); border-color: var(--ok-border); }
.verification.warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-border); }
.verification.error { background: var(--error-bg); color: var(--error-fg); border-color: var(--error-border); }
.verification.ok::before { content: "\2713  "; font-weight: 700; }

/* Catalogue */

.catalog { padding-top: 32px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.filters input, .filters select {
    font: inherit; color: var(--text); background: var(--surface);
    border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; min-height: 44px;
}
.filters input { flex: 1 1 260px; }
.filters select { flex: 0 1 220px; }
.filters input:focus, .filters select:focus { outline: 2px solid var(--brand); outline-offset: 1px; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-top: 8px; }

.card {
    display: flex; flex-direction: column; gap: 12px; padding: 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); color: inherit; text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); color: inherit; }
.card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.card-head { display: flex; align-items: center; gap: 12px; }
.card h2 { font-size: 1.0625rem; margin: 0; line-height: 1.3; }
.card .muted { margin: 0; }
.summary { margin: 0; color: var(--muted); font-size: 0.9375rem; flex: 1; }

.swatch { width: 40px; height: 40px; border-radius: 10px; background: var(--accent); flex-shrink: 0; }
.swatch.large { width: 64px; height: 64px; border-radius: 16px; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-strong); white-space: nowrap; }
.tag.type-custom_engine { background: #fae8ff; color: #86198f; }
.tag.type-package { background: #ccfbf1; color: #115e59; }
@media (prefers-color-scheme: dark) {
    .tag.type-custom_engine { background: #3b0a3f; color: #f0abfc; }
    .tag.type-package { background: #083b37; color: #5eead4; }
}

.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 48px 0; }

/* Agent page */

.agent-page { padding-top: 24px; }
.back { text-decoration: none; font-size: 0.9375rem; }
.agent-header { display: flex; align-items: center; gap: 20px; margin: 16px 0 28px; }
.agent-header h1 { margin: 4px 0; font-size: clamp(1.5rem, 3.5vw, 2.25rem); line-height: 1.2; }
.agent-header .eyebrow { color: var(--muted); }
.agent-header .lead { color: var(--muted); }

.agent-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 960px) { .agent-layout { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.agent-main, .agent-side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }
@media (min-width: 960px) { .agent-side { position: sticky; top: 84px; } }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.0625rem; margin: 0 0 12px; }
.panel p { margin: 0 0 12px; }
.panel p:last-child { margin-bottom: 0; }

.bullets { margin: 0; padding-left: 20px; }
.bullets li + li { margin-top: 4px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 0.875rem; }
.tool-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 0.9375rem; }

.deploy-buttons { display: flex; flex-direction: column; gap: 8px; }
.button {
    display: block; text-align: center; padding: 11px 16px; border-radius: 10px;
    background: var(--brand); color: #fff; font-weight: 600; text-decoration: none;
}
.button:hover { background: var(--brand-strong); color: #fff; }
@media (prefers-color-scheme: dark) { .button, .button:hover { color: #0b1120; } }

.digest { display: block; word-break: break-all; font-size: 0.8125rem; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }

.versions { width: 100%; border-collapse: collapse; font-size: 0.875rem; display: block; overflow-x: auto; }
.versions th, .versions td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.versions th { color: var(--muted); font-weight: 600; white-space: nowrap; }

/* Verify page */

.prose { max-width: 820px; padding-top: 32px; }
.prose h1 { font-size: clamp(1.5rem, 3.5vw, 2.25rem); margin: 0 0 8px; }
.prose h2 { font-size: 1.25rem; margin: 32px 0 8px; }
.key-facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.key-facts dt { color: var(--muted); }
.key-facts dd { margin: 0; word-break: break-all; }
.code { background: #0f172a; color: #e2e8f0; padding: 16px; border-radius: 10px; overflow-x: auto; font-size: 0.8125rem; line-height: 1.7; white-space: pre; }

@media (max-width: 560px) {
    .filters select { flex: 1 1 100%; }
    .header-nav { gap: 12px; font-size: 0.875rem; }
    .brand span { display: none; }
    .key-facts { grid-template-columns: 1fr; }
    .key-facts dd { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    .card { transition: none; }
    .card:hover { transform: none; }
}
