@font-face {
    font-family: 'BioRhyme';
    src: url('/assets/fonts/BioRhyme-VariableFont_wdth,wght.ttf') format('truetype');
    font-weight: 200 800;
    font-stretch: 100% 125%;
    font-display: swap;
}

:root {
    --gold: rgb(225 169 99);
    --gold-light: rgb(244 211 160);
    --teal: rgb(34 76 81);
    --night: #05080a;
    --card: rgb(8 14 16 / .78);
    --radius: 1rem;
}

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

html {
    background: var(--night);
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    font-family: 'BioRhyme', Georgia, serif;
    font-size: 1.15rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Fixed through a pseudo-element: iOS ignores background-attachment: fixed. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background: radial-gradient(circle at 50% 35%, rgb(0 0 0 / .05) 0%, rgb(0 0 0 / .6) 60%, rgb(0 0 0 / .95) 100%),
    center / cover no-repeat url('/front/images/bg.webp');
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

/* Snow */

.snow,
.snow::before {
    position: fixed;
    inset: -100vh 0 0;
    z-index: -1;
    pointer-events: none;
    background-image: radial-gradient(2px 2px at 20px 30px, white 50%, transparent 51%),
    radial-gradient(2px 2px at 140px 90px, white 50%, transparent 51%),
    radial-gradient(3px 3px at 230px 200px, white 50%, transparent 51%),
    radial-gradient(2px 2px at 90px 260px, white 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 280px 20px, white 50%, transparent 51%);
    background-size: 300px 300px;
    opacity: .35;
    animation: snow 30s linear infinite;
}

.snow::before {
    content: '';
    inset: 0;
    background-size: 220px 220px;
    background-position: 60px 40px;
    opacity: .6;
    filter: blur(1px);
    animation-duration: 45s;
}

@keyframes snow {
    to {
        transform: translateY(100vh);
    }
}

/* Layout */

.page {
    width: min(22rem, 100% - 2rem);
    padding: 1.5rem 0 1rem;
    text-align: center;
}

.stage {
    position: relative;
}

.stage img {
    display: block;
    height: auto;
    user-select: none;
}

.dog {
    width: 74%;
    margin: 0 auto;
    transform-origin: 50% 100%;
    animation: peek 4s ease-in-out infinite;
}

.hat {
    position: relative;
    z-index: 1;
    width: 100%;
    margin-top: -12%;
    filter: drop-shadow(0 1.5rem 1.5rem rgb(0 0 0 / .6));
}

@keyframes peek {
    0%, 100% {
        transform: translateY(0) rotate(0);
    }
    50% {
        transform: translateY(-3%) rotate(-1.5deg);
    }
}

.card {
    position: relative;
    z-index: 2;
    margin-top: -28%;
    padding: 1.5rem 1.25rem;
    border: 1px solid rgb(225 169 99 / .7);
    border-radius: var(--radius);
    background: var(--card);
    backdrop-filter: blur(.4rem);
    -webkit-backdrop-filter: blur(.4rem);
    box-shadow: 0 0 2.6rem rgb(255 255 255 / .12), inset 0 1px 0 rgb(255 255 255 / .08);
}

h1,
h2 {
    margin: 0;
    color: var(--gold);
    font-weight: 700;
    line-height: 1.1;
}

h1 {
    margin-bottom: .75rem;
    font-size: 1.6rem;
    font-stretch: 115%;
}

h2 {
    font-size: clamp(2.2rem, 11vw, 2.8rem);
    text-shadow: 0 0 1.2rem rgb(225 169 99 / .45);
}

.text {
    margin: 0;
    font-size: 1.3rem;
    line-height: 1.55;
    text-wrap: balance;
}

.hint {
    margin: 1rem 0 0;
    color: rgb(255 255 255 / .6);
    font-size: .85rem;
    text-wrap: balance;
}

/* Buttons */

.button {
    display: block;
    width: 100%;
    margin-top: 1.25rem;
    padding: .7rem 1.5rem;
    border: 0;
    border-radius: 10rem;
    background: linear-gradient(180deg, var(--gold-light), var(--gold));
    color: #1a1208;
    font: inherit;
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    box-shadow: 0 .4rem 1rem rgb(0 0 0 / .6), inset 0 1px 0 rgb(255 255 255 / .5);
    transition: transform .2s, box-shadow .2s, opacity .2s, filter .2s;
}

.button:hover {
    filter: brightness(1.08);
    box-shadow: 0 .6rem 1.4rem rgb(0 0 0 / .7), 0 0 1.4rem rgb(225 169 99 / .35);
}

.button:active {
    transform: scale(.97);
}

.button:focus-visible,
.name:has(input:focus-visible) {
    outline: 2px solid white;
    outline-offset: 3px;
}

.button.is-pulsing {
    animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
    50% {
        transform: scale(.94);
    }
}

/* Name picker */

.names {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: .6rem;
    margin: 1.25rem 0 0;
    padding: 0;
    border: 0;
}

.name {
    position: relative;
    display: block;
    cursor: pointer;
}

.name input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.name span {
    display: block;
    padding: .65rem .5rem;
    border: 1px solid rgb(255 255 255 / .18);
    border-radius: .7rem;
    background: rgb(255 255 255 / .06);
    font-size: 1.05rem;
    line-height: 1.3;
    overflow-wrap: anywhere;
    transition: background .2s, border-color .2s, color .2s, transform .2s;
}

.name:hover span {
    border-color: rgb(225 169 99 / .7);
    background: rgb(225 169 99 / .12);
}

.name input:checked + span {
    border-color: var(--gold);
    background: var(--gold);
    color: #1a1208;
    font-weight: 700;
    transform: scale(1.04);
    box-shadow: 0 0 1.2rem rgb(225 169 99 / .45);
}

.name.is-read {
    cursor: default;
}

.name.is-read span {
    border-style: dashed;
    background: transparent;
    color: rgb(255 255 255 / .35);
    text-decoration: line-through;
}

.name.is-read span::after {
    content: ' ✓';
    text-decoration: none;
    display: inline-block;
    margin-left: .2rem;
}

.pick:invalid .button {
    opacity: .45;
    box-shadow: none;
}

/* Reveal */

.reveal {
    display: none;
}

.cover {
    margin: 1.25rem 0 1rem;
}

.cover img {
    display: block;
    width: 100%;
    height: auto;
    border: 2px solid var(--gold);
    border-radius: var(--radius);
    box-shadow: 0 1rem 2rem rgb(0 0 0 / .8), 0 0 2.5rem rgb(225 169 99 / .3);
}

body.revealing .dog {
    animation: dive .7s ease-in forwards;
}

body.revealing .hat {
    animation: shake .45s ease-in-out .6s 2;
}

body.revealed .prepare,
.card:has(#reveal:target) .prepare {
    display: none;
}

body.revealed .reveal,
#reveal:target {
    display: block;
    scroll-margin-top: 1rem;
    animation: appear .9s cubic-bezier(.2, .9, .3, 1.2) both;
}

