/* book.css: the fromzero look on top of mdbook. Only fonts and mdbook's own colour variables, plus a few
   reading touches: delete this file to get stock mdbook back. The theme follows the system: "light" (paper),
   or "navy" (ink) when the system is dark. */

/* reading text: Charter where the system has it (macOS), else the bundled Source Serif 4 (a screen serif in the same
   spirit). Headings and everything you click: the system's own sans. Code: JetBrains Mono. */
@font-face { font-family: "Source Serif 4"; src: url("/fonts/source-serif.woff2") format("woff2");
  font-weight: 200 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Source Serif 4"; src: url("/fonts/source-serif-italic.woff2") format("woff2");
  font-weight: 200 900; font-style: italic; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/jetbrains-mono.woff2") format("woff2");
  font-weight: 100 800; font-style: normal; font-display: swap; }

.light, html:not(.js) {                                  /* paper */
  --bg: #fbfaf7; --fg: #23262b;
  --sidebar-bg: #f3f1ec; --sidebar-fg: #3d424a; --sidebar-non-existant: #9ca1a8; --sidebar-active: #2156c4;
  --sidebar-spacer: #e4e0d8; --sidebar-header-border-color: #e4e0d8;
  --scrollbar: #cbc6bd; --icons: #8c9097; --icons-hover: #23262b;
  --links: #2156c4; --inline-code-color: #9a3f12;
  --theme-popup-bg: #ffffff; --theme-popup-border: #e4e0d8; --theme-hover: #ebe8e1;
  --quote-bg: #f4f2ec; --quote-border: #e4e0d8;
  --table-border-color: #e4e0d8; --table-header-bg: #f3f1ec; --table-alternate-bg: transparent;
  --searchbar-border-color: #d6d1c7; --searchbar-bg: #ffffff; --searchbar-fg: #23262b; --searchresults-li-bg: #f3f1ec;
  --fz-code-bg: #f4f2ec;
}
.navy {                                                  /* ink */
  --bg: #15171b; --fg: #d8dbe0;
  --sidebar-bg: #101215; --sidebar-fg: #aab0b9; --sidebar-non-existant: #5f656e; --sidebar-active: #8db4ff;
  --sidebar-spacer: #22252b; --sidebar-header-border-color: #22252b;
  --scrollbar: #3a3f48; --icons: #7b818a; --icons-hover: #d8dbe0;
  --links: #8db4ff; --inline-code-color: #f2b48c;
  --theme-popup-bg: #1b1e23; --theme-popup-border: #2a2e35; --theme-hover: #1f2329;
  --quote-bg: #1a1d22; --quote-border: #2a2e35;
  --table-border-color: #2a2e35; --table-header-bg: #1a1d22; --table-alternate-bg: transparent;
  --searchbar-border-color: #2a2e35; --searchbar-bg: #1b1e23; --searchbar-fg: #d8dbe0; --searchresults-li-bg: #1b1e23;
  --fz-code-bg: #1a1d22;
}

:root {
  --content-max-width: 760px;
  --fz-radius: 10px;
}
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* type: the system's own UI font (San Francisco, Segoe UI, Cantarell/Ubuntu...), a little more air */
:root {
  --mono-font: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; --code-font-size: 0.8em;
  --fz-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Ubuntu, Cantarell, sans-serif;
  --fz-serif: Charter, "Bitstream Charter", "Source Serif 4", "Iowan Old Style", Georgia, serif;
}
html, body, .sidebar, .menu-bar { font-family: var(--fz-sans); -webkit-font-smoothing: antialiased; }
.content main { font-family: var(--fz-serif); font-size: 2rem; line-height: 1.62; letter-spacing: -0.003em; }
.content main h1, .content main h2, .content main h3, .content main h4,
.content main table, .content main details > summary, .content main .pf-ui { font-family: var(--fz-sans); }
.content main table { font-size: 0.82em; line-height: 1.5; }
@media (max-width: 620px) { .content main { font-size: 1.8rem; } }
.content main h1 { font-size: 3.6rem; font-weight: 700; line-height: 1.2; letter-spacing: -0.02em; margin-top: 1.2em; }
.content main h2 { font-size: 2.5rem; font-weight: 700; letter-spacing: -0.01em; margin-top: 2.2em; padding-bottom: 0.3em;
  border-bottom: 1px solid var(--table-border-color); }
