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

:root {
	font-size: 18px;
	--color-text: #fff;
	--color-bg: #000;
	--color-link: #fff;
	--color-link-hover: #fff;
}

body {
	margin: 0;
	color: var(--color-text);
	background-color: var(--color-bg);
	font-family: area-normal,-apple-system, BlinkMacSystemFont, Segoe UI, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	width: 100%;
	height: 100vh;
	overflow: hidden;
	touch-action: none;
}

/* Page Loader */
.js .loading::before,
.js .loading::after {
	content: '';
	position: fixed;
	z-index: 1000;
}

.js .loading::before {
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: #f0f0f0;
}

.js .loading::after {
	top: 50%;
	left: 50%;
	width: 20vw;
	aspect-ratio: 0.75;
	transform: translate3d(-50%,-50%,0);
	background-color: #f0f0f0;
	animation: loaderAnim 1s linear infinite alternate forwards;

}

@keyframes loaderAnim {
	to {
		background-color: #ccc;
	}
}

a {
	text-decoration: none;
	color: var(--color-link);
	outline: none;
	cursor: pointer;
}

a:hover {
	color: var(--color-link-hover);
	outline: none;
}

/* Better focus styles from https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible */
a:focus {
	/* Provide a fallback style for browsers
	 that don't support :focus-visible */
	outline: none;
	background: lightgrey;
}

a:focus:not(:focus-visible) {
	/* Remove the focus indicator on mouse-focus for browsers
	 that do support :focus-visible */
	background: transparent;
}

a:focus-visible {
	/* Draw a very noticeable focus style for
	 keyboard-focus on browsers that do support
	 :focus-visible */
	outline: 2px solid red;
	background: transparent;
}

.unbutton {
	background: none;
	border: 0;
	padding: 0;
	margin: 0;
	font: inherit;
	text-transform: uppercase;
	color: inherit;
	cursor: pointer;
}

.unbutton:focus {
	outline: none;
}

main {
	display: grid;
	grid-template-areas: 'main';
	position: relative;
	width: 100%;
	height: 100vh;
	overflow: hidden;
	place-items: center;
}

.frame {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	color: var(--color-title);
	padding: 1rem;
	font-size: 13px;
	font-weight: 600;
	display: grid;
	grid-template-columns: 100%;
	grid-template-areas: 'title' 'demos' 'credits' 'sponsor';
	justify-content: start;
	align-content: space-between;
	align-items: start;
	z-index: 100;
	pointer-events: none;
	grid-gap: 0.5rem;
}

.frame a {
	pointer-events: auto;
}

.frame a:not(.frame__demo) {
	white-space: nowrap;
	overflow: hidden;
	position: relative;
}

.frame a:not(.frame__demo)::before {
	content: '';
	height: 1px;
	width: 100%;
	background: currentColor;
	position: absolute;
	top: 90%;
	transition: transform 0.3s;
	transform-origin: 0% 50%;
}

.frame a:not(.frame__demo):hover::before {
	transform: scaleX(0);
	transform-origin: 100% 50%;
}

.frame__title {
	grid-area: title;
	display: flex;
	align-items: flex-end;
}

.frame strong {
	font-weight: 800;
}

.frame__title-main {
	font-size: inherit;
	margin: 0;
	font-weight: inherit;
}

.frame__demos {
	grid-area: demos;
}

a.frame__demo {
	margin: 0 0 0 1rem;
	text-decoration: none;
}

.frame__demo--current {
	font-weight: bold;
	color: var(--color-link-hover);
}

.frame__credits {
	grid-area: credits;
	text-transform: uppercase;
	display: flex;
	gap: 1rem;
}

.type {
	grid-area: main;
	display: grid;
	place-items: center;
	pointer-events: none;
	z-index: 100;
}

.type__item {
	text-align: center;
	font-weight: 800;
	font-size: clamp(1rem, 14vw, 1rem);
	grid-area: 1 / 1 / -1 / -1;
	opacity: 0;
	line-height: 1.5;
}

.type__item--current {
	opacity: 1;
}

.char-wrap {
	display: inline-block;
	position: relative;
	overflow: hidden;
	display: inline-flex;
}

.type__item.splitting .char {
	line-height: 1.5;
	padding-bottom: 0.3em;
}

.slider {
	grid-area: main;
	position: relative;
	overflow: hidden;
	display: grid;
	place-items: center;
	width: 100%;
	height: 100vh;
}

.slider__item {
	grid-area: 1 / 1 / -1 / -1;
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
	display: grid;
	place-items: center;
	opacity: 0;
	pointer-events: none;
}

.slider__item--current {
	opacity: 1;
	pointer-events: auto;
	z-index: 50;
}

.slider__item-inner {
	position: relative;
	width: 100%;
	height: 100%;
	display: grid;
	place-items: center;
	grid-area: 1 / 1 / -1 / -1;
	background-size: cover;
	background-position: 50% 50%;
}

.slider--bg {
	z-index: 1;
}

.demo-2 .slider--bg {
	-webkit-filter: contrast(0.6) saturate(2);
	filter: contrast(0.6) saturate(2);
}

.slider--fg {
	position: absolute;
	width: 20vw;
	min-width: 200px;
	aspect-ratio: 0.75;
	height: auto;
	z-index: 2;
}

.content {
	width: 100vw;
	height: 100vh;
	overflow: hidden;
	position: relative;
} 

.content-open .content {
	overflow: auto;
}

.content__inner {
	position: relative;
	display: grid;
	gap: 4vh;
	padding: 8rem 10vw 0;
	max-width: 1200px;
}

.content__title {
	font-size: clamp(3rem,9vw,20rem);
	font-weight: 600;
	margin: 0;
	line-height: 1;
}

.content__subtitle {
	font-size: 1rem;
	font-weight: 600;
	margin: 0;
}

.content__text {
	margin-top: 10vh;
	max-width: 500px;
}

.slider-nav {
	position: fixed;
	padding: 1rem;
	width: 100%;
	line-height: 1;
	display: grid;
	grid-template-areas: 'prev next';
	bottom: 0;
	right: 0;
	z-index: 2;
	justify-content: space-between;
}

.slider-nav__item {
	line-height: 1.5;
	position: relative;
	text-transform: uppercase;
	display: block;
	font-size: clamp(1rem,6vw,1rem);
	transition: opacity 0.3s;
}

.slider-nav__item span {
	display: inline-block;
	pointer-events: none;
}

.slider-nav__item:hover {
	opacity: 0.5;
}

.slider-nav__item--prev {
	grid-area: prev;
}

.slider-nav__item--next {
	grid-area: next;
}

.content-open .slider-nav__item--next,
.content-open .slider-nav__item--prev,
.slider-nav__item--back {
	opacity: 0;
	pointer-events: none;
}

.slider-nav__item--back {
	grid-area: next;
}

.content-open .slider-nav__item--back {
	pointer-events: auto;
	opacity: 1;
}

@media screen and (min-width: 53em) {
	.frame { 
		height: 100vh; 
		grid-gap: 2rem;
		grid-template-columns: auto auto 1fr;
		grid-template-rows: auto auto;
		grid-template-areas: 'title demos sponsor' 'credits ... ... ';
	}
	.frame__demos {
		justify-self: end;
	}
	.slider-nav {
		justify-content: end;
		width: auto;
		padding: 2rem;
		grid-template-areas: 'prev' 'next';
		justify-items: end;
	}
	.slider-nav__item {
		line-height: 1;
	}
	.slider-nav__item--prev {
		margin-right: 5vw;
	}
}
