styles.css 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798
  1. /* fonts */
  2. @font-face {
  3. font-family: 'PT Sans';
  4. src: url('fonts/pt_sans-web-bold.woff2') format('woff2'),
  5. url('fonts/pt_sans-web-bold.woff') format('woff');
  6. font-weight: bold;
  7. font-style: normal;
  8. }
  9. @font-face {
  10. font-family: 'PT Sans';
  11. src: url('fonts/pt_sans-web-italic.woff2') format('woff2'),
  12. url('fonts/pt_sans-web-italic.woff') format('woff');
  13. font-weight: normal;
  14. font-style: italic;
  15. }
  16. @font-face {
  17. font-family: 'PT Sans';
  18. src: url('fonts/pt_sans-web-regular.woff2') format('woff2'),
  19. url('fonts/pt_sans-web-regular.woff') format('woff');
  20. font-weight: normal;
  21. font-style: normal;
  22. }
  23. @font-face {
  24. font-family: 'Miriam Libre';
  25. src: url('fonts/miriamlibre-bold.woff2') format('woff2'),
  26. url('fonts/miriamlibre-bold.woff') format('woff');
  27. font-weight: bold;
  28. font-style: normal;
  29. }
  30. *, *::before, *::after {
  31. font-family: inherit;
  32. color: inherit;
  33. margin: 0;
  34. padding: 0;
  35. box-sizing: border-box;
  36. }
  37. html {
  38. font-size: calc(1em + 0.33vw);
  39. font-family: PT Sans, sans-serif;
  40. line-height: 1.5;
  41. color: #111;
  42. }
  43. * + * {
  44. margin-top: 2.25rem;
  45. }
  46. br,
  47. dt,
  48. dd,
  49. th,
  50. td,
  51. option,
  52. [hidden] + *,
  53. li + li,
  54. body,
  55. .main-and-footer {
  56. margin-top: 0;
  57. }
  58. p + p {
  59. margin-top: 0.75rem;
  60. }
  61. a {
  62. text-decoration: none;
  63. border-bottom: 1px solid;
  64. }
  65. img {
  66. max-width: 100%;
  67. }
  68. p img {
  69. margin: 0.75rem 0;
  70. }
  71. figure p img {
  72. margin: 0;
  73. }
  74. :focus:not([tabindex="-1"]),
  75. [data-expands]:focus svg,
  76. .patterns a:focus .text {
  77. outline: 3px solid #ccc;
  78. outline-offset: 2px;
  79. }
  80. /* fix for IE :( */
  81. div:not([tabindex]):focus {
  82. outline: none;
  83. }
  84. /* skip link */
  85. [href="#main"] {
  86. display: block;
  87. width: 100%;
  88. padding: 0.75rem;
  89. color: #fff;
  90. background: #000;
  91. position: absolute;
  92. top: -3rem;
  93. text-align: center;
  94. z-index: 1;
  95. }
  96. [href="#main"]:focus {
  97. top: 0;
  98. outline: none;
  99. }
  100. /* text styles */
  101. h1, h2, h3, h4 {
  102. font-family: Miriam Libre, serif;
  103. line-height: 1.125;
  104. }
  105. h1 {
  106. font-size: 2rem;
  107. }
  108. h2 {
  109. font-size: 1.66rem;
  110. }
  111. h3 {
  112. font-size: 1.25rem;
  113. }
  114. h4 {
  115. font-size: 1rem;
  116. font-family: PT Sans, sans-serif;
  117. }
  118. kbd {
  119. line-height: 1;
  120. font-size: 0.66rem;
  121. padding: 0.1rem 0.33rem;
  122. border-radius: 0.25rem;
  123. border: 2px solid;
  124. box-shadow: 0.125rem 0.125rem 0 #111;
  125. vertical-align: 0.33em;
  126. }
  127. pre {
  128. overflow-x: auto;
  129. padding: 1.5rem;
  130. border: 1px solid;
  131. }
  132. code {
  133. font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  134. font-size: 0.85em;
  135. }
  136. .cmd {
  137. padding: 0.75rem;
  138. background: #111;
  139. }
  140. .cmd code {
  141. color: #fff;
  142. white-space: nowrap;
  143. }
  144. .cmd code::before {
  145. content: '$';
  146. font-weight: bold;
  147. padding-right: 0.25em;
  148. }
  149. .cmd code::after {
  150. content: '';
  151. display: inline-block;
  152. width: 0.75em;
  153. height: 1.25em;
  154. background: #fff;
  155. margin-left: 0.25em;
  156. }
  157. /* Lists */
  158. main ul {
  159. margin-left: 2.25rem;
  160. }
  161. main li + li {
  162. margin-top: 0.5rem;
  163. }
  164. main ul ul {
  165. margin-top: 0;
  166. }
  167. /* Buttons */
  168. button {
  169. font-size: 1.25rem;
  170. font-family: inherit;
  171. font-weight: inherit;
  172. background: #111;
  173. color: #fff;
  174. padding: 0.75rem;
  175. border: 0;
  176. }
  177. /* Tables */
  178. table {
  179. text-align: left;
  180. table-layout: fixed;
  181. width: 100%;
  182. border-collapse: collapse;
  183. }
  184. th, td {
  185. border: 2px solid;
  186. padding: 0.5rem;
  187. line-height: 1.25;
  188. margin: 0;
  189. }
  190. th {
  191. font-weight: bold;
  192. }
  193. th:empty {
  194. border: 0;
  195. }
  196. /* Tested using... table */
  197. .tested {
  198. text-align: center;
  199. }
  200. .tested td {
  201. vertical-align: top;
  202. }
  203. .tested th {
  204. background-color: #111;
  205. border-color: #111;
  206. color: #fff;
  207. }
  208. .tested img {
  209. max-width: 3rem;
  210. }
  211. .tested span {
  212. display: block;
  213. margin: 0;
  214. }
  215. .tested .additional {
  216. font-size: 0.85rem;
  217. }
  218. caption {
  219. font-size: 1.125rem;
  220. padding-bottom: 0.25rem;
  221. font-style: italic;
  222. }
  223. /* Page structure */
  224. .wrapper {
  225. position: relative;
  226. margin-top: 0;
  227. }
  228. .intro-and-nav {
  229. font-size: 0.85rem;
  230. width: 15rem;
  231. height: 100vh;
  232. position: fixed;
  233. top: 0;
  234. left: 0;
  235. border-right: 2px solid;
  236. }
  237. .intro-and-nav > div {
  238. padding: 2.25rem;
  239. display: flex;
  240. flex-direction: column;
  241. height: 100%;
  242. }
  243. .logo {
  244. border: 0;
  245. }
  246. .library-desc {
  247. font-style: italic;
  248. margin-top: 0.25rem;
  249. margin-left: auto;
  250. margin-right: auto;
  251. max-width: 30rem;
  252. }
  253. .main-and-footer {
  254. margin-left: 15rem;
  255. }
  256. .main-and-footer > div {
  257. max-width: 40rem;
  258. margin: 0 auto;
  259. padding: 2.25rem;
  260. }
  261. [role="contentinfo"] {
  262. font-size: 0.85rem;
  263. margin-top: 4rem;
  264. text-align: center;
  265. }
  266. /* Patterns navigation */
  267. .patterns {
  268. overflow: auto;
  269. margin-top: 1rem;
  270. }
  271. .patterns * {
  272. margin-top: 0;
  273. }
  274. .patterns h3 {
  275. font-size: 1rem;
  276. }
  277. .patterns li {
  278. line-height: 1.125;
  279. margin-top: 0.75rem;
  280. list-style: none;
  281. }
  282. .patterns ul ul {
  283. margin-left: 0.75rem;
  284. }
  285. .pattern a {
  286. border: 0;
  287. display: flex;
  288. flex-wrap: nowrap;
  289. align-items: baseline;
  290. font-weight: bold;
  291. }
  292. .pattern a:focus {
  293. outline: none;
  294. }
  295. .pattern a:focus span {
  296. outline:
  297. }
  298. .pattern span {
  299. margin-left: 0.125rem;
  300. }
  301. .pattern [aria-current] span {
  302. text-decoration: underline;
  303. text-decoration-skip: ink;
  304. }
  305. /* menu button */
  306. #menu-button {
  307. display: none;
  308. width: 100%;
  309. text-align: center;
  310. }
  311. #menu-button:focus {
  312. outline: none;
  313. box-shadow: inset 0 0 0 0.25rem #ccc;
  314. }
  315. /* Pattern lists */
  316. .patterns-list {
  317. list-style: none;
  318. margin-left: 0;
  319. }
  320. .patterns-list h2 {
  321. font-size: 1.25rem;
  322. }
  323. .patterns-list li + li {
  324. margin-top: 1rem;
  325. padding-top: 1rem;
  326. border-top: 2px solid;
  327. }
  328. .patterns-list a {
  329. border: 0;
  330. }
  331. /* Tags */
  332. .tags {
  333. margin-top: 0;
  334. font-size: 0.85rem;
  335. }
  336. .tags * {
  337. display: inline;
  338. margin: 0;
  339. }
  340. .tag-icon {
  341. height: 1em;
  342. width: auto;
  343. vertical-align: middle;
  344. }
  345. .tags strong {
  346. margin-right: 0.25rem;
  347. }
  348. .tags li {
  349. white-space: nowrap;
  350. margin: 0 0.25rem 0 0;
  351. }
  352. /* Notes and warnings */
  353. .note {
  354. border-left: 0.5rem solid;
  355. font-size: 0.85rem;
  356. }
  357. .note > div {
  358. margin-left: 0.75rem;
  359. }
  360. .note > div > img:first-child {
  361. height: 1.5rem;
  362. }
  363. .note > div > :first-child + * {
  364. margin-top: 0;
  365. }
  366. .note.warning {
  367. border-left: 0;
  368. background-image: url(images/stripe.svg);
  369. background-size: 0.5rem auto;
  370. background-repeat: repeat-y;
  371. }
  372. .note.warning > div {
  373. margin-left: 1.25rem;
  374. }
  375. /* Tick lists */
  376. .ticks li {
  377. list-style: none;
  378. position: relative;
  379. }
  380. .ticks li::before {
  381. content: '';
  382. display: inline-block;
  383. width: 1rem;
  384. height: 1rem;
  385. margin-right: 0.25rem;
  386. background-image: url(images/icon-tick.svg);
  387. background-size: 100% auto;
  388. position: absolute;
  389. left: -1.25rem;
  390. top: 0.25rem;
  391. }
  392. /* Figures */
  393. figure {
  394. text-align: center;
  395. }
  396. figcaption {
  397. font-size: 0.85rem;
  398. font-style: italic;
  399. margin-top: 0.5rem;
  400. }
  401. main {
  402. display: block;
  403. counter-reset: fig;
  404. min-height: 100vh;
  405. }
  406. figcaption::before {
  407. counter-increment: fig;
  408. content: 'Figure ' counter(fig) ':\0020';
  409. font-weight: bold;
  410. }
  411. /* Code blocks */
  412. pre[class*=language-] {
  413. background: none;
  414. margin-top: 2.25rem;
  415. margin-bottom: 0;
  416. overflow-y: hidden;
  417. overflow-x: auto;
  418. }
  419. pre[class*=language-][data-line] {
  420. padding: 1em 0 0 2.25rem;
  421. }
  422. pre[class*=language-] code * {
  423. margin-top: 0 !important;
  424. }
  425. [data-codeblock-shortcode] {
  426. display: block;
  427. margin-top: -1rem;
  428. }
  429. *:not(pre) > code {
  430. white-space: nowrap;
  431. }
  432. .token.property,
  433. .token.tag,
  434. .token.boolean,
  435. .token.number,
  436. .token.constant,
  437. .token.symbol,
  438. .token.deleted {
  439. color: #888;
  440. }
  441. .token.selector,
  442. .token.attr-name,
  443. .token.string,
  444. .token.char,
  445. .token.builtin,
  446. .token.inserted {
  447. color: #111;
  448. }
  449. .token.operator,
  450. .token.entity,
  451. .token.url,
  452. .language-css .token.string,
  453. .style .token.string {
  454. color: #333;
  455. background: none;
  456. }
  457. .token.atrule,
  458. .token.attr-value,
  459. .token.keyword {
  460. color: #666;
  461. }
  462. .token.function {
  463. color: #888;
  464. }
  465. .line-numbers code {
  466. padding-left: 3rem;
  467. margin-top: -1rem;
  468. overflow-x: auto;
  469. overflow-y: hidden;
  470. }
  471. .line-numbers {
  472. padding: 1.5rem !important;
  473. }
  474. .line-numbers .line-numbers-rows {
  475. margin-left: 2.25rem;
  476. left: -3.5em;
  477. top: 1.25rem;
  478. color: #111;
  479. border-color: #111;
  480. }
  481. .line-numbers-rows > span:before {
  482. color: inherit;
  483. }
  484. /* Expandable sections */
  485. .expandable-section {
  486. border-top: 1px solid;
  487. border-bottom: 1px solid;
  488. padding: 0.75rem 0;
  489. }
  490. [id^="expandable-"] {
  491. margin: 0;
  492. padding: 1.5rem 0 0.75rem;
  493. }
  494. .expandable-section + .expandable-section {
  495. margin-top: 0;
  496. border-top: 0;
  497. }
  498. [data-expands] {
  499. text-align: left;
  500. color: #111;
  501. border: 0;
  502. background: none;
  503. width: 100%;
  504. padding: 0;
  505. margin: 0;
  506. display: flex;
  507. align-items: center;
  508. justify-content: space-between;
  509. cursor: pointer;
  510. }
  511. [data-expands] svg {
  512. margin-top: 0;
  513. width: 1em;
  514. height: 1em;
  515. }
  516. [data-expands][aria-expanded="true"] svg .up-strut {
  517. display: none;
  518. }
  519. [data-expands]:focus {
  520. outline: none;
  521. }
  522. p:empty {
  523. display: none;
  524. }
  525. *:not(p) + p:empty + p {
  526. margin-top: 2.25rem;
  527. }
  528. /* WCAG and principles */
  529. .wcag ul li {
  530. font-size: 0.85em;
  531. }
  532. .principles p {
  533. font-size: 0.85rem;
  534. margin-top: 0.75rem;
  535. }
  536. .principles.with-desc > li + li,
  537. .wcag.with-desc > li + li {
  538. border-top: 1px solid;
  539. margin-top: 0.75rem;
  540. padding-top: 0.75rem;
  541. }
  542. /* Site errors */
  543. .site-error {
  544. padding: 1.5rem;
  545. background: #efefef;
  546. }
  547. .site-error strong {
  548. color: #C83737;
  549. }
  550. /* SVG icons */
  551. a svg, button svg {
  552. height: 0.75em;
  553. width: auto;
  554. margin-right: 0.125rem;
  555. }
  556. h1 svg {
  557. vertical-align: -0.5rem;
  558. }
  559. /* color palettes */
  560. .colors {
  561. display: flex;
  562. height: 5rem;
  563. margin: -0.25rem;
  564. list-style: none;
  565. flex-wrap: nowrap;
  566. }
  567. .colors li {
  568. margin: 0.25rem;
  569. flex: 1 0 auto;
  570. position: relative;
  571. }
  572. .colors span {
  573. line-height: 1;
  574. background-color: #111;
  575. color: #fff;
  576. font-size: 0.75rem;
  577. padding: 0.25rem;
  578. position: absolute;
  579. bottom: 0.25rem;
  580. right: 0.25rem;
  581. }
  582. /* cross references */
  583. .pattern-link {
  584. font-weight: bold;
  585. }
  586. /* inline demos */
  587. [id^="demo-"] {
  588. all: initial;
  589. display: block;
  590. }
  591. @media (max-width: 45em) {
  592. [role="banner"] {
  593. position: static;
  594. width: auto;
  595. height: auto;
  596. }
  597. .intro {
  598. text-align: center;
  599. }
  600. .intro-and-nav > div {
  601. padding: 1.5rem;
  602. }
  603. .logo img {
  604. max-width: 15rem;
  605. }
  606. .main-and-footer {
  607. margin: 0;
  608. }
  609. .patterns h3 {
  610. font-size: 1.125rem;
  611. border-top: 4px solid;
  612. border-bottom: 4px solid;
  613. padding: 0.75rem 0;
  614. }
  615. .patterns ul ul {
  616. margin: 0;
  617. }
  618. .patterns li {
  619. margin-top: 0;
  620. }
  621. .pattern {
  622. font-size: 1rem;
  623. }
  624. .pattern a {
  625. padding: 0.75rem 0;
  626. }
  627. .pattern + .pattern {
  628. border-top: 1px solid;
  629. }
  630. #menu-button {
  631. display: block;
  632. }
  633. #patterns-list {
  634. display: none;
  635. }
  636. [aria-expanded="true"] + #patterns-list {
  637. display: block;
  638. }
  639. }