/* The RiffTrax stream playlist 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);
	--note-ink: #7a5300;
	--note-bg: #fdf3d8;
	--note-line: #ecd28b;
}

@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);
		--note-ink: #f0cf7a;
		--note-bg: #2e250e;
		--note-line: #5c4a17;
	}
}

/* Each section has a colour: its dot, its chip and its cards' edge.
   movies.js picks one from the section's name. */
.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; }

/* Cards and sections 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: 76rem;
	background: var(--page);
	color: var(--ink);
	font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

code, kbd { font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace; }
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 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, sort and section 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; }

.az {
	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;
	cursor: pointer;
}
.az:hover { border-color: var(--ink-2); color: var(--ink); }
.az[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--page); }
.az: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); }

.sec { margin-top: 1.9rem; }
.sec h2 {
	display: flex;
	gap: 0.55rem;
	align-items: center;
	margin: 0 0 0.75rem;
	font-size: 1.25rem;
	line-height: 1.2;
}
.sec h2::before {
	content: "";
	flex: none;
	width: 0.75rem;
	height: 0.75rem;
	border-radius: 50%;
	background: var(--accent);
}
.sec h2 .n { color: var(--muted); font-size: 0.9375rem; font-weight: 400; font-variant-numeric: tabular-nums; }

.items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr));
	gap: 0.5rem;
	margin: 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 section's colour 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.6rem;
	align-items: flex-start;
	min-width: 0;
	padding: 0.6rem 0.65rem 0.65rem 0.95rem;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.copy:hover { background: var(--wash); }
.copy:active { background: var(--wash); }
.copy:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 10px 0 0 10px; }
.item.nolink .copy:focus-visible { border-radius: 10px; }

.text { display: flex; flex: 1; flex-direction: column; gap: 0.1rem; min-width: 0; }
.kicker {
	color: var(--accent);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	line-height: 1.4;
	text-transform: uppercase;
}
.name { font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.yr { margin-left: 0.1rem; color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.aka { color: var(--ink-2); font-size: 0.8125rem; line-height: 1.35; overflow-wrap: anywhere; }
.note {
	align-self: flex-start;
	margin-top: 0.25rem;
	padding: 0 0.5em;
	border: 1px solid var(--note-line);
	border-radius: 999px;
	background: var(--note-bg);
	color: var(--note-ink);
	font-size: 0.75rem;
	line-height: 1.5;
}

.copy > .ico { flex: none; margin-top: 0.1rem; color: var(--muted); opacity: 0.6; transition: opacity 0.15s, color 0.15s; }
/* With a mouse, the copy icon shows on the card 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; }
/* The last title copied keeps a tick. */
.item.last .i-copy { display: none; }
.item.last .i-done { display: block; color: var(--accent); opacity: 1; }
.enter { display: none; flex: none; }

/* While searching with a keyboard, the card 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 .ico.i-copy, .searching .item.first .ico.i-done { display: none; }
}

.out {
	display: grid;
	flex: none;
	place-items: center;
	width: 2.6rem;
	border-left: 1px solid var(--line);
	color: var(--muted);
}
.out .ico { width: 1rem; height: 1rem; }
.out:hover { background: var(--wash); color: var(--accent); }
.out:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 0 10px 10px 0; }

.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 code { font-size: 0.8125rem; line-height: 1.4; opacity: 0.85; overflow-wrap: anywhere; user-select: all; }

@media (max-width: 40rem) {
	h1 { font-size: 1.65rem; }
	.lede { font-size: 1rem; }
	/* 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; }
	.az { padding: 0.65rem 0.85rem; }
}

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