/* The RiffTrax chat quotes page. No inline styles anywhere: the site's
   Content-Security-Policy allows only this file. */

:root {
	color-scheme: light dark;
	--page: #f9f9f7;
	--surface: #ffffff;
	--ink: #0b0b0b;
	--ink-2: #52514e;
	--muted: #6f6d68;
	--line: #e1e0d9;
	--line-2: #c3c2b7;
	--link: #1c5cab;
	--on-accent: #ffffff;
	--shadow: rgba(20, 20, 18, 0.16);
	--serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, Cambria, serif;
	--sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
	:root {
		--page: #0d0d0d;
		--surface: #171716;
		--ink: #f0efec;
		--ink-2: #c3c2b7;
		--muted: #9a9892;
		--line: #2c2c2a;
		--line-2: #45443f;
		--link: #86b6ef;
		--on-accent: #0d0d0d;
		--shadow: rgba(0, 0, 0, 0.6);
	}
}

/* Each person credited has a colour: their chip's dot and their quotes' edge.
   quotes.js picks it. The same colours as the playlist page. */
.h-blue   { --accent: #1c5cab; --wash: #eaf1fb; }
.h-orange { --accent: #b4451f; --wash: #fbeee8; }
.h-teal   { --accent: #0f766e; --wash: #e4f3f0; }
.h-purple { --accent: #6d4bc4; --wash: #f0ebfb; }
.h-red    { --accent: #b3261e; --wash: #fbeaea; }
.h-gray   { --accent: #6f6d68; --wash: #efeee9; }
.h-all    { --accent: #2a2a28; --wash: #efeee9; }

@media (prefers-color-scheme: dark) {
	.h-blue   { --accent: #86b6ef; --wash: #16243a; }
	.h-orange { --accent: #f0a07a; --wash: #34211a; }
	.h-teal   { --accent: #6fd3c2; --wash: #13302b; }
	.h-purple { --accent: #b9a3f0; --wash: #261f3f; }
	.h-red    { --accent: #f2a19b; --wash: #3a1e1c; }
	.h-gray   { --accent: #b1afa8; --wash: #252523; }
	.h-all    { --accent: #f0efec; --wash: #252523; }
}

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

/* Quotes set their own display; hidden has to win. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0 auto;
	padding: 1.25rem 1rem 5rem;
	max-width: 52rem;
	background: var(--page);
	color: var(--ink);
	font: 1rem/1.5 var(--sans);
}

a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

code, kbd { font-family: var(--mono); }
code { font-size: 0.9em; }

kbd {
	display: inline-block;
	padding: 0 0.4em;
	border: 1px solid var(--line-2);
	border-bottom-width: 2px;
	border-radius: 4px;
	background: var(--surface);
	color: var(--ink-2);
	font-size: 0.75rem;
	line-height: 1.45;
	vertical-align: 0.05em;
}

.vh {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* The copy fallback's text box, out of sight. */
.offscreen { position: fixed; top: 0; left: -9999px; opacity: 0; }

.ico {
	width: 1.1rem;
	height: 1.1rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
/* The quote-mark icon: two filled dots with tails. */
.i-quote circle { fill: currentColor; stroke: none; }
/* The same icon in the page's intro, where it names the button. */
.ico.inline { width: 1.05em; height: 1.05em; margin: 0 0.1em; color: var(--ink); vertical-align: -0.15em; }

/* The page's head. */
.top { max-width: 46rem; }
.crumbs { margin: 0; font-size: 0.875rem; }
h1 {
	margin: 0.25rem 0 0.45rem;
	font-size: 2.1rem;
	line-height: 1.1;
	letter-spacing: -0.015em;
}
.lede { margin: 0; color: var(--ink-2); font-size: 1.0625rem; text-wrap: pretty; }
.stats { margin: 0.6rem 0 0; color: var(--muted); font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.stats:empty { display: none; }
.keys { margin: 0.3rem 0 0; color: var(--muted); font-size: 0.8125rem; }

/* Search, order and chips, kept in view while the list scrolls. */
.bar {
	position: sticky;
	top: 0;
	z-index: 5;
	margin: 1rem -1rem 0;
	padding: 0.75rem 1rem 0.65rem;
	border-bottom: 1px solid var(--line);
	background: var(--page);
}

.row { display: flex; gap: 0.5rem; align-items: center; }

.find { position: relative; flex: 1; min-width: 0; }
.find .ico {
	position: absolute;
	top: 50%;
	left: 0.9rem;
	width: 1.15rem;
	height: 1.15rem;
	margin-top: -0.575rem;
	color: var(--muted);
	pointer-events: none;
}

#q {
	width: 100%;
	padding: 0.65rem 1rem 0.65rem 2.65rem;
	border: 1px solid var(--line-2);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
	font-size: 1.0625rem;
}
#q::placeholder { color: var(--muted); opacity: 1; }
#q:focus { border-color: var(--link); outline: 2px solid var(--link); outline-offset: 0; }
/* While searching, the count of matches sits at the right end of the box. */
.find.counting #q { padding-right: 5.6rem; }
.hits {
	position: absolute;
	top: 50%;
	right: 1rem;
	color: var(--muted);
	font-size: 0.8125rem;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	transform: translateY(-50%);
	pointer-events: none;
}

.sort {
	flex: none;
	padding: 0.65rem 1rem;
	border: 1px solid var(--line-2);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink-2);
	font: inherit;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.5;
	white-space: nowrap;
	cursor: pointer;
}
.sort:hover { border-color: var(--ink-2); color: var(--ink); }
.sort[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--page); }
.sort:focus-visible, .tab:focus-visible, .empty button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

.tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }

.tab {
	display: inline-flex;
	gap: 0.45rem;
	align-items: center;
	padding: 0.25rem 0.75rem 0.25rem 0.6rem;
	border: 1px solid var(--line-2);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
	font-size: 0.875rem;
	white-space: nowrap;
	cursor: pointer;
}
.tab::before {
	content: "";
	flex: none;
	width: 0.6rem;
	height: 0.6rem;
	border-radius: 50%;
	background: var(--accent);
}
.tab.h-all { padding-left: 0.75rem; }
.tab.h-all::before { display: none; }
.tab .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.tab:hover { border-color: var(--accent); background: var(--wash); }
.tab[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.tab[aria-pressed="true"]::before { background: currentColor; }
.tab[aria-pressed="true"] .n { color: inherit; opacity: 0.8; }
.tab.none:not([aria-pressed="true"]) { opacity: 0.5; }

/* The list. */
.status { margin: 2.5rem 0; color: var(--muted); }

.items {
	display: grid;
	gap: 0.5rem;
	margin: 1.25rem 0 0;
	padding: 0;
	list-style: none;
}

.item {
	position: relative;
	display: flex;
	min-width: 0;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--surface);
	transition: border-color 0.15s, box-shadow 0.15s;
}
/* The colour of whoever said it down the left edge, clipped by the corners. */
.item::before {
	content: "";
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 3px;
	background: var(--accent);
	opacity: 0.75;
	pointer-events: none;
}
.item:hover { border-color: var(--line-2); box-shadow: 0 6px 16px -10px var(--shadow); }

.copy {
	display: flex;
	flex: 1;
	gap: 0.75rem;
	align-items: flex-start;
	min-width: 0;
	padding: 0.7rem 0.75rem 0.8rem 1.05rem;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.copy:hover, .copy:active { background: var(--wash); }
.copy:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px 0 0 10px; }

.text { display: flex; flex: 1; flex-direction: column; gap: 0.2rem; min-width: 0; }
.cmd {
	color: var(--accent);
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.4;
}
.said {
	font-family: var(--serif);
	font-size: 1.125rem;
	line-height: 1.42;
	overflow-wrap: anywhere;
	text-wrap: pretty;
}
.by {
	color: var(--ink-2);
	font-size: 0.875rem;
	line-height: 1.4;
	overflow-wrap: anywhere;
}
.by::before { content: "— "; color: var(--muted); }

/* An emote code, which chat shows as a picture. */
.emote {
	display: inline-block;
	padding: 0 0.4em;
	border: 1px solid var(--line-2);
	border-radius: 5px;
	background: var(--page);
	color: var(--ink-2);
	font-family: var(--sans);
	font-size: 0.72em;
	font-style: normal;
	font-weight: 600;
	line-height: 1.5;
	vertical-align: 0.12em;
}

.copy > .ico { flex: none; margin-top: 0.05rem; color: var(--muted); opacity: 0.6; transition: opacity 0.15s, color 0.15s; }
/* With a mouse, the copy icon shows on the quote under it; a touch screen always shows it. */
@media (hover: hover) and (pointer: fine) {
	.copy > .ico { opacity: 0; }
}
.copy:hover > .ico, .copy:focus-visible > .ico { color: var(--accent); opacity: 1; }
.i-done { display: none; }
.enter { display: none; flex: none; }

/* The second button: the quote's words. */
.alt {
	display: grid;
	flex: none;
	place-items: center;
	width: 2.75rem;
	padding: 0;
	border: 0;
	border-left: 1px solid var(--line);
	background: none;
	color: var(--muted);
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.alt .ico { width: 1.3rem; height: 1.3rem; }
.alt:hover, .alt:active { background: var(--wash); color: var(--accent); }
.alt:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0 10px 10px 0; }

/* The last quote copied keeps a tick on the button used. */
.item.last-cmd .copy .i-copy { display: none; }
.item.last-cmd .copy .i-done { display: block; color: var(--accent); opacity: 1; }
.item.last-words .alt .i-quote { display: none; }
.item.last-words .alt .i-done { display: block; color: var(--accent); }

/* While searching with a keyboard, the quote Enter copies is marked. */
@media (hover: hover) and (pointer: fine) {
	.searching .item.first { border-color: var(--accent); }
	.searching .item.first .enter { display: inline-block; }
	.searching .item.first .copy > .ico { display: none; }
}

.item.flash { animation: flash 0.9s ease-out; }
@keyframes flash {
	from { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent); }
	to { box-shadow: 0 0 0 3px transparent; }
}

.empty { margin: 3rem 0; color: var(--ink-2); text-align: center; }
.empty p { margin: 0 0 0.75rem; }
.empty button {
	padding: 0.45rem 1.1rem;
	border: 1px solid var(--line-2);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink);
	font: inherit;
	cursor: pointer;
}
.empty button:hover { border-color: var(--ink-2); }

.foot {
	margin-top: 3rem;
	padding-top: 1rem;
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 0.875rem;
}
.foot p { margin: 0; }

/* What was just copied, at the foot of the window. */
.toast {
	position: fixed;
	bottom: max(1rem, env(safe-area-inset-bottom));
	left: 50%;
	z-index: 10;
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	width: max-content;
	max-width: min(40rem, calc(100% - 2rem));
	padding: 0.65rem 1rem 0.7rem;
	border-radius: 12px;
	background: var(--ink);
	color: var(--page);
	box-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.55);
	opacity: 0;
	visibility: hidden;
	transform: translate(-50%, 0.75rem);
	transition: opacity 0.18s, transform 0.18s, visibility 0s linear 0.18s;
	pointer-events: none;
}
.toast.show {
	opacity: 1;
	visibility: visible;
	transform: translate(-50%, 0);
	transition: opacity 0.18s, transform 0.18s;
}
.toast.bad { pointer-events: auto; }
.toast strong { font-size: 0.9375rem; }
.toast-body {
	font-family: var(--mono);
	font-size: 0.8125rem;
	line-height: 1.4;
	opacity: 0.85;
	overflow-wrap: anywhere;
	user-select: all;
}
/* A quote's words: three lines at most, unless they have to be copied by hand. */
.toast.words .toast-body {
	display: -webkit-box;
	overflow: hidden;
	font-family: var(--serif);
	font-size: 0.9375rem;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}
.toast.words.bad .toast-body { display: block; -webkit-line-clamp: none; }

@media (max-width: 40rem) {
	h1 { font-size: 1.65rem; }
	.lede { font-size: 1rem; }
	.said { font-size: 1.0625rem; }
	/* One row of chips that scrolls sideways, so the bar stays short. */
	.tabs {
		flex-wrap: nowrap;
		margin-right: -1rem;
		padding-right: 1rem;
		overflow-x: auto;
		scrollbar-width: none;
	}
	.tabs::-webkit-scrollbar { display: none; }
	.sort { padding: 0.65rem 0.85rem; }
	/* "Newest first" fits as "Newest"; the rest stays for screen readers. */
	.sort .wide {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}
}

@media (prefers-reduced-motion: reduce) {
	.item, .toast, .toast.show, .copy > .ico { transition: none; }
	.item.flash { animation: none; }
}
