/* The blog in the look of changkun.de and its library: latere.ai's ink
 * palette, neutral grays with the ink itself as the accent and one navy
 * for links, and Inter for everything but code. Chinese falls back to the
 * system's own faces, which Inter lacks. */
:root {
    --bg: #ffffff;
    --bg-raised: #f4f4f4;
    --bg-code: #f7f7f7;
    --text: #0d0d0d;
    --text-prose: #262626;
    --text-secondary: #525252;
    --text-muted: #666666;
    --navy: #38538f;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.14);
    --shadow: 0 20px 80px rgba(0, 0, 0, 0.18);
    --photo-shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 6px 20px rgba(0, 0, 0, 0.10);
    --sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Noto Sans CJK SC', 'Microsoft YaHei', sans-serif;
    /* For the math in a figure's labels, set as TeX sets it. */
    --serif: 'STIX Two Text', 'Times New Roman', Times, 'Songti SC', serif;
    --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'PingFang SC', monospace;
    --measure: 700px;
    --rail: 232px;
    --wide: 1120px;
    --gutter: 24px;
    /* The fixed header's height, kept by the script after the header;
     * the page starts below it and anchors stop clear of it. */
    --header-h: 69px;
}

[data-theme="dark"] {
    --bg: #161616;
    --bg-raised: #262626;
    --bg-code: #1d1d1d;
    --text: #ececec;
    --text-prose: #d4d4d4;
    --text-secondary: #b4b4b4;
    --text-muted: #9a9a9a;
    --navy: #9bb0e4;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);
    --shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
    --photo-shadow: 0 1px 2px rgba(0, 0, 0, 0.40), 0 6px 20px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
}

* { box-sizing: border-box; }

html { scroll-padding-top: calc(var(--header-h) + 24px); }

body {
    margin: 0;
    padding-top: var(--header-h);
    background: var(--bg);
    color: var(--text-secondary);
    font: 15px/1.65 var(--sans);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background-color 0.3s, color 0.3s;
}

::selection { background: #555; color: #fff; }

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

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--text);
    outline-offset: 2px;
    border-radius: 4px;
}

button { font: inherit; color: inherit; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

svg { width: 16px; height: 16px; flex: none; }

.eyebrow { font-size: 14px; color: var(--text-muted); }

/* ---- Header ---- */

/* Fixed, as the library's, so an elastic scroll past the top moves the
 * page under it and not the header itself. */
.site-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s;
}

/* As the library's header: 16px at the top and right puts the theme
 * button where the home page has it. */
.header-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 16px 16px clamp(16px, 2vw, 24px);
}

.brand {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-right: auto;
    font-weight: 600;
    white-space: nowrap;
}

.brand a { color: var(--text); }

.brand .sep { color: var(--text-secondary); font-weight: 400; }

.site-nav { display: flex; align-items: center; gap: 20px; }

/* The header's links read as plain text links. */
.site-nav a { color: var(--text-secondary); white-space: nowrap; }

.site-nav a[aria-current] { color: var(--text); }

.site-nav a:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }

/* The language and theme buttons, a pair of the home page's button. */
.header-actions { display: flex; align-items: center; gap: 8px; }

.lang-toggle,
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
}

.lang-toggle { font-size: 13px; font-weight: 500; white-space: nowrap; }

.lang-toggle:hover,
.theme-toggle:hover { color: var(--text); background: var(--bg-raised); }

.theme-toggle svg { width: 18px; height: 18px; }

[data-theme="light"] .icon-sun,
[data-theme="dark"] .icon-moon { display: none; }

/* ---- Frame ---- */

