/* ============================================================
   PKG DOCS — design system tokens
   0px radius on everything except keycap chips (4px).
   No shadows. No gradients.
   ============================================================ */

:root {
  /* color */
  --accent:        #2b5945;
  --accent-10:     rgba(43, 89, 69, 0.10);
  --accent-05:     rgba(43, 89, 69, 0.05);
  --text:          #1e2124;
  --text-medium:   #636363;
  --text-light:    #6b6b6b;
  --placeholder:   #757575;
  --bg:            #ffffff;
  --border-faint:  rgba(43, 89, 69, 0.10);
  --border-strong: #1e2124;

  /* status */
  --safety:        #b3261e;
  --safety-10:     rgba(179, 38, 30, 0.08);

  /* type */
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  /* layout */
  --sidebar-w: 280px;
  --toc-w:     210px;
  --content-max: 1600px;
  --topbar-h:  60px;

  font-size: 15px; /* 1rem = 15px */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Foundry runs an ~18px root; this UI is authored in px (not rem), so a root
   font-size bump would not scale it. Scale the whole app proportionally by
   1.125× with zoom instead — text, spacing, borders and layout all scale
   together. */
#root { zoom: 1.125; }

button { font-family: var(--sans); cursor: pointer; border-radius: 0; }
a { color: var(--accent); text-decoration: none; }
::selection { background: var(--accent-10); }

/* hide native scrollbar grit but keep scroll */
.scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--border-faint) transparent; }
.scroll::-webkit-scrollbar { width: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--border-faint); }

/* ===== type roles ===== */
.h1 {
  font-size: 32px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  letter-spacing: normal;
  margin: 0;
}
.subtitle {
  font-size: 14px;
  color: var(--text-medium);
  line-height: 1.5;
  margin: 5px 0 0;
}
.section-hdr {
  font-size: 13px;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-medium);
  margin: 0;
}
.body { font-size: 14px; line-height: 1.5; color: var(--text); }
.mono { font-family: var(--mono); }

/* ============================================================
   TOP BAR
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar-h);
  background: var(--bg);
  border-bottom: 1px solid #2b5945;
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.brand-glyph {
  width: 22px; height: 22px;
  border: 1.5px solid var(--text);
  display: grid; place-items: center;
  position: relative;
}
.brand-glyph::after {
  content: '';
  position: absolute;
  width: 7px; height: 7px;
  background: var(--accent);
}
.brand-word { font-size: 18px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }

/* search */
.search {
  flex: 1;
  max-width: 680px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  background: transparent;
}
.search svg { flex-shrink: 0; color: var(--text-medium); }
.search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--text);
}
.search input::placeholder { color: var(--placeholder); }

/* deferred search — visibly inactive, not a broken-looking live box */
.search.is-disabled { border-color: var(--border-faint); background: var(--accent-05); cursor: not-allowed; }
.search.is-disabled svg { color: var(--text-light); opacity: 0.6; }
.search.is-disabled input { color: var(--text-light); cursor: not-allowed; }
.search.is-disabled input::placeholder { color: var(--text-light); opacity: 0.8; }

/* ============================================================
   TOP TABS
   ============================================================ */
.tabs {
  display: flex;
  gap: 30px;
  padding: 0 32px;
  border-bottom: 1px solid var(--border-faint);
  background: var(--bg);
  position: sticky;
  top: var(--topbar-h);
  z-index: 40;
}
.tab {
  appearance: none;
  background: none;
  border: none;
  padding: 11px 2px;
  margin-bottom: -1px;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-medium);
  border-bottom: 5px solid transparent;
  display: flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--accent);
  font-weight: 600;
  border-bottom-color: var(--accent);
}
.tab .chev { font-size: 12px; opacity: 0.6; }

/* ============================================================
   APP GRID
   ============================================================ */
.shell {
  max-width: var(--content-max);
  margin: 0;
  padding: 0 32px;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr var(--toc-w);
  gap: 16px;
  align-items: start;
}
.shell.no-toc { grid-template-columns: var(--sidebar-w) 1fr; }
.shell.narrow-toc { grid-template-columns: var(--sidebar-w) 1fr var(--toc-w); }

/* ===== sidebar ===== */
.sidebar {
  position: sticky;
  top: calc(var(--topbar-h) + 44px);
  height: calc(100vh - var(--topbar-h) - 44px);
  background: var(--accent-05);
  padding: 18px 0 32px;
}
.sidebar-inner { padding: 0 18px; }
.nav-group { margin-bottom: 18px; }
.nav-group-hdr {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 7px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-medium);
}
.nav-group-hdr .collapse {
  background: none; border: none; color: var(--text-medium);
  font-size: 14px; padding: 0; line-height: 1;
}
/* sidebar collapse is deferred — honest disabled affordance, not a dead live control */
.nav-group-hdr .collapse:disabled { color: var(--text-light); opacity: 0.45; cursor: not-allowed; }
.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  text-align: left;
  padding: 6px 12px;
  margin: 0 -12px;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-medium);
  font-family: var(--sans);
}
.nav-item:hover { background: var(--accent-05); color: var(--text); }
.nav-item:focus { outline: none; box-shadow: none; }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Keyboard focus ring for the remaining interactive controls — only .nav-item had one.
   :focus-visible keeps mouse clicks clean; inset offset so full-width rows don't clip. */
