@import url("https://fonts.googleapis.com/css2?family=Baumans&family=Inder&family=PT+Mono&display=swap");

/* Global variables */
:root {
    --font-head: "Baumans", sans-serif;
    --font-sans: "Inder", sans-serif;
    --font-mono: "PT Mono", monospace;
    --bg: #fff;
    --accent-bg: #eee;
    --text: #222;
    --text-light: #555;
    --accent: #04a;
    --accent-hover: #058;
    --preformatted: #404040;
    --disabled: #ddd;
    --bg-menu: #c0c0c0;
    --border: #808080;
    --code: #d15;
    --marked: #fd3;
    --bg-hover: rgba(0, 0, 0, 0.05);
    --success: #28a745;
    --info: #17a2b8;
    --warning: #ffc107;
    --danger: #dc3545;
    --light-success: #d4edda;
    --light-info: #d1ecf1;
    --light-warning: #fff3cd;
    --light-danger: #f8d7da;
    --border-radius: 5px;
    --transition-medium: 0.3s;
    --shadow-small:
        0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-medium:
        0 3px 6px rgba(0, 0, 0, 0.16), 0 3px 6px rgba(0, 0, 0, 0.23);
    --shadow-large:
        0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
    --z-header: 100;
    --z-tooltip: 700;
    --z-modal: 900;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --bg: #222;
        --accent-bg: #333;
        --text: #e0e0e0;
        --text-light: #aaa;
        --accent: #fa0;
        --accent-hover: #fb3;
        --preformatted: #c0c0c0;
        --disabled: #111;
        --bg-menu: #404040;
        --border: #555;
        --success: #48c774;
        --info: #3298dc;
        --warning: #ffdd57;
        --danger: #f14668;
        --light-success: #1b4422;
        --light-info: #1e3a5a;
        --light-warning: #524100;
        --light-danger: #5a1c24;
    }

    img,
    video {
        opacity: 0.8;
    }
}

/* Base Styles */

* {
    box-sizing: border-box;
}

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

html {
    font-family: var(--font-sans);
    font-size: 100%;
    line-height: normal;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    display: grid;
    grid-template-columns: 15% 70% 15%;
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    line-height: 1.5;
    background-color: var(--bg);
}

body > * {
    grid-column: 2;
}

/* Layout Components */

body > header {
    background-color: var(--accent-bg);
    border-bottom: 1px solid var(--border);
    grid-column: 1 / -1;
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow-small);
    position: relative;
    z-index: var(--z-header);
    display: grid;
    grid-template-columns: 1fr auto 4fr 1fr;
}

body > header > a {
    grid-column: 2;
    grid-row: 1 / span 2;
}

body > header > div {
    grid-column: 3;
}

body > header > nav {
    grid-column: 3;
}

body > footer {
    background-color: var(--accent-bg);
    border-top: 1px solid var(--border);
    grid-column: 1 / -1;
    padding: 1rem;
    text-align: center;
    color: var(--text-light);
}

body > footer > div {
    display: flex;
    justify-content: center;
}

body > footer > div a {
    margin: auto 0.5rem;
    width: 2rem;
}

body > footer p {
    font-size: 0.85rem;
}

main {
    display: block;
    margin: 1rem 0;
}

/* Typography */

h1,
h2,
h3,
h4,
h5,
h6,
p {
    overflow-wrap: break-word;
    margin: 1rem 0;
}

h1 {
    font-family: var(--font-head);
    font-size: 3rem;
    text-align: center;
    margin: 0 auto;
}

h2 {
    font-size: 2.5rem;
    position: relative;
    text-wrap: balance;
}

h3 {
    font-size: 2rem;
    text-wrap: balance;
}

h4 {
    font-size: 1.5rem;
}

h5 {
    font-size: 1.2rem;
}

h6 {
    font-size: 1rem;
}

b,
strong {
    font-weight: bolder;
}

