
@font-face {
	font-family: 'IBM Plex Sans';
	src: url("/api/public/p/aHR0cHM6Ly93d3cuY2hyaXNsYXV4LmNvbS9mb250cy9JQk1QbGV4U2Fucy1SZWd1bGFyLm90Zg") format("opentype");
}

@font-face {
    font-family: 'IBM Plex Sans';
    font-weight: bold;
    src: url("/api/public/p/aHR0cHM6Ly93d3cuY2hyaXNsYXV4LmNvbS9mb250cy9JQk1QbGV4U2Fucy1Cb2xkLm90Zg") format("opentype");
}

@font-face {
    font-family: 'IBM Plex Sans';
    font-style: italic;
    src: url("/api/public/p/aHR0cHM6Ly93d3cuY2hyaXNsYXV4LmNvbS9mb250cy9JQk1QbGV4U2Fucy1JdGFsaWMub3Rm") format("opentype");
}

body {
	background-color: #F6F6EE;
	font-family: "IBM Plex Sans", sans-serif;
	text-size-adjust: none;
}

.flag-icon {
	background-size: contain;
	background-position: 50%;
	background-repeat: no-repeat;
	position: relative;
	display: inline-block;
	width: 1.33333333em;
	line-height: 1em;
}

.flag-icon:before {
	content: "\00a0";
}

.flag-icon-de {
	background-image: url(/api/public/p/aHR0cHM6Ly93d3cuY2hyaXNsYXV4LmNvbS9mbGFncy9kZS5zdmc);
	float: right;
	clear: right;
}

.flag-icon-gb {
	background-image: url(/api/public/p/aHR0cHM6Ly93d3cuY2hyaXNsYXV4LmNvbS9mbGFncy9nYi5zdmc);
	float: right;
	clear: right;
}

section {
	margin-top: 100pt;
	margin-bottom: 20pt;
	clear: both;
}

h1 {
	clear: both;
}

h1, h2, h3, h4, p {
	margin-left: 10%;
	width: 70%;
}

h1 {
	padding-top: 3%;
}

p {
	font-size: 1em;
}

a {
	text-decoration: none;
}

a#home {
	color: #333;
	font-size: 14pt;
	float: left;
}

div#top_banner {
	background-color: #d4d6a2;
	position: absolute;
	width: 100%;
	left: 0;
	top: 0;
}

div#top_banner_text {
	text-align: center;
	padding: 7pt;
	margin-bottom: 5pt;
}

a#home img,
img#home {
	width: 65pt;
	margin-top: 30pt;   /* only used together with banner above */
}

/* On narrow screens the banner text wraps and outgrows the fixed 30pt
   offsets, covering the logo, date and flag. Put the banner in normal
   flow instead; the negative margins cancel the default 8px body margin
   so it still spans the full width. */
@media screen and (max-width: 600px) {
	div#top_banner {
		position: relative;
		width: auto;
		margin: -8px -8px 8px;
	}

	a#home img,
	img#home {
		margin-top: 0;
	}
}

@media screen and (max-width: 500px) {

	a#home {
		font-size: 9pt;
	}

	/* vw rather than %: the % resolved against the shrink-wrapped link,
	   leaving the logo much smaller than on the front page */
	a#home img,
	img#home {
		width: 12vw;
	}
}

li {
	clear: left;
}

li a span {
	padding-left: 18pt;
}

li a img {
	width: 120pt;
	border: solid 1pt #999;
	padding: 2pt;
	vertical-align: middle;
	display: inline-block;
}

div.subpage_title {
	padding-top: 20pt;
	display: inline-block;
}

span.short_title {
	color: #111;
	display: block;
}

span.byline {
	color: #555;
	font-size: 70%;
	margin-top: 3pt;
	display: block;
}

span.new {
	color: #2757C1;
	padding-left: 10pt;
}

@media screen and (max-width: 800px) {
	div.subpage_title {
		width: 300px;
		padding-top: 6pt;
	}
}

@media screen and (max-width: 600px) {
	li a img {
		display: block;
	}

	div.subpage_title {
		padding-top: 6pt;
		padding-bottom: 10pt;
		display: block;
	}
}

span#date {
	float: right;
	margin-top: 30pt;   /* only used together with banner above */
}

/* Banner is in normal flow on narrow screens (see div#top_banner), so
   the date starts level with the logo top. Kept after the rule above,
   which would otherwise win at equal specificity. */
@media screen and (max-width: 600px) {
	span#date {
		margin-top: 0;
	}
}

ul {
	list-style: none;
	margin-left: 8%;
	margin-bottom: 25pt;
}

li {
	margin-bottom: 15pt;
}

div.drawing {
	overflow: auto;
	text-align: center;
	width: 100%;
	margin: 0;
}

