/* ===================================================================
   AgentTune v2 — Conversational Design
   Warm cream + terracotta. Chat-interface conceit. Geist typography.
   =================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&display=swap");

:root {
  /* Base palette */
  --bg: #f6f3ef;
  --surface: #ffffff;
  --ink: #1e1d1a;
  --muted: #7a7468;
  --border: #e3ddd1;
  --border-soft: #f0eadd;
  --accent: #c8553d;
  --ai-bubble: #efe9df;
  --system-tint: #f6f3ef;

  /* System colors */
  --sys-mbti: #5b4dc0;
  --sys-enneagram: #2f8a5b;
  --sys-disc: #d99632;
  --sys-attachment: #e07a8a;
  --sys-ocean: #3a72c4;
  --sys-souls: #c8553d;

  /* MBTI group colors */
  --group-nt: #5b4dc0;
  --group-nf: #2f8a5b;
  --group-sj: #3a72c4;
  --group-sp: #c8553d;

  /* Attachment style colors */
  --attach-secure: #2f8a5b;
  --attach-anxious: #e07a8a;
  --attach-avoidant: #3a72c4;
  --attach-disorganized: #7a4ac8;

  /* Typography */
  --font-sans: "Geist", "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "SF Mono", Menlo, Consolas, monospace;

  /* Spacing */
  --content-max: 1280px;
  --content-pad: 64px;
  --content-pad-y: 44px;

  --radius-card: 14px;
  --radius-card-lg: 16px;
  --radius-pill: 100px;
  --radius-bubble: 16px;
}

/* ---------------------------------------------------------------
   Base
---------------------------------------------------------------- */

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  font-size: inherit;
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
}

em, i { font-style: italic; }
strong, b { font-weight: 600; }

code { font-family: var(--font-mono); font-size: 0.92em; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--muted); }
.ink { color: var(--ink); }
.accent { color: var(--accent); }

/* ---------------------------------------------------------------
   Layout
---------------------------------------------------------------- */

.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--content-pad-y) var(--content-pad) 64px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 48px 0;
}

.divider.tight { margin: 36px 0; }

/* ---------------------------------------------------------------
   Nav
---------------------------------------------------------------- */

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 36px;
  font-size: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 5px;
  background: var(--accent);
  display: inline-block;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
}

.nav-links a {
  color: var(--muted);
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--ink); }

.nav-links a.active {
  color: var(--ink);
  font-weight: 600;
}

.nav-links a.github {
  color: var(--ink);
  font-weight: 600;
}

/* ---------------------------------------------------------------
   Pills
---------------------------------------------------------------- */

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  background: rgba(200, 85, 61, 0.08);
  color: var(--accent);
  letter-spacing: 0.01em;
}

.pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: currentColor;
  display: inline-block;
}

.pill-no-dot::before {
  display: none;
}

/* ---------------------------------------------------------------
   Headlines + lede
---------------------------------------------------------------- */

.h-hero {
  font-size: 72px;
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin: 16px 0 0;
}

.h-hero-italic {
  font-style: italic;
  font-weight: 500;
  color: var(--accent);
  margin: 0;
}

.h-research-hero {
  font-size: 60px;
}

.h-section {
  font-size: 36px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 10px 0 22px;
}

.h-sub {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 10px 0 18px;
}

.lede {
  font-size: 20px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 740px;
  margin-top: 22px;
}

.lede em { color: var(--ink); }

/* ---------------------------------------------------------------
   CTAs
---------------------------------------------------------------- */

.cta-row {
  display: flex;
  gap: 12px;
  margin-top: 26px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  transition: filter 0.15s, transform 0.05s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn:hover {
  filter: brightness(1.04);
  box-shadow: 0 4px 16px rgba(30, 29, 26, 0.08);
}

.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--ink);
  color: white;
}

.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  font-weight: 500;
}

.btn-secondary:hover {
  background: var(--bg);
}

.btn-light {
  background: white;
  color: var(--ink);
}

/* ---------------------------------------------------------------
   Cards
---------------------------------------------------------------- */

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: 18px;
}

.card-lg {
  border-radius: var(--radius-card-lg);
  padding: 28px;
}

.card-accent {
  border-top-width: 3px;
  border-top-style: solid;
}

/* ---------------------------------------------------------------
   System stack
---------------------------------------------------------------- */

.systems-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.system-card-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.system-card-title {
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 4px;
}

.system-card-sub {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  margin-top: 4px;
}

.system-card-desc {
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.45;
  margin-top: 10px;
}

/* ---------------------------------------------------------------
   Chat library (the hero interaction)
---------------------------------------------------------------- */

