/* Be Civic renderer — brand tokens + layout. <300 LOC ceiling.
 * Tokens copied from bc-docs/style.css :root; layout adapted for the
 * renderer's three-column shell (no Mintlify selectors).
 */

@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("/fonts/manrope-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --brand-gold: #fae042;
  --brand-red: #ed2939;
  --brand-black: #0a0a0a;
  --brand-white: #ffffff;
  --brand-cream: #f5f4ee;
  --brand-cream-soft: #d4d2cc;
  --brand-ink: #1a1a18;
  --brand-ink-body: #2a2a26;
  --brand-mute-light: #6a6a65;
  --brand-mute-dark: #888884;
  --brand-hairline-light: #ebe9e3;
  --brand-hairline-dark: #232321;
  --display: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --bg: var(--brand-white);
  --fg: var(--brand-ink);
  --fg-soft: var(--brand-ink-body);
  --mute: var(--brand-mute-light);
  --hair: var(--brand-hairline-light);
  --code-bg: #f3efe6;
  --code-border: #e8e3d6;
  --header-h: 56px;
}
html.dark {
  --bg: var(--brand-black);
  --fg: var(--brand-cream);
  --fg-soft: var(--brand-cream-soft);
  --mute: var(--brand-mute-dark);
  --hair: var(--brand-hairline-dark);
  --code-bg: #15151a;
  --code-border: #2a2a28;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
/* scroll-padding-top is set per-heading via scroll-margin-top; using both stacks. */
body {
  font-family: var(--body);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--brand-gold); text-decoration-thickness: 2px; }
h1, h2, h3, h4, h5, h6 {
  font-family: var(--display);
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin: 1.8em 0 0.5em;
  scroll-margin-top: 72px;
  color: var(--fg);
}
h1 { font-weight: 800; font-size: 2.4rem; line-height: 1.1; margin-top: 0.3em; letter-spacing: -0.025em; }
h2 { font-weight: 700; font-size: 1.65rem; margin-top: 2.2em; border-bottom: 1px solid var(--hair); padding-bottom: 0.35em; }
h3 { font-weight: 700; font-size: 1.2rem; margin-top: 1.8em; }
h4 { font-weight: 700; font-size: 1.02rem; margin-top: 1.4em; }
p, ul, ol, table { color: var(--fg-soft); }
code, pre, kbd, samp { font-family: var(--mono); }
code { background: var(--code-bg); padding: 0.15em 0.35em; border-radius: 3px; font-size: 0.88em; border: 1px solid var(--code-border); }
pre { background: var(--code-bg); padding: 1em 1.1em; overflow-x: auto; border-radius: 6px; border: 1px solid var(--code-border); font-size: 0.9em; line-height: 1.5; }
pre code { background: transparent; padding: 0; border: 0; font-size: inherit; }
table { border-collapse: collapse; width: 100%; margin: 1em 0; font-size: 0.95em; }
th, td { border: 1px solid var(--hair); padding: 0.5em 0.7em; text-align: left; vertical-align: top; }
th { background: color-mix(in srgb, var(--hair) 30%, transparent); font-weight: 700; }
hr { border: 0; border-top: 1px solid var(--hair); margin: 2em 0; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--brand-gold); color: var(--brand-ink);
  padding: 0.5em 1em; z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- Top nav ---------- */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 1em;
  padding: 0 1.25em; height: 56px;
  background: var(--bg); border-bottom: 1px solid var(--hair);
  backdrop-filter: saturate(180%) blur(6px);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
}
.wordmark {
  display: inline-flex; align-items: center;
  text-decoration: none; flex-shrink: 0;
  height: 100%; padding: 0.4em 0;
}
.wordmark-img { display: block; height: 22px; width: auto; }
html.light .wordmark-dark, html.dark .wordmark-light { display: none; }
.search { flex: 1; max-width: 360px; margin: 0 auto; }
.search input {
  width: 100%; padding: 0.4em 0.8em;
  border: 1px solid var(--hair); border-radius: 4px;
  background: var(--bg); color: var(--fg); font: inherit;
}
.search input:focus { outline: 2px solid var(--brand-gold); outline-offset: 1px; }
.nav-actions { display: flex; align-items: center; gap: 0.75em; }
.theme-toggle {
  background: transparent; border: 1px solid var(--hair);
  color: var(--fg); width: 32px; height: 32px;
  border-radius: 4px; cursor: pointer; font-size: 1rem;
}
.theme-toggle:hover { border-color: var(--brand-gold); }
.nav-cta {
  font-size: 0.9rem; padding: 0.35em 0.8em;
  border: 1px solid var(--hair); border-radius: 4px; text-decoration: none;
}
.nav-cta:hover { border-color: var(--brand-gold); }
.nav-hamburger {
  display: none; background: transparent; border: 0;
  color: var(--fg); font-size: 1.5em; cursor: pointer;
}

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 220px;
  gap: 2.5em; max-width: 1320px; margin: 0 auto; padding: 2.5em 1.75em;
}
.sidebar {
  position: sticky; top: 72px; align-self: start;
  max-height: calc(100vh - 88px); overflow-y: auto;
  font-size: 0.92em;
  padding-right: 0.5em;
}
.nav-group { margin-bottom: 1.75em; padding-top: 1.25em; border-top: 1px solid var(--hair); }
.nav-group:first-child { padding-top: 0; border-top: 0; }
.nav-group-label {
  font-family: var(--display); font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--mute); margin: 0 0 0.7em; border: 0; padding: 0;
}
.nav-group ul { list-style: none; padding: 0; margin: 0; }
.nav-group li { margin: 0.05em 0; }
.nav-group a {
  display: block; padding: 0.32em 0.55em; border-radius: 4px;
  color: var(--fg-soft); text-decoration: none;
  line-height: 1.4;
}
.nav-group a:hover { background: color-mix(in srgb, var(--brand-gold) 14%, transparent); color: var(--fg); }
.nav-group a[aria-current="page"] {
  color: var(--fg); font-weight: 600;
  text-decoration: underline solid var(--brand-gold);
  text-decoration-thickness: 2px; text-underline-offset: 4px;
  background: color-mix(in srgb, var(--brand-gold) 8%, transparent);
}
.nav-subgroup .nav-sub-label {
  display: block; font-size: 0.85em; color: var(--mute); margin: 0.6em 0 0.25em; font-weight: 600;
}
.nav-subgroup ul { padding-left: 0.8em; border-left: 1px solid var(--hair); margin-left: 0.4em; }

