/* ============================================================
   nitpin docs theme — aligned with nitpin.com
   Dark default (#0A0B0D / #ECEDEA / teal #40C8E0) + light
   (#FAFAF8 / #16181B / deep teal #0C6A7C). The mdbook theme
   picker's light-ish themes (Light, Rust) map to the nitpin
   light palette; the dark ones (Navy, Coal, Ayu) to nitpin dark.
   ============================================================ */

:root {
  --np-font-body: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, system-ui, "Segoe UI", sans-serif;
  --np-font-display: "Bricolage Grotesque", "Hanken Grotesk", -apple-system, system-ui, sans-serif;
  --np-accent: #40C8E0;
  --np-accent-deep: #06343d;
  --np-redline: #E8852E;
  --mono-font: "JetBrains Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace;
  --code-font-size: 0.855em;
}

/* ---------- nitpin light ---------- */
.light, .rust, html:not(.js) {
  --bg: #FAFAF8;
  --fg: #16181B;

  --sidebar-bg: #F2F1ED;
  --sidebar-fg: rgba(22, 24, 27, .78);
  --sidebar-non-existant: rgba(22, 24, 27, .34);
  --sidebar-active: #0C6A7C;
  --sidebar-spacer: rgba(22, 24, 27, .11);

  --scrollbar: rgba(22, 24, 27, .28);

  --icons: rgba(22, 24, 27, .54);
  --icons-hover: #16181B;

  --links: #0C6A7C;

  --inline-code-color: #0C6A7C;

  --theme-popup-bg: #FFFFFF;
  --theme-popup-border: rgba(22, 24, 27, .11);
  --theme-hover: #F2F1ED;

  --quote-bg: #F7F6F2;
  --quote-border: rgba(22, 24, 27, .11);

  --warning-border: #E8852E;

  --table-border-color: rgba(22, 24, 27, .11);
  --table-header-bg: #F2F1ED;
  --table-alternate-bg: #F7F6F2;

  --searchbar-border-color: rgba(22, 24, 27, .18);
  --searchbar-bg: #FFFFFF;
  --searchbar-fg: #16181B;
  --searchbar-shadow-color: rgba(22, 24, 27, .12);
  --searchresults-header-fg: rgba(22, 24, 27, .54);
  --searchresults-border-color: rgba(22, 24, 27, .11);
  --searchresults-li-bg: #F2F1ED;
  --search-mark-bg: rgba(64, 200, 224, .38);

  --color-scheme: light;

  --copy-button-filter: invert(45.49%);
  --copy-button-filter-hover: invert(31%) sepia(60%) saturate(1246%) hue-rotate(152deg) brightness(92%) contrast(94%);

  --footnote-highlight: rgba(64, 200, 224, .45);

  --overlay-bg: rgba(22, 24, 27, .25);

  --blockquote-note-color: #0C6A7C;
  --blockquote-tip-color: #2b7a3d;
  --blockquote-important-color: #6650c8;
  --blockquote-warning-color: #a05f10;
  --blockquote-caution-color: #b03434;

  --sidebar-header-border-color: rgba(22, 24, 27, .11);
}

