<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>{{.Data.T.Query}} — 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">
			<a href="/" class="decoration-none">
				<h1 class="inline valign-mid text sans margin-lr-1">a·muse</h1>
			</a>
			<form action="/items/" method="get" class="flex inline margin-lr-1 border-bottom">
				<input type="search" name="q" class="phone-max-width-8 border-none bg-none sans text" placeholder="{{.Strings.Global.search}}" value="{{ .Data.T.Query }}" />
			</form>
			<div class="margin-lr-1 text">
				{{ 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>
					<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">&#xe7ff;</span>
						</li>
					</ul>
				</nav>
				{{ end }}
			</div>
		</header>
		<main class="margin-lr-1">
			<div class="flex flex-row flex-wrap flex-justify-space flex-align-start margin-top-1">
				<div>
					{{if gt .Data.T.Page 1}}
					<a href="/items/?q={{.Data.T.Query}}&page={{.Data.T.PrevPage}}" class="decoration-none" title="{{.Strings.Search.prev_link_title}}"><span class="material-icon font-2">&#xe408;</span></a>
					{{end}}
				</div>
				<div>
					{{if lt .Data.T.Page .Data.T.Total_pages}}
					<a href="/items/?q={{.Data.T.Query}}&page={{.Data.T.NextPage}}" class="decoration-none" title="{{.Strings.Search.next_link_title}}"><span class="material-icon font-2">&#xe409;</span></a>
					{{end}}
				</div>
			</div>
			<div class="flex flex-row flex-wrap flex-justify-space flex-align-start">
				{{if or .Data.T.Results .Data.I.Results}}
				{{range .Data.T.Results}}
				{{if eq .Media_type "movie"}}
				<a href="/films/{{.Id}}" class="decoration-none force-width-18 margin-tb-1 no-outline border-solid border-gradient border-tb-transparent border-_5 padding-tb-_25 padding-lr-_25">
				{{else if eq .Media_type "person"}}
				<a href="/persons/{{.Id}}" class="decoration-none force-width-18 margin-tb-1 no-outline border-solid border-gradient border-tb-transparent border-_5 padding-tb-_25 padding-lr-_25">
				{{else if eq .Media_type "tv"}}
				<a href="/tvseries/{{.Id}}" class="decoration-none force-width-18 margin-tb-1 no-outline border-solid border-gradient border-tb-transparent border-_5 padding-tb-_25 padding-lr-_25">
				{{end}}
					<div class="flex">
						<div>
							{{if .Poster_path}}
							<img src="https://image.tmdb.org/t/p/w154{{.Poster_path}}" class="min-height-231px width-154px" />
							{{else if eq .Media_type "movie"}}
							<img src="/static/img/poster_empty.webp" class="min-height-231px width-154px" />
							{{else if eq .Media_type "tv"}}
							<img src="/static/img/tv_empty.webp" class="min-height-231px width-154px" />
							{{else if eq .Media_type "person"}}
							<img src="/static/img/person_empty.webp" class="min-height-231px width-154px" />
							{{end}}
						</div>
						<div class="margin-lr-1">
							<p class="sans">{{.Name}}</p>
							{{if not .Release_date.IsZero}}
							<p class="sans font-_875 text-grey">{{.Release_date.Year}}</p>
							{{end}}
							{{if eq .Media_type "tv"}}
							<p class="sans font-_875 text-grey">{{$.Strings.Search.tvserie}}</p>
							{{else if eq .Media_type "movie"}}
							<p class="sans font-_875 text-grey">{{$.Strings.Search.film}}</p>
							{{else if eq .Media_type "person"}}
							<p class="sans font-_875 text-grey">{{$.Strings.Search.person}}</p>
							{{end}}
						</div>
					</div>
				</a>
				{{end}}
				{{range .Data.I.Results}}
				{{if eq .Type "works"}}
				<a href="/books/{{.Uri}}" class="decoration-none force-width-18 margin-tb-1 no-outline border-solid border-gradient border-tb-transparent border-_5 padding-tb-_25 padding-lr-_25">
				{{else if eq .Type "humans"}}
				<a href="/authors/{{.Uri}}" class="decoration-none force-width-18 margin-tb-1 no-outline border-solid border-gradient border-tb-transparent border-_5 padding-tb-_25 padding-lr-_25">
				{{else if eq .Type "series"}}
				<a href="/bookseries/{{.Uri}}" class="decoration-none force-width-18 margin-tb-1 no-outline border-solid border-gradient border-tb-transparent border-_5 padding-tb-_25 padding-lr-_25">
				{{end}}
					<div class="flex">
						<div>
							{{if .ImagePath}}
							<img src="{{.ImagePath}}" class="min-height-231px width-154px" />
							{{else if eq .Type "works"}}
							<img src="/static/img/book_empty.webp" class="min-height-231px width-154px" />
							{{else if eq .Type "humans"}}
							<img src="/static/img/person_empty.webp" class="min-height-231px width-154px" />
							{{else if eq .Type "series"}}
							<img src="/static/img/bookserie_empty.webp" class="min-height-231px width-154px" />
							{{end}}
						</div>
						<div class="margin-lr-1">
							<p class="sans">{{.Label}}</p>
							{{if eq .Type "works"}}
							<p class="sans font-_875 text-grey">{{$.Strings.Search.book}}</p>
							{{else if eq .Type "humans"}}
							<p class="sans font-_875 text-grey">{{$.Strings.Search.author}}</p>
							{{else if eq .Type "series"}}
							<p class="sans font-_875 text-grey">{{$.Strings.Search.bookserie}}</p>
							{{end}}
						</div>
					</div>
				</a>
				{{end}}
			</div>
				<div class="centre">
					<a href="/about#sources">{{$.Strings.Search.droids}}</a>
				</div>
			<div class="flex flex-row flex-wrap flex-justify-space flex-align-start">
				<div>
					{{if gt .Data.T.Page 1}}
					<a href="/items/?q={{.Data.T.Query}}&page={{.Data.T.PrevPage}}" class="decoration-none" title="{{.Strings.Search.prev_link_title}}"><span class="material-icon font-2">&#xe408;</span></a>
					{{end}}
				</div>
				<div>
					{{if lt .Data.T.Page .Data.T.Total_pages}}
					<a href="/items/?q={{.Data.T.Query}}&page={{.Data.T.NextPage}}" class="decoration-none" title="{{.Strings.Search.next_link_title}}"><span class="material-icon font-2">&#xe409;</span></a>
					{{end}}
				</div>
			</div>
			{{else if eq .Data.T.Total_pages 0}}
			<div class="font-2 w12 flex flex-centre margin-top-10">
				<div>
					<p>{{.Strings.Search.not_found_quote}}</p>
					<p class="indent-2 sans">—{{.Strings.Search.not_found_character}} (<span class="italic sans">{{.Strings.Search.not_found_title}}</span>, {{.Strings.Search.not_found_code}} {{.Strings.Search.not_found_episode}})</p>
				</div>
			</div>
			<div>
			{{else if gt .Data.T.Page .Data.T.Total_pages}}
			<div class="font-2 w12 flex flex-centre margin-top-10">
				<div>
					<p>{{.Strings.Search.too_far_quote}}</p>
					<p class="indent-2 sans">—{{.Strings.Search.too_far_character}} (<span class="italic sans">{{.Strings.Search.too_far_title}}</span>)</p>
				</div>
			</div>
			{{end}}
		</main>
	</body>
</html>
