/* 
CSS written by: Cyd

Most selectors you’ll need are here. Feel free to add as many as you need.
*/

@font-face {
	font-family: "Instrument Serif";
	src: url("https://cydstumpel.nl/externals/InstrumentSerif-Regular.woff2") format("woff2"),
		url("https://cydstumpel.nl/externals/InstrumentSerif-Regular.woff") format("woff");
	font-weight: 400;
	font-style: normal;
}

@font-face {
	font-family: "Instrument Serif";
	src: url("https://cydstumpel.nl/externals/InstrumentSerif-Italic.woff2") format("woff2"),
		url("https://cydstumpel.nl/externals/InstrumentSerif-Italic.woff") format("woff");
	font-weight: 400;
	font-style: italic;
}

@font-face {
	font-family: "Times New Roman";
	src: local("Times New Roman");
	size-adjust: 82%;
}

* {
	box-sizing: border-box;
	margin: 0;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-family: 'Instrument Serif', 'Times New Roman', serif;
}

:root {
	--background-color: #ececec;
	--text-color: #000;
	--grid-columns: repeat(12, 1fr);
	--grid-columns-main: repeat(9, 1fr);
	--grid-gap: 1.5rem;
	--padding: 1.5rem;
	--max-width: 1600px;
	--bezier-out: cubic-bezier(0.25, 1, 0.5, 1);
	/* ease-out-quart */
	--bezier-in: cubic-bezier(0.11, 0, 0.5, 0);

	/* ease-in-quad */

}

@media (max-width: 1024px) {
	:root {
		--grid-columns: repeat(6, 1fr);
		--grid-columns-main: repeat(6, 1fr);
		--grid-gap: 1rem;
		--padding: 1rem;
	}
}

html {
	background: var(--text-color);
}

body {
	display: grid;
	grid-template-columns: var(--grid-columns);
	gap: var(--grid-gap);
	align-items: start;
	padding: var(--padding);

	background-color: var(--background-color);
	color: var(--text-color);

	@media (prefers-reduced-motion: no-preference) {
		animation-name: translate-up, clip-in;
		animation-duration: 0.7s, 0.6s;
		animation-delay: 0.1s, 0.5s;
		animation-fill-mode: both;
		animation-timing-function: var(--bezier-out);
	}
}

time {
	background-color: var(--text-color);
	color: var(--background-color);
	padding: 0.1rem 0.3rem;
	border-radius: 0.25rem;
	white-space: nowrap;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	font-weight: 400;
}

h1 {
	font-size: 15.2vw;
	line-height: 1;

}

@media (max-width: 1024px) {
	h1 {
		font-size: 14vw;
	}
}

h2 {
	font-size: max(2rem, 5vw);
	line-height: 1.1;
}

h3 {
	font-size: max(1.75rem, 4vw);
	line-height: 1.1;
}

h4,
summary {
	font-size: max(1.25rem, 2vw);
	line-height: 1.1;
}

p,
details {
	font-size: max(1rem, 1.5vw);
	line-height: 1.5;
}

a {
	color: inherit;
}

aside>*:not(h1, h2, h3, h4, h5) {
	font-size: max(1rem, 1.25vw);
	line-height: 1.3;
}

section p:first-of-type,
footer p:first-of-type {
	font-size: clamp(1.15rem, 1.75vw, 2.25rem);
}

h1,
h2,
h3,
h4 {

	&+p,
	&+ul,
	&+ol {
		margin-top: 0.8em;
	}
}

p {

	&+p,
	&+ul,
	&+ol {
		margin-top: 1em;
	}

	&+h1,
	&+h2,
	&+h3,
	&+h4 {
		margin-top: 1.25em;
	}
}


header {
	pointer-events: none;
	position: relative;
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: var(--grid-columns);
	z-index: 1;
	overflow: clip;
	gap: var(--grid-gap);
	align-items: end;
	padding-bottom: var(--padding);
	padding-top: var(--padding);

	/* nesting only with modern css properties */
	@media (prefers-reduced-motion: no-preference) {
		@supports (container-type: scroll-state) {
			position: sticky;
			top: 0;

			container-name: sticky-header;
			container-type: scroll-state;
		}
	}
}

@supports (grid-template-columns: subgrid) {
	header {
		grid-template-columns: subgrid;
	}
}

/* nesting only with modern css properties */
@container sticky-header scroll-state(stuck: top) {
	header {
		p {
			opacity: 0;
			visibility: hidden;
			transition: opacity 0.2s var(--bezier-out), visibility 0s 0.2s allow-discrete;
		}

		&::before {
			opacity: 0;
		}
	}
}

header::before {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	border-bottom: 1px solid var(--text-color);
	transition: opacity 0.2s var(--bezier-out);

	/* Fine if this doesnt play on old browsers */
	@media (prefers-reduced-motion: no-preference) {
		animation: clip-from-left 0.6s 0.6s var(--bezier-out) both;
	}
}