/* The knn page uses d3 SVGs sized in fixed pixels. Give them a small margin
   and let them shrink to fit narrower (mobile) screens; the viewBox set in
   knn.js keeps the aspect ratio while max-width caps the rendered width. */
div[id^="drawing_knn"] {
	box-sizing: border-box;
	padding: 0 10px;
}

div[id^="drawing_knn"] svg {
	max-width: 100%;
	height: auto;
}

/* Same treatment for the kmeans page: its d3 SVGs are sized in fixed pixels
   but carry a viewBox (set in kmeans.js), so max-width lets them shrink to
   fit narrow (mobile) screens while keeping their aspect ratio. */
div[id^="drawing_kmeans"] {
	box-sizing: border-box;
	padding: 0 10px;
}

div[id^="drawing_kmeans"] svg {
	max-width: 100%;
	height: auto;
}

div.imagetext {
	width: 100%;
	text-align: center;
}

span.imagetext {
	font-size: 10pt;
}

.default-pointer {
	cursor: default;
}

.click-pointer {
	cursor: pointer;
}

div.definitions {
	clear: both;
}

div.about {
	padding-top: 60pt;
	clear: both;
}

div.about p, div.definitions p {
	width: 350pt;
	padding-bottom: 20pt;
}

@media screen and (max-width: 600px) {
	div.about p, div.definitions p {
		width: 75%;
	}
}

div.icons {
	text-align: center;
}

div.icons img {
	width: 3%;
	margin-left: 1%;
	margin-right: 1%;
	cursor: pointer;
}

div.icons img:active {
	transform: scale(1.5);
}

div.sharethis-inline-share-buttons {
	margin-top: 28pt;
}

div.map {
	overflow: auto;
	width: 90%;
	height: 38vw;
	margin: auto;
	border: solid #777 1px;
	padding: 6px;
}

div#map_intro_text {
	margin-bottom: 1.5vw;
}

span#map_intro_name {
	font-size: 14pt;
}

a.osm-attribution {
	color: #aaa;
	font-size: 9pt;
    display: block;
    width: 90%;
    margin: 0 auto 2vw;
    text-align: right;
}

/* Footer, shared by all pages: centred, items separated by dots */
footer {
	clear: both;
	box-sizing: border-box;
	max-width: 1200px;
	margin: 56px auto 0;
	padding: 20px clamp(24px, 5vw, 48px) 32px;
	border-top: 1px solid #D4D6A2;
	text-align: center;
	line-height: 1.8;
}

footer, footer a {
	color: #777;
	font-size: 0.9375rem;
}

footer a:hover {
	color: #111;
}

/* inline-block keeps each item whole when the line wraps */
footer > * {
	display: inline-block;
}

footer > * + *::before {
	content: "·";
	display: inline-block;
	padding: 0 0.6em;
	color: #999;
}

/* On narrow screens the copyright gets its own line, without a leading dot */
@media screen and (max-width: 600px) {
	footer > span {
		display: block;
	}

	footer > span::before {
		content: none;
	}
}

/* ------------------------------------------------------------------
   Front page (index_page.html). Everything is scoped to body.front so
   the algorithm pages keep their existing layout.
   ------------------------------------------------------------------ */

body.front {
	--paper: #F6F6EE;
	--olive: #D4D6A2;
	--ink: #111;
	--ink-soft: #555;
	--hairline: #999;
	--green: #248232;
	--blue: #2757C1;
	--gutter: clamp(24px, 5vw, 48px);
	--measure: 1200px;

	margin: 0;
	color: var(--ink);
	line-height: 1.5;
	-webkit-text-size-adjust: 100%;
	text-size-adjust: 100%;
}

@media (prefers-reduced-motion: no-preference) {
	html:has(body.front) {
		scroll-behavior: smooth;
	}
}

body.front a:focus-visible {
	outline: 2px solid var(--green);
	outline-offset: 3px;
}

/* Reset the global page rules that assume the old flowing layout */
body.front h1,
body.front h2,
body.front p {
	margin-left: 0;
	width: auto;
	padding-top: 0;
}

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

body.front li {
	clear: none;
	margin: 0;
}

/* Masthead */
body.front .masthead {
	max-width: var(--measure);
	margin: 0 auto;
	/* same offset below the absolutely positioned banner as a#home img on
	   the other pages (body margin + 30pt) */
	padding: calc(8px + 30pt) var(--gutter) 0;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

/* On narrow screens the banner is in normal flow (see div#top_banner);
   the front page has no body margin to cancel */
@media screen and (max-width: 600px) {
	body.front div#top_banner {
		margin: 0;
	}

	body.front .masthead {
		padding-top: 12px;
	}
}

body.front .brand {
	display: block;
	line-height: 0;
}

/* Same logo size as on the other pages */
body.front img.brand {
	width: 65pt;
	height: auto;
	margin: 0;
}

