/* Viewport — media module: lists of videos, loops and renders, and the single page. See DESIGN.md, "Modules". */

/* Controls that only work with media.js are printed with [hidden]; classes that set display must not undo it. */
[data-vp-media] [hidden],
.vp-dialog [hidden] {
	display: none;
}
/* Set in <head> for visitors with hidden tags, cleared by media.js once their cards are filtered. */
.vp-hiding [data-tags] {
	visibility: hidden;
}

/* ---- shared control: menu buttons, player options, item actions -------------------------------- */
.vp-menu summary,
.vp-menu__btn,
.vp-find button,
.vp-opt,
.vp-act {
	display: inline-flex;
	align-items: center;
	gap: var(--s-2);
	min-height: 2.75rem;
	padding: 0 var(--s-3);
	background: var(--panel);
	border-radius: var(--radius);
	font-size: var(--t-sm);
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
}
.vp-menu summary:hover,
.vp-menu__btn:hover,
.vp-find button:hover,
.vp-opt:hover,
.vp-act:hover {
	background: var(--line);
}
.vp-find button[aria-pressed="true"],
.vp-opt[aria-pressed="true"],
.vp-act[aria-pressed="true"] {
	background: var(--ink);
	color: var(--floor);
}
/* Pressed is never colour alone: the icon fills in as well. */
[aria-pressed="true"] > .vp-ico {
	fill: currentColor;
}
.vp-ico {
	flex: none;
}

/* ---- save toggle on cards and tiles --------------------------------------------------------------- */
.vp-save {
	position: absolute;
	top: var(--s-1);
	right: var(--s-1);
	z-index: 1;
	display: grid;
	place-items: center;
	width: 2.25rem;
	height: 2.25rem;
	background: var(--floor);
	border-radius: var(--radius);
	transition: opacity 0.15s var(--ease);
}
.vp-save:hover,
.vp-save[aria-pressed="true"] {
	color: var(--axis);
}
@media (hover: hover) and (pointer: fine) {
	.vp-save {
		opacity: 0;
	}
	.vp-card:hover .vp-save,
	.vp-tile:hover .vp-save,
	.vp-save:focus-visible,
	.vp-save[aria-pressed="true"] {
		opacity: 1;
	}
}
.vp-tile__a {
	display: block;
	height: 100%;
}
.vp-tile__a:focus-visible {
	outline-offset: -2px;
}
.vp-tile:focus-within span {
	transform: none;
}

/* ---- toolbar: tag search and filter menus ----------------------------------------------------------- */
.vp-tools {
	display: grid;
	gap: var(--s-3);
	margin-block: var(--s-4);
}
.vp-find {
	position: relative;
	display: flex;
	gap: var(--s-2);
	min-width: 0;
}
.vp-find input {
	flex: 1;
	min-width: 0;
	height: 2.75rem;
	padding: 0 var(--s-3);
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}
.vp-find input::placeholder {
	color: var(--ink-2);
}
.vp-find input:focus {
	border-color: var(--brand);
}
.vp-find .vp-suggest {
	z-index: 20;
}
.vp-suggest a small {
	color: var(--ink-2);
	font-size: var(--t-xs);
}
.vp-menus {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	gap: var(--s-2);
}
.vp-menu summary {
	list-style: none;
}
.vp-menu summary::-webkit-details-marker {
	display: none;
}
.vp-menu summary::after {
	content: "";
	margin-top: var(--s-1);
	border: var(--s-1) solid transparent;
	border-top-color: currentColor;
}
.vp-menu[open] summary {
	background: var(--line);
}
/* On phones the list hangs from the left edge of the row, so it can never leave the screen. */
.vp-menu ul {
	position: absolute;
	z-index: 20;
	top: calc(100% + var(--s-1));
	left: 0;
	min-width: 12rem;
	max-width: 100%;
	padding: var(--s-1);
	background: var(--floor);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}
