:root {
    --bg: #111111;
    --surface: #1f1610;
    --border: #3d2b1a;
    --selection: #3a0a00;
    --fg: #c4a882;
    --fg-bright: #d9c6a5;
    --fg-dim: #8b7355;
    --comment: #6b5a45;
    --amber: #d48b30;
    --amber-hi: #f0a030;
    --rust: #c84820;
    --rust-hi: #dc4a20;

    --mono: "Comic Mono", "Liberation Mono", "DejaVu Sans Mono", Menlo, monospace;
    /* site-wide text font; code always uses --mono */
    --prose: Charter, "Bitstream Charter", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
    --measure: 90ch;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-size: inherit;
}

h1 {
    font-size: 26px;
    line-height: 1.25;
}

h2 {
    font-size: 20px;
    line-height: 1.3;
}

h3 {
    font-size: 17px;
    line-height: 1.35;
}

::selection {
    background: var(--selection);
    color: var(--fg-bright);
}

body {
    font-family: var(--prose);
    background: var(--bg);
    color: var(--fg-bright);
    padding: 32px;
    max-width: 100%;
    margin: 0 auto;
    line-height: 1.6;
    font-size: 16px;
}

nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;
    margin-bottom: 24px;
}

.nav-links {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
}

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

small, h1, h2, p {
    display: block;
    margin-bottom: 4px;
}

small {
    color: var(--fg-dim);
    font-size: 14px;
}

.page {
    display: none;
}

/* show the targeted page; fall back to home when no page is targeted */
.page:target,
#home {
    display: block;
}

body:has(.page:target) #home:not(:target) {
    display: none;
}

.intro {
    margin-bottom: 12px;
}

.post-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.post-entry {
    display: block;
    border-bottom: 1px solid var(--border);
    padding-bottom: 16px;
}

.post-entry:hover h2 {
    color: var(--amber-hi);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.card {
    display: block;
    border: 1px solid var(--border);
    padding: 16px;
    background: var(--surface);
    transition: border-color 0.2s;
}

.card:hover {
    border-color: var(--amber);
}

.card p {
    font-size: 14px;
    color: var(--fg);
}

.tag {
    background: var(--border);
    color: var(--fg-bright);
    font-size: 13px;
    padding: 2px 6px;
    margin-right: 4px;
    margin-top: 8px;
    display: inline-block;
}

hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* blog posts (generated from posts/*.org) */
article {
    max-width: var(--measure);
    margin: 0 auto;
    font-size: 18px;
    line-height: 1.65;
}

article header h1 {
    margin: 0 0 8px;
}

article .subtitle {
    color: var(--fg);
    font-style: italic;
    margin-bottom: 8px;
}

article h2 {
    margin: 48px 0 12px;
    color: var(--amber);
}

article h3 {
    font-size: 19px;
    margin: 32px 0 8px;
}

article p,
article ul,
article ol,
article pre,
article blockquote,
article table {
    margin-bottom: 16px;
}

article ul,
article ol {
    padding-left: 24px;
}

article li {
    margin-bottom: 6px;
}

article li > ul,
article li > ol {
    margin: 6px 0 0;
}

article strong {
    color: var(--fg-bright);
    font-weight: 700;
}

article a {
    color: var(--amber);
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 3px;
}

article a:hover {
    color: var(--amber-hi);
    text-decoration-color: currentColor;
}

article .back {
    text-decoration: none;
    font-size: 15px;
}

.toc {
    font-size: 15px;
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 8px 12px;
    margin-top: 16px;
}

.toc summary {
    cursor: pointer;
    color: var(--fg-dim);
}

.toc ul {
    list-style: none;
    padding-left: 16px;
    margin: 4px 0 0;
}

.toc > nav > ul,
.toc > ul {
    padding-left: 0;
}

.toc li {
    margin: 2px 0;
}

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

pre {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 12px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.5;
}

code {
    font-family: var(--mono);
    font-size: 0.85em;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0 4px;
}

pre code {
    font-size: inherit;
    background: none;
    border: none;
    padding: 0;
}

blockquote {
    border-left: 2px solid var(--amber);
    padding-left: 16px;
    color: var(--fg);
    font-style: italic;
}

/* wide tables scroll inside the article instead of the whole page */
table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 15px;
    line-height: 1.45;
}

th, td {
    border: 1px solid var(--border);
    padding: 4px 8px;
    vertical-align: top;
}

th {
    background: var(--surface);
    text-align: left;
    white-space: nowrap;
}

img {
    max-width: 100%;
}

@media (max-width: 600px) {
    body {
        padding: 16px;
    }

    article {
        font-size: 17px;
    }

    article h2 {
        margin-top: 36px;
    }
}
