/*
 * Carlster: Material 3 in hand-written CSS, like the dflag.se front page and the other dflag.se pages (Nunito, tinted
 * surfaces instead of outlines, rounded shapes, light and dark after the device), mobile first: the rules are read on
 * a phone at the table while the DJ scans the cards.
 * The tones come from the old page's own colours: indigo (default) is the logo's and the headings' #6366F1, fuchsia
 * (?ton=fuchsia) the logo gradient's other end, #EC4899. Every text colour pair is at least 4.5:1
 * (tools/test_site.py checks it).
 */

@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/nunito-latin-400-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("../fonts/nunito-latin-700-normal.woff2") format("woff2");
}

@font-face {
    font-family: "Nunito";
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url("../fonts/nunito-latin-800-normal.woff2") format("woff2");
}

:root {
    color-scheme: light dark;
    --font: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --max: 760px;
    --gutter: max(16px, env(safe-area-inset-left));
    --gutter-r: max(16px, env(safe-area-inset-right));
}

/* tone: indigo (light) */
:root,
:root[data-tone="indigo"] {
    --primary: #4648d4;
    --on-primary: #ffffff;
    --container: #e1e0ff;
    --on-container: #07006c;
    --bg: #fcf8ff;
    --surface: #f0ecf9;
    --surface-high: #e4e1ed;
    --text: #1b1b23;
    --text-2: #464554;
    --outline: #767586;
    --accent: #ffd9e4;
    --on-accent: #3e0021;
    --inverse: #303038;
    --on-inverse: #f2effb;
}

:root[data-tone="fuchsia"] {
    --primary: #b10e6b;
    --on-primary: #ffffff;
    --container: #ffd9e4;
    --on-container: #3e0021;
    --bg: #fff8f8;
    --surface: #fbeaef;
    --surface-high: #f5dce3;
    --text: #25181d;
    --text-2: #574048;
    --outline: #8b7079;
    --accent: #e1e0ff;
    --on-accent: #07006c;
    --inverse: #3b2c31;
    --on-inverse: #ffecf1;
}

@media (prefers-color-scheme: dark) {
    :root,
    :root[data-tone="indigo"] {
        --primary: #c0c1ff;
        --on-primary: #1000a9;
        --container: #2f2ebe;
        --on-container: #e1e0ff;
        --bg: #13131b;
        --surface: #1f1f27;
        --surface-high: #34343d;
        --text: #e4e1ed;
        --text-2: #c7c4d7;
        --outline: #908fa0;
        --accent: #7a2950;
        --on-accent: #ffd9e4;
        --inverse: #e4e1ed;
        --on-inverse: #303038;
    }

    :root[data-tone="fuchsia"] {
        --primary: #ffb0cd;
        --on-primary: #640039;
        --container: #8e0050;
        --on-container: #ffd9e4;
        --bg: #1c1014;
        --surface: #291c21;
        --surface-high: #403136;
        --text: #f5dce3;
        --text-2: #debec8;
        --outline: #a68992;
        --accent: #2f2ebe;
        --on-accent: #e1e0ff;
        --inverse: #f5dce3;
        --on-inverse: #3b2c31;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 16px;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 17px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
}

h1,
h2,
h3 {
    margin: 0;
    line-height: 1.2;
    text-wrap: balance;
}

p {
    margin: 0;
}

a {
    color: var(--primary);
}

:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 8px;
}

.icon {
    width: 24px;
    height: 24px;
    flex: none;
    fill: currentColor;
}

/* top bar */
.app-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: var(--max);
    margin: 0 auto;
    padding: max(12px, env(safe-area-inset-top)) var(--gutter-r) 4px var(--gutter);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 800;
    font-size: 20px;
    text-decoration: none;
}

.brand__mark {
    width: 40px;
    height: 40px;
    padding: 8px;
    border-radius: 14px;
    background: var(--container);
    fill: var(--on-container);
}

.grow {
    flex: 1;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 24px;
    border-radius: 999px;
    font: inherit;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    white-space: nowrap;
}

.btn.filled {
    background: var(--primary);
    color: var(--on-primary);
}