.chat-grid {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 18px;
  height: 720px;
}

.contacts {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.contacts-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.contacts-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--accent);
}

.contacts-header-title {
  font-weight: 600;
  font-size: 14px;
}

.contacts-header-meta {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}

.contacts-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}

.contacts-tabs::-webkit-scrollbar { display: none; }

.contact-tab {
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.contact-tab:hover {
  background: var(--system-tint);
  color: var(--ink);
}

.contact-tab.active {
  background: var(--ink);
  color: white;
}

.contact-tab-count {
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.7;
}

.contacts-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0;
}

.contact-system-section + .contact-system-section {
  margin-top: 4px;
  border-top: 1px solid var(--border-soft);
  padding-top: 4px;
}

.contact-system-header {
  padding: 12px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}

.contact-system-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
}

.contact-empty {
  padding: 40px 20px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.contact-group-label {
  padding: 8px 20px 4px;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.contact-row {
  width: 100%;
  background: transparent;
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  border-left: 3px solid transparent;
  transition: background 0.12s;
}

.contact-row:hover {
  background: rgba(246, 243, 239, 0.6);
}

.contact-row.active {
  background: var(--system-tint);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11.5px;
  flex-shrink: 0;
}

.avatar-md {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  font-size: 12px;
}

.avatar-solid {
  color: white;
}

.avatar-tinted {
  /* background and color set inline via JS or :is selectors */
}

.contact-text {
  flex: 1;
  min-width: 0;
}

.contact-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
}

.contact-blurb {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Chat thread */
.chat-thread {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-thread-header {
  padding: 12px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-thread-title {
  font-weight: 600;
  font-size: 15px;
}

.chat-thread-meta {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 3px;
  background: var(--sys-enneagram);
}

.chat-thread-stack {
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}

.chat-thread-body {
  flex: 1;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

.system-notice {
  align-self: center;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 12px;
  background: var(--system-tint);
  border-radius: 10px;
}

.bubble-tuning {
  align-self: flex-start;
  max-width: 78%;
  background: var(--system-tint);
  padding: 14px 18px;
  border-radius: 16px 16px 16px 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  color: #4a4538;
  white-space: pre-wrap;
  max-height: 220px;
  overflow: hidden;
  position: relative;
}

.bubble-tuning::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(to bottom, transparent, var(--system-tint));
  pointer-events: none;
}

.bubble-user {
  align-self: flex-end;
  max-width: 70%;
  background: var(--ink);
  color: white;
  padding: 11px 18px;
  border-radius: 16px 16px 4px 16px;
  font-size: 14px;
}

.bubble-agent {
  align-self: flex-start;
  max-width: 82%;
  background: var(--ai-bubble);
  padding: 14px 18px;
  border-radius: 16px 16px 16px 4px;
  font-size: 14.5px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.chat-composer {
  padding: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}

.composer-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  color: var(--muted);
  background: var(--surface);
}

.composer-send {
  width: 38px;
  height: 38px;
  border-radius: 19px;
  color: white;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------------------------------------------------------
   Attachment strip
---------------------------------------------------------------- */

.attachment-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.attachment-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: 18px;
}

.attach-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 12px;
}

.attach-meta-val {
  font-weight: 600;
}

.attach-blurb {
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.5;
  margin-top: 8px;
}

/* ---------------------------------------------------------------
   All-types mega-section (strips per system)
---------------------------------------------------------------- */

.type-strip {
  margin-bottom: 36px;
}

.type-strip:last-child {
  margin-bottom: 0;
}

.type-strip-header {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.type-strip-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.type-strip-title {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: -0.01em;
}

.type-grid {
  display: grid;
  gap: 12px;
}

.type-grid-3 { grid-template-columns: repeat(3, 1fr); }
.type-grid-4 { grid-template-columns: repeat(4, 1fr); }
.type-grid-5 { grid-template-columns: repeat(5, 1fr); }

.type-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: 16px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
}

.type-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(30, 29, 26, 0.06);
  border-color: var(--border-strong, var(--border));
}

.type-card-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  align-self: flex-start;
  font-family: var(--font-mono);
}

.type-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2px;
}

.type-card-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.type-card-blurb {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin-top: 2px;
}

@media (max-width: 1100px) {
  .type-grid-5 { grid-template-columns: repeat(3, 1fr); }
  .type-grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .type-grid-5 { grid-template-columns: repeat(2, 1fr); }
  .type-grid-4 { grid-template-columns: repeat(2, 1fr); }
  .type-grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .type-grid-5,
  .type-grid-4,
  .type-grid-3 { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------
   Before / after section
---------------------------------------------------------------- */

.toggle-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 16px;
}

.toggle-group {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}

.toggle-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  background: transparent;
  transition: background 0.12s, color 0.12s;
}