/* Links & Navigation */

a {
    background-color: transparent;
    color: var(--accent);
    font-weight: bold;
    text-decoration: underline;
}

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

a:hover {
    text-decoration: none;
    color: var(--accent-hover);
}

/* Navigation */
nav {
    line-height: 2;
    margin: auto 0;
    display: flex;
    justify-content: space-evenly;
}

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

nav ul li {
    display: inline-block;
    position: relative;
}

/* Header nav dropdown styles */
nav ul li ul,
nav ul li ul li {
    background: var(--border);
    width: 100%;
}

nav ul li ul {
    display: none;
    position: absolute;
    left: auto;
    box-shadow: var(--shadow-medium);
}

nav ul li:hover > ul {
    display: block;
}

nav a,
nav a:visited {
    padding: 0.5rem 1rem;
    color: var(--text);
    display: inline-block;
    text-decoration: none;
    border-bottom: 2px solid transparent;
}

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

/* Box Styling & Layout */

aside,
details,
pre,
progress {
    background-color: var(--accent-bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    transition: box-shadow var(--transition-medium);
}

aside:hover,
details:hover,
pre:hover {
    box-shadow: var(--shadow-small);
}

aside {
    font-size: 1rem;
    width: 30%;
    padding: 0 15px;
    margin-inline-start: 15px;
    float: right;
}

*[dir="rtl"] aside {
    float: left;
}

article,
fieldset,
dialog {
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    transition:
        transform var(--transition-medium),
        box-shadow var(--transition-medium);
}

article:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-small);
}

/* Sections & headings */

section {
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    margin: 2rem 0;
}

section + section,
section:first-child {
    border-top: 0;
    padding-top: 0;
    margin-top: 1rem;
}

section + section {
    margin-top: 0;
}

section:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

/* Details & summary */
details {
    padding: 0.7rem 1rem;
}

details:hover {
    background-color: var(--accent-bg);
}

summary {
    cursor: pointer;
    font-weight: bold;
    padding: 0.7rem 1rem;
    margin: -0.7rem -1rem;
    word-break: break-all;
}

summary:hover {
    background-color: var(--bg-hover);
}

details[open] > summary + * {
    margin-top: 0;
}

details[open] > summary {
    margin-bottom: 0.5rem;
}

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

/* Tables */

table {
    border-collapse: collapse;
    border-spacing: 0;
    margin: 1.5rem 0;
    empty-cells: show;
    width: 100%;
}

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

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

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

tr:hover > td {
    background-color: var(--bg-hover);
}

tr:nth-child(even) {
    background-color: var(--accent-bg);
}

table caption {
    font-weight: bold;
    padding: 0.5rem 0;
    text-align: center;
}

/* Forms */

textarea,
select,
input,
button {
    font-size: inherit;
    font-family: inherit;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border-radius: var(--border-radius);
    box-shadow: none;
    max-width: 100%;
    display: inline-block;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

textarea,
select,
input {
    color: var(--text);
    background-color: var(--bg);
    border: 1px solid var(--border);
}

textarea:focus,
select:focus,
input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(4, 170, 170, 0.2);
    outline: none;
}

/* Buttons */
button,
input[type="submit"],
input[type="reset"],
input[type="button"] {
    border: 1px solid var(--accent);
    background-color: var(--bg);
    color: var(--accent);
    text-decoration: none;
    line-height: normal;
    position: relative;
    transition: all var(--transition-medium);
    cursor: pointer;
    font-weight: bold;
}

input:disabled,
textarea:disabled,
select:disabled,
button:disabled {
    cursor: not-allowed;
    background-color: var(--disabled);
    border-color: var(--disabled);
    color: var(--text-light);
}

button:enabled:hover,
input[type="submit"]:enabled:hover,
input[type="reset"]:enabled:hover,
input[type="button"]:enabled:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow-small);
}

