/* Daily Game — each day's game is a different box: the lid colour comes from --lid-hue. */

@font-face {
    font-family: "Bowlby One";
    src: url("../fonts/BowlbyOne-Regular.ttf") format("truetype");
    font-display: swap;
}
@font-face {
    font-family: "Atkinson Hyperlegible";
    src: url("../fonts/AtkinsonHyperlegible-Regular.ttf") format("truetype");
    font-weight: 400;
    font-display: swap;
}
@font-face {
    font-family: "Atkinson Hyperlegible";
    src: url("../fonts/AtkinsonHyperlegible-Bold.ttf") format("truetype");
    font-weight: 700;
    font-display: swap;
}
@font-face {
    font-family: "Atkinson Hyperlegible";
    src: url("../fonts/AtkinsonHyperlegible-Italic.ttf") format("truetype");
    font-style: italic;
    font-display: swap;
}

@counter-style die {
    system: fixed;
    symbols: "⚀" "⚁" "⚂" "⚃" "⚄" "⚅";
    suffix: " ";
}

:root {
    --lid-hue: 250;
    --paper: #ffffff;
    --ink: #221e33;
    --ink-soft: #5b5670;
    --panel: #eeedf3;
    --lid: hsl(var(--lid-hue) 62% 36%);
    --lid-ink: #ffffff;
    --accent: hsl(var(--lid-hue) 62% 36%);
    --measure: 36rem;
    --gutter: clamp(1.25rem, 5vw, 2rem);
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #17151f;
        --ink: #eceaf4;
        --ink-soft: #a9a5ba;
        --panel: #24212f;
        --lid: hsl(var(--lid-hue) 55% 30%);
        --accent: hsl(var(--lid-hue) 70% 72%);
    }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font: 1.1875rem/1.55 "Atkinson Hyperlegible", system-ui, sans-serif;
}

a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* Site header: small and quiet, the lid below is the show. */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    max-width: calc(var(--measure) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0.9rem var(--gutter);
    font-size: 1rem;
}
.site-name { font-weight: 700; color: var(--ink); text-decoration: none; }

main {
    max-width: calc(var(--measure) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter) 4rem;
}

/* The box lid */
.lid {
    background: var(--lid);
    color: var(--lid-ink);
    margin: 0 calc(-1 * var(--gutter)) 2rem;
    padding: 1.25rem var(--gutter) 1.75rem;
    border-radius: 0 0 1.25rem 1.25rem;
}
@media (min-width: 42rem) {
    .lid { border-radius: 1.25rem; }
}
.lid a { color: inherit; }

.days {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    font-size: 0.95rem;
    opacity: 0.92;
}
.days .today { flex: 1; text-align: center; }
.days [rel="prev"] { order: -1; }

.lid h1, .game h1, .why h1, main > h1 {
    font-family: "Bowlby One", "Atkinson Hyperlegible", sans-serif;
    font-weight: 400;
    line-height: 0.98;
    letter-spacing: -0.01em;
    margin: 1.5rem 0 1rem;
}
.lid h1 {
    font-size: clamp(2.9rem, 13vw, 4.75rem);
    overflow-wrap: anywhere;
}
main > h1, .why h1 { font-size: clamp(2rem, 8vw, 3rem); }

.facts {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0;
    padding: 0;
    font-size: 1rem;
}
.game .facts { margin-bottom: 2rem; }
.facts li {
    border: 2px solid currentColor;
    border-radius: 999px;
    padding: 0.1rem 0.75rem;
}

.notice {
    background: var(--panel);
    border-radius: 0.75rem;
    padding: 0.9rem 1.1rem;
}

/* Rules */
.rules h2 {
    font-size: 1.05rem;
    margin: 2rem 0 0.5rem;
    color: var(--ink-soft);
}
.rules h2:first-child { margin-top: 0; }
.rules ul { padding-left: 1.2rem; }
.rules p { margin: 0.5rem 0; }

