/* Reset */

/* http://meyerweb.com/eric/tools/css/reset/
   v2.0 | 20110126
   License: none (public domain)
*/

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
	margin: 0;
	padding: 0;
	border: 0;
	font-size: 100%;
	font: inherit;
	vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption,
footer, header, hgroup, menu, nav, section {
	display: block;
}
body {
	line-height: 1;
}
blockquote, q {
	quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
	content: '';
	content: none;
}
table {
	border-collapse: collapse;
	border-spacing: 0;
}

/* Fonts */

@font-face {
  font-family: 'Junicode';
  src:
    url('fonts/JunicodeVF-Roman.woff2') format('woff2'),
    local('JunicodeVF-Regular'),
    local('Junicode');
  font-weight: 200 300 700 900;
  font-style: normal;
}

@font-face {
  font-family: 'Junicode';
  src:
    url('fonts/JunicodeVF-Italic.woff2') format('woff2'),
    local('JunicodeVF-Italic'),
    local('Junicode');
  font-weight: 200 300 700 900;
  font-style: italic;
}

@font-face {
  font-family: 'Montagu Slab';
  src:
    url('fonts/MontaguSlab.woff2') format('woff2'),
    local('Montagu Slab'),
    local('Montagu Slab 144pt');
  font-weight: 400 700 900;
  font-style: normal;
}

@font-face {
  font-family: 'Fantasque Sans Mono';
  src:
    url('fonts/FantasqueSansMono-Regular.woff2') format('woff2'),
    local('Fantasque Sans Mono');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Fantasque Sans Mono';
  src:
    url('fonts/FantasqueSansMono-Italic.woff2') format('woff2'),
    local('Fantasque Sans Mono');
  font-weight: 400;
  font-style: italic;
}

/* Declarations */

:root {
  /* Flexoki colours */
  --base-50: rgb(242, 240, 229);
  --base-200: rgb(206, 205, 195);
  --base-300: rgb(183, 181, 172);
  --base-900: rgb(40, 39, 38);
  --base-black: rgb(16, 15, 15);
  --orange-300: rgb(236, 139, 73);
  --orange-600: rgb(188, 82, 21);
  --yellow-200: rgb(236, 203, 96);
  --yellow-400: rgb(208, 162, 21);
  --green-300: rgb(160, 175, 84);
  --blue-850: rgb(19, 48, 81);
  --blue-900: rgb(18, 37, 59);
  --blue-950: rgb(16, 26, 36);
  --cyan-200: rgb(135, 211, 195);
  --cyan-700: rgb(28, 108, 102);

  /* Light/dark colour sets */
  --color-bg: light-dark(var(--base-50), var(--blue-950));
  --color-tx: light-dark(var(--blue-900), var(--base-50));
  --color-title: light-dark(var(--blue-900), var(--orange-300));
  --color-heading: light-dark(var(--orange-600), var(--green-300));
  --color-featured: light-dark(var(--orange-600), var(--cyan-700));
  --color-link: light-dark(var(--cyan-700), var(--cyan-200));
  --color-linkhover: light-dark(var(--yellow-400), var(--yellow-200));
  --color-subtle: light-dark(var(--base-200), var(--blue-850));

	/* Fonts */
	--body-fonts: Junicode, Garamond, Georgia, 'Times New Roman', 'FreeSerif', serif;
	--header-fonts: 'Montagu Slab', Clarendon, Georgia, 'Arial Black', serif;
	--code-fonts: 'Fantasque Sans Mono', 'Fira Code', 'Cascadia Code', Consolas, Hack, 'Courier New', monospace;
  --base-font-size: 20pt;

	/* Other */
	--full-width: 100vw;
	--body-width: 960px;
	--header-background: url("images/blog-bg-mini.png") #12122c repeat-x;

  color-scheme: light dark;
}

/* Main */

body {
  color: var(--color-tx);
  background: var(--color-bg);
  font-family: var(--body-fonts);
  font-size: var(--base-font-size);
  overflow-x: hidden;
}

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

body a:active {
  color: var(--cyan-200);
}

body a:hover {
  color: var(--color-linkhover);
}

.full-width {
  width: var(--full-width);
  margin: 0;
}

.body-width {
  width: var(--body-width);
  margin: 0 auto;
  box-sizing: border-box;
}

:is(h1,h2,h3) {
  font-family: var(--header-fonts);
  font-weight: 900;
  letter-spacing: -0.04ex;
  font-optical-sizing: none;
}

