:root {
    --content-width: 800px;
    --vertical-spacing: 1.5em;
    --spacing-unit: 2em;
    --character-width: 16px;
    --character-height: 16px;
    --character-scale: 1.5;
    --characters-per-row: 256;
    --media-border-radius: 1em;

    --accent-color: rgb(32, 214, 151);
    --primary-foreground-color: black;
    --secondary-foreground-color: #ddd;
    --primary-background-color: #fff;
    --secondary-background-color: #eee;
    --translucent-background-color: rgba(255, 255, 255, 0.8);
}

@media (prefers-color-scheme: dark) {

    :root {
        --primary-foreground-color: #fff;
        --secondary-foreground-color: #666;
        --primary-background-color: #171616;
        --secondary-background-color: #1d1d1d;
        --translucent-background-color: rgba(23, 22, 22, 0.8);
    }
    
}

@font-face {
    font-family: 'ChiKareGo';
    src: url('/fonts/ChiKareGo.ttf');
}

@font-face {
    font-family: 'ChiKareGo2';
    src: url('/fonts/ChiKareGo2.ttf');
}

@font-face {
    font-family: 'Unifont';
    src: url('/fonts/unifont-15.1.02.otf');
}

body {
    background-color: var(--primary-background-color);
    color: var(--primary-foreground-color);
    font-family: 'Unifont', Helvetica, sans-serif;
    font-weight: 200;
    margin: 0;
}

h1, h2, h3, h4 {
    font-family: 'ChiKareGo2', Helvetica, sans-serif;
}

h1 {
    font-size: 3em;
}

header {
    text-align: center;
    font-size: 1.5em;
}

header h1 {
    font-size: 2em;
}

a {
    color: var(--accent-color);
    text-decoration: none;
}

table {
    border: 1px solid var(--secondary-foreground-color);
    border-collapse: collapse;
}

table th, table td {
    padding: 0.5em;
}

table td {
    border: 1px solid var(--secondary-foreground-color);
}

ul.navigation {
    list-style: none;
    text-align: center;
    margin: 0;
    padding: 1em;
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-sizing: border-box;
    font-weight: 400;
    background-color: var(--translucent-background-color);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

ul.navigation a {
    text-decoration: none;
}

ul.navigation > li {
    display: inline-block;
    padding: 0.4em;
}

ul.features {
    list-style: none;
    padding: 0;
}

.header {
    text-align: center;
}

.content {
    max-width: var(--content-width);
    margin: auto;
    padding: 0 2em;
    font-size: 1.1em;
    line-height: var(--vertical-spacing);
}

.tagline {
    text-align: center;
    font-size: 1.4em;
    font-weight: 400;
}

.footer {
    max-width: var(--content-width);
    margin: auto;
    padding: 2em;
    text-align: center;
}

.footer ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer ul li {
    display: inline-block;
}

.footer ul li::after {
    content: ", "
}

.footer ul li:last-child::after {
    content: ""
}

.info {
    background: var(--secondary-background-color);
    border-radius: var(--media-border-radius);
    padding: 2em;
    text-align: center;
}

img {
    max-width: 100%;
    margin: auto;
    border-radius: var(--media-border-radius);
}

hr {
    border: 0;
    border-bottom: 1px solid var(--secondary-foreground-color);
    margin-bottom: var(--spacing-unit);
}

.character {
    /*
     * Character offsets are typically calculated as (code % 256, floor(code / 256)).
     *
     * You can copy-and-paste the following code into a Swift repl to get a useful function:
     *
     * func offset(_ value: Int) -> (Int, Int) { (value % 256, value / 256) }
     */
    width: var(--character-width);
    height: var(--character-height);
    display: inline-block;
    background: url('/images/unifont.png');
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    scale: var(--character-scale);
}

@media (prefers-color-scheme: dark) {
    .character {
        filter: invert(99%) sepia(22%) saturate(2%) hue-rotate(94deg) brightness(102%) contrast(100%);   
    }
}

.weary-cat {
    /* 0x1F640 */
    background-position: calc(-1 * 64 * var(--character-width)) calc(-1 * 502 * var(--character-height));
}

.cloud-with-rain {
    /* 0x1F327 */
    background-position: calc(-1 * 39 * var(--character-width)) calc(-1 * 499 * var(--character-height));
}

.metro {
    /* 0x1F687 */
    background-position: calc(-1 * 135 * var(--character-width)) calc(-1 * 502 * var(--character-height));
}

.speech-balloon {
    /* 0x1F4AC */
    background-position: calc(-1 * 172 * var(--character-width)) calc(-1 * 500 * var(--character-height));
}

.spiral-calendar {
    /* 0x1F5D3 */
    background-position: calc(-1 * 211 * var(--character-width)) calc(-1 * 501 * var(--character-height));
}

.grid {
    list-style: none;
    display: grid;
    grid-gap: 1em;
    margin: 0 0 0 0;
    margin-bottom: var(--spacing-unit);
    padding: 0;
}

ul.grid > li {
    padding: 0;
    text-indent: 0;
    box-sizing: border-box;
}

.grid.prefer-2-columns {
    grid-template-columns: 1fr 1fr;
}

.grid h1 {
    font-weight: bold;
    font-size: 1.4em;
    margin: 0.2em 0;
}

.grid p {
    margin: 0;
}

@media screen and (max-width: 600px) { /* Palm */
    .grid.prefer-2-columns {
        grid-template-columns: 1fr;
    }
}

.simulator .device {
    max-width: max-content;
    margin: auto;
}

.simulator .screen {
    border: 1px solid var(--secondary-foreground-color);
    margin: auto;
    text-align: center;
    position: relative;
}

.simulator .qrcode {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin: 0 auto;
}

.simulator ul.buttons {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: right;
}

.simulator ul.buttons li {
    display: inline;
    margin-left: 0.5em;
}

.simulator details {
    font-size: 0.8em;
}

.simulator details table {
    background: #fafafa;
}

.simulator details table td {
    word-break: break-all;
}