/* The actions: one die face per choice — roll a die if you can't decide. */
.rules ol {
    list-style: none;
    counter-reset: choice;
    padding: 0;
    margin: 1rem 0 0;
    display: grid;
    gap: 0.75rem;
}
.rules ol li {
    counter-increment: choice;
    position: relative;
    background: var(--panel);
    border-radius: 0.75rem;
    padding: 0.9rem 1.1rem 0.9rem 3.4rem;
}
.rules ol li::before {
    content: counter(choice, die);
    position: absolute;
    left: 0.8rem;
    top: 0.75rem;
    font-size: 2.1rem;
    line-height: 1;
    color: var(--accent);
}
.rules ol li em { color: var(--ink-soft); }

.example {
    margin-top: 1.5rem;
    border-top: 2px solid var(--panel);
    padding-top: 1rem;
}
.example summary { cursor: pointer; font-weight: 700; }
.example ul { padding-left: 1.2rem; color: var(--ink-soft); }

/* Voting tokens */
.vote { margin-top: 3rem; }
.vote h2 { font-size: 1.3rem; margin: 0 0 0.75rem; }
.vote form { display: flex; gap: 0.9rem; }
.vote button {
    width: 4.25rem;
    height: 4.25rem;
    border-radius: 50%;
    border: 3px solid var(--panel);
    background: var(--paper);
    font-size: 2rem;
    line-height: 1;
    cursor: pointer;
}
.vote button[aria-pressed="true"] {
    border-color: var(--accent);
    background: var(--panel);
    animation: pop 220ms ease-out;
}
@keyframes pop {
    50% { transform: scale(1.12); }
}
.vote-result { color: var(--ink-soft); }
.tally { display: inline-flex; gap: 0.9rem; margin-right: 0.5rem; }

.game-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: center;
    margin-top: 2.5rem;
}
.game-actions button {
    font: inherit;
    font-weight: 700;
    color: var(--paper);
    background: var(--ink);
    border: 0;
    border-radius: 999px;
    padding: 0.55rem 1.25rem;
    cursor: pointer;
}

/* Archive: a shelf of boxes */
.archive { list-style: none; padding: 0; margin: 0; display: grid; gap: 1rem; }
.archive li {
    border-left: 0.6rem solid hsl(var(--lid-hue) 62% 36%);
    padding: 0.25rem 0 0.25rem 1rem;
}
.archive a { display: block; color: var(--ink); text-decoration: none; }
.archive a:hover strong { text-decoration: underline; }
.archive time { display: block; font-size: 0.95rem; color: var(--ink-soft); }
.archive strong { font-family: "Bowlby One", sans-serif; font-weight: 400; font-size: 1.5rem; line-height: 1.1; }
.archive p { margin: 0.25rem 0; }
.archive .tally { font-size: 0.95rem; color: var(--ink-soft); }

/* Why page */
.why table { border-collapse: collapse; width: 100%; margin: 1rem 0; }
.why th, .why td { text-align: left; padding: 0.4rem 0; border-bottom: 1px solid var(--panel); }
.why td:last-child, .why th:last-child { text-align: right; }
.why .score strong { font-family: "Bowlby One", sans-serif; font-weight: 400; font-size: 2rem; }
.small { font-size: 0.9rem; color: var(--ink-soft); }

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; }
}

/* Print page and printing in general: ink only, one sheet. */
.print .site-header { display: none; }
.print main { padding-top: 2rem; }
.print .game h1 { font-size: 2.5rem; margin-top: 0; }
@media print {
    :root { --paper: #fff; --ink: #000; --ink-soft: #333; --panel: #fff; --accent: #000; }
    body { font-size: 11pt; }
    .site-header, .days, .vote, .game-actions, .notice, .example { display: none; }
    .lid { background: none; color: #000; margin: 0; padding: 0; }
    .lid h1, .game h1 { font-size: 26pt; margin: 0 0 0.5rem; }
    .rules ol li { border: 1px solid #999; padding: 0.4rem 0.6rem 0.4rem 2.6rem; break-inside: avoid; }
    .rules ol li::before { left: 0.5rem; top: 0.35rem; font-size: 1.6rem; }
    main { padding: 0; max-width: none; }
    @page { margin: 15mm; }
}
