/* ROI Navigator docs — styles. Tokens from Figma (Gravity UI base), see HANDOFF.md */

:root {
  --brand: #7950F2;
  --brand-hover: #6a46d5;
  --text-primary: #000000d9;
  --text-heading: #000000;
  --text-compl: #000000b2;
  --text-secondary: #00000080;
  --text-slate: #647a8d;
  --line-generic: #0000001a;
  --line-solid: #e5e5e5;
  --base-generic: #0000000d;
  --positive-fg: #2d8b5d;
  --positive-bg: #32ba7626;
  --danger-fg: #bd0935;
  --danger-bg: #ff003d26;
  --r-xs: 3px;
  --r-m: 6px;
  --r-l: 8px;
  --r-xl: 10px;
  --shadow-xsm: 0 1px 2px #1018280a;
  --measure: 720px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #fff;
  font-family: 'Manrope', -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 56px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--line-solid);
}

.topbar__logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--r-l);
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.02em;
  user-select: none;
}

.topbar__title {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-heading);
}

.topbar__sep {
  color: var(--line-generic);
}

.topbar__section {
  font-size: 14px;
  color: var(--text-secondary);
}

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

.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  max-width: 1320px;
  margin: 0 auto;
}

/* ---------- Left doc tree ---------- */

.sidenav {
  position: sticky;
  top: 56px;
  align-self: start;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 28px 12px 48px 24px;
  border-right: 1px solid var(--line-solid);
}

.doctree { list-style: none; margin: 0; padding: 0; }
.doctree ul { list-style: none; margin: 2px 0 10px; padding: 0; }

.doctree__group {
  display: block;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.01em;
  color: var(--text-heading);
  text-decoration: none;
  border-radius: var(--r-l);
}

.doctree__item {
  display: block;
  padding: 6px 12px 6px 24px;
  font-size: 14px;
  color: var(--text-compl);
  text-decoration: none;
  border-radius: var(--r-l);
  transition: background 0.12s ease, color 0.12s ease;
}

.doctree__item:hover { background: var(--base-generic); color: var(--text-heading); }

/* Active nav state: soft neutral fill, bold text, NO bar, NO purple (see HANDOFF) */
.doctree__item.is-active,
.doctree__group.is-active {
  background: var(--base-generic);
  color: var(--text-heading);
  font-weight: 700;
}

/* ---------- Content ---------- */

.content {
  padding: 32px 48px 96px 48px;
  min-width: 0;
}

.prose { max-width: var(--measure); }

/* ---------- Breadcrumbs ---------- */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
  font-size: 13px;
}

.breadcrumb li { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); }
.breadcrumb li + li::before { content: '/'; color: var(--line-generic); }
.breadcrumb a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--text-compl); }
.breadcrumb .is-current { color: var(--brand); font-weight: 600; }

/* ---------- Typography ---------- */

h1, h2, h3, h4 {
  font-family: 'Manrope', sans-serif;
  color: var(--text-heading);
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
}

h1 { font-size: 34px; margin: 0 0 14px; letter-spacing: -0.01em; }
h2 { font-size: 28px; margin: 56px 0 16px; letter-spacing: -0.01em; }
h3 { font-size: 20px; margin: 40px 0 12px; }

/* Chart-name runheads (the underlined headings in the source doc) */
h4 {
  font-size: 15.5px;
  font-weight: 800;
  margin: 30px 0 8px;
}

.lead {
  font-size: 16px;
  line-height: 1.7;
  color: var(--text-compl);
  margin: 0 0 8px;
  max-width: var(--measure);
}

p { margin: 0 0 14px; max-width: var(--measure); }

ul.list, ol.list { margin: 0 0 16px; padding-left: 22px; max-width: var(--measure); }
ul.list li, ol.list li { margin: 0 0 7px; }
ul.list li::marker { color: var(--text-slate); }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; }

strong { font-weight: 700; color: var(--text-heading); }

/* ---------- Numbered steps ---------- */

ol.steps {
  list-style: none;
  counter-reset: step;
  margin: 0 0 18px;
  padding: 0;
  max-width: var(--measure);
}

ol.steps > li {
  counter-increment: step;
  position: relative;
  padding: 0 0 14px 42px;
}

ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 1px;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--base-generic);
  color: var(--text-heading);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Callouts (pattern from Figma node 9266-106873) ---------- */

.alert {
  position: relative;
  display: block;
  margin: 22px 0;
  padding: 16px 20px 16px 24px;
  background: rgba(0, 0, 0, 0.05);
  border-radius: var(--r-xl);
  overflow: hidden;
  max-width: var(--measure);
}

