1
0

responsive.css 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. /* CSS3_ style sheet for the output of Docutils HTML5 writer. */
  2. /* Generic responsive design for all screen sizes. */
  3. /* */
  4. /* :Author: Günter Milde */
  5. /* */
  6. /* :Id: $Id: responsive.css 9079 2022-06-19 14:00:56Z milde $ */
  7. /* :Copyright: © 2021 Günter Milde. */
  8. /* :License: Released under the terms of the `2-Clause BSD license`_, */
  9. /* in short: */
  10. /* */
  11. /* Copying and distribution of this file, with or without modification, */
  12. /* are permitted in any medium without royalty provided the copyright */
  13. /* notice and this notice are preserved. */
  14. /* */
  15. /* This file is offered as-is, without any warranty. */
  16. /* */
  17. /* .. _2-Clause BSD license: http://www.spdx.org/licenses/BSD-2-Clause */
  18. /* .. _CSS3: https://www.w3.org/Style/CSS/ */
  19. /* Note: */
  20. /* This style sheet is provisional: */
  21. /* the API is not settled and may change with any minor Docutils version. */
  22. /* General Settings */
  23. /* ================ */
  24. * { box-sizing: border-box; }
  25. body {
  26. background-color: #fafaf6;
  27. margin: auto;
  28. --field-indent: 6.6em; /* indent of fields in field lists */
  29. --sidebar-margin-right: 0; /* adapted in media queries below */
  30. }
  31. main {
  32. counter-reset: figure table;
  33. }
  34. body > * {
  35. background-color: white;
  36. line-height: 1.6;
  37. padding: 0.5rem calc(29% - 7.2rem); /* go from 5% to 15% (8.15em/54em) */
  38. margin: auto;
  39. max-width: 100rem;
  40. }
  41. sup, sub { /* avoid additional inter-line space for lines with sup/sub */
  42. line-height: 1;
  43. }
  44. /* Vertical Space (Parskip) */
  45. p, ol, ul, dl, li,
  46. div.line-block,
  47. .topic,
  48. .footnote, .citation,
  49. div > math,
  50. table {
  51. margin-top: 0.5em;
  52. margin-bottom: 0.5em;
  53. }
  54. h1, h2, h3, h4, h5, h6,
  55. dl > dd, details > p:last-child {
  56. margin-bottom: 0.5em;
  57. }
  58. /* Indented Blocks */
  59. blockquote, figure, .topic {
  60. margin: 1em 2%;
  61. padding-left: 1em;
  62. }
  63. div.line-block div.line-block,
  64. pre, dd, dl.option-list {
  65. margin-left: calc(2% + 1em);
  66. }
  67. /* Object styling */
  68. /* ============== */
  69. footer, header {
  70. font-size: small;
  71. }
  72. /* Frontmatter */
  73. div.dedication {
  74. padding: 0;
  75. margin: 1.4em 0;
  76. font-style: italic;
  77. font-size: large;
  78. }
  79. .dedication p.topic-title {
  80. display: none;
  81. }
  82. blockquote p.attribution,
  83. .topic p.attribution {
  84. text-align: right;
  85. }
  86. /* Table of Contents */
  87. nav.contents ul {
  88. padding-left: 1em;
  89. }
  90. ul.auto-toc > li > p { /* hanging indent */
  91. padding-left: 1em;
  92. text-indent: -1em;
  93. }
  94. main > nav.contents ul:not(.auto-toc) {
  95. list-style-type: square;
  96. }
  97. main > nav.contents ul ul:not(.auto-toc) {
  98. list-style-type: disc;
  99. }
  100. main > nav.contents ul ul ul:not(.auto-toc) {
  101. list-style-type: '\2B29\ ';
  102. }
  103. main > nav.contents ul ul ul ul:not(.auto-toc) {
  104. list-style-type: '\2B1D\ ';
  105. }
  106. main > nav.contents ul ul ul ul ul:not(.auto-toc) {
  107. list-style-type: '\2B2A\ ';
  108. }
  109. nav.contents ul > li::marker {
  110. color: grey;
  111. }
  112. /* Transitions */
  113. hr {
  114. margin: 1em 10%;
  115. }
  116. /* Lists */
  117. ul, ol {
  118. padding-left: 1.1em; /* indent by bullet width (Firefox, DejaVu fonts) */
  119. }
  120. dl.field-list > dd,
  121. dl.docinfo > dd {
  122. margin-left: var(--field-indent); /* adapted in media queries or HTML */
  123. }
  124. dl.option-list > dd {
  125. margin-left: 20%;
  126. }
  127. /* run-in: start field-body on same line after long field names */
  128. dl.field-list.run-in > dd p {
  129. display: block;
  130. }
  131. /* "description style" like in most dictionaries, encyclopedias etc. */
  132. dl.description {
  133. display: flow-root;
  134. }
  135. dl.description > dt {
  136. clear: left;
  137. float: left;
  138. margin: 0;
  139. padding: 0;
  140. padding-right: 0.3em;
  141. font-weight: bold;
  142. }
  143. dl.description > dd:after {
  144. display: table;
  145. content: "";
  146. clear: left; /* clearfix for empty descriptions */
  147. }
  148. /* start lists nested in description/field lists on new line */
  149. dd > dl:first-child,
  150. dd > ul:first-child,
  151. dd > ol:first-child {
  152. clear: left;
  153. }
  154. /* disclosures */
  155. details { padding-left: 1em; }
  156. summary { margin-left: -1em; }
  157. /* Footnotes and Citations */
  158. .footnote {
  159. font-size: small;
  160. }
  161. /* Images, Figures, and Tables */
  162. img {
  163. display: block;
  164. }
  165. p > img, p > a > img,
  166. figure > img, figure > a > img {
  167. display: inline;
  168. }
  169. figcaption,
  170. table > caption {
  171. /* font-size: small; */
  172. font-style: italic;
  173. }
  174. figcaption > .legend {
  175. font-size: small;
  176. font-style: initial;
  177. }
  178. figure.numbered > figcaption > p:before {
  179. counter-increment: figure;
  180. content: "Figure " counter(figure) ": ";
  181. font-weight: bold;
  182. font-style: initial;
  183. }
  184. table tr {
  185. text-align: left;
  186. vertical-align: baseline;
  187. }
  188. table.booktabs { /* "booktabs" style (no vertical lines) */
  189. border-top: 2px solid;
  190. border-bottom: 2px solid;
  191. }
  192. table.booktabs * {
  193. border: 0;
  194. }
  195. table.booktabs th {
  196. border-bottom: thin solid;
  197. }
  198. table.numbered > caption:before {
  199. counter-increment: table;
  200. content: "Table " counter(table) ": ";
  201. font-weight: bold;
  202. font-style: initial;
  203. }
  204. /* Admonitions and System Messages */
  205. .admonition,
  206. div.system-message {
  207. border: thin solid silver;
  208. margin: 1em 2%;
  209. padding: 0.5em 1em;
  210. }
  211. .caution p.admonition-title,
  212. .attention p.admonition-title,
  213. .danger p.admonition-title,
  214. .warning p.admonition-title,
  215. div.error {
  216. color: maroon;
  217. }
  218. div.system-message > p > span.literal {
  219. overflow-wrap: break-word;
  220. }
  221. /* Literal and Code */
  222. pre.literal-block, pre.doctest{
  223. padding: 0.2em;
  224. overflow-x: auto;
  225. }
  226. .literal-block, .doctest, span.literal {
  227. background-color: #f6f9f8;
  228. }
  229. .system-message span.literal {
  230. background-color: inherit;
  231. }
  232. /* basic highlighting: for a complete scheme, see */
  233. /* https://docutils.sourceforge.io/sandbox/stylesheets/ */
  234. pre.code .comment, code .comment { color: #5C6576 }
  235. pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
  236. pre.code .literal.string, code .literal.string { color: #0C5404 }
  237. pre.code .name.builtin, code .name.builtin { color: #352B84 }
  238. pre.code .deleted, code .deleted { background-color: #DEB0A1}
  239. pre.code .inserted, code .inserted { background-color: #A3D289}
  240. /* Hyperlink References */
  241. a {
  242. text-decoration: none; /* for chromium */
  243. /* Wrap links at any place, if this is the only way to prevent overflow */
  244. overflow-wrap: break-word;
  245. }
  246. .contents a, a.toc-backref, a.citation-reference {
  247. overflow-wrap: inherit;
  248. }
  249. /* Undecorated Links (see also minimal.css) */
  250. /* a.citation-reference, */
  251. .citation a.fn-backref {
  252. color: inherit;
  253. }
  254. a:hover {
  255. text-decoration: underline;
  256. }
  257. *:hover > a.toc-backref:after {
  258. content: " \2191"; /* ↑ UPWARDS ARROW */
  259. color: grey;
  260. }
  261. *:hover > a.self-link:after {
  262. content: "\1F517"; /* LINK SYMBOL */
  263. color: grey;
  264. font-size: smaller;
  265. margin-left: 0.2em;
  266. }
  267. /* highlight the target of the current URL */
  268. section:target > h2, section:target > h3, section:target > h4,
  269. section:target > h5, section:target > h6,
  270. .contents :target,
  271. .contents:target > .topic-title,
  272. [role="doc-biblioentry"]:target > .label,
  273. [role="doc-biblioref"]:target,
  274. [role="note"]:target, /* Docutils 0.18 ... 0.19 */
  275. [role="doc-footnote"]:target, /* Docutils >= 0.20 */
  276. [role="doc-noteref"]:target {
  277. background-color: #d2e6ec;
  278. }
  279. /* Block Alignment */
  280. /* Let content flow to the side of aligned images and figures */
  281. /* no floats around this elements */
  282. footer, header, hr,
  283. h1, h2, h3 {
  284. clear: both;
  285. }
  286. img.align-left,
  287. video.align-left,
  288. figure.align-left,
  289. table.align-left {
  290. margin-left: 0;
  291. padding-left: 0;
  292. margin-right: 0.5em;
  293. clear: left;
  294. float: left;
  295. }
  296. img.align-right,
  297. video.align-right,
  298. figure.align-right,
  299. table.align-right {
  300. margin-left: 0.5em;
  301. margin-right: 0;
  302. clear: right;
  303. float: right;
  304. }
  305. /* Margin Elements */
  306. /* see below for screen size dependent rules */
  307. .sidebar,
  308. .marginal,
  309. .admonition.marginal {
  310. max-width: 40%;
  311. border: none;
  312. background-color: #efefea;
  313. margin: 0.5em var(--sidebar-margin-right) 0.5em 1em;
  314. padding: 0.5em;
  315. padding-left: 0.7em;
  316. clear: right;
  317. float: right;
  318. font-size: small;
  319. }
  320. .sidebar {
  321. width: 40%;
  322. }
  323. /* Math */
  324. /* for math-output=MathML (for math-output=HTML, see math.css) */
  325. math .boldsymbol {
  326. font-weight: bold;
  327. }
  328. mstyle.mathscr, mi.mathscr {
  329. font-family: STIX;
  330. }
  331. /* Adaptive page layout */
  332. /* ==================== */
  333. @media (max-width: 30em) {
  334. /* Smaller margins and no floating elements for small screens */
  335. /* (main text less than 40 characters/line) */
  336. body > * {
  337. padding: 0.5rem 5%;
  338. line-height: 1.4
  339. }
  340. .sidebar,
  341. .marginal,
  342. .admonition.marginal {
  343. width: auto;
  344. max-width: 100%;
  345. float: none;
  346. }
  347. dl.option-list,
  348. pre {
  349. margin-left: 0;
  350. }
  351. body {
  352. --field-indent: 4em;
  353. }
  354. dl.field-list.narrow, dl.docinfo, dl.option-list {
  355. --field-indent: 2.4em;
  356. }
  357. pre, pre * {
  358. font-size: 0.9em;
  359. /* overflow: auto; */
  360. }
  361. }
  362. @media (min-width: 54em) {
  363. /* Move ToC to the left */
  364. /* Main text width before: 70% ≙ 35em ≙ 75…95 chrs (Dejavu/Times) */
  365. /* after: ≳ 30em ≙ 54…70 chrs (Dejavu/Times) */
  366. body.with-toc {
  367. padding-left: 8%;
  368. }
  369. body.with-toc > * {
  370. margin-left: 0;
  371. padding-left: 22rem; /* fallback for webkit */
  372. padding-left: min(22%, 22rem);
  373. padding-right: 7%;
  374. }
  375. main > nav.contents { /* global ToC */
  376. position: fixed;
  377. top: 0;
  378. left: 0;
  379. width: min(25%, 25em);
  380. height: 100vh;
  381. margin: 0;
  382. background-color: #fafaf6;
  383. padding: 1em 2% 0 2%;
  384. overflow: auto;
  385. }
  386. main > nav.contents > * {
  387. padding-left: 0;
  388. line-height: 1.4;
  389. }
  390. main > nav.contents a {
  391. color: inherit;
  392. }
  393. }
  394. @media (min-width: 70em) {
  395. body {
  396. --field-indent: 9em;
  397. }
  398. }
  399. @media (min-width: 77em) {
  400. /* Move marginalia to 6rem from right border */
  401. /* .sidebar, */
  402. /* .marginal, */
  403. /* .admonition.marginal { */
  404. /* margin-right: calc(6rem - 15%); */
  405. /* } */
  406. /* BUG: margin is calculated for break point width */
  407. /* workaround: variable + many breakpoints */
  408. body > * {
  409. padding-left: 18%;
  410. padding-right: 28%; /* fallback for webkit */
  411. padding-right: min(28%, 28rem);
  412. --sidebar-margin-right: -20rem;
  413. }
  414. /* limit main text to ~ 50em ≙ 85…100 characters DejaVu rsp. …120 Times */
  415. body.with-toc > * {
  416. padding-left: min(22%, 22rem);
  417. padding-right: calc(78% - 50rem); /* fallback for webkit */
  418. padding-right: min(78% - 50rem, 28rem);
  419. --sidebar-margin-right: 0;
  420. }
  421. }
  422. @media (min-width: 85em) {
  423. body.with-toc > * {
  424. --sidebar-margin-right: -9rem;
  425. }
  426. }
  427. @media (min-width: 90em) {
  428. /* move marginalia into the margin */
  429. body > * {
  430. padding-left: min(22%, 22rem);
  431. --sidebar-margin-right: -23rem;
  432. }
  433. body.with-toc > * {
  434. --sidebar-margin-right: -14rem;
  435. }
  436. }
  437. @media (min-width: 99em) {
  438. /* move marginalia out of main text area */
  439. body.with-toc > * {
  440. --sidebar-margin-right: -20rem;
  441. }
  442. body > *, body.with-toc > * { /* for webkit */
  443. padding-left: 22rem;
  444. padding-right: 28rem;
  445. }
  446. .admonition.marginal,
  447. .marginal {
  448. width: 40%; /* make marginal figures, ... "full width" */
  449. }
  450. }
  451. @media (min-width: 104em) {
  452. body.with-toc > * {
  453. --sidebar-margin-right: -23rem;
  454. }
  455. }