:root {
    color-scheme: light dark;

    --c-bg-light: #dedbd2;
    --c-fg-light: #18181b;
    --c-hi-light: #18181b;
    --c-lo-light: #2f2f36;

    --c-bg-dark: var(--c-fg-light);
    --c-fg-dark: var(--c-bg-light);
    --c-hi-dark: var(--c-bg-light);
    --c-lo-dark: #555;

    --radius: 5px;
    --content-max-width: 120ch;
}

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

body {
    font-family: sans-serif;
    margin: 0;
    background: light-dark(var(--c-bg-light), var(--c-bg-dark));
    color: light-dark(var(--c-fg-light), var(--c-fg-dark));
    line-height: 1.4;
    padding: clamp(1rem, 3vw, 3rem) clamp(1.5rem, 5vw, 4.5rem);
    word-wrap: break-word;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

body > * {
    width: min(100%, var(--content-max-width));
}

@media (min-width: 768px) {
    body {
        font-size: 1.1rem;
        line-height: 1.5;
    }
}

@media (min-width: 1400px) {
    body {
        font-size: 1.2rem;
        line-height: 1.5;
    }
}

@media (min-width: 1920px) {
    body {
        font-size: 1.3rem;
        line-height: 1.6;
    }
}

small {
    font-size: 0.8rem;
    color: light-dark(var(--c-lo-light), var(--c-lo-dark));
}

a {
    color: light-dark(var(--c-hi-light), var(--c-hi-dark));
    text-decoration: none;
    font-weight: bold;
    font-family: monospace;
    transition: color 0.2s ease;
}

h2 > a::before {
    content: "#";
    position: absolute;
    left: -1.25em;
    opacity: 0;
    transition: opacity 0.2s ease;
    color: light-dark(var(--c-lo-light), var(--c-lo-dark));
}

h2 > a:hover::before {
    opacity: 1;
}

a:hover {
    filter: brightness(1.3);
    text-decoration: underline;
}

h1 {
    font-size: 2.5rem;
    text-align: center;
}

h2 {
    font-size: 2rem;
}

h1,
h2,
h3 {
    padding-left: 0.5rem;
    font-family: monospace;
    margin-top: 4rem;
    text-shadow: 9px 6px 13px 2px rgba(0, 0, 0, 0.1);
}

ul {
    padding-left: 0.25em;
    list-style-type: ">";
    font-family: monospace;
    line-height: 2;
}

li {
    padding-left: 1em;
}

article {
    margin-top: 1em;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: monospace;
    font-weight: bold;
}

.code-block-wrapper {
    position: relative;
    margin: 2rem;
}

@media (max-width: 640px) {
    .code-block-wrapper {
        margin: 1.5rem 0;
    }
}

pre {
    border: 2px solid light-dark(var(--c-lo-light), var(--c-lo-dark));
    border-radius: var(--radius);
    padding: 1rem;
    margin: 0;
    overflow-x: auto;
}

.copy-button {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    padding: 0.25rem 0.5rem;
    font-family: monospace;
    font-size: 0.75rem;
    background: light-dark(var(--c-bg-light), var(--c-bg-dark));
    color: light-dark(var(--c-fg-light), var(--c-fg-dark));
    border: 1px solid light-dark(var(--c-lo-light), var(--c-lo-dark));
    border-radius: var(--radius);
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.copy-button:hover {
    opacity: 1;
}

.copy-button:active {
    opacity: 0.5;
}

code {
    font-family: monospace;
}

blockquote {
    border-left: 4px solid
        light-dark(var(--c-lo-light), rgba(222, 219, 210, 0.6));
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    color: light-dark(var(--c-lo-light), var(--c-bg-light));
    background: light-dark(rgba(24, 24, 27, 0.05), rgba(255, 255, 255, 0.08));
    font-style: italic;
    border-radius: var(--radius);
}

html,
body {
    max-width: 100%;
    overflow-x: hidden;
    word-wrap: break-word;
}

p,
li,
h1,
h2,
h3 {
    word-break: break-word;
}

figure {
    display: block;
    text-align: center;
    margin: 2em auto;
}

figure img,
figure svg {
    max-width: 75%;
    height: auto;
    display: block;
    margin: 0 auto;
    max-height: 400px;
    border: 2px solid light-dark(var(--c-lo-light), var(--c-lo-dark));
    box-shadow: 5px light-dark(var(--c-lo-light), var(--c-lo-dark));
    border-radius: var(--radius);
}

figcaption {
    font-size: 0.9em;
    color: light-dark(var(--c-lo-light), var(--c-lo-dark));
    margin-top: 0.5em;
    font-style: italic;
}

footer {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    align-items: center;
    text-align: center;
    margin-top: 2em;
}
