:root {
	--blue: #0038b8;
	--blue-dark: #002a8a;
	--ink: #14181f;
	--paper: #fffdf6;
	--muted: #4b5563;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
}

body {
	font-family: Heebo, "Segoe UI", Arial, sans-serif;
	color: var(--ink);
	background: #e6ecfa;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	padding: 1.5rem 1rem;
}

/* the waving flag sits behind everything, softened by a light veil */
#flag {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: -2;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	background: radial-gradient(ellipse at center, rgb(255 255 255 / 15%), rgb(230 236 250 / 65%));
}

.card {
	width: 100%;
	max-width: 40rem;
	background: rgb(255 255 255 / 84%);
	backdrop-filter: blur(8px);
	border: 1px solid rgb(255 255 255 / 70%);
	border-radius: 1.5rem;
	padding: 2rem 1.5rem 1.5rem;
	box-shadow: 0 20px 60px rgb(0 38 120 / 18%);
	text-align: center;
}

h1 {
	margin: 0;
	font-family: "Frank Ruhl Libre", Georgia, serif;
	font-weight: 900;
	font-size: clamp(2.6rem, 8vw, 4rem);
	line-height: 1;
	color: var(--blue);
	letter-spacing: 0.02em;
}

.tagline {
	margin: 0.5rem 0 0;
	color: var(--muted);
	font-size: 1.05rem;
}

/* the ballot slip, as dropped into the box */
.ballot {
	position: relative;
	margin: 1.75rem auto 1.5rem;
	max-width: 22rem;
	min-height: 12rem;
	padding: 1.75rem 1.25rem 1.5rem;
	background: var(--paper);
	border: 1px solid #d9d4c7;
	border-radius: 0.2rem;
	box-shadow: 0 1px 0 #fff inset, 0 14px 30px rgb(0 0 0 / 22%), 0 2px 4px rgb(0 0 0 / 10%);
	transform: rotate(-1.2deg);
}

.ballot::after {
	content: "";
	position: absolute;
	inset: 0.6rem;
	border: 1px dashed rgb(0 0 0 / 12%);
	pointer-events: none;
}

.ballot.drop {
	animation: drop 0.65s cubic-bezier(0.2, 0.9, 0.3, 1.25) both;
}

@keyframes drop {
	from {
		opacity: 0;
		transform: translateY(-70px) rotate(-8deg) scale(0.96);
	}

	to {
		opacity: 1;
		transform: translateY(0) rotate(-1.2deg) scale(1);
	}
}

.letters {
	font-family: "Frank Ruhl Libre", Georgia, serif;
	font-weight: 900;
	font-size: clamp(3.5rem, 14vw, 5.5rem);
	line-height: 1;
	letter-spacing: 0.06em;
	color: var(--ink);
}

.name {
	margin-top: 1rem;
	font-size: clamp(1.4rem, 5vw, 1.9rem);
	font-weight: 700;
	line-height: 1.35;
	color: var(--ink);
}

.word {
	display: inline-block;
	margin: 0 0.2em;
	opacity: 0;
	transform: translateX(50px);
	transition: opacity 0.5s ease, transform 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.35);
}

.word.adjective {
	transform: translateX(-50px);
	color: var(--blue);
}

.ballot.shown .word {
	opacity: 1;
	transform: none;
}

.ballot.shown .word.adjective {
	transition-delay: 0.4s;
}

.actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
}

button {
	font: inherit;
	font-weight: 700;
	font-size: 1.05rem;
	padding: 0.8rem 1.5rem;
	border-radius: 999px;
	border: 2px solid var(--blue);
	background: #fff;
	color: var(--blue);
	cursor: pointer;
	transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

button:hover,
button:focus-visible {
	transform: translateY(-2px);
	box-shadow: 0 8px 20px rgb(0 56 184 / 25%);
	outline: none;
}

button:active {
	transform: translateY(0);
}

button.primary {
	background: var(--blue);
	color: #fff;
	font-size: 1.25rem;
	padding: 0.9rem 2rem;
}

button.primary:hover,
button.primary:focus-visible {
	background: var(--blue-dark);
}

.status {
	min-height: 1.5rem;
	margin: 1rem 0 0;
	color: var(--muted);
}

footer {
	max-width: 40rem;
	text-align: center;
	color: var(--muted);
	font-size: 0.85rem;
}

footer p {
	margin: 0;
}

.credit {
	margin-top: 0.5rem;
}

.credit a {
	color: var(--blue);
	text-decoration: none;
	direction: ltr;
	unicode-bidi: isolate;
}

.credit a:hover,
.credit a:focus-visible {
	text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
	.ballot.drop {
		animation: none;
	}

	.word {
		transition: none;
	}

	button {
		transition: none;
	}
}
