@font-face {
	font-family: 'Lato';
	src: local(Lato Regular), url('/webfonts/lato/LatoLatin-Regular.woff2') format('woff2');
	font-style: normal;
	font-weight: normal;
	text-rendering: optimizeLegibility;
}

@font-face {
	font-family: 'Lato';
	src: local(Lato Bold), url('/webfonts/lato/LatoLatin-Bold.woff2') format('woff2');
	font-style: normal;
	font-weight: bold;
	text-rendering: optimizeLegibility;
}

*, ::before, ::after {
	box-sizing: border-box;
}

html {
	--background-color: white;
	--text-color: black;
	--link-color: var(--text-color);
	--disabled-color: gray;
	--rule-color: silver;
	--new-marker-text-color: var(--text-color);
	--new-marker-background-color: hsl(10deg 90% 50%);
	--table-margin: 2em;
	scroll-padding-top: var(--header-height);
	overflow: auto;
	background: var(--background-color);
	color: var(--text-color);
}

@media (prefers-color-scheme: dark) {
	html {
		--background-color: #222;
		--text-color: white;
		--disabled-color: darkgray;
		--rule-color: gray;
		--new-marker-background-color: hsl(10deg 100% 40%);
	}
}

head {
	display: block;
}

head > * {
	display: none;
}

body {
	margin: 0;
	padding: 0 1em;
	padding: 0 clamp(1em, 2vw, 2em);
	font: 1em/1.1 Lato, Source Sans Pro, sans-serif;
	font-variant-numeric: lining-nums tabular-nums;
	font-variant-ligatures: none;
	position: relative;
}

body:not(.scrolled) {
	padding-bottom: 3em;
}

:focus-visible {
	outline: thin solid var(--text-color);
	outline-offset: 0.25em;
}

@media (prefers-reduced-motion: no-preference) {
	:focus-visible {
		transition: outline-offset .2s ease;
	}
}

a {
	color: var(--link-color);
	text-underline-position: under;
}

.skip-link {
	position: absolute;
	top: 1em;
	z-index: 1;
	background: var(--background-color);
	box-shadow: 0 0 0 1em var(--background-color);
}

