/* MarkMcB.com Style Sheet  */

/* Montserrat */
@font-face { font-family: 'Montserrat'; font-display: block; font-style: normal; font-weight: 500; src: url('/fonts/montserrat-v31-latin-500.woff2') format('woff2'); }
@font-face { font-family: 'Montserrat'; font-display: block; font-style: normal; font-weight: 700; src: url('/fonts/montserrat-v31-latin-700.woff2') format('woff2'); }

/* Source Sans 3 */
@font-face { font-family: 'Source Sans 3'; font-display: block; font-style: normal; font-weight: 500; src: url('/fonts/source-sans-3-v19-latin-500.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-display: block; font-style: italic; font-weight: 500; src: url('/fonts/source-sans-3-v19-latin-500italic.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-display: block; font-style: normal; font-weight: 600; src: url('/fonts/source-sans-3-v19-latin-600.woff2') format('woff2'); }

/* Nunito Sans */
@font-face { font-family: 'Nunito Sans'; font-display: block; font-style: normal; font-weight: 400; src: url('/fonts/nunito-sans-v19-latin-regular.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-display: block; font-style: italic; font-weight: 400; src: url('/fonts/nunito-sans-v19-latin-italic.woff2') format('woff2'); }
@font-face { font-family: 'Nunito Sans'; font-display: block; font-style: normal; font-weight: 700; src: url('/fonts/nunito-sans-v19-latin-700.woff2') format('woff2'); }

/* Berkeley Mono */
@font-face { font-family: 'Berkeley Mono'; font-display: swap; font-style: oblique -16deg 0deg; font-stretch: 60 100; font-weight: 100 900; src: url('/fonts/berkeley-mono.woff2') format('woff2'); }

/* defaults */
:root {
    --hmf-max-width: 800px;
    --hmf-padding: 20px;
    --text-weight: 400;
    --main-title-weight: 700;
    --nav-weight: 500;
    --h1-weight: 600;
    --h23-weight: 600;
    --h456-weight: 500;
    --h1-size: 2.25rem;
    --h2-size: 1.875rem;
    --h3-size: 1.5rem;
    --h4-size: 1.25rem;
    --h5-size: 1.125rem;
    --h6-size: 1rem;
    --heading-line-height: 1.2;
    --heading-margin-top: 1.1em;
    --heading-margin-bottom: 0.5rem;
    --footer-weight: 400;
    --link-decoration: none;
    --site-headers-font: 'Montserrat', system-ui, -apple-system, sans-serif;
    --paragraph-headers-font: 'Source Sans 3', system-ui, -apple-system, serif;
    --paragraph-font: 'Nunito Sans', system-ui, -apple-system, sans-serif;
    --mono-font: 'Berkeley Mono', system-ui, -apple-system, monospace;
}

/* use browser preferences for light/dark unless, user has set a preference */
@media (prefers-color-scheme: light) {
    :root:not(.dark-mode) {
        --color-fg: #101920;
        --color-fg2: #404950;
        --color-bg: #fdfeff;
        --color-bg2: #9d9e9f;
        --color-primary: #27c;
        --color-primary-muted: #579;
        --color-primary-shift: #5191D0;
        --color-primary-compliment: #9ec0f2;
        --color-terminal-fg: #111;
        --color-terminal-bg: #FFFBEF;
        --image-brightness: brightness(1.0);
    }
}

@media (prefers-color-scheme: dark) {
    :root:not(.light-mode) {
        --color-fg: #e3e3d3;
        --color-fg2: #c3c3b3;
        --color-bg: #1c1c1c;
        --color-bg2: #4c4c4c;
        --color-primary: #ec8;
        --color-primary-muted: rgb(from var(--color-primary) r g b / 70%);
        --color-primary-shift: #ab8c4f;
        --color-primary-compliment: #957d3f;
        --color-terminal-fg: #ddd;
        --color-terminal-bg: #13130c;
        --image-brightness: brightness(0.8);
    }
}

/* use user preferences for light/dark, set via javascript */
:root.light-mode {
    --color-fg: #101920;
    --color-fg2: #404950;
    --color-bg: #fdfeff;
    --color-bg2: #9d9e9f;
    --color-primary: #27c;
    --color-primary-muted: #579;
    --color-primary-shift: #5191D0;
    --color-primary-compliment: #9ec0f2;
    --color-terminal-fg: #111;
    --color-terminal-bg: #FFFBEF;
    --image-brightness: brightness(1.0);
}

:root.dark-mode {
    --color-fg: #e3e3d3;
    --color-fg2: #c3c3b3;
    --color-bg: #1c1c1c;
    --color-bg2: #4c4c4c;
    --color-primary: #ec8;
    --color-primary-muted: rgb(from var(--color-primary) r g b / 70%);
    --color-primary-shift: #ab8c4f;
    --color-primary-compliment: #957d3f;
    --color-terminal-fg: #ddd;
    --color-terminal-bg: #13130c;
    --image-brightness: brightness(0.8);
}

* {
    box-sizing: border-box;
}

body {
    background-color: var(--color-bg);
    color: var(--color-fg);
    font-family: var(--paragraph-font);
    font-size: 1.1em;
    font-weight: var(--text-weight);
    margin: 0;
    padding: 0px;
    transition: background-color 0.3s, color 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    font-feature-settings: "calt" off;
    font-variant-ligatures: none;
    font-smooth: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#theme-toggle {
    background-color: transparent;
    color: var(--color-primary);
    border: 0;
    width: 15px;
    height: 15px;
    padding: 0;
    margin: 0;
    cursor: pointer;
}
#theme-toggle svg {
    width: 15px;
    height: 15px;
    vertical-align: -1px;
}

#theme-state {
    opacity: 1;
    transition: opacity 2s ease-out;
    font-family: var(--paragraph-headers-font);
    font-weight: var(--text-weight);
    color: var(--color-bg);
    padding: 0 3px;
    background-color: var(--color-primary);
    font-size: 0.8em;
    margin: auto;
}

#theme-state.hidden {
    opacity: 0;
}