button:enabled:active,
input[type=\"submit\"]:enabled:active,
input[type=\"reset\"]:enabled:active,
input[type=\"button\"]:enabled:active {
    transform: translateY(0);
    box-shadow: none;
}

textarea:not([cols]) {
    width: 100%;
}

/* Select dropdown styling */
select:not([multiple]) {
    background-image:
        linear-gradient(45deg, transparent 49%, var(--text) 51%),
        linear-gradient(135deg, var(--text) 51%, transparent 49%);
    background-position: calc(100% - 15px), calc(100% - 10px);
    background-size:
        5px 5px,
        5px 5px;
    background-repeat: no-repeat;
    padding-inline-end: 25px;
}

*[dir="rtl"] select:not([multiple]) {
    background-position: 10px, 15px;
}

/* Checkbox and radio styling */
input[type="checkbox"],
input[type="radio"] {
    vertical-align: middle;
    position: relative;
    width: min-content;
    cursor: pointer;
}

input[type="checkbox"] + label,
input[type="radio"] + label {
    display: inline-block;
    cursor: pointer;
}

input[type="radio"] {
    border-radius: 100%;
}

input[type="checkbox"]:checked,
input[type="radio"]:checked {
    background-color: var(--accent);
    border: 1px solid var(--accent);
}

input[type="checkbox"]:checked::after {
    content: " ";
    width: 0.36rem;
    height: 0.64rem;
    border-radius: 0;
    position: absolute;
    top: 0.08rem;
    left: 0.32rem;
    background-color: transparent;
    border-right: solid var(--bg) 0.16rem;
    border-bottom: solid var(--bg) 0.16rem;
    transform: rotate(45deg);
}

input[type="radio"]:checked::after {
    background-color: var(--bg);
    content: " ";
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 100%;
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
}

/* Special input types */
input[type="range"] {
    padding: 0.1rem 0;
}

input[type="color"] {
    height: 2.5rem;
    padding: 0.2rem;
}

input[type="file"] {
    border: 0;
}

/* Miscellaneous Elements */

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

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

img,
video {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    border-style: none;
    display: block;
    transition:
        transform var(--transition-medium),
        box-shadow var(--transition-medium);
}

img:hover,
video:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-small);
}

/* Figures and captions */
figure {
    margin: 0;
    display: block;
}

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

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

/* Text elements */
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;
    transition:
        border-color var(--transition-medium),
        transform var(--transition-medium);
}

blockquote:hover {
    border-inline-start-color: var(--accent-hover);
    transform: translateX(2px);
}

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

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

dd {
    margin-inline-start: 1rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--accent-bg);
}

/* Code elements */
code,
pre,
pre span,
kbd,
samp {
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--code);
}

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

kbd:hover {
    background-color: var(--accent-bg);
    transform: translateY(-1px);
}

pre {
    margin: 0.5rem;
    padding: 1rem 1.5rem;
    max-width: 100%;
    overflow: auto;
    scrollbar-width: thin;
}

pre code {
    background: none;
    margin: 0;
    padding: 0;
}

code,
kbd,
samp {
    display: inline-block;
}