.content main h3 { font-size: 2.05rem; font-weight: 700; margin-top: 1.8em; }
.content main p, .content main li { max-width: 68ch; }
.content a { text-underline-offset: 0.2em; }

/* code: rounded, framed */
.content pre { border-radius: var(--fz-radius); border: 1px solid var(--table-border-color); }
.content pre > code.hljs, .content pre > code { background: var(--fz-code-bg); }
.content pre > code { padding: 1.1rem 1.4rem; }
.content :not(pre) > code { border-radius: 5px; padding: 0.1em 0.35em; }

/* the "In one sentence" / "Goal" box and other quotes: a soft callout */
.content blockquote {
  margin: 1.6em 0; padding: 0.9em 1.3em; border: 1px solid var(--quote-border); border-left: 4px solid var(--links);
  border-radius: var(--fz-radius); background: var(--quote-bg);
}
.content blockquote p:first-child { margin-top: 0; }
.content blockquote p:last-child { margin-bottom: 0; }

/* tables: lighter lines, rounded frame */
.content .table-wrapper { border: 1px solid var(--table-border-color); border-radius: var(--fz-radius); }
.content table { margin: 0; width: 100%; }
.content table td, .content table th { border: 0; border-bottom: 1px solid var(--table-border-color); padding: 0.55em 0.9em; }
.content table tr:last-child td { border-bottom: 0; }
.content table thead th { text-align: left; font-weight: 600; }

/* collapsibles (Hint, Solution, Go deeper, Check yourself): cards that open smoothly */
.content details {
  margin: 1.1em 0; border: 1px solid var(--table-border-color); border-radius: var(--fz-radius);
  background: var(--quote-bg); overflow: hidden; padding: 0 1.1em;     /* the padding also spaces bare text */
  interpolate-size: allow-keywords;                   /* lets the height animate where browsers support it */
}
.content details > summary {
  list-style: none; cursor: pointer; margin: 0 -1.1em; padding: 0.75em 1.1em 0.75em 2.5em; font-weight: 500;
  display: block; position: relative; transition: background-color 0.15s;   /* block: inline code stays in the line */
}
.content details > summary::-webkit-details-marker { display: none; }
.content details > summary::before {
  content: "›"; display: inline-block; width: 0.8em; position: absolute; left: 1.1em; font-weight: 700; color: var(--links);
  transition: transform 0.2s ease;
}
.content details[open] > summary::before { transform: rotate(90deg); }
.content details > summary:hover { background: var(--theme-hover); }
.content details[open] > summary { border-bottom: 1px solid var(--table-border-color); margin-bottom: 0.8em; }
.content details[open] { padding-bottom: 1em; }
.content details > :last-child { margin-bottom: 0; }
.content details::details-content {
  block-size: 0; opacity: 0;
  transition: block-size 0.25s ease, opacity 0.2s ease, content-visibility 0.25s allow-discrete;
}
.content details[open]::details-content { block-size: auto; opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .content details::details-content, .content details > summary::before { transition: none; }
}

/* animations draw their own panel in the page's colours */
.content iframe.stage { margin: 0.6em 0 1.2em; }

/* sidebar and page arrows: calmer */
.sidebar .chapter li a { border-radius: 6px; padding: 0.2em 0.5em; transition: background-color 0.15s; }
.sidebar .chapter li a:hover { background: var(--theme-hover); text-decoration: none; }
.nav-chapters { transition: color 0.15s, background-color 0.15s; border-radius: 10px; }

/* code must show exactly what you type: no ligatures (<= stays <=, == stays ==) */
code, pre, kbd, .hljs { font-variant-ligatures: none; font-feature-settings: "liga" 0, "calt" 0; }
.content td code { white-space: nowrap; }