#masthead {
  height: 50px;
  background: var(--header-background);
	background-size: initial;
  background-position: center 20%;
}

#site-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: .8em 0;
}

#avatar {
  width: 216px;
  height: auto;
}

/* because WordPress insists on the image being in a P tag */
#avatar-container {
  line-height: initial;
}

header h1 {
  font-size: 120%;
}

header h1 a:link, header h1 a:visited {
  color: var(--color-title);
  text-decoration: none;
}

header h1 a:hover {
  color: var(--color-title);
  text-decoration: wavy underline;
}

header h2 {
  font-size: 80%;
}

nav {
  text-transform: lowercase;
  font-variant: small-caps;
  font-size: 90%;
}

nav ul {
  display: flex;
  gap: 1ex;
  list-style-type: none;
}

nav ul li:after {
  content: "\2000\2E33\2009";
}

nav ul li:last-of-type:after {
  content: none;
}

main {
  padding: 1em 0;
}

#introduction {
  padding-bottom: 1em;
}

.display-posts-listing {
  display: flex;
  width: 100%;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 1em;
  padding: 1em 0;
}

.post-preview {
  display: grid;
  gap: .5em;
  grid-template-columns: auto 1fr;
}

.post-preview .meta {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: space-between;
}

.post-preview .meta h3 {
  color: var(--color-heading);
}

.post-preview .meta a:link {
  font-size: 100%;
}

.post-preview .post-featured-image {
  grid-column: 1;
  grid-row: 1/4;
  width: 128px;
  height: 128px;
  object-fit: cover;
}

.post-preview .preview-text {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  height: 100%;
}

.post-preview .read-more {
  line-height: 2.0;
}

.post-preview .category-list {
  font-size: 80%;
  text-align: right;
  border-bottom: 1px solid var(--color-subtle);
  grid-column: 2;
  grid-row: 3/4;
}

.post-single article, .page-single article {
  display: grid;
  grid-template-columns: 1fr 2fr;
  justify-items: stretch;
}

.post-single article figure.post-featured-image {
  grid-column: 1/3;
  background-color: var(--color-featured);
  margin-bottom: 2em;
  height: 216px;
}

.post-single article img.attachment-post-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  mix-blend-mode: screen;
  filter: grayscale();
}

.post-header {
  contain: content;
  grid-column: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
  height: fit-content;
  border-bottom: 16px solid var(--color-tx);
  margin-right: 1em;
  padding-bottom: 1ex;
}

.post-header h3 {
  color: var(--color-heading);
}

.post-header h3, .post-header time {
  margin: 0 0 1ex 0;
  font-size: 90%;
}

.post-header h4 {
  margin-top: 1ex;
}

.post-header ul.post-categories {
  list-style: "\261E" outside;
}

.post-header ul.post-tags {
  list-style: "\270E" outside;
}

.post-header ul li {
  margin-left: 1.6em;
  padding: .5ex 0 0 .5ex;
}

.post-header :is(.post-meta, .post-categories, .post-tags) {
  font-size: 70%;
}

#post-body {
  contain: content;
}

#post-body:after {
  content: "\2217\2217\2217";
  letter-spacing: 2ex;
  font-size: 150%;
  display: block;
  width: 100%;
  text-align: center;
  color: var(--color-subtle);
  padding-top: 1em;
}

.body-copy {
  font-size: var(--base-font);
  line-height: 1.4;
  text-align: justify;
}

.body-copy>p {
  margin-bottom: 1em;
  max-width: 60ex;
}

#introduction>p {
	max-width: initial;
}

.body-copy h3 {
  margin: 1ex 0 2ex 0;
}

.body-copy ul {
  list-style: "\2BD6" outside;
  margin-left: 1em;
}

.body-copy ul li::marker {
  font-size: 70%;
}

.body-copy ol {
  list-style: decimal outside;
  margin-left: 1em;
}

.body-copy ul li, .body-copy ol li {
  padding: 1ex 0 1ex 1.5ex;
  line-height: 1.2;
}

.body-copy details.body-image, .body-copy button.body-image {
  margin: 0 auto 1em auto;
  width: fit-content;
  cursor: pointer;

  &[open] > figure {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(206, 205, 195, 0.5);
    pointer-events: none;

    & > img {
      max-height: 80vh;
      cursor: initial;
      pointer-events: initial;
      padding-bottom: 2%;
    }
  }
}

