/* IBM Plex Serif (SIL Open Font License, see fonts/OFL.txt), served from this site.
   Only the Latin subset is shipped; other characters fall back to Georgia/serif. */
@font-face {
    font-family: 'IBM Plex Serif';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/ibm-plex-serif-latin-400.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'IBM Plex Serif';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('fonts/ibm-plex-serif-latin-700.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --bg: #c8daeb;
    --ink: #000000;
    --muted: #3b4f63;
    --brand: #FC7C00;
    --card: #ffffff;
    --card-edge: #587490;
    --done: #d4edda;
    --done-edge: #2e7d46;
    --check: #28a745;
    --check-ink: #ffffff;
    --link: #2864d2;
    --link-bg: #ffffff;
    --link-hover: #eef4ff;
    --focus: #1b5fd1;
    --shadow: rgba(0, 0, 0, 0.1);
    /* On the root so the viewport, scrollbars and controls follow the scheme too. */
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #14202d;
        --ink: #e8eef5;
        --muted: #aebfce;
        --card: #1f2f40;
        --card-edge: #6a8399;
        --done: #1d3b2b;
        --done-edge: #3aa77a;
        --check: #3aa77a;
        --check-ink: #0d1f17;
        --link: #8db4ff;
        --link-bg: #1f2f40;
        --link-hover: #2a3d52;
        --focus: #7aa7ff;
        --shadow: rgba(0, 0, 0, 0.4);
    }
}

body {
    font-family: 'IBM Plex Serif', Georgia, serif;
    /* Keeps the fallback font the same visual size as IBM Plex Serif while it loads. */
    font-size-adjust: from-font;
    line-height: 1.5;
    background: var(--bg);
    color: var(--ink);
    text-align: center;
    margin: 0;
}

h1 {
    color: var(--brand);
    margin: 0 auto;
    text-wrap: balance;
}

h2 {
    margin: 0 auto;
}

.goal {
    margin: 0 auto;
    font-size: 1.125rem;
    font-weight: 700;
    text-wrap: balance;
}

.noscript {
    margin: 1.25rem;
}

/* task cards: a list of toggle buttons */
.cards {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cards li {
    width: 95%;
    max-width: 800px;
    margin: 4px auto;
}

.card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3.25rem;
    /* Room on both sides for the completed checkmark, so centred text never touches it. */
    padding: 0.35rem 2.5rem;
    border: 2px solid var(--card-edge);
    border-radius: 12px;
    background: var(--card);
    box-shadow: 0 4px 8px var(--shadow);
    color: inherit;
    font: inherit;
    text-align: center;
    text-wrap: pretty;
    overflow-wrap: break-word;
    cursor: pointer;
}

.card:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

/* completed state: colour plus a checkmark, so colour isn't the only signal */
.card[aria-pressed="true"] {
    background-color: var(--done);
    border-color: var(--done-edge);
}

.card[aria-pressed="true"]::after {
    content: "\2713";
    position: absolute;
    top: 0.5rem;
    right: 0.625rem;
    width: 1.625rem;
    height: 1.625rem;
    line-height: 1.625rem;
    border-radius: 50%;
    background: var(--check);
    color: var(--check-ink);
    font-size: 0.875rem;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

.card {
    transition: box-shadow 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}

/* Only movement is switched off for people who ask for less motion. */
@media (prefers-reduced-motion: no-preference) {
    .card {
        transition-property: transform, box-shadow, border-color, background-color;
    }

    .card:active {
        transform: scale(0.995);
        transition-duration: 0.06s;
    }
}

/* Forced colors removes shadows and replaces colours: keep the completed state visible. */
@media (forced-colors: active) {
    .card[aria-pressed="true"] {
        border-color: Highlight;
    }

    .card[aria-pressed="true"]::after {
        background: Highlight;
        color: HighlightText;
    }
}

/* new card link */
.actions {
    margin: 0.875rem auto;
}

.actions a {
    display: inline-block;
    padding: 0.5rem 0.875rem;
    margin: 0 5px;
    border: 2px solid var(--link);
    border-radius: 6px;
    background: var(--link-bg);
    color: var(--link);
    font: inherit;
    text-decoration: none;
    cursor: pointer;
}

.actions a:hover {
    background: var(--link-hover);
}

.actions a:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

/* bottom sections: rules, then the QR code, then a credit line */
.how_to_play,
.qrcode {
    max-width: 600px;
    margin: 1.75rem auto 0;
    padding: 0 1.25rem;
}

.how_to_play h2,
.qrcode h2 {
    margin: 0 0 0.625rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
}

.how_to_play ul {
    margin: 0;
    padding-left: 1.25rem;
    text-align: left;
}

.how_to_play li {
    text-wrap: pretty;
}

.how_to_play li + li {
    margin-top: 0.375rem;
}

/* A white tile with room around the code, so it scans on any background. */
.qr {
    display: inline-block;
    padding: 12px;
    background: #fff;
    border-radius: 14px;
    line-height: 0;
}

.qr img {
    display: block;
    width: min(220px, 66vw);
    height: auto;
}

.footer {
    margin: 1.75rem auto 1.5rem;
    padding: 0 1.25rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.footer p {
    margin: 0;
}

.footer a {
    color: inherit;
}

/* em, not px, so the breakpoint follows the user's text size */
@media (max-width: 37.5em) {
    .card {
        font-size: 1.125rem;
    }

    .goal {
        font-size: 1.25rem;
    }
}