.vp-menu a {
	display: block;
	padding: var(--s-2) var(--s-3);
	border-left: 2px solid transparent;
	font-size: var(--t-sm);
}
.vp-menu a:hover {
	background: var(--panel);
}
.vp-menu a[aria-current] {
	border-left-color: var(--axis);
	font-weight: 700;
}
.vp-menu a:focus-visible {
	outline-offset: -2px;
}
@media (min-width: 600px) {
	.vp-menu {
		position: relative;
	}
	.vp-menu ul {
		max-width: none;
	}
}
@media (min-width: 768px) {
	.vp-tools {
		grid-template-columns: minmax(0, 24rem) minmax(0, 1fr);
		align-items: start;
	}
	.vp-menus {
		justify-content: flex-end;
	}
	.vp-menu ul {
		left: auto;
		right: 0;
	}
}
.vp-active {
	align-items: center;
	margin-bottom: var(--s-4);
}
.vp-chip__x {
	opacity: 0.7;
}
.vp-active__all {
	font-size: var(--t-sm);
}
.vp-trend {
	display: flex;
	align-items: center;
	gap: var(--s-2);
	min-width: 0;
	margin-bottom: var(--s-4);
	font-size: var(--t-sm);
}
.vp-trend ul {
	display: flex;
	gap: var(--s-2);
	min-width: 0;
	padding: var(--s-1);
	overflow-x: auto;
	scrollbar-width: none;
}
.vp-trend ul::-webkit-scrollbar {
	display: none;
}
.vp-trend li {
	flex: none;
}

/* ---- results ------------------------------------------------------------------------------------------ */
.vp-count {
	margin-block: var(--s-4) var(--s-3);
	font-size: var(--t-sm);
}
.vp-results__h {
	margin-top: var(--s-7);
	font-size: var(--t-xl);
	font-stretch: 125%;
	font-weight: 800;
	letter-spacing: -0.02em;
	line-height: 1.1;
}
.vp-note {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--s-2) var(--s-4);
	margin-bottom: var(--s-3);
	padding: var(--s-2) var(--s-3);
	background: var(--panel);
	border-left: 2px solid var(--axis);
	border-radius: var(--radius);
	font-size: var(--t-sm);
}
[data-vp-list][aria-busy="true"] {
	opacity: 0.6;
}
.vp-more {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--s-3);
	margin-top: var(--s-6);
}
.vp-more + .vp-pager {
	margin-top: var(--s-4);
}
.vp-empty .vp-chips {
	margin-top: var(--s-4);
}
.vp-saved .vp-empty {
	padding-block: var(--s-5);
	max-width: 52ch;
}
.vp-saved:focus {
	outline: none;
}

/* ---- hidden tags dialog --------------------------------------------------------------------------------- */
.vp-dialog {
	width: min(34rem, calc(100% - var(--s-6)));
	max-height: calc(100% - var(--s-7));
	padding: var(--s-5);
	background: var(--bg);
	color: var(--ink);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}
.vp-dialog::backdrop {
	background: var(--floor);
	opacity: 0.85;
}
.vp-dialog > * + * {
	margin-top: var(--s-3);
}
.vp-dialog__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--s-4);
}
.vp-dialog h2 {
	font-size: var(--t-xl);
	font-stretch: 125%;
	font-weight: 800;
}
.vp-dialog h3 {
	margin-top: var(--s-5);
	font-size: var(--t-sm);
	font-weight: 700;
}
.vp-dialog .vp-find {
	display: block;
}
.vp-dialog .vp-find input {
	width: 100%;
}
.vp-dialog .vp-suggest {
	position: static;
	margin-top: var(--s-1);
	max-height: 14rem;
}

