/* Cose Theme - FILMS page: a grid of 16:9 tiles that play a muted preview,
   and a fullscreen player. Spacing follows film page.png (three columns,
   ~8% gutters, titles indented under each tile) and FILMS.png (one column). */

.film-page {
	margin-top: -90px;
	padding: 5px 5px 80px;
}

.film-grid {
	display: flex;
	flex-direction: column;
	row-gap: 5vw;
}

/* One film = one row of three videos; title and subtitle sit under the centre one. */
.film-row {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	column-gap: 8vw;
	align-items: start;
}

.film-row__info {
	grid-column: 2;
	grid-row: 2;
	display: flex;
	flex-direction: column;
	padding: 6px 0 0 15%;
	text-transform: uppercase;
}

.film-row__title {
	font-weight: 500;
}

.film-row__artist {
	font-style: italic;
	text-transform: none;
}

.film-card {
	grid-row: 1;
}

.film-card__media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	overflow: hidden;
	padding: 0;
	border: none;
	background: #eee;
	cursor: pointer;
}

.film-card__poster,
.film-card__player,
.film-card__player iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Scoped: WooCommerce's `.woocommerce-page img { height: auto }` is not on
   this page, but the same pattern has bitten before. */
.film-card__media .film-card__poster {
	object-fit: cover;
}

/* The preview fades in over the poster once it's really playing. */
.film-card__player {
	opacity: 0;
	transition: opacity 0.5s ease;
	pointer-events: none;
}

.film-card.is-previewing .film-card__player {
	opacity: 1;
}

@media (max-width: 900px) {
	.film-page {
		margin-top: 0;
		padding-top: 0;
		padding-bottom: 150px;
	}

	/* 30px from one film's title to the next film's video. */
	.film-grid {
		row-gap: 30px;
	}

	.film-row {
		grid-template-columns: 1fr;
		row-gap: 0;
	}

	.film-card {
		grid-row: auto;
	}

	.film-card--empty {
		display: none;
	}

	.film-row__info {
		grid-column: 1;
		grid-row: auto;
		/* 10px under the video above. */
		margin-top: 10px;
		padding: 0 0 0 15%;
	}
}

/* --- Fullscreen player --- */

body.film-modal-open {
	overflow: hidden;
}

.film-modal {
	position: fixed;
	inset: 0;
	z-index: 10000;
	background: #000;
	color: #fff;
	opacity: 0;
	transition: opacity 0.35s ease;
}

.film-modal[hidden] {
	display: none;
}

.film-modal.is-open {
	opacity: 1;
}

.film-modal button {
	background: none;
	border: none;
	padding: 0;
	color: #fff;
	text-transform: uppercase;
	cursor: pointer;
}

.film-modal__stage {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* Contained: as large as fits the window without cropping. */
.film-modal__frame {
	display: block;
	position: relative;
	width: min(100vw, calc(100vh * var(--film-ratio, 1.7778)));
	aspect-ratio: var(--film-ratio, 1.7778);
}

.film-modal__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* A transparent layer over the iframe: the click toggles play/pause, and the
   embedded player's own hover UI (and any branding in it) is never reachable. */
.film-modal__hit {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	cursor: pointer;
}

.film-modal .film-modal__close {
	position: absolute;
	top: 20px;
	right: 40px;
}

.film-modal__bar {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	gap: 30px;
	padding: 0 40px 24px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
	padding-top: 40px;
}

.film-modal__caption {
	flex: 0 0 20%;
	text-transform: uppercase;
}

.film-modal__title {
	font-weight: 500;
}

.film-modal__artist {
	font-style: italic;
	text-transform: none;
}

.film-modal .film-modal__toggle,
.film-modal .film-modal__sound {
	min-width: 6em;
	text-align: left;
}

.film-modal__progress {
	position: relative;
	flex: 1;
	height: 15px;
	cursor: pointer;
}

.film-modal__progress::before {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 7px;
	height: 1px;
	background: rgba(255, 255, 255, 0.4);
}

.film-modal__progress-fill {
	position: absolute;
	left: 0;
	top: 7px;
	height: 1px;
	width: 0;
	background: #fff;
}

.film-modal__time {
	min-width: 8em;
	text-align: right;
}

@media (max-width: 900px) {
	.film-modal .film-modal__close {
		right: 16px;
	}

	.film-modal__bar {
		flex-wrap: wrap;
		gap: 12px 20px;
		padding: 40px 16px 20px;
	}

	.film-modal__caption {
		flex: 0 0 100%;
	}

	.film-modal__progress {
		flex: 0 0 100%;
		order: 5;
	}

	.film-modal__time {
		margin-left: auto;
		min-width: 0;
	}
}

/* Keeps CLOSE readable over a bright frame. */
.film-modal::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 90px;
	background: linear-gradient(rgba(0, 0, 0, 0.4), transparent);
	pointer-events: none;
	z-index: 1;
}

