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

:root {
	--font-sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
	--font-mono: "Courier New", Courier, monospace;
	--home-bg: #ffffff;
	--home-text: #111111;
	--video-bg: #000000;
	--video-text: #ffffff;
	--space: 1rem;
	--max-content: 1200px;
}

html {
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	font-family: var(--font-sans);
	line-height: 1.5;
	min-height: 100vh;
	padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

a {
	text-decoration: none;
	color: inherit;
}

a:hover {
	opacity: 0.65;
}

img {
	max-width: 100%;
	height: auto;
}

/* ── Home ── */

.page-home {
	background: var(--home-bg);
	color: var(--home-text);
}

.home {
	max-width: var(--max-content);
	margin: 0 auto;
	padding: var(--space);
}

.thumb-grid-wrap {
	width: 100%;
	margin-bottom: 2rem;
}

.thumb-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 4px;
	width: 100%;
}

.thumb-grid a {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	text-decoration: none;
}

.thumb-grid img {
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border: 0;
	display: block;
}

.dir-table {
	width: 95%;
	border: 0;
	border-collapse: collapse;
	background: var(--home-bg);
	color: #000;
}

.dir-table td {
	padding: 0;
	vertical-align: top;
}

.dir-table font,
.dir-listing {
	font-family: monospace;
	font-size: 12pt;
	font-weight: normal;
	line-height: normal;
	letter-spacing: normal;
}

.dir-listing {
	border-collapse: collapse;
	width: 100%;
}

.dir-listing td {
	padding: 0;
	vertical-align: middle;
	white-space: nowrap;
	line-height: 1;
}

.dir-icon {
	vertical-align: middle;
	white-space: nowrap;
	padding-right: 0.2em;
}

.dir-icon img {
	max-width: none;
	width: auto;
	height: auto;
	vertical-align: middle;
	border: 0;
}

.dir-name {
	padding-right: 1.25em;
	line-height: 22px;
	vertical-align: middle;
}

.dir-name a {
	position: relative;
	top: 3px;
	vertical-align: baseline;
}

.dir-date,
.dir-size,
.dir-desc {
	position: relative;
	top: 3px;
	line-height: 22px;
}

.dir-date {
	padding-right: 0.65em;
}

.dir-size {
	padding-right: 0.5em;
}

.dir-listing a,
.dir-table a {
	color: #000;
	text-decoration: underline;
}

.dir-listing a:visited,
.dir-listing a:active,
.dir-table a:visited,
.dir-table a:active {
	color: #000;
}

.dir-listing a:hover,
.dir-table a:hover {
	opacity: 1;
}

.dir-listing img,
.dir-table img {
	max-width: none;
	width: auto;
	height: auto;
	vertical-align: middle;
	border: 0;
}

.dir-listing tr:first-child td {
	padding-bottom: 0.35em;
}

.dir-listing hr,
.dir-table hr {
	border: none;
	border-top: 1px solid #000;
	margin: 0;
	height: 0;
}

.dir-table > tbody > tr > td > hr {
	margin-bottom: 1em;
}

.dir-date-short {
	display: none;
}

@media (max-width: 768px) {
	.home {
		padding: 0.5rem;
	}

	.thumb-grid-wrap {
		text-align: center;
	}

	.thumb-grid {
		display: inline-grid;
		width: min(324px, 100%);
		grid-template-columns: repeat(2, 1fr);
		text-align: left;
	}

	.dir-table {
		width: 95%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	.dir-table font,
	.dir-listing {
		font-size: 10pt;
	}

	.dir-icon {
		padding-right: 0.5em;
	}

	.dir-name {
		padding-right: 1.5em;
	}

	.dir-date {
		padding-right: 0.75em;
	}

	.dir-date-full {
		display: none;
	}

	.dir-date-short {
		display: inline;
	}

	.dir-day {
		display: none;
	}
}

@media (max-width: 768px) and (orientation: landscape) {
	.thumb-grid {
		width: 100%;
		grid-template-columns: repeat(4, 1fr);
	}

	.dir-date-full {
		display: inline;
	}

	.dir-date-short {
		display: none;
	}

	.dir-day {
		display: inline;
	}
}

/* ── Video pages ── */

.page-video {
	background: var(--video-bg);
	color: var(--video-text);
	min-height: 100vh;
}

.layout-table {
	width: 100%;
	max-width: none;
	margin: 0;
	border-collapse: collapse;
}

.layout-table,
.layout-table tbody,
.layout-table tr {
	display: block;
	width: 100%;
	height: 100vh;
	position: relative;
}

.layout-table td:first-child {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100vh;
	padding: 0;
	box-sizing: border-box;
}

.layout-table td:last-child {
	position: absolute;
	top: var(--space);
	left: var(--space);
	padding: 0;
	z-index: 2;
	font-family: Verdana, sans-serif;
	font-size: medium;
	white-space: nowrap;
}

.layout-table td:last-child font {
	font-family: inherit;
	font-size: inherit;
}

.layout-table td:last-child a {
	display: inline;
	margin-right: 0.75rem;
	letter-spacing: 0.05em;
}

.layout-table td:last-child a:first-child {
	display: inline;
	margin-bottom: 0;
	font-weight: normal;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.layout-table video {
	display: block;
	width: 90%;
	max-width: 90%;
	height: calc(100vh - 2.5rem);
	height: calc(100dvh - 2.5rem);
	max-height: calc(100vh - 2.5rem);
	max-height: calc(100dvh - 2.5rem);
	object-fit: contain;
	object-position: center;
	background: #111;
}

video::-webkit-media-controls {
	opacity: 0;
}

video:hover::-webkit-media-controls,
video:focus::-webkit-media-controls {
	opacity: 1;
}