body.revealed .cover img {
    animation: glow 3s ease-in-out .9s infinite;
}

@keyframes dive {
    20% {
        transform: translateY(-8%);
    }
    to {
        transform: translateY(60%) scale(.85);
        opacity: 0;
    }
}

@keyframes shake {
    25% {
        transform: rotate(-4deg);
    }
    75% {
        transform: rotate(4deg);
    }
}

@keyframes appear {
    from {
        opacity: 0;
        transform: translateY(2rem) scale(.9);
        filter: blur(.5rem);
    }
}

@keyframes glow {
    50% {
        box-shadow: 0 1rem 2rem rgb(0 0 0 / .8), 0 0 3.5rem rgb(225 169 99 / .55);
    }
}

/* Sparkles, thrown out of the hat on reveal */

.sparkles {
    position: absolute;
    top: 52%;
    left: 50%;
    z-index: 3;
    pointer-events: none;
}

.sparkles span {
    position: absolute;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: var(--gold-light);
    box-shadow: 0 0 .6rem var(--gold);
    animation: sparkle 1.4s ease-out var(--delay) both;
}

.sparkles span:nth-child(3n) {
    background: white;
}

@keyframes sparkle {
    from {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    to {
        transform: translate(var(--x), var(--y)) scale(.2);
        opacity: 0;
    }
}

.app-version {
    margin: auto 0 0;
    padding: 2rem 0 1rem;
    color: rgb(255 255 255 / .35);
    font-size: .7rem;
}

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

    html {
        scroll-behavior: auto;
    }
}

/* Admin: the organiser's page, Sun stays out of the way. */

.page-admin .page {
    width: min(40rem, 100% - 2rem);
}

.page-admin .stage {
    display: none;
}

.page-admin .card {
    margin-top: 0;
    text-align: left;
}

.page-admin h1 {
    text-align: center;
}

.page-admin h3 {
    margin: 1.75rem 0 .6rem;
    color: var(--gold);
    font-size: 1.05rem;
}

.page-admin button,
.page-admin select,
.page-admin textarea {
    font: inherit;
    font-size: .85rem;
    color: white;
    background: rgb(255 255 255 / .08);
    border: 1px solid rgb(255 255 255 / .25);
    border-radius: .5rem;
    padding: .35rem .7rem;
}

.page-admin button {
    cursor: pointer;
}

.page-admin button:hover {
    border-color: var(--gold);
}

.page-admin button.is-primary {
    background: var(--gold);
    border-color: var(--gold);
    color: #1a1208;
    font-weight: 700;
}

.page-admin select option {
    color: black;
}

.admin-message {
    padding: .6rem .9rem;
    border-left: 3px solid var(--gold);
    background: rgb(225 169 99 / .12);
    font-size: .9rem;
}

.admin-spoiler-toggle {
    display: block;
    margin-bottom: .5rem;
    font-size: .85rem;
    cursor: pointer;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.admin-table th,
.admin-table td {
    padding: .45rem .4rem;
    border-bottom: 1px solid rgb(255 255 255 / .12);
    text-align: left;
}

.admin-table th {
    color: rgb(255 255 255 / .6);
    font-size: .75rem;
    font-weight: 400;
}

.admin-table a {
    color: white;
}

.admin-spoiler {
    filter: blur(.35rem);
    transition: filter .2s;
}

.card:has(.admin-spoiler-toggle input:checked) .admin-spoiler {
    filter: none;
}

.admin-actions {
    text-align: right !important;
}

.admin-actions form {
    display: inline;
}

.admin-force,
.admin-global {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    font-size: .9rem;
}

.admin-links {
    width: 100%;
    resize: vertical;
    line-height: 1.6;
}
