/*
 * Bootstrap 5.3 (vendor/bootstrap/bootstrap.layer.css) mapped onto the
 * codepeek tokens from theme.css, so Bootstrap components, utilities and the
 * grid share the site's colours, type and radii. Unlayered, so it wins over
 * Bootstrap's own defaults.
 */
:root,
[data-bs-theme="dark"] {
  --bs-body-bg: var(--cp-bg, #08080a);
  --bs-body-color: var(--cp-text, #fafafa);
  --bs-body-font-family: var(--cp-font);
  --bs-font-monospace: var(--cp-font-mono);
  --bs-secondary-color: var(--cp-muted, #a1a1aa);
  --bs-tertiary-color: var(--cp-subtle, #71717a);
  --bs-secondary-bg: var(--cp-surface, #111114);
  --bs-tertiary-bg: var(--cp-surface-2, #18181c);
  --bs-border-color: var(--cp-line-strong, rgba(255, 255, 255, .12));
  --bs-border-color-translucent: var(--cp-line, rgba(255, 255, 255, .07));
  --bs-border-radius: var(--cp-radius, 12px);
  --bs-border-radius-sm: var(--cp-radius-sm, 8px);
  --bs-border-radius-lg: var(--cp-radius-lg, 20px);
  --bs-emphasis-color: #fff;
  --bs-link-color: var(--cp-accent);
  --bs-link-hover-color: var(--cp-accent);
  --bs-link-color-rgb: 198, 255, 61;
  --bs-link-hover-color-rgb: 198, 255, 61;
  --bs-primary: var(--cp-accent);
  --bs-primary-rgb: 198, 255, 61;
  --bs-focus-ring-color: color-mix(in srgb, var(--cp-accent) 35%, transparent);
  --bs-gutter-x: 1.5rem;
}

/* One fluid page gutter for every Bootstrap container on the site. */
.container,
.container-fluid {
  --bs-gutter-x: clamp(1rem, 3vw, 2.5rem);
}

.btn-primary {
  --bs-btn-color: var(--cp-accent-ink);
  --bs-btn-bg: var(--cp-accent);
  --bs-btn-border-color: var(--cp-accent);
  --bs-btn-hover-color: var(--cp-accent-ink);
  --bs-btn-hover-bg: color-mix(in srgb, var(--cp-accent) 88%, #fff);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--cp-accent-ink);
  --bs-btn-active-bg: var(--cp-accent);
  --bs-btn-active-border-color: transparent;
  font-weight: 600;
}

/* Type: Montserrat for every heading, Inter for the rest (tokens in theme.css).
   Catalogue elements render in their own isolated preview, so this never
   reaches the elements' own markup. */
h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6,
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
  font-family: var(--cp-font-display) !important;
}

/* style.css starts with `*{margin:0;padding:0}`, which (being unlayered) also
   wipes Bootstrap's grid spacing. Give the layout primitives theirs back;
   the spacing utilities (p-*, m-*, gap-*) are !important and unaffected. */
/* Page containers share the header island's box (--cp-page, theme.css), so
   any .container/.container-fluid lines up with .site-header__inner. The
   gutter lives outside the box; rows' negative margins fall into it and the
   columns' content starts exactly at the header edge. */
.container, .container-fluid, .container-sm, .container-md, .container-lg, .container-xl, .container-xxl {
  box-sizing: border-box;
  width: var(--cp-page);
  max-width: none;
  margin-right: auto;
  margin-left: auto;
  padding-right: 0;
  padding-left: 0;
}

.row {
  margin-top: calc(-1 * var(--bs-gutter-y));
  margin-right: calc(-.5 * var(--bs-gutter-x));
  margin-left: calc(-.5 * var(--bs-gutter-x));
}

.row > * {
  margin-top: var(--bs-gutter-y);
  padding-right: calc(var(--bs-gutter-x) * .5);
  padding-left: calc(var(--bs-gutter-x) * .5);
}
