UNPKG

kontra

Version:

Kontra HTML5 game development library

689 lines (570 loc) 10.3 kB
/* BASELINE FONT - 16px BASELINE GRID - 1.625rem MODULAR FONT SCALE ------------------ 14px - small 16px - body, H6 18px - H5 22px - H4 26px - H3 30px - H2 36px - H1 */ html { font-size: 20px; } html, body { height: 100%; } /* * TYPOGRAPHY */ body { /* mobile first system ui font stack */ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; color: #242729; background: #fdfdfd; margin: 0; line-height: 1.625rem; } h2, h3, h4, h5, h6 { margin: 0 0 1rem 0; font-weight: normal; } h1, .nav-heading { font-size: 2.666rem; /* 48 / 18 */ line-height: 3.25rem; /* 1.625 * 2 */ font-weight: bold; padding-bottom: 0.8125rem; margin: 0; } h2, .nav-api-heading { font-size: 1.875rem; /* 30 / 16 */ line-height: 2.25rem; margin-bottom: 1rem; padding-right: 1.312rem; } h3 { margin-top: 1.312rem; font-size: 1rem; line-height: 1.625rem; font-weight: bold; } h4 { font-size: 1.375rem; /* 22 / 16 */ line-height: 1.625rem; } h5 { font-size: 1.125rem; /* 18 / 16 */ line-height: 1.625rem; } p { font-size: 1rem; line-height: 1.625rem; } p, ul, ol, dl, table, pre[class*=language-], canvas, form, figure, .tablist { margin: 0 0 1.312rem; } ul, dl { padding-left: 1.312rem; } li { line-height: 1.625rem; } dd + dt { margin-top: 0.75rem; } dd { margin-left: 1.312rem; } dt { margin-bottom: 0.382rem; } a { color: #3e76c2; text-decoration: none; } a:hover, a:focus { text-decoration: underline; } a:visited { color: #3e76c2; } /* highlight selected section */ :target { transform: translateX(20px); border-left-color: #3e76c2; } section > h2 { border-left: 40px solid white; padding-left: 10px; transition: transform 0.5s ease, border-left-color 0.5s ease; margin-left: -50px; } .content { display: flex; height: 100%; } canvas { max-width: 100%; background: #333333; } main { padding: 1.325rem; flex-grow: 1; position: relative; height: 100%; box-sizing: border-box; } main > div { max-width: 33.333rem; } .github-corner:hover .octo-arm { animation: octocat-wave 560ms ease-in-out } @keyframes octocat-wave { 0%, 100%{ transform: rotate(0) } 20%, 60% { transform: rotate(-25deg) } 40%, 80% { transform: rotate(10deg) } } @media (max-width: 500px) { .github-corner:hover .octo-arm { animation:none } .github-corner .octo-arm { animation: octocat-wave 560ms ease-in-out } .github-corner svg { width: 60px; height: 60px; } } .main-nav { background: #333333; padding: 1.325rem; width: 13.8889rem; flex-shrink: 0; overflow-y: auto; } nav { padding-right: 14.6%; } .nav-heading, .nav-api-heading { color: #fdfdfd; display: block; } .main-nav section:first-child { margin-top: 0; } .main-nav a { color: #fdfdfd; display: block; line-height: 1.25rem; margin: 0 0 0.382rem 0; padding: 0.4rem 0 0.4rem 0.382rem; text-decoration: none; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; } .main-nav a:visited { color: #fdfdfd; } .main-nav a:hover, .main-nav a:focus, .main-nav a[aria-current] { background: #fdfdfd; color: #242729; text-decoration: none; text-rendering: auto; -webkit-font-smoothing: auto; -moz-osx-font-smoothing: auto; } .main-nav a[href="#main"] { position: absolute; top: -100%; } .main-nav a[href="#main"]:focus { top: 0; } .main-nav strong { display: block; margin: 1.625rem 0 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid #fdfdfd; color: #fdfdfd; } /*nav * { padding-left: 5px; }*/ .toc ul { position: relative; } /* hide bulleted lists without using "list-style: none;" so VoiceOver still reads the toc as a list @see http://www.456bereastreet.com/archive/201109/screen_readers_list_items_and_list-stylenone/ */ .toc ul:after { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 1.312rem; background: #fdfdfd; } .toc li a { line-height: 1rem; display: block; margin: 0.1rem 0; } /* make the first level links line up with the nested links */ .toc > ul > li > a { margin-left: 1.312rem; } section { margin-top: 3.25rem; } main h2, main h3 { position: relative; } .section-link { color: #242729; display: block; } .section-link:visited { color: #242729; } h2 [aria-hidden=true], h3 [aria-hidden=true] { position: absolute; top: 0; right: 0; } code[class*=language-], pre[class*=language-] { font-size: 0.889rem; } [role=tablist] { display: flex; list-style: none; margin: 0; padding: 0; } [role=tablist] li:last-child { flex-grow: 1; border-bottom: 1px solid #333; } [role=tabpanel] { margin: 0; border: 1px solid #333; border-top: none; } [role=tabpanel] { display: none; } [role=tabpanel] pre { margin: 0; } [role=tab] { position: relative; padding: 0.5rem 1rem; display: block; background: none; border: 0; font-size: 0.75rem; cursor: pointer; border-left: 1px solid #aaa; border-right: 1px solid #aaa; border-top: 1px solid #aaa; } [role=tab]:before { content: ''; position: absolute; left: 0; top: 0; right: 0; bottom: 0; border-bottom: 1px solid #333; } [data-examples=global] [data-tab=global] [role=tab], [data-examples=es] [data-tab=es] [role=tab], [data-examples=bundle] [data-tab=bundle] [role=tab] { background: #f5f2f0; border-color: #333; } [data-examples=global] [data-tab=global] [role=tab]:before, [data-examples=es] [data-tab=es] [role=tab]:before, [data-examples=bundle] [data-tab=bundle] [role=tab]:before { display: none; } [data-examples=global] [data-tabpanel=global], [data-examples=es] [data-tabpanel=es], [data-examples=bundle] [data-tabpanel=bundle] { display: block; } .object-prop { margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid; } code:not([class]) { background: #f5f2f0; display: inline-block; padding: 0 0.25rem; } .optional { display: inline-block; margin-left: 1rem; padding: 0 0.25rem; font-style: italic; } /* * Customized bundle */ label { display: flex; align-items: center; } label input { margin-right: 0.5rem; } .filesize:before { content: '('; } .filesize:after { content: ')'; } /*#download { display: inline-block; position: absolute; right: 0; top: 0; border: 1px solid #3073dd; padding: 0.607rem 1.429rem; text-decoration: none; background: #3e76c2; color: #fdfdfd; text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-size: 1.35rem; line-height: 1; } #download:hover { }*/ .code-section { position: relative; margin-top: 0; } .code-title { max-width: 100%; } .code-output { height: 350px; } .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; } figure { text-align: center; } figure img { background: #333333; max-width: 100%; } figcaption { font-size: 16px; font-style: italic; } code-output { display: block; text-align: center; } dd > dl { margin-top: 1.312rem; } /** * Games made with kontra.js page */ .games { padding: 0; display: grid; grid-gap: 1.312rem; grid-template-columns: repeat(2, 1fr); text-align: center; list-style: none; } .games a { display: block; margin: 0 auto; } .games li { position: relative; } .games img { width: 100%; height: auto; } .games span { display: block; } @media screen and (max-width: 768px) { html { font-size: 14px; } } @media screen and (max-width: 620px) { .content { flex-direction: column; height: auto; } main > div { margin: 0 auto; } .main-nav { width: 100%; box-sizing: border-box; } nav { padding-right: 0; max-width: 33.333rem; display: flex; } .main-nav section { flex: 1; margin-top: 0; } .main-nav strong { height: 3.25rem; padding-bottom: 0.8125rem; margin: 0 0 1.312rem 0; line-height: 4.25rem; } } @media screen and (max-width: 350px) { .games { grid-template-columns: 1fr; } } .menu-button { color: #fdfdfd; margin: 0; padding: 0.382rem 0.8125rem; font-size: inherit; border: 1px solid #fdfdfd; background: none; position: absolute; top: 1.693rem; right: 1.325rem; line-height: 1.625rem; } .menu-button[aria-expanded="true"] { background: #fdfdfd; color: #242729; } .menu-button[aria-expanded="true"] + #menu { visibility: visible; } nav { display: block; } .main-nav { position: relative; } #menu { visibility: hidden; height: 0; transition: height 0.3s; margin: 0; padding: 0; list-style: none; overflow-y: hidden; } .nav-heading { margin: 0; padding: 0; border: 0; } #menu ul { padding: 0; margin: 0; list-style: none; } #menu .nav-api-heading { margin: 1.625rem 0 0.5rem; padding-bottom: 0.5rem; border-bottom: 1px solid #fdfdfd; color: #fdfdfd; margin-top: 3.25rem; } .menu-expanded .nav-heading { padding-bottom: 0.8125rem; border-bottom: 1px solid #fdfdfd; margin: 0 0 1.312rem 0; } .scroll-indicator { display: none; } @media screen and (min-width: 620px) { #menu { visibility: visible; } main { overflow-y: scroll; } #menu { overflow-y: initial; } .menu-button { display: none; } .main-nav .nav-heading { padding-bottom: 0.8125rem; border-bottom: 1px solid #fdfdfd; margin: 0 0 1.312rem 0; } .scroll-indicator { position: fixed; bottom: 0; left: 0; opacity: 0; visibility: hidden; display: flex; justify-content: center; align-items: center; padding: 0 1.325rem; width: 13.8889rem; height: 1.5rem; background: rgba(255,255,255,0.5); color: #242729; font-weight: bold; transform: rotate(180deg); font-size: 2rem; transition: opacity 300ms ease, visibility 300ms ease; } .showScroll .scroll-indicator { opacity: 1; visibility: visible; } .scroll-indicator span { margin-top: 0.5rem; } }