/* agents.css — /agents/ page only.
   All colour, spacing, and radius tokens come from base.css :root.
   No hex values except what is already in :root. */

/* ─── Active nav link (agents page) ───────────────────────────────── */

.nav-link-active {
    color: var(--accent) !important;
}

/* ─── Page layout ─────────────────────────────────────────────────── */

.agents-page {
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
}

.agents-section {
    max-width: var(--max-w);
    margin: 0 auto;
    padding: var(--space-24) var(--space-6);
}

@media (max-width: 767px) {
    .agents-section {
        padding: 4rem var(--space-4);
    }
}

/* ─── Page header ──────────────────────────────────────────────────── */

.agents-header {
    margin-bottom: var(--space-12);
}

.agents-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0.08em;
    color: var(--ink-muted);
    margin-bottom: var(--space-4);
}

.agents-title {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: var(--space-4);
}

@media (max-width: 767px) {
    .agents-title { font-size: 1.875rem; }
}

.agents-sub {
    font-family: var(--font-sans);
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--ink-muted);
    max-width: 640px;
}

/* ─── Search console (HUD-style agent filter) ─────────────────────── */

.agent-console {
    position: relative;
    margin-bottom: var(--space-10);
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    padding: var(--space-5) var(--space-6) var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background:
        linear-gradient(180deg, rgba(0, 255, 209, 0.035), transparent 42%),
        radial-gradient(120% 140% at 0% 0%, rgba(0, 255, 209, 0.05), transparent 55%),
        var(--bg-elev);
    overflow: hidden;
    isolation: isolate;
}
/* faint dotted-grid texture behind the console */
.agent-console::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
    -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
    pointer-events: none;
    z-index: -1;
}

/* HUD corner brackets */
.console-corner {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 1.5px solid var(--accent);
    opacity: 0.55;
    pointer-events: none;
    z-index: 1;
}
.console-corner--tl { top: 7px;    left: 7px;    border-right: none; border-bottom: none; }
.console-corner--tr { top: 7px;    right: 7px;   border-left: none;  border-bottom: none; }
.console-corner--bl { bottom: 7px; left: 7px;    border-right: none; border-top: none; }
.console-corner--br { bottom: 7px; right: 7px;   border-left: none;  border-top: none; }

/* slow scan sweep */
.console-scan {
    position: absolute;
    top: 0; left: -30%;
    width: 30%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 255, 209, 0.06), transparent);
    pointer-events: none;
    z-index: 0;
    animation: console-sweep 6.5s var(--ease-out) infinite;
}
@keyframes console-sweep {
    0%   { left: -30%; }
    55%, 100% { left: 130%; }
}

/* Input row */
.agent-search-input-wrap {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.35);
    padding: 0 var(--space-4);
    transition: border-color var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-fast) var(--ease-out);
}

.agent-search-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft), 0 0 18px var(--accent-glow);
}

.agent-search-prompt {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--accent);
    user-select: none;
    letter-spacing: -0.02em;
    flex-shrink: 0;
    text-shadow: 0 0 8px var(--accent-glow);
    animation: search-prompt-blink 1.4s step-end infinite;
}

@keyframes search-prompt-blink {
    0%, 100% { opacity: 1; }
    48%, 56%  { opacity: 0.15; }
}

.agent-search-field {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--ink);
    padding: var(--space-4) 0;
    caret-color: var(--accent);
}
.agent-search-field::-webkit-search-cancel-button { display: none; }
.agent-search-field::placeholder { color: var(--ink-subtle); }

/* "/" keyboard hint — hidden once the field is focused or has text */
.agent-search-hint {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    line-height: 1;
    color: var(--ink-muted);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    padding: 3px 7px;
    transition: opacity var(--dur-fast);
}
.agent-search-input-wrap:focus-within .agent-search-hint { opacity: 0; }

.agent-search-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink-muted);
    display: flex;
    align-items: center;
    padding: 2px;
    border-radius: 3px;
    transition: color var(--dur-fast);
    flex-shrink: 0;
}
.agent-search-clear:hover { color: var(--accent); }