/* ---------- nitpin dark ---------- */
.navy, .coal, .ayu {
  --bg: #0A0B0D;
  --fg: #ECEDEA;

  --sidebar-bg: #101216;
  --sidebar-fg: rgba(236, 237, 234, .74);
  --sidebar-non-existant: rgba(236, 237, 234, .30);
  --sidebar-active: #7FE0F0;
  --sidebar-spacer: rgba(255, 255, 255, .10);

  --scrollbar: rgba(236, 237, 234, .28);

  --icons: rgba(236, 237, 234, .54);
  --icons-hover: #ECEDEA;

  --links: #7FE0F0;

  --inline-code-color: #7FE0F0;

  --theme-popup-bg: #15171B;
  --theme-popup-border: rgba(255, 255, 255, .10);
  --theme-hover: #1B1E23;

  --quote-bg: #15171B;
  --quote-border: rgba(255, 255, 255, .10);

  --warning-border: #E8852E;

  --table-border-color: rgba(255, 255, 255, .10);
  --table-header-bg: #1B1E23;
  --table-alternate-bg: #101216;

  --searchbar-border-color: rgba(255, 255, 255, .14);
  --searchbar-bg: #15171B;
  --searchbar-fg: #ECEDEA;
  --searchbar-shadow-color: rgba(0, 0, 0, .5);
  --searchresults-header-fg: rgba(236, 237, 234, .54);
  --searchresults-border-color: rgba(255, 255, 255, .10);
  --searchresults-li-bg: #1B1E23;
  --search-mark-bg: #06343d;

  --color-scheme: dark;

  --copy-button-filter: invert(70%);
  --copy-button-filter-hover: invert(85%) sepia(20%) saturate(1200%) hue-rotate(150deg) brightness(105%) contrast(95%);

  --footnote-highlight: #06343d;

  --overlay-bg: rgba(10, 11, 13, .5);

  --blockquote-note-color: #7FE0F0;
  --blockquote-tip-color: #6fcf8a;
  --blockquote-important-color: #b9a5ff;
  --blockquote-warning-color: #E8852E;
  --blockquote-caution-color: #e86a6a;

  --sidebar-header-border-color: rgba(255, 255, 255, .10);
}

@media (prefers-color-scheme: dark) {
  html:not(.js) {
    --bg: #0A0B0D;
    --fg: #ECEDEA;
    --sidebar-bg: #101216;
    --sidebar-fg: rgba(236, 237, 234, .74);
    --sidebar-active: #7FE0F0;
    --links: #7FE0F0;
    --inline-code-color: #7FE0F0;
    --quote-bg: #15171B;
    --quote-border: rgba(255, 255, 255, .10);
    --table-border-color: rgba(255, 255, 255, .10);
    --table-header-bg: #1B1E23;
    --table-alternate-bg: #101216;
    --color-scheme: dark;
  }
}

/* ---------- typography ---------- */

html {
  font-family: var(--np-font-body);
  -webkit-font-smoothing: antialiased;
  font-optical-sizing: auto;
}

body {
  font-family: var(--np-font-body);
}

h1, h2, h3, h4, h5,
.menu-title {
  font-family: var(--np-font-display);
  font-optical-sizing: auto;
  font-weight: 640;
  letter-spacing: -0.012em;
}

h1 { font-variation-settings: "opsz" 40; }
h2 { font-variation-settings: "opsz" 32; }

.content main {
  line-height: 1.62;
  font-size: 16.5px;
}

::selection { background: var(--np-accent); color: var(--np-accent-deep); }
::-moz-selection { background: var(--np-accent); color: var(--np-accent-deep); }

/* ---------- chrome refinements ---------- */

/* hairline under the top bar, like the landing nav */
#menu-bar {
  border-block-end: 1px solid var(--quote-border);
}

.menu-title {
  font-size: 1.35rem;
  font-weight: 680;
}

/* sidebar: quieter, landing-like */
.sidebar {
  font-family: var(--np-font-body);
  font-size: 0.92em;
  line-height: 1.9;
}
.chapter li.chapter-item { margin-block-start: 0.5em; }
.chapter li a:hover { color: var(--sidebar-active); text-decoration: none; }
.chapter li a.active { font-weight: 640; }

/* links: accent, underline on hover only */
.content a { text-decoration: none; }
.content a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* code blocks sit on a surface card with a hairline, like the landing crops */
pre { border-radius: 10px; }
pre > .buttons button { border-radius: 6px; }
pre > code {
  border-radius: 10px;
  border: 1px solid var(--quote-border);
  padding: 1rem 1.25rem;
}

/* inline code: subtle chip */
:not(pre) > code {
  border-radius: 6px;
  padding: 0.1em 0.35em;
  background: var(--quote-bg);
  border: 1px solid var(--quote-border);
}

/* code backgrounds follow the palette's surface tones */
.navy .hljs, .coal .hljs, .ayu .hljs { background: #15171B; }
.light .hljs, .rust .hljs { background: #F7F6F2; }

/* tables: hairline borders, no heavy header */
table { border-collapse: collapse; }
table th, table td { border-color: var(--table-border-color); }
table thead th { font-family: var(--np-font-body); font-weight: 640; }

/* blockquotes: landing-style hairline card */
blockquote {
  border-radius: 8px;
}
