/*     _           _        _       
   ___| | ___  ___| |_ _ __(_) ___  
  / _ \ |/ _ \/ __| __| '__| |/ __| 
 |  __/ |  __/ (__| |_| |  | | (__  
  \___|_|\___|\___|\__|_|_ |_|\___| 
 | |__   ___   ___ | | _| | ___| |_ 
 | '_ \ / _ \ / _ \| |/ / |/ _ \ __|
 | |_) | (_) | (_) |   <| |  __/ |_ 
 |_.__/ \___/ \___/|_|\_\_|\___|\__|


CSS written by: vini sdl
https://codeberg.org/vsdl
*/




/* Variables */
/* ========= */

:root {

	/* Main colors */
	--fg: #333;
	--bg: hwb(60 90% 10%);
	--bg-inset: #ececec;
	--bg-page: #fff;
	--link: #3d0795;
	--link-hover: #6200ff;
	--link-visited: #7b669d;
	
	--accent: darkolivegreen;
	--accent-dimmed: #cbe2b9;

	/* Page size */
	--page-w: 560px;
	--page-h: 740px;
	
	/* Page properties */
	--page-border: 6px solid oklch(from var(--accent-dimmed) 0.75 calc(c / 2) h);
	--page-radius: 12px;
	--page-inner-radius: 2px;
	--page-padding: 0.5rem;
	--page-shadow: 0 2px 28px rgba(0, 0, 0, 0.1);
	--page-separator-rule: 4px dotted oklch(from var(--fg) l c h / 0.2);

	/* Content properties */
	--content-width: 500px;
	--content-padding: 1rem;
	--content-font-family: 'Iowan Old Style', 'Palatino Linotype', serif;
	--content-font-size: 105%;
	--content-font-size-desktop: 125%;
	--content-line-height: 1.45;
	--font: 'Iowan Old Style', 'Palatino Linotype', serif;

	/* Color relative transform */
	--color-transform-05: -0.05;
	--color-transform-10: -0.1;
	--color-transform-15: -0.15;
	--color-transform-20: -0.2;

	/* Custom scrollbar */
	--scrollbar-size: 28px;
	--scrollbar-button-bg: var(--accent-dimmed);
	--scrollbar-button-bg-hover: oklch(from var(--accent-dimmed) calc(l + var(--color-transform-10)) calc(c + 0.1) h);
	--scrollbar-button-bg-active: oklch(from var(--accent-dimmed) calc(l + var(--color-transform-20)) calc(c + 0.2) h);
	--scrollbar-button-demilune: 2px;

	--scrollbar-track-bg: var(--bg);
	--scrollbar-track-border-color: oklch(from var(--fg) l c h / 0.4);

	--scrollbar-thumb-bg: var(--bg-page);
	--scrollbar-thumb-border-color: oklch(from var(--fg) l c h / 0.4);

	--scrollbar-track-piece-bg: oklch(from var(--accent-dimmed) l calc(c * 0.7) h / 0.8);
	--scrollbar-track-piece-border-color: oklch(from var(--scrollbar-track-piece-bg) calc(l - 0.15) c h);

	/* Dotted bg */
	--dot-color: oklch(from var(--bg) calc(l + var(--color-transform-15)) c h);

	/* Icons assets */
	--icon-chevron-right: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>');
	--icon-chevron-left:  url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>');
}

@media (prefers-color-scheme: dark) {
	:root {
		--fg: #fff;
		--bg: #101011;
		--bg-inset: #353c38;
		--bg-page: #262a28;
		--link: #ae8be8;
		--link-hover: #d5baff;
		--link-visited: #9180b0;
		
		--accent: #6c902e;
		--accent-dimmed: #314837;

		--color-transform-10: 0.1;
		--color-transform-15: 0.15;
		--color-transform-20: 0.2;

		--page-border: 6px solid oklch(from var(--accent-dimmed) 0.4 calc(c / 2) h);
		
		--scrollbar-thumb-bg-hover: oklch(from var(--accent-dimmed) calc(l + var(--color-transform-10)) calc(c + 0.1) h);
		--scrollbar-track-border-color: oklch(from var(--fg) l c h / 0.2);
		--scrollbar-track-piece-border-color: transparent;

		--page-shadow: 0 2px 28px black;

		--icon-chevron-right: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m9 18 6-6-6-6"/></svg>');
	--icon-chevron-left:  url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="m15 18-6-6 6-6"/></svg>');
	}
}


