* {
    box-sizing: border-box;
    padding: 0;
    margin: 0;
    min-width: 0;
}

:root {
    color-scheme: light;
    --color-surface: hsl(0, 0%, 95%);
    --color-lowered: hsl(0, 0%, 94%);
    --color-raised: hsl(0, 0%, 98%);
    --color-super-lowered: hsl(0, 0%, 90%);
    --color-super-raised: hsl(0, 0%, 100%);
    --color-primary: hsl(341, 59%, 45%);
    --color-text: hsl(0, 0%, 0%);
    --color-link: #2949b2;
    --color-shadow: rgba(0, 0, 0, 0.15);
    --radius: 0.35rem;
}

html,
body {
    line-height: 1.5;
    letter-spacing: 0.15px;
    font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
        "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    color: var(--color-text);
    background: var(--color-surface);
    overflow: hidden auto;
    height: 100dvh;
    scroll-behavior: smooth;
}

#page {
    background: var(--color-surface);
    padding: 0;
    display: flex;
    justify-content: center;
    max-width: 100%;
}

main {
    margin: auto;
    width: 100%;
    max-width: 100%;
}

@media (min-width: 768px) {
    main {
        width: calc(80ch + 1rem);
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
}

article {
    width: 100%;
    margin: auto;
    max-width: 100%;
    padding: 0 0.75rem;
    margin-bottom: 0.75rem;
}

.content_container {
    margin: auto;
    width: 100%;
}

@media screen and (min-width: 500px) {
    .content_container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    #page {
        padding: 0.5rem;
    }

    .content_container {
        max-width: 720px;
    }
}

@media (min-width: 900px) {
    .content_container {
        max-width: 960px;
    }

    @media (min-width: 1200px) {
        article {
            padding: 0;
        }

        .content_container {
            max-width: 1100px;
        }
    }
}

ol,
ul,
menu {
    list-style: inside;
    margin: 0 0 1rem 0;
    padding: 0 0 0 20px;
}

hr {
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
    border: 0;
    border-top: solid 1px var(--color-super-lowered);
}

hr.small {
    margin-top: 0.25rem;
    margin-bottom: 0.25rem;
}

p,
pre,
table,
ul,
ol,
blockquote {
    margin-bottom: 1rem;
}

ol {
    list-style: decimal;
}

.footernav {
    display: flex;
    gap: 0.75rem;
}

.footernav .item {
    position: relative;
    margin-left: 0.5rem;
}

.footernav .item:first-child {
    margin-left: 0;
}

.footernav .item::before {
    content: "·";
    position: absolute;
    left: -0.75rem;
}

.footernav .item:first-child:before {
    display: none;
}

pre {
    padding: 0.5rem;
    border: solid 1px var(--color-lowered);
    background: var(--color-surface);
    overflow: auto;
    max-width: 100%;
}

code:not(pre code) {
    padding: 0.2rem;
    border-radius: var(--radius);
    background: var(--color-lowered);
}

p,
li,
span,
code {
    max-width: 100%;
    overflow-wrap: normal;
    text-wrap: pretty;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.card,
.card-nest {
    background: var(--color-raised);
    color: var(--color-text-raised) !important;
    border-radius: var(--radius);
    padding: 0.75rem;
    max-width: 100vw;
    box-shadow: 0 0 2px var(--color-shadow);
}

.card.padded {
    padding: 1rem;
}

.card-nest {
    padding: 0;
}

.card-nest:has(.card:nth-child(3)) .card {
    /* if the nest has a third element, make cards default to no border-radius */
    border-radius: 0;
}

.card-nest .card:first-child {
    border-top-left-radius: var(--radius);
    border-top-right-radius: var(--radius);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    background: var(--color-lowered);
    color: var(--color-text-lowered) !important;
    box-shadow: none;
}

.card-nest .card:last-child {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: var(--radius);
    border-bottom-right-radius: var(--radius);
    box-shadow: none;
}

.card.secondary {
    background: var(--color-lowered);
    color: var(--color-text-lowered) !important;
}

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

a:hover {
    text-decoration: underline;
}

img {
    display: inline;
    max-width: 100%;
    vertical-align: middle;
    border-radius: var(--radius);
}