.agent-search-readout {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-shrink: 0;
    padding-left: var(--space-3);
    border-left: 1px solid var(--border);
}
.agent-search-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    animation: status-pulse 2s var(--ease-out) infinite;
}
@keyframes status-pulse {
    0%, 100% { opacity: 1;   transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.7); }
}
.agent-search-count {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--ink-muted);
    white-space: nowrap;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* Filter row */
.agent-filter-row {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--space-4) var(--space-6);
}

.agent-filter-group {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.agent-filter-label {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    white-space: nowrap;
    flex-shrink: 0;
    opacity: 0.7;
}
.agent-filter-label::before {
    content: "▚ ";
    opacity: 0.6;
}

.agent-filter-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.agent-filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--ink-muted);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 5px 11px;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    transition: color var(--dur-fast) var(--ease-out),
                background var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out),
                box-shadow var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
}

.pill-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.35;
    flex-shrink: 0;
    transition: opacity var(--dur-fast), box-shadow var(--dur-fast);
}

.agent-filter-pill:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(0, 255, 209, 0.10);
    box-shadow: 0 0 12px var(--accent-glow);
    transform: translateY(-1px);
}
.agent-filter-pill:hover .pill-label { text-shadow: 0 0 8px var(--accent-glow); }
.agent-filter-pill:hover .pill-dot {
    opacity: 1;
    background: var(--accent);
    box-shadow: 0 0 7px var(--accent);
}

.agent-filter-pill.is-active {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-soft);
    box-shadow: 0 0 14px var(--accent-glow), inset 0 0 12px rgba(0, 255, 209, 0.06);
}
.agent-filter-pill.is-active .pill-dot {
    opacity: 1;
    background: var(--accent);
    box-shadow: 0 0 7px var(--accent);
}

/* Card filter animation */
.agent-card.is-filtered-out {
    opacity: 0;
    transform: scale(0.94);
    pointer-events: none;
}

/* Empty state */
.agents-empty {
    grid-column: 1 / -1;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--ink-muted);
    padding: var(--space-16) 0 var(--space-12);
    text-align: center;
}

.agents-empty-prompt {
    color: var(--accent);
    opacity: 0.6;
}

@media (prefers-reduced-motion: reduce) {
    .console-scan, .agent-search-prompt, .agent-search-status { animation: none; }
}

@media (max-width: 767px) {
    .agent-console {
        margin-bottom: var(--space-8);
        padding: var(--space-4) var(--space-4) var(--space-5);
        gap: var(--space-4);
    }
    .agent-filter-row {
        gap: var(--space-3) var(--space-4);
    }
    .agent-filter-group {
        gap: var(--space-2);
        width: 100%;
    }
    .agent-filter-label {
        width: 100%;
    }
}

/* ─── Card grid ────────────────────────────────────────────────────── */

.agents-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 32px;
    opacity: 0;
}

.agents-grid.is-visible {
    opacity: 1;
}

@media (max-width: 767px) {
    .agents-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* ─── Agent card ───────────────────────────────────────────────────── */

.agent-card {
    min-height: 360px;
    padding: 24px 24px 20px 24px;
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    cursor: pointer;
    transition:
        border-color var(--dur-fast) var(--ease-out),
        box-shadow var(--dur-base) var(--ease-out),
        transform 0.25s var(--ease-out),
        opacity 0.25s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
    text-decoration: none;
    color: inherit;
}

.agent-card:hover {
    border-color: var(--accent);
    box-shadow: 0 8px 24px var(--accent-glow);
    transform: translateY(-2px);
}

.agent-card:focus-visible {
    outline: 2px solid var(--accent-glow);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .agent-card { transition: border-color var(--dur-fast) var(--ease-out); }
    .agent-card:hover { transform: none; box-shadow: none; }
}

/* Card meta row (status + role) */
.agent-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.agent-card-status {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 4px;
    padding: 1px 6px;
    line-height: 1.6;
    white-space: nowrap;
}

.agent-card-role {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Card name (h2) */
.agent-card-name {
    font-family: var(--font-mono);
    font-size: 1.25rem;
    font-weight: 500;
    line-height: 1.2;
    letter-spacing: -0.005em;
    color: var(--ink);
    position: relative;
    display: inline-block;
    padding-bottom: 3px;
}

.agent-card-name::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--accent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--dur-fast) var(--ease-out);
}