code:not(pre code) {
    background-color: var(--bg-hover);
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

/* Progress bars */
progress {
    width: 100%;
    transition: value var(--transition-medium);
    background-color: var(--accent-bg);
    border-radius: var(--border-radius);
    border: none;
}

progress::-webkit-progress-bar {
    border-radius: var(--border-radius);
    background-color: var(--accent-bg);
}

progress::-webkit-progress-value {
    border-radius: var(--border-radius);
    background-color: var(--accent);
    transition: width var(--transition-medium);
}

progress::-moz-progress-bar {
    border-radius: var(--border-radius);
    background-color: var(--accent);
    transition: width var(--transition-medium);
}

progress:indeterminate::-moz-progress-bar {
    background-color: var(--accent-bg);
}

/* Text formatting */
small {
    font-size: 0.8rem;
}

sub,
sup {
    font-size: 0.75rem;
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

sub {
    bottom: -0.3rem;
}

sup {
    top: -0.5rem;
}

/* Focus Styles */

*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* More specific focus styles for buttons to override general focus */

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

/* Dialog/Modal */

dialog {
    background-color: var(--bg);
    max-width: 40rem;
    margin: auto;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-large);
    z-index: var(--z-modal);
}

dialog::backdrop {
    background-color: rgba(0, 0, 0, 0.6);
}

/* Tooltips */

abbr[title] {
    cursor: help;
    text-decoration: underline dotted;
    position: relative;
}

abbr[title]:hover::after,
[data-tooltip]:hover::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--accent-bg);
    color: var(--text);
    padding: 0.5rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    white-space: nowrap;
    z-index: var(--z-tooltip);
    box-shadow: var(--shadow-small);
    border: 1px solid var(--border);
}

/* Miscellaneous */

template {
    display: none;
}

[hidden] {
    display: none;
}

/* Media Queries */

/* Large screen enhancement */
@media only screen and (min-width: 1600px) {
    html {
        font-size: 110%;
    }
}

/* Tablet breakpoint */
@media only screen and (min-width: 720px) and (max-width: 1023px) {
    h1 {
        font-size: 2.7rem;
    }
    section {
        padding: 1.5rem 0.8rem;
    }
    aside {
        width: 40%;
    }
}

/* Mobile breakpoint */
@media only screen and (max-width: 719px) {
    body {
        grid-template-columns: 10% 80% 10%;
    }
    h1 {
        font-size: 2.5rem;
    }
    h2 {
        font-size: 2rem;
    }
    h3 {
        font-size: 1.6rem;
    }
    h4 {
        font-size: 1.3rem;
    }

    body > header {
        display: block;
    }

    body > header > a {
        display: flex;
        margin: 0 auto;
        justify-content: center;
    }

    /* Make aside full-width on mobile */
    aside {
        width: 100%;
        float: none;
        margin-inline-start: 0;
    }

    /* Makes input fields wider on smaller screens */
    textarea,
    select,
    input {
        width: 100%;
    }

    /* Reduce nav side on mobile */
    nav {
        flex-wrap: wrap;
    }
    nav a {
        border: none;
        padding: 0;
        text-decoration: underline;
        line-height: 1;
    }

    dialog {
        max-width: calc(100vw - 2rem);
    }
}

/* Medium mobile breakpoint */
@media only screen and (max-width: 480px) {
    nav ul li {
        display: block;
        margin: 0.5rem 0;
    }
}

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

    body {
        display: block;
        background: white;
        color: black;
        font-size: 12pt;
    }

    body > header {
        background-color: unset;
    }

    nav,
    body > footer {
        display: none;
    }

    article {
        border: none;
        padding: 0;
        break-inside: avoid;
    }

    h2,
    h3,
    h4 {
        break-after: avoid;
    }
    ul,
    ol,
    dl {
        break-inside: avoid;
    }

    dt {
        font-weight: bold;
        margin-top: 0.5cm;
    }

    dd {
        margin-left: 1cm;
    }

    a[href^="http"]::after {
        content: " <" attr(href) ">";
        font-size: 9pt;
        color: #666;
    }

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

    a {
        text-decoration: none;
        color: black;
    }

    p {
        widows: 3;
        orphans: 3;
    }

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

    mark {
        border: 1px solid #666;
        background: white;
    }

    pre,
    table,
    figure,
    img,
    svg {
        break-inside: avoid;
        max-width: 100% !important;
    }

    pre code {
        white-space: pre-wrap;
        font-size: 10pt;
    }

    /* Hide unnecessary elements when printing */
    button,
    input[type="button"],
    input[type="submit"],
    input[type="reset"] {
        display: none;
    }

    /* Format listings better for print */
    dl dt {
        font-size: 14pt;
        margin-top: 0.7cm;
    }
}

