/* Midnight Ledger — front-page vote. */

:root {
	--am-bg: #0E1420;
	--am-surface: #161E2E;
	--am-ink: #EEF1F7;
	--am-muted: #8A97AE;
	--am-accent: #F2A33C;
	--am-counter: #6B7A99;
	--am-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

html {
	background: var(--am-bg);
}

.admin-bar {
	--am-bar: 32px;
}

@media screen and (max-width: 782px) {
	.admin-bar {
		--am-bar: 46px;
	}
}


body {
	margin: 0;
	background: var(--am-bg);
	color: var(--am-ink);
	font-family: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
	font-weight: 400;
	-webkit-font-smoothing: antialiased;
	overflow-x: hidden;
}

.am {
	position: relative;
	/* As a group block, .am inherits Gutenberg's default block margin. */
	margin-block: 0;
	/* Admin bar (logged-in only) shortens the usable viewport by its height. */
	min-height: calc(100svh - var(--am-bar, 0px));
	display: grid;
	place-items: center;
	padding: clamp(28px, 4vw, 56px) clamp(20px, 5vw, 64px);
	isolation: isolate;
	/* Clip the aurora horizontally, but let a tall composition scroll. */
	overflow-x: hidden;
	box-sizing: border-box;
}

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

/* --- Animated ground -------------------------------------------------- */

.am__aurora {
	/* Fixed so the ground stays put if a short viewport scrolls. */
	position: fixed;
	inset: -10%;
	z-index: -2;
	filter: blur(56px);
	pointer-events: none;
}

.am__blob {
	position: absolute;
	display: block;
	border-radius: 50%;
	will-change: transform;
}

.am__blob--amber {
	width: 46vmax;
	height: 46vmax;
	top: -14%;
	right: -6%;
	opacity: 0.85;
	background: radial-gradient(circle at 50% 50%, rgba(242, 163, 60, 0.5) 0%, rgba(242, 163, 60, 0.16) 42%, transparent 70%);
	animation: am-drift-a 44s var(--am-ease) infinite alternate;
}

.am__blob--slate {
	width: 52vmax;
	height: 52vmax;
	bottom: -22%;
	left: -10%;
	opacity: 0.9;
	background: radial-gradient(circle at 50% 50%, rgba(107, 122, 153, 0.42) 0%, rgba(107, 122, 153, 0.14) 45%, transparent 72%);
	animation: am-drift-b 52s var(--am-ease) infinite alternate;
}

.am__blob--deep {
	width: 40vmax;
	height: 40vmax;
	top: 28%;
	left: 34%;
	opacity: 0.75;
	background: radial-gradient(circle at 50% 50%, rgba(34, 48, 74, 0.55) 0%, rgba(22, 30, 46, 0.25) 48%, transparent 74%);
	animation: am-drift-c 38s var(--am-ease) infinite alternate;
}

@keyframes am-drift-a {
	from { transform: translate3d(0, 0, 0) scale(1); }
	to   { transform: translate3d(-8vw, 10vh, 0) scale(1.18); }
}

@keyframes am-drift-b {
	from { transform: translate3d(0, 0, 0) scale(1.1); }
	to   { transform: translate3d(10vw, -8vh, 0) scale(0.92); }
}

@keyframes am-drift-c {
	from { transform: translate3d(0, 0, 0) scale(0.9); }
	to   { transform: translate3d(-12vw, -12vh, 0) scale(1.25); }
}

/* Fine tooth of grain so the gradients never band. */
.am__grain {
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	opacity: 0.035;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --- Stage ------------------------------------------------------------ */

.am__stage {
	width: min(920px, 100%);
	max-width: 100%;
	margin: 0;
	text-align: center;
}

/* Gutenberg group blocks add their own block margins; the composition
   controls its own rhythm, so neutralise them and re-apply deliberately. */
.am__stage > *,
.am__outro > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

.am__stage > .am__welcome {
	margin-block-end: clamp(24px, 3vw, 40px);
}

.am__stage > .am__question {
	margin-block-end: clamp(32px, 4.5vw, 56px);
}

.am__stage > .am__outro {
	margin-block-start: clamp(32px, 4vw, 52px);
}

.am__welcome {
	margin: 0 0 clamp(24px, 3vw, 40px);
	color: var(--am-ink);
	font-size: clamp(1.6rem, 3.4vw, 2.6rem);
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: -0.015em;
	text-wrap: balance;
}

.am__domain {
	color: var(--am-accent);
	font-weight: 700;
	white-space: nowrap;
}

.am__question {
	margin: 0 0 clamp(32px, 4.5vw, 56px);
	font-size: clamp(2rem, 5.4vw, 4rem);
	font-weight: 700;
	line-height: 1.06;
	letter-spacing: -0.022em;
	text-wrap: balance;
}

.am__figure {
	color: var(--am-accent);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

/* --- Controls --------------------------------------------------------- */

.am__controls {
	display: flex;
	justify-content: center;
	gap: clamp(12px, 2vw, 20px);
	margin-bottom: 20px;
}

.am__btn {
	position: relative;
	min-width: clamp(140px, 20vw, 190px);
	padding: 18px 40px;
	border-radius: 999px;
	border: 1px solid transparent;
	font-family: inherit;
	font-size: clamp(1rem, 1.6vw, 1.15rem);
	font-weight: 500;
	letter-spacing: 0.01em;
	cursor: pointer;
	transition:
		transform 0.18s var(--am-ease),
		background-color 0.28s var(--am-ease),
		color 0.28s var(--am-ease),
		border-color 0.28s var(--am-ease),
		opacity 0.28s var(--am-ease);
}

.am__btn--yes {
	background: var(--am-accent);
	color: var(--am-bg);
}

.am__btn--no {
	background: transparent;
	border-color: var(--am-counter);
	color: var(--am-ink);
}

.am__btn:hover:not([disabled]) {
	transform: translateY(-2px);
}

.am__btn--no:hover:not([disabled]) {
	background: var(--am-counter);
}

.am__btn--yes:hover:not([disabled]) {
	background: #F7B75E;
}

.am__btn:active:not([disabled]) {
	transform: translateY(1px);
}

.am__btn:focus-visible {
	outline: 2px solid var(--am-accent);
	outline-offset: 4px;
}

.am[data-voted] .am__btn {
	cursor: default;
	opacity: 0.45;
}

.am[data-voted] .am__btn[data-am-chosen] {
	opacity: 1;
	box-shadow: 0 0 0 1px rgba(238, 241, 247, 0.25), 0 0 0 6px rgba(242, 163, 60, 0.12);
}

.am__status {
	min-height: 1.4em;
	margin: 0 0 clamp(36px, 5vw, 56px);
	color: var(--am-muted);
	font-size: 0.9rem;
	opacity: 0;
	transition: opacity 0.4s var(--am-ease);
}

.am__status[data-visible] {
	opacity: 1;
}

/* --- Meter ------------------------------------------------------------ */

.am__meter {
	text-align: left;
}

.am__legend {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: clamp(20px, 5vw, 64px);
	margin-bottom: 18px;
}

.am__side {
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-width: 34ch;
}

.am__side--yes {
	text-align: right;
	align-items: flex-end;
}

.am__count {
	font-size: clamp(1.6rem, 3.4vw, 2.5rem);
	font-weight: 700;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	transition: color 0.4s var(--am-ease);
}

.am__side--no .am__count {
	color: var(--am-counter);
}

.am__side--yes .am__count {
	color: var(--am-accent);
}

.am__side-label {
	color: var(--am-muted);
	font-size: 0.83rem;
	line-height: 1.5;
}

.am__track {
	position: relative;
	height: 16px;
	border-radius: 999px;
	background: var(--am-counter);
	overflow: hidden;
}

.am__fill {
	position: absolute;
	inset: 0 0 0 auto;
	width: 50%;
	border-radius: 999px;
	background: linear-gradient(90deg, #E08E23, var(--am-accent));
	transition: width 0.9s var(--am-ease);
}

/* Travelling sheen so the bar reads as live, not painted. */
.am__fill::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
	transform: translateX(-100%);
	animation: am-sheen 3.6s var(--am-ease) infinite;
}

@keyframes am-sheen {
	0%, 55% { transform: translateX(-100%); }
	100%    { transform: translateX(100%); }
}

.am__meter--bump .am__track {
	animation: am-bump 0.5s var(--am-ease);
}

@keyframes am-bump {
	50% { transform: scaleY(1.35); }
}

/* --- Footer ----------------------------------------------------------- */

.am__outro {
	padding-top: 22px;
	border-top: 1px solid rgba(138, 151, 174, 0.12);
}

.am__foot {
	margin: 0 auto;
	color: var(--am-accent);
	font-size: clamp(1.05rem, 1.9vw, 1.45rem);
	font-weight: 500;
	line-height: 1.35;
	letter-spacing: 0.01em;
	text-align: center;
	text-wrap: balance;
	max-width: 30ch;
	animation: am-breathe 3.2s ease-in-out infinite;
}

/* Slow pulse so the line reads as a promise, not a warning. */
@keyframes am-breathe {
	0%, 100% { opacity: 0.55; transform: translateY(0); }
	50%      { opacity: 1; transform: translateY(-2px); }
}

.am__sale {
	margin: 10px 0 0;
	color: var(--am-counter);
	font-size: 0.78rem;
	letter-spacing: 0.06em;
	text-align: center;
	text-transform: uppercase;
}

.am__contact {
	margin: 6px 0 0;
	font-size: 0.82rem;
	text-align: center;
}

.am__contact a {
	color: var(--am-muted);
	text-decoration: none;
	border-bottom: 1px solid rgba(138, 151, 174, 0.3);
	transition: color 0.28s var(--am-ease), border-color 0.28s var(--am-ease);
}

.am__contact a:hover,
.am__contact a:focus-visible {
	color: var(--am-accent);
	border-bottom-color: var(--am-accent);
}

/* --- Responsive ------------------------------------------------------- */

@media (max-width: 640px) {
	.am__sale {
		margin-top: 8px;
		font-size: 0.72rem;
	}

	.am__contact {
		margin-top: 5px;
		font-size: 0.78rem;
	}

	.am__controls {
		flex-direction: column;
	}

	.am__btn {
		width: 100%;
	}

	/* Yes leads on mobile so the buttons match the legend order below. */
	.am__btn--yes {
		order: -1;
	}

	.am__legend {
		flex-direction: column;
		gap: 12px;
		margin-bottom: 14px;
	}

	.am__side,
	.am__side--yes {
		max-width: none;
		text-align: left;
		align-items: flex-start;
	}

	.am__side--yes {
		order: -1;
	}
}

/* --- Short viewports --------------------------------------------------- */

/*
 * The type and spacing clamps scale on vw, so a wide-but-short window (a
 * 720p laptop, a browser with tall chrome) gets desktop-sized spacing with
 * no vertical room for it. Tighten on height, independently of width.
 */
@media (max-height: 950px) and (min-width: 641px) {
	.am {
		padding-top: clamp(24px, 4vh, 48px);
		padding-bottom: clamp(24px, 4vh, 48px);
	}

	.am__stage > .am__welcome {
		margin-block-end: clamp(16px, 2.4vh, 30px);
		font-size: clamp(1.4rem, 3vw, 2.35rem);
	}

	.am__stage > .am__question {
		margin-block-end: clamp(24px, 3.4vh, 44px);
		font-size: clamp(1.9rem, 4.6vw, 3.5rem);
	}

	.am__btn {
		padding: 14px 34px;
	}

	.am__status {
		margin-bottom: clamp(18px, 2.5vh, 32px);
	}

	.am__count {
		font-size: clamp(1.4rem, 2.6vw, 2rem);
	}

	.am__stage > .am__outro {
		margin-block-start: clamp(20px, 3vh, 36px);
	}

	.am__outro {
		padding-top: 16px;
	}

	.am__foot {
		font-size: clamp(1rem, 1.6vw, 1.25rem);
	}
}

/* Small phones: same squeeze, tuned for the stacked layout. */
@media (max-height: 720px) and (max-width: 640px) {
	.am {
		padding-top: 16px;
		padding-bottom: 16px;
	}

	.am__stage > .am__welcome {
		margin-block-end: 12px;
		font-size: 1.15rem;
	}

	.am__stage > .am__question {
		margin-block-end: 18px;
		font-size: 1.35rem;
	}

	.am__btn {
		padding: 13px 28px;
	}

	.am__controls {
		gap: 10px;
	}

	.am__status {
		margin-bottom: 20px;
	}

	.am__legend {
		gap: 12px;
		margin-bottom: 14px;
	}

	.am__count {
		font-size: 1.4rem;
	}

	.am__side-label {
		font-size: 0.78rem;
	}

	.am__stage > .am__outro {
		margin-block-start: 22px;
	}

	.am__outro {
		padding-top: 14px;
	}

	.am__foot {
		font-size: 1rem;
	}
}

/* --- Reduced motion --------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.am__blob,
	.am__fill::after,
	.am__foot,
	.am__meter--bump .am__track {
		animation: none !important;
	}

	.am__foot {
		opacity: 1;
	}

	.am__fill {
		transition: none;
	}

	.am__btn {
		transition: background-color 0.2s linear, color 0.2s linear;
	}

	.am__btn:hover:not([disabled]),
	.am__btn:active:not([disabled]) {
		transform: none;
	}
}