.agent-card:hover .agent-card-name::after { transform: scaleX(1); }

/* Card headline + description */
.agent-card-headline {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--ink);
}

.agent-card-desc {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--ink-muted);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* Value row */
.agent-card-value-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3) 0;
    border-top: 1px solid var(--border);
}

.agent-value-label {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--accent);
    margin: 0;
}

.agent-value-text {
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 400;
    line-height: 1.55;
    color: var(--ink-muted);
    margin: 0;
}

/* Legacy header/title selectors (kept for compat) */
.agent-card-header { display: flex; flex-direction: column; gap: var(--space-2); }

.agent-card-tagline {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--ink-muted);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Stack chips */
.agent-stack {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.agent-chip {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 24px;
    letter-spacing: 0.04em;
    padding: 0 10px;
    height: 24px;
    border: 1px solid var(--accent);
    border-radius: 999px;
    background: var(--accent-soft);
    color: var(--accent);
    white-space: nowrap;
    transition:
        border-color 120ms var(--ease-out),
        color 120ms var(--ease-out),
        background 120ms var(--ease-out);
}

.agent-card:hover .agent-chip {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

/* Diagram pane */
.agent-diagram-pane {
    flex: 1;
    width: 100%;
    aspect-ratio: 16 / 10;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agent-diagram-pane img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.agent-diagram-loading {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-subtle);
    text-align: center;
}

/* Card footer */
.agent-card-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-top: var(--space-2);
    border-top: 1px solid var(--border);
}

.agent-open-btn {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 32px;
    letter-spacing: 0.08em;
    color: var(--accent);
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    -webkit-tap-highlight-color: transparent;
    transition: gap var(--dur-fast) var(--ease-out);
}

.agent-open-btn:hover { gap: 10px; }

.agent-open-btn svg {
    transition: transform var(--dur-fast) var(--ease-out);
}

.agent-open-btn:hover svg { transform: translateX(2px); }

/* ─── Deep-dive dialog ─────────────────────────────────────────────── */

.agent-deepdive {
    width: min(1120px, 92vw);
    max-height: min(720px, 88vh);
    padding: 32px;
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    background: var(--bg-elev);
    color: var(--ink);
    overflow: hidden;
    display: grid;
    grid-template-columns: 60fr 40fr;
    gap: 32px;
    opacity: 0;
    transform: translateY(24px);
}

.agent-deepdive[open] {
    display: grid;
}

.agent-deepdive::backdrop {
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

@media (max-width: 767px) {
    .agent-deepdive {
        width: 96vw;
        max-height: 92vh;
        padding: 20px;
        grid-template-columns: 1fr;
        overflow-y: auto;
    }
}

/* Deep-dive diagram side */
.deepdive-diagram {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    min-height: 0;
}

.deepdive-diagram-img {
    flex: 1;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    object-fit: contain;
    cursor: zoom-in;
    min-height: 0;
}

/* Deep-dive info side */
.deepdive-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    overflow-y: auto;
    min-height: 0;
    padding-right: 4px;
}

.deepdive-info::-webkit-scrollbar { width: 3px; }
.deepdive-info::-webkit-scrollbar-track { background: transparent; }
.deepdive-info::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }

.deepdive-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
}

.deepdive-title {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 500;
    line-height: 1.2;
    color: var(--ink);
}

.deepdive-close {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink-muted);
    cursor: pointer;
    transition:
        border-color var(--dur-fast) var(--ease-out),
        color var(--dur-fast) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.deepdive-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Body paragraphs */
.deepdive-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.deepdive-body p {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.65;
    color: var(--ink);
}

.deepdive-body strong {
    color: #ffffff;
    font-weight: 500;
}

/* Traits table */
.deepdive-traits { border-top: 1px solid var(--border); }

.deepdive-trait {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    height: 36px;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
}

.deepdive-trait-key {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
    white-space: nowrap;
}