.toggle-btn[aria-pressed="true"] {
  background: var(--ink);
  color: white;
}

.demo-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card-lg);
  padding: 28px;
}

.demo-user-bubble {
  background: var(--ink);
  color: white;
  padding: 12px 18px;
  border-radius: 16px 16px 4px 16px;
  font-size: 15px;
  display: inline-block;
}

.demo-user-row {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.demo-agent-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.demo-agent-bubble {
  background: var(--ai-bubble);
  padding: 14px 20px;
  border-radius: 16px 16px 16px 4px;
  font-size: 16px;
  line-height: 1.55;
  white-space: pre-wrap;
  max-width: 80%;
}

.demo-caption {
  margin-top: 16px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.demo-caption .mono {
  color: var(--accent);
}

/* ---------------------------------------------------------------
   Tests row
---------------------------------------------------------------- */

.tests-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}

.test-card {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: 18px;
}

.test-name {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-top: 12px;
}

.test-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.test-path {
  font-family: var(--font-mono);
  font-size: 11px;
  margin-top: 14px;
  padding: 6px 10px;
  border-radius: 6px;
  display: inline-block;
}

/* ---------------------------------------------------------------
   Footer
---------------------------------------------------------------- */

.footer {
  margin-top: 48px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 12px;
}

.footer a {
  color: var(--muted);
}

.footer a:hover { color: var(--accent); }

/* ===================================================================
   Research-specific
   =================================================================== */

/* Big stat */
.bigstat-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 36px;
  align-items: center;
}

.bigstat-number {
  font-size: 140px;
  font-weight: 700;
  color: var(--accent);
  line-height: 0.95;
  letter-spacing: -0.04em;
  margin-top: 12px;
}

.bigstat-denom {
  color: var(--muted);
  font-size: 64px;
}

.bigstat-caption {
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  margin-top: 14px;
  max-width: 520px;
}

.bigstat-source {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  margin-top: 12px;
}

.breakdown-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card-lg);
  padding: 24px;
}

.breakdown-header {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.breakdown-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.breakdown-row:last-child { border-bottom: none; }

.breakdown-model {
  font-weight: 600;
  font-size: 13.5px;
}

.breakdown-progress {
  height: 4px;
  background: var(--ai-bubble);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

.breakdown-bar {
  height: 100%;
  background: var(--accent);
}

.breakdown-pct {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  width: 40px;
  text-align: right;
}

/* Findings ladder */
.ladder-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.ladder-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 18px;
}

.ladder-num {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
}

.ladder-instrument {
  font-weight: 600;
  font-size: 18px;
  margin-top: 4px;
}

.ladder-card-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.4;
}

.ladder-finding {
  font-size: 14px;
  font-weight: 500;
  margin-top: 14px;
}

.ladder-detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* Findings tabs */
.tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 0;
}

.tab-btn {
  padding: 8px 14px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 12.5px;
  color: var(--ink);
  background: transparent;
  transition: background 0.12s, color 0.12s;
}

.tab-btn[aria-selected="true"] {
  background: var(--ink);
  color: white;
}

/* Findings stack (all 5 stacked, no tabs) */
.findings-stack {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Finding card */
.finding-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card-lg);
  padding: 28px;
}

.finding-num {
  width: 28px;
  height: 28px;
  border-radius: 14px;
  color: white;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  flex-shrink: 0;
  margin-top: 4px;
}