.main {
    max-width: calc(var(--wide) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 0 var(--gutter);
}

/* One reading column; with contents, a rail beside it on a wide screen. */
.page,
.stream,
.archive,
.intro { max-width: var(--measure); margin: 0 auto; }

.page.has-toc { max-width: var(--measure); }

.toc-rail { display: none; }

@media (min-width: 1180px) {
    .page.has-toc {
        display: grid;
        grid-template-columns: minmax(0, var(--measure)) var(--rail);
        justify-content: center;
        gap: 64px;
        max-width: none;
    }
    .toc-rail {
        display: block;
        position: sticky;
        top: calc(var(--header-h) + 24px);
        align-self: start;
        max-height: calc(100vh - var(--header-h) - 48px);
        margin-top: 56px;
        overflow-y: auto;
        scrollbar-width: thin;
    }
    .toc-inline { display: none; }
}

.toc-label { margin-bottom: 10px; font-size: 13px; color: var(--text-muted); }

.toc ul { margin: 0; padding: 0; list-style: none; }

.toc ul ul { padding-left: 12px; }

.toc li { margin: 0; }

.toc a {
    display: block;
    padding: 4px 0 4px 10px;
    border-left: 1px solid var(--border);
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-secondary);
    transition: color 0.2s, border-color 0.2s;
}

.toc a:hover { color: var(--text); }

.toc a[aria-current] { color: var(--text); border-left-color: var(--text); }

.idea-toc-year > strong {
    display: block;
    margin: 10px 0 4px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.idea-toc-year:first-child > strong { margin-top: 0; }

.idea-toc-date { font-variant-numeric: tabular-nums; color: var(--text-muted); margin-right: 4px; }

.toc-inline {
    margin: 0 0 32px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0 16px;
}

.toc-inline summary {
    padding: 12px 0;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
}

.toc-inline[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 8px; }

.toc-inline .toc { padding-bottom: 12px; }

/* ---- Front page ---- */

/* The portrait beside the name; on a phone the role and bio take the
 * full width below both, as the research page's header does. */
.intro {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 32px;
    padding: 56px 0 40px;
}

.intro-portrait { grid-row: 1 / span 2; }

.intro-name-block { align-self: end; }

.intro-about { align-self: start; }

.intro-portrait {
    width: 130px;
    height: 130px;
    border-radius: 12px;
    box-shadow: var(--photo-shadow);
    object-fit: cover;
}

.intro-name {
    margin: 0;
    font: 600 clamp(30px, 5vw, 38px)/1.15 var(--sans);
    letter-spacing: -0.02em;
    color: var(--text);
}

/* Inter's C stands off its left edge; this sets it on the text's line. */
.intro-name .lang-en { margin-left: -0.05em; }

.intro-role { margin: 10px 0 0; font-size: 16px; color: var(--navy); }

.intro-bio { margin: 4px 0 0; font-size: 15px; line-height: 1.65; }

/* ---- Stream: posts and ideas ---- */

.entry,
.idea-card { padding: 32px 0; border-top: 1px solid var(--border); }

.entry-meta,
.idea-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

.kind { font-weight: 500; color: var(--navy); }

.entry-title,
.idea-title {
    margin: 8px 0 10px;
    font: 600 22px/1.3 var(--sans);
    letter-spacing: -0.015em;
    color: var(--text);
    text-wrap: balance;
}

.entry-title a,
.idea-title a { color: inherit; transition: color 0.2s; }

.entry-title a:hover,
.idea-title a:hover { color: var(--navy); }

.entry-summary p { margin: 0; font-size: 15.5px; line-height: 1.7; }

.entry-more {
    display: inline-block;
    margin-top: 12px;
    font-size: 14px;
    font-weight: 500;
}

.entry-more:hover { text-decoration: underline; text-underline-offset: 3px; }

.idea-share,
.idea-stat {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--text-muted);
}

.idea-share {
    padding: 2px;
    border: 0;
    background: none;
    cursor: pointer;
    transition: color 0.2s;
}

.idea-share:hover { color: var(--text); }

.idea-stat svg { width: 13px; height: 13px; }

.idea-body { font-size: 15.5px; }

/* A deep dive is folded in the stream and open on the idea's own page.
 * It is generated text, so it reads as a quieter panel apart from the
 * idea: smaller type in the secondary tone, its disclaimer as a label,
 * its headings at the size of the text. */
.idea-augmented {
    display: none;
    margin-top: 28px;
    padding: 18px 22px 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-code);
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--text-secondary);
}

.post-type-normal .idea-augmented { display: block; }