.tab:focus-visible, .toc-item:focus-visible, .chip:focus-visible, .prop-group-hdr:focus-visible,
.prop-row:focus-visible, .dep-row:focus-visible, .fn-summary-link:focus-visible,
.fn-table tbody tr:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.nav-item.active {
  background: none;
  color: var(--accent);
  font-weight: 700;
  border-radius: 0;
  box-shadow: none;
}
.nav-item .arrow { opacity: 0; color: var(--accent); }
.nav-item.active .arrow { opacity: 1; }
.nav-item .count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-light);
  font-weight: 400;
}
.nav-item.active .count { color: var(--accent); }
.nav-label { display: flex; align-items: baseline; gap: 7px; flex: 1 1 auto; min-width: 0; }
.nav-label > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-item .arrow { flex-shrink: 0; margin-left: 8px; }

/* ===== content column ===== */
.content {
  min-width: 0;
  padding: 24px 22px 100px;
}

.breadcrumb {
  font-size: 14px;
  color: var(--text-medium);
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px;
}
.breadcrumb .crumb-link { color: var(--text-medium); cursor: pointer; }
.breadcrumb .crumb-link:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--text-light); }
.breadcrumb .crumb-current { color: rgb(30, 33, 36); font-weight: 500; }

/* ===== TOC rail ===== */
.toc {
  position: sticky;
  top: calc(var(--topbar-h) + 44px);
  height: calc(100vh - var(--topbar-h) - 44px);
  padding: 24px 0 32px;
  overflow-y: auto;
}
.toc-hdr {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-medium);
  margin-bottom: 18px;
}
.toc-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none; border: none;
  font-size: 13px;
  color: var(--text);
  padding: 5px 0;
  font-family: var(--sans);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.toc-item .marker { color: var(--accent); margin-right: 6px; opacity: 0; }
.toc-item:hover { color: var(--accent); }
.toc-item.active { color: var(--accent); }
.toc-item.active .marker { opacity: 1; }
.toc-item.indent { padding-left: 18px; }
.toc-item.dim { color: var(--text-light); }

/* ============================================================
   PRIMITIVES
   ============================================================ */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 0;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
}
.btn-primary:hover { background: #234a39; }

.feedback-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 14px;
  font-weight: 500;
  padding: 11px 20px;
}
.feedback-fab:hover { background: #234a39; }
/* deferred feedback — honest disabled affordance (matches .search.is-disabled) */
.feedback-fab:disabled { background: var(--accent-05); color: var(--text-light); cursor: not-allowed; }
.feedback-fab:disabled:hover { background: var(--accent-05); }

/* pills / badges — small, flat, 0 radius */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  line-height: 1;
  font-family: var(--mono);
  padding: 3px 7px;
  border: 1px solid var(--border-faint);
  color: var(--text-medium);
  white-space: nowrap;
  letter-spacing: 0;
}
.pill.bound   { border-color: var(--border-faint); color: var(--text-light); }
.pill.direct  { border-color: var(--border-faint); color: var(--text-light); }
.pill.pending { border-color: rgba(179,38,30,0.45); color: var(--safety); background: var(--safety-10); }
.pill.safety  { border-color: var(--safety); color: var(--safety); background: var(--safety-10); }
.pill.tier-base    { border-color: var(--border-faint); color: var(--text-light); }
.pill.tier-derived { border-color: rgba(43,89,69,0.3); color: var(--accent); }
.pill.origin { border-color: var(--border-faint); color: var(--text-light); }

/* status dot */
.dot { width: 6px; height: 6px; flex-shrink: 0; display: inline-block; }
.dot.bound   { background: var(--accent); }
.dot.direct  { background: var(--text-light); }
.dot.pending { background: var(--safety); }

/* safety shield icon */
.shield { color: var(--safety); flex-shrink: 0; display: inline-flex; }

/* card */
.card {
  border: 1px solid var(--border-faint);
  background: var(--bg);
  padding: 24px;
}

/* divider */
.hr { height: 1px; background: var(--border-faint); border: none; margin: 0; }

/* small caps label */
.eyebrow {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-medium);
}

/* monospace inline code */
.code {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
}

.muted { color: var(--text-medium); }
.faint { color: var(--text-light); }
.safety-text { color: var(--safety); }
