/* Crazy Badger Studio: a hand dealt under the lamp.
   The page is the felt table at night with a lamp hanging over the middle.
   Felt is for showing the game; paper (a yellow legal pad, the kind every
   42 table keeps score on) is for reading. Dominoes are drawn the way the
   game lays them out: your hand stands on its long edge, played tiles lie
   face up pointing at you. */

@font-face {
	font-family: "Literata";
	src: url("/fonts/literata-latin.woff2") format("woff2");
	font-weight: 200 900;
	font-display: swap;
}

:root {
	--night: #0f3323;
	--felt: #17573a;
	--felt-lit: #2e8a5a;
	--ivory: #f3eee2;
	--chalk: #c6d5ca;
	--pip: #1c1b18;
	--brass: #d4a750;
	--oak: #7a4a25;
	--oak-dark: #4f2e15;
	--pad: #fbf3c4;
	--pad-binding: #7e2c27;
	--margin-red: #d77a6e;
	--pencil: #2f2d28;
	--ballpoint: #1f4e8c;

	--serif: "Literata", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
	--page: min(70rem, 100% - 2.5rem);
	--measure: 33em;
	/* Felt nap: fine noise laid over the color. */
	--nap: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.28'/%3E%3C/svg%3E");
}

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

html {
	-webkit-text-size-adjust: 100%;
	background: var(--night);
}

body {
	margin: 0;
	color: var(--ivory);
	font-family: var(--serif);
	font-size: 1.1875rem;
	line-height: 1.65;
	background:
		var(--nap),
		radial-gradient(ellipse 64rem 44rem at 50% 15rem, var(--felt-lit), var(--felt) 45%, var(--night) 100%) no-repeat,
		var(--night);
}

img {
	display: block;
	max-width: 100%;
	height: auto;
}

a {
	color: inherit;
	text-decoration-color: var(--brass);
	text-decoration-thickness: 0.09em;
	text-underline-offset: 0.2em;
}

a:hover {
	color: var(--brass);
}

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

h1,
h2,
h3 {
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.015em;
	margin: 0 0 0.4em;
	text-wrap: balance;
}

h1 {
	font-size: clamp(3rem, 1.9rem + 5vw, 5.75rem);
}

h2 {
	font-size: clamp(2rem, 1.5rem + 2vw, 2.875rem);
}

h3 {
	font-size: 1.375rem;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: 0;
}

p {
	margin: 0 0 1em;
	max-width: var(--measure);
}

.wrap {
	width: var(--page);
	margin-inline: auto;
}

.lead {
	font-size: clamp(1.25rem, 1.1rem + 0.6vw, 1.5rem);
	line-height: 1.5;
	color: var(--chalk);
}

.skip {
	position: absolute;
	left: 1rem;
	top: -4rem;
	background: var(--ivory);
	color: var(--pip);
	padding: 0.5rem 1rem;
	z-index: 1;
}

.skip:focus {
	top: 1rem;
}

/* Header */

.site-header .wrap {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding-block: 1.25rem;
}

.brand {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	text-decoration: none;
	font-weight: 700;
	font-size: 1.125rem;
}

.brand img {
	width: 0.95rem;
}

.site-nav {
	display: flex;
	gap: 1.5rem;
}

.site-nav a {
	text-decoration: none;
	font-weight: 600;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
	color: var(--ivory);
	text-decoration: underline;
	text-decoration-color: var(--brass);
	text-decoration-thickness: 3px;
}

/* The deal: the badger tile just played in the middle, your hand below. */

.deal {
	text-align: center;
	padding-block: clamp(2rem, 6vw, 4.5rem) clamp(3rem, 8vw, 6rem);
}

.deal p {
	max-width: 30em;
	margin-inline: auto;
}

.table {
	margin: clamp(2rem, 5vw, 3.5rem) auto 0;
}