.prose .idea-augmented > p:first-child {
    margin-bottom: 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

.prose .idea-augmented > p:first-child em { font-style: normal; }

.prose .idea-augmented h1,
.prose .idea-augmented h2,
.prose .idea-augmented h3,
.prose .idea-augmented h4 {
    margin: 1.4em 0 0.4em;
    font: 600 15px/1.45 var(--sans);
    color: var(--text);
}

.prose .idea-augmented h3,
.prose .idea-augmented h4 { font-size: 14.5px; }

/* The generated text opens in more than one shape: a rule may follow the
 * disclaimer, the title may be a first or second level heading, a rule
 * may follow it. The panel frames the section already, so those rules
 * go, and whichever heading comes first is the panel's title. */
.prose .idea-augmented > p:first-child + hr,
.prose .idea-augmented > p:first-child + h1 + hr,
.prose .idea-augmented > p:first-child + h2 + hr,
.prose .idea-augmented > p:first-child + hr + h1 + hr,
.prose .idea-augmented > p:first-child + hr + h2 + hr { display: none; }

.prose .idea-augmented > p:first-child + h1,
.prose .idea-augmented > p:first-child + h2,
.prose .idea-augmented > p:first-child + hr + h1,
.prose .idea-augmented > p:first-child + hr + h2 { margin-top: 0; font-size: 16.5px; }

.prose .idea-augmented hr { margin: 1.4em 0; }

.prose .idea-augmented p,
.prose .idea-augmented li { font-size: inherit; }

.prose .idea-augmented strong { color: var(--text); }

.prose .idea-augmented blockquote { font-size: inherit; }

.prose .idea-augmented pre { font-size: 12.5px; }

.idea-toggle {
    display: inline-flex;
    align-items: center;
    height: 26px;
    margin-top: 16px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: none;
    font: 500 13px/1 var(--sans);
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.idea-toggle:hover { color: var(--navy); border-color: var(--navy); }

/* ---- Ideas page ---- */

.ideas-stream { min-width: 0; }

.ideas-header { padding: 56px 0 24px; }

.ideas-header .archive-title { margin: 0 0 12px; }

.ideas-intro { margin: 0 0 16px; font-size: 15.5px; }

.ideas-intro p { margin: 0; }

.ideas-search-wrap { display: flex; align-items: center; gap: 10px; }

.compose-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: none;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
}

.compose-btn:hover { color: var(--text); background: var(--bg-raised); }

.ideas-search-box { position: relative; flex: 1; min-width: 0; }

.ideas-search {
    width: 100%;
    height: 36px;
    padding: 0 32px 0 12px;
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    background: none;
    color: var(--text);
    font: 14px var(--sans);
    outline: none;
    transition: border-color 0.2s;
}

.ideas-search:focus { border-color: var(--text-muted); }

.ideas-search::placeholder { color: var(--text-muted); }

.ideas-search-clear {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.ideas-search-clear:hover { color: var(--text); background: var(--bg-raised); }

.ideas-count { flex: none; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-muted); }

.page-ideas .idea-card:first-of-type { border-top: 1px solid var(--border); }

/* ---- Article ---- */

.article { min-width: 0; }

.article-header { padding: 56px 0 28px; }

.article-title {
    margin: 0;
    font: 600 clamp(30px, 5vw, 38px)/1.2 var(--sans);
    letter-spacing: -0.02em;
    color: var(--text);
    text-wrap: balance;
}

.article-header > .article-title:first-child { margin-top: 0; }

.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    margin-top: 14px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-muted);
}

/* ---- Prose: the body of a post, an idea and a page ---- */

.prose {
    font-size: 16.5px;
    line-height: 1.75;
    color: var(--text-prose);
    overflow-wrap: break-word;
}

.prose > :first-child,
.prose .lang-en > :first-child,
.prose .lang-zh > :first-child { margin-top: 0; }

.prose p { margin: 0 0 1.1em; }

.prose h1,
.prose h2 {
    margin: 2em 0 0.6em;
    font: 600 24px/1.3 var(--sans);
    letter-spacing: -0.015em;
    color: var(--text);
}