.skip-link:not(:focus),
.visually-hidden {
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

body > header, body > footer {
	padding: 1em 0;
	font-size: 0.9em;
	background: var(--background-color);
}

body > header {
	position: sticky;
	top: 0;
	border-bottom: thin solid transparent;
	z-index: 1;
}

body.scrolled > header {
	border-color: var(--rule-color);
}

body > footer {
	position: fixed;
	bottom: 0;
	border-top: thin solid var(--rule-color);
	width: 100%;
	width: calc(100% - 2 * clamp(1em, 2vw, 2em));
	line-height: 1.4;
}

body.scrolled > footer {
	position: static;
	border-color: transparent;
}

body > footer cite {
	font-style: normal;
}

nav ol {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-flow: row wrap;
	gap: 1em;
}

nav a {
	color: var(--disabled-color);
}

nav a[href] {
	color: inherit;
	text-decoration: none;
}

nav a[href][aria-current] {
	text-decoration: underline;
	text-decoration-thickness: 0.1em;
}

s {
	text-decoration-thickness: 0.1em;	
}

svg {
	width: auto;
	height: 1rem;
}

h1 {
	font-weight: bold;
	font-size: 1.5em;
	margin: 2rem 0 1rem;
	text-align: left;
}

table {
	margin: var(--table-margin) 0;
	table-layout: fixed;
	border-collapse: collapse;
}

caption {
	font-weight: bold;
	font-size: 1.5em;
	padding-bottom: 0.75em;
	text-align: left;
}

tbody:not(:first-of-type),
tfoot {
	border-top: thin solid var(--rule-color);
}

th, td {
	box-sizing: content-box;
	padding: 0.25em 0.5em;
	font-weight: normal;
	text-align: left;
	vertical-align: top;
}

:is(th, td):first-child {
	padding-left: 0;
}

:is(th, td):last-child {
	padding-right: 0;
}

:where(#index) :is(th, td) {
	vertical-align: middle;	
}

td {
	width: 6em;
}

td:empty {
	width: 0 !important;
	padding: 0 !important;
}

[property="episodeNumber"] {
	width: 2em;
}

tr:last-of-type [property="episodeNumber"] {
	padding-right: 0;
}

td[property="name"],
td[property="workTranslation"],
td[property="director"],
td[property="author"],
td:has([property="author"]),
td[property="review"],
td:has([property="video"]) {
	width: 18em;
}

details:not(:first-child) {
	margin-top: 0.5em;
}

details p {
	max-width: 32em;
	margin-left: -26em;
	line-height: 1.4;
	-webkit-hyphens: auto;
	hyphens: auto;
}

details p:not([property]):only-of-type {
		text-align: end;
}

dl {
	margin: 0;
}

dt, dd, dd ul {
	display: inline;
	margin: 0;
}

ul:has(details) {
	display: flex;
	flex-wrap: wrap;
	
	li, details {
		display: contents;
	}
	
	li:not(:first-of-type) summary {
		margin-left: 1.5em;
	}
	
	iframe {
		order: 1;
		width: 100%;
	}
}

@media (width > 40em) {
	[property="abstract"], [property="description"] {
		margin-top: 0.5em;
		padding-top: 0.25em;
		background: var(--background-color);
		scale: 1;
	}

	tr:not(:last-of-type) :is([property="abstract"], [property="description"]):last-child,
	tr:not(:last-of-type) :is([property="abstract"], [property="description"]) ~ :last-child {
		padding-bottom: 0.5em;
		border-bottom: thin solid var(--rule-color);
	}
}

@media (max-width: 40em) {
	thead {
		display: none;
	}
	
	table, caption, tbody, tr, th, td {
		display: block;
		width: 100% !important;
	}
	
	tr {
		padding: 1em 0;
	}
	
	th, td {
		padding-left: 0;
		padding-right: 0;
	}
	
	#index td {
		display: inline;
	}
	
	#index [property="startDate"]::after {
		content: '–';
	}

	details p {
		max-width: initial;
		margin-left: 0;
	}
}

ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

li {
	display: inline;
}

li:not(:last-of-type) > span::after {
	content: ', ';
}

li:nth-last-of-type(2) > span::after {
	content: ' & ';
}

abbr[title] {
	text-decoration: none;
}

img {
	display: block;
	margin: auto;
	height: 2.5em;
}

summary {
	width: fit-content;
	white-space: nowrap;
}

details:has(.new) summary {
	color: var(--new-marker-text-color);
	background: var(--new-marker-background-color);
	outline: 0.4em solid var(--new-marker-background-color);
}

.review-range,
.review-lang {
	font-size: 0.8em;
}

iframe {
	margin: 1em 0;
	width: 100%;
	height: auto;
	border: none;
	aspect-ratio: 16/9;
}

figure {
	margin: 1em 0;
	
	iframe {
		margin: 0;
	}
}

button {
	font: inherit;
	border-color: transparent;
	background: black;
	color: white;
	padding: 0.5em;
	border-radius: 0.5em;
}

body:has(> .players) {
	padding-bottom: 0 !important;
}

.players {
	--columns: 2;
	--rows: 1;
	aspect-ratio: calc(16/9 * var(--columns) / var(--rows));
	max-width: 100%;
	max-height: calc(100vh - var(--header-height, 0) - 1em);
	display: grid;
	gap: 0.5em;
	
	&:has(:is(iframe, figure):nth-of-type(2)) {
		--rows: 2;
	}
	
	&:has(:is(iframe, figure):nth-of-type(4)) {
		--columns: 3;
	}
	
	&:has(:is(iframe, figure):nth-of-type(6)) {
		--rows: 3;
	}

	@media (width >= 36em) {
		grid-template-columns: repeat(var(--columns), 1fr);
		
		&:has(:is(iframe, figure):last-of-type:nth-of-type(even)) {
		
			> :first-child {
				grid-row: 1 / span var(--rows);
			}
		}
	}
	
	& iframe {
		margin: 0;
	}
}

#player-controls button {
	margin-right: 0.5em;
}
