/* Engineering graph pages (2026-11): Home, MBEstudio (/capabilities), Direction,
   Agents and About. Colour comes from the site tokens in site.css; this file
   adds the page components and a dark rendering of the same tokens for
   visitors whose system is set to dark. Pages opt in with body.gx. */

body.gx {
  --gx-accent: #b4481e;
  --gx-accent-ink: #8f3714;
  --gx-accent-soft: #fbf0ea;
  --gx-ok: #1f7a4d;
  --gx-ok-soft: #e7f4ec;
  --gx-dev: #8a5a00;
  --gx-dev-soft: #fbf1dc;
  --gx-road: #4b5563;
  --gx-road-soft: #eef0f3;
  --gx-node: #ffffff;
  --gx-edge: #c9ced4;
}

@media (prefers-color-scheme: dark) {
  body.gx.theme-light,
  body.gx.page-home {
    --fg-rgb: 236 238 241;
    --bg-rgb: 14 16 20;
    --muted-rgb: 160 166 175;
    --shadow-rgb: 0 0 0;
    --on-accent: #ffffff;
    --bg-0: #0e1014;
    --bg-1: #0e1014;
    --bg-2: #15181d;
    --bg-3: #1b1f25;
    --bg-4: #232830;
    --border-1: #2a2f37;
    --border-2: #2a2f37;
    --border-3: #3a404a;
    --text-1: #eceef1;
    --text-2: #d5d9de;
    --text-3: #b3b9c1;
    --text-4: #9aa1ab;
    --text-5: #858c96;
    --mint-300: #f0a07c;
    --mint-400: #e98a5f;
    --mint-500: #e98a5f;
    --mint-600: #f0a07c;
    --slate-50: #eceef1;
    --slate-100: #e2e5e9;
    --slate-200: #d5d9de;
    --slate-300: #b3b9c1;
    --slate-400: #9aa1ab;
    --slate-500: #8b929c;
    --slate-600: #6f7680;
    --slate-700: #3a404a;
    --slate-800: #1f232a;
    --slate-850: #1b1f25;
    --slate-900: #15181d;
    --slate-950: #0e1014;
    --ed-rule: #2a2f37;
    --ed-rule-strong: #3a404a;
    --ed-surface: #15181d;
    --ed-surface-hover: #221a16;

    --gx-accent: #e98a5f;
    --gx-accent-ink: #f0a07c;
    --gx-accent-soft: #2a1c15;
    --gx-ok: #6fcf97;
    --gx-ok-soft: #13271c;
    --gx-dev: #f2c063;
    --gx-dev-soft: #2b2312;
    --gx-road: #b3b9c1;
    --gx-road-soft: #20242b;
    --gx-node: #15181d;
    --gx-edge: #4a515c;

    background-color: #0e1014;
    color: var(--text-3);
    color-scheme: dark;
  }
  body.gx .landing-nav,
  body.gx .topnav,
  body.gx .topnav__menu,
  body.gx .site-footer--landing {
    background: #0e1014;
    border-color: var(--border-2);
  }
  body.gx .landing-nav a,
  body.gx .topnav__links a,
  body.gx .site-footer--landing a { color: var(--text-2); }
  body.gx .landing-nav__brand span { color: var(--text-1); }
}

/* Layout */
.gx-main { color: var(--text-3); }
.gx-wrap { max-width: 1120px; margin-inline: auto; padding-inline: 24px; }
.gx-read { max-width: 720px; }
@media (max-width: 640px) { .gx-wrap { padding-inline: 16px; } }

.gx-hero { padding: clamp(56px, 9vw, 112px) 0 clamp(32px, 5vw, 56px); }
.gx-hero h1 {
  color: var(--text-1);
  font-size: clamp(2.2rem, 5.2vw, 3.9rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 600;
  margin: 14px 0 20px;
  max-width: 20ch;
}
.gx-kicker {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gx-accent-ink);
  margin: 0;
}
.gx-lede { font-size: clamp(1.05rem, 1.4vw, 1.2rem); line-height: 1.65; color: var(--text-3); max-width: 64ch; margin: 0; }
.gx-lede + .gx-lede { margin-top: 14px; }

.gx-section { padding: clamp(44px, 6vw, 72px) 0; border-top: 1px solid var(--border-2); }
.gx-section h2 {
  color: var(--text-1);
  font-size: clamp(1.55rem, 3.2vw, 2.2rem);
  line-height: 1.18;
  letter-spacing: -0.025em;
  font-weight: 600;
  margin: 10px 0 16px;
  max-width: 30ch;
}
.gx-section h3 { color: var(--text-1); font-size: 1.05rem; font-weight: 600; margin: 0 0 8px; line-height: 1.35; }
.gx-section p { line-height: 1.7; }
.gx-section > .gx-wrap > p { max-width: 68ch; }