@media screen and (max-width: 500px) {
	body.front img.brand {
		width: 12vw;
	}
}

body.front .lang {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	color: var(--ink-soft);
	font-size: 0.9375rem;
	padding: 6px 0;
}

body.front .lang:hover {
	color: var(--ink);
}

body.front .lang .flag-icon {
	float: none;
	width: 1.25em;
	height: 0.9em;
}

/* Main column */
body.front main {
	max-width: var(--measure);
	margin: 0 auto;
	padding: 0 var(--gutter);
}

/* Hero */
body.front .hero {
	margin: 0;
	padding: clamp(32px, 7vw, 88px) 0 clamp(40px, 6vw, 72px);
}

body.front .hero h1 {
	max-width: 17ch;
	margin: 0 0 24px;
	font-size: clamp(2.125rem, 5.2vw, 4rem);
	line-height: 1.06;
	letter-spacing: -0.025em;
	font-weight: bold;
}

body.front .hero .intro {
	max-width: 60ch;
	margin: 0 0 36px;
	font-size: clamp(1rem, 1.6vw, 1.1875rem);
	line-height: 1.6;
	color: #333;
}

body.front .topics ul {
	display: flex;
	flex-wrap: wrap;
	gap: 10px 28px;
}

body.front .topics a {
	color: var(--ink);
	font-weight: bold;
	border-bottom: 2px solid var(--olive);
	padding-bottom: 2px;
	transition: border-color 150ms ease;
}

body.front .topics a:hover {
	border-bottom-color: var(--green);
}

body.front .topics .count {
	font-weight: normal;
	color: var(--ink-soft);
	font-size: 0.8125em;
	margin-left: 6px;
}

/* Categories: sticky heading on the left, previews on the right */
body.front .category {
	margin: 0;
	padding: 36px 0 56px;
	border-top: 1px solid var(--olive);
	scroll-margin-top: 16px;
}

body.front .category h2 {
	margin: 0 0 24px;
	font-size: 1.375rem;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

@media screen and (min-width: 900px) {
	body.front .category {
		display: grid;
		grid-template-columns: 11rem 1fr;
		gap: 32px;
		align-items: start;
	}

	body.front .category h2 {
		position: sticky;
		top: 24px;
		margin: 0;
	}
}

body.front .cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(0, 14rem));
	gap: 40px 28px;
}

body.front .card a {
	display: block;
	color: var(--ink);
}

/* Cancel the global "li a span" indent for the text only; a broader
   selector would also override the image frame's padding */
body.front .card_title,
body.front .card_byline {
	padding-left: 0;
}

/* Preview framed in the same hairline grey the visualisations use; the
   frame turns green on hover, like the highlighted edge in the logo. */
body.front .card_image {
	display: block;
	padding: 3px;
	border: 1px solid var(--hairline);
	background: var(--paper);
	transition: border-color 150ms ease, box-shadow 150ms ease;
}

body.front .card a:hover .card_image,
body.front .card a:focus-visible .card_image {
	border-color: var(--green);
	box-shadow: 0 0 0 1px var(--green);
}

body.front .card a:focus-visible {
	outline: none;
}

body.front .card img {
	display: block;
	width: 100%;
	height: auto;
	border: 0;
	padding: 0;
}

body.front .card_title {
	display: block;
	margin-top: 14px;
	font-weight: bold;
	font-size: 1.0625rem;
	line-height: 1.3;
}

body.front .card a:hover .card_title {
	color: var(--green);
}

body.front .card .new {
	display: inline-block;
	margin-left: 8px;
	padding: 0 6px;
	border: 1px solid var(--blue);
	border-radius: 2px;
	color: var(--blue);
	font-size: 0.75rem;
	font-weight: normal;
	line-height: 1.5;
	vertical-align: 2px;
}

body.front .card_byline {
	display: block;
	margin-top: 4px;
	color: var(--ink-soft);
	font-size: 0.9375rem;
	line-height: 1.45;
}

/* About */
body.front .about {
	margin: 0;
	padding: 48px 0 16px;
	border-top: 1px solid var(--olive);
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
	gap: 24px 48px;
}

body.front .about h2 {
	margin: 0 0 8px;
	font-size: 1.125rem;
}

body.front .about p {
	max-width: 60ch;
	margin: 0;
	padding: 0;
	color: #333;
}

/* Share prompt (emitted by layout.html after main) */
body.front > p,
body.front div.sharethis-inline-share-buttons {
	max-width: var(--measure);
	margin-left: auto;
	margin-right: auto;
	padding-left: var(--gutter);
	padding-right: var(--gutter);
	box-sizing: border-box;
}

body.front > p {
	margin-top: 40px;
	color: var(--ink-soft);
}

body.front div.sharethis-inline-share-buttons {
	margin-top: 12px;
}