.played {
	width: clamp(4.5rem, 9vw, 6.5rem);
	margin: 0 auto clamp(2.5rem, 6vw, 4rem);
	transform: rotate(-7deg);
	filter: drop-shadow(0.35rem 0.6rem 0.4rem rgba(0, 0, 0, 0.45));
}

.hand {
	display: flex;
	justify-content: center;
	gap: clamp(0.25rem, 1vw, 0.75rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.hand li {
	flex: 0 1 8.5rem;
	min-width: 0;
}

.hand img {
	width: 100%;
	filter: drop-shadow(0 0.5rem 0.4rem rgba(0, 0, 0, 0.4));
	transition: transform 140ms ease-out;
}

/* Like the game: a tile lifts when you point at it. */
.hand img:hover,
.hand img:active {
	transform: translateY(-14%);
}

/* Texas 42 on the home page, and the big screenshot on its own page. */

.feature-game {
	display: grid;
	grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
	align-items: center;
	gap: clamp(2rem, 5vw, 4rem);
	padding-block: clamp(2rem, 5vw, 4rem) clamp(4rem, 9vw, 7rem);
}

/* The wood rail around the table, as a frame. */
.rail {
	padding: clamp(0.4rem, 1vw, 0.7rem);
	border-radius: 12px;
	background: linear-gradient(160deg, var(--oak), var(--oak-dark));
	box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.5);
}

.rail img {
	border-radius: 5px;
}

.status {
	color: var(--brass);
	font-weight: 700;
}

.button {
	display: inline-block;
	padding: 0.65rem 1.4rem;
	border-radius: 10px;
	background: var(--ivory);
	color: var(--pip);
	font-weight: 700;
	text-decoration: none;
	box-shadow: 0 0.35rem 0 #b9b19f;
}

.button:hover {
	color: var(--pip);
	background: #fffaf0;
}

.button:active {
	transform: translateY(0.2rem);
	box-shadow: 0 0.15rem 0 #b9b19f;
}

/* Texas 42 page: where the 42 comes from. */

.count {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: flex-end;
	gap: clamp(0.75rem, 2.5vw, 1.75rem);
	margin: clamp(2rem, 5vw, 3rem) auto 1.5rem;
	padding: 0;
	list-style: none;
}

.count li {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.6rem;
	font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
	font-weight: 700;
}

.count img {
	width: clamp(2.6rem, 6vw, 4rem);
	filter: drop-shadow(0.2rem 0.4rem 0.3rem rgba(0, 0, 0, 0.4));
}

.count .sum {
	align-self: center;
	font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
	color: var(--chalk);
	font-weight: 400;
}

.count .total {
	align-self: center;
	font-size: clamp(3rem, 2rem + 4vw, 4.75rem);
	font-weight: 900;
	line-height: 1;
	color: var(--brass);
}

.count-note {
	margin-inline: auto;
	color: var(--chalk);
}

.shot {
	padding-bottom: clamp(3rem, 7vw, 5rem);
}

.section {
	padding-block: clamp(3rem, 7vw, 5rem);
}

.features {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 2.25rem 3.5rem;
	margin-top: 2rem;
}

.features p {
	margin: 0;
	color: var(--chalk);
}

/* Paper: the yellow legal pad, with its binding along the top and the red
   double line down the margin. */

.pad {
	position: relative;
	background:
		linear-gradient(to right,
			transparent calc(var(--margin) - 4px),
			var(--margin-red) calc(var(--margin) - 4px), var(--margin-red) calc(var(--margin) - 3px),
			transparent calc(var(--margin) - 3px), transparent var(--margin),
			var(--margin-red) var(--margin), var(--margin-red) calc(var(--margin) + 1px),
			transparent calc(var(--margin) + 1px)),
		var(--pad);
	color: var(--pencil);
	border-radius: 3px 3px 6px 6px;
	padding: 3.25rem clamp(1.1rem, 4vw, 3rem) 2.5rem calc(var(--margin) + clamp(0.9rem, 3vw, 2rem));
	box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.5);
	--margin: clamp(1.4rem, 6vw, 4.5rem);
}