.main { min-width: 0; }
.breadcrumb { color: var(--mute); font-size: 0.85em; margin-bottom: 0.75em; letter-spacing: 0.01em; }
.breadcrumb a { color: var(--mute); text-decoration: none; }
.breadcrumb a:hover { color: var(--fg); text-decoration: underline solid var(--brand-gold); text-underline-offset: 3px; }
.status-badge {
  display: inline-block; font-family: var(--display); font-weight: 700;
  font-size: 0.78rem; letter-spacing: 0.08em; padding: 0.3em 0.65em;
  border-bottom: 2px solid var(--brand-gold); margin-bottom: 0.75em;
  color: var(--fg-soft);
  background: color-mix(in srgb, var(--brand-gold) 10%, transparent);
  border-radius: 3px 3px 0 0;
}
.status-stable { border-bottom-color: var(--hair); background: transparent; color: var(--fg); }
.status-beta { border-bottom-color: var(--brand-red); background: color-mix(in srgb, var(--brand-red) 8%, transparent); }
.status-draft { border-bottom-color: var(--hair); background: transparent; color: var(--mute); }
.page-title { font-size: 2.4rem; margin: 0.3em 0 0.6em; line-height: 1.1; letter-spacing: -0.025em; }
.lede { color: var(--fg-soft); font-size: 1.1em; line-height: 1.55; margin-bottom: 1.75em; max-width: 65ch; }
.content { max-width: 72ch; }
.content > p, .content > ul, .content > ol { max-width: 72ch; }

.toc { font-size: 0.88em; position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 88px); overflow-y: auto; padding-left: 0.5em; border-left: 1px solid var(--hair); }
.toc-label {
  font-family: var(--display); font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--mute); border: 0; padding: 0; margin: 0 0 0.75em;
}
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0.35em 0; line-height: 1.4; }
.toc a { color: var(--mute); text-decoration: none; display: block; padding: 0.1em 0; }
.toc a:hover, .toc a.active { color: var(--fg); border-left: 2px solid var(--brand-gold); margin-left: -0.5em; padding-left: calc(0.5em - 2px); }
.toc a.active { background: color-mix(in srgb, var(--brand-gold) 12%, transparent); font-weight: 600; }

