/* dvlopcore base stylesheet.
   A site sets its look in its own css/site.css, mostly by giving the custom properties
   below other values. Everything here works without them. */

:root {
	--font-family: Verdana, sans-serif;
	--line-height: 1.5;
	--color-text: #000;
	--color-background: #fff;
	--color-link: #00e;
	--color-link-visited: #551a8b;

	/* Keyboard focus: a dark box with light text plus an outline. */
	--focus-text: #fff;
	--focus-background: #000;
	--focus-outline: #000;

	/* Page */
	--page-width: 20cm;
	--content-padding: 10%;

	/* Header: an image (or colour) in a 4:1 band, the site name, the language switcher, the menu. */
	--header-image: none;
	--header-position: center;
	--header-background: #333;
	--header-ratio: 4 / 1;
	--site-name-color: #fff;
	--site-name-size: 3em;
	--site-name-margin: 0.5em 0;
	--site-name-shadow: 0 0 0.2em #000;

	/* Menu and language switcher buttons */
	--nav-background: yellow;
	--nav-text: blue;
	--nav-hover-background: mediumblue;
	--nav-hover-text: #fff;
	--nav-font-size: 16pt;
	--language-switcher-width: 20%;

	/* Language picker: a button in the menu colours that opens a panel with the languages. */
	--picker-background: #fff;
	--picker-text: #000;
	--picker-border: #333;
	--picker-current: mediumblue;

	/* Images in markdown pages float at the end of the text. */
	--image-width: 48%;
}

@media (width < 768px) {
	:root {
		--page-width: 98%;
		--site-name-size: 1.25em;
		--language-switcher-width: 33%;
	}
}

/* Page */

body {
	max-inline-size: var(--page-width);
	margin-inline: auto;
	font-family: var(--font-family);
	line-height: var(--line-height);
	color: var(--color-text);
	background: var(--color-background);
}

a {
	color: var(--color-link);
}

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

:focus-visible {
	outline: 3px solid var(--focus-outline);
	outline-offset: 2px;
}

a:focus-visible {
	font-weight: bold;
	color: var(--focus-text);
	background: var(--focus-background);
}

.sr-only {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	inset-block-start: 0.5rem;
	inset-inline-start: 0.5rem;
	z-index: 10;
	padding: 0.5em 1em;
	transform: translateY(-200%);
}

.skip-link:focus {
	transform: none;
}

/* Header */

.site-header {
	display: flex;
	flex-direction: column;
	aspect-ratio: var(--header-ratio);
	background: var(--header-background) var(--header-image) var(--header-position) / cover no-repeat;
}

.site-name {
	order: 1;
	margin: var(--site-name-margin);
	font-size: var(--site-name-size);
	font-weight: bold;
	font-style: italic;
	text-align: center;
	color: var(--site-name-color);
	text-shadow: var(--site-name-shadow);
}

.site-header ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em 1%;
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-header li {
	flex: 1 1 0;
	min-inline-size: max-content;
}

.site-header nav a {
	display: block;
	padding-inline: 0.25em;
	font-size: var(--nav-font-size);
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	color: var(--nav-text);
	background: var(--nav-background);
}

.site-header nav a:hover {
	text-decoration: underline;
	color: var(--nav-hover-text);
	background: var(--nav-hover-background);
}

.site-header nav a:focus-visible {
	color: var(--focus-text);
	background: var(--focus-background);
}

.site-header nav [aria-current] {
	font-weight: bold;
	text-decoration: underline;
}

.language-switcher {
	order: 0;
	align-self: end;
	inline-size: var(--language-switcher-width);
}

.language-switcher a {
	border-radius: 50%;
}

/* Language picker (header.php, js/language-picker.js): a <details> without JavaScript, a
   <button aria-expanded> with it. Same look for both. */

.language-picker {
	order: 0;
	position: relative;
	align-self: end;
	margin: 0.5em;
	font-size: var(--nav-font-size);
}