.pad::before {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	height: 1.1rem;
	border-radius: 3px 3px 0 0;
	background: var(--pad-binding);
}

.pad a {
	color: var(--ballpoint);
	text-decoration-color: currentColor;
}

.pad a:hover {
	color: var(--pencil);
}

.pad :focus-visible {
	outline-color: var(--ballpoint);
}

.rules {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	gap: clamp(2rem, 6vw, 5rem);
	align-items: center;
}

.rules .pad {
	transform: rotate(-0.6deg);
}

.rules dl {
	margin: 1.5rem 0 0;
}

.rules dl div {
	padding: 0.5rem 0;
	border-bottom: 1px solid rgba(31, 78, 140, 0.22);
}

.rules dt {
	font-weight: 700;
}

.rules dd {
	margin: 0;
}

.phones {
	display: flex;
	gap: 1.25rem;
	justify-content: center;
}

.phones img {
	width: min(15rem, 46%);
	border: 6px solid var(--pip);
	border-radius: 20px;
	box-shadow: 0 1.25rem 2.5rem rgba(0, 0, 0, 0.5);
}

/* Privacy policy: the whole thing on the pad. */

.policy {
	max-width: 48rem;
	margin: clamp(1rem, 4vw, 3rem) auto clamp(3rem, 7vw, 5rem);
}

.policy h1 {
	font-size: clamp(2.25rem, 1.6rem + 3vw, 3.5rem);
}

.policy h2 {
	font-size: 1.5rem;
	margin-top: 1.8em;
}

.policy ul {
	max-width: var(--measure);
	padding-left: 1.25rem;
}

.policy li {
	margin-bottom: 0.45em;
}

.policy .lead {
	color: var(--pencil);
}

.effective {
	font-style: italic;
}

code {
	font-size: 0.9em;
	overflow-wrap: anywhere;
}

/* Footer: off the edge of the table. */

.site-footer {
	background: rgba(0, 0, 0, 0.35);
}

.site-footer .wrap {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 1.5rem 3rem;
	padding-block: 2.5rem;
}

.site-footer h2 {
	font-size: 1.5rem;
	margin-bottom: 0.3em;
}

.site-footer p {
	margin: 0;
}

.fine {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	align-items: flex-end;
	align-self: end;
	font-size: 1rem;
	color: var(--chalk);
}

/* Narrow screens */

@media (max-width: 52rem) {
	.feature-game,
	.rules,
	.features {
		grid-template-columns: minmax(0, 1fr);
	}

	.fine {
		align-items: flex-start;
	}
}

@media (max-width: 30rem) {
	.site-nav {
		gap: 1rem;
	}

	.brand span {
		display: none;
	}

	.brand img {
		width: 1.2rem;
	}
}

/* The deal, once, as the page opens: the hand lands tile by tile and then
   the badger tile is slapped down in the middle. */
@media (prefers-reduced-motion: no-preference) {
	.hand li {
		animation: land 260ms ease-out both;
	}

	.hand li:nth-child(2) { animation-delay: 60ms; }
	.hand li:nth-child(3) { animation-delay: 120ms; }
	.hand li:nth-child(4) { animation-delay: 180ms; }
	.hand li:nth-child(5) { animation-delay: 240ms; }
	.hand li:nth-child(6) { animation-delay: 300ms; }
	.hand li:nth-child(7) { animation-delay: 360ms; }

	.played {
		animation: slap 420ms 520ms cubic-bezier(0.3, 1.4, 0.5, 1) both;
	}

	@keyframes land {
		from {
			transform: translateY(-1.25rem);
			opacity: 0;
		}
	}

	@keyframes slap {
		from {
			transform: translateY(-2rem) rotate(-22deg) scale(1.15);
			opacity: 0;
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	.hand img {
		transition: none;
	}
}
