body {
    margin: 0;
    background: #ffffff;
    color: #111;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 16px;
    line-height: 1.6;
}

.container {
    max-width: 720px;
    margin: 40px auto;
    padding: 0 16px;
}

.name {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 8px;
}

.divider {
    margin: 24px 0;
    white-space: nowrap;
    overflow: hidden;
    color: #444;
}

.content img {
    max-width: 100%;
    display: block;
    margin: 32px auto;
}

.content h2 {
    margin-top: 48px;
    font-size: 18px;
    font-weight: 600;
    color: #000;
}

.content ul {
    padding-left: 0;
    list-style: none;
}

.content ul li {
    margin-bottom: 6px;
}

.content a {
    color: #000;
    border-bottom: 1px solid #000;
    text-decoration: none;
    transition: all 0.2s ease;
    padding: 2px 4px;
}

.content a:hover {
    background: #ff3b3b;
    color: #fff;
    border-bottom-color: #ff3b3b;
}

/* Blog styles */
.post-list {
    margin-top: 24px;
}

.post-item {
    margin-bottom: 32px;
}

.post-date {
    font-size: 14px;
    color: #666;
    margin-bottom: 4px;
}

.post-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.post-title a {
    color: #000;
    text-decoration: none;
    border-bottom: 2px solid #ff3b3b;
    transition: all 0.2s ease;
    padding: 2px 6px;
}

.post-title a:hover {
    background: #ff3b3b;
    color: #fff;
    border-bottom-color: #ff3b3b;
}

.post-excerpt {
    color: #444;
    margin: 0;
}

/* Markdown content styling */
.content pre {
    background: #f6f8fa;
    color: #24292e;
    padding: 20px 24px;
    overflow-x: auto;
    border-radius: 6px;
    line-height: 1.6;
    margin: 24px 0;
    border: 1px solid #e1e4e8;
    font-size: 14px;
}

.content pre::-webkit-scrollbar {
    height: 8px;
}

.content pre::-webkit-scrollbar-track {
    background: transparent;
}

.content pre::-webkit-scrollbar-thumb {
    background: #d1d5da;
    border-radius: 4px;
}

.content pre::-webkit-scrollbar-thumb:hover {
    background: #959da5;
}

.content code {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    font-size: 13.5px;
    background: #f6f8fa;
    padding: 3px 6px;
    border-radius: 3px;
    color: #d73a49;
    font-weight: 500;
}

.content pre code {
    background: none;
    padding: 0;
    color: #24292e;
    font-weight: 400;
    font-size: 14px;
}

.content blockquote {
    margin: 24px 0;
    padding-left: 16px;
    border-left: 3px solid #ff3b3b;
    color: #444;
    font-style: italic;
}

.content hr {
    border: none;
    border-top: 1px solid #ddd;
    margin: 32px 0;
}

.content img + em {
    display: block;
    text-align: center;
    font-size: 14px;
    color: #666;
    margin-top: -24px;
    margin-bottom: 24px;
}

/* Portfolio preview */