.deepdive-trait-val {
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--ink);
    text-align: right;
}

/* Try-it links */
.deepdive-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
}

.deepdive-link {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    transition:
        border-color var(--dur-fast) var(--ease-out),
        background var(--dur-fast) var(--ease-out);
}

.deepdive-link:hover,
.deepdive-link--btn:hover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.deepdive-link--btn {
    cursor: pointer;
    background: transparent;
}


/* Page transition styles are injected by page-transition.js (self-contained). */

/* ─── Full-screen agent panel ──────────────────────────────────────── */

/* Hide the chat widget on the agents page by default */
.agents-page .agent-widget-host {
    visibility: hidden;
    pointer-events: none;
}

/* Show the chat widget on top of the Atlas panel when it's open */
[data-deep-dive-open] .agent-widget-host {
    visibility: visible;
    pointer-events: auto;
    z-index: 1010;
}

.agent-panel-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: none;
    opacity: 0;
    /* overflow lives on .agent-panel-scroll so GSAP's opacity animation
       on this element never breaks Android Chrome scroll hit-testing */
}

.agent-panel-overlay.is-open {
    display: block;
}

/* Scroll root — plain div, no GSAP animations, owns the scroll context */
.agent-panel-scroll {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* Explicitly allow vertical pan so browser never suppresses it */
    touch-action: pan-y;
}

.agent-panel-inner {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px 48px;
}

/* Single-column body: diagram full-width, content below.
   IMPORTANT: `.agent-panel-body` is ALSO a chat-widget class (components.css),
   whose rule sets overflow-y:scroll + flex:1 1 auto. That bleeds onto this
   deep-dive panel and creates a second, non-scrollable scroll container that
   swallows touch-pan on mobile (the real "deep dive won't scroll" bug).
   Explicitly reset so the ONLY scroll context is .agent-panel-scroll. */
.agent-panel-body {
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow: visible;
    flex: initial;
    min-height: 0;
    padding: 0 0 48px;
}

@media (max-width: 767px) {
    .agent-panel-inner { padding: 0 16px; }
}

/* Sticky panel header */
.agent-panel-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: 16px 0 12px;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    margin-bottom: var(--space-6);
}

.agent-panel-hdr-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.agent-panel-close {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--ink-muted);
    cursor: pointer;
    padding: 0;
    transition:
        border-color var(--dur-fast) var(--ease-out),
        color var(--dur-fast) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.agent-panel-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Panel title block */
.agent-panel-title-block {
    margin-bottom: var(--space-8);
}

.agent-panel-name {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--ink);
    margin-bottom: var(--space-3);
}

@media (max-width: 767px) {
    .agent-panel-name { font-size: 1.5rem; }
}

.agent-panel-subtitle {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--ink-muted);
    margin-bottom: var(--space-2);
    letter-spacing: 0.02em;
}

.agent-panel-headline {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.6;
    color: var(--ink-muted);
}

/* Panel sections */
.agent-panel-section {
    margin-bottom: var(--space-8);
}

.agent-panel-eyebrow {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0.08em;
    color: var(--ink-subtle);
    margin-bottom: var(--space-4);
}

/* Full-width diagram wrapper (inline SVG + img fallback) */
.agent-panel-diagram-wrap {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    overflow: hidden;
    position: relative;
}

.agent-panel-diagram-wrap svg,
.agent-panel-diagram-wrap img {
    width: 100%;
    height: auto;
    display: block;
}

/* img fallback */
.agent-panel-diagram {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    display: block;
}

/* Expand / fullscreen button */
.agent-diag-expand {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.72);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    color: var(--ink-muted);
    cursor: pointer;
    padding: 0;
    transition:
        border-color var(--dur-fast) var(--ease-out),
        color var(--dur-fast) var(--ease-out),
        background var(--dur-fast) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.agent-diag-expand:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(0, 255, 209, 0.08);
}

/* ─── Diagram fullscreen overlay ─────────────────────────────────── */

.agent-diag-fs {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 32px;
}

