/* Global colour variables */
:root {
    --sans-font: -apple-system, BlinkMacSystemFont, "Avenir Next", Avenir, "Nimbus Sans L", Roboto, Noto, "Segoe UI", Arial, Helvetica, "Helvetica Neue", sans-serif;
    --mono-font: Consolas, Menlo, Monaco, "Andale Mono", "Ubuntu Mono", monospace;

    --bg: #FAFAFA;
    --header-bg: #212121;
    --text: #212121;
    --header-text: #FAFAFA;
    --link: #0D47A1;
    --code: #D81B60;
    --pre: #D0D0D0;
    --pre-bg: #1A1A1A;
    --accent: #e6e6e6;
    --gh-hover: #D3D3D3;
    --before-blue: #64B5F6;
    --after-blue: #BBDEFB;
    --before-orange: #FBC02D;
    --after-orange: #FFF176;
    --before-green: #4CAF50;
    --after-green: #C8E6C9;
    --notice-red-bg: #FFE4E1;
    --notice-red-border: #951818;
}

/* Define colours for auto dark mode */
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #212121;
        --header-bg: #111;
        --text: #EEE;
        --link: #64B5F6;
        --accent: #333;
        --gh-hover: #222;
        --code: #F06292;
        --notice-red-bg: #951818;
        --notice-red-border: #EFD3CF;
    }

    ul li {
        opacity: .8;
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--sans-font);
    font-size: 1.1rem;
    margin: 0 0 4rem 0;
    padding: 0 .5rem;
    background: var(--bg);
    color: var(--text);
}

header,
main,
footer {
    margin: 0 auto;
    max-width: 50rem;
    width: 100%;
}

/* Format navigation */
nav {
  font-size: 1rem;
  line-height: 2;
  padding: 1rem 0;
  margin-left: 1rem;
}

nav a {
  border: 1px solid var(--text);
  border-radius: 5px;
  color: var(--text) !important;
  display: inline-block;
  padding: .1rem 1rem;
  margin-right: 1rem;
  text-decoration: none;
  transition: .4s;
}

nav a:hover,
nav a.current {
  color: var(--text) !important;
  background: var(--accent);
}

nav a.current:hover {
  text-decoration: none;
}

header {
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--text);
}

header h1 {
    margin: 0;
    font-size: 3rem;
    padding: 1rem 0 1rem 0;
    text-align: center;
}

main {
  margin-top: 3rem;
}

.small {
    font-size: .9rem;
}

.medium {
    font-weight: bold;
    font-size: 1.4rem;
}

.centre {
  text-align: center;
}

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

h2 {
    margin: 4rem 0 -1.5rem 0;
}

.jump li {
    display: inline-block;
    padding-right: 1rem;
}

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

a:hover,
a:focus {
    text-decoration: none;
}

a.site,
a.site:visited {
    color: currentColor;
    text-decoration: none;
}

a.site:hover,
a.site:focus {
    text-decoration: underline;
}

.button {
  background: var(--link);
  color: var(--bg) !important;
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 5px;
  text-decoration: none;
}

.button:hover {
  background: var(--text);
}

pre {
    font-family: var(--mono-font);
    background: var(--pre-bg) !important;
    border-radius: 5px;
    margin-bottom: 1.6em;
    max-width: 100%;
    white-space: pre-wrap;
    padding: 1.6em;
    max-height: 650px;
}

pre code {
    font-size: 1.1rem;
    font-family: var(--mono-font);
    color: #ccc;
}

code {
    font-family: var(--mono-font);
    color: var(--code);
}

ul {
    list-style: none;
    margin: 3rem 0 0 0;
    padding: 0;
}

/* BLUE COLOURS */
ul.blue li {
    background: var(--after-blue);
    color: #212121;
    line-height: 1;
    margin: 0 0 0.5rem 0;
    padding: 15px 10px 12px;
    position: relative;
    border-radius: 4px;
}

ul.blue li span.before {
    background: var(--before-blue);
    height: 100%;
    width: calc(var(--data-size)/512 * 100%);
    border-radius: 4px;
    z-index: 0;
}

/* ORANGE COLOURS */
ul.orange li {
    background: var(--after-orange);
    color: #212121;
    line-height: 1;
    margin: 0 0 0.5rem 0;
    padding: 15px 10px 12px;
    position: relative;
    border-radius: 4px;
}

ul.orange li span.before {
    background: var(--before-orange);
    height: 100%;
    width: calc(var(--data-size)/512 * 100%);
    border-radius: 4px;
    z-index: 0;
}

/* GREEN COLOURS */
ul.green li {
    background: var(--after-green);
    color: #212121;
    line-height: 1;
    margin: 0 0 0.5rem 0;
    padding: 15px 10px 12px;
    position: relative;
    border-radius: 4px;
}

ul.green li span.before {
    background: var(--before-green);
    height: 100%;
    width: calc(var(--data-size)/512 * 100%);
    border-radius: 4px;
    z-index: 0;
}

ul li span.before,
ul li span.after {
    left: 0;
    position: absolute;
    top: 0;
}

ul li span.after {
    left: auto;
    opacity: 0.8;
    right: 10px;
    top: auto;
}

ul li a {
    font-weight: bold;
    position: relative;
    z-index: 2;
}

footer {
    border-top: 1px solid var(--text);
    margin: 3rem auto 0;
    padding: 0.5rem 0 0;
    text-align: center;
    font-size: .9rem;
}

@media(max-width:500px) {
    body {
        margin: 0 0 4rem 0;
        padding: 0 10px;
    }
}

/* Format the accordion */
details {
    padding: .6rem 1rem;
    background: var(--accent);
    border: 1px solid;
    border-radius: 5px;
    margin-bottom: 1rem;
}

details.red-notice {
  background: var(--notice-red-bg);
  border-color: var(--notice-red-border);
}

.red-notice h2 {
  margin: 0;
}

summary {
    cursor: pointer;
    font-weight: bold;
}

details[open] {
    padding-bottom: .75rem;
}

details[open] summary {
    margin-bottom: .5rem;
}

details[open]>*:last-child {
    margin-bottom: 0;
}

img {
  max-width: 100%;
  display: block;
  margin: 0 auto;
}

.divrandom {
  margin: 2rem 0 4rem 0;
}

.random {
  background: var(--before-green);
}

.notice {
    border: 2px solid;
    padding: 1rem 1.5rem;
    background-color: var(--accent);
    margin: 3rem 0;
    text-align: center;
}