a {
    color: var(--color-primary);
    text-decoration: var(--link-decoration);
}

a:hover {
  background-color: rgb(from var(--color-primary) r g b / 10%);
}

h1, h2, h3, h4, h5, h6 {
    color: var(--color-fg2);
    font-family: var(--paragraph-headers-font);
    margin-top: 1.3em;
    line-height: var(--heading-line-height);
    margin-top: var(--heading-margin-top);
    margin-bottom: var(--heading-margin-bottom);
}

h1 { font-size: var(--h1-size); font-weight: var(--h1-weight); }
h2 { font-size: var(--h2-size); font-weight: var(--h23-weight); }
h3 { font-size: var(--h3-size); font-weight: var(--h23-weight); }
h4 { font-size: var(--h4-size); font-weight: var(--h456-weight); }
h5 { font-size: var(--h5-size); font-weight: var(--h456-weight); font-style: italic; }
h6 { font-size: var(--h6-size); font-weight: var(--h456-weight); font-style: italic; }

p code, li code {
    background-color: rgb(from var(--color-fg) r g b / 10%);
    border-radius: 2px;
    padding: 0 2px;
}

main > :first-child {
    margin-top: 0px;
}

header {
    max-width: var(--hmf-max-width);
    margin: 15px auto 0 auto;
    width: 100%;
    padding: 15px var(--hmf-padding) 0px var(--hmf-padding);
    border-radius: 0 0 5px 5px;
}

header .separator, footer .separator {
    height: 1px;
    border-bottom: 1px dotted var(--color-primary-muted);
    margin: 30px auto;
}

nav {
    margin: 5px 0 0 0;
    max-width: 1000px;
    padding: 0;
    display: inline-block;
}

nav ul {
  display: flex;
  justify-content: left;
  list-style-type: none;
  padding: 0;
  margin: 0;
}

nav ul li {
    margin: 0 15px 0 0;
    font-family: var(--site-headers-font);
    font-size: 1em;
    font-weight: var(--nav-weight);
}

nav ul li a {
  text-decoration: none;
  color: var(--color-primary);
}

nav ul li a:hover {
  background-color: transparent;
}

header h1 {
    text-align: left;
    font-family: var(--site-headers-font);
    font-weight: var(--main-title-weight);
    font-size: 2.2em;
    margin: 0 auto;
    padding: 0 15px 0 0;
    color: var(--color-primary);
    display: inline-block;
}

header h1 a {
    color: var(--color-primary);
    text-decoration: none;
}

header h1 a:hover {
    background-color: transparent;
}

main {
    flex: 1;
    margin: 0 auto;
    max-width: var(--hmf-max-width);
    padding: 0 var(--hmf-padding);
    width: 100%;
}

ul.breadcrumbs {
    margin: 0;
    padding: 0;
}

ul.breadcrumbs li {
    list-style-type: none;
    display: inline-block;
    border-radius: 5px;
    padding: 2px 0;
    margin: 0;
    font-size: 0.8em;
}

ul.breadcrumbs li:not(:first-child)::before {
    content: '> ';
}

ul.breadcrumbs + h1 {
    margin-top: 20px;
}

.notice {
    margin: 40px auto;
    border: 2px solid var(--color-primary-shift);
    border-radius: 8px;
    padding: 0px 15px;
    background: rgb(from var(--color-primary-shift) r g b / 10%);
}