/* `> svg` targets ONLY the cloned diagram (direct child), never the close
   button's icon svg (a grandchild) — that broad match blew the close icon
   up to 640px (the "giant grey X" bug). */
.agent-diag-fs > svg {
    width: auto;
    height: auto;
    max-width: calc(100vw - 64px);
    max-height: calc(100vh - 80px);
    display: block;
}

/* Defensive: pin the close-button icon regardless of any diagram svg rule */
.agent-diag-fs-close svg {
    width: 18px;
    height: 18px;
    flex: none;
}

.agent-diag-fs-close {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2001;
    height: 36px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--ink-muted);
    background: rgba(0, 0, 0, 0.72);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    cursor: pointer;
    transition:
        border-color var(--dur-fast) var(--ease-out),
        color var(--dur-fast) var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.agent-diag-fs-close:hover {
    border-color: var(--accent);
    color: var(--accent);
}
/* Mobile fullscreen rules live in the consolidated < 768 px block below. */

/* Numbered steps */
.agent-steps {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--border);
}

.agent-step {
    display: grid;
    grid-template-columns: 36px 1fr;
    gap: var(--space-4);
    padding: var(--space-6) 0;
    border-bottom: 1px solid var(--border);
    align-items: start;
}

.agent-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-strong);
    background: var(--bg-card);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--ink-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.agent-step-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.agent-step-label {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--ink);
}

.agent-step-detail {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.65;
    color: var(--ink-muted);
}

/* Tech decisions */
.agent-tech-item {
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.agent-tech-item:first-child {
    border-top: 1px solid var(--border);
}

.agent-tech-name {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--accent);
}

.agent-tech-why {
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.65;
    color: var(--ink-muted);
}

/* Traits table */
.agent-traits-table {
    border-top: 1px solid var(--border);
}

.agent-trait-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    height: 40px;
    padding: 0;
    border-bottom: 1px solid var(--border);
}

.agent-trait-key {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-muted);
    white-space: nowrap;
}

.agent-trait-val {
    font-family: var(--font-mono);
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
    color: var(--ink);
    text-align: right;
}

/* Panel links section — pinned outside the scroll container, always visible */
.agent-panel-links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 2;
}

.demo-btn-row {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.demo-try-btn,
.demo-watch-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    font-family: var(--font-mono);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink);
    background: transparent;
    border: 1.5px solid var(--ink);
    border-radius: var(--radius-md);
    cursor: pointer;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: background 180ms, border-color 180ms;
}
.demo-try-btn:hover,
.demo-watch-btn:hover {
    background: var(--border-strong);
    border-color: var(--ink);
}
.demo-play-icon {
    font-size: 1rem;
    line-height: 1;
}

/* Video lightbox modal */
.video-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0,0,0,0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 250ms;
}
.video-modal-overlay.video-modal-visible { opacity: 1; }
.video-modal-wrap {
    position: relative;
    width: min(90vw, 1100px);
    background: #000;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.video-modal-player {
    width: 100%;
    display: block;
    max-height: 80vh;
    border-radius: var(--radius-lg);
}
.video-modal-close {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 10;
    background: rgba(0,0,0,0.65);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms;
}
.video-modal-close:hover { background: rgba(255,255,255,0.15); }

.video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: rgba(0,0,0,0.35);
    border-radius: var(--radius-lg);
    transition: background 150ms;
}
.video-play-overlay:hover { background: rgba(0,0,0,0.2); }
.video-play-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(0,255,209,0.15);
    border: 2px solid var(--color-accent);
    color: var(--color-accent);
    font-size: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 4px;
    transition: transform 150ms, background 150ms;
}
.video-play-overlay:hover .video-play-btn {
    transform: scale(1.08);
    background: rgba(0,255,209,0.25);
}

/* ─── "More coming" teaser tile ────────────────────────────────────── */

.agents-teaser {
    grid-column: 1 / -1;
    padding: 24px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--ink-subtle);
}

.agents-teaser-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.agents-teaser-text {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--ink-subtle);
}

/* ─── Footer ───────────────────────────────────────────────────────── */

.agents-footer {
    margin-top: var(--space-24);
    padding-top: var(--space-8);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.agents-footer-copy {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--ink-subtle);
}