.gx-actions { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-top: 28px; }
.gx-link { font-weight: 600; color: var(--gx-accent-ink); }

/* Cards */
.gx-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin-top: 24px; }
.gx-card { border: 1px solid var(--border-2); border-radius: 12px; padding: 20px; background: var(--bg-2); min-width: 0; }
.gx-card p { margin: 0; font-size: 0.95rem; }
.gx-card p + p { margin-top: 10px; }
.gx-card .gx-status { margin-bottom: 10px; }

/* Ordered steps */
.gx-steps { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; counter-reset: gx; }
.gx-steps > li { counter-increment: gx; display: grid; grid-template-columns: 2.25rem 1fr; gap: 4px 14px; padding: 18px 20px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--bg-2); }
.gx-steps > li::before {
  content: counter(gx);
  grid-row: 1 / span 3;
  width: 2rem; height: 2rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--gx-accent-soft); color: var(--gx-accent-ink);
  font-weight: 600; font-size: 0.9rem;
}
.gx-steps h3 { margin: 4px 0 4px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.gx-steps p { margin: 0; font-size: 0.95rem; }

/* Status labels */
.gx-status {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap; line-height: 1.5;
}
.gx-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.gx-status--ok { color: var(--gx-ok); background: var(--gx-ok-soft); }
.gx-status--dev { color: var(--gx-dev); background: var(--gx-dev-soft); }
.gx-status--road { color: var(--gx-road); background: var(--gx-road-soft); }

/* Traceability chain */
.gx-chain { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; }
.gx-chain > li { position: relative; padding: 16px; border: 1px solid var(--border-2); background: var(--bg-2); min-width: 0; }
.gx-chain > li + li { border-left: 0; }
.gx-chain > li:first-child { border-radius: 12px 0 0 12px; }
.gx-chain > li:last-child { border-radius: 0 12px 12px 0; }
.gx-chain__type { display: block; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--gx-accent-ink); margin-bottom: 6px; }
.gx-chain__id { display: block; font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 0.78rem; color: var(--text-4); margin-bottom: 6px; overflow-wrap: anywhere; }
.gx-chain p { margin: 0; font-size: 0.9rem; line-height: 1.5; color: var(--text-2); }
.gx-chain__verdict { color: var(--gx-ok); font-weight: 600; }
@media (max-width: 900px) {
  .gx-chain { grid-template-columns: 1fr; }
  .gx-chain > li + li { border-left: 1px solid var(--border-2); border-top: 0; }
  .gx-chain > li:first-child { border-radius: 12px 12px 0 0; }
  .gx-chain > li:last-child { border-radius: 0 0 12px 12px; }
}
.gx-note { font-size: 0.85rem; color: var(--text-4); margin-top: 12px; }

/* Diagram */
.gx-figure { margin: 28px 0 0; }
.gx-figure svg { display: block; width: 100%; height: auto; max-width: 880px; margin-inline: auto; }
.gx-figure figcaption { font-size: 0.85rem; color: var(--text-4); text-align: center; margin-top: 12px; }
.gx-svg-node { fill: var(--gx-node); stroke: var(--gx-edge); stroke-width: 1.5; }
.gx-svg-core { fill: var(--gx-accent-soft); stroke: var(--gx-accent); stroke-width: 2; }
.gx-svg-edge { stroke: var(--gx-edge); stroke-width: 1.5; fill: none; }
.gx-svg-edge--back { stroke: var(--gx-accent); stroke-dasharray: 5 5; }
.gx-svg-title { fill: var(--text-1); font: 600 15px/1 var(--font-body, system-ui, sans-serif); }
.gx-svg-core-title { fill: var(--gx-accent-ink); font: 600 18px/1 var(--font-body, system-ui, sans-serif); }
.gx-svg-sub { fill: var(--text-4); font: 400 12px/1 var(--font-body, system-ui, sans-serif); }

/* Tables */
.gx-table-wrap { overflow-x: auto; border: 1px solid var(--border-2); border-radius: 12px; margin-top: 24px; }
.gx-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.gx-table th, .gx-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border-2); vertical-align: top; }
.gx-table tr:last-child td { border-bottom: 0; }
.gx-table th { color: var(--text-1); font-weight: 600; background: var(--bg-3); }
.gx-table td:first-child { color: var(--text-1); font-weight: 600; }
@media (max-width: 640px) {
  .gx-table thead { display: none; }
  .gx-table, .gx-table tbody, .gx-table tr, .gx-table td { display: block; width: 100%; }
  .gx-table tr { border-bottom: 1px solid var(--border-2); padding: 10px 0; }
  .gx-table tr:last-child { border-bottom: 0; }
  .gx-table td { border: 0; padding: 4px 16px; }
}