.prose h3 {
    margin: 1.9em 0 0.5em;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--text);
}

.prose h4,
.prose h5,
.prose h6 {
    margin: 1.6em 0 0.4em;
    font-size: 16.5px;
    font-weight: 600;
    color: var(--text);
}

/* An idea's own headings sit under its title, so they stay small. */
.prose.idea-body h1,
.prose.idea-body h2,
.prose.idea-body h3 { font: 600 18px/1.4 var(--sans); margin: 1.6em 0 0.5em; }

.prose a {
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
    text-underline-offset: 3px;
    transition: text-decoration-color 0.2s;
}

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

.prose strong { color: var(--text); font-weight: 600; }

.prose blockquote {
    margin: 1.4em 0;
    padding: 2px 0 2px 18px;
    border-left: 2px solid var(--border-strong);
    color: var(--text-secondary);
}

.prose blockquote p:last-child { margin-bottom: 0; }

.prose ul,
.prose ol { margin: 0 0 1.1em; padding-left: 1.4em; }

.prose li { margin: 0.3em 0; }

.prose li > ul,
.prose li > ol { margin: 0.3em 0 0; }

.prose img,
.prose video,
.prose iframe {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 1.6em auto;
    border-radius: 8px;
}

.prose figure { margin: 1.6em 0; }

.prose figcaption { margin-top: -0.8em; font-size: 13.5px; text-align: center; color: var(--text-muted); }

.prose hr { margin: 2.5em 0; border: 0; border-top: 1px solid var(--border); }

.prose table {
    display: block;
    width: max-content;
    max-width: 100%;
    margin: 1.4em 0;
    overflow-x: auto;
    border-collapse: collapse;
    font-size: 14.5px;
    line-height: 1.5;
}

.prose th,
.prose td { padding: 8px 14px 8px 0; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }

.prose th { font-weight: 600; color: var(--text); border-bottom-color: var(--border-strong); }

.prose code,
.prose kbd {
    padding: 0.12em 0.38em;
    border-radius: 4px;
    background: var(--bg-raised);
    font: 0.86em var(--mono);
}

.prose pre {
    margin: 1.4em 0;
    padding: 16px 18px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-code);
    font: 13.5px/1.6 var(--mono);
    color: var(--text);
    tab-size: 4;
}

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

/* Hugo's highlighter sets numbered code as a table of two cells. */
.prose .highlight { margin: 1.4em 0; }

.prose .highlight > .chroma {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg-code);
}

.prose .highlight pre { margin: 0; border: 0; border-radius: 0; background: none; }

.prose .lntable {
    display: table;
    width: 100%;
    max-width: none;
    margin: 0;
    border-spacing: 0;
    font-size: inherit;
}

.prose .lntd { padding: 0; border: 0; vertical-align: top; }

.prose .lntd:first-child pre {
    padding-right: 12px;
    border-right: 1px solid var(--border);
    color: var(--text-muted);
    text-align: right;
    user-select: none;
}

.prose .lntd:last-child { width: 100%; }

.prose .footnotes { margin-top: 3em; font-size: 14px; color: var(--text-secondary); }

.prose .footnotes hr { margin: 0 0 1.2em; }

.prose .MathJax_Display { overflow-x: auto; overflow-y: hidden; }

/* Colors old posts set inline, taken into the palette without editing the
 * posts: their red, the Bio's questions among them, becomes the navy; the
 * plum becomes the violet; and a hard-coded black follows the text, so it
 * does not vanish on the dark page. */
.prose [style*="#ff0000" i],
.prose [style*="color: red" i],
.prose [style*="color:red" i] { color: var(--navy) !important; font-weight: 600; }
.prose [style*="#993366" i] { color: var(--code-keyword) !important; }
.prose [style*="#000000" i],
.prose [style*="color: black" i] { color: inherit !important; }

/* ---- Interactive figures (ifig.js) ---- */

.ifig { margin: 1.8em 0 0.6em; }

.ifig-stage { position: relative; width: 100%; }

.ifig-stage svg { display: block; width: 100%; height: auto; overflow: visible; }

.ifig-stage text { fill: var(--text-secondary); font-family: var(--sans); font-size: 12.5px; }