.body-copy button.body-image {
  display: block;
  border: 0;
  background: none;
}

.post-single img {
  max-height: 240px;
  width: auto;
}

#blog-list li {
  padding: 1em 0;
  margin: 1em 0;
  border-bottom: 1px solid var(--color-subtle);
  list-style-type: none;
}

#blog-list li::marker {
  color: var(--base-300);
}

#blog-list li header, #blog-list li .post-body {
  margin: 1em 0;
}

#blog-list li .read-more {
  font-style: italic;
  font-size: 80%;
  padding-top: .5em;
}

#blog-list .attachment-post-thumbnail {
  width: 184px;
  height: 184px;
  object-fit: cover;
}

#blog-list .post-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-end;
}

.body-copy .body-image .body-image-caption, .body-copy button.body-image figcaption, .wp-caption-text {
  text-align: end;
  padding: 2ex 0;
  font-size: 14pt;
  font-style: italic;
  font-family: var(--body-fonts);
}

.body-copy details.body-image summary, .body-copy button.body-image figure {
  display: block;
}

.body-copy details.body-image[open] summary:before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  cursor: pointer;
}

.body-copy .body-image-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background-color: rgba(206, 205, 195, 0.5);
  pointer-events: none;

  & > figure {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;

    & > img {
      max-height: 80vh;
      cursor: initial;
      pointer-events: initial;
      padding-bottom: 2%;
    }

    & > .lightbox-close-button {
      position: fixed;
      top: 1ex;
      right: 1.2ex;
      font-size: 36pt;
    }
  }
}

.body-copy .float-right {
  float: right;
  margin-left: 3ex;
}

.body-copy a.hat-tip:before {
  content: "\21AC\2009"
}

.body-copy blockquote {
  margin: 0 0 .6em 1em;
  padding-top: 1em;
  font-size: 24pt;
  font-weight: 700;
  font-style: italic;
  text-wrap: pretty;
  text-indent: -.7ex;
}

.body-copy blockquote:before, .body-copy q:before {
  content: "\201C";
}

.body-copy blockquote:after, .body-copy q:after {
  content: "\201D";
}

.body-copy cite {
  display: block;
  font-size: 12pt;
  margin: 0 4em 2em 0;
  text-align: right;
}

.body-copy cite:before {
  content: "\2E3A";
}

.body-copy table {
  margin: 1em 0;
}

.body-copy tr:nth-of-type(even) {
  background-color: var(--base-200);
}

.body-copy table :is(th, td) {
  padding: 1ex .8ex;
  border: 1px solid var(--base-300);
}

.body-copy thead {
  font-weight: 700;
  text-transform: lowercase;
  font-variant: small-caps;
}

pre, code, kbd {
  font-family: var(--code-fonts);
  font-size: 80%;
}

strong {
  font-weight: 700;
}

em, abbr {
  font-style: italic;
}

address {
  margin: 0 0 1em 1em;
}

acronym {
  text-transform: lowercase;
  font-variant: small-caps;
  font-weight: 700;
}

footer {
  font-size: 60%;
  padding: .5em;
  border-top: 1px solid var(--color-subtle);
}

/* Extra WordPress-y bits */
#post-body img {
  width: auto !important;
  height: auto !important;
  max-width: 100%;
}

.body-copy figure {
  width: auto !important;
}

blockquote>p {
  display: inline;
}

figure.alignright, img.alignright {
  float: right;
  margin-left: 1.5em;
}

figure.alignleft, img.alignleft {
  float: left;
  margin-right: 1.5em;
}

figure.aligncenter, img.aligncenter {
  clear: both;
  text-align: center;
  margin: 0 auto;
}

.entry-footer {
  grid-column: 1 / -1;
}

@media (max-width: 1000px) {
	.body-width {
		width: 100vw;
		padding-left: 48px !important;
		padding-right: 48px !important;
	}
	
	.post-single article, .page-single article {
		display: flex;
		flex-direction: column;
		gap: 1em;
	}
}

@media (max-aspect-ratio: 3/4) {
	header h1 {
		font-size: 100%;
	}
	
	header h2 {
		font-size: 60%;
	}
	
	#avatar {
		width: 128px;
	}
	
	nav ul {
		flex-direction: column;
	}
	
	nav ul li:after {
		content: initial;
	}
	
	.post-preview {
		grid-template-columns: 1fr;
	}
	
	.post-single article figure.post-featured-image {
		margin-bottom: 0;
	}
}