/* The Fun in Balloon Land soundboard. A sky full of parade balloons: each
   quote is a balloon on a string, tethered in loose rows. No inline styles
   anywhere: the site's Content-Security-Policy allows only this file, so
   balloon colours are classes (hue-*) and sounds.js sets only --dur, through
   the style object. */

:root {
	color-scheme: light dark;
	--sky: #e3eef8;
	--sky-deep: #cfe0f0;
	--ink: #1b2340;
	--muted: #55607f;
	--string: #9fb2c8;
	--panel: #f7fbfe;
	--edge: #c4d4e4;
	--focus: #1b2340;
	--link: #1c5cab;

	--b-red: #e5483d;    --on-red: #ffffff;
	--b-orange: #f28a2e; --on-orange: #1b2340;
	--b-yellow: #f4c63f; --on-yellow: #1b2340;
	--b-green: #3fa865;  --on-green: #10241a;
	--b-blue: #3a7bd5;   --on-blue: #ffffff;
	--b-purple: #8a5bc8; --on-purple: #ffffff;
	--b-pink: #ec6ea0;   --on-pink: #2a1020;
	--b-teal: #23a39d;   --on-teal: #08201f;

	/* No web fonts under the CSP: a rounded face where the system has one. */
	--display: ui-rounded, "Arial Rounded MT Bold", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--sky: #0e1630;
		--sky-deep: #131d3d;
		--ink: #edf1fa;
		--muted: #9aa6c4;
		--string: #46537a;
		--panel: #16203f;
		--edge: #2b3760;
		--focus: #f4c63f;
		--link: #86b6ef;
	}
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
	margin: 0;
	background: linear-gradient(180deg, var(--sky-deep), var(--sky) 360px) var(--sky);
	color: var(--ink);
	font: 15px/1.5 var(--body);
}
a { color: var(--link); }

.page {
	max-width: 1180px;
	margin: 0 auto;
	padding-block: 22px 40px;
	padding-left: max(16px, env(safe-area-inset-left, 0px));
	padding-right: max(16px, env(safe-area-inset-right, 0px));
	display: grid;
	gap: 22px;
}

/* Header */
.masthead { display: grid; gap: 6px; }
.crumbs { margin: 0 0 4px; font-size: 0.875rem; }
.eyebrow {
	margin: 0;
	font: 600 12px/1.2 var(--body);
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--muted);
}
h1 {
	margin: 0;
	font: 900 clamp(34px, 6vw, 60px)/0.98 var(--display);
	letter-spacing: -0.01em;
	text-wrap: balance;
}
h1 .pop { color: var(--b-red); }
.lede { margin: 4px 0 0; max-width: 62ch; color: var(--muted); }