/* short, vertically-centered marker bar, flush to the left edge */
.alert::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 55%;
  min-height: 26px;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--brand);
}

.alert--tip::before { background: var(--positive-fg); }

.alert__title {
  display: block;
  font-weight: 800;
  font-size: 14px;
  color: var(--text-heading);
  margin: 0 0 4px;
}

.alert p { margin: 0; }
.alert p + p { margin-top: 8px; }

/* ---------- Tables ---------- */

.tbl-wrap { margin: 20px 0 24px; overflow-x: auto; }

table.tbl {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  font-size: 14px;
  border: 1px solid var(--line-solid);
  border-radius: var(--r-l);
  overflow: hidden;
}

table.tbl th {
  text-align: left;
  font-weight: 700;
  color: var(--text-heading);
  background: var(--base-generic);
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-solid);
}

table.tbl td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-solid);
  vertical-align: top;
  color: var(--text-compl);
}

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

/* ---------- Definition lists (fixed 180px term column) ---------- */

.deflist {
  display: grid;
  grid-template-columns: 180px 1fr;
  column-gap: 20px;
  row-gap: 10px;
  margin: 16px 0 22px;
  max-width: var(--measure);
  align-items: baseline;
}

.deflist dt {
  font-weight: 700;
  color: var(--text-heading);
  font-size: 14px;
  margin: 0;
}

.deflist dd {
  margin: 0;
  color: var(--text-compl);
  font-size: 14.5px;
}

/* ---------- Figures (real screenshots) ---------- */

figure.fig {
  margin: 20px 0 26px;
  max-width: 100%;
  width: fit-content;
}

figure.fig img {
  display: block;
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line-solid);
  border-radius: var(--r-l);
  box-shadow: var(--shadow-xsm);
}

figure.fig figcaption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.fig-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
  margin: 20px 0 26px;
}

.fig-row figure.fig { margin: 0; }

/* ---------- Inline chips ---------- */

.val {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--base-generic);
  border: 1px solid var(--line-generic);
  border-radius: var(--r-xs);
  padding: 1px 6px;
  white-space: nowrap;
  color: var(--text-heading);
}

.ui-chip {
  font-size: 0.9em;
  background: var(--base-generic);
  border: 1px solid var(--line-generic);
  border-radius: var(--r-m);
  padding: 1px 7px;
  white-space: nowrap;
  color: var(--text-heading);
  font-weight: 600;
}

/* ---------- Formula block ---------- */

.formula {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13.5px;
  background: var(--base-generic);
  border-radius: var(--r-l);
  padding: 12px 18px;
  margin: 14px 0 18px;
  color: var(--text-heading);
  width: fit-content;
  max-width: var(--measure);
}

/* ---------- Separator ---------- */

.separator {
  border: 0;
  border-top: 1px solid var(--line-solid);
  margin: 48px 0;
  max-width: var(--measure);
}

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

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .sidenav { display: none; }
  .content { padding: 24px 20px 64px; }
}


/* ---------- Additions for rn-docs (not in the published stylesheet) ---------- */

/* Text spans the full content column, aligned with tables and side-by-side blocks. */
:root { --measure: 100%; }

/* KPI boxes, comparison options and media groups are tables: term column + description */
table.tbl td:first-child {
  width: 220px;
  font-weight: 700;
  color: var(--text-heading);
}

/* Language switch — right end of the top bar, same chip language as .ui-chip */
.topbar__spacer { flex: 1; }

.langswitch {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: var(--r-l);
  background: var(--base-generic);
}

.langswitch a {
  padding: 3px 10px;
  border-radius: var(--r-m);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
}

.langswitch a:hover { color: var(--text-heading); text-decoration: none; }

.langswitch a[aria-current="true"] {
  background: #fff;
  color: var(--text-heading);
  box-shadow: var(--shadow-xsm);
}

@media (max-width: 640px) {
  table.tbl td:first-child { width: 40%; }
}

/* Text + narrow screenshot side by side, 50/50, once the content column is wide enough
   (build.mjs → pair()). Max layout width stays at the published 1320px. */
@media (min-width: 1280px) {
  .pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 24px;
    align-items: start;
    margin: 0 0 26px;
  }

  .pair__text > :last-child { margin-bottom: 0; }
  .pair__text .tbl-wrap:first-child,
  .pair__text p:first-child { margin-top: 0; }
  .pair table.tbl td:first-child { width: 40%; }
  .pair figure.fig { margin: 0; width: 100%; }
}