.ifig-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    margin-top: 12px;
    font-size: 13px;
    line-height: 1.4;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
}

.ifig-button {
    height: 28px;
    padding: 0 11px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: none;
    font: 500 13px var(--sans);
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
}

.ifig-button:hover:not(:disabled) { color: var(--navy); border-color: var(--navy); }

.ifig-button:disabled { opacity: 0.45; cursor: default; }

.ifig-button[aria-pressed="true"] { color: var(--bg); background: var(--text); border-color: var(--text); }

.ifig-slider { display: inline-flex; align-items: center; gap: 8px; }

.ifig-slider input { width: 120px; accent-color: var(--navy); }

.ifig-slider-value { min-width: 3.2em; color: var(--text-secondary); }

.ifig-readout { margin-left: auto; color: var(--text-secondary); }

/* ---- Article footer ---- */

.article-footer { padding: 16px 0 24px; }

.tags,
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

.tags { margin: 8px 0 32px; }

.tag {
    display: inline-flex;
    align-items: baseline;
    padding: 3px 10px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-secondary);
    transition: color 0.2s, border-color 0.2s;
}

.tag:hover { color: var(--navy); border-color: var(--navy); }

.tag-count { margin-left: 6px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--text-muted); }

.article-license {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 2px 12px;
    margin: 0 0 32px;
    padding: 16px 18px;
    border-radius: 12px;
    background: var(--bg-raised);
    font-size: 13.5px;
}

.article-license dt { font-weight: 600; color: var(--text); }

.article-license dd { margin: 0; overflow-wrap: anywhere; }

.article-license .article-license-note { grid-column: 1 / -1; margin-top: 6px; color: var(--text-muted); }

.prenext {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin: 0 0 32px;
    padding: 16px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    font-size: 14.5px;
    line-height: 1.45;
}

.prenext a { color: var(--text-secondary); transition: color 0.2s; }

.prenext a:hover { color: var(--navy); }

.prenext-older { text-align: right; }

.prenext-dir { color: var(--text-muted); }

.feedback {
    display: flex;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
}

.feedback svg { width: 20px; height: 20px; margin-top: 2px; color: var(--text-muted); }

.feedback p { margin: 0; }

.feedback-heading { font-weight: 600; color: var(--text); }

.feedback-desc { margin: 2px 0 8px !important; }

.feedback a { font-weight: 500; }

/* ---- Archive, tags ---- */

.archive-header { padding: 56px 0 8px; }

.archive-title { margin: 6px 0 0; font: 600 clamp(30px, 5vw, 38px)/1.15 var(--sans); letter-spacing: -0.02em; color: var(--text); }

.archive-header .archive-title:first-child { margin-top: 0; }

.archive-count { margin: 10px 0 0; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-muted); }

.archive-year {
    margin: 40px 0 8px;
    font: 600 22px/1.2 var(--sans);
    letter-spacing: -0.015em;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.archive-list { margin: 0; padding: 0; list-style: none; }

.archive-list li {
    display: flex;
    gap: 18px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    line-height: 1.45;
}

.archive-list time { flex: none; width: 44px; padding-top: 1px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--text-muted); }

.archive-list a { color: var(--text); transition: color 0.2s; }

.archive-list a:hover { color: var(--navy); }

/* The cloud is words, no chips: sized by use, set on one baseline so a
 * row of mixed sizes reads as a line, and centered as a block. The tags
 * used ten times or more take the ink. */
.tag-cloud {
    justify-content: center;
    align-items: baseline;
    gap: 10px 20px;
    padding: 32px 0 16px;
    line-height: 1.3;
}

.archive-cloud .archive-header { text-align: center; }

.cloud-tag { color: var(--text-secondary); transition: color 0.2s; }

.cloud-tag-major { color: var(--text); }

.cloud-tag:hover { color: var(--navy); }

.cloud-tag:hover .tag-count { color: var(--navy); }

.cloud-tag .tag-count { margin-left: 3px; font-size: 10.5px; vertical-align: super; line-height: 0; }

/* ---- Pagination ---- */