/* Main Structure */
/* ============== */

html, body {
	margin: 0;
	padding: 0;
	overflow-y: hidden;
	scroll-behavior: auto;
	box-sizing: border-box;
	font-family: var(--content-font-family);
}

/* background noisy texture */
html:after {
	content: "";
	width: 100%;
	height: 100%;
	pointer-events: none;
	background: url("../images/electric-booklet--bg.png") no-repeat;
	background-size: cover;
	background-position: top;
	position: absolute;
	left: 0;
	top: 0;
	mix-blend-mode: multiply;
	opacity: 0.2;

	@media (prefers-color-scheme: dark) {
		mix-blend-mode: screen;
		opacity: 0.1;
	}

	@media (min-resolution: 2x) {
		background-size: cover;
	}
}

html {
	background: var(--bg);
	color: var(--fg);
	width: min(var(--page-w), 100dvw);
	height: min(var(--page-h), 100dvh);
	border: var(--page-border);
	border-radius: var(--page-radius);
	margin: calc((100dvh - min(var(--page-h), 100dvh)) / 2) auto;
	padding: var(--page-padding);
	box-shadow: var(--page-shadow);

	container-type: size;
	container-name: desktop;

	/* Small viewport adjustments */
	@media (height < 740px) and (width < 560px) {
		margin: 0;
	}
	@media (height < 740px) {
		border-block: none;
		border-radius: 0;
	}
	@media (width < 560px) {
		border-inline: none;
		border-radius: 0;
	}
}

/* Dotted background pattern */
html {
	--dot-color: oklch(from var(--bg) calc(l - 0.15) c h);
	background-image: radial-gradient(var(--dot-color) 1px, transparent 1px), radial-gradient(var(--dot-color) 1px, transparent 1px);
	background-size: 24px 24px;
	background-position: 0 0, 12px 12px;
	background-color: var(--bg);
}

body > :where(header, main, aside, footer) {
	padding: var(--content-padding);
}


body {
	--page-computed-height: calc(100cqh - (var(--content-padding) * 2) - var(--scrollbar-size));
	--page-computed-gap: calc((100cqw - var(--content-width)) / 2);

	anchor-name: --body;
	font-size: var(--content-font-size);
	line-height: var(--content-line-height);
	padding-inline: var(--page-computed-gap);
	padding-block: var(--content-padding);
	background: var(--bg-page, var(--bg));
	outline: calc(var(--page-padding) + 1px) solid var(--bg-page);
	box-shadow: var(--page-shadow);
	border-radius: var(--page-inner-radius);
	margin-inline: auto;
	max-height: 100cqh;
	overflow: auto;
	min-height: 100%;

	@media (height < 740px) or (width < 560px) {
		border-radius: 0;
	}
	@media (height < 740px) and (width < 560px) {
		padding-block: 0.5em;
	}
	@media (height >= 740px) or (width >= 560px) {
		font-size: var(--content-font-size-desktop);
	}

	@supports selector(body::column) {
		column-width: var(--content-width);
		column-gap: max(var(--page-computed-gap), 128px);
		column-rule: var(--page-separator-rule);
		scroll-snap-type: both mandatory;
		overscroll-behavior-x: contain;
		overflow-y: hidden;
		
		&::column {
			scroll-snap-align: center;
		}

		@media (width < 560px) {
			column-gap: 50vw;
		}
	}

	img {
		max-inline-size: stretch;
	}
}

/* Links */
a {
	color: var(--link);

	&:visited {
		color: var(--link-visited);
	}

	&:hover {
		color: var(--link-hover);
	}
}


/* Chunky scrollbars */
/* ================= */

