/*
 * research-prose.css — styles the HTML produced by static/research-markdown.js.
 *
 * The markdown engine emits SEMANTIC class names (ins-*) instead of Tailwind
 * utilities, so all visual styling lives here. Dark theme, emerald (#34d399)
 * accent — matching the original Research design — wired onto the Compass
 * design tokens (var(--c-*)) where it keeps us consistent with the rest of the
 * product. Rendered HTML is injected into <div class="research-prose">.
 */

:root {
  --ins-accent: #34d399;        /* emerald-400 */
  --ins-accent-hover: #6ee7b7;  /* emerald-300 */
  --ins-text: rgba(255, 255, 255, 0.68);
  --ins-text-strong: rgba(255, 255, 255, 0.85);
  --ins-text-dim: rgba(255, 255, 255, 0.50);
  --ins-text-faint: rgba(255, 255, 255, 0.40);
  --ins-border: rgba(255, 255, 255, 0.08);
  --ins-card: rgba(255, 255, 255, 0.02);
  --ins-card-hover: rgba(255, 255, 255, 0.04);
}

.research-prose {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--ins-text);
}

/* ── Block text ───────────────────────────────────────────────────────────── */
.ins-p {
  margin: 0 0 1rem;
  color: var(--ins-text);
  font-size: 0.9375rem;
  line-height: 1.7;
}

.ins-h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.80);
  margin: 3.5rem 0 1rem;
  scroll-margin-top: 6rem;
}
.ins-h3 {
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.70);
  margin: 2rem 0 0.75rem;
  scroll-margin-top: 6rem;
}
.ins-h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  margin: 1.5rem 0 0.5rem;
}
.ins-h { font-weight: 600; color: rgba(255, 255, 255, 0.80); margin: 0.75rem 0; }

.ins-anchor {
  opacity: 0;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: opacity 0.15s;
}
.ins-h2:hover .ins-anchor { opacity: 0.4; }

.ins-strong { font-weight: 600; color: var(--ins-text-strong); }
.ins-em { font-style: italic; color: rgba(255, 255, 255, 0.60); }

.ins-link {
  color: var(--ins-accent);
  text-decoration: underline;
  text-decoration-color: rgba(52, 211, 153, 0.35);
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color 0.15s, text-decoration-color 0.15s;
}
.ins-link:hover {
  color: var(--ins-accent-hover);
  text-decoration-color: rgba(110, 231, 183, 0.6);
}
.ins-link[target="_blank"]::after {
  content: " ↗";
  font-size: 0.7em;
  opacity: 0.6;
  vertical-align: super;
  line-height: 1;
}

.ins-ul, .ins-ol {
  margin: 1rem 0;
  padding-left: 1.5rem;
  color: rgba(255, 255, 255, 0.65);
  font-size: 0.9375rem;
}
.ins-ul { list-style: disc; }
.ins-ol { list-style: decimal; }
.ins-ul li, .ins-ol li { margin-bottom: 0.375rem; line-height: 1.6; }

.ins-quote {
  border-left: 2px solid rgba(52, 211, 153, 0.4);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--ins-text-dim);
  font-style: italic;
  font-size: 0.9rem;
  line-height: 1.6;
}

.ins-hr { border: none; border-top: 1px solid var(--ins-border); margin: 2.5rem 0; }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.ins-table-wrap {
  overflow-x: auto;
  margin: 1.25rem 0;
  border-radius: 0.75rem;
  border: 1px solid var(--ins-border);
}
.ins-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.ins-table thead tr { background: var(--ins-card); border-bottom: 1px solid var(--ins-border); }
.ins-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ins-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ins-table td {
  padding: 0.75rem 1rem;
  color: rgba(255, 255, 255, 0.70);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.ins-table tbody tr:last-child td { border-bottom: none; }
.ins-table tbody tr:hover { background: var(--ins-card); }

/* ── Code ─────────────────────────────────────────────────────────────────── */
.ins-code {
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ins-accent);
  font-size: 0.8rem;
  font-family: "JetBrains Mono", "Courier New", monospace;
}
.ins-pre {
  margin: 1rem 0;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--ins-border);
}
.ins-pre__lang {
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--ins-border);
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.30);
  font-family: "JetBrains Mono", monospace;
}
.ins-pre pre {
  background: rgba(0, 0, 0, 0.30);
  padding: 1rem;
  margin: 0;
  overflow-x: auto;
  font-size: 0.75rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.60);
  font-family: "JetBrains Mono", "Courier New", monospace;
}

