/* Defaults */
:root {
  /* See https://github.com/system-fonts/modern-font-stacks */
	--font-family: system-ui, sans-serif;
  --font-family-title: Seravek, 'Gill Sans Nova', Ubuntu, Calibri, 'DejaVu Sans', source-sans-pro, sans-serif;
	--font-family-monospace: ui-monospace, 'Cascadia Code', 'Source Code Pro', Menlo, Consolas, 'DejaVu Sans Mono', monospace;
}

/* Theme colors */
:root {
  --color-gray-20: #edf1e1;
	--color-gray-50: #C0C0C0;
	--color-gray-90: #333;
	--theme-color: #E986A7;

  --background-color: #fff;
	--page-background-color: #fcfff5;

	--text-color: var(--color-gray-90);
	--text-color-link: #082840;
	--text-color-link-active: #5f2b48;
	--text-color-link-visited: #17050F;

	--syntax-tab-size: 2;

  --border-style: solid;
}

@media (prefers-color-scheme: dark) {
	:root {
		--color-gray-20: #c66987;
		--color-gray-50: #C0C0C0;
		--color-gray-90: #edf1e1;

		/* --text-color is assigned to --color-gray-90 above */
		--text-color-link: var(--text-color);
		--text-color-link-active: var(--theme-color);
		--text-color-link-visited: var(--text-color);

		--background-color: #15202b;
  	--page-background-color: var(--background-color);
	}
}

/* Global stylesheet */
* {
	box-sizing: border-box;
}

@view-transition {
	navigation: auto;
}

html,
body {
	margin: 0 auto;
	font-family: var(--font-family);
	color: var(--text-color);
	background-color: var(--page-background-color);
}
html {
	padding: 0;
	overflow-y: scroll;
}
body {
	max-width: 44em;
  padding: 1rem 0 4rem;
  background-image: url(/img/logo-lightgreen.png);
  background-size: 4rem;
  background-repeat: no-repeat;
  background-position: 50% bottom;
}

/* https://www.a11yproject.com/posts/how-to-hide-content/ */
.visually-hidden {
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/* Fluid images via https://www.zachleat.com/web/fluid-images/ */
img {
  max-width: 100%;
}
img[width][height] {
  height: auto;
}
img[src$=".svg"] {
  width: 100%;
  height: auto;
  max-width: none;
}

p:last-child {
	margin-bottom: 0;
}
p {
  margin: 0.5em 0 1em;
	line-height: 1.5;
}

li {
	line-height: 1.5;
}

a[href] {
	color: var(--text-color-link);
}
a[href]:visited {
	color: var(--text-color-link-visited);
}
a[href]:hover,
a[href]:active {
	color: var(--text-color-link-active);
}

main {
  padding: 1rem;
  background: var(--background-color);
  border-style: var(--border-style);
  border-color: var(--color-gray-20);
  border-width: 1px 0 2px;
}
main :first-child {
	margin-top: 0;
}
main :last-child {
	margin-bottom: 0;
}

header {
  padding: 1rem;
}
header:after {
	content: "";
	display: table;
	clear: both;
}

footer {
	font-size: 0.8125em; /* 13px /16 */
  padding: 1rem;
}

.links-nextprev {
	display: flex;
	justify-content: space-between;
	gap: .5em 1em;
	list-style: "";
	border-top: 2px var(--border-style) var(--color-gray-20);
	padding: 1em 0;
}
.links-nextprev > * {
	flex-grow: 1;
}
.links-nextprev-next {
	text-align: right;
}

table {
	margin: 1em 0;
}
table td,
table th {
	padding-right: 1em;
}

pre,
code {
	font-family: var(--font-family-monospace);
}
pre:not([class*="language-"]) {
	margin: .5em 0;
	line-height: 1.375; /* 22px /16 */
	-moz-tab-size: var(--syntax-tab-size);
	-o-tab-size: var(--syntax-tab-size);
	tab-size: var(--syntax-tab-size);
	-webkit-hyphens: none;
	-ms-hyphens: none;
	hyphens: none;
	direction: ltr;
	text-align: left;
	white-space: pre;
	word-spacing: normal;
	word-break: normal;
	overflow-x: auto;
}
code {
	word-break: break-all;
}

/* Header */
header {
	display: flex;
	gap: 1em .5em;
	flex-wrap: wrap;
	align-items: center;
}
.home-link {
	font-size: 1.1em;
	font-weight: 700;
	margin-right: 2em;
  font-family: var(--font-family-title);
}
.home-link:link:not(:hover) {
	text-decoration: none;
}

/* Nav */
.nav {
	display: flex;
	padding: 0;
	margin: 0;
	list-style: none;
}
.nav-item {
	display: inline-block;
	margin-right: 1em;
}
.nav-item a[href]:not(:hover) {
	text-decoration: none;
}
.nav a[href][aria-current="page"] {
	text-decoration: underline;
}

/* Posts list */
.postlist {
	list-style: none;
	padding: 0;
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 1em;
}
.postlist-item a {
  height: 100%;
  padding: 1em;
  display: block;
  text-decoration: none;
  border-style: var(--border-style);
  border-color: var(--color-gray-20);
  border-width: 1px 1px 2px;
}
.postlist-item a[href] {
	color: inherit;
}
.postlist-item a[href]:visited {
	color: inherit;
}
.postlist-item a[href]:hover,
.postlist-item a[href]:active {
	color: inherit;
  background: var(--color-gray-20);
}
.postlist-title {
	font-size: 1.1875em; /* 19px /16 */
	font-weight: 700;
}
.postlist-description {
  margin: 0.2em 0;
}
.postlist-date {
  display: block;
	font-size: 0.8125em; /* 13px /16 */
}

/* Post metadata */
.post-metadata {
	display: flex;
	gap: 0.2em 1.5em;
	flex-wrap: wrap;
	align-items: center;
}

/* Tags */
.post-tags {
	display: flex;
	flex-wrap: wrap;
	padding: 0;
	margin: 0;
	list-style: none;
  gap: 0.2em 0.5em;
}
.post-tag {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-transform: capitalize;
	font-style: italic;
}

/* Figures */
figure {
  margin: 1em 0;
  padding: 1em;
  border-style: var(--border-style);
  border-color: var(--color-gray-20);
  border-width: 1px 1px 2px;
}
figcaption {
  margin-top: 0.5em;
  font-size: 0.8em;
  font-family: var(--font-family-monospace);
}

/* Headings */
h1,
h2,
h3 {
  margin-top: 1.5em;
  font-family: var(--font-family-title);
}

/* Dividers */
hr {
  border: 0;
	border-bottom: 1px var(--border-style) var(--color-gray-20);
}

/* Small devices (portrait phones) */
@media (max-width: 639px) {
  h1 { font-size: 1.5625em; /* 25px /16 */ }
  h2 { font-size: 1.375em;  /* 22px /16 */ }
  h3 { font-size: 1.1875em; /* 19px /16 */ }
}

/* Larger devices */
@media (min-width: 640px) {
  header {
    padding: 1.5rem 2rem 1rem;
  }

  main {
    padding: 2rem 2rem;
    border-width: 1px 1px 2px;
  }

  footer {
    padding: 1rem 2rem;
  }

  h1 {
    margin-bottom: 0;
  }

  .postlist {
    grid-template-columns: repeat(2, 1fr);
  }

  .post-metadata {
    margin: 1em 0;
  }
}