::-webkit-scrollbar {
	height: var(--scrollbar-size);
}
::-webkit-scrollbar-button {
	width: var(--scrollbar-size);
	height: var(--scrollbar-size);
	background-color: var(--scrollbar-button-bg);
	background-repeat: no-repeat;
	background-position: center center;
	cursor: pointer;
	border-radius: 100%;
}
::-webkit-scrollbar-button:hover {
	background-color: var(--scrollbar-button-bg-hover);
}
::-webkit-scrollbar-button:active {
	background-color: var(--scrollbar-button-bg-active);
}
::-webkit-scrollbar-button {
	background-image: var(--icon-chevron-right);
	border-left: var(--scrollbar-button-demilune) solid var(--bg-page);
}
::-webkit-scrollbar-button:decrement {
	background-image: var(--icon-chevron-left);
	border-left: 0;
	border-right: var(--scrollbar-button-demilune) solid var(--bg-page);
}
::-webkit-scrollbar-track {
  background: var(--scrollbar-track-bg);
  border: 1px solid var(--scrollbar-track-border-color);
  border-radius: 100px;
}
::-webkit-scrollbar-thumb {
	background: var(--scrollbar-thumb-bg);
	border-radius: 100px;
	border: 1px solid var(--scrollbar-thumb-border-color);
}
::-webkit-scrollbar-thumb:hover {
	background: var(--scrollbar-thumb-bg-hover, var(--scrollbar-thumb-bg));
}
::-webkit-scrollbar-track-piece {
	border: 1px solid var(--scrollbar-track-piece-border-color);
	border-radius: 100px;
	cursor: pointer;
}
::-webkit-scrollbar-track-piece:decrement {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}
::-webkit-scrollbar-track-piece:hover {
	background: var(--scrollbar-track-piece-bg);
}
::-webkit-scrollbar-track-piece:increment {
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}
::-webkit-scrollbar-thumb:hover {
	cursor: grab;
}
::-webkit-scrollbar-thumb:active {
	cursor: grabbing;
}

/* Touch-based devices don't need big scrollbars */
@media (hover: none) {
	:root {
		--scrollbar-size: 10px;
	}
	::-webkit-scrollbar-button {
		width: 0;
	}
	::-webkit-scrollbar-thumb {
		background: var(--scrollbar-button-bg-hover);
	}
}

/* Fallback for custom scrollbar */
@supports not selector(::-webkit-scrollbar) {
	:root {
		/* Sets scrollbar size to zero so it's not part of the page size calc */
		--scrollbar-size: 0px;
		scrollbar-color: var(--scrollbar-track-bg) var(--scrollbar-thumb-bg);
	}
}

/* Page break control */
:is(h1, h2, h3, h4, h5, h6) {
	break-after: avoid;
	break-inside: avoid;
	line-height: normal;
}
:is(h1, h2, h3, h4, h5, h6) + p {
	break-before: avoid;
}


/* ===========================================================================*/
/* ===========================================================================*/
/*	 						Content-specific styles 						  */
/* ===========================================================================*/
/* ===========================================================================*/

h2, h3, h4 {
	text-wrap: balance;
	margin-block-start: 2em;
	line-height: normal;
}
h2 {
	font-size: 2.5rem;
	break-before: column;
	margin-block-start: 0;
}

p {
	text-align: justify;
	hyphens: auto;
}

/* Hero header */
/* =========== */