/* Capability groups */
.gx-cap { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.gx-cap > li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; align-items: start; padding: 16px 18px; border: 1px solid var(--border-2); border-radius: 12px; background: var(--bg-2); }
.gx-cap h3 { margin: 0; }
.gx-cap p { grid-column: 1 / -1; margin: 0; font-size: 0.93rem; }
@media (max-width: 520px) { .gx-cap > li { grid-template-columns: 1fr; } .gx-cap .gx-status { justify-self: start; grid-row: 1; } }

/* Format pills */
.gx-pills { list-style: none; padding: 0; margin: 20px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.gx-pills li { border: 1px solid var(--border-2); border-radius: 999px; padding: 6px 12px; font-size: 0.88rem; color: var(--text-2); background: var(--bg-2); }

/* Video slot */
.gx-video { margin-top: 24px; border: 1px solid var(--border-2); border-radius: 12px; overflow: hidden; background: var(--bg-3); aspect-ratio: 16 / 9; display: grid; place-items: center; }
.gx-video video { width: 100%; height: 100%; display: block; }
.gx-video__empty { padding: 24px; text-align: center; font-size: 0.95rem; color: var(--text-4); max-width: 46ch; }

/* Timeline */
.gx-timeline { list-style: none; padding: 0; margin: 24px 0 0; border-left: 2px solid var(--border-3); }
.gx-timeline > li { position: relative; padding: 0 0 22px 22px; }
.gx-timeline > li:last-child { padding-bottom: 0; }
.gx-timeline > li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--bg-1); border: 2px solid var(--gx-accent); }
.gx-timeline > li:last-child::before { background: var(--gx-accent); }
.gx-timeline p { margin: 4px 0 0; }

.gx-main code { overflow-wrap: anywhere; }

/* Diagram: wide layout above 640px, stacked layout on phones */
.gx-diagram--tall { display: none !important; max-width: 420px !important; }
@media (max-width: 640px) {
  .gx-diagram--wide { display: none !important; }
  .gx-diagram--tall { display: block !important; }
}

/* Home page: the page-home palette in dark */
@media (prefers-color-scheme: dark) {
  body.gx.page-home {
    --ph-bg: #0e1014;
    --ph-ink: #eceef1;
    --ph-ink-2: #b3b9c1;
    --ph-line: rgba(255, 255, 255, 0.1);
    --ph-code-bg: #15181d;
    --ph-accent-soft: #1d2033;
    --ph-accent: #a5b4fc;
    --ph-accent-strong: #c7d2fe;
    background-color: #0e1014;
    color: #eceef1;
  }
  body.gx.page-home::before { background: #0e1014; }
}

/* Headings on the new pages win over the shared light-theme heading rules */
html body.gx main .gx-hero h1 { font-family: inherit; color: var(--text-1); }
html body.gx main .gx-section h2 { color: var(--text-1); }
html body.gx.page-home main .gx-section h2,
html body.gx.page-home main .gx-section h3 { color: var(--ph-ink); }
html body.gx.page-home main .gx-section p { color: var(--ph-ink-2); }

/* Paragraph rhythm: the shared reset zeroes paragraph margins */
html body.gx main .gx-section p + p,
html body.gx main .gx-section p + .gx-grid,
html body.gx main .gx-section p + .gx-cap { margin-top: 14px; }
html body.gx main .gx-section .gx-wrap > p,
html body.gx main .gx-hero .gx-lede { max-width: 68ch; }
html body.gx .ag-main p + p { margin-top: 14px; }
html body.gx.theme-light:not(.page-home) main.gx-main a:not(.btn-primary):not(.btn-secondary) { color: var(--gx-accent-ink); }

/* Four link cards sit in one row on desktop, two by two on tablets */
.gx-grid--4 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }

