/* Project film or photo (Nov 30) — inc/project-film.php. Loaded on project pages that have one.
   A full-width 16:9 box (made for 1080p and 720p films) that plays a silent loop while on screen, with
   "Watch the film" bottom right to play the whole film with sound in a dialog (main.js, [data-film-open]).
   The poster photo is always underneath; visitors who turn motion off only see the poster. */

.project-film { background: var(--deep); }
.project-film__frame { position: relative; margin: 0; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100vh - var(--header-h, 72px)); max-height: calc(100svh - var(--header-h, 72px)); overflow: hidden; background: var(--deep); }
.project-film__frame > img, .project-film__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: var(--focus, 50% 50%); }
/* Photo only (no film): a caption in the bottom-right corner, where the play button would be. */
.project-film__caption { position: absolute; z-index: 2; right: max(16px, env(safe-area-inset-right, 0px)); bottom: 16px; max-width: min(60%, 420px); padding: 8px 12px; background: rgba(22, 23, 24, .72); color: var(--white); font: 500 13px/1.35 var(--font-sans); letter-spacing: .02em; }
@media (min-width: 961px) { .project-film__caption { right: 28px; bottom: 28px; font-size: 14px; } }
.project-film .video-layer { position: absolute; inset: 0; }
.project-film .video-layer video { width: 100%; height: 100%; object-fit: cover; }
/* The pause switch the moving loop needs sits bottom left, away from the play button. */
.project-film .video-toggle { position: absolute; z-index: 3; left: max(16px, env(safe-area-inset-left, 0px)); right: auto; bottom: 16px; top: auto; }

.project-film__play { appearance: none; position: absolute; z-index: 3; right: max(16px, env(safe-area-inset-right, 0px)); bottom: 16px; display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 18px 6px 6px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .95); color: var(--deep); font: 600 15px/1 var(--font-sans); letter-spacing: .01em; cursor: pointer; box-shadow: 0 2px 12px rgba(22, 23, 24, .3); transition: background var(--dur-hover, 150ms) ease, color var(--dur-hover, 150ms) ease, transform var(--dur-hover, 150ms) ease; }
.project-film__icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--rust); color: var(--white); transition: background var(--dur-hover, 150ms) ease; }
.project-film__icon svg { margin-left: 2px; }
.project-film__play:hover, .project-film__play:focus-visible { background: var(--deep); color: var(--white); }
.project-film__play:hover .project-film__icon, .project-film__play:focus-visible .project-film__icon { background: var(--white); color: var(--deep); }
.project-film__play:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }

@media (min-width: 961px) {
	.project-film__play { right: max(28px, env(safe-area-inset-right, 0px)); bottom: 28px; min-height: 56px; padding: 8px 22px 8px 8px; font-size: 16px; }
	.project-film__icon { width: 40px; height: 40px; }
	.project-film .video-toggle { left: 28px; bottom: 28px; }
}
@media (max-width: 560px) {
	.project-film__play { right: 12px; bottom: 12px; min-height: 44px; padding: 4px 14px 4px 4px; font-size: 14px; gap: 8px; }
	.project-film__icon { width: 34px; height: 34px; }
	.project-film .video-toggle { left: 12px; bottom: 12px; }
}

/* The whole film, with sound and controls. */
.project-film-modal { width: min(1440px, 94vw); max-width: none; max-height: none; padding: 0; border: 0; background: #000; overflow: visible; }
.project-film-modal::backdrop { background: rgba(20, 22, 23, .92); }
.project-film-modal video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; max-height: 86vh; background: #000; }
.project-film-modal__close { appearance: none; position: absolute; top: -52px; right: 0; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--deep); cursor: pointer; }
.project-film-modal__close .icon { width: 22px; height: 22px; }
.project-film-modal__close:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
@media (max-width: 760px) {
	.project-film-modal { width: 100vw; }
	.project-film-modal__close { top: -56px; right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
	.project-film__play, .project-film__icon { transition: none; }
}
