styles.css 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  1. /* fonts */
  2. @font-face {
  3. font-family: 'Miriam Libre';
  4. src: url('fonts/miriamlibre-bold.woff2') format('woff2'), url('fonts/miriamlibre-bold.woff') format('woff');
  5. font-weight: bold;
  6. font-style: normal;
  7. }
  8. *,
  9. *::before,
  10. *::after {
  11. font-family: inherit;
  12. color: inherit;
  13. margin: 0;
  14. padding: 0;
  15. box-sizing: border-box;
  16. }
  17. html {
  18. font-size: calc(1em + 0.33vw);
  19. font-family: PT Sans, sans-serif;
  20. line-height: 1.5;
  21. color: #111;
  22. }
  23. * + * {
  24. margin-top: 2.25rem;
  25. }
  26. br,
  27. dt,
  28. dd,
  29. th,
  30. td,
  31. option,
  32. [hidden] + *,
  33. li + li,
  34. body,
  35. .main-and-footer {
  36. margin-top: 0;
  37. }
  38. p + p {
  39. margin-top: 0.75rem;
  40. }
  41. a {
  42. text-decoration: none;
  43. border-bottom: 1px solid;
  44. }
  45. abbr {
  46. text-decoration: none;
  47. cursor: help;
  48. border-bottom: 1px dashed;
  49. }
  50. img {
  51. max-width: 100%;
  52. }
  53. p img {
  54. margin: 0.75rem 0;
  55. }
  56. figure p img {
  57. margin: 0;
  58. }
  59. :focus:not([tabindex="-1"]),
  60. [data-expands]:focus svg,
  61. .patterns a:focus .text {
  62. outline: 3px solid #ccc;
  63. outline-offset: 2px;
  64. }
  65. /* fix for IE :( */
  66. [tabindex="-1"]:focus,
  67. div:not([tabindex]):focus {
  68. outline: none;
  69. }
  70. /* skip link */
  71. [href="#main"] {
  72. display: block;
  73. width: 100%;
  74. padding: 0.75rem;
  75. color: #fff;
  76. background: #000;
  77. position: absolute;
  78. top: -3rem;
  79. text-align: center;
  80. z-index: 1;
  81. }
  82. [href="#main"]:focus {
  83. top: 0;
  84. outline: none;
  85. }
  86. /* text styles */
  87. h1,
  88. h2,
  89. h3,
  90. h4 {
  91. font-family: Miriam Libre, serif;
  92. line-height: 1.125;
  93. }
  94. h1 {
  95. font-size: 2rem;
  96. }
  97. h2 {
  98. font-size: 1.66rem;
  99. }
  100. h3 {
  101. font-size: 1.25rem;
  102. }
  103. h4,
  104. h5 {
  105. font-size: 1rem;
  106. font-family: PT Sans, sans-serif;
  107. }
  108. h5 {
  109. font-size: 0.85rem;
  110. text-transform: uppercase;
  111. }
  112. kbd {
  113. line-height: 1;
  114. font-size: 0.66rem;
  115. padding: 0.1rem 0.33rem;
  116. border-radius: 0.25rem;
  117. border: 2px solid;
  118. box-shadow: 0.125rem 0.125rem 0 #111;
  119. vertical-align: 0.33em;
  120. }
  121. pre,
  122. .file-tree {
  123. overflow-x: auto;
  124. padding: 1.5rem;
  125. border: 1px solid;
  126. }
  127. code {
  128. font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  129. font-size: 0.85em;
  130. }
  131. .cmd {
  132. padding: 0.75rem;
  133. background: #111;
  134. }
  135. .cmd code {
  136. color: #fff;
  137. white-space: nowrap;
  138. }
  139. .cmd code::before {
  140. content: '$';
  141. font-weight: bold;
  142. padding-right: 0.25em;
  143. }
  144. /* Lists */
  145. main ul,
  146. main ol {
  147. margin-left: 2.25rem;
  148. }
  149. main li + li {
  150. margin-top: 0.5rem;
  151. }
  152. main ul ul {
  153. margin-top: 0;
  154. }
  155. /* Buttons */
  156. button {
  157. font-size: 1.25rem;
  158. font-family: inherit;
  159. font-weight: inherit;
  160. background: #111;
  161. color: #fff;
  162. padding: 0.75rem;
  163. border: 0;
  164. }
  165. /* Tables */
  166. table {
  167. text-align: left;
  168. table-layout: fixed;
  169. width: 100%;
  170. border-collapse: collapse;
  171. }
  172. th,
  173. td {
  174. border: 2px solid;
  175. padding: 0.5rem;
  176. line-height: 1.25;
  177. margin: 0;
  178. }
  179. th {
  180. font-weight: bold;
  181. }
  182. th:empty {
  183. border: 0;
  184. }
  185. /* Tested using... table */
  186. .tested {
  187. text-align: center;
  188. }
  189. .tested td {
  190. vertical-align: top;
  191. overflow: hidden;
  192. }
  193. .tested th {
  194. background-color: #111;
  195. border-color: #111;
  196. color: #fff;
  197. }
  198. .tested img {
  199. max-width: 3rem;
  200. }
  201. .tested span {
  202. display: block;
  203. margin: 0;
  204. }
  205. .tested .additional {
  206. font-size: 0.85rem;
  207. }
  208. caption {
  209. font-size: 1.125rem;
  210. padding-bottom: 0.25rem;
  211. font-style: italic;
  212. }
  213. /* Page structure */
  214. .wrapper {
  215. position: relative;
  216. margin-top: 0;
  217. overflow-x: hidden;
  218. }
  219. .intro-and-nav {
  220. font-size: 0.85rem;
  221. width: 15rem;
  222. height: 100vh;
  223. position: fixed;
  224. top: 0;
  225. left: 0;
  226. border-right: 2px solid;
  227. }
  228. .intro-and-nav > div {
  229. padding: 2.25rem;
  230. display: flex;
  231. flex-direction: column;
  232. height: 100%;
  233. }
  234. .logo {
  235. border: 0;
  236. }
  237. .logo img {
  238. width: 100%;
  239. max-width: 12rem;
  240. }
  241. .library-desc {
  242. font-style: italic;
  243. margin-top: 0.5rem;
  244. margin-left: auto;
  245. margin-right: auto;
  246. max-width: 30rem;
  247. }
  248. .main-and-footer {
  249. margin-left: 15rem;
  250. }
  251. .main-and-footer > div {
  252. max-width: 40rem;
  253. margin: 0 auto;
  254. padding: 2.25rem;
  255. }
  256. [role="contentinfo"] {
  257. font-size: 0.85rem;
  258. margin-top: 4rem;
  259. text-align: center;
  260. }
  261. /* Patterns navigation */
  262. .patterns {
  263. overflow: auto;
  264. margin-top: 1.5rem;
  265. }
  266. .patterns * {
  267. margin-top: 0;
  268. }
  269. .patterns h3 {
  270. font-size: 1rem;
  271. }
  272. .patterns h3 + ul {
  273. margin-top: 0.75rem;
  274. }
  275. .patterns li {
  276. line-height: 1.125;
  277. list-style: none;
  278. }
  279. .patterns li + li {
  280. margin-top: 0.75rem;
  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 span {
  296. margin-left: 0.125rem;
  297. }
  298. .pattern [aria-current] {
  299. background-color: #111;
  300. background-image: url(images/arrow_effect.svg);
  301. background-position: right center;
  302. background-size: 125%;
  303. background-repeat: no-repeat;
  304. color: #fff;
  305. padding: 0.5em 1em 0.5em;
  306. }
  307. /* menu button */
  308. #menu-button {
  309. display: none;
  310. width: 100%;
  311. text-align: center;
  312. }
  313. #menu-button:focus {
  314. outline: none;
  315. box-shadow: inset 0 0 0 0.25rem #ccc;
  316. }
  317. /* Tables of contents */
  318. .toc {
  319. font-size: 0.85rem;
  320. border: 1px solid;
  321. padding: 1.5rem;
  322. }
  323. .toc h2 {
  324. font-size: 1rem;
  325. }
  326. .toc ol {
  327. margin-left: 0.75rem;
  328. margin-top: 0.5rem;
  329. }
  330. /* Pattern lists */
  331. .patterns-list {
  332. list-style: none;
  333. margin-left: 0;
  334. }
  335. .patterns-list h2 {
  336. font-size: 1.25rem;
  337. }
  338. .patterns-list li + li {
  339. margin-top: 1rem;
  340. padding-top: 1rem;
  341. border-top: 2px solid;
  342. }
  343. .patterns-list a {
  344. border: 0;
  345. }
  346. /* Tags */
  347. .tags {
  348. margin-top: 0;
  349. font-size: 0.85rem;
  350. }
  351. .tags * {
  352. display: inline;
  353. margin: 0;
  354. }
  355. .tags strong {
  356. margin-right: 0.25rem;
  357. }
  358. .tags li {
  359. white-space: nowrap;
  360. margin: 0 0.25rem 0 0;
  361. }
  362. /* Notes and warnings */
  363. .note {
  364. border-left: 0.5rem solid;
  365. font-size: 0.85rem;
  366. }
  367. .note svg {
  368. height: 2.25rem;
  369. width: auto;
  370. }
  371. .note > div {
  372. margin-left: 0.75rem;
  373. }
  374. .note > div > img:first-child {
  375. height: 1.5rem;
  376. }
  377. .note > div >:first-child + * {
  378. margin-top: 0;
  379. }
  380. .note.warning {
  381. border-left: 0;
  382. background-image: url(images/stripe.svg);
  383. background-size: 0.5rem auto;
  384. background-repeat: repeat-y;
  385. }
  386. .note.warning > div {
  387. margin-left: 1.25rem;
  388. }
  389. /* Tick lists */
  390. .ticks li {
  391. list-style: none;
  392. position: relative;
  393. }
  394. .ticks li::before {
  395. content: '';
  396. display: inline-block;
  397. width: 1rem;
  398. height: 1rem;
  399. margin-right: 0.25rem;
  400. background-image: url(images/icon-tick.svg);
  401. background-size: 100% auto;
  402. position: absolute;
  403. left: -1.25rem;
  404. top: 0.25rem;
  405. }
  406. /* Figures */
  407. figure {
  408. text-align: center;
  409. }
  410. figcaption {
  411. font-size: 0.85rem;
  412. font-style: italic;
  413. margin-top: 0.5rem;
  414. }
  415. main {
  416. display: block;
  417. counter-reset: fig;
  418. min-height: 100vh;
  419. }
  420. figcaption::before {
  421. counter-increment: fig;
  422. content: 'Figure ' counter(fig) ':\0020';
  423. font-weight: bold;
  424. }
  425. /* Code blocks */
  426. pre[class*=language-] {
  427. background: none;
  428. margin-top: 2.25rem;
  429. margin-bottom: 0;
  430. overflow-y: hidden;
  431. overflow-x: auto;
  432. }
  433. pre[class*=language-][data-line] {
  434. padding: 1em 0 0 2.25rem;
  435. }
  436. pre[class*=language-] code * {
  437. margin-top: 0 !important;
  438. }
  439. [data-codeblock-shortcode] {
  440. display: block;
  441. margin-top: -1rem;
  442. }
  443. .token.property,
  444. .token.tag,
  445. .token.boolean,
  446. .token.number,
  447. .token.constant,
  448. .token.symbol,
  449. .token.deleted {
  450. color: #888;
  451. }
  452. .token.selector,
  453. .token.attr-name,
  454. .token.string,
  455. .token.char,
  456. .token.builtin,
  457. .token.inserted {
  458. color: #111;
  459. }
  460. .token.operator,
  461. .token.entity,
  462. .token.url,
  463. .language-css .token.string,
  464. .style .token.string {
  465. color: #333;
  466. background: none;
  467. }
  468. .token.atrule,
  469. .token.attr-value,
  470. .token.keyword {
  471. color: #666;
  472. }
  473. .token.function {
  474. color: #888;
  475. }
  476. .line-numbers code {
  477. padding-left: 3rem;
  478. margin-top: -1rem;
  479. overflow-x: auto;
  480. overflow-y: hidden;
  481. }
  482. .line-numbers {
  483. padding: 1.5rem !important;
  484. }
  485. .line-numbers .line-numbers-rows {
  486. margin-left: 2.25rem;
  487. left: -3.5em;
  488. top: 1.25rem;
  489. color: #111;
  490. border-color: #111;
  491. }
  492. .line-numbers-rows > span:before {
  493. color: inherit;
  494. }
  495. /* file tree lists */
  496. .file-tree {
  497. overflow-x: auto;
  498. }
  499. .file-tree ul {
  500. font-family: Courier, monospace;
  501. margin: 0;
  502. padding: 0;
  503. padding-left: 3rem;
  504. list-style: none;
  505. line-height: 1.25;
  506. position: relative;
  507. }
  508. .file-tree > ul {
  509. padding-left: 0;
  510. overflow-x: auto;
  511. }
  512. .file-tree li {
  513. background: #fff;
  514. position: relative;
  515. white-space: nowrap;
  516. }
  517. .file-tree li + li {
  518. margin-top: 0;
  519. }
  520. .file-tree li:not(:last-child) > ul::before {
  521. content: '\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020\2502\0020';
  522. position: absolute;
  523. left: 0;
  524. top: 0;
  525. bottom: 0;
  526. width: 1em;
  527. white-space: normal;
  528. }
  529. .file-tree li::before {
  530. content: '\251C\2500\2500\0020';
  531. }
  532. .file-tree li:last-child::before {
  533. content: '\2514\2500\2500\0020';
  534. }
  535. /* Expandable sections */
  536. .expandable-section {
  537. border-top: 1px solid;
  538. border-bottom: 1px solid;
  539. padding: 0.75rem 0;
  540. }
  541. [id^="js-expandable-"] {
  542. margin: 0;
  543. padding: 1.5rem 0 0.75rem;
  544. }
  545. @media screen {
  546. .expandable-section + .expandable-section {
  547. margin-top: 0;
  548. border-top: 0;
  549. }
  550. }
  551. [data-expands] {
  552. text-align: left;
  553. color: #111;
  554. border: 0;
  555. background: none;
  556. width: 100%;
  557. padding: 0;
  558. margin: 0;
  559. display: flex;
  560. align-items: center;
  561. justify-content: space-between;
  562. cursor: pointer;
  563. }
  564. [data-expands] svg {
  565. margin-top: 0;
  566. width: 1em;
  567. height: 1em;
  568. }
  569. [data-expands][aria-expanded="true"] svg .up-strut {
  570. display: none;
  571. }
  572. [data-expands]:focus {
  573. outline: none;
  574. }
  575. p:empty {
  576. display: none;
  577. }
  578. *:not(p) + p:empty + p {
  579. margin-top: 2.25rem;
  580. }
  581. /* WCAG and principles */
  582. .wcag ul li {
  583. font-size: 0.85em;
  584. }
  585. .principles p {
  586. font-size: 0.85rem;
  587. margin-top: 0.75rem;
  588. }
  589. .principles.with-desc > li + li,
  590. .wcag.with-desc > li + li {
  591. border-top: 1px solid;
  592. margin-top: 0.75rem;
  593. padding-top: 0.75rem;
  594. }
  595. /* Site errors */
  596. .site-error {
  597. padding: 1.5rem;
  598. background: #efefef;
  599. }
  600. .site-error strong {
  601. color: #C83737;
  602. }
  603. /* SVG icons */
  604. a svg,
  605. button svg,
  606. h1 svg {
  607. height: 0.75em;
  608. width: auto;
  609. margin-right: 0.25em;
  610. }
  611. h1 svg,
  612. li > svg,
  613. h2 a svg {
  614. height: 1em;
  615. vertical-align: middle;
  616. }
  617. h1 svg {
  618. margin-right: 0;
  619. }
  620. .print {
  621. white-space: nowrap;
  622. }
  623. .svg-outer {
  624. width: 0.75em;
  625. display: inline-block;
  626. vertical-align: middle;
  627. }
  628. /* Color palettes */
  629. .colors {
  630. display: flex;
  631. height: 5rem;
  632. margin: -0.25rem;
  633. list-style: none;
  634. flex-wrap: nowrap;
  635. }
  636. .colors li {
  637. margin: 0.25rem;
  638. flex: 1 0 auto;
  639. position: relative;
  640. }
  641. .colors span {
  642. line-height: 1;
  643. background-color: #111;
  644. color: #fff;
  645. font-size: 0.75rem;
  646. padding: 0.25rem;
  647. position: absolute;
  648. bottom: 0.25rem;
  649. right: 0.25rem;
  650. }
  651. /* cross references */
  652. .pattern-link {
  653. font-weight: bold;
  654. }
  655. /* inline demos */
  656. [id^="js-demo-"] {
  657. all: initial;
  658. display: block;
  659. }
  660. /* Section links */
  661. .h2-container {
  662. position: relative;
  663. font-size: 1.66rem;
  664. }
  665. .h2-container a {
  666. position: absolute;
  667. margin-top: 0;
  668. top: 0;
  669. line-height: 1;
  670. left: -1em;
  671. border: 0;
  672. }
  673. /* Single page layout */
  674. .wrapper.print-version .main-and-footer {
  675. margin-left: 0;
  676. }
  677. .wrapper.print-version .intro-and-nav {
  678. position: static;
  679. border: 0;
  680. width: auto;
  681. text-align: center;
  682. display: flex;
  683. align-items: center;
  684. justify-content: center;
  685. }
  686. .wrapper.print-version main {
  687. min-height: 0;
  688. }
  689. .wrapper.print-version .library-desc {
  690. font-size: 1rem;
  691. }
  692. .wrapper.print-version .intro-and-nav > div {
  693. height: auto;
  694. }
  695. .wrapper.print-version #patterns-list {
  696. margin-left: 0;
  697. margin-top: 1.5rem;
  698. display: block;
  699. }
  700. .wrapper.print-version .toc {
  701. font-size: 1rem;
  702. }
  703. .wrapper.print-version .toc h2 {
  704. font-size: 1.66rem;
  705. }
  706. .wrapper.print-version #patterns-list h3 {
  707. font-size: 1.25rem;
  708. }
  709. .wrapper.print-version .patterns {
  710. margin-top: 0;
  711. }
  712. .pattern-section:not(:last-child) {
  713. padding-bottom: 2.25rem;
  714. border-bottom: 2px solid;
  715. }
  716. .pattern-section h1 {
  717. padding: 0 !important;
  718. }
  719. @media screen and (max-width: 45em) {
  720. [role="banner"] {
  721. position: static;
  722. width: auto;
  723. height: auto;
  724. }
  725. .intro {
  726. text-align: center;
  727. }
  728. .intro-and-nav > div {
  729. padding: 1.5rem;
  730. }
  731. .main-and-footer {
  732. margin: 0;
  733. }
  734. .patterns h3 {
  735. font-size: 1.125rem;
  736. border-top: 4px solid;
  737. border-bottom: 4px solid;
  738. padding: 0.75rem 0;
  739. }
  740. .patterns li:not(.pattern) {
  741. margin-top: 0;
  742. }
  743. .patterns ul ul {
  744. margin: 0;
  745. }
  746. .patterns li {
  747. margin-top: 0;
  748. }
  749. .pattern {
  750. font-size: 1rem;
  751. }
  752. .pattern a {
  753. padding: 0.75rem 0;
  754. }
  755. .pattern [aria-current] {
  756. background-image: none;
  757. }
  758. .pattern + .pattern {
  759. border-top: 1px solid;
  760. margin-top: 0;
  761. }
  762. #menu-button {
  763. display: block;
  764. }
  765. #patterns-list {
  766. display: none;
  767. }
  768. .toc-link {
  769. display: none;
  770. }
  771. [aria-expanded="true"] + #patterns-list {
  772. display: block;
  773. }
  774. .tested th,
  775. .tested td {
  776. display: block;
  777. }
  778. .tested td + td {
  779. border-top: 0;
  780. }
  781. }
  782. @media print {
  783. .wrapper:not(.print-version) .intro-and-nav,
  784. .wrapper:not(.print-version) [role="contentinfo"] {
  785. display: none;
  786. }
  787. .main-and-footer {
  788. margin-left: 0;
  789. }
  790. a {
  791. border: 0;
  792. }
  793. main a::after {
  794. content: " (" attr(href) ")";
  795. word-break: break-word;
  796. }
  797. main nav a::after {
  798. content: '';
  799. }
  800. .cmd {
  801. background: #fff;
  802. color: #111;
  803. }
  804. pre code {
  805. white-space: pre-wrap !important;
  806. }
  807. .line-numbers .line-numbers-rows {
  808. display: none;
  809. }
  810. .line-numbers code {
  811. padding-left: 0;
  812. }
  813. .expandable-section {
  814. border: 0;
  815. padding: 0;
  816. }
  817. .expandable-section + p {
  818. margin-top: 0.75rem;
  819. }
  820. [id^="js-expandable-"] {
  821. display: block;
  822. }
  823. [data-expands] svg {
  824. display: none;
  825. }
  826. main *:not(.with-desc) {
  827. page-break-inside: avoid;
  828. }
  829. .note.warning {
  830. border-left: 0.5rem solid;
  831. background: none;
  832. }
  833. }