/* 
MIT License

Copyright (c) 2020 Simple.css (Kev Quirk)
Copyright (c) 2026 b01lers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

/* Global variables. */
:root {
  /* Set sans-serif & mono fonts */
  --sans-font: -apple-system, BlinkMacSystemFont, "Avenir Next", Avenir,
    "Nimbus Sans L", Roboto, "Noto Sans", "Segoe UI", Arial, Helvetica,
    "Helvetica Neue", sans-serif;
  --serif-font: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --mono-font: Consolas, Menlo, Monaco, "Andale Mono", "Ubuntu Mono", monospace;
  --standard-border-radius: 5px;
  --border-width: 1px;

  /* Light theme */
  --bg: #fff;
  --accent-bg: #f5f7ff;
  --text: #212121;
  --text-light: #585858;
  --border: #898EA4;
  --accent: oklch(0.6 0.2 25);
  --accent-hover: oklch(0.6 0.2 25);
  --accent-text: var(--bg);
  --code: #d81b60;
  --preformatted: #444;
  --marked: #ffdd33;
  --disabled: #efefef;
}

/* Dark theme */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #212121;
    --accent-bg: #2b2b2b;
    --text: #dcdcdc;
    --text-light: #ababab;
    --accent: oklch(0.55 0.2 25);
    --accent-hover: #e85353;
    --accent-text: var(--bg);
    --code: #f06292;
    --preformatted: #ccc;
    --disabled: #111;
  }

  /* Add a bit of transparency so light media isn't so glaring in dark mode */
  img,
  video {
    opacity: 0.8;
  }
}

/* Reset box-sizing */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Reset default appearance */
textarea,
select,
input,
progress {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

html {
  /* Set the font globally */
  font-family: var(--sans-font);
  scroll-behavior: smooth;
}

/* Make the body a nice central block */
body {
  color: var(--text);
  background-color: var(--bg);
  font-size: 1.15rem;
  line-height: 1.5;
  margin: 0;
}

body>* {
  grid-column: 2;
}

/* display as link on hover */
:is(h1, h2, h3, h4, h5, h6)>a:hover {
  &::after {
  content: " #";
  }
  text-decoration: underline;
}

/* display as standard header when not hovering */
:is(h1, h2, h3, h4, h5, h6)>a:not(:hover) {
  text-decoration: none;
}

/* Prevent long strings from overflowing container */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* Reduce header size on mobile */
@media only screen and (max-width: 720px) {
  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 2.1rem;
  }

  h3 {
    font-size: 1.75rem;
  }

  h4 {
    font-size: 1.25rem;
  }
}

/* Format links & buttons */
a,
a:visited {
  color: var(--accent);
}

a:hover {
  text-decoration: none;
}

/* Set the cursor to '?' on an abbreviation and style the abbreviation to show that there is more information underneath */
abbr[title] {
  cursor: help;
  text-decoration-line: underline;
  text-decoration-style: dotted;
}

button:enabled:hover,
.button:not([aria-disabled="true"]):hover,
input[type="submit"]:enabled:hover,
input[type="reset"]:enabled:hover,
input[type="button"]:enabled:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  cursor: pointer;
}