table {
    table-layout: auto;
    border: 1px solid rgb(from var(--color-fg) r g b / 40%);
    border-collapse: collapse;
    font-size: 0.8em;
    margin: 0 auto;
    width: 100%;
}

table th {
    border: 1px solid rgb(from var(--color-fg) r g b / 40%);
    background-color: var(--color-primary-muted);
    color: var(--color-bg);
    padding: 2px 5px;
    font-family: var(--paragraph-headers-font);
}

table td {
    border: 1px solid rgb(from var(--color-fg) r g b / 40%);
    padding: 2px 5px;
}

@media (max-width: 768px) {
    table * { font-size: 0.8em; }
    table td, table th {
        padding-left: 2px;
        padding-right: 2px;
    }
}

footer {
    margin: auto auto 0px auto;
    width: 100%;
    max-width: var(--hmf-max-width);
    padding: 0 var(--hmf-padding);
    margin-bottom: 30px;
}

footer .content {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
}

footer .content-item {
    flex: 1 1 auto;
    min-width: 150px;
    margin-bottom: 20px;
}

footer .content-item h4 {
    margin: 0 0 10px 0;
}

footer .copyright ul {
  margin: 0;
  padding: 0;
}

footer .copyright ul li {
  font-size: 0.8em;
  list-style-type: none;
}

footer .contact-icon {
    width: 30px;
    height: 30px;
    fill: rgb(from var(--color-primary-muted) r g b / 50%);
}
footer .contact-icon:hover {
    fill: var(--color-primary);
 }

footer .get-in-touch ul {
  display: flex;
  justify-content: left;
  list-style-type: none;
  padding: 0;
  margin: 0;
}

footer .get-in-touch ul li {
    margin: 0 15px 0 0;
    font-size: 1.0em;
    font-weight: 500;
}

footer .get-in-touch ul li a {
    text-decoration: none;
}

footer .get-in-touch ul li a:hover {
    background-color: transparent;
 }

figure.small-right {
    float: right;
    max-height: 600px;
    max-width: 30%;
    margin: 5px 10px 20px 30px;
    border-radius: 10px;
}

figure.small-right img {
    border-radius: 10px;
    width: 100%;
    height: auto;
}

figure.small-right figcaption {
    font-size: 0.7em;
    padding: 2px 10px;
    font-family: var(--paragraph-font);
}

.generic-flex-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    font-family: var(--paragraph-font);
    gap: 20px;
}

.generic-flex-item {
    flex: 0 0 auto;
    min-width: 170px;
    width: 30%;
    margin: 0px;
}

.generic-flex-item h3 {
    margin-bottom: 0;
    font-style: normal;
    font-weight: var(--h456-weight);
}

.front-page-links {
    margin: 0 0 30px 0;
}

.front-page-links ul {
    margin: 5px 0 10px 0;
    padding-left: 20px;
}

.front-page-links ul li {
    color: var(--color-primary-muted);
}

figure.article-center {
    width: 100%;
    margin: 50px auto;
    text-align: center;
}

figure.article-center img {
    margin: 0 auto;
    border-radius: 10px;
    max-width: 100%;  
    max-height: 66vh;
    height: auto;
    width: auto;
    display: block;
    filter: var(--image-brightness);
}

figure.article-center figcaption {
    margin: 10px auto;
    width: 80%;
    text-align: center;
    font-family: var(--paragraph-font);
    font-style: italic;
    font-size: 0.9em;
}

.http-status {
    width: 100%;
}

.http-status h1 {
    font-family: var(--site-headers-font);
    font-weight: var(--text-weight);
    /* color: var(--color-primary-compliment); */
    width: 100%;
    margin: 0 auto;
    text-align: center;
    font-size: clamp(96px, 15vw, 120px);
}

.http-status h2 {
    font-family: var(--site-headers-font);
    font-weight: var(--text-weight);
    background-color: var(--color-primary-compliment);
    color: var(--color-fg2);
    border-radius: 8px;
    width: fit-content;
    margin: 0 auto 50px auto;
    padding: 5px 20px;
    text-align: center;
    font-size: clamp(24px, 6vw, 50px);
}

.http-status form {
    margin: 50px auto 100px auto;
    text-align: center;
}

.http-status form input, .http-status form button {
    font-size: 1em;
}

.http-status form button {
    color: var(--color-bg);
    background-color: var(--color-fg);
}

.http-status p {
    text-align: center;
    max-width: 70%;
    margin: 0 auto;
}