header::after {

	position: absolute;
	top: 0;
	left: calc(var(--padding) * -1);

	right: calc(var(--padding) * -1);

	height: 5.5vw;
	background: var(--background-color);
	z-index: -1;
	border-bottom: 1px solid var(--text-color);

	@media (prefers-reduced-motion: no-preference) {
		content: '';
	}

	@media (prefers-reduced-motion: no-preference) {
		animation-name: clip-from-left;
		animation-duration: 0.6s;
		animation-timing-function: var(--bezier-in);
		animation-fill-mode: both;
		animation-timeline: view();
		animation-range: entry 115svh entry 125svh;

		@media (width < 1024px) {
			animation-range: entry 115svh entry 120svh;
		}
	}
}

@media (max-width: 1024px) {
	header::after {
		height: 7vw;
		min-height: 2.7rem;
	}
}



header h1 {
	clip-path: inset(-10%);
	grid-column: 1 / -1;
	transition: transform 0.4s var(--bezier-in);
	transform-origin: top left;

	@media (prefers-reduced-motion: no-preference) {
		@supports (container-type: scroll-state) {
			animation-name: scale-header-down;
			animation-duration: 0.6s;
			animation-timing-function: var(--bezier-in);
			animation-fill-mode: both;
			animation-timeline: view();
			animation-range: entry 100svh entry 115svh;
		}
	}


}

header span {

	/* fine if this doesnt work on old browsers */
	@media (prefers-reduced-motion: no-preference) {
		display: inline-block;
		transform: translateY(120%);
		animation: animate-up 0.6s var(--bezier-out) both;

		@supports (animation-delay: calc(0.04s * (sibling-count() - sibling-index()))) {
			animation-delay: calc(0.04s * sibling-index() + 0.4s);
		}
	}
}

header span:nth-of-type(3) {
	font-style: italic;
}


header p {
	grid-column: span 4;
	transition: opacity 0.2s var(--bezier-out), visibility 0.2s allow-discrete;

	/* fine if this doesnt work on old browsers */
	@media (prefers-reduced-motion: no-preference) {
		animation: animate-up 0.6s 0.5s var(--bezier-out) both;
	}
}

@media (max-width: 1024px) {
	header p {
		grid-column: span 3;
	}
}

header p:has(a) {
	grid-column: span 2 / -1;

}

@media (max-width: 1024px) {
	header p:has(a) {
		grid-column: span 3 / -1;
	}
}

header a {
	display: block;
	width: max-content;
	margin-left: auto;
	background-color: var(--text-color);
	color: var(--background-color);
	padding: 0.5rem 1rem;
	border-radius: 0.5rem;
	text-decoration: none;
	font-size: clamp(1rem, 2vw, 2rem);
	transition: background-color 0.3s ease;
	pointer-events: auto;
}


main {
	grid-column: span 9;
	display: grid;
	grid-template-columns: var(--grid-columns-main);
	gap: var(--grid-gap);

}

@media (max-width: 1024px) {
	main {
		grid-column: 1 / -1;
	}
}

main,
aside {
	@media (prefers-reduced-motion: no-preference) {
		animation: fade-in 0.6s 0.4s var(--bezier-out) both;
	}
}

main>h2 {
	grid-column: 1/-1;
	max-width: 30ch;
	text-wrap: balance;
}

main>p {
	grid-column: span 4;

}

@media (max-width: 1024px) {
	main>p {
		grid-column: span 5;
	}
}

main>p:nth-of-type(odd) {
	grid-column: 2 / span 4;

}

@media (width < 1024px) {
	main>p:nth-of-type(odd) {
		grid-column: span 5;
	}
}

aside:first-of-type {
	grid-column: span 3 / -1;
	background-color: var(--background-color);

	/* Fine if this doesnt work on old browsers */
	@media (prefers-reduced-motion: no-preference) {
		position: sticky;
		top: calc(var(--padding) + 5.5vw);
		margin-bottom: 100vh;

		@media (width < 1024px) {
			position: relative;
			top: 0;
			margin-bottom: 0;
		}
	}


	@media (width < 1024px) {
		grid-column: 1 / -1;
	}

}

aside:nth-of-type(1) {
	grid-row: 2;
}

aside {
	grid-column: 1 / -1;
	background-color: var(--background-color);
	padding: var(--padding);
	border: 1px solid var(--text-color);
	border-radius: 0.5rem;
}

img {
	width: 100%;
}

section {
	position: relative;
	grid-row-gap: 0;
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: var(--grid-columns-main);
	gap: 0 var(--grid-gap);
	border-top: 1px solid var(--text-color);
	padding-top: var(--padding);

	@supports (grid-template-columns: subgrid) {
		grid-template-columns: subgrid;
	}
}

section h3 {
	grid-column: 1 / -1;
}

section * {
	grid-column: 2 / -1;
}