.finding-header {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.finding-title {
  font-weight: 600;
  font-size: 15px;
}

.finding-source {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.finding-readlink {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 100px;
  align-self: flex-start;
}

.finding-readlink:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.finding-msgs {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble-headline {
  align-self: flex-start;
  max-width: 78%;
  background: var(--system-tint);
  padding: 14px 18px;
  border-radius: 16px 16px 16px 4px;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
}

.bubble-body {
  align-self: flex-start;
  max-width: 82%;
  background: var(--ai-bubble);
  padding: 14px 18px;
  border-radius: 16px 16px 16px 4px;
  font-size: 15px;
  line-height: 1.6;
}

.bubble-quote {
  align-self: flex-start;
  max-width: 82%;
  padding: 14px 18px;
  border-radius: 16px 16px 16px 4px;
  font-size: 14px;
  line-height: 1.5;
  font-style: italic;
  font-weight: 500;
}

/* Finding data tables */
.finding-data {
  width: 100%;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-top: 4px;
}

.finding-data-header {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
}

.finding-row {
  display: grid;
  padding: 10px 18px;
  border-top: 1px solid var(--border-soft);
  align-items: center;
  font-size: 13px;
}

.finding-row:first-of-type { border-top: none; }

.finding-row-mbti {
  grid-template-columns: 1.4fr 0.8fr 1.5fr;
}

.finding-row-disc {
  grid-template-columns: 1.6fr 0.6fr 0.6fr 0.6fr 0.6fr 0.9fr;
}

.finding-cell-model { font-weight: 600; }
.finding-cell-strong { font-family: var(--font-mono); font-weight: 700; color: var(--accent); }
.finding-cell-num { font-family: var(--font-mono); font-size: 12px; color: var(--muted); text-align: right; }
.finding-cell-num.s { color: var(--sys-enneagram); font-weight: 600; }
.finding-cell-num.c { color: var(--sys-disc); font-weight: 700; }
.finding-cell-profile { font-family: var(--font-mono); font-size: 13px; color: var(--sys-disc); text-align: right; font-weight: 700; }
.finding-cell-note { font-size: 12px; color: var(--muted); font-style: italic; }

/* Profile cards (Enneagram/Attachment models) */
.profile-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 4px;
}

.profile-card {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 14px;
}

.profile-label {
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.profile-code {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  margin-top: 4px;
}

.profile-model {
  font-size: 13px;
  font-weight: 500;
  margin-top: 4px;
}

.profile-oneliner {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.45;
}

.profile-meta-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.profile-secure {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--sys-enneagram);
  margin-top: 4px;
  font-weight: 600;
}

/* Big Five chart container */
.chart-container {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 18px;
}

.chart-legend {
  display: flex;
  gap: 18px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  flex-wrap: wrap;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend-swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
}

/* Attachment plane SVG container */
.attach-plane {
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 18px;
}

.attach-plane-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.attach-plane-norm {
  font-size: 11px;
  color: var(--muted);
  margin-top: 8px;
  font-style: italic;
}

/* Slo heatmap */
.slo-table {
  background: var(--surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  padding: 22px;
  margin-top: 14px;
}

.slo-grid {
  display: grid;
  grid-template-columns: 160px repeat(9, 1fr) 80px;
  gap: 4px;
  align-items: center;
}

.slo-col-header {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.slo-col-header.right { text-align: right; }

.slo-row-label {
  font-size: 13px;
  font-weight: 600;
}

.slo-cell {
  padding: 10px 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: 4px;
  color: var(--ink);
}

.slo-cell.bold {
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.slo-profile {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
}

/* Dark closer */
.closer {
  margin-top: 44px;
  background: var(--ink);
  border-radius: 18px;
  padding: 36px;
  color: white;
}

.closer-headline {
  font-size: 40px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin-top: 14px;
  max-width: 880px;
}

.closer-accent {
  color: var(--accent);
}

.closer-cta {
  display: inline-block;
  margin-top: 24px;
}

/* ===================================================================
   Test pages — individual instrument detail
   =================================================================== */

.test-hero {
  padding: 24px 0 36px;
}

.test-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.test-meta-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.test-meta-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.test-meta-value {
  font-size: 16px;
  font-weight: 600;
  margin-top: 2px;
  color: var(--ink);
}

.test-chart-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card-lg);
  padding: 36px;
  margin: 16px 0;
}

.test-chart-caption {
  font-size: 13px;
  color: var(--muted);
  margin-top: 18px;
  text-align: center;
  font-style: italic;
}

.test-section {
  padding: 36px 0;
  border-bottom: 1px solid var(--border);
}

.test-section:last-of-type { border-bottom: none; }

.test-section h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}

.test-section h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 24px 0 8px;
}

.steps-list {
  padding-left: 22px;
  margin: 0;
}

.steps-list li {
  margin-bottom: 10px;
  line-height: 1.55;
}

.steps-list code {
  background: var(--bg-code, var(--system-tint));
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.92em;
}

.items-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 4px 0;
  list-style: none;
  counter-reset: item;
  margin: 0;
  padding-left: 0;
}

.items-list li {
  counter-increment: item;
  display: flex;
  gap: 14px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
  line-height: 1.4;
}

.items-list li:last-child { border-bottom: none; }

.items-list li::before {
  content: counter(item);
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  width: 24px;
  text-align: right;
  padding-top: 2px;
}

.items-list .item-r {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  margin-left: 6px;
  font-weight: 600;
}

