@font-face {
    font-family: 'Berkeley Mono';
    src: url('../fonts/BerkeleyMonoVariable.woff2') format('woff2');
    font-weight: 100 900;
    font-display: swap;
}

@font-face {
    font-family: "Atkinson Hyperlegible Next";
    src: url("../fonts/AtkinsonHyperlegibleNextVF-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --bgcolor: #fbfbfa;
    --fontcolor: #1a1a1a;
    --linkcolor: #2563eb;
    --visitedcolor: #2563eb;
    --border-color: #e5e7eb;
    --code-border: #d1d5db;
    --meta-color: #6b7280;

    --aside-note-bg: #eff6ff;
    --aside-note-border: #3b82f6;
    --aside-note-text: #1e3a8a;

    --aside-tip-bg: #fdf2f8;
    --aside-tip-border: #db2777;
    --aside-tip-text: #831843;

    --aside-danger-bg: #fef2f2;
    --aside-danger-border: #ef4444;
    --aside-danger-text: #7f1d1d;
}

:root[data-theme='dark'] {
    --bgcolor: #100f0f;
    --fontcolor: #cecdc3;
    --linkcolor: #78a9ff;
    --visitedcolor: #78a9ff;
    --border-color: #282828;
    --code-border: #403e3c;
    --meta-color: #878580;

    --aside-note-bg: #12253b;
    --aside-note-border: #4385be;
    --aside-note-text: #cecdc3;

    --aside-tip-bg: #39172b;
    --aside-tip-border: #ce5d97;
    --aside-tip-text: #cecdc3;

    --aside-danger-bg: #3e1715;
    --aside-danger-border: #d14d41;
    --aside-danger-text: #cecdc3;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    font-family: "Atkinson Hyperlegible Next", sans-serif;
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
    background: var(--bgcolor);
    color: var(--fontcolor);
    font-size: 1rem;
    line-height: 1.25;
    text-wrap: pretty;
}

a {
    color: var(--linkcolor);
    text-decoration: underline;
    text-decoration-color: transparent;
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s ease;
}

a:hover {
    text-decoration-color: currentColor;
}

h1,
h2,
h3,
h4 {
    line-height: 1.2;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--fontcolor);
}

p {
    margin: 10px 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

header a {
    font-weight: bold;
    color: var(--linkcolor);
    text-decoration: none;
    font-size: 1.1rem;
    margin-right: 20px;
}

header a:hover {
    text-decoration: underline;
    text-underline-offset: 4px;
}

hr {
    border: 0;
    height: 0;
    border-bottom: 1px solid var(--border-color);
    margin: 0 0;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: auto;
}

figure {
    margin: 1.5rem 0;
}

figcaption {
    color: var(--meta-color);
    font-size: 0.9rem;
    text-align: center;
    margin-top: 0.5rem;
    font-style: italic;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.container>footer {
    margin-top: auto;
}

.blog-title,
.post-item {
    margin: 20px 0;
}

.post-meta {
    font-size: .9em;
    color: var(--meta-color);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0 0;
}

.post-content {
    margin: 20px 0;
}

.post-title {
    margin-bottom: 0;
}

code,
pre {
    font-family: "Berkeley Mono", monospace;
    font-size: 0.95rem;
}

code:not(pre code) {
    display: inline-block;
    border: 1px solid var(--code-border);
    border-radius: 0.3rem;
    padding: 0px 5px;
    margin: 0px 1px;
    line-height: 1.2;
    background: transparent;
}

pre {
    padding: 1rem;
    overflow: auto;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
    line-height: 1.3;
    margin: 1.5rem 0;
}

blockquote {
    border-left: 3px solid var(--code-border);
    margin: 1.5rem 0;
    padding: 0 1rem;
    font-style: italic;
    color: var(--meta-color);
}

table {
    margin: 15px 0;
    border-collapse: collapse;
    width: 100%;
}

table th,
table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-color);
}

table th {
    text-align: left;
    font-weight: bold;
}

.center {
    text-align: center;
}

.hidden {
    display: none;
}

button#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--fontcolor);
    font-family: inherit;
}

footer {
    font-size: 0.9rem;
    text-align: center;
    padding: 0 0;
    color: var(--meta-color);
}

@media screen and (max-width: 650px) {
    body {
        max-width: 90%;
    }

    header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    header a {
        margin: 0 10px;
    }
}

.aside {
    margin: 1rem 0;
    border-radius: .2rem;
    padding: 1rem;
    position: relative;
    padding-left: 1.5rem;
    border-left: 4px solid;
}

.aside-note {
    background: var(--aside-note-bg);
    border-color: var(--aside-note-border);
    color: var(--aside-note-text);
}

.aside-tip {
    background: var(--aside-tip-bg);
    border-color: var(--aside-tip-border);
    color: var(--aside-tip-text);
}

.aside-danger {
    background: var(--aside-danger-bg);
    border-color: var(--aside-danger-border);
    color: var(--aside-danger-text);
}

.post-toc {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 2rem 0;
    max-width: 100%;
}

.toc-title {
    font-family: "Atkinson Hyperlegible Next", sans-serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--fontcolor);
    margin-bottom: 1rem;
}

.post-toc nav ul {
    list-style-type: disc;
    padding-left: 1.25rem;
    margin: 0;
}

.post-toc li {
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.post-toc li:last-child {
    margin-bottom: 0;
}

.post-toc a {
    color: var(--linkcolor);
    text-decoration: none;
}

.post-toc a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-toc nav ul ul {
    list-style-type: circle;
    margin-top: 0.4rem;
    margin-bottom: 0.2rem;
    padding-left: 1.5rem;
}
