/* General style sheet */

/* Fonts */
@font-face {
  font-family: 'Lato';
  src: url('fonts/Lato-Bold.eot'); /* IE9 Compat Modes */
  src: url('fonts/Lato-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('fonts/Lato-Bold.woff2') format('woff2'), /* Modern Browsers */
       url('fonts/Lato-Bold.woff') format('woff'), /* Modern Browsers */
       url('fonts/Lato-Bold.ttf') format('truetype');
  font-style: normal;
  font-weight: bold;
  text-rendering: optimizeLegibility;
}

@font-face {
  font-family: 'Lato';
  src: url('fonts/Lato-Regular.eot'); /* IE9 Compat Modes */
  src: url('fonts/Lato-Regular.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */
       url('fonts/Lato-Regular.woff2') format('woff2'), /* Modern Browsers */
       url('fonts/Lato-Regular.woff') format('woff'), /* Modern Browsers */
       url('fonts/Lato-Regular.ttf') format('truetype');
  font-style: normal;
  font-weight: normal;
  text-rendering: optimizeLegibility;
}

/* General */
* {
  box-sizing: border-box;
}

html {
  font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Cantarell, Ubuntu,
 Helvetica, Arial, sans-serif;
}

html, body {
  min-width: 18rem;
  padding: 1.5rem;
  background-color: #eee;
}

body {
  max-width: 40rem;
  margin-left: auto;
  margin-right: auto;
  line-height: 2rem;
  font-size: 1.25rem;
  color: #333;
}

/* Headings */

h1, h2, h3 { line-height: 1 }
header > h1 { font-size: 4rem; margin-top: 0; margin-bottom: 0; }
h1, h2 { font-size: 2rem; }
:not(header) > h1 { line-height:1.25; }
h2 { margin-top: 2.5rem; margin-bottom: 1.5rem; line-height: 1.25; }
h3 { font-size: 1.5rem; line-height: 1.25; margin-top: 2rem; }

time.single {
  display: block;
  font-size: 1rem;
  line-height: 1;
  font-weight: normal;
  color: gray;
  text-align: left;
  margin-top: -0.3rem;
}

/* Stop subscripts and superscripts from changing the line height.
   Courtesy of https://css-tricks.com/snippets/css/prevent-superscripts-and-subscripts-from-affecting-line-height/ */

sup, sub {
  vertical-align: baseline;
  position: relative;
  top: -0.4em;
}

sub {
  top: 0.4em;
}

/* Figures and images */

img {
  max-width: 100%;
}

/*
  Set images to full width by default. This also stops
  images from “jumping” during layout (which happens if only
  max-width is set.
*/
main img {
  width: 100%;
}

figure {
  margin-top: 2rem;
  margin-bottom: 2rem;
  margin-left: 0;
  margin-right: 0;
}

figure > video {
  border: 1px solid black;
}

figcaption {
  font-size: 1rem;
  font-style: oblique;
  line-height: 1.5;
  text-align: center;
  font-weight: bold;
}

/*
  Screenshots of windows with drop shadows don’t appear to take up 100%
  of the width. Adjust them optically.
*/
.window-with-shadow > img {
  max-width: 110%;
  width: 110%;
  margin-left: -5%;
  margin-right: -5%;
}

/*
  And also pull the figure captions up so that the margin doesn’t take the drop
  shadow into consideration.
*/
.window-with-shadow > figcaption, .window-with-shadow > figcaption > p:first-of-type {
  margin-top: -1rem;
}

/*
  Don’t add additional space between an H3 and a figure that immediately follows
  it to improve grouping.
*/
h3 + figure {
  margin-top: 0;
}

/* For windows with shadow, tighten up the spacing even further. */
h3 + figure.window-with-shadow {
  margin-top: -0.5rem;
}

/* Specialisations */

figure.half-width-flush-right {
  width: 47.5%;
  margin-left: 5%;
  float: right; 
  margin-top: 0.5rem; /* get the top to line up with text */
  margin-bottom: 0;
}

/* Video */

video, video[poster] { width: 100%; }
figure > video, figure > .video { margin-bottom: 1rem; }

/* Mastodon toot embeds */

.mastodon-embed {
  width: 400px;
  max-width: 100%;
  border: 0;
  float:right;
  margin-left: 1rem;
  border: 1px solid gray;
}

/* Block quotes */

blockquote {
  margin-left: -1.3rem;
  border-left: 0.3rem solid lightgray;
  padding-left: 1rem;
  font-style: italic;
  color: slategray;
}

blockquote a {
  color: slategray;
}

blockquote li {
  margin-left: 2em;
}

/* Code */

pre, code {
  font-family: "SFMono-Regular",
  Consolas,
  "Fira Code",
  "Liberation Mono",
  Menlo,
  Courier,
  monospace;
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.5;
  font-variant-ligatures: none;
}

pre {
  background-color: lightpink;

  /* Make sure preformatted text wraps. */
  white-space: pre-wrap;       /* css-3 */
  white-space: -moz-pre-wrap;  /* Mozilla, since 1999 */
  white-space: -pre-wrap;      /* Opera 4-6 */
  white-space: -o-pre-wrap;    /* Opera 7 */
  word-wrap: break-word;       /* Internet Explorer 5.5+ */

  margin-left: -1rem;
  margin-right: -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

pre > code {
  font-size: 0.9rem;
}

:not(pre) > code {
  color: darkcyan;
  font-weight: 500;
}

/* Links */

a {
  color: #333;
  text-decoration: none;
  border-bottom: 1px solid rgb(20, 120, 220);
}

header > a {
  border: none;
}

/* Lists */

ol, ul {
  padding-left: 0;
}

li::marker {
  font-size: 1.5rem;
  color: darkgray;
}

.posttitle {
  max-width: 100%;
  overflow: auto;
}

.pre-june {
  grid-column: 1 / 3;
}

/* Tables */

/* Make tables display with striped row borders overflowing the flush left alignment of the text just like we do with lists and code blocks for consistency. */
table {
  width: 100%;
  border-spacing: 0;
  margin-top: 2rem;
  margin-bottom: 2rem;
  margin-left: -1rem;
  margin-right: -1rem;
}

th:first-of-type, td:first-of-type {
  padding-left: 1rem;
  padding-right: 1rem;
}

th {
  text-align: left;
  padding-bottom: 1rem;
  border-bottom: 3px solid gray;
}

/* Hack to add space between thead and tbody (https://stackoverflow.com/a/10762599) */
tbody::before
{
  content: '';
  display: block;
  height: 0.5rem;
}

td {
  padding-top: 1em;
  padding-bottom: 1em;
}

tr > td:first-child {
  font-weight: bold;
}

/* Stripes */
tr:nth-child(2n) {
  background-color: #eee;
}

/* Special styles */

/* Warnings */
.important-warning {
  /* Make any icons inside align properly to text flow. */
  display: flex;
  align-items: center;

  background-color: darkred;
  color: white;

  border-radius: 1rem;

  /* Keep text flush left and bleed the background. */
  padding: 1rem;
  margin-left: -3.5rem;
  padding-left: 0rem;
  margin-right: -3.5rem;
  padding-right: 3.5rem;
}

.warning-icon {
  height: 5rem;
  display: inline-block;
  padding-left: 1rem;
  margin-right: 1rem;
  /* padding: 0; */
}

.warning-path {
  fill: white;
}

/* Images */

.hairline-border > img {
  border: 1px solid gray;
}

/* Icons */

header {
  display: grid;
  grid-template-columns: 1fr 2.25rem 2.4rem 2.25rem /*2.25rem*/;
  grid-gap: 0.25rem;
  margin-bottom: 2.7rem;
  align-items: end;
}

.email, .mastodon, .rss, .p2p {
  height: 26px;
}

/* Keyboard styles */
kbd {
  display: inline-block;
  border-radius: 0.25rem;
  background-color: #eee;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  padding-top: 0.125rem;
  padding-bottom: 0.125rem;
  border: 1px solid lightgray;
  line-height: 1.25rem;
  font-size: 0.9rem;
}

/* Footnotes */

.footnote-ref { font-size: 0.9rem; margin-left: 0.15rem; }
.footnotes { font-size: 1rem; margin-top: 2rem; }
.footnotes > hr { border: 0.5px solid; color: darkcyan; }
.footnotes li::marker { font-size: 1rem; color: #333; }

.footnotes::before { content: "Footnotes"; font-size: 1.5rem; }

/* Footer */

footer {
  border-top: 1px solid rgb(10, 45, 80);
  text-align: center;
  font-size: 0.9rem;
  margin-top: 2rem;
}

#about-the-author {
  /* background-color: #eee; */
  padding-top: 2rem;
  text-align: left;
  display: grid;
  grid-template-columns: 100px 1fr;
  grid-gap: 1.5rem;
  margin-bottom: 2rem;
  /* align-items: end; */
}

#about-the-author img {
  width: 100px;
  float: left;
  margin-right: 24px;
}

#about-the-author h3 {
  margin-top: 0;
  margin-bottom: 12px;
}

.summary {
  font-style: italic;
  font-size: 16px;
  line-height: 1.5;
}

/* Navigation */

nav {
  grid-column-start: 1;
  grid-column-end: 5;
  border-bottom: 2px solid #333;
  margin-top: 1em;
  margin-bottom: 1.5em;
}

nav ul {
  margin-bottom: 0;
}

nav ul li {
  display: inline-block;
  margin-left: 0;
  margin-right: 0.5em;
  margin-bottom: 0;
}

nav ul li a {
  display: block;
  color: inherit;
  border-bottom: 0;
}

nav ul li.active, nav ul li a {
  padding-left: 0.5em;
  padding-right: 0.5em;
}

nav ul li:hover {
  color: white;
  background-color: rgb(20, 120, 220);
}

nav ul li.active {
  background-color: #333;
  color: white;
}


/* Break point: warning dialog touches the edges */

@media (max-width: 752px) {
  .important-warning {
    border-radius: 0;
  }
}

/* Break point: width is smaller than original layout width */

@media (max-width: 740px) {
  .mastodon-embed {
    width: 100%;
    float: none;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Break point: title goes to two lines: 580px. */

/* Nothing yet. */

/* Break point: narrow portrait viewports */

@media (max-width: 420px) {
  html {
    font-size: 0.9rem;
  }

  html, body {
    padding: 0.5rem;
  }

  /*
  Remove the border radius so the background color of code blocks appears in
  full bleed.
  */
  .chroma {
    border-radius: 0;
  }

  /* Let the figure captions breath, even on images with shadows */
  .window-with-shadow > figcaption, .window-with-shadow > figcaption > p:first-of-type {
    margin-top: 0;
  }

  /* Sadly, there’s not enough room to make list text flush left. */
  li { list-style-position: inside; }

  /* Half-width images leave the text too narrow to read comfortably so revert to full-width. */
  figure.half-width-flush-right {
    width: 100%;
    margin-left: inherit;
  }

  .important-warning {
    margin-left: 0;
    margin-right: 0;
  }

  .warning-icon {
    height: 10rem;
  }
}

/*
  Install Site.js widget.
*/

button {
  text-align: center;
  cursor: pointer;
  font-size:16px;
  color: white;
  border-radius: 4px;
  background-color:#466B6A;
  border: none;
  padding: 0.75em;
  padding-top: 0.25em;
  padding-bottom: 0.25em;
  transition: color 0.5s;
  transition: background-color 0.5s;
}

button:hover {
  color: black;
  background-color: #92AAA4;
}

button:disabled {
  color: #999;
  background-color: #ccc !important;
}

.code-with-copy-button {
  display: grid;
  grid-template-columns: 1fr [button] auto;
  align-items: center;
}

.code-with-copy-button code {
  padding-right: 1em;
}

.installation-instructions button {
  grid-column: button;
}

.installation-instructions pre {
  /* Ensure the copy button doesn’t overlap the code itself. */
  grid-column: 1/2;
  padding-right: 5.5em;
  margin-right: -5.5em;
  margin-top: 0;
  margin-bottom: 0;
}

#links-to-instructions-for-other-platforms a {
  cursor: pointer;
}

/* Like this? Fund us! shortcode */

#fund-us {
  display: block;
  background-color: #AFE1E8;
  color: #154652;
  margin-left: -1rem;
  margin-right: -1rem;
  padding: 2rem;
}

/* Control the gutter around the box with padding alone. */
#fund-us > h2 { margin-top: 0; }
#fund-us > p:last-of-type { margin-bottom: 0; }

/* Mastodon embeds */

.mastodon-embed {
  width: 100%;
  float: none;
  margin-left: 0;
}

/* Dark mode. */
@media (prefers-color-scheme: dark) {
  /* Invert all elements on the body while attempting to not alter the hue substantially. */
  body {
    filter: invert(100%) hue-rotate(180deg);
  }

  /* Workarounds and optical adjustments. */

  /*
     Firefox workaround: Set the background colour for the html element
     separately because, unlike other browsers, Firefox does not apply
     the invert filter to the root element’s background.
  */
  html {
    background-color: #111;
  }

  /* Do not invert media (revert the invert). */
  img, video, iframe, svg {
    filter: invert(100%) hue-rotate(180deg);
  }
  

  iframe:fullscreen {
    filter: none;
  }

  /* Improve contrast on icons. */
  .icon {
    filter: invert(15%) hue-rotate(180deg);
  }

  /* Re-enable code block backgrounds. */
  pre {
    filter: invert(6%);
  }

  /* Improve contrast on list item markers. */
  li::marker {
    color: #666;
  }
  
  .social-icon {
  text-decoration: none;
  border: none;
  outline: none;
}

.social-icon img {
  border: none;
  outline: none;
  text-decoration: none;
  vertical-align: middle;
}
}