.button:focus-visible,
button:focus-visible:where(:enabled),
input:enabled:focus-visible:where([type="submit"],
  [type="reset"],
  [type="button"]) {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

nav {
  display: flex;
  flex-direction: column;
  align-items: center;

  & img {
    width: 12rem;
    max-width: 90%;
    height: auto;
  }
}

/* Use flexbox to allow items to wrap, as needed */
nav ul,
nav ol {
  list-style-type: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
}

/* List items are inline elements, make them behave more like blocks */
nav ul li,
nav ol li {
  margin-left: 0.5rem;
  display: block;
}

nav li:not(:last-of-type)::after {
  content: " |";
}

nav a {
  border: none;
  padding: 0;
  text-decoration: underline;
  line-height: 1;
}

nav a.current {
  background: none;
}

nav a:hover,
nav a.current,
nav a[aria-current="page"],
nav a[aria-current="true"] {
  background: var(--bg);
  border-color: var(--accent);
  color: var(--accent);
  cursor: pointer;
}

/* display main as flex to center items */
main {
  display: flex;
  align-items: center;
  flex-direction: column;
}

article {
  width: min(50rem, 90%);
}

/* less padding/margin on mobile */
@media (max-width: 768px) {
  article {
    width: calc(100% - 1rem);
    max-width: 100%;
    padding: 0.5rem;
    margin: 0.5rem;
  }
}

/* Format tables */
table {
  border-collapse: collapse;
  margin: 1.5rem 0;
}

figure>table {
  width: max-content;
  margin: 0;
}

td,
th {
  border: var(--border-width) solid var(--border);
  text-align: start;
  padding: 0.5rem;
}

th {
  background-color: var(--accent-bg);
  font-weight: bold;
}

tr:nth-child(even) {
  /* Set every other cell slightly darker. Improves readability. */
  background-color: var(--accent-bg);
}

table caption {
  font-weight: bold;
  margin-bottom: 0.5rem;
}

/* Misc body elements */
hr {
  border: none;
  height: var(--border-width);
  background: var(--border);
  margin: 1rem auto;
}

mark {
  padding: 2px 5px;
  border-radius: var(--standard-border-radius);
  background-color: var(--marked);
  color: black;
}

mark a {
  color: var(--accent);
}

img,
video {
  max-width: 100%;
  height: auto;
  border-radius: var(--standard-border-radius);
}

figure {
  margin: 0;
  display: block;
  overflow-x: auto;
}

figure>img,
figure>picture>img {
  display: block;
  margin-inline: auto;
}

figcaption {
  position: sticky;
  left: 0;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-light);
  margin-block: 1rem;
}

blockquote {
  margin-inline-start: 2rem;
  margin-inline-end: 0;
  margin-block: 2rem;
  padding: 0.4rem 0.8rem;
  border-inline-start: 0.35rem solid var(--accent);
  color: var(--text-light);
  font-style: italic;
}

cite {
  font-size: 0.9rem;
  color: var(--text-light);
  font-style: normal;
}

dt {
  color: var(--text-light);
}

/* Use mono font for code elements */
code,
pre,
pre span,
kbd,
samp {
  font-family: var(--mono-font);
  color: var(--code);
}

kbd {
  color: var(--preformatted);
  border: var(--border-width) solid var(--preformatted);
  border-bottom: 3px solid var(--preformatted);
  border-radius: var(--standard-border-radius);
  padding: 0.1rem 0.4rem;
}

pre {
  padding: 1rem 1.4rem;
  max-width: 100%;
  overflow: auto;
  color: var(--preformatted);
}

/* Fix embedded code within pre */
pre code {
  color: var(--preformatted);
  background: none;
  margin: 0;
  padding: 0;
}

/* Superscript & Subscript */
/* Prevent scripts from affecting line-height. */
sup,
sub {
  vertical-align: baseline;
  position: relative;
}

sup {
  top: -0.4em;
}

sub {
  top: 0.3em;
}

/* Print */
@media print {
  @page {
    margin: 1cm;
  }

  body {
    display: block;
  }

  article {
    border: none;
    padding: 0;
  }

  a[href^="http"]::after {
    content: " <" attr(href) ">";
  }

  abbr[title]:after {
    content: " (" attr(title) ")";
  }

  a {
    text-decoration: none;
  }

  p {
    widows: 3;
    orphans: 3;
  }

  hr {
    border-top: var(--border-width) solid var(--border);
  }

  mark {
    border: var(--border-width) solid var(--border);
  }

  figure {
    break-inside: avoid;
  }

  pre code {
    white-space: pre-wrap;
  }
}