/* ---------- Callouts ---------- */
.callout {
  margin: 1.75em 0; padding: 1em 1.25em;
  border-left: 3px solid var(--brand-gold);
  background: color-mix(in srgb, var(--brand-gold) 7%, transparent);
  border-radius: 0 6px 6px 0;
}
.callout-warning { border-left-color: var(--brand-red); background: color-mix(in srgb, var(--brand-red) 6%, transparent); }
.callout-note { border-left-color: var(--mute); background: color-mix(in srgb, var(--hair) 35%, transparent); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout strong:first-child { font-family: var(--display); font-weight: 700; }
.callout-tip pre { position: relative; white-space: pre-wrap; word-break: break-word; overflow-x: visible; padding-right: 4.5em; }
.copy-btn { position: absolute; top: 0.5em; right: 0.5em; font-family: var(--display); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; padding: 0.35em 0.7em; border-radius: 4px; background: color-mix(in srgb, var(--brand-gold) 22%, transparent); color: var(--fg); border: 1px solid var(--hair); cursor: pointer; transition: background 0.15s; }
.copy-btn:hover { background: color-mix(in srgb, var(--brand-gold) 38%, transparent); }
.copy-btn.copied { background: color-mix(in srgb, var(--brand-gold) 50%, transparent); border-color: var(--brand-gold); }

/* ---------- References ---------- */
.references { margin-top: 2.5em; padding-top: 1.5em; border-top: 1px solid var(--hair); font-size: 0.95em; }
.ref-list { list-style: none; padding: 0; }
.ref-list li { margin: 0.5em 0; padding-left: 1.5em; text-indent: -1.5em; }
.ref-num { font-weight: 700; color: var(--mute); }
.ref-id { font-size: 0.85em; color: var(--mute); }
.ref-meta { font-size: 0.85em; color: var(--mute); }
.ref-token { color: var(--fg-soft); text-decoration: none; }
.ref-token:hover { color: var(--brand-red); }
.mute { color: var(--mute); font-size: 0.9em; }

/* ---------- Skills index ---------- */
.skill-category { margin: 2em 0; }
.skill-category h2 { border-bottom: 1px solid var(--hair); }
.skill-list { list-style: none; padding: 0; }
.skill-row { padding: 0.75em 0; border-bottom: 1px solid var(--hair); }
.skill-link { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; text-decoration: none; }
.skill-title { color: var(--fg); font-weight: 600; }
.skill-status {
  font-family: var(--display); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--mute);
  padding: 0.1em 0.5em; border-radius: 3px; border: 1px solid var(--hair);
}
.skill-desc { color: var(--mute); font-size: 0.9em; margin: 0.3em 0 0; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 4em; padding-top: 1.5em; border-top: 1px solid var(--hair);
  color: var(--mute); font-size: 0.85em;
}
.site-footer a { color: var(--mute); }

/* ---------- Search results panel ---------- */
.search-results {
  position: fixed; top: 56px; right: 1em;
  width: min(420px, 90vw); max-height: 60vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--hair);
  border-radius: 6px; padding: 0.5em; z-index: 50;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.15);
}
.search-results[hidden] { display: none; }
.search-result { display: block; padding: 0.6em; border-radius: 4px; text-decoration: none; }
.search-result:hover { background: color-mix(in srgb, var(--brand-gold) 12%, transparent); }
.search-result-title { color: var(--fg); font-weight: 600; }
.search-result-excerpt { color: var(--mute); font-size: 0.88em; }
.search-result-excerpt mark { background: var(--brand-gold); color: var(--brand-ink); padding: 0 0.2em; }

/* ---------- Mobile (375px) ---------- */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; gap: 1em; padding: 1.25em 1em; }
  .sidebar { display: none; position: fixed; top: 56px; left: 0; width: 82vw; height: calc(100vh - 56px); max-height: none; background: var(--bg); border-right: 1px solid var(--hair); padding: 1.5em; z-index: 50; box-shadow: 4px 0 18px rgba(0,0,0,0.12); }
  .sidebar.open { display: block; }
  .drawer-backdrop:not([hidden]) { display: block; position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 40; }
  .toc { display: none; }
  .site-nav { padding: 0 0.875em; gap: 0.5em; }
  .nav-hamburger { display: block; order: -1; padding: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; }
  .search { max-width: none; }
  .nav-cta { display: none; }
  .content, .content > p, .content > ul, .content > ol { max-width: 100%; }
  .page-title { font-size: 1.75rem; line-height: 1.15; }
  h1 { font-size: 1.85rem; }
  h2 { font-size: 1.3rem; margin-top: 1.6em; }
  h3 { font-size: 1.1rem; }
  pre { font-size: 0.85em; padding: 0.85em 0.95em; }
  .search-results { right: 0.5em; left: 0.5em; width: auto; }
}

/* ---------- Tablet (768px) ---------- */
@media (min-width: 769px) and (max-width: 1023px) {
  .layout { grid-template-columns: 230px minmax(0, 1fr); gap: 2em; padding: 2em 1.5em; }
  .toc { display: none; }
  .content, .content > p, .content > ul, .content > ol { max-width: 100%; }
}

/* ---------- Scrollbar theming (Firefox + WebKit) ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--hair) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--hair); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }
