/*
 * Film templates — archive (/film/) and single (/film/{slug}/).
 * Loaded only on those views (see inc/enqueue.php). Depends on the shared
 * cascade: tokens -> base -> layout -> components. Uses existing tokens only.
 * Introduced in Phase 3B-1. Mobile-first.
 *
 * Shared primitives used here — .schusei-section-label, .schusei-pagination,
 * .schusei-empty, .schusei-meta-list — live in components.css (Phase 3B-2).
 */

/* ============================================================ FILM ARCHIVE */
.schusei-film-archive.schusei-main {
	max-width: var(--sch-width-wide);
}

.schusei-film-archive__header {
	margin-bottom: var(--sch-space-xl);
}

.schusei-film-list {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--sch-space-xl) var(--sch-space-lg);
}

@media (min-width: 48em) {
	.schusei-film-list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* ---------------------------------------------------------------- one card */
.schusei-film-card {
	position: relative;
	min-width: 0;
	margin: 0;
}

/* CinemaScope, matching the schusei_film_cinemascope image size (2400x1004,
   ~2.39:1) — most films are mastered/framed at this ratio. Film-only; do not
   copy this ratio to other content types. */
.schusei-film-card__media {
	aspect-ratio: 2400 / 1004;
	overflow: hidden;
	background-color: var(--sch-bg-raised);
}

.schusei-film-card__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: opacity var(--sch-duration-base) var(--sch-ease);
}

.schusei-film-card__placeholder {
	display: block;
	width: 100%;
	height: 100%;
	box-shadow: inset 0 0 0 1px var(--sch-border);
}

.schusei-film-card:hover .schusei-film-card__image,
.schusei-film-card:focus-within .schusei-film-card__image {
	opacity: 0.88;
}

.schusei-film-card__body {
	margin-top: var(--sch-space-sm);
}

.schusei-film-card__title {
	margin: 0;
	font-size: var(--sch-text-heading);
	font-weight: 400;
	line-height: var(--sch-leading-snug);
	overflow-wrap: anywhere;
}

.schusei-film-card__link {
	color: var(--sch-text);
	text-decoration: none;
}

/* Stretch the title link over the whole card without changing its a11y name. */
.schusei-film-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
}

.schusei-film-card__link:focus-visible {
	outline: none;
}

.schusei-film-card__link:focus-visible::after {
	outline: 2px solid var(--sch-accent-warm);
	outline-offset: 4px;
}

.schusei-film-card__meta {
	margin: var(--sch-space-3xs) 0 0;
	display: flex;
	flex-wrap: wrap;
	gap: var(--sch-space-2xs) var(--sch-space-sm);
	font-size: var(--sch-text-micro);
	letter-spacing: var(--sch-tracking-wide);
	text-transform: uppercase;
	color: var(--sch-text-secondary);
}

/* ============================================================= FILM SINGLE */
.schusei-film-single.schusei-main {
	max-width: var(--sch-width-content);
}

.schusei-film > * + * {
	margin-top: var(--sch-space-xl);
}

/* ------------------------------------------------------------ header */
.schusei-film__back {
	margin: 0 0 var(--sch-space-lg);
	font-size: var(--sch-text-micro);
	letter-spacing: var(--sch-tracking-wide);
	text-transform: uppercase;
}

.schusei-film__back a {
	color: var(--sch-text-secondary);
	text-decoration: none;
}

.schusei-film__back a:hover,
.schusei-film__back a:focus-visible {
	color: var(--sch-text);
}

.schusei-film__title {
	margin: 0;
	font-size: var(--sch-text-title);
	font-weight: 400;
	line-height: var(--sch-leading-tight);
	overflow-wrap: anywhere;
}

.schusei-film__meta {
	margin: var(--sch-space-sm) 0 0;
	display: flex;
	flex-wrap: wrap;
	gap: var(--sch-space-2xs) var(--sch-space-sm);
	font-size: var(--sch-text-micro);
	letter-spacing: var(--sch-tracking-wide);
	text-transform: uppercase;
	color: var(--sch-text-secondary);
}

/* In-text links sit inline with non-link meta (year, etc.); an underline is
   the non-colour cue that keeps them distinguishable (WCAG 1.4.1). */
.schusei-film__meta a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
}

.schusei-film__meta a:hover,
.schusei-film__meta a:focus-visible {
	color: var(--sch-text);
}

/* ------------------------------------------------------------ hero image */
.schusei-film__hero {
	margin: var(--sch-space-xl) 0 0;
}

.schusei-film__hero-image {
	width: 100%;
	height: auto;
}

/* ------------------------------------------------------------ video */
.schusei-film__video {
	margin-top: var(--sch-space-xl);
}