.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 40px 0 56px;
}

.pagination > * {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
    color: var(--text-secondary);
    transition: color 0.2s, background-color 0.2s;
}

.pagination a:hover { color: var(--text); background: var(--bg-raised); }

.pagination [aria-current] { background: var(--text); color: var(--bg); }

/* ---- Footer ---- */

.site-footer { margin-top: 32px; border-top: 1px solid var(--border); }

.footer-inner {
    max-width: calc(var(--wide) + 2 * var(--gutter));
    margin: 0 auto;
    padding: 28px var(--gutter) 40px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-profiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; margin-bottom: 14px; }

.footer-profiles a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: var(--text-muted);
    transition: color 0.2s, background-color 0.2s;
}

.footer-profiles a:hover { color: var(--navy); background: var(--bg-raised); }

.footer-friends,
.footer-copyright { margin: 0 0 6px; }

.footer-label { margin-right: 6px; }

.footer-friends a,
.footer-copyright a { color: var(--text-muted); }

.footer-friends a:hover,
.footer-copyright a:hover { color: var(--text-secondary); }

.footer-stat { margin-left: 8px; font-variant-numeric: tabular-nums; }

/* ---- Compose: the new-idea window of the ideas page ---- */

.compose-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2080;
    background: rgba(0, 0, 0, 0.35);
}

/* The window reads like the idea it will become: the title in the face of
 * an idea's title, the text at the size of its body, and Preview renders it
 * with the page's own styles. Expanded, it writes and previews side by side. */
.compose-window {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    z-index: 2090;
    flex-direction: column;
    width: min(760px, calc(100vw - 48px));
    height: min(720px, calc(100vh - 80px));
    overflow: hidden;
    transform: translate(-50%, -50%);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    background: var(--bg);
    box-shadow: var(--shadow);
    font-family: var(--sans);
}

.compose-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 10px 10px 22px;
    border-bottom: 1px solid var(--border);
}