.film-modal .film-modal__close {
	z-index: 2;
}

/* Mobile (Mobile/FILMS.png): one video per film - the centre one - with the
   film's title and subtitle right under it. The side videos are only for
   wide screens. */
@media (max-width: 900px) {
	.film-card:nth-child(1),
	.film-card:nth-child(3) {
		display: none;
	}

	.film-card:nth-child(2) {
		order: 1;
	}

	.film-row__info {
		order: 2;
	}
}

/* --- The consent prompt that replaces a blocked video ---
   The cookie widget swaps Vimeo's iframe for its own "this content is
   blocked, accept?" panel until the visitor accepts the "content"
   category. In the grid the poster is enough, so the panel is hidden
   there; in the fullscreen player it is set in the site's own style. */
.film-card .hu-iframe-overlay {
	display: none !important;
}

.film-modal .hu-iframe-overlay {
	position: absolute !important;
	inset: 0 !important;
	top: 0 !important;
	left: 0 !important;
	width: 100% !important;
	height: 100% !important;
	z-index: 1;
	display: flex !important;
	align-items: center;
	justify-content: center;
	background: #000 !important;
	color: #fff !important;
}

.film-modal .hu-iframe-overlay,
.film-modal .hu-iframe-overlay * {
	font-family: 'HAL Timezone', sans-serif !important;
	font-size: 1rem !important;
	line-height: 1.5 !important;
	letter-spacing: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	text-shadow: none !important;
	color: #fff !important;
	font-weight: 400;
}

.film-modal .hu-iframe-content {
	width: min(420px, calc(100% - 40px));
	margin: 0 auto;
	text-align: left;
	background: none !important;
}

.film-modal .hu-iframe-content p {
	margin: 0 0 10px !important;
}

.film-modal .hu-iframe-heading,
.film-modal .hu-iframe-heading strong {
	text-transform: uppercase;
	font-weight: 500 !important;
}

.film-modal .hu-iframe-unblock {
	font-weight: 400 !important;
	display: block;
	width: 100%;
	margin: 18px 0 14px !important;
	padding: 14px 16px !important;
	background: transparent !important;
	border: 1px solid #fff !important;
	text-transform: uppercase;
	cursor: pointer;
}

.film-modal .hu-iframe-unblock:hover {
	background: #fff !important;
	color: #000 !important;
	font-weight: 500 !important;
}

.film-modal .hu-iframe-policy {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.film-modal .hu-iframe-withdraw {
	opacity: 0.7;
}

/* The player's own layers keep clear of the prompt. */
.film-modal__bar,
.film-modal .film-modal__close {
	z-index: 2;
}

/* Videos that are not Vimeo iframes (Cloudflare Stream, plain files) are
   <video> elements: the tile's one fills it and is cropped like the poster;
   in the fullscreen player it is shown whole, on black. */
.film-card__player video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.film-modal__frame video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: #000;
}