/* ---- single page: player beside up next from 1024px, stacked below ---------------------------------------- */
.vp-watch--m {
	grid-template-columns: minmax(0, 1fr);
	gap: var(--s-5);
	padding-top: 0;
}
.vp-watch__stage {
	margin-inline: calc(var(--gutter) * -1);
	background: var(--floor);
	border-bottom: 2px solid var(--axis);
}
/* The box holds the media's own aspect ratio, so the page does not move when the file arrives. */
.vp-watch--m .vp-player {
	position: relative;
	display: block;
	width: 100%;
	max-width: none;
	max-height: 78vh;
	aspect-ratio: var(--r, 1.7778);
	background: var(--floor);
}
.vp-watch--m .vp-player video,
.vp-watch--m .vp-player img {
	width: 100%;
	height: 100%;
	max-height: none;
	aspect-ratio: auto;
	object-fit: contain;
	background: none;
}
.vp-watch--m .vp-player--img {
	max-height: 86vh;
}
/* Very tall renders and strips are read at full width; "Fit to screen" brings back the whole picture. */
.vp-watch--m .vp-player--tall {
	max-width: 44rem;
	max-height: none;
	margin-inline: auto;
}
.vp-watch--m .vp-player--tall.is-fit {
	max-width: none;
	max-height: 86vh;
}
.vp-end {
	position: absolute;
	inset: 0;
	display: grid;
	place-content: center;
	justify-items: center;
	gap: var(--s-2);
	padding: var(--s-3);
	overflow: auto;
	background: var(--floor);
	text-align: center;
}
.vp-end__t {
	max-width: 40ch;
	overflow: hidden;
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.vp-end__go {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--s-2);
}
.vp-end .vp-btn {
	min-height: 2.25rem;
	padding-inline: var(--s-3);
	font-size: var(--t-sm);
}
@media (min-width: 600px) {
	.vp-end {
		gap: var(--s-3);
	}
	.vp-end__t {
		font-size: var(--t-lg);
	}
	.vp-end .vp-btn {
		min-height: 2.75rem;
		padding-inline: var(--s-5);
		font-size: var(--t-md);
	}
}
.vp-playbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--s-2);
	padding: var(--s-2) var(--gutter);
}
.vp-playbar .vp-opt {
	min-height: 2.25rem;
	background: none;
	border: 1px solid var(--line);
}
.vp-playbar .vp-opt:hover {
	border-color: var(--ink-2);
}
.vp-playbar .vp-opt[aria-pressed="true"] {
	background: var(--ink);
	border-color: var(--ink);
}
.vp-opt--wide,
.vp-keys {
	display: none;
}
.vp-keys {
	margin-left: auto;
	font-size: var(--t-xs);
}
.vp-keys kbd {
	padding: 0 var(--s-1);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	font: inherit;
	font-weight: 600;
}
@media (min-width: 1024px) {
	.vp-watch--m {
		grid-template-columns: minmax(0, 1fr) 22rem;
		grid-template-areas: "stage side" "main side";
		grid-template-rows: auto 1fr;
		gap: var(--s-5) var(--s-6);
		align-items: start;
		padding-top: var(--s-5);
	}
	.vp-watch--m[data-theatre] {
		grid-template-areas: "stage stage" "main side";
	}
	.vp-watch--m[data-theatre] .vp-player {
		max-height: 88vh;
	}
	.vp-watch__stage {
		grid-area: stage;
		margin-inline: 0;
		border-radius: var(--radius);
		overflow: hidden;
	}
	.vp-watch--m .vp-watch__main {
		grid-area: main;
	}
	.vp-watch--m .vp-watch__side {
		grid-area: side;
	}
	.vp-playbar {
		padding-inline: var(--s-2);
	}
	.vp-opt--wide {
		display: inline-flex;
	}
}
@media (min-width: 1024px) and (hover: hover) {
	.vp-keys {
		display: block;
	}
}

/* ---- single page: actions, description, tags, up next --------------------------------------------------------- */
.vp-acts,
.vp-acts__g {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--s-2);
}
.vp-acts__say {
	flex-basis: 100%;
	font-size: var(--t-sm);
}
.vp-acts__say:empty {
	display: none;
}
.vp-desc {
	font-size: var(--t-sm);
}
.vp-desc.is-clamped {
	max-height: 4.5em;
	overflow: hidden;
}
.vp-desc__more,
.vp-tags .vp-link,
.vp-watch__report .vp-link {
	font-size: var(--t-sm);
	font-weight: 600;
}
.vp-watch--m .vp-desc__more {
	margin-top: var(--s-2);
}
.vp-tags {
	align-items: center;
}
.vp-tags.is-short [data-extra] {
	display: none;
}
.vp-watch__report {
	display: flex;
	flex-wrap: wrap;
	gap: var(--s-2) var(--s-5);
}
.vp-ups {
	display: grid;
	gap: var(--s-3);
}
.vp-up a {
	display: grid;
	grid-template-columns: clamp(7.5rem, 40%, 10rem) minmax(0, 1fr);
	gap: var(--s-3);
	align-items: start;
}
.vp-up__img {
	position: relative;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--panel);
	border-bottom: 2px solid var(--axis);
	border-radius: var(--radius);
}
.vp-up__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.vp-up__txt {
	min-width: 0;
}
.vp-up__t {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
	overflow: hidden;
	font-size: var(--t-sm);
	font-weight: 600;
	line-height: 1.35;
}
.vp-up a:hover .vp-up__t {
	text-decoration: underline;
	text-decoration-color: var(--axis);
	text-underline-offset: 0.2em;
}
@media (min-width: 600px) and (max-width: 1023px) {
	.vp-ups {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: var(--s-4);
	}
}
