@import url('https://fonts.googleapis.com/css2?family=Inter+Tight:ital,wght@0,100..900;1,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Source+Code+Pro');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined');

:root {
    --font-size: 16px;
    /* Changing this scales everyting. */
    --content-width: 45em;
    --font: Inter Tight;
    --font-mono: 'Source Code Pro';
    --foreground: rgb(217, 224, 238);
    --foreground-alt: rgb(67, 61, 87);
    --background: #1e1e2e;
    --background-alt: rgb(159, 120, 149);
    --good: #a3be8c;
    --bad: hsl(354, 74%, 62%);
    --warn: #ebcb8b;
    --roundness: 0.2em;
}

html,
body,
input,
select,
button,
textarea {
    margin: 0;
    padding: 0;
    color: var(--foreground);
    background-color: var(--background);
    font-family: var(--font), sans-serif;
    font-size: var(--font-size);
    line-height: 1.4em;
    font-weight: 350;
}

body {
    min-height: 100vh;
    background: linear-gradient(to top, var(--background), var(--foreground-alt)) no-repeat;
    background-position: top;
}

/* ---------------------------------------- Header, footer and navigation. -- */

div.framed {
    padding: 1em;
    border-radius: var(--roundness);
    background-color: color-mix(in srgb, var(--foreground-alt) 50%, transparent);
}

div.framed > p {
    margin-bottom: 0;
}

header {
    margin: 0;
    padding: 1em;
    top: 0;
    z-index: 100;
}

header>div {
    margin: 0;
    padding: 0.75em 1em;
    display: flex;
    margin: auto;
    max-width: var(--content-width);
    justify-content: space-between;
    align-items: center;
}

header>div>a {
    font-size: 1.25em;
    text-decoration: none;
    color: var(--foreground);
}

header>div>a.icon {
    font-size: 2.2em;
    opacity: 0.7;
    color: var(--foreground);
}

header>div>a.icon:hover {
    opacity: 1;
}

header>div>a.icon:hover {
    color: var(--foreground);
    text-decoration: none;
}

.section {
    border: 1px solid var(--foreground-alt);
    padding: 20px;
    border-radius: 5px;
    margin: 20px 0;
    background-color: color-mix(in srgb, var(--background) 50%, transparent);
}

.section > h3 {
    color: var(--foreground);
    font-weight: 400;
}

footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 auto 0 auto;
    padding: 1em 1em 0.3em 1em;
    max-width: var(--content-width);
    border-top: 1px solid var(--background-alt);
    margin-top: auto;
}

/* footer a {
    color: color-mix(in srgb, var(--foreground-alt) 100%, white 70%);
    text-decoration: none;
    font-size: 0.75em;
} */

footer a:hover {
    color: var(--foreground);
    text-decoration: none;
}

/* ---------------------------------------- Table of contents -- */

nav {
    margin: 0;
    padding: 1em;
    max-width: var(--content-width);
    margin: auto;
}

nav>h1 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5em 0 0 0;
    padding: 0.5em 0.2em 0.5em 0.2em;
    font-size: 1.2em;
    color: var(--foreground);
    border-bottom: 1px solid var(--background-alt);
    cursor: pointer;
}

nav a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    padding: 0.5em 0.2em 0.5em 0.2em;
    font-size: 1.2em;
    max-width: var(--content-width);
    list-style-type: none;
    color: var(--foreground);
    border-bottom: 1px solid var(--background-alt);
    text-decoration: none;
}

nav a:hover,
nav h1:hover {
    color: var(--foreground);
    background-color: var(--background-alt);
}

nav button {
    position: absolute;
    top: 1em;
    right: 1em;
    text-decoration: none;
    font-size: 2em;
    color: var(--foreground);
    background: none;
    border: none;
}

/* ---------------------------------------- Main content --*/

main {
    margin: 0;
    padding: 1em 1em 0 1em;
    max-width: var(--content-width);
    margin: auto;
}

h1,
h2 {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1em 0 1em 0;
    padding: 0 0 0.5em 0;
    font-size: 1.75em;
    border-bottom: 1px solid #3a3a52;
}

h2 {
    font-size: 1.5em;
}

h3 {
    font-size: 1.25em;
}

p {
    margin: 0 0 1em 0;
    padding: 0;
}

a {
    color: var(--foreground);
    text-decoration: underline color-mix(in srgb, var(--foreground) 50%, transparent);
}

a:hover {
    color: var(#5e81ac);
    text-decoration: underline solid var(--foreground);
}

pre {
    margin: 0 0 1em 0;
    padding: 0.6em 1em;
    border-radius: var(--roundness);
    background-color: var(--foreground-alt);
    color: var(--background-alt);
    font-family: var(--font-mono);
    font-size: 0.85em;
}

code {
    padding: 0.1em 0.3em;
    border-radius: var(--roundness);
    background-color: var(--foreground-alt);
    color: var(--background-alt);
    font-family: var(--font-mono);
    font-size: 0.85em;
    white-space: nowrap;
}

img {
    max-width: 100%;
}

img.framed {
    max-width: 100%;
    box-sizing: border-box;
    padding: 0.7em;
    border-radius: var(--roundness);
    background-color: var(--foreground-alt);
}

/* ---------------------------------------- Form -- */

li > a {
    color: var(--foreground);
    text-decoration: underline;
}

button {
    margin: 0;
    padding: 0.6em 1.2em;
    border: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    background-color: var(--foreground-alt);
    color: var(--background);
    border-radius: var(--roundness);
    font-size: var(--font-size);
}

button.good {
    background-color: var(--good)
}

button.bad {
    background-color: var(--bad)
}

button:hover {
    filter: brightness(1.1);
    /* box-shadow       : 0 0.1em 0.2em 0 rgba(0, 0, 0, 0.2), 0 0.1em 0.2em 0 rgba(0, 0, 0, 0.2); */
}

button>span.icon {
    padding: 0 0.3em 0 0;
    font-size: 1.2em;
    line-height: 1em;
}

/* ---------------------------------------- Flex -- */

.flexed {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
    flex-wrap: nowrap;
}

.flexed.top {
    align-items: flex-start;
}

.flexed>* {
    flex-grow: 1;
}

/* ---------------------------------------- Icon -- */

.icon {
    margin: 0;
    padding: 0;
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
}

/* other */

hr {
    margin: 1em 0;
    padding: 0;
    border: none;
    border-top: 1px solid var(--background-alt);
}

/* Animations for details expansion */
details {
    transition: all 0.3s ease;
}

details[open] {
    transition: all 0.3s ease;
}

details>summary {
    cursor: pointer;
    list-style: none;
    padding: 0.5em 0.2em 0.5em 0.2em;
    font-size: 1.2em;
    color: var(--foreground);
    /* border-bottom: 1px solid var(--background-alt); */
}

details>summary:hover {
    color: var(--foreground);
    background-color: var(--background-alt);
}

details>summary::-webkit-details-marker {
    display: none;
}

details>summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 0.5em;
    transition: transform 0.3s ease;
    font-size: 0.5em;
    vertical-align: top;
}

details[open]>summary::before {
    transform: rotate(90deg);
}

details>ul {
    margin-top: 1em;
}

.bad {
    color: var(--bad);
}

.section > h3 {
    margin-top: 0.1em;
}

.section > h2 {
    margin-top: 0.4em;
}

.section > h1 {
    margin-top: 0.5em;
}