/* Classes */

/* Menu Component */
.menu-list,
.menu-item {
    position: relative;
}

.menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.menu-item {
    padding: 0;
    margin: 0;
    height: 100%;
    max-width: 12rem;
}

.menu-link,
.menu-heading {
    display: block;
    text-decoration: none;
    white-space: nowrap;
    text-align: left;
    padding: 0.5rem 1rem;
    color: var(--text);
}

.menu-horizontal {
    width: 100%;
    white-space: nowrap;
    display: flex;
}

.menu-horizontal .menu-list {
    display: inline-block;
}

.menu-horizontal .menu-item,
.menu-horizontal .menu-heading,
.menu-horizontal .menu-separator {
    display: inline-block;
    vertical-align: middle;
}

.menu-item .menu-item {
    display: block;
}

/* Menu dropdowns */
.menu-children {
    background: var(--border);
    display: none;
    position: absolute;
    left: 100%;
    top: 0;
    margin: 0;
    padding: 0;
    z-index: 3;
    box-shadow: var(--shadow-medium);
}

.menu-horizontal .menu-children {
    left: 0;
    top: auto;
    width: inherit;
}

.menu-allow-hover:hover > .menu-children,
.menu-active > .menu-children {
    display: inline-block;
    position: absolute;
}

.menu-has-children > .menu-link:after {
    padding-left: 0.5em;
    content: "\25B8";
    font-size: small;
}

.menu-horizontal .menu-has-children > .menu-link:after {
    content: "\25BE";
}

.menu-has-children:hover > .menu-link:after {
    transform: rotate(90deg);
}

.menu-horizontal .menu-has-children:hover > .menu-link:after {
    transform: rotate(180deg);
}

/* Menu scrolling */
.menu-scrollable {
    overflow-y: scroll;
    overflow-x: hidden;
}

.menu-scrollable .menu-list {
    display: block;
}

.menu-horizontal.menu-scrollable .menu-list {
    display: inline-block;
}

.menu-horizontal.menu-scrollable {
    white-space: nowrap;
    overflow-y: hidden;
    overflow-x: auto;
    padding: 0.5rem 0;
    scrollbar-width: thin;
}

/* Menu separators & styling */
.menu-separator,
.menu-horizontal .menu-children .menu-separator {
    background: var(--preformatted);
    height: 1px;
    margin: 0.3rem 0;
}

.menu-horizontal .menu-separator {
    width: 1px;
    height: 1.3rem;
    margin: 0 0.3rem;
}

.menu-horizontal .menu-children .menu-separator {
    display: block;
    width: auto;
}

.menu-heading {
    text-transform: uppercase;
}

.menu-disabled {
    opacity: 0.5;
}

.menu-disabled .menu-link:hover {
    color: inherit;
    background: transparent;
    cursor: not-allowed;
}

.menu-active > .menu-link,
.menu-link:hover,
.menu-link:focus {
    background: var(--bg-menu);
    outline: none;
}

.menu-selected > .menu-link,
.menu-selected > .menu-link:visited {
    background: var(--bg-menu);
}

/* Form layouts */
.form-aligned input,
.form-aligned select,
.form-message-inline {
    display: inline-block;
    vertical-align: middle;
}

.form-aligned textarea {
    display: inline-block;
    vertical-align: top;
}

.form-aligned .control-group label {
    text-align: right;
    display: inline-block;
    vertical-align: middle;
    width: 12rem;
    margin: 0 1rem 0.5rem 0;
}

.form-aligned .controls {
    margin: 1.5rem 0 0 13.25rem;
}

/* Media Queries */

/* Mobile breakpoint */
@media only screen and (max-width: 720px) {
    .form-aligned .control-group label {
        text-align: left;
    }
    .form-aligned .controls {
        margin: 1.5rem 0 0 0;
    }
}