.items-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  font-size: 13px;
}

.items-table th,
.items-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

.items-table th {
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
}

.items-table tr:last-child td { border-bottom: none; }

.items-table .num-col {
  width: 40px;
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.score-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  font-size: 13px;
}

.score-table th,
.score-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
}

.score-table th {
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
  font-weight: 600;
}

.score-table tr:last-child td { border-bottom: none; }

.score-table .mono { font-family: var(--font-mono); font-size: 12px; }

.test-catalog-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin: 32px 0 0;
}

.test-catalog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px;
  transition: transform 0.15s, box-shadow 0.15s;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  border-top-width: 3px;
}

.test-catalog-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(30, 29, 26, 0.08);
}

.test-catalog-source {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.test-catalog-name {
  font-size: 22px;
  font-weight: 600;
  margin-top: 10px;
  letter-spacing: -0.01em;
}

.test-catalog-stats {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.test-catalog-desc {
  font-size: 13px;
  color: var(--ink);
  margin-top: 14px;
  line-height: 1.5;
  flex: 1;
}

.test-catalog-link {
  font-family: var(--font-mono);
  font-size: 11px;
  margin-top: 16px;
  letter-spacing: 0.04em;
}

@media (max-width: 1100px) {
  .test-meta-grid { grid-template-columns: repeat(2, 1fr); }
  .test-catalog-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
  .test-catalog-grid { grid-template-columns: 1fr; }
  .test-meta-grid { grid-template-columns: 1fr; }
  .test-chart-box { padding: 20px; }
}

/* ---------------------------------------------------------------
   Responsive
---------------------------------------------------------------- */

@media (max-width: 1100px) {
  :root {
    --content-pad: 40px;
  }
  .systems-grid { grid-template-columns: repeat(3, 1fr); }
  .tests-grid { grid-template-columns: repeat(3, 1fr); }
  .h-hero { font-size: 60px; }
  .h-research-hero { font-size: 50px; }
}

@media (max-width: 960px) {
  :root {
    --content-pad: 32px;
    --content-pad-y: 32px;
  }
  .chat-grid {
    grid-template-columns: 1fr;
    height: auto;
  }
  .contacts {
    height: 380px;
  }
  .chat-thread {
    min-height: 600px;
  }
  .bigstat-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .bigstat-number {
    font-size: 110px;
  }
  .bigstat-denom { font-size: 50px; }
  .ladder-grid { grid-template-columns: repeat(2, 1fr); }
  .profile-grid { grid-template-columns: repeat(2, 1fr); }
  .attachment-grid { grid-template-columns: repeat(2, 1fr); }
  .slo-grid {
    grid-template-columns: 120px repeat(9, 1fr) 70px;
    gap: 2px;
  }
  .slo-row-label { font-size: 12px; }
  .slo-cell { font-size: 11px; }
  .closer-headline { font-size: 32px; }
}

@media (max-width: 768px) {
  :root {
    --content-pad: 24px;
  }
  .h-hero { font-size: 44px; }
  .h-research-hero { font-size: 38px; }
  .h-section { font-size: 28px; }
  .h-sub { font-size: 22px; }
  .lede { font-size: 17px; }
  .bigstat-number { font-size: 88px; }
  .bigstat-denom { font-size: 42px; }
  .nav { font-size: 13px; }
  .nav-links { gap: 14px; }
  .systems-grid { grid-template-columns: repeat(2, 1fr); }
  .tests-grid { grid-template-columns: repeat(2, 1fr); }
  .closer { padding: 24px; }
  .closer-headline { font-size: 26px; }
}

@media (max-width: 600px) {
  :root {
    --content-pad: 20px;
    --content-pad-y: 24px;
  }
  .h-hero { font-size: 36px; }
  .h-research-hero { font-size: 30px; }
  .h-section { font-size: 24px; }
  .h-sub { font-size: 20px; }
  .lede { font-size: 16px; }
  .systems-grid { grid-template-columns: 1fr; }
  .tests-grid { grid-template-columns: 1fr; }
  .attachment-grid { grid-template-columns: 1fr; }
  .ladder-grid { grid-template-columns: 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .bigstat-number { font-size: 72px; }
  .bigstat-denom { font-size: 32px; }
  .nav-links { gap: 12px; font-size: 12px; }
  .nav-links a:not(.active):not(.github) {
    display: none;
  }
  .demo-card, .finding-card, .breakdown-card, .closer {
    padding: 18px;
  }
  .slo-grid {
    /* Compact further */
    grid-template-columns: 90px repeat(9, 1fr) 56px;
  }
}
