/* === Foundation Protocol — minimal docs theme === */

:root {
  --md-text-font: "Inter", "Noto Sans SC", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --md-code-font: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

[data-md-color-scheme="default"] {
  --fp-accent: #5b3fb6;
  --fp-border: rgba(15, 18, 32, 0.09);
  --fp-border-strong: rgba(15, 18, 32, 0.22);
  --fp-hover-bg: rgba(15, 18, 32, 0.025);
  --fp-muted: #6b6b75;

  --md-typeset-a-color: var(--fp-accent);
  --md-accent-fg-color: var(--fp-accent);
}

[data-md-color-scheme="slate"] {
  --fp-accent: #b4a0ec;
  --fp-border: rgba(255, 255, 255, 0.08);
  --fp-border-strong: rgba(255, 255, 255, 0.22);
  --fp-hover-bg: rgba(255, 255, 255, 0.04);
  --fp-muted: #9a98a4;

  --md-default-bg-color: #0f0f12;
  --md-code-bg-color: #18181d;
  --md-typeset-a-color: var(--fp-accent);
  --md-accent-fg-color: var(--fp-accent);
}

/* --- Header: flat, hairline bottom border --- */

.md-header {
  box-shadow: none;
  border-bottom: 1px solid var(--fp-border);
}

.md-header__inner {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
}

.md-tabs {
  border-bottom: 1px solid var(--fp-border);
  box-shadow: none;
}

/* --- Dark-mode logo swap --- */

[data-md-color-scheme="slate"] .md-header__button.md-logo img,
[data-md-color-scheme="slate"] .md-header__button.md-logo svg {
  content: url("logo-dark.png");
}

/* --- Typography --- */

.md-typeset {
  font-size: 0.7rem;
  line-height: 1.7;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.md-typeset h1 {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

.md-typeset h2 {
  font-weight: 600;
  letter-spacing: -0.01em;
  font-size: 1.02rem;
  margin-top: 2.4rem;
  margin-bottom: 0.85rem;
}

.md-typeset h3 {
  font-weight: 600;
  font-size: 0.88rem;
}

.md-typeset h1 + p {
  font-size: 0.7rem;
  line-height: 1.7;
  color: var(--fp-muted);
  margin-top: 0;
  margin-bottom: 1.6em;
  border-left: 2px solid var(--fp-muted);
  padding: 0.1rem 0 0.1rem 0.85rem;
}

/* --- Cards: flat, hairline, no shadow, whole-card clickable --- */

.md-typeset .grid.cards > ul > li,
.md-typeset .grid.cards > ol > li,
.md-typeset .grid > .card {
  position: relative;
  border: 1px solid var(--fp-border);
  border-radius: 8px;
  box-shadow: none;
  background: transparent;
  padding: 1.1rem 1.25rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.md-typeset .grid.cards > ul > li:hover,
.md-typeset .grid.cards > ol > li:hover,
.md-typeset .grid > .card:hover {
  border-color: var(--fp-border-strong);
  background: var(--fp-hover-bg);
  box-shadow: none;
  transform: none;
}

/* Stretch the title link to cover the whole card (still allows
   text selection in the description because we lift descendant
   paragraphs above the overlay). */
.md-typeset .grid.cards > ul > li > p:first-child > a::after,
.md-typeset .grid.cards > ol > li > p:first-child > a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 1;
}

.md-typeset .grid.cards > ul > li > *:not(:first-child),
.md-typeset .grid.cards > ol > li > *:not(:first-child) {
  position: relative;
  z-index: 2;
}

.md-typeset .grid.cards p:first-child {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.4em;
}

.md-typeset .grid.cards .twemoji,
.md-typeset .grid.cards svg {
  fill: var(--fp-muted);
  height: 1.1em;
  width: 1.1em;
}

/* --- Code blocks --- */

.md-typeset pre {
  border-radius: 8px;
}

.md-typeset .highlight pre {
  border: 1px solid var(--fp-border);
}

.md-typeset code {
  font-feature-settings: "calt", "liga";
}

/* --- Inline images --- */

.md-typeset p img {
  max-width: 100%;
  border-radius: 8px;
}

.md-typeset p:has(> img) {
  margin: 2rem 0 2.5rem;
  text-align: center;
}

/* --- Sidebar: lower-key titles --- */

.md-nav__title {
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--fp-muted);
}

.md-nav__link {
  transition: color 0.12s ease;
}

/* --- Tabs --- */

.md-tabs__link {
  font-size: 0.78rem;
  font-weight: 500;
  opacity: 0.75;
  transition: opacity 0.15s ease;
}

.md-tabs__link:hover,
.md-tabs__link--active {
  opacity: 1;
}

/* --- Search --- */

.md-search__form {
  border-radius: 8px;
}

/* --- Tables --- */

.md-typeset table:not([class]) {
  border-radius: 8px;
  overflow: hidden;
  font-size: 0.76rem;
  border: 1px solid var(--fp-border);
}

.md-typeset table:not([class]) th {
  font-weight: 600;
}

/* --- Footer --- */

.md-footer-meta {
  font-size: 0.7rem;
}

/* --- Scrollbars --- */

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-thumb {
  background: var(--fp-border-strong);
  border-radius: 5px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