/* Controls */
.controls {
	position: sticky;
	top: env(safe-area-inset-top, 0px);
	z-index: 5;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
	padding: 10px 12px;
	background: var(--panel);
	border: 1px solid var(--edge);
	border-radius: 14px;
	box-shadow: 0 6px 18px -12px rgba(20, 30, 60, .45);
}
.search { flex: 1 1 220px; min-width: 0; position: relative; }
.search input {
	width: 100%;
	font: 500 15px/1 var(--body);
	color: var(--ink);
	background: var(--sky);
	border: 1px solid var(--edge);
	border-radius: 10px;
	padding: 10px 70px 10px 12px;
}
.search .count {
	position: absolute;
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
	font-size: 12px;
	color: var(--muted);
	font-variant-numeric: tabular-nums;
	pointer-events: none;
}
.seg { display: inline-flex; border: 1px solid var(--edge); border-radius: 10px; overflow: hidden; }
.seg button {
	font: 600 13px/1 var(--body);
	color: var(--muted);
	background: transparent;
	border: 0;
	padding: 10px 12px;
	cursor: pointer;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.vol { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.vol input { width: 110px; accent-color: var(--b-red); }
.stop {
	font: 700 13px/1 var(--body);
	color: var(--ink);
	background: transparent;
	border: 1.5px solid var(--ink);
	border-radius: 999px;
	padding: 9px 14px;
	cursor: pointer;
}
.stop:disabled { opacity: .4; cursor: default; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* The balloon field */
.field {
	list-style: none;
	margin: 0;
	padding: 6px 0 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
	gap: 22px 14px;
}
.item {
	display: grid;
	justify-items: center;
	align-content: start;
	min-width: 0;
}

/* Eight colours, handed out by position in sounds.js */
.hue-red    { --hue: var(--b-red);    --on: var(--on-red); }
.hue-orange { --hue: var(--b-orange); --on: var(--on-orange); }
.hue-yellow { --hue: var(--b-yellow); --on: var(--on-yellow); }
.hue-green  { --hue: var(--b-green);  --on: var(--on-green); }
.hue-blue   { --hue: var(--b-blue);   --on: var(--on-blue); }
.hue-purple { --hue: var(--b-purple); --on: var(--on-purple); }
.hue-pink   { --hue: var(--b-pink);   --on: var(--on-pink); }
.hue-teal   { --hue: var(--b-teal);   --on: var(--on-teal); }

.balloon {
	position: relative;
	width: min(100%, 150px);
	aspect-ratio: 5 / 6;
	border: 0;
	padding: 16px 12px 20px;
	border-radius: 50% 50% 47% 47% / 56% 56% 44% 44%;
	background:
		radial-gradient(circle at 31% 26%, rgba(255, 255, 255, .62), rgba(255, 255, 255, 0) 24%),
		radial-gradient(circle at 70% 80%, rgba(0, 0, 0, .16), rgba(0, 0, 0, 0) 55%),
		var(--hue);
	color: var(--on);
	cursor: pointer;
	display: grid;
	place-items: center;
	overflow: hidden;
	transform-origin: 50% 100%;
	transition: transform .18s ease;
	-webkit-tap-highlight-color: transparent;
}
.balloon:hover { transform: translateY(-3px) rotate(-1.5deg); }
.balloon:active { transform: scale(.97); }
.balloon .label {
	position: relative;
	z-index: 1;
	font: 900 18px/1.02 var(--display);
	max-width: 100%;
	text-align: center;
	text-wrap: balance;
	overflow-wrap: anywhere; /* a word too wide for the balloon wraps rather than spills */
	hyphens: none;
}
.balloon.long .label { font-size: 15.5px; }
.balloon.xlong .label { font-size: 13.5px; line-height: 1.05; }
.balloon .key {
	position: absolute;
	top: 16%;
	left: 15%;
	z-index: 1;
	font: 700 11px/1 var(--body);
	padding: 3px 5px;
	border-radius: 5px;
	background: rgba(255, 255, 255, .28);
	color: inherit;
	text-transform: uppercase;
}
@media (hover: none) { .balloon .key { display: none; } }
/* Lines from Mike, Kevin and Bill rather than the film */
.balloon .riff {
	position: absolute;
	top: 16%;
	right: 14%;
	z-index: 1;
	font: 800 10px/1 var(--body);
	letter-spacing: .08em;
	text-transform: uppercase;
	padding: 3px 5px;
	border-radius: 5px;
	background: rgba(0, 0, 0, .22);
	color: inherit;
}
/* Helium rising: fills the balloon from the knot up while the clip plays. */
.balloon .helium {
	position: absolute;
	inset: 0;
	background: rgba(255, 255, 255, .30);
	transform: scaleY(0);
	transform-origin: 50% 100%;
}
.balloon.playing .helium { transform: scaleY(1); transition: transform var(--dur, 1s) linear; }
.balloon.playing { animation: bob .9s ease-in-out infinite alternate; }
@keyframes bob {
	from { transform: translateY(0) rotate(-2deg) scale(1.04); }
	to { transform: translateY(-5px) rotate(2deg) scale(1.04); }
}
.balloon.failed { filter: grayscale(1); opacity: .6; }
.knot {
	width: 14px;
	height: 9px;
	margin-top: -3px;
	background: var(--hue);
	clip-path: polygon(50% 0, 100% 100%, 0 100%);
}
.string { width: 12px; height: 26px; display: block; }
.string path { fill: none; stroke: var(--string); stroke-width: 1.4; }
.tag {
	margin: 2px 0 0;
	max-width: 170px;
	text-align: center;
	font-size: 12.5px;
	line-height: 1.35;
	color: var(--muted);
}
.tag .said { display: block; color: var(--ink); font-weight: 500; }
.tag .meta { display: block; font-variant-numeric: tabular-nums; }

.empty { color: var(--muted); padding: 30px 0; text-align: center; grid-column: 1 / -1; }

.foot {
	border-top: 1px solid var(--edge);
	padding-top: 16px;
	font-size: 13px;
	color: var(--muted);
	display: grid;
	gap: 6px;
	max-width: 78ch;
}
.foot p { margin: 0; }

@media (max-width: 520px) {
	/* phones: the bar scrolls away with the page, and the phone's own buttons set the volume */
	.controls { position: static; }
	.vol { display: none; }
	.field { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; }
	.balloon .label { font-size: 17px; }
	.balloon.long .label { font-size: 15px; }
	.balloon.xlong .label { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
	.balloon, .balloon:hover { transition: none; transform: none; }
	.balloon.playing { animation: none; outline: 3px solid var(--ink); outline-offset: 3px; }
	.balloon.playing .helium { transition: none; transform: scaleY(1); }
}
