:root {
  --md-default-bg-color: var(--background);
  --md-default-fg-color: var(--foreground);
  --md-primary-fg-color: var(--brand);
  --md-accent-fg-color: var(--accent);
  --md-code-bg-color: var(--code-bg);
  --md-code-fg-color: var(--code-fg);
  --md-border-color: var(--border);
}

:root,
.md-typeset {
  font-size: 16px;
}

.md-typeset h1 {
  font-size: 36px;
  line-height: 44px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

@media (min-width:768px) {
  .md-typeset h1 {
    font-size: 44px;
    line-height: 52px
  }
}

.md-typeset h2 {
  font-size: 24px;
  line-height: 32px;
  font-weight: 600;
}

.md-typeset p,
.md-typeset li {
  font-size: 16px;
  line-height: 24px;
}

.md-typeset small {
  font-size: 12px;
  line-height: 16px;
}

.md-typeset code {
  background: color-mix(in oklch, var(--muted) 60%, transparent);
  padding: .1rem .3rem;
  border-radius: 6px;
}

.md-typeset pre>code {
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* Cards: callouts and admonitions styled like landing cards */
.md-typeset .admonition,
.md-typeset details {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.md-typeset .admonition>.admonition-title {
  font-weight: 600;
}

/* Tables */
.md-typeset table:not([class]) {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.md-typeset table:not([class]) th {
  background: color-mix(in oklch, var(--surface) 98%, transparent);
  color: var(--foreground);
  text-transform: uppercase;
  font-size: 12px;
}

.md-typeset table:not([class]) td,
.md-typeset table:not([class]) th {
  border-color: color-mix(in oklch, var(--border) 60%, transparent);
}

/* Links use brand accent tone */
.md-typeset a {
  color: var(--accent);
}

.md-header,
.md-footer,
.md-nav {
  border-color: var(--border);
}

/* Header matches dashboard topbar */
.md-header {
  background: var(--surface);
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
  box-shadow: none;
}

.md-header__inner {
  max-width: 1200px;
  margin: 0 auto;
}

.md-header a {
  color: var(--foreground);
}

/* Sidebar/nav */
.md-sidebar--primary {
  border-right: 1px solid var(--border);
}

.md-nav__link {
  color: var(--foreground);
}

.md-nav__link:hover {
  color: var(--accent);
}

.md-nav__link--active,
.md-nav__item--active>.md-nav__link {
  color: var(--foreground);
  font-weight: 600;
  border-left: 2px solid var(--accent);
}

/* Buttons */
.md-button--primary {
  background-color: var(--btn-bg);
  color: var(--btn-fg);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.md-button {
  border-radius: var(--radius-sm);
}

/* Containers to align with full-width grid: left sidebar + centered content */
.md-main__inner {
  max-width: none;
  width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* Make sidebar sticky and flush left with clear background and border */
.md-sidebar--primary {
  position: sticky;
  top: 72px;
  height: calc(100vh - 72px);
  background: var(--background);
  border-right: 1px solid var(--border);
}

/* Article content as a card, centered within content column */
.md-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin: 24px auto 48px auto;
  max-width: 1200px;
}

.md-content__inner {
  padding-top: 0;
}

/* Search and header controls to match buttons */
.md-search__form {
  border-radius: var(--radius-sm);
}

.md-search__input {
  border-radius: var(--radius-sm);
}

/* Strong contrast in dark scheme – remove light spots */
[data-md-color-scheme="slate"] .md-header,
[data-md-color-scheme="slate"] .md-sidebar--primary {
  background: var(--background);
  color: var(--foreground);
}

/* Dark content card slightly elevated but not bright */
[data-md-color-scheme="slate"] .md-content {
  background: var(--bg-2-d);
  color: var(--foreground);
}

/* Improve nav readability in dark mode */
[data-md-color-scheme="slate"] .md-nav__link {
  color: var(--fg-2-d);
}

[data-md-color-scheme="slate"] .md-nav__link:hover,
[data-md-color-scheme="slate"] .md-nav__link--active,
[data-md-color-scheme="slate"] .md-nav__item--active>.md-nav__link {
  color: var(--foreground);
}

/* Search inputs tone down in dark */
[data-md-color-scheme="slate"] .md-search__form,
[data-md-color-scheme="slate"] .md-search__input {
  background: var(--bg-2-d);
}