/* ── Shared bullet dot ────────────────────────────────────────────────────── */
.ins-dot {
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 9999px;
  background: var(--ins-accent);
  flex-shrink: 0;
  margin-top: 0.4rem;
}

/* ── Callouts ─────────────────────────────────────────────────────────────── */
.callout-block {
  display: flex;
  gap: 0.75rem;
  border-radius: 0.75rem;
  border: 1px solid var(--ins-border);
  padding: 1rem;
  margin: 1.25rem 0;
}
.ins-callout__icon { flex-shrink: 0; margin-top: 0.1rem; font-size: 0.875rem; }
.ins-callout__body { font-size: 0.875rem; color: rgba(255, 255, 255, 0.70); line-height: 1.6; }
.callout-note, .callout-info { background: rgba(59, 130, 246, 0.08); border-color: rgba(59, 130, 246, 0.20); }
.callout-note .ins-callout__icon, .callout-info .ins-callout__icon { color: #60a5fa; }
.callout-warning, .callout-warn { background: rgba(245, 158, 11, 0.08); border-color: rgba(245, 158, 11, 0.20); }
.callout-warning .ins-callout__icon, .callout-warn .ins-callout__icon { color: #fbbf24; }
.callout-tip, .callout-success { background: rgba(52, 211, 153, 0.08); border-color: rgba(52, 211, 153, 0.20); }
.callout-tip .ins-callout__icon, .callout-success .ins-callout__icon { color: var(--ins-accent); }

/* ── Key takeaways ────────────────────────────────────────────────────────── */
.ins-takeaways {
  margin: 1.5rem 0;
  padding: 1.25rem;
  border-radius: 0.75rem;
  border: 1px solid rgba(52, 211, 153, 0.20);
  background: rgba(52, 211, 153, 0.05);
}
.ins-takeaways__title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ins-accent);
  margin: 0 0 0.75rem;
}
.ins-takeaways__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.ins-takeaways__item { display: flex; align-items: flex-start; gap: 0.5rem; font-size: 0.875rem; color: rgba(255, 255, 255, 0.65); }

/* ── Grid ─────────────────────────────────────────────────────────────────── */
.ins-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; margin: 1.5rem 0; }
.ins-grid__card {
  display: flex; flex-direction: column; gap: 0.75rem;
  padding: 1.25rem; border-radius: 0.75rem;
  border: 1px solid var(--ins-border); background: var(--ins-card);
}
.ins-grid__icon {
  width: 2.5rem; height: 2.5rem; border-radius: 0.75rem;
  background: rgba(52, 211, 153, 0.10); border: 1px solid rgba(52, 211, 153, 0.20);
  display: flex; align-items: center; justify-content: center; font-size: 1.25rem;
}
.ins-grid__title { font-weight: 600; color: var(--ins-text-strong); font-size: 0.875rem; margin: 0; }
.ins-grid__desc { font-size: 0.75rem; color: var(--ins-text-dim); line-height: 1.6; margin: 0; }

/* ── Features ─────────────────────────────────────────────────────────────── */
.ins-features { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; margin: 1.5rem 0; }
.ins-features__card {
  display: flex; gap: 0.75rem; padding: 1rem;
  border-radius: 0.75rem; border: 1px solid var(--ins-border);
  background: var(--ins-card); transition: background 0.15s;
}
.ins-features__card:hover { background: var(--ins-card-hover); }
.ins-features__icon {
  width: 2.25rem; height: 2.25rem; border-radius: 0.5rem;
  border: 1px solid; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex-shrink: 0;
}
.ins-features__icon--0 { background: rgba(52, 211, 153, 0.10); border-color: rgba(52, 211, 153, 0.20); }
.ins-features__icon--1 { background: rgba(59, 130, 246, 0.10); border-color: rgba(59, 130, 246, 0.20); }
.ins-features__icon--2 { background: rgba(168, 85, 247, 0.10); border-color: rgba(168, 85, 247, 0.20); }
.ins-features__icon--3 { background: rgba(245, 158, 11, 0.10); border-color: rgba(245, 158, 11, 0.20); }
.ins-features__icon--4 { background: rgba(239, 68, 68, 0.10); border-color: rgba(239, 68, 68, 0.20); }
.ins-features__icon--5 { background: rgba(99, 102, 241, 0.10); border-color: rgba(99, 102, 241, 0.20); }
.ins-features__icon--6 { background: rgba(20, 184, 166, 0.10); border-color: rgba(20, 184, 166, 0.20); }
.ins-features__icon--7 { background: rgba(249, 115, 22, 0.10); border-color: rgba(249, 115, 22, 0.20); }
.ins-features__body { display: flex; flex-direction: column; gap: 0.25rem; min-width: 0; }
.ins-features__title { font-size: 0.875rem; font-weight: 500; color: rgba(255, 255, 255, 0.80); margin: 0; }
.ins-features__desc { font-size: 0.75rem; color: rgba(255, 255, 255, 0.45); line-height: 1.6; margin: 0; }

