<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>{{.Data.Title}}{{if not .Data.Release_date.IsZero}} ({{.Data.Release_date.Year}}){{end}} — a·muse</title>
		<link rel="stylesheet" href="/static/style/style.css" />
		<link rel="icon" type="image/svg+xml" href="/static/img/logo.svg">
		<link rel="apple-touch-icon" type="image/svg+xml" href="/static/img/logo.svg">
	</head>
	<body>
		<header class="w12 padding-bottom-_25 flex flex-row flex-justify-space flex-align-centre bg-primary">
			<a href="/" class="decoration-none">
				<h1 class="inline valign-mid text-white sans margin-lr-1">a·muse</h1>
			</a>
			<form action="/items/" method="get" class="flex inline margin-lr-1 border-bottom-white">
				<input type="search" name="q" class="phone-max-width-8 border-none bg-none sans text-white" placeholder="{{.Strings.Global.search}}" />
			</form>
			<div class="margin-lr-1 text-white">
				{{ if .State.User.IsEmpty }}
				<a href="/login" class="decoration-none sans">{{.Strings.Global.log_in}}</a>
				—
				<a href="/signup" class="decoration-none sans">{{.Strings.Global.sign_up}}</a>
				{{ else }}
				<nav class="text">
					<label for="hamburger" class="cursor-hand">
						<img src="/users/{{.State.User.Username}}/avatar?size=small" class="border-radius-25 width-1_5"/>
					</label>
					<input type="checkbox" id="hamburger" class="display-none" />
					<ul class="absolute right top-1 padding-lr-1 padding-tb-_5 bg align-right list-style-none sans">
						<!--<li><a href="/users/{{.State.User.Username}}" class="decoration-none text-accent">{{.Strings.Global.account}}</a><span class="material-icon padding-lr-_5">&#xe851;</span></li>-->
						<li><a href="/users/{{.State.User.Username}}/watchlist" class="decoration-none text-accent">{{.Strings.Global.watchlist}}</a><span class="material-icon padding-lr-_5">&#xe04a;</span></li>
						<li><a href="/users/{{.State.User.Username}}/tvqueue" class="decoration-none text-accent">{{.Strings.Global.tv_queue}}</a><span class="material-icon padding-lr-_5">&#xe1b2;</span></li>
						<li><a href="/users/{{.State.User.Username}}/readlist" class="decoration-none text-accent">{{.Strings.Global.readlist}}</a><span class="material-icon padding-lr-_5">&#xe431;</span></li>
						<li><a href="/users/{{.State.User.Username}}/experiences" class="decoration-none text-accent">{{.Strings.Global.experiences}}</a><span class="material-icon padding-lr-_5">&#xe042;</span></li>
						<li class="bg-error">
							<form action="/users/{{.State.User.Username}}/sessions/{{.State.User.Session}}" method="POST" class="inline">
								<input type="hidden" value="DELETE" name="method" />
								<input type="submit" value="{{.Strings.Global.log_out}}" class="border-none bg-none font-normal text-accent padding-lr-0 cursor-hand font-1" />
							</form><span class="material-icon padding-lr-_5 text-white">&#xe7ff;</span>
						</li>
					</ul>
				</nav>
				{{ end }}
			</div>
		</header>
		<div class="absolute top behind w12">
			{{if .Data.Backdrop_path}}
			<img src="https://image.tmdb.org/t/p/original{{.Data.Backdrop_path}}" class="w12 cover height-30" />
			{{else}}
			<img src="/static/img/film_backdrop.webp" class="w12 cover height-30" /> <!-- Photo by [mujipanda](https://pixabay.com/users/mujipanda-2035588/) from [Pixabay](https://pixabay.com/photos/menu-cinema-singapore-old-cinema-1192534/) -->
			{{end}}
			<div class="on-desktop relative bottom-4 sans inline-block w12 padding-l-16 font-3 bg-gradient">
				<span class="text-white">{{.Data.Title}}</span>
				{{if not .Data.Release_date.IsZero}}
				<span class="text-unimportant font-thin font-2">({{.Data.Release_date.Year}})</span>
				{{end}}
			</div>
		</div>
		<main class="margin-top-20 margin-lr-5 flex flex-row flex-wrap flex-justify-space flex-align-start margin-bottom-2">
			<div class="desktop-w3 phone-w12 margin-bottom-2">
				{{if .Data.Poster_path}}
				<img src="https://image.tmdb.org/t/p/w154{{.Data.Poster_path}}" class="block min-height-231px width-154px">
				{{else}}
				<img src="/static/img/poster_empty.webp" class="block min-height-231px width-154px" />
				{{end}}
				<div class="on-phone">
					<span class="sans font-3">{{.Data.Title}}</span>
					{{if not .Data.Release_date.IsZero}}
					<span class="sans text-unimportant font-thin font-2">({{.Data.Release_date.Year}})</span>
					{{end}}
				</div>
				<p class="sans text-grey margin-top-1 margin-bottom-_5"><span class="material-icon">&#xe8d0;</span> {{$.Strings.Film.rating}}</p>
				{{if eq .Data.Vote_count 0}}
				<p class="margin-lr-1 sans margin-tb-_5">{{$.Strings.Film.TBD}}</p>
				{{else}}
				<p class="margin-lr-1 sans margin-tb-_5">{{.Data.Vote_average}}/10 ({{$.Strings.Film.votes}}: {{.Data.Vote_count}})</p>
				{{end}}
				{{if .Data.Genres}}
				<p class="sans text-grey margin-top-1 margin-bottom-_5"><span class="material-icon">&#xe43a;</span> {{$.Strings.Film.genre}}</p>
				<p class="margin-lr-1 sans margin-tb-_5">{{range .Data.Genres}} {{.Name}}<br/> {{end}}</span></p>
				{{end}}
				<p class="sans text-grey margin-top-1 margin-bottom-_5"><span class="material-icon">&#xe422;</span> {{$.Strings.Film.runtime}}</p>
				{{if eq .Data.Runtime 0}}
				<p class="margin-lr-1 sans margin-tb-_5">{{.Strings.Film.TBD}}</p>
				{{else}}
				<p class="margin-lr-1 sans margin-tb-_5">{{.Data.Runtime}} {{.Strings.Film.minutes}}</p>
				{{end}}
				<p class="sans text-grey margin-top-1 margin-bottom-_5"><span class="material-icon">&#xe923;</span> {{$.Strings.Film.status}}</p>
				<p class="margin-lr-1 sans margin-tb-_5">{{.Data.Status}}</p>
				<details>
					<summary class="cursor-hand margin-bottom-_5">
						<span class="sans">{{$.Strings.Film.premieres}}</span>
					</summary>
					<div>
						<span class="sans">{{$.Strings.Film.earliest}}:</span>
						<ul class="margin-tb-0">
						{{ range .Data.EarliestReleaseDates }}
						<li class="sans">
							<!-- todo on, in <- strings, locale to country/language name -->
							{{ $.GetPremiereType .Type }}: on {{$.FormatDate .ReleaseDate}} in {{.Locale}} {{if .Note}}({{.Note}}){{end}}
						</li>
						{{ end }}
						</ul>
						<!-- todo in country from user settings (but check also country alone if not with language) -->
						<hr class="margin-tb-_5"/>
						{{ range $locale, $releaseDates := .Data.ReleaseDates }}
							<div>
								<!-- locale to country/language name -->
								<span class="sans">{{$locale}}:</span>
								<ul class="margin-tb-0">
									{{ range $releaseDates }}
									<!-- todo on, in <- strings -->
									<li class="sans">{{ $.GetPremiereType .Type }} on {{$.FormatDate .ReleaseDate}} {{if .Note}}({{.Note}}){{end}}</li>
									{{end}}
								</ul>
							</div>
						{{ end }}
					</div>
				</details>
				{{ if .Data.BasedOn.Title }}
				<p class="sans text-grey margin-top-1 margin-bottom-_5"><span class="material-icon">&#xe865;</span> {{.Strings.Film.based_on}}</p>
				<p class="margin-lr-1 sans margin-tb-_5"><a href="{{.Data.BasedOn.Uri}}">{{.Data.BasedOn.Title}}</a></p>
				{{ end }}
				<p class="sans text-grey margin-top-1 margin-bottom-_5"><span class="material-icon">&#xe157;</span> {{.Strings.Film.source}}</p>
				<p class="margin-lr-1 sans margin-tb-_5"><a href="{{.Data.Source}}">TheMovieDB</a></p>
				{{if and (.Data.IsOnWantList) (not .State.User.IsEmpty)}}
				<p class="sans text-grey margin-top-1 margin-bottom-_5"><span class="material-icon">&#xe05f;</span> {{.Strings.Film.Watchlist}}</p>
				<p class="margin-lr-1 sans margin-tb-_5">{{.Strings.Film.onWatchlist}}</p>
				<form action="/users/{{.State.User.Username}}/watchlist/film:{{.Data.Id}}" method="POST">
					<input type="hidden" name="method" value="DELETE" />
					<button type="submit" class="border-text sans margin-lr-1 hover-bg-grey padding-tb-_25 cursor-hand text"><span class="padding-lr-_5 material-icon">&#xe16c;</span><span class="sans padding-lr-_5">{{.Strings.Film.remove_want}}</span></button>
				</form>
				{{end}}
				{{if .Data.Experiences}}
				<p class="sans text-grey margin-top-1 margin-bottom-_5"><span class="material-icon">&#xe04a;</span> {{.Strings.Film.watched}}</p>
				<p class="margin-lr-1 sans margin-tb-_5">{{len .Data.Experiences}} times<br/>
				last time <span title="{{.Data.GetLastExperienceFull .Strings}}">{{.Data.GetLastExperience .Strings .State.User.Timezone}}</p>
				{{end}}
			</div>
			<div class="desktop-w6 phone-w12 margin-top-10 padding-lr-2 margin-bottom-2">
				<div>
					{{if not .State.User.IsEmpty}}
					<div class="flex flex-row flex-wrap flex-centre flex-align-centre">
						{{if and (not .Data.IsOnWantList) (not .Data.Experiences)}}
						<form action="/users/{{.State.User.Username}}/watchlist/" method="POST" class="margin-tb-_5 margin-lr-1">
							<input type="hidden" name="itemId" value="{{.Data.Id}}" />
							<input type="hidden" name="itemType" value="film" />
							<button type="submit" class="border-text hover-bg-grey padding-tb-_25 cursor-hand text font-2"><span class="padding-lr-_5 material-icon font-2">&#xe03b;</span><span class="sans padding-lr-_5">{{.Strings.Film.want_watch}}</span></button>
						</form>
						{{end}}
						<form action="/users/{{.State.User.Username}}/experiences/" method="POST" class="margin-tb-_5 margin-lr-1">
							<input type="hidden" name="itemId" value="{{.Data.Id}}" />
							<input type="hidden" name="itemType" value="film" />
							<button type="submit" class="border-text hover-bg-dark-accent padding-tb-_25 cursor-hand text-black font-2"><span class="padding-lr-_5 material-icon font-2">&#xe04a;</span><span class="sans padding-lr-_5">{{.Strings.Film.watched}}</span></button><label for="experienced-datetime-check" class="cursor-hand bg-accent inline-block font-2 relative top-m_3 height-3_3 text-black">
								<span class="material-icon">&#xe5cf;</span>
							</label>
							<input type="checkbox" id="experienced-datetime-check" class="display-none experienced-datetime-check" name="isOtherTime" value="true"/>
							<div class="experienced-box absolute">
								<input type="date" name="experiencedDate" class="margin-lr-_5 margin-tb-_5 text bg border-text" placeholder="YYYY-mm-dd"/>
								<input type="time" name="experiencedTime" class="margin-lr-_5 margin-tb-_5 text bg border-text" placeholder="HH:MM" />
							</div>
						</form>
					</div>
					{{end}}
				</div>
				<p class="italic serif">{{.Data.Tagline}}</p>
				<p class="serif justify hyphenate">{{.Data.Overview}}</p>
				<hr class="material-icon text-grey hr-film" />
				{{if .Data.Collection.Parts}}
				<p class="sans font-2">{{.Strings.Film.in_this_collection}}:</p>
				<div class="flex flex-row flex-wrap felx-justify-space flex-align-start">
					{{range .Data.Collection.Parts}}
					<a href="/films/{{.Id}}" class="decoration-none no-outline margin-tb-1 margin-lr-1">
						<div class="flex force-width-16">
							<div>
								{{if .Poster_path}}
								<img src="https://image.tmdb.org/t/p/w92{{.Poster_path}}" class="min-height-139px width-92px" />
								{{else}}
								<img src="/static/img/poster_empty.webp" class="min-height-139px width-92px" />
								{{end}}
							</div>
							<div class="margin-lr-1">
								<p class="sans">{{.Title}}</p>
								{{if not .Release_date.IsZero}}
								<p class="sans font-_875 text-grey">{{.Release_date.Year}}</p>
								{{end}}
								{{if .IsWatched}}<p class="material-icon font-_875 text-grey">&#xe8f4;</p>{{end}}
							</div>
						</div>
					</a>
					{{end}}
				</div>
				{{end}}
			</div>
			<div class="desktop-w3 phone-w12 margin-top-10 flex phone-flex-flow">
				<details class="margin-lr-1 flex-force-40 min-width-13_5">
					<summary class="cursor-hand">
						<span class="material-icon font-1_5">&#xe7fb;</span> <span class="sans font-1_5">{{.Strings.Film.cast}}</span>
					</summary>
					<div>
						{{if not .Data.Credits.Cast}}
						<p class="sans indent-2 margin-top-1">{{.Strings.Film.empty_payroll}}</p>
						{{end}}
						{{range .Data.Credits.Cast}}
						<a href="/persons/{{.Id}}" class="decoration-none no-outline inline-block margin-tb-1">
							<div class="flex">
								<div>
									{{if .Profile_path}}
									<img src="https://image.tmdb.org/t/p/w92{{.Profile_path}}" class="min-height-139px width-92px" decoding="async" loading="lazy" />
									{{else}}
									<img src="/static/img/person_empty.webp" class="min-height-139px width-92px" decoding="async" loading="lazy" />
									{{end}}
								</div>
								<div class="margin-lr-1">
									<p class="sans text">{{.Character}}</p>
									<p class="sans font-_875">{{.Name}}</p>
								</div>
							</div>
						</a>
						{{end}}
					</div>
				</details>
				<details class="margin-lr-1 flex-force-40 min-width-13_5">
					<summary class="cursor-hand">
						<span class="material-icon font-1_5">&#xe7fc;</span> <span class="sans font-1_5">{{.Strings.Film.crew}}</span>
					</summary>
					<div>
						{{if not .Data.Credits.Crew}}
						<p class="sans indent-2 margin-top-1">{{.Strings.Film.empty_payroll}}</p>
						{{end}}
						{{range .Data.Credits.Crew}}
						<a href="/persons/{{.Id}}" class="decoration-none no-outline inline-block margin-tb-1">
							<div class="flex">
								<div>
									{{if .Profile_path}}
									<img src="https://image.tmdb.org/t/p/w92{{.Profile_path}}" class="min-height-139px width-92px" decoding="async" loading="lazy" />
									{{else}}
									<img src="/static/img/person_empty.webp" class="min-height-139px width-92px" decoding="async" loading="lazy" />
									{{end}}
								</div>
								<div class="margin-lr-1">
									<p class="sans text">{{.Job}}</p>
									<p class="sans font-_875">{{.Name}}</p>
								</div>
							</div>
						</a>
						{{end}}
					</div>
				</details>
			</div>
		</main>
	</body>
</html>
