_docs.scss 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  1. //
  2. // Component: Docs
  3. //
  4. // Visual treatment for documentation pages. Body class `.docs-page` opts in.
  5. // Demo pages are not affected.
  6. //
  7. // Inline code blocks rendered by MDX (Astro highlight default class)
  8. .astro-code {
  9. padding: .75rem;
  10. @include border-radius($border-radius);
  11. }
  12. .docs-page {
  13. // Constrain the docs card to a comfortable reading width.
  14. // Tables and code blocks inside can still scroll horizontally if needed.
  15. .app-content > .container-fluid {
  16. max-width: 60rem; // ~960px
  17. @include media-breakpoint-up(xxl) {
  18. max-width: 64rem;
  19. }
  20. }
  21. //
  22. // Card body — breathing room + prose typography.
  23. // Only applied inside docs content cards so demo-page card content
  24. // stays unchanged.
  25. //
  26. .card > .card-body {
  27. padding: 1.5rem;
  28. font-size: 1rem;
  29. line-height: 1.7;
  30. color: var(--#{$prefix}body-color);
  31. @include media-breakpoint-up(md) {
  32. padding: 2.5rem;
  33. }
  34. //
  35. // Heading hierarchy. The MDX content in src/html/components/docs/ uses
  36. // ##### (h5) as the dominant section heading and ###### (h6) as a
  37. // sub-heading (most visible in FAQ.mdx, where h5 is a topic and h6 is
  38. // a question). Style h5 as a major section and h6 as a sub-section so
  39. // the visual hierarchy matches the semantic one.
  40. //
  41. h1,
  42. h2,
  43. h3,
  44. h4,
  45. h5,
  46. h6,
  47. .h1,
  48. .h2,
  49. .h3,
  50. .h4,
  51. .h5,
  52. .h6 {
  53. margin-top: 2em;
  54. margin-bottom: .5em;
  55. font-weight: 600;
  56. line-height: 1.3;
  57. color: var(--#{$prefix}emphasis-color);
  58. scroll-margin-top: 4rem; // anchor-link friendly
  59. &:first-child {
  60. margin-top: 0;
  61. }
  62. }
  63. h2,
  64. .h2 {
  65. padding-bottom: .35em;
  66. font-size: 1.75rem;
  67. border-bottom: 1px solid var(--#{$prefix}border-color);
  68. }
  69. h3,
  70. .h3 {
  71. font-size: 1.4rem;
  72. }
  73. h4,
  74. .h4 {
  75. font-size: 1.2rem;
  76. }
  77. // h5 is the dominant section heading across docs MDX files. Give it
  78. // a visible separator above so sections are easy to scan.
  79. h5,
  80. .h5 {
  81. padding-top: 1.5em;
  82. margin-top: 2.5em;
  83. font-size: 1.3rem;
  84. border-top: 1px solid var(--#{$prefix}border-color);
  85. &:first-child {
  86. padding-top: 0;
  87. border-top: 0;
  88. }
  89. }
  90. // h6 is the sub-section / FAQ question style. Smaller than h5 but
  91. // still distinctly heading-like, with a touch of accent colour to
  92. // separate from body text.
  93. h6,
  94. .h6 {
  95. margin-top: 1.75em;
  96. font-size: 1.08rem;
  97. color: var(--#{$prefix}emphasis-color);
  98. }
  99. //
  100. // Paragraphs and lists.
  101. //
  102. p,
  103. ul,
  104. ol,
  105. dl,
  106. blockquote,
  107. table {
  108. margin-bottom: 1.1rem;
  109. }
  110. ul,
  111. ol {
  112. padding-left: 1.5rem;
  113. li {
  114. margin-bottom: .35rem;
  115. }
  116. // Tighter nested lists
  117. ul,
  118. ol {
  119. margin-top: .35rem;
  120. margin-bottom: 0;
  121. }
  122. }
  123. // Lead-style first paragraph (just after a heading)
  124. h2 + p,
  125. h3 + p,
  126. h5 + p {
  127. margin-top: 0;
  128. }
  129. //
  130. // Inline code — pill style that complements MDX's syntax-highlighted blocks.
  131. //
  132. p code,
  133. li code,
  134. td code,
  135. th code,
  136. h2 code,
  137. h3 code,
  138. h4 code,
  139. h5 code,
  140. h6 code {
  141. padding: .15em .4em;
  142. font-size: .875em;
  143. color: var(--#{$prefix}emphasis-color);
  144. background: var(--#{$prefix}tertiary-bg);
  145. border: 1px solid var(--#{$prefix}border-color);
  146. @include border-radius($border-radius-sm);
  147. }
  148. //
  149. // Code blocks.
  150. //
  151. pre.astro-code,
  152. pre {
  153. padding: 1rem 1.25rem;
  154. margin-top: 1.25rem;
  155. margin-bottom: 1.5rem;
  156. overflow-x: auto;
  157. font-size: .875rem;
  158. line-height: 1.6;
  159. @include border-radius($border-radius);
  160. code {
  161. padding: 0;
  162. background: transparent;
  163. border: 0;
  164. }
  165. }
  166. //
  167. // Tables — reference-doc styling with hairline borders.
  168. //
  169. table {
  170. width: 100%;
  171. margin-top: 1.25rem;
  172. margin-bottom: 1.5rem;
  173. overflow: hidden;
  174. font-size: .95rem;
  175. border-collapse: collapse;
  176. border: 1px solid var(--#{$prefix}border-color);
  177. @include border-radius($border-radius-sm);
  178. th,
  179. td {
  180. padding: .65rem .9rem;
  181. text-align: left;
  182. vertical-align: top;
  183. border-bottom: 1px solid var(--#{$prefix}border-color);
  184. }
  185. th {
  186. font-weight: 600;
  187. color: var(--#{$prefix}emphasis-color);
  188. background: var(--#{$prefix}tertiary-bg);
  189. }
  190. tr:last-child td {
  191. border-bottom: 0;
  192. }
  193. code {
  194. white-space: nowrap;
  195. }
  196. }
  197. //
  198. // Blockquotes used as info callouts.
  199. //
  200. blockquote {
  201. padding: .85rem 1.1rem;
  202. margin-top: 1.25rem;
  203. color: var(--#{$prefix}emphasis-color);
  204. background: var(--#{$prefix}info-bg-subtle);
  205. border-left: 4px solid var(--#{$prefix}info-border-subtle);
  206. @include border-radius($border-radius-sm);
  207. p:last-child {
  208. margin-bottom: 0;
  209. }
  210. code {
  211. background: rgba(0, 0, 0, .05);
  212. }
  213. }
  214. //
  215. // Prose links — stand out more than Bootstrap defaults.
  216. //
  217. a:not(.btn):not(.nav-link) {
  218. color: var(--#{$prefix}primary);
  219. text-decoration: underline;
  220. text-decoration-thickness: 1px;
  221. text-underline-offset: 3px;
  222. &:hover {
  223. text-decoration-thickness: 2px;
  224. }
  225. }
  226. //
  227. // Horizontal rule — used as additional section separator.
  228. //
  229. hr {
  230. margin: 2.5rem 0;
  231. border: 0;
  232. border-top: 1px solid var(--#{$prefix}border-color);
  233. opacity: 1;
  234. }
  235. //
  236. // Lead paragraph — the first paragraph in any doc is a summary.
  237. // Visually heavier so it functions as a deck.
  238. //
  239. > p:first-child,
  240. > p:first-of-type {
  241. margin-bottom: 2rem;
  242. font-size: 1.125rem;
  243. line-height: 1.6;
  244. color: var(--#{$prefix}body-color);
  245. }
  246. //
  247. // FAQ / disclosure accordion — uses native <details>/<summary>.
  248. // Add `.faq-item` to <details> to opt in.
  249. //
  250. details.faq-item {
  251. margin-bottom: .5rem;
  252. overflow: hidden;
  253. background: var(--#{$prefix}body-bg);
  254. border: 1px solid var(--#{$prefix}border-color);
  255. @include border-radius($border-radius);
  256. @include transition(border-color .15s ease, box-shadow .15s ease);
  257. &:hover {
  258. border-color: var(--#{$prefix}primary-border-subtle);
  259. }
  260. &[open] {
  261. background: var(--#{$prefix}body-bg);
  262. border-color: var(--#{$prefix}primary-border-subtle);
  263. box-shadow: 0 1px 3px rgba(0, 0, 0, .04);
  264. }
  265. summary {
  266. position: relative;
  267. padding: .9rem 3rem .9rem 1.1rem;
  268. font-size: 1rem;
  269. font-weight: 600;
  270. color: var(--#{$prefix}emphasis-color);
  271. list-style: none;
  272. cursor: pointer;
  273. user-select: none;
  274. @include transition(color .15s ease);
  275. // Hide the default disclosure triangle in Webkit/Blink
  276. &::-webkit-details-marker {
  277. display: none;
  278. }
  279. // Hide the marker in modern Firefox too
  280. &::marker {
  281. content: "";
  282. }
  283. &:hover {
  284. color: var(--#{$prefix}primary);
  285. }
  286. // Right-side chevron, rotates on open
  287. &::after {
  288. position: absolute;
  289. top: 50%;
  290. right: 1.1rem;
  291. display: inline-block;
  292. width: .55rem;
  293. height: .55rem;
  294. margin-top: -.4rem;
  295. content: "";
  296. border-right: 2px solid currentcolor;
  297. border-bottom: 2px solid currentcolor;
  298. opacity: .55;
  299. transform: rotate(45deg);
  300. @include transition(transform .2s ease);
  301. }
  302. }
  303. &[open] > summary {
  304. color: var(--#{$prefix}primary);
  305. border-bottom: 1px solid var(--#{$prefix}border-color);
  306. &::after {
  307. margin-top: -.15rem;
  308. opacity: 1;
  309. transform: rotate(-135deg);
  310. }
  311. }
  312. // Content (everything after <summary>) gets the inner padding
  313. > *:not(summary) {
  314. padding-right: 1.1rem;
  315. padding-left: 1.1rem;
  316. }
  317. > *:not(summary):first-of-type {
  318. padding-top: 1rem;
  319. }
  320. > *:not(summary):last-child {
  321. padding-bottom: 1rem;
  322. }
  323. // Tighten paragraphs/lists inside an FAQ answer
  324. p,
  325. ul,
  326. ol {
  327. margin-bottom: .65rem;
  328. }
  329. > *:last-child p:last-child,
  330. > p:last-child,
  331. > ul:last-child,
  332. > ol:last-child {
  333. margin-bottom: 0;
  334. }
  335. // Code blocks inside an FAQ answer get a less-distracting bg
  336. pre.astro-code,
  337. pre {
  338. margin-right: 0;
  339. margin-left: 0;
  340. }
  341. }
  342. }
  343. // Dark-mode tweak: blockquote info bg needs more contrast on dark
  344. &[data-bs-theme="dark"],
  345. [data-bs-theme="dark"] & {
  346. .card > .card-body blockquote code {
  347. background: rgba(255, 255, 255, .08);
  348. }
  349. }
  350. }