/* ── Steps ────────────────────────────────────────────────────────────────── */
.ins-steps { margin: 1.5rem 0; }
.ins-step { display: flex; gap: 1rem; margin: 0.5rem 0; }
.ins-step__rail { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.ins-step__num {
  width: 1.75rem; height: 1.75rem; border-radius: 9999px;
  background: rgba(52, 211, 153, 0.15); border: 1px solid rgba(52, 211, 153, 0.30);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: var(--ins-accent);
}
.ins-step__line { width: 1px; flex: 1; background: rgba(255, 255, 255, 0.05); margin-top: 0.5rem; }
.ins-step__body { flex: 1; padding-bottom: 1.5rem; }
.ins-step:last-child .ins-step__body { padding-bottom: 0.5rem; }
.ins-step__title { font-weight: 600; color: var(--ins-text-strong); margin: 0 0 0.25rem; font-size: 0.875rem; }
.ins-step__desc { font-size: 0.875rem; color: rgba(255, 255, 255, 0.55); line-height: 1.6; margin: 0; }

/* ── Layer ────────────────────────────────────────────────────────────────── */
.ins-layer { margin: 1rem 0; padding: 1.25rem; border-radius: 0.75rem; border: 1px solid; }
.ins-layer__label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.25rem; }
.ins-layer__title { font-weight: 700; font-size: 1rem; color: var(--ins-text-strong); margin: 0 0 0.5rem; }
.ins-layer__desc { font-size: 0.875rem; color: rgba(255, 255, 255, 0.55); line-height: 1.6; margin: 0; }
.ins-layer--green  { background: rgba(52, 211, 153, 0.05); border-color: rgba(52, 211, 153, 0.20); }
.ins-layer--green  .ins-layer__label { color: var(--ins-accent); }
.ins-layer--blue   { background: rgba(59, 130, 246, 0.05); border-color: rgba(59, 130, 246, 0.20); }
.ins-layer--blue   .ins-layer__label { color: #60a5fa; }
.ins-layer--purple { background: rgba(168, 85, 247, 0.05); border-color: rgba(168, 85, 247, 0.20); }
.ins-layer--purple .ins-layer__label { color: #c084fc; }
.ins-layer--amber  { background: rgba(245, 158, 11, 0.05); border-color: rgba(245, 158, 11, 0.20); }
.ins-layer--amber  .ins-layer__label { color: #fbbf24; }

/* ── Ingest ───────────────────────────────────────────────────────────────── */
.ins-ingest {
  margin: 1.5rem 0; padding: 1.25rem; border-radius: 0.75rem;
  border: 1px solid rgba(52, 211, 153, 0.20); background: rgba(255, 255, 255, 0.015);
}
.ins-ingest__title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ins-accent); margin: 0 0 1rem; }
.ins-ingest__list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem 2rem; }
.ins-ingest__item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; color: rgba(255, 255, 255, 0.65); }
.ins-ingest__item .ins-dot { margin-top: 0; }

/* ── Sources ──────────────────────────────────────────────────────────────── */
.ins-sources {
  margin: 1.5rem 0; border-radius: 0.75rem; overflow: hidden;
  border: 1px solid var(--ins-border); background: var(--ins-card);
}
.ins-sources__head { padding: 1rem 1.25rem 0.25rem; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.ins-sources__title { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.30); margin: 0; }
.ins-sources__list { list-style: none; margin: 0; padding: 0.25rem 1.25rem; }
.ins-sources__item { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.625rem 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.ins-sources__item:last-child { border-bottom: none; }
.ins-sources__icon { font-size: 1rem; flex-shrink: 0; margin-top: 0.1rem; }
.ins-sources__text { font-size: 0.875rem; color: rgba(255, 255, 255, 0.65); line-height: 1.6; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .ins-grid, .ins-features, .ins-ingest__list { grid-template-columns: 1fr; }
}