/* Dark mode: surfaces site.css hard-codes as light colours */
@media (prefers-color-scheme: dark) {
  html body.gx code,
  html body.gx .cli-inline { background: var(--bg-4); color: var(--text-1); }
  html body.gx pre code,
  html body.gx .ag-code-card pre code { background: transparent; color: var(--text-1); }
  html body.gx .landing-nav.topnav .topnav__links a:hover,
  html body.gx .landing-nav.topnav .topnav__links a[aria-current="page"] { background: #2a1c15; color: var(--text-1); }
  html body.gx .topnav__menu,
  html body.gx .topnav__toggle { background: #0e1014; color: var(--text-1); border-color: var(--border-2); }
  html body.gx main .paper, html body.gx main .paper--tight, html body.gx main .card { background: var(--bg-2); border-color: var(--border-2); }
}

/* Flat, typographic components (2026-11-24): no pills, dots or circles */
.gx-status { padding: 0; border-radius: 0; background: none !important; font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.7rem; letter-spacing: 0.06em; gap: 0; }
.gx-status::before { content: none; display: none; }
.gx-status + .gx-status::before { content: "/"; display: inline; color: var(--text-5); margin: 0 8px; }
.gx-steps > li { border-radius: 6px; }
.gx-steps > li::before {
  content: counter(gx, decimal-leading-zero);
  width: auto; height: auto; border-radius: 0; background: none;
  display: block; padding-top: 5px;
  font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.8rem; font-weight: 500;
  color: var(--gx-accent-ink);
}
.gx-timeline { border-left: 1px solid var(--border-3); }
.gx-timeline > li::before { left: -1px; top: 10px; width: 12px; height: 1px; border: 0; border-radius: 0; background: var(--gx-accent); }
.gx-timeline > li:last-child::before { background: var(--gx-accent); }
.gx-pills { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0; border-top: 1px solid var(--border-2); border-left: 1px solid var(--border-2); }
.gx-pills li { border: 0; border-right: 1px solid var(--border-2); border-bottom: 1px solid var(--border-2); border-radius: 0; background: none; padding: 12px 14px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.8rem; }
.gx-card, .gx-cap > li, .gx-table-wrap, .gx-video { border-radius: 6px; }
.gx-chain > li:first-child { border-radius: 6px 0 0 6px; }
.gx-chain > li:last-child { border-radius: 0 6px 6px 0; }
@media (max-width: 900px) {
  .gx-chain > li:first-child { border-radius: 6px 6px 0 0; }
  .gx-chain > li:last-child { border-radius: 0 0 6px 6px; }
}

/* Homepage 3D preview */
.gx-viewer { margin: 28px 0 0; border: 1px solid var(--border-2); border-radius: 6px; overflow: hidden; background: #111418; }
.gx-viewer__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 10px 14px; background: #15181d; border-bottom: 1px solid #2a2f37; color: #d5d9de; font-size: 0.85rem; }
.gx-viewer__bar label { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.75rem; letter-spacing: 0.04em; text-transform: uppercase; color: #9aa1ab; }
.gx-viewer__bar select { font: inherit; font-family: var(--font-sans, system-ui); text-transform: none; letter-spacing: 0; font-size: 0.875rem; color: #eceef1; background: #0e1014; border: 1px solid #3a404a; border-radius: 4px; padding: 6px 8px; }
html body .gx-viewer__bar a { color: #f0a07c; font-weight: 500; }
.gx-viewer__stage { position: relative; aspect-ratio: 1600 / 853; min-height: 240px; background: radial-gradient(ellipse 70% 60% at 50% 55%, #1d2128 0%, #111418 70%); }
.gx-viewer__stage model-viewer { display: block; width: 100%; height: 100%; background: transparent; --poster-color: transparent; }
.gx-viewer__stage img[slot="poster"] { width: 100%; height: 100%; object-fit: contain; display: block; }
.gx-viewer__note { margin: 0; padding: 10px 14px; border-top: 1px solid #2a2f37; background: #15181d; color: #9aa1ab; font-size: 0.8rem; }
@media (max-width: 640px) { .gx-viewer__stage { min-height: 0; } }
.gx-viewer__title { font-family: var(--font-mono, ui-monospace, monospace); font-size: 0.75rem; letter-spacing: 0.04em; color: #9aa1ab; }
@media (prefers-color-scheme: dark) {
  html body.gx .kicker, html body.gx.page-home .kicker { color: var(--gx-accent-ink) !important; }
}
@media (prefers-color-scheme: dark) {
  html body.gx .ag-mode, html body.gx .ag-mode:hover { background: var(--bg-2) !important; border-color: var(--border-2) !important; color: var(--text-2); }
  html body.gx .ag-mode h3 { color: var(--text-1); }
  html body.gx .site-skip-link, html body.gx .skip-link { background: #eceef1; color: #0e1014; }
}
@media (prefers-color-scheme: dark) {
  html body.gx.page-home main a.gx-link,
  html body.gx.page-home main .gx-card a,
  html body.gx.page-home main .gx-section p a { color: #f0a07c !important; }
}
.gx-status + .gx-status::before { content: none; display: none; }
.gx-steps h3 .gx-status, .gx-timeline h3 .gx-status { margin-left: 0; }