body > header {
	box-sizing: border-box;
	background: var(--accent-dimmed);
	background: linear-gradient(
		to top right,
		var(--accent-dimmed),
		oklch(from var(--accent-dimmed) l c calc(h + 10))
	);
	border-radius: 8px;
	padding: 1em;
	min-height: var(--page-computed-height);
	box-decoration-break: clone;
	display: flex;
	flex-direction: column;
	justify-content: space-evenly;

	& > :first-child {
		margin-block-start: 0;
	}
	& > :last-child {
		margin-block-end: 0;
	}

	h1 {
		margin-block-end: 0;
		font-size: 2.5rem;
		line-height: 0.8;
		text-wrap: balance;
		letter-spacing: -0.05em;
		font-style: normal;
		text-transform: lowercase;
		text-align: end;

		span {
			display: block;
		}

		& span:nth-child(1) {
			&::before {
				font-weight: 100;
				content: "❀";
				color: var(--accent);
				display: block;
				margin-block-end: 0.3em;
				position: relative;
			}
		}
	}

	p {
		font-size: 1.1em;
		text-wrap: pretty;
		text-align: start;

		time {
			font-weight: bold;
			white-space: nowrap;
		}
	}

	@media (width >= 560px) {
		padding: 1em 2em;

		p {
			font-size: 1.1em;
		}

		h1 {
			font-size: 4rem;
		}
	}

	@media (height < 600px) {
		h1 {
			span {
				display: inline;
				font-size: 0.8em;
			}
		}
	}

	& > p:last-child:has(a) {
		text-align: center;

		a {
			display: block;
			background: var(--accent);
			padding: 0.25em 0.75em;
			color: white;
			border-radius: 8px;
			text-decoration-color: var(--accent-dimmed);

			&:hover {
				background: oklch(from var(--accent) calc(l - var(--color-transform-05)) c h);
			}
			&:active {
				background: oklch(from var(--accent) calc(l - var(--color-transform-10)) c h);
			}
		}
	} 

	& > p:not(:has(a))::after {
		content: " ➺";
		font-size: 2em;
		line-height: 0.5;
		vertical-align: bottom;
		margin: 0;
	}
}

/* Sessions */
/* ======== */

#sessions > ul {
	list-style: none;
	margin: 0;
	padding: 0;

	li {
		display: flex;
		flex-direction: row;
		margin: 0;
		background: var(--bg-inset);
		padding: 0.4em;
		margin-bottom: 0.2em;
		break-inside: avoid;
		box-decoration-break: clone;
		gap: 1ch;
		border-radius: 8px;
		break-inside: avoid;

		a {
			break-before: avoid;
			line-height: normal;
			display: flex;
			flex: 1 1 auto;
			align-self: center;
		}
		img {
			break-after: avoid;
			border-radius: 8px;
			width: 33%;
			min-height: 3lh;
			aspect-ratio: 1.6;
			flex: 0 0 auto;
			object-fit: cover;
		}
	}

	@media (width < 560px) {
		column-count: 1;
		
		li {
			box-sizing: border-box;
			justify-content: center;
		}

		img {
			max-width: 64px;
		}
	}
}

/* Fancy heading */
main h2#what-whould-web,
aside h2,
footer#about h2 {
	margin-block-start: 0;
	font-weight: normal;
	font-style: italic;
	text-wrap: balance;
	line-height: 1.1;
}

@media (height > 500px) {
	main h2#what-whould-web,
	aside h2 {
		margin-block-start: 3em;
	}
}

/* Expanded abbreviation */
h2 > abbr[title] {
	text-decoration: none;

	&::after {
		content: " (" attr(title) ")";
	}
}

main {
	/* Drop cap */
	h2#what-whould-web + p:first-letter {
		font-size: 2lh;
		float: left;
		line-height: 1;
		margin-right: 0.3rem;
	}

	h4 {
		font-weight: normal;
		font-style: italic;
	}
}

/* Asterism separators */
#custom-themes {
	margin-block-start: 1em;
	
	&::before {
		display: block;
		content: "⁂";
		text-align: center;
		padding-block-end: 1em;
	}
}

/* AMS separator */
#about h2:first-child::before {
	content: "✖✖✖";
	display: block;
	text-align: center;
	font-style: normal;
	font-size: 1.5rem;
	margin-block-end: 2rem;
}

/* Print-friendly expanded <details> */
details {
	position: relative;

	&::details-content {
		content-visibility: visible;
	}
}
details summary {
	list-style: none;
	font-weight: bold;
	pointer-events: none;
	break-after: avoid;
}


/* Themes section */
#about h3:last-of-type {
	text-align: center;
	break-before: column;

	/* Flower separator */
	&:before {
		break-after: avoid;
		content: "❀❀❀";
		display: block;
		text-align: center;
		font-style: normal;
		font-size: 1.5rem;
		margin-block-end: 2rem;
	}

	& + ul {
		text-align: center;
		list-style: none;
		margin: 0;
		padding: 0;
		columns: 2;

		li {
			margin-block-end: 0.5em;
		}
	}
}