section ul {
	list-style-type: '';
	padding: 0;
	display: grid;
	gap: var(--grid-gap);
	align-items: center;
	grid-template-columns: repeat(8, 1fr);

	@supports (grid-template-columns: subgrid) {
		grid-template-columns: subgrid;
	}

}

section ul li {
	position: relative;
	grid-column: span 4;
	padding: var(--padding);
	border: 1px solid var(--text-color);
	border-radius: 0.5rem;
	display: flex;
	flex-direction: column-reverse;
	gap: 0.5rem;
	font-size: max(1.5rem, 3vw);
	background-color: var(--background-color);

	/* Fine if this doesnt work on old browsers */
	@media (prefers-reduced-motion: no-preference) {
		animation-duration: 0.6s;
		animation-timing-function: var(--bezier-out);
		animation-fill-mode: both;
		animation-timeline: view();
		animation-range: contain contain 90%;

		&:nth-of-type(even) {
			animation-name: from-center-to-left;
		}

		&:nth-of-type(odd) {
			animation-name: from-center-to-right;
		}
	}

}

section ul li a {
	text-decoration: none;

}

section ul li a::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
}

h2+details {
	margin-top: var(--padding);
}

details {
	border: 1px solid var(--text-color);
	padding: var(--padding) var(--padding) 0;
	border-radius: 0.5rem;

}
details[open] {
	padding-bottom: var(--padding);
}

details+details {
	margin-top: calc(var(--padding) * 0.5);
}

summary {
	display: flex;
	justify-content: space-between;
	gap: var(--padding);
	cursor: pointer;
	list-style: none;
	padding-bottom: var(--padding);
}

summary::after {
	content: '+';
	flex-shrink: 0;
}

summary::-webkit-details-marker {
	display: none;
}

@supports (interpolate-size: allow-keywords) {

	::details-content {
		padding-top: 0.25rem;
		height: 0;
		overflow: clip;

		@media (prefers-reduced-motion: no-preference) {
			transition: height 0.5s ease, content-visibility 0.5s ease allow-discrete;
		}
	}
}

@supports (interpolate-size: allow-keywords) {
	:root {
		interpolate-size: allow-keywords;
	}

	[open]::details-content {
		height: auto;
	}
}

details summary:focus-visible {
	outline: none;
}

details:focus-within {
	outline: 2px dashed var(--text-color);
	outline-offset: 2px;
}

a:focus-visible {
	outline: 2px dashed var(--text-color);
	outline-offset: 2px;
}

footer {
	display: grid;
	grid-template-columns: var(--grid-columns);
	gap: 0 var(--grid-gap);
	border-top: 1px solid var(--text-color);
	grid-column: 1 / -1;
	padding: var(--padding);

	@supports (grid-template-columns: subgrid) {
		grid-template-columns: subgrid;
	}
}

footer>h2,
footer>p {
	grid-column: 1 / span 6;
}

footer p+ul {
	grid-column: 1 / -1;
	display: flex;
	gap: var(--grid-gap);
	flex-wrap: wrap;
	list-style-type: '';
	padding: 0;
	grid-row: 0;
	font-size: max(1rem, 2vw);
}

footer h3 {
	margin-top: 0.5em;
	grid-column: 1 /span 3;
}

footer h3+ul {
	grid-column: 1 / span 3;
	list-style-type: '';
	padding: 0;
	display: flex;
	gap: var(--grid-gap);
	flex-wrap: wrap;
}

footer li {
	grid-column: span 4;
}

footer h3+ul li a {
	display: block;
	padding: 0.5rem;
	border-radius: 0.5rem;
	border: 1px solid var(--text-color);
	text-decoration: none;
	transition: background-color 0.3s ease;

	&:hover {
		background-color: var(--text-color);
		color: var(--background-color);
	}
}

@keyframes animate-up {
	0% {
		transform: translateY(150%);
	}

	100% {
		transform: translateY(0);
	}
}

@keyframes clip-in {
	0% {
		clip-path: inset(0 round 0.5rem);
	}

	100% {
		clip-path: inset(calc(var(--padding) * 0.5) round 0.5rem);
	}
}

@keyframes clip-from-left {
	0% {
		clip-path: inset(0 100% 0 0);
	}

	100% {
		clip-path: inset(0 0 0 0);
	}
}

@keyframes fade-in {
	0% {
		opacity: 0;
	}

	100% {
		opacity: 1;
	}
}

@keyframes scale-header-down {
	0% {
		transform: scale(1);
	}

	100% {
		transform: scale(0.2);
	}
}

@keyframes from-center-to-left {
	0% {
		transform: translateX(-20%) rotate(2deg);
	}

	100% {
		transform: translateX(0);
	}
}

@keyframes from-center-to-right {
	0% {
		transform: translateX(20%) rotate(-2deg);
	}

	100% {
		transform: translateX(0);
	}
}