general.css 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461
  1. /* Base styles and content styles */
  2. :root {
  3. /* Browser default font-size is 16px, this way 1 rem = 10px */
  4. font-size: 62.5%;
  5. color-scheme: var(--color-scheme);
  6. }
  7. html {
  8. font-family: "Inter", sans-serif;
  9. color: var(--fg);
  10. background-color: var(--bg);
  11. text-size-adjust: none;
  12. -webkit-text-size-adjust: none;
  13. }
  14. /* H1 - InterDisplay Black */
  15. main h1 {
  16. font-family: "InterDisplay", sans-serif;
  17. font-weight: 900;
  18. border-left: 1px solid var(--h1-border-color);
  19. padding-inline-start: 10px;
  20. }
  21. /* H2-H5 - Inter Bold */
  22. h2, h3, h4, h5 {
  23. font-family: "Inter", sans-serif;
  24. font-weight: 700;
  25. border-left: 1px solid var(--h2-border-color);
  26. padding-inline-start: 10px;
  27. }
  28. h3 {
  29. border-left-color: var(--h3-border-color);
  30. }
  31. h4 {
  32. border-left-color: var(--h4-border-color);
  33. }
  34. h5 {
  35. border-left-color: var(--h5-border-color);
  36. }
  37. /* Italic text */
  38. em, i {
  39. font-family: "Inter", sans-serif;
  40. font-style: italic;
  41. }
  42. body {
  43. margin: 0;
  44. font-size: 1.6rem;
  45. overflow-x: hidden;
  46. }
  47. code {
  48. font-family: var(--mono-font) !important;
  49. font-size: var(--code-font-size);
  50. direction: ltr !important;
  51. background-color: var(--code-bg);
  52. padding: 0.2em 0.4em;
  53. border-radius: 3px;
  54. }
  55. /* make long words/inline code not x overflow */
  56. main {
  57. overflow-wrap: break-word;
  58. }
  59. /* make wide tables scroll if they overflow */
  60. .table-wrapper {
  61. overflow-x: auto;
  62. }
  63. /* Don't change font size in headers. Use inline code colors. */
  64. h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
  65. font-size: unset;
  66. color: var(--inline-code-color);
  67. background-color: var(--hljs-inline-bg);
  68. border: 1px solid var(--hljs-inline-border);
  69. }
  70. .left { float: left; }
  71. .right { float: right; }
  72. .boring { opacity: 0.6; }
  73. .hide-boring .boring { display: none; }
  74. .hidden { display: none !important; }
  75. h2, h3 { margin-block-start: 2.5em; }
  76. h4, h5 { margin-block-start: 2em; }
  77. .header + .header h3,
  78. .header + .header h4,
  79. .header + .header h5 {
  80. margin-block-start: 1em;
  81. }
  82. h1:target::before,
  83. h2:target::before,
  84. h3:target::before,
  85. h4:target::before,
  86. h5:target::before,
  87. h6:target::before,
  88. dt:target::before {
  89. display: inline-block;
  90. content: "";
  91. color:var(--links-hover);
  92. margin-inline-start: -30px;
  93. width: 30px;
  94. font-size:10px;
  95. transform: translateY(-5px);
  96. }
  97. /* This is broken on Safari as of version 14, but is fixed
  98. in Safari Technology Preview 117 which I think will be Safari 14.2.
  99. https://bugs.webkit.org/show_bug.cgi?id=218076
  100. */
  101. :target {
  102. /* Safari does not support logical properties */
  103. scroll-margin-top: calc(var(--menu-bar-height) + 0.5em);
  104. }
  105. .page {
  106. outline: 0;
  107. padding: 0 var(--page-padding);
  108. margin-block-start: calc(0px - var(--menu-bar-height)); /* Compensate for the #mdbook-menu-bar-hover-placeholder */
  109. }
  110. .page-wrapper {
  111. box-sizing: border-box;
  112. background-color: var(--bg);
  113. }
  114. html:not(.js) .page-wrapper,
  115. .js:not(.sidebar-resizing) .page-wrapper {
  116. transition: margin-left 0.3s ease, transform 0.3s ease; /* Animation: slide away */
  117. }
  118. [dir=rtl]:not(.js) .page-wrapper,
  119. [dir=rtl].js:not(.sidebar-resizing) .page-wrapper {
  120. transition: margin-right 0.3s ease, transform 0.3s ease; /* Animation: slide away */
  121. }
  122. .content {
  123. overflow-y: auto;
  124. padding: 0 5px 50px 5px;
  125. }
  126. .content main {
  127. margin-inline-start: auto;
  128. margin-inline-end: auto;
  129. max-width: var(--content-max-width);
  130. }
  131. .content p { line-height: 1.45em; }
  132. .content ol { line-height: 1.45em; }
  133. .content ul { line-height: 1.45em;
  134. list-style-type: square;}
  135. .content a { text-decoration: none; }
  136. .content a:hover { text-decoration: none;
  137. color: var(--links-hover); }
  138. .content img, .content video { max-width: 100%; }
  139. .content .header:link,
  140. .content .header:visited {
  141. color: var(--fg);
  142. }
  143. .content .header:link,
  144. .content .header:visited:hover {
  145. text-decoration: none;
  146. }
  147. table {
  148. margin: 0 auto;
  149. border-collapse: collapse;
  150. font-family: var(--menu-number-font), monospace;
  151. letter-spacing: .1em;
  152. }
  153. table td {
  154. padding: 6px 20px;
  155. border-top: 1px var(--table-border-color) solid;
  156. border-bottom: 1px var(--table-border-color) solid;
  157. border-left: none;
  158. border-right:none;
  159. }
  160. table thead {
  161. background: var(--table-header-bg);
  162. }
  163. table thead td {
  164. font-weight: 700;
  165. border: none;
  166. }
  167. table thead th {
  168. padding: 7px 20px;
  169. }
  170. table thead tr {
  171. border-top: 1px var(--table-header-bg) solid;
  172. border-bottom: 1px var(--table-header-bg) solid;
  173. border-left: none;
  174. border-right:none;
  175. }
  176. /* Alternate background colors for rows */
  177. table tbody tr:nth-child(2n) {
  178. background: var(--table-alternate-bg);
  179. }
  180. blockquote {
  181. margin: 20px 0;
  182. padding: 5px 20px;
  183. color: var(--fg);
  184. background-color: var(--quote-bg);
  185. border-left: .05em solid var(--quote-border);
  186. }
  187. /* TODO: Remove .warning in a future version of mdbook, it is replaced by
  188. blockquote tags. */
  189. .warning {
  190. margin: 20px;
  191. padding: 0 20px;
  192. border-inline-start: 2px solid var(--warning-border);
  193. }
  194. .warning:before {
  195. position: absolute;
  196. width: 3rem;
  197. height: 3rem;
  198. margin-inline-start: calc(-1.5rem - 21px);
  199. content: "ⓘ";
  200. text-align: center;
  201. background-color: var(--bg);
  202. color: var(--warning-border);
  203. font-weight: bold;
  204. font-size: 2rem;
  205. }
  206. blockquote .warning:before {
  207. background-color: var(--quote-bg);
  208. }
  209. kbd {
  210. background-color: var(--table-border-color);
  211. border-radius: 4px;
  212. border: solid 1px var(--theme-popup-border);
  213. box-shadow: inset 0 -1px 0 var(--theme-hover);
  214. display: inline-block;
  215. font-size: var(--code-font-size);
  216. font-family: var(--mono-font);
  217. line-height: 10px;
  218. padding: 4px 5px;
  219. vertical-align: middle;
  220. }
  221. sup {
  222. /* Set the line-height for superscript and footnote references so that there
  223. isn't an awkward space appearing above lines that contain the footnote.
  224. See https://github.com/rust-lang/mdBook/pull/2443#discussion_r1813773583
  225. for an explanation.
  226. */
  227. line-height: 0;
  228. }
  229. .footnote-definition {
  230. font-size: 0.9em;
  231. }
  232. /* The default spacing for a list is a little too large. */
  233. .footnote-definition ul,
  234. .footnote-definition ol {
  235. padding-left: 20px;
  236. }
  237. .footnote-definition > li {
  238. /* Required to position the ::before target */
  239. position: relative;
  240. }
  241. .footnote-definition > li:target {
  242. scroll-margin-top: 50vh;
  243. }
  244. .footnote-reference:target {
  245. scroll-margin-top: 50vh;
  246. }
  247. /* Draws a border around the footnote (including the marker) when it is selected.
  248. TODO: If there are multiple linkbacks, highlight which one you just came
  249. from so you know which one to click.
  250. */
  251. .footnote-definition > li:target::before {
  252. border: 2px solid var(--footnote-highlight);
  253. border-radius: 6px;
  254. position: absolute;
  255. top: -8px;
  256. right: -8px;
  257. bottom: -8px;
  258. left: -32px;
  259. pointer-events: none;
  260. content: "";
  261. }
  262. /* Pulses the footnote reference so you can quickly see where you left off reading.
  263. This could use some improvement.
  264. */
  265. @media not (prefers-reduced-motion) {
  266. .footnote-reference:target {
  267. animation: fn-highlight 0.8s;
  268. border-radius: 2px;
  269. }
  270. @keyframes fn-highlight {
  271. from {
  272. background-color: var(--footnote-highlight);
  273. }
  274. }
  275. }
  276. .tooltiptext {
  277. position: absolute;
  278. visibility: hidden;
  279. color: #fff;
  280. background-color: #333;
  281. transform: translateX(-50%); /* Center by moving tooltip 50% of its width left */
  282. left: -8px; /* Half of the width of the icon */
  283. top: -35px;
  284. font-size: 0.8em;
  285. text-align: center;
  286. border-radius: 6px;
  287. padding: 5px 8px;
  288. margin: 5px;
  289. z-index: 1000;
  290. }
  291. .tooltipped .tooltiptext {
  292. visibility: visible;
  293. }
  294. .chapter li.part-title {
  295. color: var(--sidebar-fg);
  296. margin: 5px 0px;
  297. font-weight: bold;
  298. }
  299. .result-no-output {
  300. font-style: italic;
  301. }
  302. .fa-svg svg {
  303. width: 1em;
  304. height: 1em;
  305. fill: currentColor;
  306. margin-bottom: -0.1em;
  307. }
  308. dt {
  309. font-weight: bold;
  310. margin-top: 0.5em;
  311. margin-bottom: 0.1em;
  312. }
  313. /* This uses a CSS counter to add numbers to definitions, but only if there is
  314. more than one definition. */
  315. dl, dt {
  316. counter-reset: dd-counter;
  317. }
  318. /* When there is more than one definition, increment the counter. The first
  319. selector selects the first definition, and the second one selects definitions
  320. 2 and beyond.*/
  321. dd:has(+ dd), dd + dd {
  322. counter-increment: dd-counter;
  323. /* Use flex display to help with positioning the numbers when there is a p
  324. tag inside the definition. */
  325. display: flex;
  326. align-items: flex-start;
  327. }
  328. /* Shows the counter for definitions. The first selector selects the first
  329. definition, and the second one selections definitions 2 and beyond.*/
  330. dd:has(+ dd)::before, dd + dd::before {
  331. content: counter(dd-counter) ". ";
  332. font-weight: 600;
  333. display: inline-block;
  334. margin-right: 0.5em;
  335. }
  336. dd > p {
  337. /* For loose definitions that have a p tag inside, don't add a bunch of
  338. space before the definition. */
  339. margin-top: 0;
  340. }
  341. /* Remove some excess space from the bottom. */
  342. .blockquote-tag p:last-child {
  343. margin-bottom: 2px;
  344. }
  345. .blockquote-tag {
  346. /* Add some padding to make the vertical bar a little taller than the text.*/
  347. padding: 2px 0px 2px 20px;
  348. /* Add a solid color bar on the left side. */
  349. border-inline-start-style: solid;
  350. border-inline-start-width: 4px;
  351. /* Disable the background color from normal blockquotes . */
  352. background-color: inherit;
  353. /* Disable border blocks from blockquotes. */
  354. border-block-start: none;
  355. border-block-end: none;
  356. }
  357. .blockquote-tag-title svg {
  358. fill: currentColor;
  359. /* Add space between the icon and the title. */
  360. margin-right: 8px;
  361. }
  362. .blockquote-tag-note {
  363. border-inline-start-color: var(--blockquote-note-color);
  364. }
  365. .blockquote-tag-tip {
  366. border-inline-start-color: var(--blockquote-tip-color);
  367. }
  368. .blockquote-tag-important {
  369. border-inline-start-color: var(--blockquote-important-color);
  370. }
  371. .blockquote-tag-warning {
  372. border-inline-start-color: var(--blockquote-warning-color);
  373. }
  374. .blockquote-tag-caution {
  375. border-inline-start-color: var(--blockquote-caution-color);
  376. }
  377. .blockquote-tag-note .blockquote-tag-title {
  378. color: var(--blockquote-note-color);
  379. }
  380. .blockquote-tag-tip .blockquote-tag-title {
  381. color: var(--blockquote-tip-color);
  382. }
  383. .blockquote-tag-important .blockquote-tag-title {
  384. color: var(--blockquote-important-color);
  385. }
  386. .blockquote-tag-warning .blockquote-tag-title {
  387. color: var(--blockquote-warning-color);
  388. }
  389. .blockquote-tag-caution .blockquote-tag-title {
  390. color: var(--blockquote-caution-color);
  391. }
  392. .blockquote-tag-title {
  393. /* Slightly increase the weight for more emphasis. */
  394. font-weight: 600;
  395. /* Vertically center the icon with the text. */
  396. display: flex;
  397. align-items: center;
  398. /* Remove default large margins for a more compact display. */
  399. margin: 2px 0 8px 0;
  400. }
  401. .blockquote-tag-title .fa-svg {
  402. fill: currentColor;
  403. /* Add some space between the icon and the text. */
  404. margin-right: 8px;
  405. }