.btn.tonal {
    background: var(--container);
    color: var(--on-container);
}

.btn.text {
    padding: 0 12px;
    color: var(--primary);
}

.btn.text:hover {
    background: var(--surface);
}

.btn .icon {
    width: 20px;
    height: 20px;
}

main {
    max-width: var(--max);
    margin: 0 auto;
    padding: 8px var(--gutter-r) 32px var(--gutter);
}

/* hero */
.hero {
    padding: 28px 24px;
    border-radius: 28px;
    background: var(--container);
    color: var(--on-container);
}

.hero__logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
}

.hero__logo svg {
    width: 56px;
    height: 56px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.hero__name {
    display: block;
    font-size: 44px;
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.5px;
}

.hero__kind {
    display: block;
    font-size: 16px;
    font-weight: 700;
    opacity: 0.85;
}

.hero h1 {
    font-size: 26px;
    font-weight: 800;
}

.hero__text {
    margin-top: 8px;
    font-size: 18px;
}

/* the chips under the hero: jump to a section */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 8px;
    padding: 0;
    list-style: none;
}

.chip {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
}

.chip:hover {
    background: var(--surface-high);
}

/* cards: one per section of the rules */
.card {
    margin-top: 16px;
    padding: 22px 20px;
    border-radius: 24px;
    background: var(--surface);
}

.card h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--primary);
    font-size: 22px;
    font-weight: 800;
}

.card h2 .icon {
    width: 28px;
    height: 28px;
}

.card h3 {
    margin: 20px 0 6px;
    font-size: 19px;
    font-weight: 800;
}

.card h4 {
    margin: 16px 0 6px;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-2);
}

.card p + p,
.card p + ul,
.card ul + p {
    margin-top: 10px;
}

.card strong {
    font-weight: 800;
}

.hl {
    color: var(--primary);
    font-weight: 800;
}

/* lists with a note in front (the old page's ♪) */
.notes {
    margin: 0;
    padding: 0;
    list-style: none;
}

.notes > li {
    position: relative;
    padding-left: 30px;
}

.notes > li + li {
    margin-top: 8px;
}

.notes > li::before {
    content: "♪";
    position: absolute;
    left: 4px;
    top: 0;
    color: var(--primary);
    font-weight: 800;
}

/* numbered steps */
.steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: step;
}

.steps > li {
    position: relative;
    min-height: 32px;
    padding-left: 46px;
    counter-increment: step;
}

.steps > li + li {
    margin-top: 14px;
}

.steps > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: -1px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--on-primary);
    font-size: 15px;
    font-weight: 800;
}

.sub {
    margin: 8px 0 0;
    padding-left: 20px;
}

.sub > li + li {
    margin-top: 4px;
}

.sub > li::marker {
    color: var(--primary);
}

/* the tip and the winning line */
.note {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--accent);
    color: var(--on-accent);
}

.win {
    font-size: 18px;
}

/* the three levels */
.levels {
    display: grid;
    gap: 10px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.levels > li {
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--bg);
}

.levels b {
    display: inline-block;
    margin-bottom: 2px;
    padding: 2px 10px;
    border-radius: 8px;
    background: var(--container);
    color: var(--on-container);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.6px;
}

@media (min-width: 640px) {
    .levels {
        grid-template-columns: repeat(3, 1fr);
    }

    .hero {
        padding: 36px 36px 32px;
    }

    .hero h1 {
        font-size: 30px;
    }

    .card {
        padding: 26px 28px;
    }
}

/* themes: chips */
.themes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.themes > li {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--bg);
    font-weight: 700;
}

footer {
    max-width: var(--max);
    margin: 0 auto;
    padding: 8px var(--gutter-r) max(32px, env(safe-area-inset-bottom)) var(--gutter);
    color: var(--text-2);
    font-size: 15px;
    text-align: center;
}

footer p + p {
    margin-top: 4px;
}

/* the small pages (404, a card that is not found, the Spotify sign-in) */
.message {
    margin-top: 16px;
}

.message .hero__text {
    margin-bottom: 20px;
}

.message .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}