.schusei-video {
	position: relative;
	aspect-ratio: 16 / 9;
	background-color: var(--sch-bg-raised);
}

.schusei-video :is(iframe, embed, object, video) {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* -------------------------------------------------- click-to-load facade */
/* YouTube facade (inc/media.php): a real link over a remote thumbnail and a
   quiet play glyph. main.js swaps in the youtube-nocookie.com embed on
   activation; with no JS the link opens the video on YouTube. The swapped-in
   iframe reuses the .schusei-video :is(iframe, ...) rule above. */
.schusei-video__play {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
}

.schusei-video__poster {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: opacity var(--sch-duration-base) var(--sch-ease);
}

.schusei-video__play:hover .schusei-video__poster,
.schusei-video__play:focus-visible .schusei-video__poster {
	opacity: 0.9;
}

/* Thin, neutral, quiet — not a YouTube-red button. `position: relative`
   keeps it above the absolutely-positioned poster. */
.schusei-video__glyph {
	position: relative;
	display: grid;
	place-items: center;
	width: 3.5rem;
	height: 3.5rem;
	border: 1px solid var(--sch-text);
	border-radius: 50%;
	background-color: var(--sch-bg-raised);
}

.schusei-video__glyph::before {
	content: "";
	margin-left: 0.2rem;
	border-style: solid;
	border-width: 0.45rem 0 0.45rem 0.7rem;
	border-color: transparent transparent transparent var(--sch-text);
}

.schusei-video__fallback {
	margin: 0;
	font-size: var(--sch-text-small);
}

.schusei-video__fallback a {
	color: var(--sch-accent-warm);
	text-decoration: none;
}

.schusei-video__fallback a:hover,
.schusei-video__fallback a:focus-visible {
	color: var(--sch-text);
}

/* ------------------------------------------------------------ body copy */
.schusei-film__body {
	font-size: var(--sch-text-body);
}

/* --------------------------------------------------------- project details */
.schusei-film__details {
	margin-top: var(--sch-space-xl);
}

/* ------------------------------------------------------------ stills */
.schusei-film__stills-section {
	margin-top: var(--sch-space-xl);
}

.schusei-gallery {
	display: grid;
	grid-template-columns: 1fr;
	gap: var(--sch-space-lg);
}

.schusei-gallery__item {
	margin: 0;
}

.schusei-gallery__image {
	width: 100%;
	height: auto;
}

.schusei-gallery__caption {
	margin-top: var(--sch-space-2xs);
	font-size: var(--sch-text-micro);
	letter-spacing: var(--sch-tracking-wide);
	color: var(--sch-text-secondary);
}

/* Image-aware stills — the same technique as the Photography / Store
   single-view galleries (photography.css / store.css). width:auto +
   max-height caps a tall portrait so it is exhibited, not oversized;
   a landscape still keeps the full column width. No object-fit, nothing
   cropped — the dark page ground shows around a narrow frame. */
.schusei-film__stills {
	gap: var(--sch-space-xl);
	justify-items: center;
}

.schusei-film__stills .schusei-gallery__item {
	width: 100%;
	text-align: center;
}

.schusei-film__stills .schusei-gallery__image {
	display: inline-block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 80vh;
}

/* ------------------------------------------------------------ credits */
.schusei-film__credits-text {
	margin-top: var(--sch-space-sm);
	max-width: var(--sch-measure);
	color: var(--sch-text-secondary);
	font-size: var(--sch-text-small);
	line-height: var(--sch-leading-snug);
}

/* ------------------------------------------------------- previous / next */
.schusei-film__pager {
	display: grid;
	gap: var(--sch-space-md);
	padding-top: var(--sch-space-lg);
	border-top: 1px solid var(--sch-border);
}

.schusei-film__pager-link {
	display: flex;
	flex-direction: column;
	gap: var(--sch-space-3xs);
	text-decoration: none;
	color: var(--sch-text-secondary);
}

.schusei-film__pager-dir {
	font-size: var(--sch-text-micro);
	letter-spacing: var(--sch-tracking-wide);
	text-transform: uppercase;
	color: var(--sch-text-secondary);
}

.schusei-film__pager-title {
	font-size: var(--sch-text-small);
	color: var(--sch-text);
}

.schusei-film__pager-link:hover .schusei-film__pager-title,
.schusei-film__pager-link:focus-visible .schusei-film__pager-title {
	color: var(--sch-accent-warm);
}

@media (min-width: 40em) {
	.schusei-film__pager {
		grid-template-columns: 1fr 1fr;
	}

	.schusei-film__pager-link--next {
		text-align: right;
	}
}