.agents-footer-back {
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: gap var(--dur-fast) var(--ease-out);
}

.agents-footer-back:hover { gap: 10px; }

/* ─── Mobile optimisations (< 768 px) ─────────────────────────────── */

@media (max-width: 767px) {

    /* ── Agent card: show diagram thumbnail at compact height ────────── */
    .agent-diagram-pane {
        flex: none;
        height: 160px;
        aspect-ratio: unset;
    }

    /* ── Panel overlay: fix iOS scroll ──────────────────────────────── */
    /* body is frozen via position:fixed in JS; overlay scrolls freely  */
    .agent-panel-overlay {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    /* ── Panel diagram: pinch-to-zoom in place (no fullscreen on mobile) ── */
    .agent-panel-diagram-wrap {
        overflow: hidden;
    }

    .agent-panel-diagram-wrap svg,
    .agent-panel-diagram-wrap img {
        width: 100% !important;
        height: auto !important;
        min-width: unset;
        /* Default pan-y keeps the <img> fallback scrolling; enablePinchZoom()
           overrides the inline-SVG case to touch-action:none in JS. */
        touch-action: pan-y;
    }

    /* Fullscreen expand is hidden on mobile — pinch-zoom replaces it. */
    .agent-diag-expand { display: none; }

    /* Zoom hint pill — fades out on first touch */
    .agent-diag-zoom-hint {
        position: absolute;
        left: 50%;
        bottom: 8px;
        transform: translateX(-50%);
        z-index: 2;
        padding: 4px 10px;
        font-family: var(--font-mono);
        font-size: 0.6875rem;
        letter-spacing: 0.04em;
        color: var(--ink-muted);
        background: rgba(0, 0, 0, 0.66);
        border: 1px solid var(--border-strong);
        border-radius: 999px;
        pointer-events: none;
        white-space: nowrap;
        transition: opacity var(--dur-base) var(--ease-out);
    }
    .agent-diag-zoom-hint.is-hidden { opacity: 0; }

    /* Subtle accent ring while actively zoomed in */
    .agent-panel-diagram-wrap.is-zoomed {
        border-color: var(--accent);
    }

    /* ── Fullscreen diagram: block scroll container (not flex) ──────────── */
    /* flex + overflow:auto breaks scroll on Android Chrome; block does not. */
    .agent-diag-fs {
        display: block;
        padding: 0;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-x pan-y;
    }

    /* `> svg` = diagram only (never the close-button icon). 640 px wide →
       labels legible on high-DPI; pan left/right and up/down to read.       */
    .agent-diag-fs > svg {
        display: block;
        min-width: 640px;
        width: 640px !important;
        height: auto !important;
        max-width: none;
        max-height: none;
        min-height: unset;
        touch-action: pan-x pan-y;
        /* top margin clears the fixed Exit button; sides give breathing room */
        margin: 64px 24px 40px;
    }

    /* ── Traits table: allow wrapping on narrow screens ─────────────── */
    .agent-trait-row {
        height: auto;
        min-height: 40px;
        padding: 10px 0;
        align-items: flex-start;
        flex-wrap: wrap;
        gap: var(--space-2);
    }

    .agent-trait-key { flex: 0 0 100%; }

    .agent-trait-val {
        text-align: left;
        font-size: 0.875rem;
        flex: 0 0 100%;
    }

    /* ── Panel body: surface quick info before the diagram ──────────── */
    .agent-panel-body { display: flex; flex-direction: column; }

    /* title → diagram overview → traits → how it works → stack → links */
    .agent-panel-title-block                            { order: 1; }
    .agent-panel-section:has(.agent-panel-diagram-wrap) { order: 2; }
    .agent-panel-section:has(.agent-traits-table)       { order: 3; }
    .agent-panel-section:has(.agent-steps)              { order: 4; }
    .agent-panel-section:has(.agent-tech-item)          { order: 5; }
    .agent-panel-links                                  { order: 6; }

    .agent-step-detail { font-size: 0.875rem; }
    .agent-tech-why    { font-size: 0.875rem; }
}