.terminal {
    background-color: var(--color-terminal-fg);
    background-color: var(--color-terminal-bg);
    font-family: var(--mono-font);
    font-feature-settings: "ss01", "ss05";
    font-stretch: 100%;
    /* font-size: 14px; */
    font-size: 0.9rem;
    margin: 20px 0;
    padding: 15px 0px 15px 25px;
    /* padding: 0px; */
    border: 1px solid rgb(from var(--color-fg) r g b / 40%);
    border-radius: 5px;
    box-shadow: 1px 1px 4px rgba(0, 0, 0, 0.5);
    line-height: 1.5;
    max-width: 800px;
    overflow-x: auto;
    white-space: pre;
    unicode-bidi: embed;
    color: rgb(from var(--color-terminal-fg) r g b / 80%);
}

code.hljs, code.nohighlight {
    padding: 0;
    font-family: var(--mono-font);
    font-feature-settings: "ss01", "ss05";
    font-stretch: 100%;
    font-size: 0.9rem;
    background-color: var(--color-terminal-bg);
}

.terminal-description {
    font-family: var(--mono-font);
    font-feature-settings: "ss01", "ss05";
    font-stretch: 100%;
    font-size: 0.8em;
    padding: 3px 10px;
    color: var(--color-primary-muted);
    background-color: rgb(from var(--color-primary-muted) r g b / 20%);
    margin: 20px 0 -21px 20px;
    border: 1px solid rgb(from var(--color-fg) r g b / 40%);
    border-radius: 5px 5px 0 0;
    width: fit-content;
    max-width: 90%;
}

.terminal .user, .terminal .root {
    font-weight: 600;
}

.terminal .user::before {
    content: '$ ';
}

.terminal .root::before {
    content: '# ';
}

.terminal .input {
    color: var(--color-terminal-fg);
    display: inline;
}

.terminal .output {
    margin-left: 0;
}

.terminal .output+.highlight {
    background-color: rgb(from var(--color-primary-shift) r g b / 30%);
    margin: 0 -5px;
    padding: 0 5px;
}

.terminal .error {
    color: #ff5555;
}

.terminal .success {
    color: #50fa7b;
}

.terminal .cursor {
    display: inline-block;
    width: 8px;
    height: 1em;
    background-color: #00ff00;
    margin-left: 2px;
    animation: blink 1s step-end infinite;
}

pre {
    padding: 0;
    font-family: var(--mono-font);
    font-feature-settings: "ss01", "ss05";
    font-stretch: 100%;
    font-size: 0.9rem;
    overflow-x: auto;
    overflow-y: hidden;
    line-height: 1rem;
    /* background-color: var(--color-terminal-bg); */
}

@keyframes blink {
    from, to {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

/* Tree style inspired by Kate Morley: https://iamkate.com/code/tree-views/ */
.tree {
  --spacing: 1.5rem;
  --radius: 8px;
  margin-left: 0;
  padding-left: 0;
}

.tree li {
  display: block;
  position: relative;
  padding-left: calc(2 * var(--spacing) - var(--radius) - 2px);
  padding-top: 2px;
}

.tree ul {
  margin-left: calc(var(--radius) - var(--spacing));
  padding-left: 0;
}

.tree ul li {
  border-left: 2px solid var(--color-bg2);
}

.tree ul li:last-child {
  border-color: transparent;
}

.tree ul li::before {
  content: '';
  display: block;
  position: absolute;
  top: calc(var(--spacing) / -2);
  left: -2px;
  width: calc(var(--spacing) + 2px);
  height: calc(var(--spacing) + 1px);
  border: solid var(--color-bg2);
  border-width: 0 0 2px 2px;
}

.tree summary {
  display: block;
  cursor: pointer;
  color: rgb(from var(--color-fg) r g b / 50%);
}

.tree summary::marker,
.tree summary::-webkit-details-marker {
  display: none;
}

.tree summary:focus {
  outline: none;
}

.tree summary:focus-visible {
  outline: 1px dotted #000;
}

.tree li::after,
.tree summary::before {
  content: '';
  display: block;
  position: absolute;
  top: calc(var(--spacing) / 1.75 - var(--radius));
  left: calc(var(--spacing) - var(--radius) - 1px);
  width: calc(2 * var(--radius));
  height: calc(2 * var(--radius));
  border-radius: 50%;
}

.tree li.non-branch-leaf::after {
    content: '';
    display: block;
    position: absolute;
    top: calc(var(--spacing) / 1.75 - var(--radius));
    left: calc(var(--spacing) - var(--radius) - 1px);
    width: calc(2 * var(--radius));
    height: calc(2 * var(--radius));
    border-radius: 50%;
    background: var(--color-primary-shift);
}

.tree summary::before {
  z-index: 1;
  background: var(--color-primary-shift) url('expand-collapse.svg') -2px -2px;
}

.tree details[open] > summary::before {
  background-position: calc(-2.75 * var(--radius)) -2px;
}

.tree details[open] > summary {
  color: var(--color-fg);
}