.compose-heading {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.5;
    font-variant-numeric: tabular-nums;
    color: var(--text-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.compose-date::after { content: ' · '; }

.compose-modes {
    display: inline-flex;
    flex: none;
    padding: 2px;
    border-radius: 8px;
    background: var(--bg-raised);
}

.compose-mode {
    padding: 3px 12px;
    border: 0;
    border-radius: 6px;
    background: none;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
}

.compose-mode:hover { color: var(--text); }

.compose-mode[aria-pressed="true"] {
    background: var(--bg);
    color: var(--text);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.compose-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s, background-color 0.2s;
}

.compose-icon:hover { color: var(--text); background: var(--bg-raised); }

.compose-expand-min,
.compose-window.expanded .compose-expand-max { display: none; }

.compose-window.expanded .compose-expand-min { display: block; }

.compose-body { display: flex; flex: 1; min-height: 0; }

/* Title and text scroll as one page, so the title moves out of the way of
 * a long text, and of a phone's keyboard. */
.compose-write { display: flex; flex: 1; flex-direction: column; min-width: 0; overflow-y: auto; }

.compose-title,
.compose-content {
    display: block;
    width: 100%;
    margin: 0;
    border: 0;
    background: transparent;
    outline: none;
    resize: none;
}

/* Both grow with what is in them, sized by compose.js; the text also
 * fills what is left of the window, so a click anywhere below lands in it. */
.compose-title {
    flex: none;
    padding: 28px 36px 0;
    overflow: hidden;
    font: 600 22px/1.3 var(--sans);
    letter-spacing: -0.015em;
    color: var(--text);
}

.compose-content {
    flex: 1 0 auto;
    padding: 14px 36px 28px;
    overflow: hidden;
    font: 16px/1.75 var(--sans);
    color: var(--text-prose);
}

.compose-title::placeholder,
.compose-content::placeholder { color: var(--text-muted); opacity: 1; }

.compose-preview { flex: 1; min-width: 0; padding: 28px 36px; overflow-y: auto; }

.compose-preview .idea-title { margin-top: 0; }

.compose-preview-empty { color: var(--text-muted); }

.compose-window[data-mode="write"] .compose-preview,
.compose-window[data-mode="preview"] .compose-write { display: none; }

.compose-footer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 8px 14px;
    border-top: 1px solid var(--border);
}

.compose-tools {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 2px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.compose-tools::-webkit-scrollbar { display: none; }

.compose-tools-sep { flex: none; width: 1px; height: 18px; margin: 0 6px; background: var(--border-strong); }

.compose-meta {
    flex: none;
    max-width: 45%;
    overflow: hidden;
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.compose-count { font-variant-numeric: tabular-nums; }

/* A status message, once there is one, takes the count's place. */
.compose-status:empty,
.compose-status:not(:empty) + .compose-count { display: none; }

.compose-send {
    flex: none;
    padding: 7px 18px;
    border: 0;
    border-radius: 6px;
    background: var(--text);
    color: var(--bg);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}

.compose-send:hover { opacity: 0.85; }

.compose-send:disabled { opacity: 0.5; cursor: default; }

/* Expanded, where there is room for both: write and preview side by side. */
@media (min-width: 721px) and (min-height: 521px) {
    .compose-window.expanded {
        width: min(1280px, calc(100vw - 48px));
        height: calc(100vh - 48px);
    }
    .compose-window.expanded .compose-modes { display: none; }
    .compose-window.expanded .compose-write { display: flex; }
    .compose-window.expanded .compose-preview { display: block; border-left: 1px solid var(--border); }
}

.compose-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    z-index: 3000;
    padding: 8px 20px;
    border-radius: 999px;
    background: var(--text);
    color: var(--bg);
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-50%) translateY(20px);
    transition: opacity 0.3s, transform 0.3s;
}

.compose-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Phones ---- */

@media (max-width: 720px) {
    :root { --gutter: 16px; --header-h: 102px; }
    .header-inner { flex-wrap: wrap; gap: 0 16px; padding-bottom: 0; }
    .site-nav {
        order: 3;
        width: calc(100% + 32px);
        margin: 4px -16px 0;
        padding: 0 16px;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .site-nav::-webkit-scrollbar { display: none; }
    .site-nav a { padding: 8px 0 12px; }
    .intro { column-gap: 16px; padding: 36px 0 28px; }
    .intro-portrait { grid-row: 1; width: 72px; height: 72px; }
    .intro-name-block { align-self: center; }
    .intro-about { grid-column: 1 / -1; margin-top: 14px; }
    .entry-title,
    .idea-title { font-size: 20px; }
    .article-header { padding: 36px 0 24px; }
    .archive-header { padding-top: 36px; }
    .prose { font-size: 16px; }
    .prose h1,
    .prose h2 { font-size: 22px; }
    .prose pre,
    .prose .highlight > .chroma { margin-left: calc(-1 * var(--gutter)); margin-right: calc(-1 * var(--gutter)); border-radius: 0; border-left: 0; border-right: 0; }
    .prose .highlight pre { margin: 0; }
    .ideas-count { display: none; }
    .idea-augmented { padding: 14px 16px 4px; }
    .prenext { grid-template-columns: 1fr; }
    .prenext-older { text-align: left; }
}

/* ---- Compose on phones, upright or on their side ---- */

@media (max-width: 720px), (max-height: 520px) {
    /* A full sheet that follows the visual viewport, which compose.js
     * reports, so the keyboard shrinks it instead of covering Post. 16px
     * text keeps iOS from zooming in on focus. */
    .compose-window,
    .compose-window.expanded {
        top: var(--compose-top, 0);
        left: 0;
        width: 100%;
        height: var(--compose-height, 100%);
        transform: none;
        border: 0;
        border-radius: 0;
    }
    .compose-header { padding: 6px 6px 6px 16px; }
    .compose-heading { font: 500 15px/1.4 var(--sans); color: var(--text); }
    .compose-date,
    .compose-expand,
    .compose-count,
    .compose-tools-sep { display: none; }
    .compose-mode { padding: 6px 14px; font-size: 14px; }
    .compose-icon { width: 40px; height: 40px; }
    .compose-icon svg { width: 18px; height: 18px; }
    .compose-title { padding: 18px 16px 0; font-size: 26px; }
    .compose-content { padding: 10px 16px 20px; }
    .compose-preview { padding: 18px 16px; }
    .compose-footer { gap: 8px; padding: 6px 8px 6px 4px; }
    .compose-tools .compose-icon { width: 35px; height: 40px; }
    .compose-send { padding: 9px 18px; font-size: 14px; }
}

/* ---- Print ---- */

@media print {
    body { padding-top: 0; }
    .site-header { position: static; }
    :root { --bg: #fff; --text: #000; --text-prose: #111; --text-secondary: #222; --text-muted: #444; --navy: #000; }
    .site-header .site-nav,
    .header-actions,
    .toc-rail,
    .toc-inline,
    .feedback,
    .prenext,
    .footer-profiles,
    .idea-toggle,
    .idea-share { display: none !important; }
    .prose { font-size: 11pt; }
    .prose pre { white-space: pre-wrap; }
}
/* Code colors for Hugo's highlighter (pygmentsUseClasses), the ones
 * latere.ai sets its code blocks in: keywords violet, strings green,
 * numbers and literals amber, names blue, variables red, comments the
 * muted text. Each is one of the palette's tones, per theme. */
:root {
    --code-comment: #666666;
    --code-keyword: #5b4a8f;
    --code-string: #356342;
    --code-number: #7d5019;
    --code-name: #38538f;
    --code-variable: #96372e;
    --code-line: rgba(56, 83, 143, 0.08);
}

[data-theme="dark"] {
    --code-comment: #9a9a9a;
    --code-keyword: #b8a9ea;
    --code-string: #86ba93;
    --code-number: #d1a56b;
    --code-name: #9bb0e4;
    --code-variable: #e99a90;
    --code-line: rgba(155, 176, 228, 0.1);
}

.chroma { color: var(--text); }
.chroma .hl { display: block; background: var(--code-line); }
.chroma .ln,
.chroma .lnt { color: var(--text-muted); }
.chroma .err { color: var(--code-variable); }

/* Comments */
.chroma .c, .chroma .ch, .chroma .cm, .chroma .c1, .chroma .cs { color: var(--code-comment); font-style: italic; }
.chroma .cp, .chroma .cpf { color: var(--code-keyword); }

/* Keywords and built-ins */
.chroma .k, .chroma .kc, .chroma .kd, .chroma .kn, .chroma .kp, .chroma .kr,
.chroma .ow, .chroma .nb, .chroma .bp { color: var(--code-keyword); }
.chroma .kt { color: var(--code-number); }

/* Names */
.chroma .na, .chroma .nc, .chroma .nd, .chroma .ne, .chroma .nf, .chroma .fm,
.chroma .ni, .chroma .nl, .chroma .nn, .chroma .nt, .chroma .no { color: var(--code-name); }
.chroma .nv, .chroma .vc, .chroma .vg, .chroma .vi, .chroma .vm { color: var(--code-variable); }

/* Literals */
.chroma .s, .chroma .sa, .chroma .sb, .chroma .sc, .chroma .dl, .chroma .sd,
.chroma .s2, .chroma .sh, .chroma .si, .chroma .sx, .chroma .s1, .chroma .ss { color: var(--code-string); }
.chroma .se, .chroma .sr { color: var(--code-number); }
.chroma .m, .chroma .mb, .chroma .mf, .chroma .mh, .chroma .mi, .chroma .il,
.chroma .mo, .chroma .l, .chroma .ld { color: var(--code-number); }

/* Operators and punctuation recede. */
.chroma .o, .chroma .p { color: var(--text-secondary); }

/* Diffs and shell sessions */
.chroma .gd { color: var(--code-variable); }
.chroma .gi { color: var(--code-string); }
.chroma .gh, .chroma .gu { color: var(--code-name); font-weight: 600; }
.chroma .ge { font-style: italic; }
.chroma .gs { font-weight: 600; }
.chroma .gp { color: var(--text-muted); user-select: none; }
.chroma .go { color: var(--text-secondary); }
.chroma .gr, .chroma .gt { color: var(--code-variable); }