.language-picker summary,
.language-picker-button {
	display: flex;
	align-items: center;
	gap: 0.6em;
	padding: 0.35em 0.75em;
	font: inherit;
	line-height: 1.25;
	color: var(--nav-text);
	background: var(--nav-background);
	border: 2px solid currentColor;
	border-radius: 0.3em;
	cursor: pointer;
	list-style: none;
}

.language-picker summary::-webkit-details-marker {
	display: none;
}

/* The chevron: points down when closed, up when open. */
.language-picker summary::after,
.language-picker-button::after {
	content: "";
	flex: none;
	inline-size: 0.45em;
	block-size: 0.45em;
	border-inline-end: 2px solid;
	border-block-end: 2px solid;
	transform: translateY(-0.15em) rotate(45deg);
	transition: transform 0.15s ease-out;
}

.language-picker [open] > summary::after,
.language-picker-button[aria-expanded="true"]::after {
	transform: translateY(0.15em) rotate(-135deg);
}

.language-picker summary:hover,
.language-picker-button:hover {
	color: var(--nav-hover-text);
	background: var(--nav-hover-background);
}

.language-picker summary:focus-visible,
.language-picker-button:focus-visible {
	color: var(--focus-text);
	background: var(--focus-background);
	outline: 3px solid var(--focus-outline);
	outline-offset: 2px;
}

.site-header .language-picker ul {
	position: absolute;
	inset-block-start: calc(100% + 0.25em);
	inset-inline-end: 0;
	z-index: 20;
	display: block;
	min-inline-size: 100%;
	max-inline-size: calc(100vw - 1em);
	padding: 0.25em 0;
	background: var(--picker-background);
	border: 2px solid var(--picker-border);
	border-radius: 0.3em;
	box-shadow: 0 0.25em 0.75em rgb(0 0 0 / 0.3);
}

.site-header .language-picker ul[hidden] {
	display: none;
}

.site-header .language-picker a {
	padding: 0.5em 1em;
	text-align: start;
	white-space: nowrap;
	color: var(--picker-text);
	background: var(--picker-background);
	border-inline-start: 0.3em solid transparent;
}

.site-header .language-picker a:hover {
	color: var(--nav-hover-text);
	background: var(--nav-hover-background);
}

.site-header .language-picker a:focus-visible {
	color: var(--focus-text);
	background: var(--focus-background);
	outline-offset: -3px;
}

/* The current language: bold, underlined and a bar at the start, not only a colour. */
.site-header .language-picker a[aria-current] {
	border-inline-start-color: var(--picker-current);
}

@media (prefers-reduced-motion: reduce) {
	.language-picker summary::after,
	.language-picker-button::after {
		transition: none;
	}
}

.main-menu {
	order: 2;
	margin-block: auto 10px;
}

/* Content */

main {
	display: flow-root;
	padding: 1% var(--content-padding) 5%;
}

main:focus {
	outline: none;
}

h1,
h2,
h3 {
	line-height: 1.2;
}

h1 {
	text-align: center;
}

img,
video {
	max-inline-size: 100%;
	block-size: auto;
}

video {
	inline-size: 100%;
}

table {
	border-collapse: collapse;
}

th,
td {
	padding-inline: 1em;
	border: 2px solid;
}

/* Images in markdown. :where() keeps this rule weak, so the classes below win. */
:where(.markdown > img, .markdown > p > img, .markdown figure) {
	float: inline-end;
	inline-size: var(--image-width);
	margin: 0 0 1em 1em;
}

.markdown figure img {
	inline-size: 100%;
}

.quarterWidthImage {
	inline-size: 25%;
}

.fullWidthImage {
	float: none;
	inline-size: 100%;
	margin-inline: 0;
}

.leftImage {
	float: inline-start;
	margin-inline: 0 50px;
}

/* Footer */

.site-footer {
	padding: 1em var(--content-padding);
	border-block-start: 1px solid;
}