/* Dark mode: follows the system setting, same palette as the experimental pages */
@media (prefers-color-scheme: dark) {
    body { background: #0d0d0d; color: #e8e8e8; }
    .name, .content h2, .content h1, .post-title a, .content a { color: #e8e8e8; }
    .content a { border-bottom-color: #e8e8e8; }
    .divider { color: #555; }
    .post-date, .content img + em { color: #888; }
    .post-excerpt, .content blockquote { color: #aaa; }
    .content pre { background: #1a1a1a; color: #e8e8e8; border-color: #2a2a2a; }
    .content pre code { color: #e8e8e8; }
    .content code { background: #1a1a1a; color: #ff6b6b; }
    .content hr { border-color: #2a2a2a; }
    .content pre::-webkit-scrollbar-thumb { background: #444; }
    .content pre::-webkit-scrollbar-thumb:hover { background: #666; }
}

/* ── Code blocks: syntax colours + copy ─────────────────────────────── */
.content pre { position: relative; tab-size: 4; -moz-tab-size: 4; }
.copy-btn {
    position: absolute; top: 8px; right: 10px;
    font: inherit; font-size: 12px; color: #999;
    background: none; border: none; padding: 0 4px; cursor: pointer;
    opacity: 0; transition: opacity 0.2s ease, color 0.2s ease;
}
.content pre:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: #ff3b3b; }

.hljs-keyword { color: #cf222e; }
.hljs-string { color: #0a3069; }
.hljs-comment { color: #6e7781; font-style: italic; }
.hljs-number, .hljs-literal { color: #0550ae; }
.hljs-title { color: #8250df; }
.hljs-type, .hljs-built_in { color: #953800; }

/* ── Live demo: plain lines, same links as the nav ───────────────────── */
.crdt-demo { margin: 28px 0; }
.demo-line {
    display: grid; grid-template-columns: 64px 1fr;
    align-items: baseline; column-gap: 12px; row-gap: 6px;
    margin-bottom: 8px;
}
.demo-line > :nth-child(n+3) { grid-column: 2; }
.demo-line:has(.demo-link) { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-left: 76px; }
.demo-line:has(.demo-link) .demo-label { width: 64px; margin-left: -76px; }
.demo-label { color: #666; }
.demo-link {
    font: inherit; color: #000; background: none; cursor: pointer;
    border: none; border-bottom: 2px solid #ff3b3b; padding: 2px 6px;
    transition: all 0.2s ease;
}
.demo-link:hover, .demo-link.on { background: #ff3b3b; color: #fff; }
.demo-input {
    font: inherit; color: #111; background: none; width: 100%; min-width: 0;
    border: none; border-bottom: 1px dotted #999; padding: 2px 0; border-radius: 0;
}
.demo-input:focus { outline: none; border-bottom: 1px solid #ff3b3b; }
.demo-line:has(.demo-input) { grid-template-columns: 64px 1fr auto; }
.demo-line:has(.demo-input) > :nth-child(n+3) { grid-column: auto; }
.demo-pending { font-size: 13px; color: #ff3b3b; }
.demo-status { min-height: 1.6em; margin-top: 4px; color: #111; }
.demo-status.bad { color: #ff3b3b; }
.raft-demo, .set-demo { margin: 28px 0; }
.demo-pending.quiet { color: #666; }
.demo-readonly { border-bottom-color: transparent; }
.demo-set { min-width: 19ch; color: #111; white-space: pre-wrap; }
.demo-clock { color: #888; font-size: 13px; }
@media (max-width: 600px) {
    .raft-demo .demo-line:has(.demo-input) { grid-template-columns: 64px 1fr; row-gap: 0; }
    .raft-demo .demo-line:has(.demo-input) > .demo-pending { grid-column: 2; }
}

@media (prefers-color-scheme: dark) {
    .copy-btn { color: #666; }
    .copy-btn:hover { color: #ff6b6b; }
    .hljs-keyword { color: #ff7b72; }
    .hljs-string { color: #a5d6ff; }
    .hljs-comment { color: #8b949e; }
    .hljs-number, .hljs-literal { color: #79c0ff; }
    .hljs-title { color: #d2a8ff; }
    .hljs-type, .hljs-built_in { color: #ffa657; }
    .demo-label { color: #888; }
    .demo-link { color: #e8e8e8; border-bottom-color: #ff6b6b; }
    .demo-link:hover, .demo-link.on { background: #ff6b6b; color: #0d0d0d; }
    .demo-input { color: #e8e8e8; border-bottom-color: #555; }
    .demo-input:focus { border-bottom-color: #ff6b6b; }
    .demo-pending, .demo-status.bad { color: #ff6b6b; }
    .demo-status { color: #e8e8e8; }
    .demo-pending.quiet { color: #888; }
    .demo-readonly { border-bottom-color: transparent; }
    .demo-set { color: #e8e8e8; }
}

/* ── Post tables and figures ───────────────────────────────────────── */
.content table {
    display: block; overflow-x: auto;
    border-collapse: collapse; font-size: 14px; margin: 24px 0;
}
.content th, .content td { padding: 6px 14px 6px 0; text-align: left; white-space: nowrap; }
.content th { font-weight: 600; border-bottom: 2px solid #ff3b3b; }
.content td { border-bottom: 1px solid #eee; }

/* On a phone, keep figures big enough to read and let them scroll sideways. */
@media (max-width: 600px) {
    .content p:has(> img[src$=".svg"]) { overflow-x: auto; }
    .content img[src$=".svg"] { max-width: none; width: 600px; margin: 24px 0 32px; }
}

@media (prefers-color-scheme: dark) {
    .content th { border-bottom-color: #ff6b6b; }
    .content td { border-bottom-color: #222; }
}

/* Lists: plain lines on pages, small grey dots inside posts. */
.content ul li { margin-bottom: 10px; }
#post-content ul { list-style: disc; padding-left: 1.3em; }
#post-content ul li::marker { color: #999; }

/* Home: the aside for résumé-parsing bots */
.intermission { font-size: 14px; margin-top: 28px; }
.intermission-label { color: #888; font-style: italic; }

/* ── Polish pass ─────────────────────────────────────────────────────── */
body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }

/* Links inside text: no gaps around the word, red underline like the nav. */
.content a {
    padding: 1px 2px;
    margin: 0 -2px;
    border-bottom: 1px solid #ff3b3b;
}

/* Where you are: the current page's nav link stays filled. */

/* Keyboard focus and text selection in the accent colour. */
a:focus-visible, button:focus-visible { outline: 2px solid #ff3b3b; outline-offset: 2px; }
::selection { background: #ff3b3b; color: #fff; }

/* Paragraphs breathe a little more. */
.content p { margin: 0 0 18px; }

@media (prefers-color-scheme: dark) {
    .content a { border-bottom-color: #ff6b6b; }
    a:focus-visible, button:focus-visible { outline-color: #ff6b6b; }
    ::selection { background: #ff6b6b; color: #0d0d0d; }
}

/* ── Microwave touches ───────────────────────────────────────────────── */

/* "You press a button": it is one. */
.micro-btn {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    border-bottom: 1px dashed #ff3b3b;
    padding: 0 1px;
    cursor: pointer;
}
.micro-btn:hover { color: #ff3b3b; }
.micro-btn:active { transform: translateY(1px); }

/* The plate: a red dot that goes once around the divider. */
.divider { position: relative; }
.plate {
    position: absolute; top: 50%; left: 0;
    width: 8px; height: 8px; margin-top: -4px;
    border-radius: 50%; background: #ff3b3b;
    opacity: 0;
}
.plate.go { animation: plate-spin 1.4s ease-in-out; }
@keyframes plate-spin {
    0% { left: 0; opacity: 1; }
    100% { left: calc(100% - 8px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .plate.go { animation-duration: 0.01s; }
}

@media (prefers-color-scheme: dark) {
    .micro-btn { border-bottom-color: #ff6b6b; }
    .micro-btn:hover { color: #ff6b6b; }
    .plate { background: #ff6b6b; }
}

/* ── Header: the site as a file tree ─────────────────────────────────── */
.tree { margin: 0; line-height: 1.6; }
.tree .name { margin: 0 0 2px; font-size: 22px; font-weight: 400; }
.tree .root { color: inherit; text-decoration: none; border: none; background: none; padding: 0; margin: 0; }
.tree .branch { font-size: 15px; white-space: pre; }
.tree .twig { color: #bbb; }
.tree .here { color: #888; }
.tree .branch a { color: #111; }

/* ── Links: the red underline draws itself in on hover ───────────────── */
.content a, .tree a {
    padding: 0; margin: 0; border: none; text-decoration: none;
    background-color: transparent;
    background-image: linear-gradient(#ff3b3b, #ff3b3b), linear-gradient(rgba(255, 59, 59, 0.35), rgba(255, 59, 59, 0.35));
    background-size: 0% 1px, 100% 1px;
    background-position: 0 100%, 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.3s ease, color 0.2s ease;
}
.content a:hover, .tree a:hover { background-color: transparent; color: inherit; background-size: 100% 1px, 100% 1px; }
.tree .root { background-image: none; }
.tree .root:hover { background-image: linear-gradient(#ff3b3b, #ff3b3b); background-size: 100% 1px; }

@media (prefers-color-scheme: dark) {
    .tree .twig { color: #555; }
    .tree .here { color: #888; }
    .tree .branch a { color: #e8e8e8; }
    .content a, .tree a {
        background-image: linear-gradient(#ff6b6b, #ff6b6b), linear-gradient(rgba(255, 107, 107, 0.4), rgba(255, 107, 107, 0.4));
    }
    .tree .root { background-image: none; }
    .tree .root:hover { background-image: linear-gradient(#ff6b6b, #ff6b6b); }
}

/* ── Every link hovers like your name: a red fill sweeps in ─────────── */
.content a, .tree a {
    background-image: linear-gradient(#ff3b3b, #ff3b3b), linear-gradient(rgba(255, 59, 59, 0.35), rgba(255, 59, 59, 0.35));
    background-size: 0% 100%, 100% 1px;
    background-position: 0 0, 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.3s ease;
}
.tree .root { background-image: linear-gradient(#ff3b3b, #ff3b3b); background-size: 0% 100%; }
.content a:hover, .tree a:hover {
    background-color: transparent;
    color: inherit;
    background-image: linear-gradient(#ff3b3b, #ff3b3b), linear-gradient(rgba(255, 59, 59, 0.35), rgba(255, 59, 59, 0.35));
    background-size: 100% 100%, 100% 1px;
    background-position: 0 0, 0 100%;
    background-repeat: no-repeat;
}
.tree .root:hover { background-size: 100% 100%; }
@media (prefers-color-scheme: dark) {
    .content a, .tree a {
        background-image: linear-gradient(#ff6b6b, #ff6b6b), linear-gradient(rgba(255, 107, 107, 0.4), rgba(255, 107, 107, 0.4));
    }
    .tree .root, .tree .root:hover { background-image: linear-gradient(#ff6b6b, #ff6b6b); }
    .content a:hover, .tree a:hover {
        background-image: linear-gradient(#ff6b6b, #ff6b6b), linear-gradient(rgba(255, 107, 107, 0.4), rgba(255, 107, 107, 0.4));
    }
}
/* Immediate, like a microwave button: no hover transitions. */
.content a, .tree a, .tree .root, .post-title a, .demo-link { transition: none; }

/* Hover: true red, white text, in both modes. */
.content a:hover, .tree a:hover, .tree .root:hover { color: #fff; }
@media (prefers-color-scheme: dark) {
    .tree .root:hover { background-image: linear-gradient(#ff3b3b, #ff3b3b); }
    .content a:hover, .tree a:hover {
        background-image: linear-gradient(#ff3b3b, #ff3b3b), linear-gradient(rgba(255, 59, 59, 0.35), rgba(255, 59, 59, 0.35));
    }
    .content a:hover, .tree a:hover, .tree .root:hover { color: #fff; }
}

/* ── The receipt: measured, not claimed ──────────────────────────────── */
.footer-divider { margin: 72px 0 12px; }
.receipt { display: inline-block; margin: 0; padding: 1px 5px; border: 1px solid #ddd; line-height: 1.5; font-size: 13px; font-style: italic; color: #999; }
.receipt a { color: inherit; }
.tree .file-meta { color: #aaa; font-variant-numeric: tabular-nums; }

/* ── Other writings ──────────────────────────────────────────────────── */
.others li { margin-bottom: 18px; }
.other-meta { font-size: 13px; color: #999; white-space: pre-wrap; }
@media (prefers-color-scheme: dark) {
    .receipt { color: #777; border-color: #2a2a2a; }
    .tree .file-meta { color: #666; }
    .other-meta { color: #777; }
}
@media (max-width: 600px) {
    .tree .file-meta { display: block; padding-left: 8ch; }
}
.receipt:has([data-receipt]:empty) { visibility: hidden; }
.receipt a { text-decoration: underline; text-decoration-color: #ccc; text-underline-offset: 3px; }
.receipt a:hover { color: #ff3b3b; text-decoration-color: #ff3b3b; }

.tree .here.empty { color: #bbb; }
@media (prefers-color-scheme: dark) { .tree .here.empty { color: #555; } }
.tree .file-meta .changed { color: inherit; background: none; text-decoration: underline; text-decoration-color: #ccc; text-underline-offset: 3px; }
.tree .file-meta .changed:hover { color: #ff3b3b; text-decoration-color: #ff3b3b; }
.missing { color: #ff3b3b; }
