/* docs.jamb.ai — the chrome around Scalar. Scalar themes itself; this file only
   owns the landing page and the topbar that sits above every reference. */

:root {
  color-scheme: light dark;

  --bg: #fbfbfc;
  --bg-raised: #ffffff;
  --bg-sunken: #f2f3f5;
  --fg: #14161a;
  --fg-muted: #5b6270;
  --fg-dim: #8b93a1;
  --line: #e3e5ea;
  --line-strong: #cdd1d9;
  --accent: #3b5bdb;
  --accent-fg: #ffffff;
  --warn-bg: #fff4e5;
  --warn-line: #f0c48a;
  --warn-fg: #7a4a06;

  --topbar-h: 48px;
  --radius: 12px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1013;
    --bg-raised: #16191e;
    --bg-sunken: #1c2027;
    --fg: #e9ecf1;
    --fg-muted: #9aa3b2;
    --fg-dim: #6d7686;
    --line: #262b33;
    --line-strong: #363d47;
    --accent: #7d94f5;
    --accent-fg: #0e1013;
    --warn-bg: #2a1f0d;
    --warn-line: #6b4d18;
    --warn-fg: #f0c48a;
  }
}

* { box-sizing: border-box; }

body.page {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); }

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

/* ── Topbar ─────────────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--topbar-h);
  padding: 0 16px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.brand {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
  flex: none;
}
.brand span { color: var(--fg-dim); font-weight: 450; }

.topbar-links {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  min-width: 0;
}
.topbar-links::-webkit-scrollbar { display: none; }

.topbar-links a {
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--fg-muted);
  text-decoration: none;
  white-space: nowrap;
}
.topbar-links a:hover { background: var(--bg-sunken); color: var(--fg); }
.topbar-links a.is-current { background: var(--accent); color: var(--accent-fg); }

/* ── Landing page ───────────────────────────────────────────────────────── */

.wrap { max-width: 1080px; margin: 0 auto; padding: 56px 24px 72px; }

.masthead h1 {
  margin: 0 0 10px;
  font-size: 34px;
  letter-spacing: -0.025em;
  font-weight: 680;
}
.masthead p { margin: 0; max-width: 62ch; color: var(--fg-muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  margin-top: 40px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px 20px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgb(0 0 0 / 0.06);
}

/* The whole card is the link; the links inside it sit above this layer. */
.card-hit { position: absolute; inset: 0; border-radius: var(--radius); z-index: 1; }
.card-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.card a:not(.card-hit) { position: relative; z-index: 2; }

.card header { display: flex; align-items: baseline; gap: 10px; }
.card h2 { margin: 0; font-size: 17px; font-weight: 640; letter-spacing: -0.015em; }

.pill {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-sunken);
  border: 1px solid var(--line);
  color: var(--fg-dim);
  font-size: 11.5px;
  font-family: var(--mono);
}

.upstream { font-size: 12.5px; color: var(--fg-dim); }

.summary { margin: 8px 0 16px; color: var(--fg-muted); font-size: 14px; }

.facts { margin: auto 0 0; display: grid; gap: 4px; font-size: 13px; }
.facts > div { display: flex; gap: 8px; }
.facts dt { flex: none; width: 82px; color: var(--fg-dim); }
.facts dd { margin: 0; color: var(--fg-muted); min-width: 0; }

.dim { color: var(--fg-dim); }

.stale {
  margin: 14px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-fg);
  font-size: 12.5px;
}

.foot { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--fg-muted); }
.foot p { margin: 0 0 4px; }

/* ── Reference pages ────────────────────────────────────────────────────── */

/* Scalar has a first-class hook for a header it does not own: it offsets its own
   sticky header by --scalar-custom-header-height and subtracts it from the
   sidebar's height. So the topbar is fixed and Scalar is told how tall it is,
   rather than being boxed into a flex child and left to overflow. */
body.reference {
  --scalar-custom-header-height: var(--topbar-h);
}
body.reference .topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 1002;
}

@media (max-width: 640px) {
  .wrap { padding: 36px 16px 56px; }
  .masthead h1 { font-size: 27px; }
  .grid { grid-template-columns: 1fr; }
}
