/* ------------------------------------------------------------------------------------------------------------------ */
/* Layout engine improvements                                                                                         */
/* ------------------------------------------------------------------------------------------------------------------ */

/* Make HTML more responsive (adapted from https://github.com/mrmrs/fluidity) */
img,
canvas,
iframe,
video,
svg,
select,
textarea {
  max-width: 100%;
  height: auto;
}

pre {
  overflow-x: auto;
}

/* Box-model fix (adapted from https://css-tricks.com/box-sizing/) */
html {
  box-sizing: border-box;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

/* ------------------------------------------------------------------------------------------------------------------ */
/* Improved typography and prose readability                                                                          */
/* ------------------------------------------------------------------------------------------------------------------ */

/* Size text according to screen width (adapted from https://css-tricks.com/molten-leading-css/) */
/* Min size: 1rem (16px), max size: 1.2rem (19.2px); dynamic size applies between 600px and 1240px. */
html {
  font-size: clamp(1rem, calc(13px + 0.5vw), 1.2rem);
}

/* Improved text layout and spacing (adapted from http://bettermotherfuckingwebsite.com) */
body {
  line-height: 1.4;
  margin: 0 auto;
  max-width: 100%;
  padding: 0em 1em;
}

p {
  text-align: justify;
  hyphens: auto;
  max-width: 40em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 1em;
  margin-bottom: 0.5em;
  font-weight: 300;
  text-transform: uppercase;
  font-family: 'Helvetica', 'Arial', sans-serif;
}

/* Improved contrast (adapted from https://jgthms.com/web-design-in-4-minutes/#color-contrast) */
body {
  color: #111;
  background-color: #f5f5f5;
}

:not(a[href]) b,
:not(a[href]) strong,
th {
  color: inherit;
}

/* Logarithmic size scale for headings (see https://github.com/waldyrious/downstyler/issues/30) */
h1 {
  color: #111;
  font-size: 200.00%;
  /* 2^(6/6) */
}

h2 {
  color: #222;
  font-size: 178.18%;
  /* 2^(5/6) */
}

h3 {
  color: #333;
  font-size: 158.74%;
  /* 2^(4/6) */
}

h4 {
  color: #444;
  font-size: 141.42%;
  /* 2^(3/6) */
}

h5 {
  color: #555;
  font-size: 125.99%;
  /* 2^(2/6) */
}

h6 {
  color: #666;
  font-size: 112.25%;
  /* 2^(1/6) */
}

body {
  font-family: Arial, Helvetica, sans-serif;
}

a[href],
a[href]:hover,
a[href]:visited {
  color: #444;
}

hr {
  border: none;
  border-top: #111 1px solid;
}

@media (prefers-color-scheme: dark) {
  body {
    background-color: #222;
    color: gainsboro;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    color: silver;
  }

  a[href],
  a[href]:hover,
  a[href]:visited {
    color: gainsboro;
  }

  hr {
    border: none;
    border-top: gray 1px solid;
  }

  img.pixel {
    filter: invert(1) brightness(.8);
  }

  img {
    filter: brightness(.9) contrast(.9);
  }
}

header>p {
  max-width: 100%;
  text-align: left;
  margin-top: 0.4em;
  margin-bottom: 0.6em;
}

ul,
ol,
li {
  max-width: 40em;
}

/* ------------------------------------------------------------------------------------------------------------------ */
/* Simple table style                                                                                                 */
/* ------------------------------------------------------------------------------------------------------------------ */

table {
  border-collapse: collapse;
}

th,
td {
  padding-left: .5em;
  padding-right: 1em;
  text-align: start;
  border: 1px solid #ddd;
}

th,
thead,
tfoot {
  background: #eee;
  font-weight: bold;
}

/* ------------------------------------------------------------------------------------------------------------------ */
/* Forms and form inputs (work in progress, see https://github.com/waldyrious/downstyler/issues/5)                    */
/* ------------------------------------------------------------------------------------------------------------------ */

textarea {
  display: block;
  width: 100%;
}

input,
textarea,
select,
button {
  font-family: inherit;
  font-size: 100%;
  margin: 0.2em 0;
}

select[size]:not([size="1"]) {
  vertical-align: top;
}

/* ------------------------------------------------------------------------------------------------------------------ */
/* Images and figures                                                                                                 */
/* ------------------------------------------------------------------------------------------------------------------ */

/* Add margins to left- and right-aligned images (https://github.com/waldyrious/downstyler/issues/13) */
img[align="right"] {
  margin-left: 1em;
}

img[align="left"] {
  margin-right: 1em;
}

/* Figure captions */
figcaption {
  font: caption;
  color: #111;
  font-size: 75% !important;
}

/* Prevent blowing up SVG images that are meant to be small */
*[class*="social"] svg,
*[class*="icon"] svg,
svg[class*="icon"],
img[class*="emoji"][src$=".svg"] {
  max-height: 30px;
}

*[class*="logo" i] svg,
*[id*="logo" i] svg {
  max-width: 100px;
}

/* ------------------------------------------------------------------------------------------------------------------ */
/* Additional adjustments                                                                                             */
/* ------------------------------------------------------------------------------------------------------------------ */



/* Styles for code-related elements */
pre,
:not(pre) code,
kbd,
samp,
tt {
  padding: .1em .3em;
  margin: 0 .1em;
  font-size: 80%;
  background: #eee;
}

/* Styles for blockquote elements */
blockquote {
  padding-left: 1em;
  margin-left: 0;
  border-left: 5px solid #ddd;
  color: #666;
}

/*pixelly images*/
.pixel {
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

/*flexbox*/
.container {
  display: flex;
  max-width: 100%;
  margin: 0 0 auto;
  align-items: flex-start;
  align-content: flex-start;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.container>* {
  flex-grow: 1;
  max-width: 27em;
  padding: 1em;
}

/*gallery stuff*/
.single {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-top: 3em;
  margin-bottom: 5em;
  max-width: 100%;
  height: auto;
}

.spread {
  display: block;
  margin-left: auto;
  margin-right: auto;
  margin-top: 3em;
  margin-bottom: 5em;
  max-width: 100%;
  height: auto;
}

.gallery {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  margin: auto;
  justify-content: center;
  max-width: 100%;
}

.item {
  width: auto;
  padding: 1em;
}

.item p {
  max-width: 20em;
}

.item img {
  width: auto;
  height: auto;
}

.yellow {
  background-color: yellow;
}